/* BUILD25: one compact command desk, a visible execution state, and optional detail. */

/* Every atlas is 4 by 2 square cells. A non-square box distorts the face. */
:where(.war-portrait.atlas,.setup-portrait,.setup-side-portrait,.roster-current-portrait,.fleet-unit-portrait,.fleet-edit-portrait,.commander-atlas,.captain-portrait,.lobby-portrait){aspect-ratio:1;height:auto!important;flex:0 0 auto!important;align-self:center}
.ship-captain{display:flex;align-items:center;gap:9px;margin:8px 0;color:#b8c9d0;font-size:11px;line-height:1.5}
.ship-captain-portrait{display:block;flex:0 0 36px;width:36px;height:36px;aspect-ratio:1;background-size:400% 200%;background-repeat:no-repeat;border:1px solid #84978566;border-radius:3px}
.ship-captain strong{font-size:11px;font-weight:500;color:#d5d6bf}
.ship-selector button strong,.ship-selector button span{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.history-entry-grid{gap:8px}
.history-entry{display:flex;align-items:center;gap:10px;min-width:0;min-height:64px;padding:10px 12px;text-align:left;border:1px solid #8c82576b;background:linear-gradient(115deg,#393b2e8c,#0b1721ed);border-radius:3px}
.history-entry.alliance{border-color:#668a8873;background:linear-gradient(115deg,#24413e80,#0b1721ed)}
.history-entry-number{flex:0 0 auto;font:18px/1 Georgia,serif;color:#b6ac81;opacity:.65}
.history-entry>span:nth-child(2){min-width:0;flex:1}
.history-entry strong{display:block;font-size:14px;line-height:1.4;font-weight:500;color:#ebe6d8;word-break:keep-all}
.history-entry small{display:block;font-size:10px;line-height:1.5;color:#a9bfbe;margin-top:4px;word-break:keep-all}
.history-entry>b{font-size:16px;font-weight:400;color:#bfc4a3}
#intro h1{font-size:clamp(40px,3.4vw,54px);line-height:1.23;margin:14px 0 10px}
#intro .intro-copy{font-size:13px;line-height:1.7}
#intro .intro-launch{margin-top:18px}
#intro .intro-mission{padding-top:12px;margin-bottom:10px}
#intro .intro-mission p{display:none}
.sound-hint{position:absolute;top:calc(100% + 8px);right:0;display:block;width:max-content;padding:5px 9px;background:#14242af2;border:1px solid #9f91605c;border-radius:4px;color:#d4ceb4;font-size:10px;font-weight:400;line-height:1.5;white-space:nowrap;pointer-events:none;box-shadow:0 4px 15px #0005}
#sound[aria-pressed=true] .sound-hint,#app[data-view=battle] .sound-hint{display:none}
#app[data-view=battle] #sound[aria-pressed=false]:is(:hover,:focus-visible) .sound-hint{display:block}
#app[data-view=battle] .icon-button,#app[data-view=battle] .audio-settings-trigger{width:44px;min-width:44px;height:44px;min-height:44px;flex:0 0 44px}

#battle-hud{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr) auto;padding:12px 20px 16px;gap:10px}
#battle-hud .battle-top{grid-column:1;grid-row:1;display:grid;grid-template-columns:minmax(160px,1fr) auto minmax(220px,1fr);gap:16px;align-items:center}
#battle-hud .battle-head{position:relative;inset:auto;transform:none;min-width:0;width:100%;min-height:48px;max-width:440px;align-self:center}
#battle-hud .battle-head h2{font-size:18px;line-height:1.35;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#battle-hud .battle-head .chapter-label,#battle-hud .battle-head>p,#battle-hud .mission-progress,#battle-hud .battle-head .campaign-route,#battle-hud .render-stats{display:none}
#battle-hud #campaign-status{position:absolute;inset:0;display:flex;justify-content:flex-end;min-height:48px;max-width:100%;padding:22px 0 3px;margin:0;background:none;border:0}
#battle-hud .campaign-status-label{display:block;max-width:100%;font-size:11px;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#battle-hud .fortress-alert{position:absolute;top:calc(100% + 3px);left:0;min-width:100%;background:#101b22ed;z-index:2}
#battle-hud .fleet-status{position:static;display:grid;width:min(285px,100%);min-width:0;max-width:none;justify-self:end;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 48px;gap:2px 10px;padding:4px 8px;align-items:center;background:#09151dd9;border:1px solid #61777c42}
#battle-hud .strength-line{min-width:0;font-size:10px;line-height:1.4}
#battle-hud .strength-line>span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#battle-hud .strength-line strong,#battle-hud .strength-line.enemy strong{font-size:21px;line-height:1.15}
#battle-hud .strength-bar{margin:2px 0;height:2px}
#battle-hud #intel-toggle{grid-column:3;grid-row:1/3;min-height:44px;padding:4px;font-size:11px;line-height:1.4;text-align:center;white-space:normal;border-left:1px solid #627e814d}
#battle-hud #finish-operation{grid-column:1/-1;min-height:44px}
#battle-hud .camera-console{position:relative;grid-column:auto;grid-row:auto;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:5px;min-width:0;width:auto;overflow:visible}
#battle-hud .view-controls{width:max-content;max-width:100%;padding:2px;gap:1px;border-color:#5c717e50;background:#0a1520cc}
#battle-hud .view-controls button{flex:0 0 auto;min-height:44px;min-width:44px;padding:5px 10px;font-size:12px}
#battle-hud .view-controls kbd{display:none}
.camera-extras{position:relative;flex:0 0 auto;color:#acbdc5;pointer-events:auto}
.camera-extras>summary{display:flex;align-items:center;gap:5px;justify-content:center;min-width:52px;min-height:44px;padding:5px 8px;border:1px solid #5c717e50;background:#0a1520cc;cursor:pointer;font-size:11px;list-style:none}
.camera-extras>summary::-webkit-details-marker{display:none}
.camera-extras[open]>summary{color:#e8d3a2;border-color:#ae9764}
.camera-extras-body{position:absolute;right:0;top:calc(100% + 7px);z-index:28;width:300px;max-width:calc(100vw - 24px);padding:10px;background:#0b1924fa;border:1px solid #7e969777;box-shadow:0 10px 30px #0009}
#battle-hud .camera-extras .focus-controls,#battle-hud .camera-extras .cinema-controls{position:static;inset:auto;transform:none;display:flex!important;flex-wrap:wrap;justify-content:flex-start;width:100%;max-width:100%;gap:5px;margin:0 0 7px}
#battle-hud .camera-extras button{min-height:44px;min-width:44px;padding:6px 10px;font-size:11px}
#battle-hud .camera-extras .flagship-condition{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:0}
#battle-hud .camera-extras .flagship-condition button{min-width:0;min-height:44px;font-size:10px;padding:5px}
#battle-hud .battle-workspace{grid-column:1;grid-row:2;min-width:0;min-height:0}

/* Dense tactical formations keep their side marker without obscuring ships. */
#battle-hud .taskforce-tag{min-width:0;width:auto;padding:3px 5px;font-size:10px;background:#07131a66;border:1px solid transparent;border-radius:3px;text-shadow:0 1px 5px #000,0 0 8px #000}
#battle-hud .taskforce-tag.selected{background:#211e1666;border-color:#bca16970;color:#ffe4a6}
#battle-hud .taskforce-tag i,#battle-hud .taskforce-tag.enemy i{width:11px;height:11px;margin:0 auto 4px;opacity:.95}
#battle-hud .taskforce-tag small{font-size:9px;line-height:1.4}
#battle-hud .taskforce-tag[data-condensed=true]{min-width:0;width:auto;padding:0;background:none;border:0;box-shadow:none}
#battle-hud .taskforce-tag[data-condensed=true] span,#battle-hud .taskforce-tag[data-condensed=true] small{display:none}
#battle-hud .taskforce-tag[data-condensed=true] i{width:11px;height:11px;margin:0}

#battle-hud .command-wrap{grid-column:1;grid-row:3;display:grid;grid-template-columns:minmax(0,1fr) auto;position:static;inset:auto;transform:none;justify-self:center;align-self:end;width:min(900px,100%);max-height:none;overflow:visible;min-width:0;border:1px solid #607a7d6b;border-radius:7px;background:#0a1721e8;box-shadow:0 8px 30px #0007}
#battle-hud .command-guide,#battle-hud .command-guide.collapsed{grid-column:1;grid-row:1;display:flex;align-items:center;gap:6px;min-height:44px;padding:5px 8px 5px 12px;border:0;background:transparent;min-width:0}
#battle-hud .guide-number,#battle-hud .unit-heading>span,#battle-hud #focus-selected,#battle-hud #hud-toggle,#battle-hud #order-label,#battle-hud .tactical-note{display:none}
#battle-hud .guide-copy{flex:1;min-width:0}
#battle-hud .guide-copy strong{display:block;color:#e4d7af;font-size:13px;font-weight:500;line-height:1.45;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#battle-hud .command-path{display:block;font-size:10px;line-height:1.5;color:#9fb7c2;margin-top:2px}
#battle-hud .guide-copy #guide-detail{font-size:11px;line-height:1.5;color:#bdd0d3;margin:5px 0 0;max-width:100%;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
#battle-hud .command-guide.collapsed #guide-detail{display:none}
#battle-hud #guide-toggle{flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:0;font-size:18px;color:#91b2ba;border:0;border-left:1px solid #53707738}
#battle-hud #guide-action{min-height:44px;max-width:145px;padding:6px 10px;font-size:11px;line-height:1.45;border:1px solid #9c96657d;border-radius:3px;color:#e2d4a5;background:#5b54322e}
#battle-hud .command-guide[data-tone=warning] .guide-copy strong{color:#edb99d}
#battle-hud .command-guide[data-tone=good] .guide-copy strong{color:#b5ddd0}
#battle-hud .unit-heading{grid-column:2;grid-row:1;display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;min-height:44px;height:auto;gap:3px;padding:0 6px 0 0;border:0}
#battle-hud .unit-heading>button,#battle-hud #captain-delegate{flex:0 0 auto;min-height:44px;min-width:44px;padding:5px 8px;margin:0;font-size:11px;line-height:1.4;white-space:nowrap;border:1px solid transparent;border-radius:3px}
#battle-hud #quick-tactics{border-color:#a8905d77;color:#ecd19a;background:#6653322e}
#battle-hud #captain-delegate{border-color:#526e7770;color:#b1c8ce}
#battle-hud #captain-delegate[aria-pressed=true]{color:#b4ded0;background:#2c51473d;border-color:#6da89380}
#battle-hud #immersive-toggle{border-color:#56747e60;color:#c2d7de;padding:5px 8px}
#battle-hud .unit-selector{grid-column:1/-1;grid-row:2;display:grid;grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:2px;padding:3px;border-top:1px solid #45616a50;background:#06121bcc}
#battle-hud .unit-selector>button{min-width:0;min-height:48px;padding:4px 9px 5px;border-radius:3px;line-height:1.4}
#battle-hud .unit-selector strong{font-size:12px;line-height:1.4}
#battle-hud .unit-selector .unit-count{display:none}
#battle-hud .unit-selector .unit-order{display:block;margin:2px 0 0;font-size:10px;line-height:1.4;min-height:14px}
#battle-hud .unit-selector .unit-strength{display:block;position:absolute;left:8px;right:8px;bottom:2px;width:auto;height:2px;margin:0;background:#31434c5c}
#battle-hud .unit-selector .unit-strength b{display:block;height:100%;background:#6aaea68c}
#battle-hud .unit-selector>button.active{border-color:#ceb77d;background:#9f84452c}
#battle-hud .commands{grid-column:1;grid-row:3;grid-template-columns:repeat(4,minmax(0,1fr));border-bottom:0}
#battle-hud .commands button{min-height:52px;min-width:44px;padding:7px 4px;justify-content:center}
#battle-hud .commands strong{font-size:14px;line-height:1.4}
#battle-hud .commands small{display:block;font-size:10px;line-height:1.4;margin-top:2px;color:#8faab8}
#battle-hud .command-meta{grid-column:2;grid-row:3;display:flex;align-items:center;justify-content:flex-end;min-width:0;min-height:44px;height:auto;gap:6px;padding:3px 7px;font-size:11px;border-top:1px solid #49636d59;border-left:1px solid #49636d59;background:transparent}
#battle-hud .command-meta>div{display:flex;gap:3px;margin-left:0}
#app[data-view=battle] #battle-hud #pause{display:inline-flex;align-items:center;justify-content:center}
#battle-hud .command-meta button,#battle-hud .planning-banner button,#battle-hud .navigation-confirm button{min-width:44px;min-height:44px;padding:5px 8px;font-size:12px;line-height:1.4;white-space:nowrap}
#battle-hud .navigation-confirm,#battle-hud .planning-banner{grid-column:1/-1;grid-row:auto;min-width:0;padding:6px 10px;gap:8px;border-radius:0 0 6px 6px}
#battle-hud .planning-banner:has(#review-plan[hidden]){display:none}
#battle-hud .planning-banner strong{font-size:11px;line-height:1.5}
#battle-hud #drawer-status .captain-console{display:block;padding:12px;border:1px solid #526f7960;border-radius:4px}
#battle-hud #drawer-status .captain-readings{display:flex;flex-wrap:wrap;gap:9px;font-size:11px;margin-top:10px}
#battle-hud #drawer-status .captain-status p{display:block;font-size:12px;white-space:normal;line-height:1.6}
#battle-hud #drawer-status .thrust-controls{display:flex;flex-wrap:wrap;gap:5px;margin-left:0;width:100%}
#battle-hud #drawer-status .thrust-controls button{min-height:44px;font-size:12px;flex:1}
#battle-hud .board-title #drawer-close{width:44px;min-width:44px}
#battle-hud .board-title #drawer-close,#battle-hud .board-title #drawer-expand,#battle-hud .drawer-head button,#battle-hud .board-context select,#battle-hud .board-footer button,#battle-hud .board-map-help summary,#battle-hud .board-status-tabs button,#battle-hud .map-tools button{min-height:44px}
#battle-hud #drawer-tactics .battle-command-tabs button,#battle-hud #drawer-tactics .formation-controls button,#battle-hud #drawer-tactics .board-thrust button,#battle-hud #drawer-tactics .board-fire-policy button,#battle-hud #drawer-tactics .autonomy-panel button{min-height:44px}
.history-autonomy-option,.setup-control-option{display:flex;align-items:center;gap:10px;min-height:56px;padding:10px 12px;border:1px solid #58747768;background:#142a3059;color:#d0dedb;font-size:13px;line-height:1.45;cursor:pointer}
.history-autonomy-option{margin:14px 0}
.history-autonomy-option input,.setup-control-option input{width:18px;height:18px;flex:0 0 18px;accent-color:#bea774;margin:0}
.history-autonomy-option small,.setup-control-option small{display:block;font-size:11px;color:#9fb7be;margin-top:4px}
.custom-workspace .setup-footer{display:grid;grid-template-columns:auto minmax(210px,1fr) auto;gap:14px;align-items:center}
.setup-control-option{font-size:12px;padding:8px 10px;min-height:52px}
.setup-control-option small{font-size:10px}
.custom-workspace .setup-footer-actions{flex-wrap:wrap;justify-content:flex-end}
.strategy-preview .strategy-contract{font-size:12px;line-height:1.7}
.strategy-preview .strategy-risk{font-size:12px;line-height:1.7}
@media(hover:hover){.history-entry:hover{background-color:#5270612e;border-color:#bdc29a}.camera-extras>summary:hover{color:#ead8a9}}

@media(max-width:900px){
 #battle-hud .battle-top{grid-template-columns:minmax(0,1fr) minmax(190px,1.28fr);gap:5px 8px}
 #battle-hud .camera-console{grid-column:1/-1;grid-row:2;justify-content:center}
 #battle-hud .fleet-status{width:100%;max-width:285px;gap:2px 6px}
 .custom-workspace .setup-footer{grid-template-columns:1fr 1fr;gap:9px}
 .custom-workspace .setup-footer-actions{grid-column:1/-1}
}
@media(max-width:760px) and (orientation:portrait){
 #intro .intro-shell{margin-top:clamp(8px,4dvh,32px)}
 #intro h1{font-size:clamp(32px,8.3vw,41px);line-height:1.23;margin:12px 0 9px}
 #intro .intro-copy{font-size:12px}
 #intro .intro-launch{margin-top:14px}
 .history-entry{min-height:61px;padding:8px 9px;gap:7px}
 .history-entry-number{font-size:15px}
 .history-entry strong{font-size:13px}
 .history-entry small{font-size:9px}
 .history-entry>b{display:none}
 #battle-hud{inset:53px 0 0;padding:10px 8px max(8px,env(safe-area-inset-bottom));gap:6px}
 #battle-hud .battle-head h2{font-size:15px;line-height:1.45}
 #battle-hud .battle-head{min-height:48px}
 #battle-hud .campaign-status-label{font-size:10px}
 #battle-hud .fleet-status{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px;padding:4px 6px}
 #battle-hud .strength-line strong,#battle-hud .strength-line.enemy strong{font-size:19px}
 #battle-hud .camera-console{gap:4px}
 #battle-hud .view-controls button{font-size:12px;min-height:44px;padding:5px 8px}
 #battle-hud .command-wrap{width:100%;grid-template-columns:minmax(0,1fr) auto}
 #battle-hud .command-guide,#battle-hud .command-guide.collapsed{grid-column:1/-1;grid-row:1;padding:4px 6px 4px 9px;gap:4px;min-height:44px}
 #battle-hud .guide-copy strong{font-size:12px;line-height:1.45}
 #battle-hud .command-path{font-size:10px;line-height:1.5}
 #battle-hud .guide-copy #guide-detail{font-size:11px;margin-top:4px}
 #battle-hud #guide-toggle{flex-basis:44px;width:44px;height:44px}
 #battle-hud #guide-action{max-width:116px;padding:5px 7px;font-size:10px}
 #battle-hud .unit-selector{grid-row:2;padding:2px;gap:1px}
 #battle-hud .unit-selector>button{padding:3px 5px 5px;min-height:44px}
 #battle-hud .unit-selector strong{font-size:12px}
 #battle-hud .unit-selector .unit-order{font-size:10px}
 #battle-hud .commands{grid-column:1/-1;grid-row:3}
 #battle-hud .commands button{min-height:44px;padding:6px 3px}
 #battle-hud .commands strong{font-size:14px}
 #battle-hud .commands small{display:none}
 #battle-hud .command-meta{grid-column:1;grid-row:4;justify-content:flex-start;flex-wrap:wrap;padding:0 3px;gap:2px;border-left:0}
 #battle-hud #battle-clock{font-size:10px;letter-spacing:.5px}
 #battle-hud .command-meta button{font-size:11px;padding:5px 4px}
 #battle-hud .unit-heading{grid-column:2;grid-row:4;gap:1px;padding:0 2px;border-top:1px solid #49636d59}
 #battle-hud .unit-heading>button,#battle-hud #captain-delegate{font-size:10px;padding:5px 4px}
 #battle-hud .unit-heading kbd,#battle-hud #quick-tactics>span{display:none}
 #battle-hud .command-wrap:has(#cancel-withdrawal:not([hidden])) .unit-heading{grid-column:1/-1;grid-row:5}
 #battle-hud .command-wrap:has(#cancel-withdrawal:not([hidden])) .command-meta{grid-column:1/-1}
 #battle-hud .planning-banner,#battle-hud .navigation-confirm{padding:6px 8px;gap:6px}
 #battle-hud .board-context select{font-size:16px}
 .history-autonomy-option{font-size:12px}
 .custom-workspace .setup-footer{grid-template-columns:1fr;gap:8px}
 .custom-workspace .setup-footer-summary{display:flex;align-items:center;justify-content:space-between;gap:10px}
 .custom-workspace .setup-footer-actions{grid-column:1;display:flex;gap:6px}
 .custom-workspace .setup-footer-actions>button{flex:1;min-height:44px;padding:9px 7px;font-size:12px}
 .setup-control-option{min-height:46px;padding:7px 10px;font-size:12px}
 .setup-control-option small{font-size:10px;margin-top:2px}
}
@media(max-height:540px) and (orientation:landscape){
 #app[data-view=battle] .topbar{height:48px}
 #battle-hud{inset:48px 0 0;grid-template-columns:minmax(0,1fr) 300px;grid-template-rows:auto minmax(0,1fr);padding:7px 12px max(8px,env(safe-area-inset-bottom));gap:6px 10px}
 #battle-hud .battle-top{grid-column:1/-1;grid-row:1;grid-template-columns:minmax(100px,1fr) auto minmax(180px,1fr);gap:8px}
 #battle-hud .battle-head h2{font-size:14px}
 #battle-hud .campaign-status-label{font-size:9px}
 #battle-hud .camera-console{grid-column:2;grid-row:1}
 #battle-hud .view-controls button{font-size:10px;padding:4px 7px}
 #battle-hud .fleet-status{min-width:0;gap:2px 6px;padding:3px 5px;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px}
 #battle-hud .strength-line strong,#battle-hud .strength-line.enemy strong{font-size:17px}
 #battle-hud .battle-workspace{grid-column:1;grid-row:2}
 #battle-hud .command-wrap{grid-column:2;grid-row:2;grid-template-columns:1fr;max-height:100%;width:100%;overflow-y:auto;overscroll-behavior:contain}
 #battle-hud .command-guide,#battle-hud .command-guide.collapsed{grid-column:1;grid-row:1;padding:4px 7px}
 #battle-hud .guide-copy strong{font-size:11px}
 #battle-hud .command-path{font-size:9px}
 #battle-hud .guide-copy #guide-detail{font-size:10px;-webkit-line-clamp:1}
 #battle-hud #guide-action{max-width:90px;font-size:9px;padding:4px}
 #battle-hud .unit-selector{grid-column:1;grid-row:2;padding:2px}
 #battle-hud .unit-selector>button{min-height:44px;padding:3px}
 #battle-hud .unit-selector strong{font-size:11px}
 #battle-hud .unit-selector .unit-order{font-size:9px}
 #battle-hud .commands{grid-column:1;grid-row:3}
 #battle-hud .commands button{min-height:44px;padding:5px 2px}
 #battle-hud .commands strong{font-size:12px}
 #battle-hud .commands small{display:none}
 #battle-hud .unit-heading{grid-column:1;grid-row:4;justify-content:space-between;padding:0 3px}
 #battle-hud .unit-heading>button,#battle-hud #captain-delegate{font-size:10px;padding:4px 6px}
 #battle-hud .unit-heading kbd,#battle-hud #quick-tactics>span{display:none}
 #battle-hud .command-meta{grid-column:1;grid-row:5;justify-content:space-between;border-left:0;padding:0 6px}
 #battle-hud .planning-banner,#battle-hud .navigation-confirm{grid-column:1}
 #intro .history-entry{min-height:47px;padding:5px 8px;gap:7px}
 #intro .history-entry strong{font-size:12px}
 #intro .history-entry small{font-size:9px;margin-top:1px}
 #intro .history-entry-number{font-size:13px}
 #intro .history-entry-grid{gap:5px}
}
