@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');
*{box-sizing:border-box}body{margin:0;background:#101a20;color:#f4f4ed;font:14px/1.5 Inter,system-ui,sans-serif}a{color:inherit;text-decoration:none}button,select{font:inherit}button,a,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer;border:1px solid #ffffff28;border-radius:6px;background:#17252ded;color:#fff;padding:12px 18px;min-height:44px;font-weight:700}button:hover{background:#2c4048}button:disabled{cursor:wait;opacity:.5}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #efd482;outline-offset:4px}[hidden]{display:none!important}.racebar{height:62px;padding:0 32px;display:flex;align-items:center;gap:28px;border-bottom:1px solid #ffffff15;font-size:12px}.brand{margin-right:auto;font-weight:900;font-size:21px;letter-spacing:-1px}.brand span{font-size:10px;font-weight:500;letter-spacing:2px;margin-left:12px;color:#91a1a6}
#game{position:relative;height:calc(100svh - 62px);min-height:620px;overflow:hidden;background:#b8c4bf;isolation:isolate}#drive-scene{display:block;width:100%;height:100%;touch-action:none}.vignette{position:absolute;inset:0;pointer-events:none;background:linear-gradient(#07151b70,transparent 25%,transparent 65%,#061219a8)}.hud-top{position:absolute;top:28px;left:30px;right:30px;display:flex;justify-content:space-between;pointer-events:none}.race-name span,.race-stats small{display:block;font-size:9px;letter-spacing:2px;color:#e2e6e4}.race-name b{font:700 31px 'Barlow Condensed',sans-serif;letter-spacing:2px}.race-stats{display:flex;gap:35px;text-align:right}.race-stats strong{font:600 31px 'Barlow Condensed',sans-serif;font-variant-numeric:tabular-nums}.race-stats em{font-size:19px;color:#ccd8d6;font-style:normal}.leaderboard{position:absolute;left:30px;top:115px;font-size:11px;min-width:162px}.leaderboard>div{display:flex;gap:13px;align-items:center;padding:6px 11px;background:#10222d99;border-left:2px solid #ffffff28;margin-bottom:3px}.leaderboard .you{background:#e6cb80ed;color:#17262b;border-left-color:#fff}.leaderboard b{font-variant-numeric:tabular-nums}.leaderboard i{width:6px;height:6px;border-radius:50%}.race-tools{position:absolute;right:28px;top:115px;display:flex;gap:7px}.race-tools button{padding:9px 12px;font-size:11px;background:#142632c9;backdrop-filter:blur(10px)}.speedometer{position:absolute;right:32px;bottom:130px;width:240px;text-shadow:0 2px 15px #06151a}.speedline{display:flex;align-items:baseline;gap:10px}.speedline>strong{font:700 84px/.95 'Barlow Condensed',sans-serif;font-variant-numeric:tabular-nums;letter-spacing:-2px}.speedline>span{font-size:12px;color:#dce5e2}.speedline>b{font:600 40px 'Barlow Condensed',sans-serif;margin-left:auto;color:#efd38c}.rpm-track{height:5px;background:#ffffff35;margin-bottom:12px}.rpm-track i{height:100%;display:block;width:0;background:#efd38c;transition:width .08s}.rpm-label{display:flex;justify-content:space-between;font-size:8px;letter-spacing:1px;color:#ccd5d6;margin-top:8px}#minimap{position:absolute;left:24px;bottom:130px;width:175px;height:125px;border:1px solid #ffffff22;border-radius:12px;background:#10212ba8;backdrop-filter:blur(8px)}.touch-controls{position:absolute;bottom:25px;left:28px;right:28px;display:flex;justify-content:space-between;gap:20px;pointer-events:none}.touch-controls>div{display:flex;gap:10px;pointer-events:auto}.touch-controls button{touch-action:none;user-select:none;-webkit-user-select:none;width:72px;height:66px;font-size:21px;background:#18313ba8;backdrop-filter:blur(10px);border-color:#ffffff60}.touch-controls button.pressed{background:#efd38c;color:#10222a}.touch-controls .gas{width:92px;background:#edd18ce8;color:#15242b;font-size:13px}.touch-controls .brake{font-size:12px;width:80px}.center-message{position:absolute;inset:30% 0 auto;text-align:center;font:800 130px 'Barlow Condensed',sans-serif;color:#fff4d2;text-shadow:0 5px 40px #122226}.track-alert{position:absolute;top:29%;left:25%;right:25%;text-align:center;font-weight:700;font-size:12px;color:#fff0c3;text-shadow:0 2px 5px #111}.intro{position:absolute;inset:0;background:linear-gradient(90deg,#0c1920f5 0%,#0c1920dc 29%,#0c192070 52%,transparent 75%);display:flex;align-items:center;padding:30px 5%;overflow:auto}.intro-copy{max-width:505px}.eyebrow{font-size:10px;font-weight:700;letter-spacing:2.3px;color:#e3c785}.intro h1{font:700 clamp(58px,7vw,96px)/.94 'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:-1px;margin:20px 0}.intro h1 em{font-style:normal;color:#efd38c}.intro-desc{font-size:13px;color:#bccbce;line-height:1.9;max-width:460px}.rival-list{display:flex;gap:24px;margin:24px 0;font-size:9px;letter-spacing:1.1px;color:#a5b3b6}.rival-list b{display:block;color:#fff;font:600 24px 'Barlow Condensed',sans-serif;letter-spacing:.5px}.setup{display:flex;gap:12px;margin-bottom:17px}.setup label{font-size:10px;color:#b2c0c1;flex:1}.setup select{display:block;width:100%;margin-top:7px;background:#14252d;color:#f1f3e9;border:1px solid #49606a;padding:11px 9px;border-radius:5px;font-size:11px;min-height:44px}.start{width:100%;background:#efd38c;color:#14252b;border:0;font-size:14px;min-height:53px}.start:hover{background:#ffe8ad}.keys{font-size:10px;color:#aabcc0;line-height:2.1}kbd{background:#ffffff13;border:1px solid #ffffff2e;padding:2px 5px;border-radius:3px;font:10px Inter,sans-serif}#load-status,.record{font-size:10px;color:#c9d3cd;margin:8px 0}.overlay{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:min(460px,calc(100% - 32px));padding:32px;background:#10212af5;box-shadow:0 18px 80px #0008;border:1px solid #ffffff26;border-radius:16px;text-align:center;backdrop-filter:blur(15px)}.overlay h2{font:700 44px 'Barlow Condensed',sans-serif;line-height:1.1;margin:14px 0}.overlay>button{margin-top:12px}.overlay>a{display:block;margin-top:20px;font-size:11px;color:#c2d0cf}.results ol{padding:0;list-style:none;text-align:left}.results li{display:flex;justify-content:space-between;padding:9px;border-bottom:1px solid #ffffff15;font-size:12px}.audio-status{position:absolute;bottom:4px;left:210px;right:300px;text-align:center;font-size:10px;color:#fff1cb;pointer-events:none}.racebar a:hover{text-decoration:underline}footer{display:flex;gap:30px;justify-content:space-between;padding:16px 28px;color:#94a8af;font-size:10px}footer details{max-width:600px}footer summary{cursor:pointer;color:#cbd6d7}footer a{text-decoration:underline}.playing .intro{display:none}.intro~.audio-status{z-index:5}.expanded{position:fixed!important;inset:0;z-index:100;height:100svh!important}body:has(.expanded){overflow:hidden}
@media(max-width:720px){.racebar{padding:0 16px;gap:15px;height:54px;font-size:10px}.brand{font-size:19px}.brand span{display:none}#game{height:calc(100svh - 54px);min-height:650px}.hud-top{top:18px;left:16px;right:16px}.race-name span{font-size:7px;letter-spacing:1px}.race-name b{font-size:24px}.race-stats{gap:16px}.race-stats strong{font-size:25px}.race-stats small{font-size:7px;letter-spacing:1px}.race-stats em{font-size:14px}.leaderboard{left:16px;top:90px;min-width:140px;font-size:9px}.race-tools{right:14px;top:90px;flex-direction:column;gap:5px}.race-tools button{min-height:44px;padding:6px 10px;font-size:9px}.speedometer{right:20px;width:175px;bottom:122px}.speedline>strong{font-size:66px}#minimap{left:16px;bottom:122px;width:125px;height:90px}.touch-controls{bottom:25px;left:14px;right:14px;gap:10px}.touch-controls>div{gap:7px}.touch-controls button{width:55px;height:62px}.touch-controls .brake{width:59px}.touch-controls .gas{width:67px}.intro{padding:24px;background:linear-gradient(90deg,#0c1920f2,#0c1920a6)}.intro h1{font-size:62px;margin:14px 0}.intro-desc{font-size:12px}.intro-desc br{display:none}.rival-list{margin:16px 0}.intro-copy{max-width:430px}.keys{font-size:9px}.audio-status{left:15px;right:15px;font-size:8px;bottom:0}.track-alert{left:15%;right:15%;top:37%;font-size:11px}footer{display:block;padding:15px}footer details{margin-top:10px}}
@media(max-height:600px) and (min-width:621px){#game{min-height:480px}.intro{padding:20px 4%;align-items:flex-start}.intro-copy{max-width:410px}.intro h1{font-size:50px;margin:8px 0}.intro-desc{font-size:11px}.rival-list{margin:10px 0}.setup{margin-bottom:10px}.keys{display:none}.speedometer{bottom:110px}.touch-controls{bottom:15px}.leaderboard{top:100px}}

/* Keep the complete setup and pedals reachable on classroom laptop screens. */
@media(min-width:721px) and (max-height:800px){#game{min-height:540px}.intro{align-items:flex-start;padding:24px 5%}.intro-copy{max-width:460px}.intro h1{font-size:68px;margin:12px 0}.intro-desc{font-size:12px}.rival-list{margin:14px 0}.keys{font-size:9px}.setup{margin-bottom:12px}.record{margin-bottom:0}}
#game:not(.playing) .hud-top,#game:not(.playing) .leaderboard,#game:not(.playing) .race-tools,#game:not(.playing) .speedometer,#game:not(.playing) #minimap,#game:not(.playing) .touch-controls{visibility:hidden}
/* Large independent touch targets: steering and pedals can be held together. */
.touch-controls{align-items:end;bottom:18px}.touch-controls .wheel-control{display:flex;flex-direction:column;align-items:center;gap:0;width:180px}.wheel-control>span{font-size:8px;letter-spacing:2px;color:#d4dfdc;text-shadow:0 2px 5px #000}#steering-wheel{width:180px;height:180px;touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab;border-radius:50%;filter:drop-shadow(0 8px 14px #0007)}#steering-wheel:focus-visible{outline:3px solid #efd38c;outline-offset:3px}#steering-wheel svg{width:100%;height:100%;display:block;transform:rotate(var(--turn,0deg));transition:transform .17s ease-out}#steering-wheel.turning{cursor:grabbing}#steering-wheel.turning svg{transition:none}.touch-controls .pedals{align-items:end;gap:16px}.touch-controls .pedals button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:end;gap:5px;padding:15px 8px;border:2px solid #9aafb3;border-radius:15px;box-shadow:0 7px 0 #050c13,0 12px 26px #0006;background:linear-gradient(135deg,#263e4bd9,#0c1b25e8);color:#f2f3e9;transition:transform .08s,box-shadow .08s}.touch-controls .pedals .brake{width:98px;height:105px}.touch-controls .pedals .gas{width:96px;height:142px;border-color:#e4c475;background:linear-gradient(135deg,#d4b665e8,#896b35e8)}.pedals i{position:absolute;inset:12px 14px 63px;background:repeating-linear-gradient(0deg,#06121a80 0 3px,transparent 3px 9px);border-radius:4px}.pedals b{font-size:15px;letter-spacing:1px}.pedals small{font-size:9px;opacity:.7}.touch-controls .pedals .pressed{transform:translateY(6px);box-shadow:0 1px 0 #050c13,inset 0 3px 12px #0006;filter:brightness(1.25)}#minimap{bottom:226px;width:145px;height:104px}.speedometer{bottom:194px}.damage-meter{position:absolute;right:32px;bottom:159px;width:240px;font-size:8px;letter-spacing:1px;color:#d6dfdb}.damage-meter>span{display:flex;justify-content:space-between}.damage-meter>i{height:3px;display:block;background:#ffffff30;margin-top:5px}.damage-meter em{display:block;height:100%;width:0;background:#f0bd71;transition:width .2s}.damage-meter.damaged em{background:#eb725c}.impact .vignette{box-shadow:inset 0 0 80px #c4462b77}.settings-panel{z-index:12;max-height:calc(100% - 28px);overflow:auto;padding:26px 30px}.settings-panel h2{margin:8px 0 14px}.control-explainer{font-size:12px;color:#b8c9cc;line-height:1.7}.settings-grid{display:grid;gap:9px;text-align:left;margin:20px 0}.settings-grid label{display:flex;justify-content:space-between;font-size:12px}.settings-grid output{color:#efd38c}.settings-grid input{width:100%;height:30px;accent-color:#e6c77b;cursor:pointer}.settings-grid select{background:#182e39;border:1px solid #72868c;border-radius:5px;color:#fff;min-height:44px;padding:8px;font-size:12px}.setup-link{font-size:11px;padding:8px 0;background:none;border:0;min-height:36px;text-decoration:underline;text-underline-offset:4px;color:#d2ddd9}.setup-link:hover{background:none;color:#efd38c}#game:not(.playing) .damage-meter{visibility:hidden}
@media(max-width:720px){.race-tools{display:grid;grid-template-columns:repeat(2,64px);gap:5px}.race-tools button{padding:5px 3px;min-height:44px}.leaderboard{min-width:125px;max-width:135px;font-size:8px}.touch-controls{left:12px;right:12px;bottom:20px}.touch-controls .wheel-control,#steering-wheel{width:142px}.touch-controls .wheel-control{height:158px}#steering-wheel{height:142px}.touch-controls .pedals{gap:10px}.touch-controls .pedals .brake{width:66px;height:93px}.touch-controls .pedals .gas{width:74px;height:126px}.pedals b{font-size:13px}.pedals i{inset:12px 10px 60px}.speedometer{bottom:194px;right:18px;width:155px}.speedline>strong{font-size:61px}#minimap{bottom:194px;width:115px;height:82px}.damage-meter{bottom:161px;right:18px;width:155px}.settings-panel{padding:20px}.settings-panel h2{font-size:36px}.audio-status{bottom:0}.intro h1{font-size:58px}.intro{align-items:flex-start;padding-top:34px}.intro .keys{margin-bottom:0}.intro .record{font-size:9px}.track-alert{top:40%}}
@media(max-width:350px){.touch-controls .wheel-control,#steering-wheel{width:118px}.touch-controls .wheel-control{height:135px}#steering-wheel{height:118px}.touch-controls .pedals{gap:7px}.touch-controls .pedals .brake{width:60px}.touch-controls .pedals .gas{width:66px}.race-name b{font-size:20px}.race-stats{gap:10px}.intro{padding:20px}.intro h1{font-size:52px}.setup{gap:7px}.setup select{font-size:10px}.speedometer,.damage-meter{width:140px}}
@media(min-width:721px) and (max-height:700px){.touch-controls .wheel-control,#steering-wheel{width:145px}.touch-controls .wheel-control{height:158px}#steering-wheel{height:145px}.touch-controls .pedals .gas{height:125px}.touch-controls .pedals .brake{height:92px}#minimap{bottom:191px;width:120px;height:85px}.speedometer{bottom:175px}.damage-meter{bottom:144px}.intro h1{font-size:60px}.intro .keys{display:none}.intro-copy{max-width:440px}}
@media(prefers-reduced-motion:reduce){#steering-wheel svg,.pedals button,.damage-meter em{transition:none}}
.intro{pointer-events:none}.intro-copy{pointer-events:auto}.rival-list{gap:9px}.rival-list button{padding:8px 10px;min-height:57px;font-size:8px;font-weight:500;letter-spacing:1px;background:#0b19268a;border-color:#ffffff25;color:#b0c2c5;text-align:left}.rival-list button[aria-pressed=true]{border-color:#efd38c;background:#d3bc7020}.rival-list button b{font-size:21px}.preview-hint{font-size:9px;color:#b6c6ca;margin:-9px 0 16px}.intro h1{margin-bottom:12px}.intro-desc{margin-top:10px}
@media(max-width:720px){.rival-list{gap:6px}.rival-list button{padding:7px 8px;letter-spacing:.6px}.rival-list button b{font-size:20px}.preview-hint{font-size:8px}.intro h1{font-size:52px}.intro-desc{font-size:11px}}
@media(max-width:350px){.rival-list button{padding:6px;font-size:7px}.rival-list button b{font-size:18px}}
.settings-open:after{content:"";position:absolute;inset:0;background:#06101866;z-index:11;backdrop-filter:blur(3px)}
/* Handbrake sits above the brake so neither large pedal shrinks on a phone. */
.touch-controls .pedals{position:relative}.touch-controls .pedals .handbrake{position:absolute;left:0;bottom:117px;width:98px;height:48px;min-height:48px;padding:5px 3px;gap:0;border-radius:9px;border-color:#d79564;background:#553626eb}.pedals .handbrake b{font-size:10px;letter-spacing:.6px}.pedals .handbrake small{font-size:8px}.drift-meter{position:absolute;left:50%;bottom:30px;transform:translateX(-50%);display:flex;align-items:center;gap:10px;padding:10px 16px;border:1px solid #ffffff35;border-radius:10px;background:#10212bdb;color:#c7d6d5;pointer-events:none}.drift-meter small{font-size:8px;letter-spacing:1px}.drift-meter strong{font:700 30px 'Barlow Condensed',sans-serif;font-variant-numeric:tabular-nums}.drift-meter span{font-size:9px;min-width:75px}.drift-meter.active{border-color:#f1d28a;color:#ffe5a7;background:#463a20ed}#game:not(.playing) .drift-meter{visibility:hidden}
@media(max-width:720px){.touch-controls .pedals .handbrake{bottom:103px;width:66px;height:46px;min-height:46px}.pedals .handbrake b{font-size:9px}.drift-meter{bottom:300px;padding:5px 10px;gap:8px;white-space:nowrap}.drift-meter strong{font-size:25px}.drift-meter small,.drift-meter span{font-size:8px}}
@media(min-width:721px) and (max-height:700px){.touch-controls .pedals .handbrake{bottom:104px;height:44px;min-height:44px}.drift-meter{bottom:20px}}

/* Reserve clear space above the handbrake for speed and damage readouts. */
.damage-meter{bottom:193px}.speedometer{bottom:228px}
@media(max-width:720px){.damage-meter{bottom:185px}.speedometer{bottom:220px}.drift-meter{bottom:335px}}

/* Both directions remain visible above the pedals, including short screens. */
.direction-selector{position:absolute;right:0;bottom:154px;display:grid;grid-template-columns:1fr 1fr;gap:6px;width:202px}.touch-controls .direction-selector button{width:auto;height:48px;min-height:48px;font-size:12px;background:#132e3bf5;border:1px solid #9ebcc4;border-radius:9px}.touch-controls .direction-selector button[aria-pressed="true"]{background:#efd38c;color:#162731;border-color:#fff0be}.direction-selector small{grid-column:1/-1;font-size:10px;text-align:center;line-height:1.4;min-height:28px;color:#fff0c8;text-shadow:0 1px 3px #000}.damage-meter{bottom:245px}.speedometer{bottom:277px}
.vignette{background:linear-gradient(#07151b40,transparent 22%,transparent 72%,#06121970)}
@media(max-width:720px){.direction-selector{bottom:138px;width:164px}.touch-controls .direction-selector button{font-size:11px}.direction-selector small{font-size:9px}.damage-meter{bottom:250px}.speedometer{bottom:278px}.drift-meter{bottom:373px}}
@media(min-width:721px) and (max-height:700px){.direction-selector{bottom:137px}.damage-meter{bottom:235px}.speedometer{bottom:265px}}
@media(max-height:600px) and (min-width:721px){#game{min-height:550px}}
/* The driving surface follows the visible viewport, including browser chrome.
   A fixed minimum height previously pushed the pedals below short screens. */
:root{--race-bar-height:62px}
#game{height:calc(100dvh - var(--race-bar-height));min-height:0}
#game.expanded{height:100dvh!important;min-height:0}
body:has(#game.playing){overflow:hidden}
.touch-controls{bottom:max(18px,env(safe-area-inset-bottom));right:max(18px,env(safe-area-inset-right));left:max(18px,env(safe-area-inset-left))}
.direction-selector{bottom:178px}
.damage-meter{bottom:277px}.speedometer{bottom:307px}
@media(max-width:720px){:root{--race-bar-height:54px}.touch-controls{left:12px;right:12px;bottom:max(16px,env(safe-area-inset-bottom))}.direction-selector{bottom:164px}.damage-meter{bottom:276px}.speedometer{bottom:306px}.drift-meter{bottom:402px}}
@media(max-height:600px) and (min-width:621px){
 #game{min-height:0}
 .hud-top{top:12px;left:18px;right:18px}.race-name b{font-size:24px}.race-stats strong{font-size:25px}.race-stats{gap:18px}
 .race-tools{top:65px;right:16px;display:flex;gap:5px}.race-tools button{min-height:44px;padding:7px 10px}
 .leaderboard{top:65px;left:18px;font-size:9px}.leaderboard>div{padding:3px 8px}
 .touch-controls{bottom:max(12px,env(safe-area-inset-bottom));left:18px;right:18px}
 .touch-controls .wheel-control,#steering-wheel{width:118px}.touch-controls .wheel-control{height:132px}#steering-wheel{height:118px}
 .touch-controls .pedals{gap:12px}.touch-controls .pedals .gas{width:82px;height:110px}.touch-controls .pedals .brake{width:86px;height:76px}
 .touch-controls .pedals .handbrake{bottom:88px;width:86px;height:44px;min-height:44px}
 .direction-selector{bottom:144px;width:180px}.direction-selector small{display:none}.touch-controls .direction-selector button{height:44px;min-height:44px;padding:6px;font-size:11px}
 .pedals i{inset:9px 12px 54px}.pedals b{font-size:12px}.pedals small{font-size:8px}
 .speedometer{left:50%;right:auto;bottom:16px;transform:translateX(-50%);width:145px}.speedline>strong{font-size:52px}.speedline>b{font-size:28px}.rpm-label{display:none}.rpm-track{margin-bottom:6px}
 .damage-meter{left:50%;right:auto;bottom:91px;transform:translateX(-50%);width:145px}
 .drift-meter{left:50%;bottom:124px;padding:5px 10px}.drift-meter strong{font-size:22px}.drift-meter small,.drift-meter span{font-size:8px}
 #minimap{display:none}.track-alert{top:44%;font-size:10px}.audio-status{bottom:0;left:155px;right:210px;font-size:8px}
}

#game:fullscreen{height:100dvh!important;min-height:0}
body:has(#game.playing)>footer{display:none}
@media(max-width:620px) and (max-height:700px){
 .race-tools{top:80px;grid-template-columns:repeat(3,44px);gap:4px}.race-tools button{font-size:9px;line-height:1.1;min-height:44px;padding:3px}
 .speedometer{bottom:278px;width:145px}.speedline>strong{font-size:48px}.speedline>b{font-size:28px}.rpm-label{display:none}.rpm-track{margin-bottom:6px}
 .damage-meter{bottom:248px;width:145px}.direction-selector{bottom:148px}.direction-selector small{min-height:22px}
 .drift-meter{left:16px;top:205px;bottom:auto;transform:none;padding:5px 8px;gap:6px}.drift-meter strong{font-size:22px}.drift-meter small,.drift-meter span{font-size:8px}
 #minimap{bottom:174px}
}
@media(max-width:620px) and (max-height:550px){#minimap{display:none}.direction-selector small{display:none}.direction-selector{bottom:138px}.speedometer{bottom:239px}.damage-meter{bottom:218px}.race-tools{top:65px}.leaderboard{top:65px}.drift-meter{top:180px}}

@media(max-width:620px) and (min-height:551px) and (max-height:700px){.touch-controls .pedals .handbrake{bottom:99px}}
