body.drive-page, body.drive-page * { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
body.drive-page main { min-height: 100dvh; background: radial-gradient(circle at 9% 18%, #fff 0 3px, transparent 4px), linear-gradient(#bfeaf2 0 300px, #fff8e7 300px); }
.drive-game { width: min(880px, calc(100% - 40px)); margin: 24px auto 42px; position: relative; z-index: 1; }
.drive-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; animation: drive-rise .5s ease-out both; }
.drive-heading > div:first-child > span { color: #2e7d87; font-size: 10px; letter-spacing: .16em; font-weight: 900; }
.drive-heading h1 { margin: 7px 0; font-size: clamp(38px, 5vw, 58px); line-height: 1; letter-spacing: -.05em; }
.drive-heading p { margin: 0; color: #526575; font-size: 13px; }
.drive-score { min-width: 112px; padding: 9px 14px; border: 3px solid var(--ink); border-radius: 18px; background: #e8dcff; box-shadow: 5px 5px 0 var(--ink); display: flex; align-items: center; justify-content: center; gap: 8px; }
.drive-score span { font-size: 30px; }
.drive-score b { color: #725ac6; font-size: 38px; line-height: 1; }
.drive-shell { overflow: hidden; border: 3px solid var(--ink); border-radius: 28px; background: #fff; box-shadow: 10px 10px 0 var(--ink); animation: drive-card-in .6s .08s cubic-bezier(.2,.8,.2,1) both; }
.drive-stage { position: relative; height: min(590px, 68dvh); min-height: 430px; overflow: hidden; background: #78ca83; touch-action: none; cursor: ew-resize; }
.drive-stage.is-stunned { cursor: not-allowed; }
.drive-stage.is-stunned::after { content: "💥"; position: absolute; z-index: 12; left: 50%; top: 48%; transform: translate(-50%,-50%); font-family: "Apple Color Emoji","Segoe UI Emoji",sans-serif; font-size: 92px; line-height: 1; pointer-events: none; animation: drive-stun-flash .82s ease-out both; }
.drive-road { position: absolute; inset: 0 12%; overflow: hidden; border-inline: 7px solid #fff; background: #5e6573; box-shadow: inset 10px 0 0 #4f5663, inset -10px 0 0 #4f5663; }
.drive-road::before, .drive-road::after { content: ""; position: absolute; z-index: 1; inset-block: 0; width: 7px; background: repeating-linear-gradient(to bottom, var(--yellow) 0 30px, #fff 30px 60px); }
.drive-road::before { left: 0; }
.drive-road::after { right: 0; }
.drive-lane { position: absolute; top: -70px; bottom: -70px; width: 5px; background: repeating-linear-gradient(to bottom, #fff 0 31px, transparent 31px 67px); opacity: .9; will-change: transform; }
.drive-lane-one { left: 33.333%; }
.drive-lane-two { left: 66.666%; }
.drive-grass { position: absolute; z-index: 1; top: -40px; bottom: 0; width: 11%; color: #fff; display: flex; flex-direction: column; justify-content: space-around; align-items: center; font-family: "Apple Color Emoji","Segoe UI Emoji",sans-serif; font-size: 31px; line-height: 3.6; filter: drop-shadow(0 4px 0 #25304722); pointer-events: none; }
.drive-grass-left { left: 0; }
.drive-grass-right { right: 0; }
.drive-items { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.drive-item { position: absolute; width: 60px; height: 60px; display: grid; place-items: center; font-family: "Apple Color Emoji","Segoe UI Emoji",sans-serif; font-size: 45px; line-height: 1; transform: translate(-50%,-50%); filter: drop-shadow(0 5px 0 #25304725); will-change: transform, top; }
.drive-item.is-star { animation: drive-star-spin 1.2s linear infinite; }
.drive-car { --steer: 0deg; --car-scale: 1; --vehicle-main: #ff607d; --vehicle-light: #ff7891; --vehicle-highlight: #ff9aad; --vehicle-dark: #d83d60; --vehicle-roof: #ff9aae; --vehicle-radius: 24px 24px 17px 17px; position: absolute; z-index: 6; left: 50%; top: 50%; width: 82px; height: 112px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; filter: drop-shadow(7px 8px 0 #25304738); transform: translate(-50%,-50%) rotate(var(--steer)) scale(var(--car-scale)); transform-origin: center; transition: filter .16s ease, transform .12s ease-out; pointer-events: none; will-change: left, top, transform; }
.drive-car::before, .drive-car::after { content: ""; position: absolute; z-index: 0; top: 23px; width: 9px; height: 24px; border: 3px solid var(--ink); border-radius: 6px; background: #253047; box-shadow: 0 44px 0 #253047, 0 44px 0 3px var(--ink); }
.drive-car::before { left: 4px; }
.drive-car::after { right: 4px; }
.drive-car-body { position: relative; z-index: 1; width: 62px; height: 102px; overflow: hidden; border: 4px solid var(--ink); border-radius: var(--vehicle-radius); background: linear-gradient(90deg, var(--vehicle-main) 0 13%, var(--vehicle-light) 13% 48%, var(--vehicle-main) 48% 100%); box-shadow: inset 0 5px 0 var(--vehicle-highlight), inset 0 -7px 0 var(--vehicle-dark); }
.drive-car-body::before, .drive-car-body::after { content: ""; position: absolute; left: 8px; right: 8px; border: 3px solid var(--ink); background: linear-gradient(135deg, #d9f7ff 0 35%, #7ccadd 36% 100%); }
.drive-car-body::before { top: 21px; height: 24px; border-radius: 12px 12px 7px 7px; }
.drive-car-body::after { bottom: 13px; height: 20px; border-radius: 6px 6px 10px 10px; background: linear-gradient(45deg, #6bbbd0 0 48%, #bcecf6 49% 100%); }
.drive-car-lights { position: absolute; z-index: 2; top: 7px; left: 8px; width: 11px; height: 8px; border: 2px solid var(--ink); border-radius: 7px 7px 4px 4px; background: #ffe76c; box-shadow: 31px 0 0 #ffe76c, 31px 0 0 2px var(--ink); }
.drive-car-roof { position: absolute; z-index: 2; left: 11px; top: 49px; width: 34px; height: 23px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 8px; background: var(--vehicle-roof); color: var(--ink); font-family: Arial,sans-serif; font-size: 10px; font-style: normal; font-weight: 1000; line-height: 1; }
.drive-car.vehicle-bus { --vehicle-main: #ffc948; --vehicle-light: #ffe37c; --vehicle-highlight: #fff0a5; --vehicle-dark: #d99a1d; --vehicle-roof: #fff2b8; --vehicle-radius: 15px; }
.drive-car.vehicle-bus .drive-car-body { width: 68px; height: 108px; }
.drive-car.vehicle-bus .drive-car-body::after { height: 25px; bottom: 9px; }
.drive-car.vehicle-fire { --vehicle-main: #ef3e4f; --vehicle-light: #ff6976; --vehicle-highlight: #ff9ca5; --vehicle-dark: #b91f34; --vehicle-roof: #fff1e8; --vehicle-radius: 17px; }
.drive-car.vehicle-fire .drive-car-roof { color: #c71f35; }
.drive-car.vehicle-police { --vehicle-main: #f7fbff; --vehicle-light: #dbeeff; --vehicle-highlight: #fff; --vehicle-dark: #3e79be; --vehicle-roof: #8fd5ff; --vehicle-radius: 21px 21px 16px 16px; }
.drive-car.vehicle-police .drive-car-roof { font-family: "Apple Color Emoji","Segoe UI Emoji",sans-serif; font-size: 15px; }
.drive-car.vehicle-icecream { --vehicle-main: #7ddfc5; --vehicle-light: #b7f3df; --vehicle-highlight: #dcfff3; --vehicle-dark: #39a992; --vehicle-roof: #ffd2e1; --vehicle-radius: 18px; }
.drive-car.vehicle-icecream .drive-car-roof { font-family: "Apple Color Emoji","Segoe UI Emoji",sans-serif; font-size: 17px; }
.drive-car.is-changing .drive-car-body { animation: drive-vehicle-change .45s cubic-bezier(.2,.8,.2,1); }
.drive-car.is-crashing { animation: drive-crash .48s ease-out; filter: drop-shadow(7px 7px 0 #ff6b8890); }
.drive-guide { position: absolute; z-index: 8; left: 50%; bottom: 162px; transform: translateX(-50%); min-width: 180px; padding: 12px 16px; border: 3px solid var(--ink); border-radius: 20px; background: #ffffffe6; box-shadow: 5px 5px 0 var(--ink); display: grid; grid-template-columns: auto auto; place-items: center; gap: 2px 8px; pointer-events: none; animation: drive-guide 1.4s ease-in-out infinite; }
.drive-guide span { grid-row: 1 / 3; font-size: 36px; }
.drive-guide b { font-size: 13px; }
.drive-guide i { font-style: normal; color: var(--pink); font-size: 25px; line-height: 1; }
.drive-actions { min-height: 64px; padding: 9px 15px; border-top: 3px solid var(--ink); background: #fff2bd; display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 12px; font-weight: 900; }
.drive-actions button { margin-left: auto; min-height: 43px; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 13px; background: var(--blue); box-shadow: 3px 3px 0 var(--ink); font-size: 13px; font-weight: 900; cursor: pointer; }
.drive-toast { position: fixed; z-index: 2000; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); padding: 13px 22px; border: 3px solid var(--ink); border-radius: 16px; background: var(--pink); color: #fff; box-shadow: 5px 5px 0 var(--ink); font-weight: 900; text-align: center; animation: drive-toast-in .3s ease-out; }
.drive-toast.is-warning { background: #f3a640; color: var(--ink); }
.drive-page footer { padding-bottom: env(safe-area-inset-bottom); }
@keyframes drive-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes drive-card-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes drive-guide { 50% { transform: translateX(-50%) scale(1.04); } }
@keyframes drive-star-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }
@keyframes drive-vehicle-change { 0% { transform: scale(.65); filter: brightness(1.4); } 55% { transform: scale(1.14); } 100% { transform: scale(1); filter: none; } }
@keyframes drive-crash { 20% { transform: translate(calc(-50% - 10px),-50%) rotate(-12deg) scale(var(--car-scale)); } 45% { transform: translate(calc(-50% + 10px),-50%) rotate(13deg) scale(var(--car-scale)); } 70% { transform: translate(calc(-50% - 5px),-50%) rotate(-7deg) scale(var(--car-scale)); } }
@keyframes drive-stun-flash { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.35); } 25% { opacity: 1; transform: translate(-50%,-50%) scale(1.15); } 70% { opacity: 1; transform: translate(-50%,-50%) scale(.95); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.8); } }
@keyframes drive-toast-in { from { opacity: 0; transform: translate(-50%,-15px); } to { opacity: 1; transform: translateX(-50%); } }
@media (max-width: 760px) {
  .drive-page .topbar { width: calc(100% - 22px); }
  .drive-game { width: calc(100% - 22px); margin: 12px auto 27px; }
  .drive-heading { align-items: center; gap: 8px; margin-bottom: 10px; }
  .drive-heading h1 { margin-block: 4px; font-size: 30px; }
  .drive-heading p { max-width: 225px; font-size: 10px; }
  .drive-score { min-width: 80px; padding: 6px 8px; box-shadow: 3px 3px 0 var(--ink); }
  .drive-score span { font-size: 22px; }
  .drive-score b { font-size: 29px; }
  .drive-shell { border-radius: 21px; box-shadow: 7px 7px 0 var(--ink); }
  .drive-stage { height: min(570px, 68dvh); min-height: 390px; }
  .drive-road { inset-inline: 8%; border-inline-width: 5px; }
  .drive-grass { width: 8%; font-size: 22px; }
  .drive-car { --car-scale: .88; width: 72px; height: 99px; }
  .drive-guide { bottom: 137px; min-width: 160px; padding: 9px 12px; }
  .drive-actions { min-height: 55px; padding: 7px 10px; gap: 10px; font-size: 10px; }
  .drive-actions button { min-height: 40px; padding-inline: 10px; font-size: 11px; }
  .drive-page footer { width: calc(100% - 22px); min-height: 50px; }
}
@media (max-height: 700px) and (max-width: 760px) {
  .drive-heading > div:first-child > span, .drive-heading p { display: none; }
  .drive-heading h1 { margin: 0; font-size: 27px; }
  .drive-stage { height: 420px; min-height: 350px; }
  .drive-actions { min-height: 48px; }
  .drive-page footer { min-height: 44px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .drive-heading, .drive-shell, .drive-guide, .drive-item.is-star, .drive-car.is-crashing, .drive-car.is-changing .drive-car-body, .drive-stage.is-stunned::after, .drive-toast { animation: none !important; }
}
