/* Portrait command desk: retain direct orders and let the battlefield breathe.
   Camera extras share one scrollable row; detailed orders remain in the drawer. */
@media(max-width:760px) and (orientation:portrait){
 #app[data-view=battle] .icon-button,#app[data-view=battle] .audio-settings-trigger{width:44px;min-width:44px;height:44px;flex:0 0 44px}
 #app[data-view=battle] .wordmark{min-height:44px}
 #battle-hud{padding:10px 8px max(8px,env(safe-area-inset-bottom));gap:6px}
 #battle-hud .battle-top{grid-template-columns:minmax(0,1fr) minmax(190px,1.28fr);gap:6px}
 #battle-hud .battle-head h2{font-size:16px;line-height:1.4;margin:0;word-break:keep-all}
 #battle-hud .battle-head .chapter-label,#battle-hud .battle-head .mission-progress,#battle-hud #campaign-status,#battle-hud .flagship-condition,#battle-hud .command-guide,#battle-hud .captain-console,#battle-hud .tactical-note,#battle-hud .render-stats,#battle-hud .unit-heading>span,#battle-hud #focus-selected,#battle-hud #hud-toggle,#battle-hud #order-label,#battle-hud .commands small{display:none}
 #battle-hud .fleet-status{min-width:0;max-width:none;width:100%;padding:4px 6px;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px;gap:2px 6px;align-items:center}
 #battle-hud .strength-line{min-width:0;font-size:10px;line-height:1.4}
 #battle-hud .strength-line>span{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 #battle-hud .strength-line strong,#battle-hud .strength-line.enemy strong{font-size:19px;line-height:1.25}
 #battle-hud #intel-toggle{grid-column:3;grid-row:1/3;min-height:44px;padding:2px;font-size:10px;line-height:1.25;text-align:center;border-left:1px solid #5b77804d;word-break:keep-all}
 #battle-hud .camera-console{width:100%;min-width:0;flex-direction:row;justify-content:flex-start;align-items:stretch;gap:4px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none}
 #battle-hud .camera-console>div{flex:0 0 auto;width:max-content;max-width:none;margin:0;flex-wrap:nowrap}
 #battle-hud .camera-console button{min-height:44px;min-width:44px;padding:6px 9px;font-size:12px;white-space:nowrap}
 #battle-hud .command-wrap{display:grid;grid-template-columns:minmax(0,1fr) auto;width:100%;max-height:none;overflow:visible;border-radius:8px;background:#09151ef2}
 #battle-hud .unit-heading{grid-column:2;grid-row:1;min-height:44px;height:auto;flex-wrap:nowrap;gap:2px;padding:0 4px;border:0;justify-content:flex-end}
 #battle-hud .command-meta{grid-column:1;grid-row:1;min-width:0;min-height:44px;height:auto;padding:0 6px;gap:6px;font-size:12px;justify-content:flex-start;background:transparent}
 #battle-hud .command-meta>div{gap:3px;margin-left:auto}
 #battle-hud .unit-heading>button,#battle-hud .command-meta button,#battle-hud .navigation-confirm button,#battle-hud .planning-banner button,#battle-hud .immersive-toolbar button{min-width:44px;min-height:44px;padding:5px 8px;font-size:11px;white-space:nowrap}
 #battle-hud .unit-selector{grid-column:1/-1;grid-row:2;border-top:1px solid #4b67745c}
 #battle-hud .unit-selector>button{min-height:48px;padding:4px;line-height:1.4}
 #battle-hud .commands{grid-column:1/-1;grid-row:3}
 #battle-hud .commands button{min-height:52px;padding:8px 3px;justify-content:center}
 #battle-hud .navigation-confirm,#battle-hud .planning-banner{grid-column:1/-1;min-width:0}
 #app[data-online=true] #battle-hud .command-meta>div{display:none}
}

/* On short phones the existing side desk stays scrollable above the safe area. */
@media(max-width:980px) and (max-height:540px) and (orientation:landscape){
 #battle-hud .captain-console,#battle-hud .command-guide,#battle-hud .unit-heading>span,#battle-hud #hud-toggle{display:none}
 #battle-hud .command-wrap{max-height:100%;overflow-y:auto;overscroll-behavior:contain}
 #battle-hud .unit-heading>button,#battle-hud .command-meta button,#battle-hud .unit-selector>button,#battle-hud .commands button,#battle-hud .navigation-confirm button,#battle-hud .planning-banner button,#battle-hud .immersive-toolbar button{min-width:44px;min-height:44px}
}

/* BUILD29: selected-fleet framing is one tap away on a narrow command desk. */
@media(max-width:760px),(max-width:980px) and (max-height:540px){
 #battle-hud .camera-console #focus-selected{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;min-width:58px;min-height:44px;padding:5px 7px;font-size:11px;white-space:nowrap;color:#e1d1a8;border:1px solid #a08b5e6b;background:#51442a32;border-radius:3px}
 #battle-hud .camera-console #focus-selected kbd{display:none}
}
