:root{color-scheme:light;--ink:#102c3a;--page:#102f3d;--panel:#d4e9ee;--panel-deep:#c2dfe6;--blue:#a6d8f5;--blue-hover:#b9e4fc;--green:#91ddb8;--red:#f4aca9;--muted:#46636f;--line:#a7c9d3;--race:#146da6;font-family:Inter,"Segoe UI",Arial,sans-serif;font-synthesis:none}
*{box-sizing:border-box}body{margin:0;background:var(--page);color:var(--ink);min-width:320px}button,input,select{font:inherit}button,select{cursor:pointer}button{font-weight:750}button:disabled{cursor:default;opacity:.48}button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid #1172af;outline-offset:3px}button,select,input{-webkit-tap-highlight-color:transparent}button[hidden],[hidden]{display:none!important}button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}h1,h2,h3,p{margin:0}.app{max-width:1500px;margin:0 auto;padding:24px 30px 0}.topbar{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:0 0 24px;border-bottom:1px solid #33505c}.brand{display:flex;align-items:center;gap:12px;color:#c4e9f9}.brand-mark{width:48px;height:48px;flex:0 0 48px}.brand-parent{font-size:10px;font-weight:750;letter-spacing:3px}.brand h1{font-size:29px;letter-spacing:1.5px;line-height:1.2;display:flex;align-items:center;gap:10px}.version{font-size:11px;font-weight:800;border:1px solid #5f8e9f;border-radius:5px;letter-spacing:0;padding:4px 5px;color:#9ed0e3}.header-actions{display:flex;gap:10px}.button{border:1px solid transparent;border-radius:10px;min-height:44px;padding:11px 14px;display:inline-flex;align-items:center;justify-content:center;gap:8px;line-height:1.2;transition:background .15s,transform .15s;color:#102734}.button:not(:disabled):active{transform:translateY(1px)}.button.soft{background:var(--blue)}.button.soft:hover:not(:disabled){background:var(--blue-hover)}.button.success{background:var(--green)}.button.success:hover:not(:disabled){background:#a9ecc9}.button.danger{background:var(--red)}.button.danger:hover:not(:disabled){background:#ffc0bd}.button.compact{font-size:12px}.header-actions .button{background:#b5d9e7}.header-actions .button:first-child span{width:17px;height:17px;border:1.5px solid currentColor;border-radius:50%;display:grid;place-items:center;font-size:11px}.intro{padding:24px 0 22px;display:flex;justify-content:space-between;align-items:center;gap:20px;color:#d6eef4}.eyebrow{font-size:10px;letter-spacing:2px;font-weight:800;color:#2e637a}.intro .eyebrow{color:#81c3dd;margin-bottom:7px}.intro h2{font-size:25px;letter-spacing:-.6px;font-weight:650}.intro>p{font-size:13px;line-height:1.5;text-align:right;color:#b5d5df}.game-layout{display:grid;grid-template-columns:minmax(0,1fr) 304px;gap:20px;align-items:start}.track-panel{background:var(--panel-deep);border-radius:16px;overflow:hidden;box-shadow:0 14px 35px #071f2a30}.track-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:64px;padding:13px 20px;background:#cce5ec}.track-toolbar>div{display:flex;align-items:center;gap:13px}.track-tag{font-size:9px;font-weight:800;letter-spacing:1.3px;padding-right:13px;border-right:1px solid #91b9c7}.track-toolbar strong{font-size:15px}.phase-pill{font-size:10px;letter-spacing:1px;font-weight:850;color:#15465d;background:#acd6e7;padding:6px 10px;border-radius:5px;white-space:nowrap}.canvas-wrap{position:relative;aspect-ratio:3/2;isolation:isolate;overflow:hidden;background:#53847a}canvas{display:block;width:100%;height:100%;touch-action:none;user-select:none;-webkit-user-select:none;cursor:crosshair}body[data-phase=race] canvas,body[data-phase=countdown] canvas,body[data-phase=results] canvas,body[data-phase=handoff] canvas{cursor:default}.track-footer{display:flex;align-items:center;gap:10px;min-height:62px;padding:13px 18px}.track-footer p{font-size:12px;line-height:1.5;flex:1}.status-dot{height:8px;width:8px;border-radius:50%;background:#317da8;flex:0 0 8px}.status-dot.error{background:#bc3434}.status-dot.ready{background:#1c7954}.draw-progress{font-size:15px;font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap}.progress-track{height:4px;background:#adced8}.progress-track>div{height:100%;width:0;background:#2c92c3;transition:width .18s}.control-panel{border-radius:16px;background:var(--panel);padding:22px;box-shadow:0 14px 35px #071f2a30}.section-heading{display:flex;align-items:center;gap:9px;margin-bottom:15px}.section-number{font-size:10px;letter-spacing:1px;font-weight:850;padding:5px 6px;border:1px solid #9abcce;border-radius:5px;color:#2b617a}.section-heading h3{font-size:15px;font-weight:800}label{display:block;font-size:11px;font-weight:800;margin:14px 0 6px}select,input{width:100%;border:1px solid #96bbc9;border-radius:8px;color:var(--ink);background:#bddfeb;padding:11px 10px;font-size:13px;font-weight:650;min-height:43px}select{padding-right:25px}select:disabled{opacity:.62;cursor:default}.field-note{font-size:11px;color:#355664;line-height:1.4;margin-top:7px}.select-row{position:relative}.select-row select{padding-right:62px}.local-badge{pointer-events:none;position:absolute;right:27px;top:15px;font-size:8px;letter-spacing:1px;font-weight:850;padding-left:5px;color:#477588}.phase-panel{border-top:1px solid var(--line);margin-top:20px;padding-top:19px}.pilot-label{display:flex;align-items:center;gap:7px;font-size:11px;font-weight:750;margin-bottom:8px}.pilot-dot{width:10px;height:10px;border-radius:50%;background:var(--race);border:1px solid #0d324650}.drawing-instruction{font-size:12px;line-height:1.55;margin:12px 0 14px;color:#274b5a}.edit-actions{display:grid;grid-template-columns:1fr auto;gap:8px}.edit-actions .button{font-size:11px;padding:10px 9px}.edit-actions .button span{font-size:19px;line-height:1}.primary-action{width:100%;margin-top:10px;font-size:13px;min-height:46px}.notice{margin-top:12px;line-height:1.5;font-size:11px;padding:10px 11px;border-radius:7px;background:#bad9e7;border-left:3px solid #3c90b8}.notice.error{background:#efcecc;border-left-color:#b64440;color:#7a2320}.notice.success{background:#bde3ce;border-left-color:#278157;color:#155137}.demo-button{width:100%;color:#215674;background:transparent;border:0;padding:15px 0 0;min-height:42px;font-size:11px;font-weight:750;display:flex;align-items:center;justify-content:center;gap:8px}.demo-button:hover{text-decoration:underline}.personal-best{display:flex;justify-content:space-between;gap:10px;align-items:center;border-top:1px solid var(--line);padding-top:16px;margin-top:19px;font-size:10px;line-height:1.4;color:#355766}.personal-best strong{font-size:15px;font-variant-numeric:tabular-nums;color:var(--ink);white-space:nowrap}.tiny-rules{margin-top:12px;display:grid;gap:4px;font-size:9px;color:#426471}.app-footer{display:flex;justify-content:space-between;flex-wrap:wrap;gap:10px;padding:19px 0 22px;font-size:10px;letter-spacing:.2px;color:#98becd}.race-countdown{position:absolute;inset:50% auto auto 50%;transform:translate(-50%,-50%);width:84px;height:84px;border-radius:24px;background:#163447ed;box-shadow:0 8px 40px #071c3d55;display:grid;place-items:center;color:#caeafd;font-size:48px;font-weight:850;border:2px solid #78bbd7;pointer-events:none}.race-clock{position:absolute;top:14px;left:14px;display:flex;flex-direction:column;gap:4px;padding:9px 13px;background:#132f3fed;border:1px solid #5e8392;border-radius:9px;color:#cef0f7;pointer-events:none}.race-clock span{font-size:8px;letter-spacing:2px;font-weight:700}.race-clock strong{font-variant-numeric:tabular-nums;font-size:20px;letter-spacing:.5px}.race-caption,.ghost-note,#handoff-panel p{font-size:12px;line-height:1.6;color:#355766}.ghost-note{font-size:10px;margin-top:18px;border-top:1px solid var(--line);padding-top:12px}.live-racers{margin-top:16px;display:grid;gap:10px}.live-racer{display:grid;grid-template-columns:25px 1fr auto;gap:8px;align-items:center;font-size:12px}.racer-icon{width:25px;height:25px;display:grid;place-items:center;border-radius:6px;font-size:11px;font-weight:850;color:#122936;background:var(--racer-color)}.racer-name{font-weight:750;overflow-wrap:anywhere}.racer-speed{font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap}.racer-progress{grid-column:2 / -1;height:3px;background:#b0cfd9;border-radius:3px;overflow:hidden;margin-top:-2px}.racer-progress>span{display:block;height:100%;width:0;background:#326e8e}.result-kicker{margin-bottom:8px}.phase-panel>h3{font-size:23px;letter-spacing:-.6px;line-height:1.2;margin-bottom:15px}.result-list{display:grid;gap:9px}.result-row{display:grid;grid-template-columns:26px 1fr auto;gap:8px;align-items:center;border-bottom:1px solid #aacbd5;padding:8px 0 11px}.result-place{font-size:18px;font-weight:850;color:#347491}.result-pilot{font-size:12px;font-weight:800;overflow-wrap:anywhere}.result-time{font-size:14px;font-weight:850;font-variant-numeric:tabular-nums;white-space:nowrap}.result-distance{display:block;font-size:10px;color:#456878;margin-top:3px;font-weight:500}.result-gap{grid-column:3;font-size:10px;color:#456878;text-align:right;margin-top:-5px}.result-insight{font-size:11px;line-height:1.6;margin-top:14px;color:#315566}#handoff-panel>.section-number{display:inline-block;margin-bottom:15px}#handoff-panel p+p{margin-top:10px}#handoff-panel .button{margin-top:20px}dialog{padding:26px;border:1px solid #9fcbd8;border-radius:18px;background:#d0e9ef;color:var(--ink);max-width:540px;width:calc(100% - 32px);box-shadow:0 20px 100px #06192566}dialog::backdrop{background:#051c2bcc;backdrop-filter:blur(3px)}.help-top{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:18px}dialog h2{font-size:25px;letter-spacing:-.6px}dialog ol{padding-left:21px;font-size:13px;line-height:1.65}dialog li{margin:12px 0;padding-left:4px}.help-note{font-size:12px;line-height:1.6;background:#b7dbe8;border-radius:8px;padding:12px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(min-width:1600px){.app{padding-top:32px}.intro{padding-top:30px;padding-bottom:26px}}
@media(max-width:1100px){.app{padding:19px 20px 0}.game-layout{grid-template-columns:minmax(0,1fr) 274px;gap:15px}.control-panel{padding:18px}.track-toolbar{padding:12px 15px}.track-toolbar>div{gap:10px}.track-tag{padding-right:10px}.intro h2{font-size:23px}.track-footer{padding:12px 14px}}
@media(max-width:800px){.app{padding:17px 15px 0}.game-layout{grid-template-columns:1fr;gap:16px}.topbar{padding-bottom:17px}.brand h1{font-size:26px}.brand-parent{font-size:9px}.brand-mark{width:42px;height:42px;flex-basis:42px}.intro{padding:20px 0 18px}.intro h2{font-size:23px}.intro>p{font-size:11px}.control-panel{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:0 25px;padding:20px}.phase-panel{margin-top:0;padding-top:0;border-top:0;grid-column:2;grid-row:1 / span 2}.personal-best{grid-column:1;margin-top:17px;padding-top:14px;align-self:end}.tiny-rules{grid-column:1;margin-top:12px}.edit-actions .button{font-size:12px}select,input{font-size:16px}.field-note{font-size:12px}.drawing-instruction{font-size:12px}.notice{font-size:12px}.demo-button{font-size:12px}.section-heading{margin-bottom:12px}.app-footer{font-size:10px}}
@media(max-width:520px){.app{padding:12px 10px 0}.topbar{gap:8px}.brand{gap:7px}.brand-mark{width:33px;height:33px;flex-basis:33px}.brand h1{font-size:21px;letter-spacing:1px}.brand-parent{font-size:7px;letter-spacing:2px}.version{font-size:9px;padding:3px 4px}.header-actions{gap:6px}.header-actions .button{padding:8px 9px;font-size:10px;min-height:38px}.fullscreen-button span{display:none}.header-actions .button:first-child span{display:none}.intro{padding:17px 2px}.intro h2{font-size:20px;max-width:250px}.intro>p{display:none}.intro .eyebrow{font-size:8px;letter-spacing:1.5px;margin-bottom:5px}.track-panel,.control-panel{border-radius:12px}.track-toolbar{min-height:53px;padding:10px 12px}.track-toolbar>div{gap:8px}.track-toolbar strong{font-size:12px}.track-tag{font-size:8px;letter-spacing:.5px;padding-right:8px}.phase-pill{font-size:8px;padding:5px 7px}.track-footer{min-height:60px;padding:10px 12px;gap:8px}.track-footer p{font-size:11px}.draw-progress{font-size:13px}.control-panel{display:block;padding:17px}.phase-panel{margin-top:18px;padding-top:18px;border-top:1px solid var(--line)}#setup-panel{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0 11px}#setup-panel .section-heading{grid-column:1 / -1;margin-bottom:8px}#setup-panel label{margin-top:9px;font-size:10px}#setup-panel label[for=track-select]{grid-column:1;grid-row:2}#setup-panel label[for=player-count]{grid-column:2;grid-row:2}#track-select{grid-column:1;grid-row:3}#setup-panel .select-row{grid-column:2;grid-row:3}#track-description{grid-column:1 / -1;font-size:11px}#setup-panel select{font-size:16px;padding-left:9px;padding-right:22px}.local-badge{display:none}.section-heading h3{font-size:15px}.pilot-label{font-size:12px}.drawing-instruction{margin:10px 0 12px}.edit-actions{grid-template-columns:1fr auto}.edit-actions .button{font-size:12px}.primary-action{font-size:14px;min-height:48px}.notice{font-size:12px}.tiny-rules{font-size:10px}.personal-best{font-size:11px}.app-footer{font-size:9px;padding:17px 2px;line-height:1.5}.race-clock{top:8px;left:8px;padding:6px 8px;border-radius:6px}.race-clock strong{font-size:14px}.race-clock span{font-size:7px}.race-countdown{width:62px;height:62px;font-size:34px;border-radius:17px}.result-list{grid-template-columns:1fr}.phase-panel>h3{font-size:23px}}
@media(max-height:520px) and (orientation:landscape){.app{padding:8px 14px 0;max-width:1100px}.topbar{padding-bottom:8px}.brand-mark{width:29px;height:29px;flex-basis:29px}.brand h1{font-size:21px}.brand-parent{font-size:7px}.header-actions .button{min-height:32px;padding:7px 10px}.intro{display:none}.game-layout{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:12px;margin-top:10px}.control-panel{display:block;padding:13px}.track-toolbar{min-height:38px;padding:8px 12px}.track-footer{min-height:45px;padding:8px 11px}.track-footer p{font-size:10px}.track-tag{font-size:8px}.track-toolbar strong{font-size:12px}.phase-panel{margin-top:14px;padding-top:14px;border-top:1px solid var(--line)}.section-heading{margin-bottom:8px}.section-heading h3{font-size:13px}select,input{font-size:13px;padding:8px;min-height:36px}.drawing-instruction{font-size:11px}.personal-best,.tiny-rules,.app-footer{display:none}label{font-size:10px;margin-top:9px}.field-note{font-size:10px}.primary-action{min-height:40px;font-size:12px}.notice{font-size:11px}.edit-actions .button{font-size:10px;min-height:36px}.demo-button{font-size:10px}.pilot-label{font-size:10px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}.button,.progress-track>div{transition:none}}
.pro-badge{margin-left:auto;padding:4px 6px;background:#9dcfdf;color:#163c50;border-radius:4px;font-size:9px;font-weight:850;letter-spacing:1px}.paint-tools{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin:15px 0}.paint-tool{border:1px solid #5a829077;border-radius:9px;min-height:63px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:8px 4px;color:#102b35;font-size:11px;font-weight:800}.paint-tool span{font-size:22px;line-height:1}.paint-tool.gas{background:#8ce0ae}.paint-tool.brake{background:#ffa19b}.paint-tool.coast{background:#99d3ef}.paint-tool[aria-pressed=true]{outline:3px solid #193c4a;outline-offset:2px}.paint-tool:focus-visible{outline:3px solid #126ea5;outline-offset:3px}.plan-summary{font-size:11px;font-weight:700;line-height:1.5;margin:16px 0;color:#2d5668}.racer-action{grid-column:2 / -1;font-size:10px;line-height:1.25;font-weight:750;color:#2c5a72;margin-top:-2px}.racer-action[data-action=brake],.racer-action[data-action=slip]{color:#9d3432}.racer-action[data-action=gas]{color:#1f7250}.racer-progress{grid-row:auto;margin-top:0}.help-note+.help-note{margin-top:10px}
@media(max-width:520px){#setup-panel .mode-label{grid-column:1 / -1;grid-row:5}#driving-mode{grid-column:1 / -1;grid-row:6;font-size:16px}#setup-panel .mode-description{grid-column:1 / -1;grid-row:7;font-size:11px}.paint-tool{font-size:12px;min-height:58px}.plan-summary{font-size:12px}.racer-action{font-size:11px}}
.paint-tool.coast{background:#b7dcec}.paint-tool.coast span{width:20px;height:20px;border:2px solid #284956;border-radius:50%;background:#f6fafb;color:transparent}.fill-gas{width:100%;font-size:12px;margin-bottom:10px}.plan-summary{margin:12px 0}.notice.warning{background:#eed7d1;border-left-color:#ac5447;color:#713629}.driving-hud{position:absolute;top:14px;right:14px;min-width:132px;display:flex;flex-direction:column;align-items:center;gap:5px;background:#122c3cf5;border:2px solid #e3edf0;border-radius:10px;padding:9px 13px;color:#f6fafb;pointer-events:none;box-shadow:0 3px 12px #061a2b55}.driving-hud strong{font-size:25px;line-height:1;font-variant-numeric:tabular-nums}.driving-hud small{font-size:11px}.driving-hud>span{font-size:10px;font-weight:850;letter-spacing:.7px}.driving-hud[data-action=gas]{border-color:#63d497;color:#8cf1b7}.driving-hud[data-action=brake],.driving-hud[data-action=slip]{border-color:#ff817d;color:#ffb3ab}.racer-action{font-size:11px}.racer-action[data-action=coast]{color:#405866}
@media(max-width:520px){.driving-hud{top:8px;right:8px;min-width:100px;padding:6px 8px;gap:4px;border-radius:7px}.driving-hud strong{font-size:19px}.driving-hud small{font-size:9px}.driving-hud>span{font-size:8px;letter-spacing:.3px}}
/* 0.3: the circuit owns the viewport while racing; controls stay outside it. */
.intro{padding:15px 0}.intro h2{font-size:22px}.topbar{padding-bottom:15px}.app{padding-top:16px}.track-toolbar{min-height:52px}.track-footer{min-height:48px}.track-panel{border:1px solid #557f8b}.camera-controls{display:flex;gap:6px!important}.camera-controls .button{min-height:34px;padding:7px 10px;font-size:11px}.race-clock,.driving-hud{position:absolute!important;left:-10000px!important;right:auto!important;top:auto!important;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
body:is([data-phase=race],[data-phase=countdown]){height:100dvh;overflow:hidden}
body:is([data-phase=race],[data-phase=countdown]) .app{height:100dvh;padding:12px 18px;display:flex;flex-direction:column;max-width:1700px}
body:is([data-phase=race],[data-phase=countdown]) .topbar{padding-bottom:10px;flex-shrink:0}
body:is([data-phase=race],[data-phase=countdown]) main{flex:1;min-height:0;display:flex;padding-top:10px}
body:is([data-phase=race],[data-phase=countdown]) :is(.intro,.app-footer,.personal-best,.tiny-rules,.track-footer,.phase-pill){display:none}
body:is([data-phase=race],[data-phase=countdown]) .game-layout{flex:1;min-height:0;grid-template-columns:minmax(0,1fr) 245px;align-items:stretch}
body:is([data-phase=race],[data-phase=countdown]) .track-panel{display:flex;flex-direction:column;min-height:0}
body:is([data-phase=race],[data-phase=countdown]) .canvas-wrap{flex:1;aspect-ratio:auto;min-height:0}
body:is([data-phase=race],[data-phase=countdown]) .control-panel{padding:16px;overflow:auto;display:block}
body:is([data-phase=race],[data-phase=countdown]) .phase-panel{border:0;padding:0;margin:0}
body:is([data-phase=race],[data-phase=countdown]) .section-heading{margin-bottom:10px}
.racer-action[data-action=assist]{color:#5c3ba2}.notice{font-weight:650}#clip-download{text-decoration:none}
@media(max-width:800px){
 body:is([data-phase=race],[data-phase=countdown]) .app{padding:8px}
 body:is([data-phase=race],[data-phase=countdown]) .game-layout{display:flex;flex-direction:column;gap:8px}
 body:is([data-phase=race],[data-phase=countdown]) .track-panel{flex:1}
 body:is([data-phase=race],[data-phase=countdown]) .control-panel{padding:8px 12px;flex:0 0 auto;max-height:155px}
 body:is([data-phase=race],[data-phase=countdown]) :is(.race-caption,.ghost-note,#race-panel .section-heading){display:none}
 body:is([data-phase=race],[data-phase=countdown]) .live-racers{margin:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px 15px}
 body:is([data-phase=race],[data-phase=countdown]) .live-racer{gap:4px;font-size:10px;grid-template-columns:20px 1fr auto}
 body:is([data-phase=race],[data-phase=countdown]) .racer-icon{height:20px;width:20px;font-size:10px}
 body:is([data-phase=race],[data-phase=countdown]) .racer-action{font-size:9px}
 body:is([data-phase=race],[data-phase=countdown]) .topbar{padding-bottom:7px}
 body:is([data-phase=race],[data-phase=countdown]) .track-toolbar{min-height:45px;padding:6px 8px}
 body:is([data-phase=race],[data-phase=countdown]) .track-tag{display:none}
 body:is([data-phase=race],[data-phase=countdown]) .camera-controls{gap:4px!important}
 body:is([data-phase=race],[data-phase=countdown]) .camera-controls .button{font-size:10px;padding:7px;min-height:32px}
 body:is([data-phase=plan],[data-phase=draw]) .track-panel{position:sticky;top:0;z-index:2}
 body:is([data-phase=plan],[data-phase=draw]) .track-footer{min-height:40px;padding:7px 10px}
 body[data-phase=plan] .control-panel{display:block;padding:12px}
 body[data-phase=plan] .phase-panel{padding:0;margin:0;border:0}
 body[data-phase=plan] :is(.personal-best,.tiny-rules){display:none}
 body[data-phase=plan] .paint-tools{margin:10px 0}.paint-tool{min-height:48px}
}
@media(max-height:520px) and (orientation:landscape){
 body:is([data-phase=race],[data-phase=countdown]) .topbar{display:none}
 body:is([data-phase=race],[data-phase=countdown]) main{padding:0}
 body:is([data-phase=race],[data-phase=countdown]) .game-layout{display:grid;grid-template-columns:minmax(0,1fr) 170px;margin:0}
 body:is([data-phase=race],[data-phase=countdown]) .control-panel{max-height:none;padding:10px}
 body:is([data-phase=race],[data-phase=countdown]) .live-racers{display:grid;grid-template-columns:1fr;gap:15px}
 body:is([data-phase=race],[data-phase=countdown]) .track-toolbar{min-height:38px}
 body:is([data-phase=draw],[data-phase=plan]) .canvas-wrap{aspect-ratio:auto;height:calc(100dvh - 146px)}
 body:is([data-phase=draw],[data-phase=plan]) .control-panel{max-height:calc(100dvh - 64px);overflow:auto}
}
.racer-action[data-action=offroad]{color:#9d3432}
/* Solo racing uses the complete viewport; telemetry already lives on the canvas. */
body:is([data-phase=race],[data-phase=countdown])[data-racers="1"] .game-layout{grid-template-columns:minmax(0,1fr)}
body:is([data-phase=race],[data-phase=countdown])[data-racers="1"] .control-panel{display:none}

#ghost-actions{display:none}body[data-phase=results] #ghost-actions{display:grid;gap:8px;margin-top:12px}#ghost-notice{font-size:12px;line-height:1.4;margin:10px 0}#race-ghost{width:auto;min-height:0}#import-ghost{font-size:11px}#expand-draw{display:none}body[data-phase=draw] #expand-draw{display:block}#lap-indicator{font-size:12px;font-weight:800}body:not([data-phase=race]) #lap-indicator{display:none}
body.draw-expanded{overflow:hidden}body.draw-expanded .track-panel{position:fixed!important;inset:0;z-index:100;height:100dvh;border-radius:0;display:flex;flex-direction:column}body.draw-expanded .canvas-wrap{flex:1;min-height:0;aspect-ratio:auto!important;height:auto!important}body.draw-expanded .track-footer{flex:0 0 auto}body.draw-expanded .track-tag{display:none}

#map-tools{display:none}.draw-expanded #map-tools{display:flex;gap:3px}.draw-expanded .track-toolbar{flex-wrap:wrap}#map-tools button{background:#acd6ef;color:#122c3c;border:0;border-radius:5px;min-width:34px;min-height:36px;font-weight:800}

/* Online lobby remains reachable while preparing and watching a race. */
.online-panel{margin:0 0 14px;padding:12px 16px;background:#e8f1f4;color:#173445;border-radius:14px;border:1px solid #b7d2dc}.online-panel summary{font-weight:800;cursor:pointer}.online-panel p{margin:10px 0;font-size:14px}.online-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px}.online-actions input{width:200px;color:#173445;background:white}.online-panel ul{display:flex;gap:12px;flex-wrap:wrap;list-style:none;padding:0}.online-panel li{background:white;border-radius:8px;padding:8px}.in-room #demo-button,.in-room #race-ghost,.in-room #import-ghost,.in-room #tune-plan,.in-room #record-replay{display:none!important}.in-room #online-panel{display:block}.in-room #online-panel[open]{max-height:45dvh;overflow:auto}.draw-expanded #online-panel{display:none}.in-room [data-phase=waiting]{pointer-events:none}@media(max-width:700px){.online-panel{padding:10px;margin-bottom:8px}.online-actions .button{min-height:42px}.online-actions input{width:100%}.header-actions a{font-size:10px;padding:8px}#setup-panel{display:flex!important;flex-direction:column}#setup-panel[hidden]{display:none!important}}
body:is([data-phase=race],[data-phase=countdown]) #online-panel{display:none!important}
