@font-face{font-family:GarageCondensed;src:local('Impact'),local('Arial Narrow');font-display:swap}
:root{--garage-font:GarageCondensed,Impact,'Arial Narrow',sans-serif;--garage-body:Arial,Helvetica,sans-serif;--race-steel:#1a2b35;--race-edge:#81919a;--race-bone:#eee5cf;--race-amber:#d99250}
body,button,input,select,dialog{font-family:var(--garage-body)}h1,h2,h3,.brand,.garage-nav,.garage-title,.primary,.garage-hero h2{font-family:var(--garage-font)!important;font-style:italic}
#ui-language{width:72px;margin:0;background:#142535;color:#e7e4d6;border:1px solid #657e8c;padding:7px;font-size:12px;pointer-events:auto}
/* One race toolbar. Dashboard corners, map and thumb zones remain independent. */
#race-tools{display:none;position:fixed;z-index:35;top:max(8px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);gap:4px;padding:4px;background:#111c25e8;border:1px solid #73848e;border-bottom:2px solid var(--race-amber);box-shadow:0 3px 12px #0006}
body:has(#hud:not([hidden])) #race-tools{display:flex}body:has(#hud:not([hidden])) header{display:none}
#race-tools button{height:40px;min-width:60px;margin:0;padding:0 14px;border:1px solid #81919a44;border-radius:2px;background:linear-gradient(#2c414d,#1c2e38);color:var(--race-bone);font-size:12px;font-weight:700;white-space:nowrap}
#race-tools button:hover{border-color:var(--race-amber)}#race-tools button:focus-visible,.race-dialog button:focus-visible,#touch-controls button:focus-visible{outline:2px solid #ffd59c;outline-offset:2px}
#radio-expand{display:flex;gap:10px;align-items:center;justify-content:center;width:150px}#radio-expand>span:first-child{font-size:20px;color:var(--race-amber)}#radio-summary{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:112px}
#radio-player{position:fixed;z-index:35;top:12px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:8px;background:#0d1d2ded;border:1px solid #718799;border-bottom:3px solid #a45c32;box-shadow:3px 4px #0005;padding:6px 10px;color:var(--race-bone);max-width:440px;width:max-content}
body:has(#hud:not([hidden]))> #radio-player{display:none}
#radio-player button{padding:4px 8px;min-width:40px;height:40px;border:1px solid #697d89;border-radius:2px;background:#203346;color:var(--race-bone);line-height:1.3}#radio-name{display:block;width:145px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:12px}#radio-player small{font-size:8px;color:#adbfca;letter-spacing:1px}#radio-volume{width:80px;padding:0;accent-color:var(--race-amber)}#radio-player.paused{opacity:.8}
/* Native modal supplies focus containment/Escape and makes its backdrop inert. */
.race-dialog{position:fixed;inset:0;margin:auto;width:min(440px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:0;border:1px solid var(--race-edge);border-top:3px solid var(--race-amber);border-radius:3px;background:linear-gradient(135deg,#21323d,#101d26);color:#e0e7e8;box-shadow:0 18px 80px #000c;overflow:hidden}
.race-dialog::backdrop{background:#050b12cc}.race-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 12px 10px 22px;border-bottom:1px solid #bdc5be33}.race-dialog-heading h2{margin:0;color:#e9d4b1;font-size:26px;font-weight:800}.race-dialog-heading button{width:44px;height:44px;padding:0;margin:0;border-radius:2px;border:1px solid #91a1a86e;background:#283c47;color:#eee5cf;font-size:26px}
.race-dialog-content{padding:20px 22px;overflow:auto;max-height:calc(100dvh - 108px);overscroll-behavior:contain}.race-dialog .voice-settings{border:0;margin:0;padding:0}.race-dialog .voice-settings legend{display:none}.race-dialog .voice-settings p{font-size:13px;margin:0 0 14px;line-height:1.6}.race-dialog .voice-settings small{display:block;font-size:11px;color:#9aafb9;line-height:1.5}.race-dialog .voice-settings button{min-height:44px;border-radius:2px;background:#2a414c;border-color:#768d9b55;margin:0 0 8px;font-size:13px}.race-dialog #voice-enable{background:#c98245;color:#171a18;font-weight:800;border-color:#efb46d}.race-dialog .voice-settings label{margin:12px 0;color:#c8d6d9}.race-dialog .voice-settings input{width:100%;min-height:32px;accent-color:var(--race-amber)}
#race-radio-panel #radio-player{position:static;transform:none;display:grid;grid-template-columns:repeat(3,1fr);gap:12px;width:100%;max-width:none;padding:0;border:0;background:none;box-shadow:none}#race-radio-panel #radio-player>div{grid-column:1/-1;grid-row:1;text-align:center;padding:0 0 12px}#race-radio-panel #radio-name{width:auto;font-size:19px;margin-top:6px}#race-radio-panel #radio-player button{height:48px}#race-radio-panel #radio-volume{grid-column:1/-1;width:100%;height:36px;margin-top:6px}
/* Thumb controls use two stable islands; extra moves expand without cancelling gas. */
#touch-controls{display:none;position:fixed;inset:0;pointer-events:none;z-index:32;touch-action:none;user-select:none;-webkit-user-select:none}
#touch-controls button{pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;width:58px;height:56px;margin:0;padding:0;border:1px solid #a5b6bc99;background:linear-gradient(#2b414ddd,#142934e6);color:var(--race-bone);font-size:24px;border-radius:5px;box-shadow:0 3px #0008,inset 0 1px #dce6e62b}
#touch-controls button.pressed{background:#ad542cee;border-color:#ffc586;box-shadow:inset 0 2px 5px #0006}#touch-controls button img{width:26px;height:24px;object-fit:contain;image-rendering:pixelated;vertical-align:middle}
.touch-steering,.touch-pedals,.touch-combat,.touch-boost,.touch-utilities,.touch-secondary{position:absolute;display:flex;gap:8px}
.touch-steering,.touch-combat{left:max(14px,env(safe-area-inset-left))}.touch-pedals,.touch-boost{right:max(14px,env(safe-area-inset-right))}.touch-steering,.touch-pedals,.touch-utilities{bottom:max(14px,env(safe-area-inset-bottom))}.touch-combat,.touch-boost{bottom:82px}.touch-combat button,.touch-boost button{height:46px!important;font-size:17px!important}.touch-utilities{left:50%;transform:translateX(-50%)}.touch-utilities button{width:44px!important;height:44px!important;font-size:23px!important;align-self:end}
.touch-secondary{left:50%;bottom:148px;transform:translateX(-50%);background:#132633f2;border:1px solid #b8b39c88;border-top:2px solid var(--race-amber);padding:8px;box-shadow:0 5px 20px #0009}.touch-secondary button{width:48px!important;height:44px!important;font-size:18px!important}.touch-secondary[hidden]{display:none}
@media(pointer:coarse){body:has(#hud:not([hidden])) #touch-controls{display:block}#game{touch-action:none}body:has(#hud:not([hidden])) #original-hud{top:0;bottom:0;height:100%}body:has(#hud:not([hidden])) #map-panel{left:max(150px,env(safe-area-inset-left));right:auto;top:68px;bottom:auto;width:88px;transform:none;border-radius:3px}body:has(#hud:not([hidden])) #map-panel #map{width:88px;height:88px}body:has(#hud:not([hidden])) #map-panel small{display:none}body:has(#hud:not([hidden])) #map-mode{font-size:8px;padding:4px;min-height:28px}body:has(#hud:not([hidden])) #voice-hud{bottom:150px;max-width:40vw;font-size:10px}body:has(#hud:not([hidden])) #network-status{bottom:1px;left:50%;transform:translateX(-50%);font-size:8px;padding:2px 5px;pointer-events:none}#hud .race-top{bottom:66px}#hud .next small{display:none}#hud .next b{font-size:9px}#race-tools button{height:40px}#race-tools{top:max(4px,env(safe-area-inset-top))}}
@media(pointer:coarse) and (orientation:portrait){body:has(#hud:not([hidden])) #original-hud{top:0;bottom:0;height:100%}body:has(#hud:not([hidden])) #map-panel{left:max(14px,env(safe-area-inset-left));top:132px}#touch-controls button{width:54px}#race-tools{max-width:calc(100vw - 24px)}#race-tools button{padding:0 10px;min-width:54px}#radio-expand{width:132px}#race-tools #race-voice-button{max-width:90px;overflow:hidden;text-overflow:ellipsis}.race-dialog{width:calc(100vw - 24px)}}
@media(max-width:900px){body:has(#menu:not([hidden]))> #radio-player{display:none}#ui-language{width:64px}#race-tools{gap:3px}}
@media(max-height:450px){.race-dialog{max-height:calc(100dvh - 20px);width:min(520px,calc(100vw - 32px))}.race-dialog-heading{padding-top:6px;padding-bottom:6px}.race-dialog-content{padding:14px 20px;max-height:calc(100dvh - 82px)}.race-dialog .voice-settings small{font-size:10px}}

#countdown.race-notice{top:auto;bottom:90px;left:50%;transform:translateX(-50%);width:max-content;max-width:70vw;font:italic 700 18px var(--garage-body);padding:8px 16px;color:var(--race-bone);text-shadow:none;background:#152936df;border:1px solid #78909b;border-left:3px solid var(--race-amber);border-radius:2px}#countdown.race-notice:empty{display:none}
@media(pointer:coarse){#countdown.race-notice{bottom:174px;font-size:12px;padding:6px 10px;max-width:40vw}body:has(#hud:not([hidden])) #toast{bottom:auto;top:58px;max-width:min(260px,calc(100vw - 180px));font-size:11px;line-height:1.4;padding:6px 10px;pointer-events:none;background:#142936e8;color:var(--race-bone);border:1px solid #8ca2ac;border-radius:2px}}

#hud .race-top{display:none}
