@font-face{font-family:Oxanium;src:url('./assets/oxanium.ttf') format('truetype');font-display:swap;font-weight:600}
@font-face{font-family:'Barlow Condensed';src:url('./assets/barlow-condensed.ttf') format('truetype');font-display:swap;font-weight:700}
:root{color-scheme:dark;--bg:#101214;--panel:#191c1f;--ink:#f1eee7;--muted:#a6a7a4;--orange:#ff6b35;--green:#a7edc7;--red:#ff6464;--line:#ffffff18;font-family:'PingFang SC','Microsoft YaHei',sans-serif;color:var(--ink);background:var(--bg);font-synthesis:none;-webkit-tap-highlight-color:transparent}
*,*::before,*::after{box-sizing:border-box;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}body{touch-action:manipulation}button,input{font:inherit;color:inherit}button,a,input{touch-action:manipulation}button{border:0;cursor:pointer}button:disabled{cursor:default}button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid var(--orange);outline-offset:4px}button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}button{transition:background .18s,color .18s,transform .18s}button:active:not(:disabled){transform:translateY(1px)}[hidden]{display:none!important}
.cockpit{position:relative;display:grid;grid-template-rows:60px minmax(0,1fr) 122px 22px;gap:16px;width:min(1440px,100%);height:100vh;height:100dvh;margin:0 auto;padding:20px 32px 14px}
.topbar{display:flex;justify-content:space-between;align-items:center;min-width:0}.brand{display:flex;align-items:center;gap:12px;text-decoration:none;color:var(--ink)}.brand-mark{width:32px;height:30px;color:var(--orange)}.brand-type{display:flex;flex-direction:column;gap:4px}.brand-type h1{font-size:21px;letter-spacing:.05em;font-weight:650}.brand-type>span{font-family:'Barlow Condensed',sans-serif;font-size:10px;letter-spacing:.19em;color:var(--muted)}.top-actions{display:flex;align-items:center;gap:10px}.icon-button{display:grid;place-items:center;background:transparent;color:var(--muted);width:40px;height:40px;border-radius:8px}.icon-button:hover{color:var(--ink);background:#ffffff0b}.icon-button[aria-pressed=true] .mute-slash{display:none}.rank-button{display:flex;align-items:center;gap:8px;height:40px;padding:0 14px;background:#ffffff09;border:1px solid var(--line);border-radius:8px;font-size:12px}.rank-button svg{width:17px;height:17px;color:var(--orange)}.rank-button:hover{background:#ffffff12}
.race{position:relative;min-height:0;overflow:hidden;border-radius:12px;isolation:isolate;background:#172025;border:1px solid #ffffff0b}#track,.race-shade{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.race-shade{background:linear-gradient(180deg,#090e1530 0%,transparent 40%,#080c0f55 73%,#080c0fde 100%)}.track-id,.personal-best{position:absolute;top:24px;z-index:2;font-size:10px;letter-spacing:.08em;color:#b1b9bd;display:flex;align-items:center;gap:8px}.track-id{left:26px}.track-dot,.connection-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:var(--orange)}.track-separator{color:#ffffff30;margin:0 4px}.personal-best{right:26px;letter-spacing:0}.personal-best strong{color:var(--ink);font-family:Oxanium,sans-serif;font-size:15px;margin-left:3px}.personal-best .time-unit{margin-left:-5px}.welcome{position:absolute;left:8%;top:50%;transform:translateY(-50%);z-index:3}.welcome h2{margin:0 0 20px;font-size:clamp(32px,4.1vw,62px);font-weight:650;letter-spacing:-.035em;line-height:1.25;text-wrap:balance}.welcome h2 span{color:var(--orange)}.welcome p{font-size:14px;color:#d0d2cc;margin:0 0 28px}.welcome p b{font-family:Oxanium,sans-serif;color:var(--ink);font-size:18px;font-weight:600}.primary-button{display:flex;align-items:center;justify-content:space-between;gap:28px;min-height:48px;padding:0 22px;border-radius:6px;background:var(--orange);color:#17110c;font-weight:650;font-size:14px}.primary-button:hover{background:#ff8658}.primary-button:disabled{opacity:.6}.primary-button svg{width:20px;height:20px}.start-button{width:230px}.welcome-hint{display:block;font-size:11px;margin-top:16px;color:var(--muted)}.race-footer{position:absolute;bottom:20px;left:26px;right:26px;display:flex;align-items:center;justify-content:space-between;color:#919a9e;font-size:9px;letter-spacing:.12em}.race-footer>span:first-child{letter-spacing:0}.connection-dot{width:4px;height:4px;background:#9ba4a6;margin-right:7px}.race-footer>span:nth-child(2){color:#bbbdb6;font-family:Oxanium,sans-serif;font-size:12px}.race-footer>span:last-child{font-family:'Barlow Condensed',sans-serif;font-size:11px;letter-spacing:.17em}
.live-hud{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:45px 0 42px;gap:8px;pointer-events:none}.race-status{display:flex;align-items:center;gap:9px;min-height:24px;color:#e7dbcd;font-size:13px;font-weight:500}.status-light{width:7px;height:7px;border-radius:50%;background:var(--orange)}[data-state=armed] .status-light,[data-state=braking] .status-light{background:var(--green)}[data-state=armed] .race-status{color:var(--green)}.speedometer{position:relative;width:clamp(230px,26vw,340px);height:clamp(169px,18.9vw,247px);flex-shrink:1;min-height:0}.speed-arc{width:100%;height:100%;overflow:visible}.arc-base{stroke:#e5e7e325;stroke-width:5;fill:none}.arc-value{stroke:var(--orange);stroke-width:5;fill:none;stroke-dasharray:0 200;transition:stroke .2s}.arc-ticks{fill:none;stroke:#eae7e270;stroke-width:12;stroke-dasharray:.45 9.55;stroke-dashoffset:.2}.speed-arc text{font-size:8px;fill:#a7b1b3;font-family:Oxanium,sans-serif}.speed-readout{position:absolute;inset:24% 0 0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-bottom:5px}.speed-readout strong{font-family:'Barlow Condensed',sans-serif;font-size:clamp(86px,10vw,136px);font-variant-numeric:tabular-nums;line-height:.9;letter-spacing:-.025em}.speed-readout>span{font-family:Oxanium,sans-serif;font-size:10px;letter-spacing:.3em;margin-top:16px;color:#c2cacb}.timing{display:flex;align-items:baseline;gap:10px;padding-top:8px}.timing>span{font-size:11px;color:#b1bab9}.timing strong{font-family:Oxanium,sans-serif;font-size:26px;letter-spacing:-.02em;font-variant-numeric:tabular-nums}.timing>span:last-child{font-size:12px;color:#d8dad4}
.control-deck{display:flex;align-items:center;gap:52px;padding:12px 0 2px}.pressure-panel{flex:1;min-width:0}.pressure-heading{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:14px;color:#c6c7bf;font-size:12px}.pressure-number{font-family:Oxanium,sans-serif;color:#e7e8de}.pressure-number strong{font-size:28px;font-weight:600}.pressure-number>span{font-size:11px;margin-left:3px;color:var(--muted)}.pressure-track{position:relative;width:100%;height:7px;background:#ffffff13}.pressure-track>span{position:absolute;inset:0 auto 0 0;width:0;background:var(--green);transition:background .1s}.force-limit{position:absolute;right:0;top:-3px;height:13px;width:2px;background:var(--red)}.pressure-scale{display:flex;justify-content:space-between;margin-top:10px;font-size:10px;color:var(--muted);font-variant-numeric:tabular-nums}.brake-pedal{position:relative;display:flex;justify-content:center;align-items:center;gap:18px;width:42%;height:98px;border-radius:8px;border:1px solid #ff8b6060;background:var(--orange);color:#21150d;touch-action:none;overflow:hidden;-webkit-touch-callout:none}.brake-pedal::after{content:'';position:absolute;left:0;right:0;bottom:0;height:4px;background:#9f371b80}.brake-pedal:disabled{background:#1d2022;border-color:var(--line);color:#737a7d}.brake-pedal:disabled::after{background:#0a0d10}.brake-pedal:not(:disabled):hover{background:#ff8252}.brake-pedal[aria-pressed=true]{background:#e75524;transform:translateY(2px);border-color:#ffa27a}.brake-pedal[aria-pressed=true]::after{height:1px}.pedal-icon{height:34px!important;width:26px!important;stroke-width:1.2!important}.pedal-copy{display:flex;flex-direction:column;gap:7px;text-align:left}.pedal-copy strong{font-size:20px;font-weight:650;letter-spacing:.05em}.pedal-copy>span{font-family:'Barlow Condensed',sans-serif;font-size:10px;letter-spacing:.14em;opacity:.7}.keyboard-key{position:absolute;right:18px;bottom:15px;font-family:Oxanium,sans-serif;font-size:8px;letter-spacing:.06em;border:1px solid currentColor;padding:4px 5px;border-radius:3px;opacity:.45}.bottomline{display:flex;justify-content:space-between;align-items:center;color:#848982;font-size:10px;min-width:0}.mobile-hint{display:none}
.result,.paused{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:50px 24px 36px;background:#0d131bea;z-index:4;text-align:center}.result-symbol{width:36px;height:36px;margin-bottom:10px;color:var(--green)}.result-symbol svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.result h2,.paused h2{font-size:clamp(22px,3vw,34px);font-weight:600;letter-spacing:-.02em;margin:0 0 10px}.result-score{display:flex;gap:10px;align-items:baseline;margin:6px 0 12px}.result-score strong{font-family:'Barlow Condensed',sans-serif;font-size:clamp(64px,7vw,94px);line-height:1;letter-spacing:-.025em;font-variant-numeric:tabular-nums}.result-score>span{font-family:Oxanium,sans-serif;font-size:18px;color:var(--muted)}.result p,.paused p{font-size:12px;color:#aeb4b0;margin:0;line-height:1.7;max-width:36ch}.save-status{display:block;height:30px;line-height:30px;margin-top:7px;font-size:11px;color:var(--green)}.result-actions{display:flex;align-items:center;gap:24px;margin-top:12px}.text-button{padding:10px 0;font-size:12px;background:transparent;color:#b4b7ae;white-space:nowrap}.text-button:hover{color:var(--ink)}.paused{z-index:5}.paused .primary-button{margin-top:26px;min-width:200px}.paused>.text-button{margin-top:10px}[data-state=failure] .result-symbol{color:var(--red)}[data-state=failure] .save-status{color:var(--muted)}.toast{position:absolute;bottom:172px;left:50%;transform:translateX(-50%);max-width:90%;padding:12px 20px;background:#24282b;color:var(--ink);font-size:12px;border-radius:6px;z-index:9;text-align:center;box-shadow:0 8px 25px #0006}
.leaderboard{position:fixed;inset:0;width:min(470px,calc(100% - 32px));max-height:calc(100dvh - 40px);padding:26px;border:1px solid #ffffff18;border-radius:12px;color:var(--ink);background:#171b1e;overflow:hidden;box-shadow:0 22px 80px #0008}.leaderboard::backdrop{background:#000a}.board-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:22px}.board-header h2{margin:0 0 8px;font-size:23px;font-weight:600}.board-header p{font-size:10px;color:var(--muted);margin:0}.board-header p span{margin:0 7px}.board-header .icon-button{margin:-5px -8px 0 0}.driver-form{border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:16px 0;margin-bottom:20px}.driver-form label{display:block;font-size:10px;color:var(--muted);margin-bottom:9px}.driver-form>div{display:flex;gap:8px}.driver-form input{flex:1;min-width:0;border:1px solid #ffffff17;background:#0e1215;border-radius:5px;padding:9px 11px;font-size:12px;-webkit-user-select:none;user-select:none}.driver-form input::placeholder{color:#969c99}.driver-form button{font-size:11px;padding:0 17px;background:#ffffff0c;border-radius:5px}.driver-form>span{font-size:10px;color:var(--green);display:block;margin-top:7px;min-height:12px}.board-columns{display:flex;justify-content:space-between;color:var(--muted);font-size:10px;margin-bottom:8px}.board-list{list-style:none;margin:0;padding:0;min-height:100px}.board-row{display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:12px;height:37px;border-bottom:1px solid #ffffff08;font-size:12px}.board-rank{font-family:Oxanium,sans-serif;font-size:11px;color:#9ca49f}.board-score{font-family:Oxanium,sans-serif;font-size:13px}.board-score small{font-size:10px;color:var(--muted);margin-left:4px}.board-row.is-current{color:var(--orange)}.board-row.is-current .board-rank{color:var(--orange)}.board-empty{padding:26px 8px;text-align:center;color:var(--muted);font-size:12px;line-height:1.8}.board-footer{display:flex;align-items:center;justify-content:space-between;margin-top:14px;gap:8px}.board-footer>span{font-size:9px;color:var(--muted)}.board-pagination{display:flex;gap:8px;align-items:center;color:var(--muted);font-size:10px}.board-pagination button{background:#ffffff0b;border-radius:4px;min-width:26px;height:26px}.board-pagination button:disabled{opacity:.35}
@media(min-width:1000px){.race::after{content:'';position:absolute;pointer-events:none;inset:0;border:12px solid #050a0d25;border-radius:12px}.welcome{top:48%}.race-footer{bottom:25px}}
@media(max-width:640px){.cockpit{padding:max(8px,env(safe-area-inset-top)) 16px max(8px,env(safe-area-inset-bottom));gap:12px;grid-template-rows:58px minmax(0,1fr) 170px 18px}.brand{gap:9px}.brand-mark{width:26px;height:26px}.brand-type h1{font-size:18px}.brand-type>span{font-size:8px}.top-actions{gap:4px}.icon-button{width:34px;height:38px}.rank-button{padding:0 10px;font-size:11px;height:35px;gap:6px}.rank-button svg{width:15px}.race{border-radius:8px}.track-id,.personal-best{top:17px;font-size:8px;gap:5px}.track-id{left:16px}.track-separator{margin:0 1px}.personal-best{right:16px}.personal-best strong{font-size:12px}.race-footer{left:16px;right:16px;bottom:16px;font-size:8px}.race-footer>span:nth-child(2){font-size:10px}.race-footer>span:last-child{font-size:9px}.welcome{left:24px;right:24px;top:48%;text-align:center}.welcome h2{font-size:clamp(29px,7.8vw,42px);line-height:1.3;margin-bottom:16px}.welcome p{font-size:12px;margin-bottom:23px}.welcome p b{font-size:16px}.start-button{width:100%;max-width:250px;margin:0 auto;height:48px}.welcome-hint{font-size:10px;margin-top:12px}.control-deck{display:grid;grid-template-rows:58px 96px;gap:12px;padding:0}.pressure-heading{font-size:11px;margin-bottom:8px}.pressure-number strong{font-size:22px}.pressure-number>span{font-size:10px}.pressure-scale{margin-top:7px;font-size:9px}.pressure-track{height:5px}.brake-pedal{width:100%;height:96px;border-radius:7px}.pedal-copy strong{font-size:21px}.pedal-copy>span{font-size:9px}.pedal-icon{height:32px!important}.keyboard-key{display:none}.bottomline{font-size:8px}.desktop-hint{display:none}.mobile-hint{display:inline}.live-hud{padding:48px 0 40px;gap:5px}.race-status{font-size:12px}.speedometer{width:min(270px,74vw);height:min(196px,54vw)}.speed-readout strong{font-size:100px}.speed-readout>span{margin-top:11px;font-size:9px}.timing{padding-top:4px;gap:9px}.timing strong{font-size:24px}.timing>span{font-size:10px}.result,.paused{padding:40px 18px 30px}.result h2,.paused h2{font-size:24px}.result-score strong{font-size:76px}.result-score{margin:4px 0 10px}.result p{font-size:10px}.result-symbol{width:30px;height:30px;margin-bottom:6px}.save-status{font-size:10px;height:25px;line-height:25px;margin-top:3px}.result-actions{gap:22px;margin-top:10px}.result-actions .primary-button{min-height:44px;font-size:12px;padding:0 18px;gap:20px}.result-actions .text-button{font-size:11px}.toast{bottom:210px}.leaderboard{padding:20px;max-height:calc(100dvh - 24px)}.board-header{margin-bottom:16px}.driver-form{margin-bottom:14px;padding:12px 0}.board-row{height:34px}.board-footer{margin-top:12px}}
@media(max-height:680px) and (max-width:640px){.cockpit{grid-template-rows:48px minmax(0,1fr) 144px 16px;gap:8px;padding-top:max(4px,env(safe-area-inset-top))}.brand-type h1{font-size:16px}.control-deck{grid-template-rows:50px 82px;gap:10px}.brake-pedal{height:82px}.welcome h2{font-size:29px;margin-bottom:12px}.welcome p{margin-bottom:16px;font-size:11px}.welcome-hint{margin-top:10px;font-size:9px}.welcome{top:49%}.track-id,.personal-best{top:13px;font-size:7px}.race-footer{bottom:12px}.live-hud{padding-top:36px;padding-bottom:32px;gap:0}.race-status{font-size:10px;min-height:20px}.speedometer{width:220px;height:160px}.speed-readout strong{font-size:82px}.speed-readout>span{font-size:8px;margin-top:8px}.timing strong{font-size:21px}.result-score strong{font-size:60px}.result h2{font-size:21px}.result-symbol{height:24px;width:24px}.result-actions .primary-button{min-height:40px}.board-header h2{font-size:21px}.board-header{margin-bottom:12px}.board-row{height:30px}.board-list{min-height:60px}.driver-form{padding:9px 0}.toast{bottom:170px}}
@media(max-height:500px){.cockpit{grid-template-rows:40px minmax(0,1fr) 16px;gap:8px;padding:6px 20px}.race{margin-right:270px}.control-deck{position:absolute;right:20px;top:70px;bottom:45px;width:245px;display:flex;flex-direction:column;justify-content:center;gap:24px}.pressure-panel{flex:0;width:100%}.brake-pedal{width:100%;height:100px;flex-shrink:0}.keyboard-key{display:none}.bottomline{grid-row:3}.welcome{left:24px;top:52%;text-align:left}.welcome h2{font-size:30px;margin-bottom:10px}.welcome p{font-size:10px;margin-bottom:14px}.welcome-hint{font-size:9px;margin-top:8px}.start-button{min-height:40px;width:190px;margin:0}.track-id,.personal-best{top:13px;font-size:7px}.personal-best strong{font-size:11px}.race-footer{bottom:12px;font-size:7px}.live-hud{flex-direction:row;gap:20px;padding:32px 20px 30px}.race-status{position:absolute;top:38px;font-size:10px}.speedometer{width:190px;height:139px;flex-shrink:0}.speed-readout strong{font-size:78px}.speed-readout>span{font-size:8px;margin-top:10px}.timing{flex-direction:column;gap:5px;padding:0}.timing strong{font-size:24px}.result{padding:34px 10px 20px}.result h2{font-size:20px;margin-bottom:2px}.result-symbol{display:none}.result-score strong{font-size:52px}.result-score{margin:2px 0 5px}.result p{font-size:10px}.save-status{height:22px;line-height:22px;margin:0}.result-actions{margin-top:6px}.result-actions .primary-button{min-height:36px;font-size:11px}.paused h2{font-size:24px}.paused .primary-button{margin-top:14px;min-height:38px}.leaderboard{width:min(640px,calc(100% - 32px));padding:14px 22px}.board-header{margin-bottom:8px}.board-header h2{font-size:19px}.board-header p{font-size:9px}.driver-form{padding:8px 0;margin-bottom:8px}.driver-form label{display:none}.driver-form>span{display:none}.board-row{height:27px}.board-empty{padding:10px}.board-list{min-height:0}.board-footer{margin-top:6px}.toast{bottom:50px}}
@media(max-height:500px) and (max-width:580px) and (orientation:portrait){.cockpit{grid-template-rows:40px minmax(0,1fr) 118px 12px;padding:4px 12px;gap:6px}.race{margin:0}.control-deck{position:static;display:grid;width:auto;grid-template-rows:42px 68px;gap:8px}.brake-pedal{height:68px}.bottomline{grid-row:4}.welcome{top:51%;left:16px;right:16px;text-align:center}.welcome h2{font-size:24px;margin-bottom:7px}.welcome p{margin-bottom:10px}.start-button{min-height:36px;margin:auto}.welcome-hint{display:none}.personal-best{display:none}.race-footer{display:none}.live-hud{flex-direction:column;padding:25px 0 5px;gap:0}.race-status{top:22px;font-size:9px}.speedometer{width:165px;height:120px}.speed-readout strong{font-size:67px}.timing{flex-direction:row;gap:8px}.timing strong{font-size:18px}.result{padding:15px}.result p{font-size:9px}.result-actions{gap:14px}.leaderboard{max-height:calc(100dvh - 16px)}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important}}

@media(max-height:500px) and (max-width:740px) and (orientation:landscape){
 .cockpit{padding-left:12px;padding-right:12px}.race{margin-right:210px}.control-deck{right:12px;width:194px;top:64px;bottom:36px;gap:18px}.brake-pedal{height:84px;gap:10px}.pedal-copy strong{font-size:17px}.pedal-copy>span{font-size:8px}.live-hud{flex-direction:column;padding:34px 8px 20px;gap:0}.race-status{position:static;min-height:18px;font-size:9px}.speedometer{width:166px;height:121px}.speed-readout strong{font-size:66px}.speed-readout>span{font-size:7px;margin-top:7px}.timing{flex-direction:row;gap:7px}.timing strong{font-size:19px}.timing>span{font-size:8px}.track-id{left:12px}.personal-best{right:12px}.race-footer{left:12px;right:12px;font-size:6px}.race-footer>span:last-child{font-size:7px}.welcome{left:16px;right:16px}.welcome h2{font-size:25px}.welcome-hint{font-size:8px}.result h2{font-size:18px}.result p{font-size:9px}.result-actions{gap:12px}.result-actions .primary-button{padding:0 12px;gap:12px}
}

/* One exterior stage, two content states. Canvas bounds never change with state. */
.cockpit{grid-template-rows:60px minmax(0,1fr);gap:12px;padding-bottom:max(16px,env(safe-area-inset-bottom))}
.race{margin:0;grid-row:2;background:#121c23}
#track,#exterior-track{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;transform-origin:72% 62%}
#exterior-track{z-index:0;opacity:1}
#track{z-index:1;opacity:0}
.race-shade{z-index:2;background:linear-gradient(90deg,#090f1670,transparent 60%)}
.outside-content{position:absolute;left:8%;top:49%;transform:translateY(-50%);width:40%;max-width:440px;z-index:3}
.outside-content .welcome,.outside-content .result{position:static;inset:auto;transform:none;padding:0;background:none;text-align:left;display:block}
.welcome h2{font-size:clamp(30px,3.5vw,52px);margin-bottom:16px}
.welcome p{margin-bottom:22px}.welcome-hint{margin-top:12px}
.result h2{font-size:clamp(22px,2.5vw,32px);margin:0 0 8px;line-height:1.2}
.result-score{display:flex;align-items:baseline;gap:8px;margin:0 0 12px}
.result-score strong{font-family:Oxanium,sans-serif;font-size:clamp(48px,5.8vw,80px);line-height:1.1;letter-spacing:-.035em}
.result-score>span{font-size:16px;color:var(--muted)}
.result-metrics{display:flex;gap:24px;margin-bottom:8px}
.result-metrics>div{display:flex;align-items:baseline;gap:6px;font-size:11px;color:var(--muted)}
.result-metrics strong{font:600 16px Oxanium,sans-serif;color:var(--ink)}
.result-metrics small{font-size:10px}
.result p{font-size:13px;line-height:1.6;margin:12px 0 18px;color:var(--muted);max-width:28em}
.save-status{display:block;min-height:24px;height:auto;line-height:1.5;margin:0 0 12px;font-size:11px;color:var(--muted)}
.result-actions{display:flex;align-items:center;gap:18px;margin:0}
.result-actions .primary-button{min-height:46px;gap:20px;white-space:nowrap}
.result-actions .text-button{min-height:44px;padding:8px 0;white-space:nowrap}
.control-deck{position:absolute;z-index:5;bottom:max(32px,env(safe-area-inset-bottom));left:8%;right:8%;width:auto;height:104px;display:grid;grid-template-columns:minmax(0,1fr) minmax(230px,.65fr);grid-template-rows:1fr;align-items:center;gap:40px;background:transparent}
.brake-pedal{width:100%;height:96px}
.bottomline,.race-footer{display:none}
.live-hud{padding:48px 24px 152px;flex-direction:column;gap:8px}
.race-status{position:static}
.speedometer{width:300px;height:218px}
.timing{flex-direction:row;gap:10px}
.toast{z-index:12;bottom:24px}
.cockpit:is([data-state=ready],[data-state=success],[data-state=failure]) .control-deck{display:none}
.cockpit:not(:is([data-state=ready],[data-state=success],[data-state=failure])) .outside-content{visibility:hidden;pointer-events:none}
.cockpit:is([data-state=accelerating],[data-state=armed],[data-state=braking],[data-state=breaking],[data-state=paused]) #track{opacity:1}
.cockpit:is([data-state=accelerating],[data-state=armed],[data-state=braking],[data-state=breaking],[data-state=paused]) #exterior-track{opacity:0}
.cockpit[data-state=entering] #track{animation:cockpit-entry 760ms cubic-bezier(.22,.7,.2,1) both}
.cockpit[data-state=entering] #exterior-track{animation:exterior-entry 760ms cubic-bezier(.22,.7,.2,1) both}
.cockpit[data-state=entering] .control-deck{opacity:0;pointer-events:none}
.cockpit[data-state=exiting] #track{animation:cockpit-exit 360ms ease-out both}
.cockpit[data-state=exiting] #exterior-track{animation:exterior-exit 360ms ease-out both}
.cockpit[data-state=exiting] .control-deck{visibility:hidden;pointer-events:none}
.cockpit[data-state=breaking] .brake-pedal{visibility:hidden;pointer-events:none}
.cockpit[data-state=breaking] .pressure-panel{opacity:.35}
@keyframes cockpit-entry{0%{opacity:0;transform:perspective(900px) translateX(16%) scale(.72) rotateY(-12deg)}45%{opacity:0}100%{opacity:1;transform:perspective(900px) translateX(0) scale(1) rotateY(0)}}
@keyframes exterior-entry{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1.65) translateX(-8%)}}
@keyframes cockpit-exit{from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.86) translateX(8%)}}
@keyframes exterior-exit{from{opacity:0;transform:scale(1.14)}to{opacity:1;transform:scale(1)}}
/* Authored SVG fragment launches from the sampled pedal center, not a fixed corner. */
.pedal-fragment{position:fixed;z-index:20;width:56px;height:80px;pointer-events:none;animation:pedal-flight 600ms cubic-bezier(.2,.6,.45,1) both;filter:drop-shadow(0 5px 6px #0008)}
.pedal-fragment svg{width:100%;height:100%;overflow:visible}
.fragment-stem{fill:none;stroke:#d4d8d8;stroke-width:7;stroke-linejoin:bevel}
.fragment-plate{fill:#393f45;stroke:#ccd4d8;stroke-width:2}
.fragment-grip{fill:none;stroke:#9aa5ad;stroke-width:4}
.pedal-fragment i{position:absolute;left:50%;top:50%;width:4px;height:12px;background:#ffd68a;box-shadow:0 0 8px #ff6b35;animation:pedal-spark 420ms ease-out both;--spark-x:75px;--spark-y:-65px}
.pedal-fragment i:nth-of-type(2){--spark-x:-65px;--spark-y:50px}
.pedal-fragment i:nth-of-type(3){--spark-x:45px;--spark-y:75px}
.pedal-fragment i:nth-of-type(4){--spark-x:-90px;--spark-y:-30px}
@keyframes pedal-flight{0%{transform:translate(0,0) rotate(-10deg);opacity:1}20%{transform:translate(calc(var(--flight-x)*.12),-95px) rotate(80deg);opacity:1}85%{opacity:1}100%{transform:translate(var(--flight-x),var(--flight-y)) rotate(620deg);opacity:0}}
@keyframes pedal-spark{from{transform:translate(0,0) rotate(0);opacity:1}to{transform:translate(var(--spark-x),var(--spark-y)) rotate(120deg);opacity:0}}
@media(max-width:640px) and (orientation:portrait){
 .cockpit{grid-template-rows:48px minmax(0,1fr);gap:8px;padding: max(8px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom))}
 .race{margin:0}.outside-content{left:8%;top:30%;width:84%;max-width:none;transform:translateY(-50%)}
 .welcome h2{font-size:clamp(29px,8.4vw,38px);line-height:1.22;margin-bottom:12px}
 .welcome p{font-size:12px;margin-bottom:18px}.welcome-hint{font-size:10px;margin-top:10px}
 .start-button{width:210px;margin:0;min-height:44px}
 .result h2{font-size:24px}.result-score strong{font-size:64px}.result-score{margin-bottom:10px}
 .result-metrics{gap:24px}.result-actions{gap:20px}.result-actions .primary-button{min-height:44px}
 .save-status{margin-bottom:8px;font-size:10px}.result p{font-size:12px}
 .track-id,.personal-best{top:16px;font-size:8px}.track-id{left:16px}.personal-best{right:16px}
 .control-deck{left:28px;right:28px;bottom:max(28px,env(safe-area-inset-bottom));height:166px;grid-template-columns:1fr;grid-template-rows:56px 96px;gap:14px}
 .brake-pedal{height:96px}.live-hud{padding:42px 12px 192px;gap:4px}.speedometer{width:260px;height:189px}.speed-readout strong{font-size:96px}
 .timing strong{font-size:25px}.timing>span{font-size:10px}
 #track,#exterior-track{transform-origin:51% 73%}
}
@media(max-height:680px) and (orientation:portrait){
 .outside-content{top:30%}.welcome h2{font-size:29px;margin-bottom:10px}.welcome p{margin-bottom:12px}.welcome-hint{font-size:9px;margin-top:8px}
 .result h2{font-size:21px;margin-bottom:4px}.result-score strong{font-size:49px}.result-score{margin-bottom:6px}
 .result-metrics{gap:16px;margin-bottom:4px}.result-metrics strong{font-size:13px}.result-metrics>div{font-size:10px;gap:4px}
 .save-status{min-height:18px;margin-bottom:6px;font-size:9px}.result-actions{gap:16px}.result-actions .primary-button{min-height:40px;font-size:12px;padding:0 16px}.result-actions .text-button{font-size:11px}
 .control-deck{height:140px;grid-template-rows:48px 82px;gap:10px;bottom:24px}.brake-pedal{height:82px}
 .live-hud{padding:38px 8px 166px;gap:0}.speedometer{width:210px;height:153px}.speed-readout strong{font-size:78px}.timing strong{font-size:21px}
}
@media(max-height:500px) and (orientation:landscape){
 .cockpit{grid-template-rows:40px minmax(0,1fr);padding:6px 12px;gap:6px}.race{margin:0}
 .outside-content{left:8%;top:53%;width:43%;transform:translateY(-50%)}
 .welcome h2{font-size:25px;margin-bottom:8px}.welcome p{font-size:10px;margin-bottom:10px}.welcome-hint{font-size:8px;margin-top:6px}.start-button{min-height:38px;width:180px;margin:0}
 .track-id,.personal-best{top:12px;font-size:7px}.track-id{left:16px}.personal-best{right:16px}
 .result h2{font-size:20px;margin-bottom:3px}.result-score strong{font-size:44px}.result-score{margin-bottom:5px}
 .result-metrics{gap:14px;margin-bottom:3px}.result-metrics>div{font-size:9px;gap:4px}.result-metrics strong{font-size:12px}.result-metrics small{font-size:8px}
 .save-status{min-height:16px;font-size:8px;margin-bottom:4px}.result-actions{gap:14px}.result-actions .primary-button{min-height:36px;font-size:11px;padding:0 12px;gap:12px}.result-actions .text-button{font-size:10px;min-height:36px}.result p{font-size:10px;margin:8px 0 12px}
 .control-deck{left:auto;right:28px;width:180px;bottom:24px;height:170px;display:grid;grid-template-columns:1fr;grid-template-rows:56px 90px;gap:24px}.brake-pedal{height:90px}.keyboard-key{display:none}
 .live-hud{right:210px;padding:32px 8px 12px;gap:0}.speedometer{width:180px;height:131px}.speed-readout strong{font-size:72px}.timing{flex-direction:row;gap:6px}.timing strong{font-size:20px}.race-status{font-size:10px}
}
@media(prefers-reduced-motion:reduce){
 .cockpit[data-state=entering] #track{opacity:1;transform:none}
 .cockpit[data-state=exiting] #track{opacity:0;transform:none}
 .cockpit[data-state=exiting] #exterior-track{opacity:1;transform:none}
 .pedal-fragment{display:none}
}

/* Keep live instruments above the canvas, anchored in the windshield sky. */
.race{container-type:size}
.live-hud{z-index:4;inset:max(84px,calc(env(safe-area-inset-top) + 72px)) 0 auto;padding:0 16px;justify-content:flex-start;flex-direction:column;gap:4px}
.live-hud .race-status{position:static;min-height:20px;font-size:12px}
.live-hud .speedometer{width:clamp(130px,22cqh,280px);height:auto;aspect-ratio:300/218;flex-shrink:0}
.live-hud .speed-readout strong{font-size:clamp(54px,9cqh,112px)}
.live-hud .speed-readout>span{font-size:9px;margin-top:8px}
.live-hud .timing{flex-direction:row;padding-top:0;gap:8px}
.live-hud .timing strong{font-size:clamp(19px,3cqh,26px)}
@media(max-height:680px) and (orientation:portrait){
 .live-hud{top:max(68px,calc(env(safe-area-inset-top) + 60px));gap:0}
 .live-hud .race-status{min-height:18px;font-size:10px}
 .live-hud .speed-readout>span{font-size:8px;margin-top:5px}
 .live-hud .timing>span{font-size:9px}
}
@media(max-height:500px) and (orientation:landscape){
 .live-hud{inset:max(60px,calc(env(safe-area-inset-top) + 52px)) 210px auto 0;gap:0}
 .live-hud .race-status{min-height:16px;font-size:10px}
 .live-hud .speedometer{width:130px;height:58px;aspect-ratio:auto}
 .live-hud .speed-arc{display:none}
 .live-hud .speed-readout{inset:0;flex-direction:row;align-items:baseline;gap:7px;padding:0}
 .live-hud .speed-readout strong{font-size:58px}
 .live-hud .speed-readout>span{font-size:8px;margin:0}
 .live-hud .timing strong{font-size:18px}
 .live-hud .timing>span{font-size:9px}
}

/* The viewport is the game: navigation floats over the scenery, not above it. */
.cockpit{display:block;width:100%;max-width:none;height:100vh;height:100dvh;margin:0;padding:0}
.cockpit .race{position:absolute;inset:0;margin:0;border:0;border-radius:0}
.topbar{position:absolute;z-index:10;top:max(20px,env(safe-area-inset-top));left:max(28px,env(safe-area-inset-left));right:max(28px,env(safe-area-inset-right));height:44px;background:none}
.topbar::before{content:"";position:absolute;z-index:-1;top:calc(-1 * max(20px,env(safe-area-inset-top)));left:calc(-1 * max(28px,env(safe-area-inset-left)));right:calc(-1 * max(28px,env(safe-area-inset-right)));height:110px;background:linear-gradient(#080e1570,transparent);pointer-events:none}
.brand{text-shadow:0 2px 14px #0008}
.top-actions .icon-button,.rank-button{background:#10182055;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
.welcome .personal-best{position:static;display:flex;justify-content:flex-start;margin-top:16px;font-size:10px;letter-spacing:0;gap:6px}
@media(max-width:640px){
 .topbar{top:max(12px,env(safe-area-inset-top));left:max(16px,env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right));height:40px}
 .topbar::before{top:calc(-1 * max(12px,env(safe-area-inset-top)));left:calc(-1 * max(16px,env(safe-area-inset-left)));right:calc(-1 * max(16px,env(safe-area-inset-right)));height:90px}
 .welcome .personal-best{justify-content:flex-start;font-size:9px;margin-top:12px}
}
@media(max-height:500px) and (orientation:landscape){
 .topbar{top:max(8px,env(safe-area-inset-top));height:36px}
 .welcome .personal-best{justify-content:flex-start;margin-top:8px;font-size:8px}
}

/* Centered, two-line telemetry stays visible throughout the race. */
.topbar{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);column-gap:16px}
.topbar .brand{justify-self:start}
.topbar .top-actions{justify-self:end}
.race-stats{width:168px;display:grid;gap:4px;padding:0;pointer-events:none}
.race-stats>div{width:calc(100% - 28px);display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;justify-self:start}
.race-stats>div:last-child{justify-self:end}
.race-stats span{display:flex;align-items:center;gap:7px;font-size:10px;letter-spacing:.08em;color:#9aa7b2;white-space:nowrap}
.race-stats span::before{content:"";width:2px;height:8px;background:var(--orange);transform:skewX(-18deg);flex-shrink:0;opacity:.75}
.race-stats>div:last-child span::before{background:var(--green)}
.race-stats strong{font-family:Oxanium,sans-serif;font-size:20px;font-weight:600;font-variant-numeric:tabular-nums;line-height:1;color:var(--ink);text-align:right}
.race-stats>div:last-child strong{color:var(--green)}
@media(max-width:640px){
 .topbar{column-gap:6px}
 .topbar .brand{gap:6px}
 .topbar .brand-mark{width:19px;height:24px}
 .topbar .brand-type h1{font-size:14px;letter-spacing:0}
 .topbar .brand-type>span{font-size:7px;letter-spacing:.13em}
 .race-stats{width:98px;padding:0;gap:5px}
 .race-stats>div{width:calc(100% - 8px);gap:4px}
 .race-stats span{font-size:8.5px;letter-spacing:0;gap:5px}
 .race-stats span::before{height:6px}
 .race-stats strong{font-size:16px}
 .topbar .top-actions{gap:3px}
 .topbar .icon-button,.topbar .rank-button{width:28px;height:34px;padding:0;display:grid;place-items:center;border-radius:6px}
 .topbar .icon-button svg,.topbar .rank-button svg{width:16px;height:16px}
 .topbar .rank-button span{display:none}
}

.brand-type h1{margin:0;line-height:normal}
.guide-link{display:inline-flex;align-items:center;gap:8px;margin-top:10px;color:#bcc6ca;font-size:10px;text-decoration:underline;text-underline-offset:4px}
.guide-link:hover{color:var(--ink)}
