:root{color-scheme:dark;--lime:#c4f47a;--cream:#fff5d9}*{box-sizing:border-box}body{margin:0;background:#132e34;color:var(--cream);font-family:'DM Sans',sans-serif;background-image:radial-gradient(ellipse at top,#35534477,transparent 70%)}button,select{font:inherit}button{cursor:pointer;touch-action:manipulation}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #ffdd81;outline-offset:3px}.shell{max-width:1240px;margin:auto;padding:0 36px}header{height:80px;display:flex;gap:22px;align-items:center;border-bottom:1px solid #ffffff16}.brand{display:flex;align-items:center;gap:12px;color:inherit;text-decoration:none;font-size:11px;letter-spacing:2px;font-weight:800}.brand b{display:grid;place-items:center;background:var(--lime);color:#243b34;font-size:25px;width:32px;height:33px;box-shadow:3px 3px #6e9a58}.birthday{margin-left:auto;color:var(--lime);font-size:9px;letter-spacing:1.5px}.header-actions{display:flex;gap:8px}.header-actions button{background:#183a3d;border:1px solid #62816e;border-radius:4px;color:#d5e5cf;font-size:10px;padding:8px 10px}.intro{display:flex;justify-content:space-between;align-items:center;padding:28px 0}.eyebrow{font-size:9px;letter-spacing:2px;color:var(--lime);font-weight:800;margin:0 0 10px}h1{font-family:'Barlow Condensed',Impact,sans-serif;font-size:64px;font-weight:900;line-height:1;margin:0}em{color:var(--lime);font-style:normal}.subtitle{font-size:12px;color:#c2cbbb;margin:13px 0 0}.subtitle span{color:#6e9b87;margin:0 10px}.stamp{border:1px solid #9ab879;border-radius:50%;height:88px;width:88px;display:flex;align-items:center;justify-content:center;gap:6px;transform:rotate(9deg);color:var(--lime)}.stamp strong{font-family:Impact,sans-serif;font-size:50px}.stamp span{font-size:9px;line-height:1.5;letter-spacing:1px}.stage{position:relative;aspect-ratio:16/9;background:#78bfd1;border:1px solid #7e9973;border-radius:9px;overflow:hidden;box-shadow:0 20px 60px #001d2b66}#game{width:100%;height:100%;display:block;object-fit:cover;image-rendering:pixelated;outline:none;touch-action:none}.stage-top{position:absolute;bottom:14px;right:14px;display:flex;justify-content:flex-end;align-items:center;z-index:6;pointer-events:none}.touch-device .stage-top{bottom:88px}.stage-top button{pointer-events:auto;background:#18374a99;border:1px solid #62816e;border-radius:4px;color:#d5e5cf;font-size:10px;padding:8px 10px}.game-title{font:900 clamp(34px,6vw,58px)/1 'Barlow Condensed',Impact,sans-serif;letter-spacing:1px;text-align:center;color:var(--cream);text-shadow:3px 3px #102035;margin:0 0 8px}.game-title em{color:var(--lime);font-style:normal}.hidden{display:none!important}.overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#102c4166}.panel{width:780px;max-width:94%;background:#122f38f2;border:1px solid #bcdb8877;padding:26px 34px 18px;border-radius:10px;text-align:center;box-shadow:0 8px 0 #081e3555}h2{font:800 43px/1 'Barlow Condensed',Impact,sans-serif;margin:10px 0}.panel>p:not(.eyebrow){font-size:11px;color:#c0d2c3;line-height:1.6}.driver-lineup{display:flex;gap:8px;margin:17px 0}.driver{width:25%;padding:7px 3px;background:#253d48;border:1px solid #60756955;border-radius:6px}.driver.levi{background:#365744;border-color:#b6d881}.driver canvas{width:67px;height:65px;image-rendering:pixelated;max-width:100%;object-fit:contain}.driver b,.driver small{display:block}.driver b{font-size:9px;letter-spacing:1px;margin:5px 0}.driver small{font-size:6px;letter-spacing:.7px;color:#afc4b3}.difficulty{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:8px;letter-spacing:1px;text-align:left}.difficulty select{padding:9px;border:1px solid #65866e;background:#254342;color:#e7f1d4;border-radius:4px;font-size:11px;letter-spacing:0}.instructions{font-size:10px;color:#bdd0c4;line-height:1.7;margin:13px 0}.play{border:0;border-radius:4px;background:var(--lime);color:#1d4037;padding:18px 28px;min-width:280px;font-size:17px;font-weight:900;letter-spacing:1.2px;box-shadow:0 4px #699151}.play .big{font-size:26px;vertical-align:-4px;margin-right:8px}.play:hover{background:#d6ff9b}.play span{margin-left:25px}.panel .panel-note{font-size:9px!important;margin:12px 0 0}.garage{display:block;margin:15px auto 0;background:#254342;color:#e7f1d4;border:1px solid #65866e;border-radius:4px;padding:12px 20px;font-size:15px;font-weight:800}.garage .big{font-size:22px;vertical-align:-3px;margin-right:8px}.hud{position:absolute;inset:0;pointer-events:none;text-shadow:1px 2px #182c40}.race-left{position:absolute;left:22px;top:18px;display:flex;align-items:center;gap:22px}.position{position:relative;padding-bottom:14px}.position strong{font:900 66px/.85 'Barlow Condensed',Impact,sans-serif;color:#fff3a6}.position>span{font-size:17px;font-weight:800;color:#fff3a6}.position small{display:block;font-size:7px;letter-spacing:1px;position:absolute;bottom:0;white-space:nowrap}.lap{border-left:1px solid #ffffff55;padding-left:20px}.lap small{display:block;font-size:9px;letter-spacing:2px}.lap b{font-size:28px}.lap b span{font-size:15px;color:#e0e8d5}.race-right{position:absolute;top:20px;right:20px;display:flex;gap:15px;align-items:center}#timer{font:700 18px monospace}.race-right button{pointer-events:auto;background:#18374a99;border:1px solid #b8d5c277;border-radius:6px;color:white;width:46px;height:46px;font-size:18px}.standings{position:absolute;top:112px;left:22px;font-size:10px;display:grid;gap:5px}.standing{background:#172e459e;padding:5px 8px;border-radius:3px;min-width:100px}.standing.me{color:var(--lime);border-left:3px solid var(--lime)}.standing span{display:inline-block;width:15px;font-weight:bold}.speed{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);text-align:center}.speed b{font:800 35px 'Barlow Condensed',Impact,sans-serif}.speed>span{font-size:8px;margin-left:4px}.speed small{display:block;font-size:9px;color:#d5f990;letter-spacing:1px}#map{position:absolute;right:15px;top:75px;width:120px;height:120px;background:#14334799;border:1px solid #cbe5cd44;border-radius:9px;image-rendering:pixelated}.rescue{position:absolute;right:18px;top:205px;pointer-events:auto;background:#18354a99;border:1px solid #b6d8c355;border-radius:4px;color:#edf5de;font-size:9px;padding:7px}.countdown{position:absolute;top:31%;width:100%;text-align:center;font:900 100px 'Barlow Condensed',Impact,sans-serif;color:#fff3a6;text-shadow:4px 5px #27465a;pointer-events:none}#toast{position:absolute;top:17px;left:50%;transform:translateX(-50%);padding:9px 15px;background:#193744ed;border:1px solid #c5eb8e;border-radius:4px;font-size:11px;opacity:0;pointer-events:none;white-space:nowrap}#toast.visible{opacity:1}.touch-controls{position:absolute;bottom:18px;left:20px;right:20px;display:flex;justify-content:space-between;pointer-events:none}.steering,.pedals{display:flex;gap:16px;align-items:flex-end}.touch-controls button{pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;color:#f1ffdc;background:#173a4abd;border:2px solid #d1e5b277;border-radius:12px;width:100px;height:92px;font-size:30px;box-shadow:0 4px #122d4399}.touch-controls button.held{background:#668653cc;border-color:#d9ffaa}.touch-controls .brake{font-size:13px;width:88px;height:70px}.touch-controls .item{font-size:15px;width:150px;background:#abc969e6;color:#223d39;border-color:#e5f7b9}.below{display:flex;justify-content:space-between;color:#b5c9b8;font-size:10px;padding:15px 0}.below i{font-size:7px;color:var(--lime);margin:0 7px}kbd{border:1px solid #769281;border-radius:3px;padding:2px 5px;font-size:9px}footer{display:flex;justify-content:space-between;padding:15px 0 25px;border-top:1px solid #ffffff13;color:#8da99c;font-size:9px}footer>span:first-child{font-size:8px;letter-spacing:1px}footer b{margin:0 8px}.results{margin:15px 0;text-align:left}.result-row{display:flex;justify-content:space-between;padding:8px 12px;margin-bottom:4px;background:#29434c;font-size:12px;border-radius:3px}.result-row.me{color:var(--lime);background:#38553e}.big-screen{overflow:hidden}.big-screen .shell{padding:0}.big-screen header,.big-screen .intro,.big-screen .below,.big-screen footer{display:none}.big-screen .stage{position:fixed;inset:0;border:0;border-radius:0;aspect-ratio:auto}.big-screen #game{object-fit:cover}.big-screen .touch-controls{bottom:max(18px,env(safe-area-inset-bottom));left:max(22px,env(safe-area-inset-left));right:max(22px,env(safe-area-inset-right))}.big-screen .panel{max-height:95%;overflow:auto}.big-screen .touch-controls button{width:112px;height:98px}.big-screen .touch-controls .item{width:168px}.big-screen .touch-controls .brake{width:92px;height:74px}.big-screen .speed{bottom:24px}@media(max-width:750px){.shell{padding:0 14px}header{height:60px}.birthday{display:none}.header-actions{margin-left:auto}.brand{font-size:8px;letter-spacing:1px}h1{font-size:42px}.intro{padding:24px 0}.eyebrow{font-size:7px;letter-spacing:1px}.stamp{width:62px;height:62px}.stamp strong{font-size:37px}.stamp span{font-size:7px}.stage{aspect-ratio:4/3}.panel{padding:17px 20px}.panel h2{font-size:33px}.driver-lineup{margin:10px 0}.driver canvas{width:44px;height:43px}.driver small{font-size:5px}.driver b{font-size:7px}.difficulty{font-size:7px}.difficulty select{font-size:10px;padding:7px}.instructions{font-size:9px;margin:8px 0}.play{padding:12px 18px;font-size:10px}.panel .panel-note{font-size:8px!important}.below>span:first-child{display:none}.below{font-size:9px}footer{font-size:8px;gap:10px}.race-left{left:12px;top:12px;gap:10px}.position strong{font-size:48px}.lap{padding-left:10px}.lap b{font-size:23px}.standings{left:12px;top:94px;font-size:8px}.standing{min-width:80px}.race-right{right:12px;top:12px}#timer{font-size:13px}#map{width:86px;height:86px;top:58px;right:12px}.rescue{top:150px;right:12px;font-size:8px}.touch-controls{left:12px;right:12px;bottom:12px}.touch-controls button{width:84px;height:78px}.touch-controls .item{width:120px;font-size:13px}.touch-controls .brake{width:70px;font-size:11px}.steering,.pedals{gap:12px}.speed{bottom:14px}.speed b{font-size:26px}.speed small{font-size:7px}#toast{top:60px;font-size:9px}}@media(max-height:550px) and (orientation:landscape){.big-screen .panel{padding:14px 25px;width:780px}.panel h2{font-size:32px;margin:5px 0}.driver-lineup{margin:8px 0}.driver canvas{width:44px;height:42px}.driver{padding:3px}.driver small{font-size:5px}.instructions{margin:7px 0}.panel>p:not(.eyebrow){margin:6px 0;font-size:10px}.panel .panel-note{font-size:8px!important}.play{padding:11px 18px}.big-screen .touch-controls button{width:96px;height:82px}.big-screen .touch-controls .item{width:144px}.big-screen .touch-controls .brake{width:80px;height:64px}}
.audio-settings{display:flex;gap:20px;justify-content:center;margin:12px 0 16px;padding-top:10px;border-top:1px solid #afc99b33}.audio-settings label{display:flex;align-items:center;gap:8px;font-size:10px;color:#cfe0c2}.audio-settings input{width:110px;accent-color:var(--lime);cursor:pointer;height:20px}#audio-status:empty{display:none}#audio-status{font-size:9px;color:#f5d69c}.race-right #race-sound{width:auto;padding:0 9px;font-size:9px;white-space:nowrap}@media(max-width:750px){.audio-settings{gap:12px;margin:8px 0 12px}.audio-settings label{font-size:9px;gap:5px}.audio-settings input{width:75px}.race-right{gap:7px}.race-right #race-sound{font-size:8px;padding:0 5px}}@media(max-height:550px) and (orientation:landscape){.audio-settings{margin:6px 0 10px;padding-top:6px}}

.touch-controls .item{background:#35465bcc;color:#b7c7ce;border-color:#a6bbbf77;font-size:15px}.touch-controls .item.ready{background:#d3c4f4ed;color:#312e4c;border-color:#f1e7ff}.speed #item-label{font-size:9px;color:#ece0ff}
/* Keep only the labels needed to choose a race or drive the kart. */
.header-actions{margin-left:auto}.stage{margin-bottom:28px}.intro{padding:24px 0}.subtitle{font-size:14px}.position{padding-bottom:0}.panel{padding:26px 34px}.driver b{font-size:12px;letter-spacing:.5px;margin:7px 0 3px}.difficulty{font-size:13px;letter-spacing:0}.difficulty select{font-size:13px;min-width:140px}.instructions{font-size:12px;line-height:1.8;margin:16px 0}.audio-settings label{font-size:12px}.header-actions button{font-size:12px}.standing{font-size:12px;padding:6px 9px}.lap small{font-size:12px;letter-spacing:1px}.rescue{font-size:11px;padding:9px}.race-right #race-sound{font-size:11px}.touch-controls .brake{font-size:15px}.touch-controls .item{font-size:16px}.speed #item-label{font-size:12px}.touch-device .speed #item-label{display:none}.panel>p:not(.eyebrow){font-size:13px}.garage{font-size:13px}#toast{font-size:12px}@media(max-width:750px){.panel{padding:18px}.driver b{font-size:10px}.difficulty,.difficulty select{font-size:12px}.instructions{font-size:11px;line-height:1.7}.audio-settings label{font-size:11px}.standing{font-size:10px;padding:5px 7px}.header-actions button{font-size:11px}.race-right #race-sound{font-size:10px}.rescue{font-size:10px}.speed #item-label{font-size:10px}.touch-controls .brake{font-size:14px}.touch-controls .item{font-size:14px}#toast{font-size:11px}.lap small{font-size:11px}}@media(max-height:550px) and (orientation:landscape){.big-screen .panel{padding:16px 25px}.driver b{font-size:11px}.instructions{font-size:11px;margin:10px 0}.panel>p:not(.eyebrow){font-size:12px}}

.track-choice{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:13px;margin-bottom:12px}.track-choice select{background:#254342;color:#e7f1d4;border:1px solid #65866e;border-radius:4px;padding:9px;font-size:13px;max-width:80%}.race-track{position:absolute;top:21px;left:50%;transform:translateX(-50%);font-size:13px;font-weight:700;background:#172e45a8;padding:7px 12px;border-radius:4px;transition:opacity .5s}.race-track.fade{opacity:0}.panel{max-height:96%;overflow:auto}#toast{top:60px}@media(max-width:750px){.track-choice,.track-choice select{font-size:12px}.race-track{top:64px;font-size:11px}#toast{top:100px}}@media(max-height:550px) and (orientation:landscape){.driver-lineup{margin:6px 0}.track-choice{margin-bottom:7px}.track-choice select{padding:6px}.instructions{margin:7px 0}.audio-settings{margin:7px 0}}

/* Lap announcements stay clear of the kart and touch controls. */
#lap-banner{position:absolute;top:9%;left:50%;transform:translate(-50%,-12px) scale(.9);opacity:0;pointer-events:none;white-space:nowrap;padding:8px 24px;border:3px solid #fff6bd;border-radius:8px;background:#153649ee;color:#fff6bd;font:900 clamp(28px,5vw,60px)/1.15 'Barlow Condensed',Impact,sans-serif;text-shadow:3px 3px #102035;box-shadow:0 5px 0 #071c3099;transition:opacity .12s,transform .16s}
#lap-banner.visible{opacity:1;transform:translate(-50%,0) scale(1)}
#lap-banner.final-lap{color:#fff36b;border-color:#fff36b;background:#56278eee}
@media(prefers-reduced-motion:reduce){#lap-banner{transition:none}}
@media(orientation:landscape) and (max-height:700px){.intro{padding:10px 0}.subtitle{font-size:11px;margin-top:6px}.panel{padding:14px 24px 12px}.game-title{font-size:30px;margin-bottom:4px}.panel h2{font-size:28px;margin:4px 0}.driver-lineup{margin:8px 0}.driver{padding:3px}.driver canvas{width:44px;height:42px}.driver b{font-size:7px;margin:4px 0 2px}.instructions{display:none}.audio-settings{margin:6px 0;padding-top:6px}.play{padding:11px 18px;font-size:14px}.results{margin:8px 0}.result-row{padding:5px 10px}}
.driver-lineup{flex-wrap:wrap}.driver-lineup .driver{width:15.5%}.driver.pick{cursor:pointer;color:inherit}.driver.selected{background:#365744;border-color:#b6d881}.driver.locked{opacity:.85}.driver-choice{font-size:12px;color:#cfe0c2;margin:10px 0 12px}.driver-choice b{color:var(--lime)}
.track-choice{display:block;text-align:left;margin-bottom:12px}.choice-label{display:block;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#cfe0c2;margin-bottom:8px}#track-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.track-card{background:#253d48;border:2px solid #60756955;border-radius:6px;padding:6px 4px;color:inherit}.track-card canvas{width:100%;height:auto;image-rendering:pixelated;background:#143347;border-radius:4px}.track-card b{display:block;font-size:8px;letter-spacing:.4px;margin:5px 0 1px}.track-card.selected{background:#365744;border-color:#b6d881}.difficulty{display:block;text-align:left;margin-bottom:4px}#difficulty-stars{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}#difficulty-stars button{background:#253d48;border:2px solid #60756955;border-radius:6px;color:#e7f1d4;padding:8px 4px}#difficulty-stars .stars{display:block;font-size:17px;letter-spacing:3px;color:#fff3a6}#difficulty-stars small{display:block;font-size:8px;letter-spacing:1px;color:#afc4b3;margin-top:2px}#difficulty-stars button.selected{background:#365744;border-color:#b6d881}
.mode-choice{text-align:left}.mode-choice .choice-label{display:block;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#cfe0c2;margin-bottom:8px}#mode-pick{display:grid;grid-template-columns:1fr 1fr;gap:8px}#mode-pick button{background:#253d48;border:2px solid #60756955;border-radius:6px;color:#e7f1d4;padding:8px 4px;font-size:12px;font-weight:800}#mode-pick button.selected{background:#365744;border-color:#b6d881}.tt-rival{margin-top:8px;font-size:11px;color:#fff3a6}.tt-rival b{color:var(--lime)}#tt-board{margin-top:8px}.tt-lead{font-size:12px;color:#cfe0c2;margin:10px 0 6px}.tt-name-row{display:flex;gap:8px}.tt-name-row input{flex:1;background:#254342;color:#e7f1d4;border:1px solid #65866e;border-radius:4px;padding:10px;font-size:14px;letter-spacing:1px;min-width:0}.tt-name-row button{background:var(--lime);color:#1d4037;border:0;border-radius:4px;padding:10px 18px;font-weight:900}.tt-status{font-size:11px;color:#f5d69c;min-height:16px;margin-top:6px}@media(max-width:750px){#track-cards{grid-template-columns:repeat(2,1fr)}.track-card b{font-size:9px}#setup{display:block}#setup .driver-lineup{flex-direction:row}#setup .driver-lineup .driver{flex:1;width:auto}#setup .driver-lineup .driver canvas{width:84px;height:81px}}
.rotate-prompt{position:absolute;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;background:#0d222bd9;padding:20px}.rotate-card{background:#122f38;border:1px solid #bcdb8877;border-radius:12px;padding:26px 30px;text-align:center;max-width:320px;box-shadow:0 8px 0 #081e3555}.rotate-icon{display:block;font-size:52px;color:var(--lime);animation:tilt 1.6s ease-in-out infinite}@keyframes tilt{0%,100%{transform:rotate(-25deg)}50%{transform:rotate(0deg)}}.rotate-card p{margin:12px 0 4px;font-size:14px}.rotate-card p b{display:block;font-size:19px;letter-spacing:1px;margin-bottom:6px}.rotate-card p span{color:#bdd0c4;font-size:12px}#rotate-dismiss{margin-top:14px;background:#254342;color:#e7f1d4;border:1px solid #65866e;border-radius:4px;padding:10px 18px;font-size:13px;font-weight:700}

/* Garage: one viewport, clear choices, and a single three-star difficulty control. */
/* Every scene shares the viewport, including results and pause. */
.shell{max-width:none;padding:0}
.stage{height:100svh;height:100dvh;aspect-ratio:auto;margin:0;border:0;border-radius:0}
.overlay:has(#setup:not(.hidden)){padding:20px;z-index:7;background:#0b202bb3}
.panel:has(#setup:not(.hidden)){display:grid;grid-template-columns:1fr auto;gap:16px 24px;width:940px;max-width:100%;max-height:none;overflow:visible;padding:26px 30px;border-radius:18px;background:#122f38f5;box-shadow:0 20px 70px #071b2966}
.panel:has(#setup:not(.hidden)) .game-title{grid-column:1/-1;margin:0;font-size:40px;letter-spacing:1.5px}
#setup{grid-column:1/-1;display:grid;grid-template-columns:230px minmax(0,1fr);grid-template-areas:'mode difficulty' 'drivers tracks' 'instructions instructions';gap:20px 24px;align-items:start;text-align:left}
#setup .choice-label{font-size:11px;letter-spacing:1.6px;margin:0 0 8px;color:#b8cbbb;font-weight:700}
#setup .mode-choice{grid-area:mode;margin:0}
#mode-pick{gap:4px;padding:4px;border-radius:9px;background:#091f29}
#mode-pick button{font-size:14px;padding:9px 10px;border:0;border-radius:6px;color:#b9cdcf;background:transparent}
#mode-pick button.selected{background:#365744;color:#edffde}
#setup .difficulty{grid-area:difficulty;display:flex;align-items:center;justify-content:flex-end;gap:14px;margin:0;align-self:center}
#setup .difficulty .choice-label{margin:0}
.difficulty-control{display:flex;align-items:center;gap:12px}
#difficulty-stars{display:flex;gap:0;padding:2px 5px;border:1px solid #648377;border-radius:10px;background:#0c252f}
#difficulty-stars button{width:42px;height:40px;padding:0;border:0;background:transparent;color:#537078;border-radius:6px;font-size:30px;line-height:1}
#difficulty-stars button.selected{background:transparent;border:0}
#difficulty-stars button.lit{color:#ffda7f;text-shadow:0 1px 6px #f5ce5533}
#difficulty-stars button:hover{background:#33515a}
#difficulty-name{min-width:62px;font-size:14px;color:#fff5d9;font-weight:700}
#setup .driver-choice-block{grid-area:drivers;min-width:0}
#setup .driver-lineup{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;margin:0}
#setup .driver-lineup .driver{flex:1;min-width:0;width:auto;padding:12px 4px 10px;border:2px solid #60756966;border-radius:10px;background:#203d48}
#setup .driver-lineup .driver.selected{background:#355840;border-color:#c4f47a}
#setup .driver-lineup .driver canvas{width:82px;height:79px;max-width:100%;object-fit:contain}
#setup .driver-lineup .driver b{font-size:13px;letter-spacing:1px;margin:8px 0 3px}
#setup .driver-lineup .driver small{font-size:8px;letter-spacing:.6px}
#setup .track-choice{grid-area:tracks;margin:0;min-width:0}
#track-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.track-card{display:flex;align-items:center;gap:12px;min-height:71px;padding:12px;border-radius:10px;text-align:left;background:#203d48;border:2px solid #60756966}
.track-card.selected{background:#355840;border-color:#c4f47a}
.track-icon{font-size:30px;line-height:1;flex:none}
.track-card b{font-size:17px;line-height:1.25;letter-spacing:0;margin:0}
#setup .instructions{grid-area:instructions;display:block;font-size:15px;line-height:1.4;margin:0;text-align:center;color:#a7c0bb}
#setup.tt-mode .difficulty{display:none}
#setup.tt-mode .driver-lineup{flex-direction:row}
.tt-rival{font-size:11px;margin-top:6px;line-height:1.3}
.panel:has(#setup:not(.hidden)) .audio-settings{grid-column:1;grid-row:4;justify-content:flex-start;gap:20px;align-items:center;margin:0;padding:0;border:0}
.panel:has(#setup:not(.hidden)) .audio-settings label{font-size:12px;gap:8px}
.panel:has(#setup:not(.hidden)) .audio-settings input{width:100px}
.panel:has(#setup:not(.hidden)) #audio-status{grid-row:3;grid-column:1/-1;margin:0;font-size:11px;line-height:1.3}
.panel:has(#setup:not(.hidden)) #play{grid-row:4;grid-column:2;min-width:0;padding:14px 20px;font-size:15px;letter-spacing:.6px;border-radius:9px;white-space:nowrap}
.panel:has(#setup:not(.hidden)) #play span{margin-left:10px}
@media(max-width:650px) and (orientation:portrait){
 .overlay:has(#setup:not(.hidden)){padding:12px}
 .panel:has(#setup:not(.hidden)){padding:18px 16px;gap:12px;grid-template-columns:1fr;border-radius:14px}
 .panel:has(#setup:not(.hidden)) .game-title{font-size:30px}
 #setup{grid-template-columns:1fr 1fr;grid-template-areas:'mode difficulty' 'drivers drivers' 'tracks tracks' 'instructions instructions';gap:12px}
 #setup .difficulty{display:block}
 #setup .difficulty .choice-label{margin-bottom:8px}
 .difficulty-control{gap:6px}#difficulty-stars{padding:2px}#difficulty-stars button{width:32px;height:36px;font-size:27px}#difficulty-name{font-size:11px;min-width:0}
 #mode-pick button{padding:10px 4px;font-size:12px}
 #setup .driver-lineup .driver{display:grid;grid-template-columns:62px 1fr;grid-template-rows:1fr 1fr;align-items:end;padding:6px;text-align:left}
 #setup .driver-lineup .driver canvas{grid-row:1/3;width:60px;height:58px}
 #setup .driver-lineup .driver b{font-size:12px;margin:0 0 3px}
 #setup .driver-lineup .driver small{align-self:start;font-size:7px}
 .track-card{min-height:62px;padding:9px;gap:7px}.track-icon{font-size:24px}.track-card b{font-size:15px}
 #setup .instructions{font-size:13px}
 .panel:has(#setup:not(.hidden)) .audio-settings{grid-row:4;grid-column:1;justify-content:space-between;gap:8px}
 .panel:has(#setup:not(.hidden)) .audio-settings input{width:70px}
 .panel:has(#setup:not(.hidden)) #play{grid-row:5;grid-column:1;padding:13px;font-size:14px}
}
@media(max-height:600px) and (orientation:landscape){
 .overlay:has(#setup:not(.hidden)){padding:8px 20px}
 .panel:has(#setup:not(.hidden)){width:940px;padding:12px 18px;gap:8px 18px;border-radius:12px}
 .panel:has(#setup:not(.hidden)) .game-title{font-size:27px}
 #setup{grid-template-columns:195px minmax(0,1fr);gap:10px 18px}
 #setup .choice-label{font-size:10px;margin-bottom:4px}
 #mode-pick button{padding:6px 8px;font-size:12px}
 #difficulty-stars button{width:35px;height:30px;font-size:25px}
 #setup .driver-lineup .driver{padding:5px 3px}
 #setup .driver-lineup .driver canvas{width:56px;height:54px}
 #setup .driver-lineup .driver b{font-size:11px;margin:3px 0 1px}
 #setup .driver-lineup .driver small{font-size:7px}
 .track-card{min-height:44px;padding:7px 9px;gap:8px}.track-icon{font-size:24px}.track-card b{font-size:15px}
 #setup .instructions{display:none}
 .panel:has(#setup:not(.hidden)) .audio-settings{gap:12px}
 .panel:has(#setup:not(.hidden)) .audio-settings input{width:75px}
 .panel:has(#setup:not(.hidden)) #play{font-size:12px;padding:11px 14px}
}
@media(max-height:650px) and (orientation:portrait){
 .panel:has(#setup:not(.hidden)){padding:12px;gap:8px}
 .panel:has(#setup:not(.hidden)) .game-title{font-size:25px}
 #setup{gap:8px}#setup .choice-label{margin-bottom:4px}
 #setup .driver-lineup .driver canvas{width:48px;height:46px}
 #setup .driver-lineup .driver{grid-template-columns:50px 1fr}
 .track-card{min-height:52px}.track-card b{font-size:14px}
}
.stage:has(#setup:not(.hidden)) .stage-top{z-index:8;top:max(7px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right));bottom:auto}
.stage:has(#results:not(.hidden)) .stage-top{z-index:8;top:max(7px,env(safe-area-inset-top));right:max(10px,env(safe-area-inset-right));bottom:auto}
#panel-title.new-record,#panel-title.new-record em{color:#ffd257}
/* Time trial: levels in one middle column, top-10 boards on the right. */
#tt-boards{display:none}
#setup.tt-mode{grid-template-columns:200px minmax(0,1fr) minmax(0,1.1fr);grid-template-areas:'mode mode mode' 'drivers tracks boards' 'instructions instructions instructions'}
#setup.tt-mode .driver-lineup{flex-direction:column}
#setup.tt-mode #track-cards{grid-template-columns:1fr}
#setup.tt-mode #tt-boards{display:block;grid-area:boards;min-width:0}
.tt-boards{display:grid;gap:12px;align-content:start;max-height:360px;overflow:auto;padding-right:4px}
.tt-board{min-width:0}
.tt-board h4{margin:0 0 6px;font-size:11px;letter-spacing:1.6px;color:#b8cbbb;font-weight:700}
.tt-board.selected h4{color:var(--lime)}
.tt-board .result-row{font-size:11px;padding:5px 9px}
@media(max-width:650px) and (orientation:portrait){
 #setup.tt-mode{grid-template-columns:1fr;grid-template-areas:'mode' 'drivers' 'tracks' 'boards' 'instructions'}
 #setup.tt-mode .driver-lineup{flex-direction:row}
 #setup.tt-mode .choice-label{font-size:9px;margin-bottom:4px}
 #setup.tt-mode #mode-pick button{padding:7px 4px;font-size:11px}
 #setup.tt-mode .driver-lineup .driver canvas{width:52px;height:50px}
 #setup.tt-mode .driver-lineup .driver b{font-size:11px}
 #setup.tt-mode .track-card{min-height:40px;padding:7px 8px;gap:7px}
 #setup.tt-mode .track-icon{font-size:22px}
 #setup.tt-mode .track-card b{font-size:14px}
 #setup.tt-mode .instructions{display:none}
 .panel:has(#setup.tt-mode:not(.hidden)) .game-title{font-size:26px}
 .tt-boards{max-height:150px}
}
@media(max-height:600px) and (orientation:portrait){
 .tt-boards{max-height:120px}
 #setup.tt-mode .track-card{min-height:36px}
}
@media(max-height:600px) and (orientation:landscape){
 #setup.tt-mode{grid-template-columns:180px minmax(0,1fr) minmax(0,1fr)}
 #setup.tt-mode .choice-label{font-size:9px;margin-bottom:4px}
 #setup.tt-mode #mode-pick button{padding:6px 4px;font-size:11px}
 #setup.tt-mode .driver-lineup .driver{padding:4px 2px}
 #setup.tt-mode .driver-lineup .driver canvas{width:40px;height:39px}
 #setup.tt-mode .driver-lineup .driver b{font-size:10px;margin:2px 0 1px}
 #setup.tt-mode .driver-lineup .driver small{font-size:6px}
 #setup.tt-mode .track-card{min-height:34px;padding:5px 8px;gap:6px}
 #setup.tt-mode .track-icon{font-size:20px}
 #setup.tt-mode .track-card b{font-size:13px}
 .panel:has(#setup.tt-mode:not(.hidden)) .game-title{font-size:22px}
 .tt-boards{max-height:220px}
}
#panel-title.champion{color:#ffd257}
/* Results: compact two-column finish screen that fits without scrolling. */
.panel:has(#results:not(.hidden)){display:grid;grid-template-columns:minmax(0,1fr) 230px;gap:8px 18px;align-items:start;grid-template-areas:'gametitle gametitle' 'title title' 'copy copy' 'results play' 'results garage' 'audio audio' 'status status'}
.panel:has(#results:not(.hidden)) #game-title{grid-area:gametitle;font-size:30px;margin:0}
.panel:has(#results:not(.hidden)) #panel-title{grid-area:title;font-size:32px;margin:4px 0}
.panel:has(#results:not(.hidden)) #panel-copy{grid-area:copy;margin:4px 0}
.panel:has(#results:not(.hidden)) #results{grid-area:results;margin:0;min-width:0}
.panel:has(#results:not(.hidden)) .result-row{padding:6px 10px}
.panel:has(#results:not(.hidden)) #play{grid-area:play;align-self:start;min-width:0;width:100%;margin:0;padding:14px 10px;font-size:15px}
.panel:has(#results:not(.hidden)) #garage{grid-area:garage;align-self:start;width:100%;margin:0}
.panel:has(#results:not(.hidden)) .audio-settings{grid-area:audio;margin:8px 0 0;padding-top:8px}
.panel:has(#results:not(.hidden)) #audio-status{grid-area:status}
@media(max-width:650px){
 .panel:has(#results:not(.hidden)){grid-template-columns:1fr;grid-template-areas:'gametitle' 'title' 'copy' 'results' 'play' 'garage' 'audio' 'status'}
}
@media(max-height:600px) and (orientation:landscape){
 .panel:has(#results:not(.hidden)){gap:5px 14px}
 .panel:has(#results:not(.hidden)) #game-title{font-size:24px}
 .panel:has(#results:not(.hidden)) #panel-title{font-size:26px;margin:2px 0}
 .panel:has(#results:not(.hidden)) #play{padding:10px;font-size:13px}
}

/* Keep canvas pixels proportional; portrait shows the center of the race. */
.game-window{position:absolute;inset:0;overflow:hidden}
.overlay{z-index:7;padding:max(42px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
.panel:has(#setup:not(.hidden)){max-height:100%;overflow:auto}
@media(orientation:portrait){
 .stage{display:flex;flex-direction:column;justify-content:center;background:#0b202b}
 .game-window{position:relative;inset:auto;width:100%;aspect-ratio:4/3;flex:none}
 .stage .stage-top{top:max(10px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));bottom:auto;z-index:8}
 .stage .touch-controls{position:relative;inset:auto;flex:none;gap:12px;margin:24px 0 0;padding:0 max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
 .stage .steering,.stage .pedals{gap:8px}
 .stage .touch-controls button{width:clamp(56px,17vw,90px);height:76px;font-size:26px}
 .stage .touch-controls .brake{width:clamp(56px,17vw,90px);height:76px;font-size:12px}
 .stage .touch-controls .item{width:clamp(92px,26vw,140px);font-size:12px}
 .overlay:has(#setup:not(.hidden)){padding-top:max(48px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom))}
 #setup .instructions{font-size:12px}
 .touch-device #setup .instructions{font-size:0}
 .touch-device #setup .instructions::after{content:'Auto acceleration · Use the buttons below the race to steer, brake, and use items.';font-size:12px}
}
@media(max-width:750px) and (orientation:portrait){
 .race-left{gap:8px;top:10px;left:10px}
 .position strong{font-size:38px}.position>span{font-size:12px}
 .lap{padding-left:8px}.lap small{font-size:9px}.lap b{font-size:20px}
 .race-right{top:10px;right:10px;gap:6px}.race-right button{width:36px;height:36px}
 .race-right #race-sound{font-size:9px}
 .standings{top:70px;left:10px;gap:3px}.standing{min-width:72px;font-size:9px;padding:4px 6px}
 #map{width:66px;height:66px;top:56px;right:10px}
 .race-track{top:auto;bottom:10px;font-size:10px;padding:5px 8px;max-width:55%;text-align:center}
 .speed,.big-screen .speed{bottom:8px;left:10px;transform:none}.speed b{font-size:22px}
 #lap-banner{top:24%;font-size:26px;padding:6px 12px}
 .countdown{top:28%;font-size:72px}
}

/* Give utility controls their own rows, clear of the driving buttons. */
.touch-device .stage .stage-top{
 top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));bottom:auto
}
.touch-device .stage-top button{min-width:44px;min-height:44px}
.touch-device .stage .race-right{
 top:calc(max(12px,env(safe-area-inset-top)) + 52px);right:max(12px,env(safe-area-inset-right));gap:8px
}
.touch-device .race-right button{min-width:44px;min-height:44px}
.touch-device #map{top:calc(max(12px,env(safe-area-inset-top)) + 106px);right:max(12px,env(safe-area-inset-right))}
@media(orientation:portrait){
 /* Fullscreen lives above the gameplay window; pause stays inside its HUD. */
 .touch-device .stage{padding-top:calc(max(12px,env(safe-area-inset-top)) + 52px)}
 .touch-device .stage .race-right{top:10px}
 .touch-device #map{top:64px}
}

/* The presenter credit belongs only to the start menu. */
.game-presenter{display:none;font:400 12px/1.4 'DM Sans',sans-serif;letter-spacing:1px;color:#cfe0c2;text-shadow:none;margin-bottom:8px}
.panel:has(#setup:not(.hidden)) .game-presenter{display:block}
