/* Khel ON Drive */
:root {
  --navy: #141721; --navy2: #1d2130; --navy3: #272c3f; --ink: #f5f3ff; --mute: #b9b6d6; --teal: #2fd4c8;
  --o: #ff9a3c; --p: #f04fa8; --v: #8b5cf6; --grad: linear-gradient(90deg, #ff9a3c, #f04fa8, #8b5cf6);
  --good: #34d058; --bad: #ff5a5f; --amber: #ffb000; --r: 18px;
  --head: Outfit, Nunito, system-ui, sans-serif; --body: Nunito, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--navy); color: var(--ink); font-family: var(--body); overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { min-height: 100%; }
[hidden] { display: none !important; }

/* ---------- front door ---------- */
#door { max-width: 980px; margin: 0 auto; padding: 14px 16px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.back { color: var(--mute); text-decoration: none; font-weight: 700; font-size: 15px; padding: 8px 4px; background: none; border: 0; }
.brand { font-family: var(--head); font-weight: 800; letter-spacing: .5px; font-size: 15px; }
.brand .k { color: #fff; } .brand .on { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero { position: relative; border-radius: 26px; overflow: hidden; padding: 26px 20px 22px; background: radial-gradient(120% 120% at 0% 0%, #3a2366 0%, #1d2130 55%), var(--navy2); margin-bottom: 16px; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.hero > * { position: relative; }
.hero h1 { font-family: var(--head); font-size: clamp(34px, 9vw, 56px); line-height: 1; margin: 0 0 8px; font-weight: 800; }
.hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: #d9d6f5; font-weight: 600; font-size: 16px; max-width: 520px; }
.cities { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 2px; }
.chip { border: 1px solid #3a3f58; background: rgba(20,23,33,.6); border-radius: 999px; padding: 7px 12px; font-weight: 800; font-size: 14px; }
.chip.live { background: var(--teal); color: #08221f; border-color: var(--teal); }
.chip.soon { color: var(--mute); font-weight: 700; }
.chip small { font-weight: 700; opacity: .8; margin-left: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { text-align: left; border: 0; border-radius: var(--r); padding: 16px; background: var(--navy2); box-shadow: inset 0 0 0 1px #2b3046; display: flex; flex-direction: column; gap: 6px; min-height: 118px; position: relative; overflow: hidden; }
.card:hover, .card:focus-visible { box-shadow: inset 0 0 0 2px var(--teal); outline: none; }
.card .ic { font-size: 28px; line-height: 1; }
.card h3 { margin: 0; font-family: var(--head); font-size: 20px; }
.card p { margin: 0; color: var(--mute); font-size: 14px; font-weight: 600; }
.card .meta { margin-top: auto; font-size: 13px; font-weight: 800; color: var(--teal); }
.card.big { background: linear-gradient(135deg, #2a1f4a, #1d2130 70%); }
.card.locked { opacity: .55; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.links button, .btn { border: 0; border-radius: 14px; padding: 11px 16px; background: var(--navy3); font-weight: 800; font-size: 15px; }
.btn.primary { background: var(--grad); color: #fff; }
.btn.teal { background: var(--teal); color: #08221f; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px #3a3f58; }
.btn:disabled { opacity: .45; cursor: default; }
h2.sec { font-family: var(--head); font-size: 24px; margin: 18px 0 10px; }
.sub { color: var(--mute); font-weight: 600; margin: -4px 0 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.tabs button { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 800; background: var(--navy3); }
.tabs button.on { background: var(--teal); color: #08221f; }
.zonehead { border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; background: var(--navy2); box-shadow: inset 0 0 0 1px #2b3046; }
.zonehead h3 { margin: 0 0 4px; font-family: var(--head); font-size: 22px; }
.zonehead p { margin: 0; color: var(--mute); font-weight: 600; }
.mlist { display: grid; gap: 10px; }
.mrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; text-align: left; border: 0; border-radius: 16px; padding: 14px; background: var(--navy2); box-shadow: inset 0 0 0 1px #2b3046; }
.mrow h4 { margin: 0 0 3px; font-family: var(--head); font-size: 18px; }
.mrow p { margin: 0; color: var(--mute); font-size: 14px; font-weight: 600; }
.mrow .tags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: #2b3046; color: #d9d6f5; }
.stars { font-size: 20px; letter-spacing: 2px; white-space: nowrap; color: #4a4f6a; }
.stars .s { color: #ffc93c; }
.opt { margin: 10px 0 14px; }
.opt > label { display: block; font-weight: 800; margin-bottom: 6px; color: #d9d6f5; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 0; border-radius: 12px; padding: 9px 12px; background: var(--navy3); font-weight: 800; }
.seg button.on { background: var(--teal); color: #08221f; }
.rides { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ride { border: 0; border-radius: 16px; background: var(--navy2); box-shadow: inset 0 0 0 1px #2b3046; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; }
.ride.on { box-shadow: inset 0 0 0 2px var(--teal); }
.ride canvas { width: 100%; height: 86px; }
.ride small { color: var(--mute); font-weight: 700; font-size: 12px; text-align: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 42px; height: 42px; border-radius: 50%; border: 3px solid transparent; position: relative; }
.sw.on { border-color: #fff; }
.sw.lock::after { content: '🔒'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; }
.note { color: var(--mute); font-size: 13px; font-weight: 700; margin-top: 8px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { border-radius: 16px; background: var(--navy2); box-shadow: inset 0 0 0 1px #2b3046; padding: 12px; text-align: center; }
.badge .bi { font-size: 30px; filter: grayscale(1) opacity(.4); }
.badge.got .bi { filter: none; }
.badge b { display: block; font-family: var(--head); margin: 4px 0 2px; }
.badge span { color: var(--mute); font-size: 12px; font-weight: 700; }
.rules { display: grid; gap: 10px; }
.rule { border-radius: 16px; background: var(--navy2); box-shadow: inset 0 0 0 1px #2b3046; padding: 12px 14px; display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: start; }
.rule .ri { font-size: 26px; }
.rule b { font-family: var(--head); font-size: 17px; }
.rule p { margin: 3px 0 0; color: var(--mute); font-weight: 600; font-size: 14px; }
.ghostcard { border-radius: 16px; padding: 14px; background: linear-gradient(135deg, #123a3a, #1d2130); box-shadow: inset 0 0 0 1px #2fd4c855; margin-bottom: 12px; }
.ghostcard b { font-family: var(--head); font-size: 18px; }
.foot { color: #6f6c8f; font-size: 12px; font-weight: 700; margin-top: 26px; line-height: 1.5; }

/* ---------- play ---------- */
#play { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; user-select: none; -webkit-user-select: none; touch-action: none; }
#views { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#views.split.side { flex-direction: row; }
.view { position: relative; flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.view canvas.world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#views.split:not(.side) .view.p2 { transform: rotate(180deg); }
#views.split .view + .view { border-top: 3px solid var(--navy); }
#views.split.side .view + .view { border-top: 0; border-left: 3px solid var(--navy); }
.hud { position: absolute; inset: 0; pointer-events: none; }
.gps { position: absolute; left: 10px; right: 112px; top: 10px; display: flex; align-items: center; gap: 10px; background: rgba(20,23,33,.86); border-radius: 16px; padding: 8px 12px; min-height: 58px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.gps .ga { width: 40px; height: 40px; flex: 0 0 40px; }
.gps .gt { font-weight: 800; font-size: 16px; line-height: 1.15; }
.gps .gs { color: var(--mute); font-weight: 700; font-size: 13px; }
.gps.goal { background: rgba(20,70,40,.9); }
.mini { position: absolute; right: 10px; top: 10px; width: 92px; height: 92px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(20,23,33,.9), 0 6px 18px rgba(0,0,0,.3); }
.speedo { position: absolute; left: 10px; top: 76px; display: flex; align-items: center; gap: 8px; background: rgba(20,23,33,.86); border-radius: 14px; padding: 6px 10px; }
.speedo .kmh { font-family: var(--head); font-weight: 800; font-size: 26px; min-width: 42px; text-align: right; }
.speedo .kmh small { font-size: 11px; color: var(--mute); display: block; line-height: 1; margin-top: -2px; }
.speedo .kmh.over { color: var(--bad); }
.limit { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 4px solid #e23b2e; color: #111; display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.counts { position: absolute; left: 10px; top: 128px; display: flex; gap: 6px; }
.counts span { background: rgba(20,23,33,.86); border-radius: 10px; padding: 4px 8px; font-weight: 800; font-size: 13px; }
.coach { position: absolute; left: 10px; right: 10px; top: 166px; background: rgba(139,92,246,.94); border-radius: 16px; padding: 10px 12px; font-weight: 800; font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.coach small { display: block; font-weight: 700; opacity: .85; font-size: 12px; margin-bottom: 2px; letter-spacing: .3px; text-transform: uppercase; }
.racebar { position: absolute; left: 10px; top: 10px; display: flex; gap: 8px; }
.racebar div { background: rgba(20,23,33,.86); border-radius: 14px; padding: 6px 12px; font-weight: 800; }
.racebar .pos { font-family: var(--head); font-size: 26px; }
.racebar .pos small { font-size: 13px; color: var(--mute); }
.racebar .lap, .racebar .tm { font-size: 15px; display: grid; place-items: center; }
.bigtxt { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-family: var(--head); font-weight: 800; font-size: 76px; text-shadow: 0 6px 20px rgba(0,0,0,.5); pointer-events: none; }
.vtoast { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); width: min(86%, 380px); background: rgba(160,30,40,.95); border-radius: 16px; padding: 10px 14px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pop .25s ease-out; }
.vtoast b { display: block; font-family: var(--head); font-size: 18px; }
.vtoast span { font-weight: 700; font-size: 13px; opacity: .95; }
.vtoast.ok { background: rgba(20,120,70,.95); }
.vtoast.info { background: rgba(30,90,160,.95); }
@keyframes pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* controls */
.pad { position: absolute; left: 0; right: 0; bottom: 0; height: 132px; pointer-events: none; }
.pad button { pointer-events: auto; position: absolute; border: 0; border-radius: 50%; background: rgba(20,23,33,.72); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), 0 4px 12px rgba(0,0,0,.3); display: grid; place-items: center; font-weight: 900; touch-action: none; }
.pad button.down { background: rgba(47,212,200,.85); color: #08221f; }
.pad .stL { left: 12px; bottom: 14px; width: 74px; height: 74px; font-size: 30px; }
.pad .stR { left: 94px; bottom: 14px; width: 74px; height: 74px; font-size: 30px; }
.pad .gas { right: 12px; bottom: 14px; width: 76px; height: 106px; border-radius: 20px; background: rgba(30,120,70,.82); font-size: 14px; }
.pad .brk { right: 96px; bottom: 14px; width: 76px; height: 76px; border-radius: 20px; background: rgba(150,40,50,.82); font-size: 14px; }
.pad .gas.down { background: #34d058; } .pad .brk.down { background: #ff5a5f; color: #fff; }
.pad .mid { pointer-events: none; position: absolute; left: 0; right: 0; bottom: 98px; display: flex; justify-content: center; gap: 8px; }
.pad .mid button { position: static; width: 46px; height: 46px; font-size: 19px; }
.pad .mid button.on { background: var(--amber); color: #2b1d00; }
.pad .mid button.lit { background: #ffe58a; color: #3a2b00; }
@media (min-width: 560px) { .pad .mid { bottom: 18px; } }
#views.split .pad { height: 110px; }
#views.split .pad .stL, #views.split .pad .stR { width: 62px; height: 62px; bottom: 10px; }
#views.split .pad .stR { left: 80px; }
#views.split .pad .gas { width: 66px; height: 86px; bottom: 10px; }
#views.split .pad .brk { width: 64px; height: 64px; right: 84px; bottom: 10px; }
#views.split .mini, #views.split .speedo { display: none; }
.beltcover { position: absolute; inset: 0; background: rgba(10,12,20,.62); display: grid; place-items: center; pointer-events: auto; padding: 20px; }
.beltcard { background: var(--navy2); border-radius: 22px; padding: 20px; max-width: 360px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.beltcard h3 { font-family: var(--head); margin: 0 0 6px; font-size: 22px; }
.beltcard p { color: var(--mute); font-weight: 600; margin: 0 0 14px; }
.beltbtn { font-size: 20px; padding: 16px 26px; border-radius: 18px; border: 0; background: var(--grad); color: #fff; font-weight: 900; }

/* dock */
#dock { flex: 0 0 auto; display: flex; justify-content: space-around; background: var(--navy); border-top: 1px solid #262a3b; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
#dock button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 800; color: #d9d6f5; padding: 4px 2px; border-radius: 10px; }
#dock .di { font-size: 18px; }
@media (max-height: 480px) and (orientation: landscape) {
  #dock button { flex-direction: row; gap: 6px; font-size: 12px; padding: 4px; } #dock .di { font-size: 15px; }
  .pad .mid { bottom: 14px; }
  .coach { top: 10px; left: auto; right: 112px; width: 300px; }
  .gps { right: auto; width: min(46%, 380px); }
}

/* sheet */
#sheet { position: fixed; inset: 0; background: rgba(8,10,18,.7); display: grid; place-items: center; z-index: 20; padding: 14px; }
.sheet-card { background: var(--navy2); border-radius: 24px; width: min(100%, 460px); max-height: calc(100% - 20px); overflow-y: auto; padding: 20px; box-shadow: 0 30px 70px rgba(0,0,0,.55); }
.sheet-card h2 { font-family: var(--head); margin: 0 0 6px; font-size: 26px; }
.sheet-card .lead { color: var(--mute); font-weight: 700; margin: 0 0 12px; }
.sheet-card .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.sheet-card .row .btn { flex: 1 1 auto; }
.bigstars { font-size: 42px; text-align: center; letter-spacing: 6px; margin: 6px 0 4px; color: #3a3f58; }
.bigstars .s { color: #ffc93c; animation: starpop .45s ease-out both; display: inline-block; }
.bigstars .s:nth-child(2) { animation-delay: .25s; } .bigstars .s:nth-child(3) { animation-delay: .5s; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.starlabels { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-size: 12px; font-weight: 800; color: var(--mute); margin-bottom: 10px; }
.starlabels .y { color: #ffc93c; }
.stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #2b3046; font-weight: 700; }
.stat b { font-family: var(--head); }
.vlist { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.vlist li { background: #2a1d26; border-radius: 12px; padding: 9px 12px; }
.vlist li b { display: block; color: #ffb3b5; }
.vlist li span { color: #e9d3d7; font-size: 13px; font-weight: 700; }
.vlist li.okk { background: #17301f; } .vlist li.okk b { color: #9ff0b5; }
.places { display: grid; gap: 6px; margin-top: 8px; }
.places .p { display: flex; justify-content: space-between; background: var(--navy3); border-radius: 12px; padding: 9px 12px; font-weight: 800; }
.places .p.me { box-shadow: inset 0 0 0 2px var(--teal); }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #2b3046; font-weight: 800; }
.toggle button { border: 0; border-radius: 999px; padding: 6px 14px; font-weight: 800; background: var(--navy3); min-width: 64px; }
.toggle button.on { background: var(--teal); color: #08221f; }
#toasts { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 30; display: grid; gap: 6px; pointer-events: none; }
#toasts div { background: #fff; color: #141721; font-weight: 800; border-radius: 12px; padding: 9px 14px; box-shadow: 0 8px 20px rgba(0,0,0,.35); animation: fadeup .3s ease-out; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } }
.gsub { margin: 4px 0 10px !important; } .mt6 { margin-top: 6px; } h2.sec.small { font-size: 19px; } .nightnote { margin: 12px 0 0 !important; } a.lnk { text-decoration: none; text-align: center; }
.cities button.chip { font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; }
.chip.live:not(.on) { background: rgba(47,212,200,.12); color: var(--teal); border-color: rgba(47,212,200,.5); }

/* ---------- parking puzzles ---------- */
.card.pzcard { background: linear-gradient(135deg, #12423f, #1d2130 70%); }
.pzgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pzl { border: 0; border-radius: 14px; background: var(--navy2); box-shadow: inset 0 0 0 1px #2b3046; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 92px; text-align: center; }
.pzl b { font-family: var(--head); font-size: 22px; }
.pzl span { font-size: 12px; font-weight: 700; color: var(--mute); line-height: 1.2; }
.pzl.done { box-shadow: inset 0 0 0 2px rgba(47,212,200,.55); }
.pzl.locked { opacity: .45; }
.pzl .stars { font-size: 14px; }
.pzplay { max-width: 600px; margin: 0 auto; }
.pzhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pzhead .sec { margin-bottom: 2px; }
.pzcount { text-align: center; background: var(--navy2); border-radius: 14px; padding: 6px 12px; min-width: 76px; box-shadow: inset 0 0 0 1px #2b3046; }
.pzcount b { display: block; font-family: var(--head); font-size: 28px; line-height: 1.05; }
.pzcount span { font-size: 12px; font-weight: 800; color: var(--mute); }
.pzcount em { display: block; font-style: normal; font-size: 12px; font-weight: 800; color: var(--teal); }
.pzboard { display: flex; justify-content: center; margin: 8px 0 10px; }
.pzboard canvas { display: block; border-radius: 14px; }
.pzpad { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-areas: "a b c" "d e f"; gap: 8px; max-width: 360px; margin: 0 auto 10px; position: relative; padding-left: 64px; }
.pzpad .pzlab { position: absolute; left: 0; font-size: 12px; font-weight: 900; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
.pzpad .pzlab.f { top: 20px; } .pzpad .pzlab.b { bottom: 20px; }
.pzmv { border: 0; border-radius: 14px; background: var(--navy3); min-height: 58px; font-size: 30px; font-weight: 900; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.pzmv:nth-child(-n+3) { background: #24453f; }
.pzmv:disabled { opacity: .3; cursor: default; }
.pzmv.hint { box-shadow: 0 0 0 3px var(--teal); }
.pzmv:active:not(:disabled) { transform: translateY(2px); }
.pzmv span { display: inline-block; transition: transform .25s; }
.pzbar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pzbar .btn { flex: 1 1 0; max-width: 170px; }
