:root{color-scheme:dark;--gold:#e7b777;--ink:#101822;--cream:#fae9c9}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#0c121a;color:var(--cream);font-family:system-ui,-apple-system,sans-serif;overscroll-behavior:none}body{background:radial-gradient(ellipse at 50% 0,#293b49,#0b1119 80%)}button,a,[role=slider]{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer;touch-action:none;user-select:none;-webkit-user-select:none}button:focus-visible,[role=slider]:focus-visible,a:focus-visible{outline:3px solid #ffdb92;outline-offset:3px}button:disabled{cursor:wait;opacity:.65}main{height:100svh;width:min(1680px,100%);margin:auto;padding:10px 14px;display:grid;grid-template-rows:48px minmax(0,1fr) 126px;gap:8px}.topbar{display:flex;align-items:center;gap:18px;padding:0 8px;background:linear-gradient(#17222c,#0d151e);border-bottom:1px solid #986b3d;box-shadow:0 5px 20px #0004;z-index:1}.brand{color:#ffa350;text-shadow:0 0 9px #ff7a3d88;text-decoration:none;font:italic 900 21px Impact,'Arial Narrow',sans-serif;letter-spacing:1px;white-space:nowrap}.brand span{color:#ffd795}h1{font:400 24px Impact,'Arial Narrow',sans-serif;letter-spacing:1.3px;color:#edcf9b;white-space:nowrap;margin:0;padding-left:16px;border-left:1px solid #736148}.hud{display:flex;align-items:center;justify-content:flex-end;gap:26px;flex:1}.score{font-size:10px;letter-spacing:1.4px;color:#d3ccbd;white-space:nowrap}.score b{font:400 28px Impact,'Arial Narrow',sans-serif;letter-spacing:1px;color:#ffca70;margin-left:6px;display:inline-block}.round{font:400 13px Impact,sans-serif;text-align:center;letter-spacing:1px;min-width:110px}.round small{display:block;font:10px system-ui;letter-spacing:1.3px;color:#c7a77f;margin-top:2px}.timer{font:400 28px Impact,sans-serif;color:#ffcd77;font-variant-numeric:tabular-nums;min-width:62px}.timer.urgent{color:#ff796d;animation:alarm .65s infinite alternate}#lives{font-size:22px;color:#ed4d4a;white-space:nowrap;letter-spacing:2px}.toolbar{display:flex;gap:6px}.toolbar button{width:32px;height:32px;padding:5px;border:1px solid #746247;border-radius:6px;background:#1c2b36;font-size:19px}.toolbar svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:2}.arena{position:relative;min-height:0;overflow:hidden;border:1px solid #ad7d40;border-radius:9px;box-shadow:0 12px 35px #0009;background:#131f29}canvas{display:block;width:100%;height:100%;touch-action:none;outline:none}#overlay{position:absolute;inset:0;background:#08121b70;display:grid;place-items:center;padding:15px;backdrop-filter:blur(2px)}.menu{width:min(630px,94%);background:linear-gradient(140deg,#172734f5,#101a25f5);border:1px solid #cba46b;border-radius:15px;padding:25px 29px;text-align:center;box-shadow:0 20px 90px #0008}.eyebrow{font-size:9px;letter-spacing:3px;color:#d9a658}.menu h2{font:400 clamp(25px,3vw,38px) Impact,'Arial Narrow',sans-serif;letter-spacing:1px;line-height:1.1;margin:12px 0;color:#ffe1aa}.menu p{font-size:13px;line-height:1.6;color:#d3d7d8;margin:8px auto 15px;max-width:480px}.level-picker{display:grid;grid-template-columns:repeat(5,1fr);gap:7px;margin:17px 0}.level-card{height:74px;border:1px solid #6c685e;border-radius:6px;background-size:cover;background-position:center;position:relative;overflow:hidden;padding:0;box-shadow:inset 0 -30px 20px #0009}.level-card span{position:absolute;bottom:0;left:0;right:0;background:#0b151ed9;font-size:8px;line-height:1.3;padding:5px 2px;letter-spacing:.3px}.level-card.selected{border:2px solid #f5c981;box-shadow:0 0 12px #e9a13a55,inset 0 -30px 20px #0009}.howto{display:flex;justify-content:center;gap:19px;font-size:10px;color:#bcc4c8;margin:13px 0}.howto b{color:#eac591;display:block;font-size:10px;letter-spacing:.6px}.primary{background:linear-gradient(#f5c47c,#c17e35);border:1px solid #ffe0ac;border-radius:8px;color:#25201c;font-weight:850;letter-spacing:.3px;padding:13px 25px;min-width:230px;box-shadow:0 4px #6f431d,0 7px 20px #0003}.primary:active{transform:translateY(2px);box-shadow:0 2px #6f431d}.menu .tiny{font-size:9px;color:#91a4ad;margin:11px 0 0}.menu-bottom{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:9px;color:#c2a985;margin-top:12px;min-height:20px;letter-spacing:.8px}.menu-bottom button{background:none;border:0;color:#dfc59a;font-size:10px;text-decoration:underline}#toast{position:absolute;top:14px;left:50%;transform:translateX(-50%);background:#10202cdd;border:1px solid #d5ad6a;padding:6px 15px;border-radius:6px;font-size:12px;font-weight:750;color:#ffd894;pointer-events:none;opacity:0;transition:opacity .14s;white-space:nowrap}#toast.show{opacity:1}#countdown{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none;font:400 70px Impact,sans-serif;color:#ffe0a4;text-shadow:0 5px 20px #000,0 0 35px #000}#countdown:empty{display:none}.cockpit{display:flex;align-items:center;justify-content:space-between;gap:15px;position:relative;padding:0 16px 0 8px;border-radius:10px;background:linear-gradient(#17232e,#101820);box-shadow:inset 0 1px #50606a55}.wheel-zone{width:190px;display:flex;align-items:center;justify-content:center;gap:4px;position:relative;height:126px}.wheel{width:126px;height:126px;cursor:grab;touch-action:none;user-select:none}.wheel:active{cursor:grabbing}.wheel svg{width:100%;height:100%;filter:drop-shadow(0 5px 5px #0009)}#wheelArt{transform-origin:100px 100px}.wheel-label{position:absolute;left:0;right:0;text-align:center;bottom:-1px;font-size:7px;letter-spacing:2px;color:#b7a484;pointer-events:none}.dashboard{text-align:center;min-width:120px;width:300px;color:#d6b57e}#terrainName{font:400 15px Impact,sans-serif;letter-spacing:1.5px}.meter{height:4px;background:#08121a;max-width:170px;margin:7px auto 4px;overflow:hidden;border-radius:3px}.meter span{height:100%;width:0;display:block;background:linear-gradient(90deg,#dca75c,#f4773f)}.dash-line{display:flex;align-items:baseline;justify-content:center;gap:5px;height:25px}#speed{font:400 28px Impact,sans-serif;color:#f4d49e;min-width:35px}.dash-line small{font-size:7px;color:#85969f}.dash-line b{border:1px solid #6c716f;border-radius:4px;padding:1px 5px;font:12px monospace;margin-left:6px;color:#cbd8d9}#driftTag{font-size:8px;color:#90d9ed;min-width:45px}.keyboard-hint{font-size:9px;letter-spacing:.3px;color:#8298a6;margin:7px 0 0;white-space:nowrap}.pedals{display:flex;gap:15px;align-self:center;justify-content:center}.pedal{height:104px;width:92px;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;padding:13px 5px 12px;gap:4px;position:relative;border:4px solid;border-radius:18px 18px 10px 10px;box-shadow:0 6px #050b10,0 9px 12px #0008;transform:perspective(300px) rotateX(9deg)}.pedal::before{content:'';position:absolute;top:12px;left:13px;right:13px;height:40px;background:radial-gradient(circle,#111a2399 0 2.7px,transparent 3.2px) 0 0/13px 13px;opacity:.8}.pedal span{font:400 20px Impact,sans-serif;letter-spacing:1px;text-shadow:0 2px #0008}.pedal small{font-size:7px;letter-spacing:1px;opacity:.8}.brake{background:linear-gradient(120deg,#cd483b,#6b211f);border-color:#e66b52;color:#ffe5cb}.gas{background:linear-gradient(120deg,#f2b547,#99601b);border-color:#ffd17b;color:#fff0c4}.pedal.pressed{transform:perspective(300px) rotateX(16deg) translateY(4px);box-shadow:0 2px #050b10,inset 0 0 20px #0004}.wheel-zone.active{filter:brightness(1.1)}.rotate-hint{display:none}[hidden]{display:none!important}@keyframes alarm{to{opacity:.45}}@media(max-width:1100px){main{padding:6px;gap:5px;grid-template-rows:41px minmax(0,1fr) 106px}.topbar{gap:12px;padding:0 7px}.brand{font-size:17px}h1{font-size:20px;padding-left:11px}.hud{gap:16px}.round{font-size:11px;min-width:90px}.score b,.timer{font-size:24px}#lives{font-size:18px}.toolbar{gap:4px}.toolbar button{width:28px;height:28px}.wheel-zone{height:106px;width:150px}.wheel{width:106px;height:106px}.pedal{height:88px;width:79px;border-width:3px;padding-bottom:9px}.pedal::before{height:31px;top:9px}.pedal span{font-size:19px}.pedals{gap:11px}.dashboard{width:250px}.keyboard-hint{font-size:8px}.menu{padding:20px 23px}.menu h2{font-size:30px}.level-card{height:65px}}
@media(max-height:550px) and (orientation:landscape){main{padding:3px 5px;gap:3px;grid-template-rows:34px minmax(0,1fr) 78px}.topbar{gap:10px}.brand{font-size:15px}h1{font-size:18px;padding-left:9px}.hud{gap:17px}.score{font-size:8px}.score b,.timer{font-size:22px}.round{font-size:10px;min-width:87px}.round small{font-size:8px;margin-top:0}#lives{font-size:17px}.toolbar button{width:25px;height:25px;padding:4px;font-size:16px}.wheel-zone{height:78px;width:135px}.wheel{height:80px;width:80px}.wheel-label{font-size:6px;bottom:-2px}.pedal{height:69px;width:77px;padding:5px 5px 7px;border-radius:12px 12px 7px 7px}.pedal::before{height:22px;top:5px;background-size:11px 11px}.pedal span{font-size:17px}.pedal small{font-size:6px}.dashboard{width:260px}#terrainName{font-size:11px}.meter{margin:4px auto 1px;height:3px}.dash-line{height:19px}#speed{font-size:21px}.keyboard-hint{font-size:7px;margin-top:4px}.menu{padding:13px 20px;max-width:540px}.eyebrow{font-size:7px}.menu h2{font-size:25px;margin:7px 0}.menu p{font-size:11px;line-height:1.4;margin:6px 0 9px}.level-picker{margin:8px 0;gap:6px}.level-card{height:49px}.level-card span{font-size:7px;padding:3px}.howto{margin:7px 0;font-size:8px}.howto b{font-size:8px}.primary{padding:9px 20px;min-width:210px;font-size:12px}.menu .tiny{font-size:8px;margin-top:6px}.menu-bottom{margin-top:6px;font-size:8px;min-height:15px}#countdown{font-size:48px}}
@media(max-width:700px) and (orientation:landscape){.brand{display:none}.hud{gap:10px}.round{min-width:77px}h1{border:0;padding:0;font-size:16px}.topbar{gap:8px}.toolbar #fullscreen{display:none}.score{font-size:7px}.score b{font-size:21px;margin-left:3px}.toolbar button{width:24px}.pedal{width:65px}.wheel-zone{width:105px}.dashboard{width:210px}.keyboard-hint{display:none}}
@media(orientation:portrait) and (max-width:900px){.rotate-hint{display:flex;position:fixed;inset:0;background:radial-gradient(#203746,#0d1620);z-index:20;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:30px}.rotate-hint svg{height:100px;width:100px;fill:none;stroke:#edc181;stroke-width:2;margin-bottom:10px}.rotate-hint h2{font:28px Impact,sans-serif;letter-spacing:1px;color:#ffe0a5}.rotate-hint p{max-width:250px;line-height:1.6;color:#b1c3cd;font-size:14px}}@media(prefers-reduced-motion:reduce){.timer.urgent{animation:none}}

/* Mobile: the arena uses the viewport; controls sit over the foreground. */
html,body{height:100%;overflow:hidden}main{height:var(--app-height,100dvh);max-height:100dvh;width:min(1680px,var(--app-width,100vw))}
@media(pointer:coarse),(max-width:1000px){
 main{width:var(--app-width,100vw);max-width:none;padding:max(3px,env(safe-area-inset-top)) max(3px,env(safe-area-inset-right)) max(3px,env(safe-area-inset-bottom)) max(3px,env(safe-area-inset-left));grid-template-rows:38px minmax(0,1fr);gap:3px;position:relative}
 .topbar{gap:8px;padding:0 6px}.brand{display:none}h1{border:0;padding:0;font-size:17px}.hud{gap:12px}.round{font-size:10px;min-width:80px}.score{font-size:8px}.score b,.timer{font-size:22px}.score b{margin-left:3px}#lives{font-size:17px;letter-spacing:0}.toolbar button{width:30px;height:30px}.toolbar #fullscreen{display:block}
 .arena{border-radius:5px}.cockpit{position:absolute;bottom:max(7px,env(safe-area-inset-bottom));left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));height:112px;padding:0;background:none;box-shadow:none;pointer-events:none;z-index:2}.cockpit .wheel,.cockpit .pedal{pointer-events:auto}.wheel-zone{height:112px;width:112px}.wheel{width:112px;height:112px}.wheel-label{display:none}.dashboard{display:none}.pedals{gap:10px}.pedal{height:88px;width:76px;opacity:.93;box-shadow:0 3px 10px #0008}.pedal span{font-size:19px}.pedal small{font-size:7px}.pedal::before{height:29px}.cockpit{transition:opacity .1s}main[data-playing="false"] .cockpit{visibility:hidden;opacity:0}
 #overlay{padding:8px;z-index:3}.menu{max-height:100%;overflow:auto;width:min(600px,98%);padding:16px 20px}.menu h2{font-size:28px}.menu p{font-size:12px}.level-card{height:64px}.level-card span{font-size:8px}
 main.immersive{grid-template-rows:28px minmax(0,1fr);padding:0;gap:0}main.immersive h1{display:none}main.immersive .toolbar button{height:25px;width:28px}main.immersive .topbar{border:0}main.immersive .arena{border:0;border-radius:0}
}
@media(max-width:600px) and (orientation:portrait){
 main{grid-template-rows:68px minmax(0,1fr)}.topbar{display:grid;grid-template-columns:1fr auto;grid-template-rows:25px 34px;gap:0 7px}h1{grid-column:1;grid-row:1;font-size:16px}.toolbar{grid-column:2;grid-row:1/3}.hud{grid-column:1;grid-row:2;justify-content:space-between;gap:8px}.round{min-width:76px;font-size:9px}.round small{font-size:8px}.score b,.timer{font-size:21px}.timer{min-width:50px}#lives{font-size:16px}.score{font-size:7px}.toolbar{gap:3px}.toolbar button{width:28px;height:32px}
 .menu{padding:22px 14px}.menu h2{font-size:29px}.menu p{font-size:13px}.level-picker{grid-template-columns:repeat(3,1fr);gap:8px}.level-card{height:76px}.level-card span{font-size:9px}.howto{gap:14px;font-size:10px}.howto b{font-size:10px}.primary{min-width:220px;padding:14px 20px}.menu .tiny{font-size:10px}.menu-bottom{font-size:10px}.eyebrow{font-size:8px}
 main.immersive .topbar{display:flex;gap:8px}main.immersive .hud{flex:1}.immersive .round{display:block;min-width:48px}.immersive .round #level{display:none}main.immersive .score b,main.immersive .timer{font-size:20px}
}
@media(max-height:450px) and (orientation:landscape){
 main{grid-template-rows:30px minmax(0,1fr)}.topbar h1{font-size:15px}.toolbar button{width:27px;height:26px}.score b,.timer{font-size:21px}.cockpit{height:100px}.wheel-zone,.wheel{width:100px;height:100px}.pedal{height:78px;width:76px}.menu{padding:10px 20px;width:min(570px,96%)}.menu h2{font-size:25px;margin:5px 0}.menu p{font-size:11px;margin:5px auto}.eyebrow{font-size:7px}.level-picker{margin:7px 0}.level-card{height:51px}.howto{margin:6px 0}.primary{padding:10px 25px}.menu .tiny{margin:7px 0 0}.menu-bottom{margin-top:5px;min-height:15px}
}

.recover{position:absolute;z-index:3;left:50%;bottom:16px;transform:translateX(-50%);border:1px solid #f3c783;background:#172935ed;color:#ffe3ad;border-radius:9px;padding:12px 19px;font-size:14px;font-weight:750;box-shadow:0 5px 15px #0008}.recover:active{background:#624424}
@media(max-width:1000px),(pointer:coarse){.recover{bottom:108px;font-size:12px;padding:10px 15px}}
