/* Thumb controls use the cockpit palette and leave the sight unobstructed. */
#touch-controls{position:fixed;inset:0;z-index:6;pointer-events:none;user-select:none;-webkit-user-select:none}
.touch-left,.touch-right{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:8px;width:144px;align-items:stretch}
.touch-left{left:max(12px,env(safe-area-inset-left))}.touch-right{right:max(12px,env(safe-area-inset-right))}
#touch-controls button,.touch-stick{pointer-events:auto;touch-action:none;-webkit-touch-callout:none;background:color-mix(in srgb,var(--panel) 90%,transparent);border:1px solid var(--muted);color:var(--ink)}
#touch-controls button{min-height:44px;min-width:44px;padding:8px 5px;font-size:11px;font-weight:bold;line-height:1.2}
#touch-controls button.held,#touch-controls button:active{background:var(--accent);border-color:var(--accent);color:var(--bg)}
.touch-pair,.touch-targets,.touch-weapons{display:flex;gap:6px}.touch-pair>*{flex:1;min-width:0}
.touch-targets{flex-wrap:wrap}.touch-targets>*{flex:1 0 45%}.touch-targets>[data-action=part]{flex-basis:100%}
.touch-stick{position:relative;align-self:center;width:120px;height:120px;border-radius:50%;display:grid;place-items:center;overflow:hidden}
.touch-stick>span{position:absolute;top:10px;font-size:10px;letter-spacing:1px;color:var(--ink)}
.touch-stick>i{width:42px;height:42px;border:1px solid var(--accent);border-radius:50%;background:var(--panel);transform:translate(var(--stick-x,0px),var(--stick-y,0px))}
.touch-stick.held>i{background:var(--accent)}
.touch-weapons{flex-direction:column}#touch-controls .touch-fire{min-height:70px;border-color:var(--accent);color:var(--accent);font-size:17px}#touch-controls .touch-fire.held{color:var(--bg)}
#touch-controls:not([data-walking=true]) .touch-walk-only,#touch-controls[data-walking=true] .touch-flight-only,#touch-controls[data-gunner=true]:not([data-walking=true]) .touch-pilot-only{display:none}
body[data-touch-controls=true][data-mode=flight]{overflow:hidden;overscroll-behavior:none}
body[data-touch-controls=true] #space{touch-action:none}
body[data-touch-controls=true]:not([data-mode=menu]) header{top:max(8px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right))}
body[data-touch-controls=true] .header-actions button{min-height:44px;min-width:44px;font-size:11px}
body[data-touch-controls=true] #pause-screen{overflow:auto;align-items:safe center;padding:16px}
body[data-touch-controls=true] .modal-card{max-height:none;padding:20px}
body[data-touch-controls=true] .graphics-pause-setting{margin-top:12px}
body[data-touch-controls=true] .modal-card button,body[data-touch-controls=true] #crew-interact,body[data-touch-controls=true] #bridge-menu,body[data-touch-controls=true] #spectator-panel button{min-height:44px}
body[data-touch-controls=true] .ace-dialog select{min-height:44px;font-size:16px}
.touch-telemetry{display:none}
body[data-touch-controls=true] #flight-hud .instruments,body[data-touch-controls=true] #flight-hud .throttle-instrument{display:none}
body[data-touch-controls=true] #flight-hud .cockpit-mobile-readout{display:flex;position:fixed;left:max(12px,env(safe-area-inset-left));right:auto;top:max(62px,calc(env(safe-area-inset-top) + 54px));bottom:auto;width:calc(100% - 24px);max-width:420px;gap:3px;flex-direction:column;padding:6px 8px;background:color-mix(in srgb,var(--bg) 88%,transparent);color:var(--ink);font:11px/1.4 Consolas,monospace}
body[data-touch-controls=true] .touch-telemetry{display:block;color:var(--accent)}
body[data-touch-controls=true] .touch-telemetry:empty{display:none}
body[data-touch-controls=true] #touch-alert{color:var(--red)}
body[data-touch-controls=true] #crew-panel,body[data-touch-controls=true] #bridge-panel{top:62px;bottom:auto;left:max(12px,env(safe-area-inset-left));right:auto;max-width:calc(100% - 24px);padding:8px}
body[data-touch-controls=true] #crew-panel p,body[data-touch-controls=true] #bridge-panel>p:last-of-type{display:none}
body[data-touch-controls=true] #crew-map{width:44px;height:64px;margin-bottom:0}
body[data-touch-controls=true] #crew-interact{margin-top:4px}
@media(orientation:landscape) and (max-height:540px){
 .touch-left,.touch-right{width:180px;gap:6px;bottom:max(8px,env(safe-area-inset-bottom))}
 .touch-stick{width:104px;height:104px}.touch-targets{gap:4px}.touch-targets>[data-action]{flex:1 0 25%}
 .touch-weapons{flex-direction:row}.touch-weapons>*{flex:1}#touch-controls .touch-fire{min-height:64px}
 body[data-touch-controls=true] #flight-hud .cockpit-mobile-readout{left:calc(max(12px,env(safe-area-inset-left)) + 188px);top:max(8px,env(safe-area-inset-top));width:calc(100% - 400px);font-size:10px;padding:4px}
 body[data-touch-controls=true] #flight-hud .cockpit-mobile-readout strong{font-size:10px}
 body[data-touch-controls=true] #crew-panel,body[data-touch-controls=true] #bridge-panel{top:8px;left:200px;max-width:calc(100% - 400px);font-size:10px}
}
@media(max-width:360px){.touch-left,.touch-right{width:132px}.touch-stick{width:112px;height:112px}}
