.mobile-controls[hidden]{display:none}
.mobile-controls{position:fixed;inset:0;z-index:4;pointer-events:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.mobile-controls button,.mobile-controls input{pointer-events:auto;touch-action:none;min-height:44px}
.mobile-driving .controls,.mobile-driving [data-phone-pair],.mobile-driving #phone-live-status{display:none!important}
.mobile-setup{margin:12px 0;padding:12px;background:#e7ecdf;border-radius:8px;font-size:12px;line-height:1.45}
.mobile-setup p{margin:6px 0}.mobile-setup button{min-height:44px;margin:4px 4px 4px 0}
.mobile-driving .sim-header{padding:6px max(10px,env(safe-area-inset-right)) 6px max(10px,env(safe-area-inset-left));gap:8px;min-height:56px}
.mobile-driving .sim-header .brand{font-size:18px}.mobile-driving .header-link,.mobile-driving .test-label span{display:none}
.mobile-driving .sim-header button{min-height:44px;padding:8px}
.mobile-driving .exam-env{font-size:11px;max-width:150px}.mobile-driving .exam-clock{margin:0;font-size:12px}
.mobile-driving .sim-tools{top:62px;bottom:auto;right:max(8px,env(safe-area-inset-right));left:auto;gap:4px;max-width:65vw;flex-wrap:wrap;justify-content:flex-end}
.mobile-driving .sim-tools button{min-height:44px;padding:8px}
.mobile-driving .sim-tools #camera{display:none}
.mobile-driving .hud{top:62px;bottom:auto;left:max(8px,env(safe-area-inset-left));padding:6px 10px;min-width:110px;gap:12px;pointer-events:none}
.mobile-driving .hud strong{font-size:26px}
.mobile-driving .indicator-readout{top:114px;bottom:auto;left:max(8px,env(safe-area-inset-left));right:auto;padding:4px 8px;pointer-events:none}
.mobile-driving .indicator-text{display:none}
.mobile-driving .mirror-frame,.mobile-driving.exam #mirror-frame{top:64px;width:160px;height:50px}
.mobile-driving .side-mirror{top:146px;bottom:auto;width:100px;height:60px}
.mobile-driving .right-mirror{right:max(8px,env(safe-area-inset-right));left:auto}
.mobile-driving .left-mirror{left:max(8px,env(safe-area-inset-left))}
.mobile-driving .exercise-status,.mobile-driving .exam-status{top:118px;left:125px;right:125px;max-width:none;padding:5px 8px;font-size:11px;pointer-events:none}
.mobile-driving .exercise-cue{bottom:155px;font-size:12px;padding:6px 10px;width:auto;max-width:55vw}
.mobile-driving .light-readout{bottom:155px;left:12px;font-size:10px}
.mobile-driving .sign-readout,.mobile-driving .signal-readout{top:112px;bottom:auto;right:10px;left:auto;max-width:160px;padding:6px;font-size:10px;pointer-events:none}
.mobile-driving .attribution,.mobile-driving .lund-attribution{bottom:157px;top:auto;right:10px;font-size:8px;max-width:30vw}
.mobile-driving .overlay{z-index:10}.mobile-driving .exam-panel{z-index:11}
.mobile-driving-active{overscroll-behavior:none;touch-action:none}
.simulator.mobile-driving-active .sim-header{background:transparent}
.mobile-actions{position:absolute;bottom:calc(100px + env(safe-area-inset-bottom));left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));display:grid;grid-template-columns:repeat(2,clamp(105px,16vw,136px));grid-template-rows:repeat(3,44px);justify-content:space-between;gap:4px}
.mobile-driving .mobile-actions button{background:#f4f3ede8;padding:6px 8px}
.mobile-actions [data-left]{grid-column:1;grid-row:1}
.mobile-actions [data-center]{grid-column:1;grid-row:2}
.mobile-actions [data-right]{grid-column:2;grid-row:1}
.mobile-actions [data-camera]{grid-column:2;grid-row:2}
.mobile-actions [data-lights]{grid-column:2;grid-row:3}
.mobile-driving .mobile-pedal{position:absolute;bottom:max(8px,env(safe-area-inset-bottom));width:25vw;max-width:210px;height:88px;border:1px solid #9bab96;font-size:16px;font-weight:700;background:linear-gradient(to top,#b8c9a9 var(--level,0%),#f4f3eddf var(--level,0%));border-radius:12px}
.mobile-brake{left:max(10px,env(safe-area-inset-left))}.mobile-gas{right:max(10px,env(safe-area-inset-right))}
.mobile-pedal output{display:block;font-size:11px;font-weight:400;margin-top:6px}
.mobile-steering-status{position:absolute;bottom:max(8px,env(safe-area-inset-bottom));left:29%;right:29%;text-align:center;color:#203b32;background:#f4f3ede8;border-radius:8px;padding:5px 8px;font-size:10px}
.mobile-steering-status [data-live]{display:block;font-size:10px}
.mobile-rotate{display:none}
@media(orientation:portrait){.mobile-driving .mobile-rotate{display:block;position:fixed;z-index:12;bottom:0;left:0;right:0;padding:15px;background:#244638;color:white;text-align:center;font-size:14px;pointer-events:none}.mobile-controls{display:none}.mobile-driving .overlay .dialog{max-height:calc(100dvh - 100px)}}
@media(max-width:670px) and (orientation:landscape){.mobile-driving .test-label,.mobile-driving .exam-env{display:none}.mobile-driving .mobile-actions button{padding:6px;font-size:11px}.mobile-driving .side-mirror{width:80px;height:48px}.mobile-driving .sim-tools #reset{display:none}}

/* The simulator's navigation stays at the top right beside the settings gear. */
.simulator .account-header-controls .simulator-menu-button{display:none}
.simulator-mobile-menu{display:none}
@media(pointer:coarse){
 .simulator .sim-header{z-index:11}
 .simulator .account-header-controls .simulator-menu-button{display:grid}
 .simulator .simulator-mobile-menu:not([hidden]){display:grid;position:fixed;z-index:15;top:calc(74px + env(safe-area-inset-top));right:max(8px,env(safe-area-inset-right));min-width:190px;padding:7px;background:#f4f3edf5;border:1px solid #c5cec3;border-radius:8px;box-shadow:0 10px 30px #172e3a3d;backdrop-filter:blur(8px)}
 .simulator .simulator-mobile-menu a{display:flex;align-items:center;min-height:48px;padding:0 14px;color:#203b32;text-decoration:none;font-size:14px;border-radius:5px}
 .simulator .simulator-mobile-menu a:focus-visible,.simulator .simulator-mobile-menu a:hover{outline:2px solid #ba8526;background:#e7ecdf}
 .simulator .account-header-controls{gap:0;margin-left:auto}
 .simulator .account-header-controls .header-icon{min-width:40px;width:40px;height:44px}
}
@media(pointer:coarse) and (max-width:670px){
 .simulator .sim-header{padding:6px max(10px,env(safe-area-inset-right)) 6px max(10px,env(safe-area-inset-left));gap:6px;min-height:56px}
 .simulator .sim-header .brand{font-size:18px}
 .simulator .sim-header button{min-height:44px;padding:8px}
 .simulator .sim-header .test-label,.simulator .sim-header .exam-env,.simulator .sim-header #camera,.simulator .sim-header #phone-live-status{display:none}
}

/* Primary action stays within thumb reach while the setup dialog scrolls. */
@media(pointer:coarse) and (max-width:950px){
 .mobile-driving .overlay .dialog{padding-bottom:calc(104px + env(safe-area-inset-bottom))}
 .mobile-driving .overlay #start{position:fixed;z-index:11;left:max(16px,env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right));bottom:calc(12px + env(safe-area-inset-bottom));width:auto;min-height:64px;margin:0;justify-content:center;padding:16px 24px;font-size:16px}
}
