/* One layout owns the race HUD. No overlapping legacy absolute offsets. */
#motion-panel{border-top:1px solid #ded1e6;margin-top:18px;padding-top:14px;color:#43215f}
#motion-panel h3{margin:0 0 12px;font-size:22px}.control-choice{display:grid;grid-template-columns:1fr 1fr;gap:10px}
#motion-panel button{min-height:48px;border-radius:15px;padding:10px 15px;border:2px solid #d8c8e6;background:#fffdf8;color:#43215f}
#motion-panel button[aria-pressed=true]{border-color:#7040ab;background:#eee3fb}
#motion-panel p{font-size:14px;line-height:1.45;margin:8px 0}
#motion-calibrate{width:100%;background:#c3e867!important;font-weight:800}
#motion-demo{width:180px;margin:8px auto}#motion-demo svg{width:100%;fill:none;stroke:#7040ab;stroke-width:4;stroke-linecap:round;stroke-linejoin:round}
#motion-phone{transform-origin:90px 48px}#motion-state{min-height:42px}
.lane-option{display:flex;align-items:center;gap:12px;margin:18px 0;padding:12px;border-radius:15px;background:#f4eefd}
.lane-option input{width:23px;height:23px;accent-color:#7040ab;flex:none}.lane-option b,.lane-option small{display:block}.lane-option small{margin-top:5px;font-size:12px;line-height:1.4}
body.motion-ready #touch .steering-controls{visibility:hidden;pointer-events:none}
body.motion-ready #flight-controls{visibility:hidden;pointer-events:none}
#flight-controls{position:absolute;left:0;bottom:96px;display:flex;gap:8px}
#touch #flight-controls button{width:66px;height:60px;background:#c3e867;color:#43215f;border:2px solid #edf7d7;border-radius:16px}
#touch #flight-controls b{font-size:24px}#touch #flight-controls span{font-size:10px}
body.racing #hud .race-top{display:flex;align-items:center;justify-content:flex-start;gap:18px!important;left:16px!important;right:16px!important;top:12px!important;padding:8px 12px!important;width:auto!important;min-height:68px;background:#fffdf8ed;border-radius:18px;color:#43215f;box-shadow:0 3px 18px #43215f12}
#hud .race-top .position{display:flex;align-items:center;gap:6px}#hud .race-top .position>b{font-size:38px!important;line-height:1;color:#43215f}
#hud .race-top .position span{font-size:14px;color:#654778}#hud .race-top small{font-size:9px}
#hud .race-top .laps,#hud .race-top .timing{display:flex;flex-direction:column;gap:3px;min-width:0}
#hud .race-top .laps b,#hud .race-top .timing b{font-size:22px!important;line-height:1.1;color:#43215f}
#hud .race-top .laps>span,#hud .race-top .timing>span{font-size:9px!important;color:#654778}
#hud .race-top #pause{margin-left:auto;flex:none}#hud #driver-badge{display:none!important}
#hud #race-mode{top:90px!important;left:18px!important;right:auto!important;max-width:48%;font-size:11px;line-height:1.4;padding:5px 9px;background:#fffdf8e8;border-radius:10px;color:#43215f}
#hud .minimap{top:90px!important;right:16px!important;width:105px!important;height:76px;left:auto}
#hud .minimap canvas{width:105px;height:76px}
#hud #race-condition:not([hidden]){top:208px!important;max-width:calc(100% - 32px);left:50%!important;right:auto!important;transform:translateX(-50%)}
#hud #motion-quick{position:absolute;left:16px;bottom:178px;pointer-events:auto;border:1px solid #d7c6e4;background:#fffdf8ef;color:#43215f;padding:10px 12px;border-radius:12px;min-height:44px;max-width:44%;font-size:12px;z-index:7}
#hud #guidance-badge{position:absolute;top:126px;left:18px;color:#43215f;background:#c3e867;padding:5px 9px;border-radius:9px;font-size:11px}
#hud #flight-height{position:absolute;right:16px;top:172px;font-size:12px;background:#fffdf8ed;color:#43215f;padding:6px 10px;border-radius:10px}
#garage-motion{display:none}@media(pointer:coarse){#garage-motion{display:block}}
body.racing #hud .race-bottom{left:16px;right:16px;bottom:178px!important;display:flex;justify-content:flex-end;gap:10px;align-items:flex-end;pointer-events:none}
#hud .race-bottom #camera{display:none}#hud .speedbox{width:118px!important;min-width:0!important;padding:10px 12px!important;background:#fffdf8ed;border-radius:18px;color:#43215f;box-shadow:none}
#hud .speedbox>b{font-size:36px!important;line-height:1;color:#43215f}#hud .speedbox>span{font-size:10px}#hud .speedbox small{font-size:10px;line-height:1.4;display:block;white-space:normal}
#hud .speedbox small,#hud #boost-label{color:#654778!important}
#touch button{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:2px;padding:5px!important;box-sizing:border-box}
#touch button b{line-height:1}#touch button span{line-height:1.1}#touch button kbd{line-height:1.05;margin:1px 0 0!important}
.touch-ui #touch .pedal-controls .boost{height:54px}
body #touch{left:16px!important;right:16px!important;bottom:max(16px,env(safe-area-inset-bottom))!important;gap:12px}
#toast{max-width:min(360px,calc(100% - 32px));white-space:normal;pointer-events:none}
.practising #hud #guidance-badge,.practising #flight-height{display:none!important}.practising #hud #motion-quick{bottom:230px}
body.practising #hud .race-bottom{bottom:178px!important}.practising .school-hint{max-width:calc(100% - 32px)!important;white-space:normal;text-align:center}
@media(max-width:430px){#hud .race-top{gap:12px!important}#hud .race-top .timing{display:none!important}#hud .race-top .position>b{font-size:32px!important}.control-choice{grid-template-columns:1fr}#motion-panel p{font-size:13px}}
@media(max-width:380px){body #touch{left:12px!important;right:12px!important;gap:8px}.touch-ui #touch .steering-controls{gap:6px}.touch-ui #touch .steering-controls button{width:50px;height:74px}.touch-ui #touch .pedal-controls{grid-template-columns:repeat(3,48px);gap:5px}.touch-ui #touch .pedal-controls button,.touch-ui #touch .pedal-controls .boost{width:48px}.touch-ui.auto-drive #touch .pedal-controls{grid-template-columns:repeat(2,48px)}}
@media(min-aspect-ratio:19/9) and (max-height:600px){
 body.racing #hud .race-top{max-width:440px;right:auto!important;min-height:54px;padding:6px 10px!important;gap:18px!important}
 #hud #race-mode{top:75px!important}#hud #guidance-badge{top:106px}#hud .minimap{top:12px!important}
 #hud #flight-height{top:94px}
 #hud #race-condition:not([hidden]){top:90px!important;max-width:320px}
 body.racing #hud .race-bottom{bottom:110px!important}#hud #motion-quick{bottom:110px}
 #hud #motion-quick{left:208px;bottom:16px}#flight-controls{bottom:90px}
 #hud .speedbox{width:105px!important}#hud .speedbox>b{font-size:30px!important}
 .practising #hud #motion-quick{bottom:160px}.practising .school-tools{bottom:106px!important}
}
@media(max-width:600px) and (max-height:600px){#hud .minimap{width:80px!important}#hud .minimap canvas{width:80px;height:58px}}
/* Garage numbers and labels wrap as units, never across each other. */
#garage-specs{flex-wrap:wrap;row-gap:6px}#garage-specs>span{white-space:nowrap}#garage-caption{min-width:0}#garage-top .menu-tools{flex-wrap:wrap;justify-content:flex-end}
@media(min-aspect-ratio:19/9) and (max-height:600px){#garage-caption{width:28%!important}#garage-specs{gap:5px 10px!important}#garage-specs span{font-size:10px!important}#garage-specs b{font-size:17px!important}}
