@font-face { font-family: 'Fredoka'; src: url(../fonts/fredoka.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url(../fonts/baloo2-deva.woff2) format('woff2'); font-weight: 400 800; font-display: swap; unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8E0-A8FF; }
:root {
  --bg1: #1d2147; --bg2: #0e1024; --text: #f3f4ff; --muted: #b9bce6; --panel: rgba(20,23,52,.72); --panel2: rgba(255,255,255,.12);
  --line: rgba(255,255,255,.16); --accent: #ffb020; --accent-t: #2a1a00; --good: #5cc46a; --bad: #ff4d5e; --shadow: 0 10px 30px rgba(0,0,0,.4);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e1024; }
body { color: var(--text); font: 16px/1.35 'Fredoka', 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { display: block; }
#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.screen { position: absolute; inset: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: stretch;
  padding: max(10px, env(safe-area-inset-top)) max(14px, calc(50% - 250px)) max(10px, env(safe-area-inset-bottom)); }
.home { background: linear-gradient(180deg, rgba(14,16,36,.82) 0%, rgba(14,16,36,.55) 30%, rgba(14,16,36,.62) 62%, rgba(14,16,36,.92) 100%); }
.sp { flex: 1; }

/* common controls */
.icon { width: 48px; height: 48px; border-radius: 16px; background: var(--panel); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); backdrop-filter: blur(6px); }
.icon svg { width: 26px; height: 26px; }
.seg { display: inline-flex; background: var(--panel); border-radius: 16px; padding: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { min-width: 52px; height: 44px; border-radius: 13px; padding: 0 12px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-t); }
.seg.wide { display: flex; width: 100%; } .seg.wide button { flex: 1; height: 46px; font-size: 17px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 10px; border-radius: 22px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; font-size: 18px; }
.pill .coin, .chip .coin { width: 24px; height: 24px; }
.big { width: 100%; min-height: 62px; border-radius: 20px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 18px; font-size: 22px; font-weight: 700; }
.big > svg { width: 28px; height: 28px; flex: none; }
.big span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.big small { display: flex; gap: 4px; align-items: center; font-size: 14px; font-weight: 600; opacity: .8; } .big small svg { width: 15px; height: 15px; }
.big.primary { background: linear-gradient(180deg, #ffc247, #ff9f1c); color: #2a1a00; box-shadow: 0 6px 0 #c76f00, var(--shadow); }
.btn { min-height: 52px; border-radius: 16px; background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); padding: 0 14px; font-weight: 600; font-size: 17px; flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px; } .btn svg { width: 22px; height: 22px; }
.btn.primary { background: var(--accent); color: var(--accent-t); width: 100%; }
.icon:active, .big:active, .btn:active, .vcard:active, .sw:active, .pedal:active { transform: scale(.96); }

/* home */
.top { display: flex; gap: 8px; align-items: center; }
.hero { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 2.2vh 0 1.4vh; }
.logo { width: 68px; height: 68px; flex: none; border-radius: 18px; filter: drop-shadow(0 8px 16px rgba(0,0,0,.4)); }
.hero h1 { font-size: 36px; margin: 0; line-height: 1; letter-spacing: .3px; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.tag { color: var(--accent); margin: 4px 0 0; font-size: 16px; font-weight: 600; }
.lbl { font-size: 17px; font-weight: 600; margin: 0.6vh 2px 8px; color: var(--muted); text-align: center; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vcard { position: relative; border-radius: 22px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line), var(--shadow); padding: 10px 10px 12px;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; backdrop-filter: blur(6px); transition: box-shadow .15s, background .15s; }
.vcard.on { background: rgba(255,176,32,.16); box-shadow: inset 0 0 0 3px var(--accent), 0 0 24px rgba(255,176,32,.35); }
.vcard .pv { width: 100%; height: 16vh; min-height: 96px; max-height: 160px; border-radius: 14px; display: block; background: #7fb24a; }
.vcard b { font-size: 22px; text-align: center; margin-top: 4px; }
.vcard .tick { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-t); display: none; place-items: center; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.vcard .tick svg { width: 18px; height: 18px; } .vcard.on .tick { display: grid; }
.stat { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); text-align: left; }
.stat small { font-size: 13px; min-width: 62px; }
.bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,.14); overflow: hidden; }
.bar i { display: block; height: 100%; width: calc(var(--v) * 100%); background: linear-gradient(90deg, #2ec4b6, #7CFFB2); border-radius: 4px; }
.swrow { display: flex; align-items: center; gap: 10px; margin: 10px 2px 18px; min-height: 52px; }
.lbl2 { color: var(--muted); font-weight: 600; font-size: 15px; }
.sws { display: flex; gap: 10px; }
.sw { position: relative; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); }
.sw .dot { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
.sw.on { box-shadow: inset 0 0 0 3px var(--accent), 0 0 12px rgba(255,176,32,.5); }
.sw.lock .dot { opacity: .55; }
.sw .price { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; background: #14172e; border-radius: 9px; padding: 0 5px 0 2px; font-size: 11.5px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.sw .price .coin { width: 13px; height: 13px; }
.cname { font-size: 14px; color: var(--text); font-weight: 600; flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode { margin-bottom: 14px; }
.how { color: var(--muted); font-size: 13px; text-align: center; margin: 10px 6px 4px; }
.foot { margin-top: auto; padding-top: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; color: var(--muted); }
.foot a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none !important; }
.hud > * { pointer-events: none; }
.hud button, .hud .ov { pointer-events: auto; }
.hbar { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; align-items: flex-start; justify-content: space-between; }
.scorebox { text-align: center; display: flex; flex-direction: column; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.scorebox b { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.scorebox small { font-size: 13px; color: #e6e8ff; font-weight: 600; }
.chips { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 58px); left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 11px; border-radius: 14px; background: rgba(14,16,36,.62); box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.chip b { font-size: 17px; } .chip small { font-size: 12px; color: var(--muted); } .chip .coin { width: 18px; height: 18px; align-self: center; }
.chip.spd b { color: #7CFFB2; min-width: 2.2ch; text-align: right; }
.x2 { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 96px); left: 50%; transform: translateX(-50%) scale(.6); opacity: 0; transition: .2s; background: #ff9f1c; color: #2a1a00; font-weight: 700; border-radius: 12px; padding: 2px 12px; font-size: 18px; }
.x2.on { opacity: 1; transform: translateX(-50%) scale(1); animation: pulse 0.8s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.1); } }
.steer { position: absolute; left: 0; right: 0; top: 48%; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; transition: opacity .6s; }
.steer span { font-size: 64px; line-height: 1; color: rgba(255,255,255,.85); text-shadow: 0 2px 8px rgba(0,0,0,.5); animation: nudge 1s ease-in-out infinite alternate; }
.steer span:last-child { animation-direction: alternate-reverse; }
.steer em { font-style: normal; font-weight: 600; background: rgba(14,16,36,.7); padding: 6px 12px; border-radius: 12px; font-size: 15px; }
.steer.gone { opacity: 0; }
@keyframes nudge { to { transform: translateX(6px); } }
.pedals { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 14px; }
.pedal { width: 66px; height: 66px; border-radius: 50%; background: rgba(14,16,36,.62); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; touch-action: none; }
.pedal svg { width: 26px; height: 26px; } .pedal small { font-size: 11px; font-weight: 600; }
.pedal.brake.on { background: rgba(255,77,94,.85); } .pedal.hornb.on { background: rgba(255,176,32,.85); color: #2a1a00; }

/* overlays */
.ov { position: absolute; inset: 0; background: rgba(5,6,20,.55); display: grid; place-items: center; animation: fade .2s ease; backdrop-filter: blur(2px); }
.card { width: min(92vw, 400px); background: linear-gradient(180deg, #23285a, #161a3d); border-radius: 26px; padding: 20px 18px 18px; box-shadow: var(--shadow), inset 0 0 0 1px var(--line); animation: up .3s cubic-bezier(.2,.9,.3,1.2); }
.card h2 { margin: 2px 0 14px; text-align: center; font-size: 28px; }
.card .row { display: flex; gap: 10px; margin-top: 10px; }
.over { background: linear-gradient(180deg, rgba(5,6,20,.72) 0%, rgba(5,6,20,.6) 55%, rgba(5,6,20,0) 72%); justify-content: flex-start; }
.overcard { display: flex; flex-direction: column; gap: 8px; margin: max(4vh, 56px) auto 0; }
.big.second { min-height: 50px; font-size: 18px; margin-top: 2px; } .big.second > svg { width: 22px; height: 22px; }
.row2 { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; margin-top: 4px; } .row2 .big { font-size: 18px; min-height: 58px; padding: 6px 10px; gap: 8px; } .row2 .big > svg { width: 22px; height: 22px; } .row2 .big span { align-items: center; text-align: center; }
.overcard h2.crash { font-size: 34px; margin: 0; color: #ff6b6b; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.overcard .sub { text-align: center; color: var(--muted); margin: -6px 0 0; font-weight: 600; }
.final { text-align: center; display: flex; flex-direction: column; align-items: center; }
.final small { color: var(--muted); font-weight: 600; } .final b { font-size: 48px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.nb { background: linear-gradient(180deg, #ffc247, #ff9f1c); color: #2a1a00; font-weight: 700; padding: 3px 14px; border-radius: 12px; animation: pop .6s ease; }
.bst { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-weight: 600; } .bst svg { width: 18px; height: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 2px; }
.stats div { background: rgba(255,255,255,.07); border-radius: 14px; padding: 7px 4px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.stats b { font-size: 19px; } .stats small { font-size: 11.5px; line-height: 1.15; color: var(--muted); display: flex; align-items: center; gap: 3px; } .stats small .coin { width: 13px; height: 13px; }
#toast { position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px); background: #f3f4ff; color: #14172e; padding: 10px 16px; border-radius: 14px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; z-index: 30; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.shake { animation: shakeEl .3s ease; }
@keyframes shakeEl { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { 30% { transform: scale(1.25); } }
@media (max-height: 760px) { .hero { margin: 1.4vh 0 .8vh; } .logo { width: 58px; height: 58px; } .hero h1 { font-size: 32px; } .lbl { margin-bottom: 6px; } }
@media (max-height: 690px) { .hero { margin: 1vh 0 .6vh; } .logo { width: 52px; height: 52px; } .hero h1 { font-size: 30px; } .vcard .pv { height: 15vh; min-height: 84px; } .how { display: none; } .swrow { margin: 6px 2px 8px; } .big { min-height: 56px; } }
@media (min-height: 800px) { .hero { margin: 4vh 0 2.4vh; } .logo { width: 80px; height: 80px; } .hero h1 { font-size: 40px; } }
:lang(hi) .big span { line-height: 1.3; } :lang(hi) .big small { margin-top: 1px; }
