/* Dedicated touch surfaces: utility menus never rearrange held combat controls. */
.touch-device{--touch-controls-height:360px;--touch-side-reserve:196px}
#touch-controls{--touch-scale:1;--touch-opacity:.8;--touch-edge:16px;--touch-action-height:60px;--touch-extra:max(0px,calc((var(--touch-scale) - 1) * 184px));color:#eee8d7}
#touch-controls [hidden]{display:none!important}
#touch-controls button{box-sizing:border-box;min-width:44px;min-height:44px;border:1px solid #d2c3a455;border-radius:10px;background:rgb(24 29 29 / var(--touch-opacity));color:#eee8d7;padding:5px 8px;font:500 11px/1.15 system-ui;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
#touch-controls button b{font:500 20px/1 system-ui;color:#d4ba86}
#touch-controls button.held,#touch-controls button.active,#touch-controls button.touch-ability-active{background:#4f5141e6;border-color:#e2c78e;color:#fff2d4}
#touch-controls button:disabled{opacity:.5}
#touch-controls button:focus-visible,#touch-altitude:focus-visible{outline:2px solid #efcc89;outline-offset:3px}
#touch-toolbar{position:absolute;inset:auto max(12px,env(safe-area-inset-right)) calc(254px + var(--touch-action-height) + var(--touch-extra) + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));display:flex;flex-wrap:nowrap;justify-content:center;gap:7px;max-width:none;max-height:none;overflow:visible;margin:0}
#touch-toolbar button{min-width:52px;min-height:44px;flex:0 0 auto;font-size:10px}
#touch-toolbar button b{font-size:17px}
#touch-actions{position:absolute;left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));bottom:calc(242px + var(--touch-extra) + env(safe-area-inset-bottom));display:flex;flex-wrap:wrap;justify-content:center;align-items:stretch;gap:5px;pointer-events:none}
#touch-actions button{pointer-events:auto;flex:1 1 44px;min-width:44px;min-height:calc(48px * var(--touch-scale));max-width:96px;font-size:10px;padding:4px}
#touch-actions [data-touch="skill"],#touch-actions [data-touch="utility"]{flex-basis:64px;max-width:106px;background-image:linear-gradient(#d4b87e,#d4b87e);background-size:var(--ability-progress,100%) 2px;background-repeat:no-repeat;background-position:left bottom}
#touch-actions [data-touch="skill"] span,#touch-actions [data-touch="utility"] span{white-space:pre-line;line-height:1.22}
#touch-actions button b{font-size:17px}
#touch-move-zone{position:absolute;left:max(8px,env(safe-area-inset-left));bottom:env(safe-area-inset-bottom);width:150px;height:146px;pointer-events:auto;touch-action:none}
#touch-controls .touch-stick{width:calc(112px * var(--touch-scale));height:calc(112px * var(--touch-scale));max-width:140px;max-height:140px;box-sizing:border-box;border:1px solid #d2c3a473;background:rgb(24 29 29 / var(--touch-opacity));touch-action:none;display:grid;place-items:center}
#touch-move{position:absolute;left:8px;right:auto;bottom:16px;pointer-events:none}
#touch-move-zone.held #touch-move{border-color:#d7c292}
#touch-move.sprinting{box-shadow:0 0 0 5px #c4a96d45;border-color:#efd197}
#touch-controls .touch-stick i{width:36px;height:36px;background:#d7cda64d;border:1px solid #dfd3ad99}
#touch-controls .touch-stick span{font:10px/1.1 system-ui;color:#e6deca;bottom:9px}
#touch-aim{right:max(16px,env(safe-area-inset-right));bottom:calc(16px + env(safe-area-inset-bottom));left:auto;pointer-events:auto}
#touch-fire{right:calc(max(16px,env(safe-area-inset-right)) + 28px);bottom:calc(32px + max(112px,112px * var(--touch-scale)) + env(safe-area-inset-bottom));left:auto;width:max(64px,calc(72px * var(--touch-scale)));height:max(64px,calc(72px * var(--touch-scale)));border-radius:50%!important;border:2px solid #dbc28b!important;background:rgb(94 68 42 / var(--touch-opacity))!important;font-size:11px!important;touch-action:none!important;gap:2px!important}
#touch-fire b{font-size:24px!important}#touch-fire small{font:9px/1 system-ui;white-space:nowrap;color:#dacfba}
#touch-weapon-actions{position:absolute;right:calc(max(16px,env(safe-area-inset-right)) + max(112px,112px * var(--touch-scale)) + 15px);bottom:calc(22px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:6px}
#touch-weapon-actions button{width:max(44px,calc(47px * var(--touch-scale)));height:max(44px,calc(47px * var(--touch-scale)));font-size:9px;padding:3px}
#touch-weapon-actions [data-touch="precision"]{touch-action:none}
#touch-more{position:absolute;z-index:2;left:max(16px,env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right));bottom:calc(308px + var(--touch-action-height) + var(--touch-extra) + env(safe-area-inset-bottom));max-height:calc(100dvh - 368px - var(--touch-action-height) - var(--touch-extra));padding:12px;border:1px solid #d4c09366;border-radius:14px;background:#1a2020f5;box-shadow:0 12px 36px #0009;overflow-y:auto;overscroll-behavior:contain;pointer-events:auto;touch-action:pan-y}
#touch-more header{display:flex;align-items:center;justify-content:space-between;gap:12px;font:600 13px system-ui;margin-bottom:8px}
#touch-more header button{flex:0 0 44px;font-size:22px}
#touch-secondary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#touch-secondary button{min-height:50px;flex-direction:row;gap:7px;touch-action:pan-y}
#touch-flight{position:absolute;left:max(16px,env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right));bottom:calc(312px + var(--touch-action-height) + var(--touch-extra) + env(safe-area-inset-bottom));max-width:360px;margin:0 auto;padding:8px 10px;background:rgb(24 29 29 / var(--touch-opacity));border:1px solid #d2c3a455;border-radius:12px;pointer-events:auto}
#touch-flight-settings{border-bottom:1px solid #d2c3a433;margin:0 0 10px;padding-bottom:8px}
#touch-flight-settings label,#touch-flight .touch-flight-summary{display:flex;justify-content:space-between;gap:8px;font:11px/1.3 system-ui;color:#eee4cf;margin-bottom:5px}
#touch-flight.touch-secondary-hidden{visibility:hidden;pointer-events:none}
#touch-flight.touch-secondary-hidden *{pointer-events:none!important}
#touch-flight>div{display:flex;gap:5px}
#touch-flight button{flex:1;min-width:44px;min-height:44px;font-size:9px;padding:3px}
#touch-flight button b{font-size:17px}
#touch-altitude{width:100%;height:44px;margin:0;accent-color:#dbbd80;touch-action:none}
#touch-controls.touch-left-handed #touch-move-zone{left:auto;right:max(8px,env(safe-area-inset-right))}
#touch-controls.touch-left-handed #touch-aim{left:max(16px,env(safe-area-inset-left));right:auto}
#touch-controls.touch-left-handed #touch-fire{left:calc(max(16px,env(safe-area-inset-left)) + 28px);right:auto}
#touch-controls.touch-left-handed #touch-weapon-actions{left:calc(max(16px,env(safe-area-inset-left)) + max(112px,112px * var(--touch-scale)) + 15px);right:auto}
@media(orientation:portrait),(min-height:601px){
 #touch-controls.touch-pilot #touch-actions{left:max(16px,env(safe-area-inset-left));right:calc(132px * max(1,var(--touch-scale)) + env(safe-area-inset-right));bottom:calc(166px + var(--touch-extra) + env(safe-area-inset-bottom))}
 #touch-controls.touch-pilot.touch-left-handed #touch-actions{left:calc(132px * max(1,var(--touch-scale)) + env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right))}
 #touch-controls.touch-pilot #touch-flight{bottom:calc(242px + var(--touch-extra) + env(safe-area-inset-bottom));padding:6px 8px}
 #touch-controls.touch-pilot #touch-toolbar{bottom:calc(326px + var(--touch-extra) + env(safe-area-inset-bottom))}
}
@media(orientation:landscape) and (max-height:600px){
 .touch-device{--touch-controls-height:170px;--touch-side-reserve:196px}
 #touch-toolbar{left:calc(150px + env(safe-area-inset-left));right:calc(150px + env(safe-area-inset-right));top:calc(8px + env(safe-area-inset-top));bottom:auto;gap:5px}
 #touch-toolbar button{flex-direction:row;gap:5px;min-width:44px;min-height:44px;padding:5px 8px}
 #touch-toolbar button b{font-size:15px}
 #touch-actions{left:calc(164px * max(1,var(--touch-scale)) + env(safe-area-inset-left));right:calc(var(--touch-side-reserve) + env(safe-area-inset-right));bottom:calc(12px + env(safe-area-inset-bottom))}
 #touch-actions button{flex:1 1 44px;max-width:100px}
 #touch-fire{right:calc(max(16px,env(safe-area-inset-right)) + 22px)}
 #touch-controls.touch-left-handed #touch-fire{left:calc(max(16px,env(safe-area-inset-left)) + 22px)}
 #touch-controls.touch-left-handed #touch-actions{left:calc(var(--touch-side-reserve) + env(safe-area-inset-left));right:calc(164px * max(1,var(--touch-scale)) + env(safe-area-inset-right))}
 #touch-more{left:calc(164px * max(1,var(--touch-scale)) + env(safe-area-inset-left));right:calc(var(--touch-side-reserve) + env(safe-area-inset-right));top:calc(60px + env(safe-area-inset-top));bottom:calc(78px + env(safe-area-inset-bottom));max-height:none;padding:10px}
 #touch-controls.touch-left-handed #touch-more{left:calc(var(--touch-side-reserve) + env(safe-area-inset-left));right:calc(164px * max(1,var(--touch-scale)) + env(safe-area-inset-right))}
 #touch-secondary{grid-template-columns:repeat(3,minmax(0,1fr))}
 #touch-flight{left:calc(165px * max(1,var(--touch-scale)) + env(safe-area-inset-left));right:calc(var(--touch-side-reserve) + env(safe-area-inset-right));bottom:calc(73px + env(safe-area-inset-bottom));max-width:360px;padding:6px 8px}
 #touch-controls.touch-left-handed #touch-flight{left:calc(var(--touch-side-reserve) + env(safe-area-inset-left));right:calc(165px * max(1,var(--touch-scale)) + env(safe-area-inset-right))}
}
@media(max-width:370px){#touch-actions{gap:3px}#touch-actions button{font-size:9px}#touch-actions [data-touch="skill"],#touch-actions [data-touch="utility"]{flex-basis:62px}#touch-move-zone{width:138px}#touch-controls .touch-stick{width:100px;height:100px}#touch-weapon-actions{right:124px}#touch-controls.touch-left-handed #touch-weapon-actions{left:124px}}
