/* Approved 16:9 driving view; menus keep their own layouts. */
.screen{aspect-ratio:16/9}
#out{object-fit:contain}
@media(orientation:landscape){
 html:has(.stage:not(.menu-open):not(.drag)),body:has(.stage:not(.menu-open):not(.drag)){overflow:hidden}
 .wrap:has(.stage:not(.menu-open):not(.drag)){max-width:none;padding:0;gap:0;height:100dvh}
 .wrap:has(.stage:not(.menu-open):not(.drag))>header,
 .wrap:has(.stage:not(.menu-open):not(.drag))>.keys,
 .wrap:has(.stage:not(.menu-open):not(.drag))>.hint{display:none}
 .stage:not(.menu-open):not(.drag){position:fixed;inset:0;display:flex;align-items:center;justify-content:center;width:100vw;height:100dvh;padding:0;background:#000;overflow:hidden}
 .stage:not(.menu-open):not(.drag) .screen{position:relative;flex:none;width:min(100vw,calc(100dvh * 16 / 9));height:auto;max-width:none;max-height:none;min-width:0;aspect-ratio:16/9;margin:0;border:0;box-shadow:none}
 .stage:not(.menu-open):not(.drag) #out{width:100%;height:100%;image-rendering:pixelated}
}
@media(pointer:coarse) and (orientation:landscape){
 .stage:not(.menu-open):not(.drag) .pad{position:absolute;top:0;bottom:0;z-index:4;display:grid;margin:0;background:none}
 .stage:not(.menu-open):not(.drag) .padL{left:0;width:22%}
 .stage:not(.menu-open):not(.drag) .padR{right:0;width:24%}
 .stage:not(.menu-open):not(.drag) .padL #tFull{font-size:13px}
 .stage:not(.menu-open):not(.drag) .room-chat{top:auto;bottom:8px;left:calc(22% + 8px);right:calc(24% + 8px)}
 .stage:not(.menu-open):not(.drag) .chat-panel{top:auto;bottom:44px;left:0;right:auto;width:min(340px,100%)}
}
.stage:not(.menu-open):not(.drag) .pad :is([data-k="left"],[data-k="right"],#tCam,#tReset,[data-k="hb"],#tPause){
 background:rgba(7,14,24,.18);border-color:rgba(232,243,255,.32);color:#f5f9ff;
 box-shadow:inset 0 0 0 1px rgba(0,0,0,.12);text-shadow:0 2px 4px #000,0 0 2px #000;
}
.stage:not(.menu-open):not(.drag) .pad :is([data-k="left"],[data-k="right"],#tCam,#tReset,[data-k="hb"],#tPause) .control-icon{filter:drop-shadow(0 2px 2px #000a)}
.stage:not(.menu-open):not(.drag) .pad :is([data-k="left"],[data-k="right"],#tCam,#tReset,[data-k="hb"],#tPause):is(.on,:active){background:rgba(92,166,220,.3);border-color:#a9dfff}
.stage:not(.menu-open):not(.drag) .padR :is(.pedal-gas,.pedal-brake){opacity:.8}

/* Results stay over the cockpit, clear of the driving controls. */
.stage:has(.ov[data-mode="done"]:not([hidden])) :is(.pad,.drag-pad,#pBtn){visibility:hidden;pointer-events:none}
.ov[data-mode="done"]{position:fixed;inset:0;z-index:4;box-sizing:border-box;padding:clamp(12px,2vw,28px);background:linear-gradient(90deg,#06090e33,#06090e88)}
.ov[data-mode="done"] .ovin{flex:none;width:100%;max-width:600px;max-height:100%;box-sizing:border-box;margin:auto 0 auto auto;padding:20px;gap:12px;overflow:auto;overscroll-behavior:contain;background:#0b121ff5;border:1px solid #52647d;border-radius:10px;box-shadow:0 12px 40px #0009}
.ov[data-mode="done"] .ovin>*{flex-shrink:0}
.ov[data-mode="done"] .race-res{padding:6px 0}
.ov[data-mode="done"] .note{color:#b8c6d9!important}
@media(orientation:landscape) and (max-height:500px){
 .ov[data-mode="done"]{padding:8px}
 .ov[data-mode="done"] .ovin{padding:10px 14px;gap:6px}
 .ov[data-mode="done"] h2{font-size:14px;line-height:1.4}
 .ov[data-mode="done"] .race-res{font-size:13px;line-height:1.15;gap:3px 8px;padding:4px 0}
 .ov[data-mode="done"] .result-driver small{font-size:11px;line-height:1.1;margin-top:0}
 .ov[data-mode="done"] .race-res b{font-size:12px}
 .ov[data-mode="done"] .btn{font-size:9px;min-height:36px;padding:10px 12px}
}
@media(orientation:portrait){
 .ov[data-mode="done"] .ovin{margin:auto;max-width:600px;padding:16px 12px}
 .ov[data-mode="done"] h2{font-size:15px;line-height:1.5}
 .ov[data-mode="done"] .race-res{font-size:14px;gap:8px 6px}
 .ov[data-mode="done"] .race-res b{font-size:12px}
}
