/* TERRA LEGION V1.4.5 / COMMAND HUD 2.0
   Formal appearance only. The Three.js board, 2D debug HUD, and gameplay
   retain their existing coordinates and authoritative state. */
.command-hud{display:none}
.legion-game.mode-formal .command-hud{
 position:absolute;z-index:26;left:12px;right:12px;top:8px;
 display:grid;grid-template-columns:minmax(168px,1fr) 104px minmax(380px,1.85fr) 104px minmax(168px,1fr);
 gap:7px;align-items:start;pointer-events:none;
 font-family:'Microsoft Yahei','Segoe UI',sans-serif;color:#e3eeeb;
}
.legion-game.mode-formal .command-hud button{font-family:inherit;pointer-events:auto;cursor:pointer;appearance:none;-webkit-appearance:none}
.legion-game.mode-formal .command-hud button:disabled{cursor:not-allowed}
.legion-game.mode-formal .formal-situationbar,.legion-game.mode-formal .formal-field-tools{display:none!important}
.legion-game.mode-formal #message{display:none!important}
.legion-game.mode-formal .formal-nav-actions{gap:5px}
.legion-game.mode-formal .formal-nav-utility{display:flex;align-items:center;gap:5px;padding-left:9px;margin-left:6px;border-left:1px solid #5b797b80}
.legion-game.mode-formal .formal-nav-utility button{min-width:52px;padding:6px 8px;border-color:#5f8587;color:#cde3e0;background:#1d333b}
.legion-game.mode-formal .formal-nav-utility button:hover{border-color:#9cddd4;background:#31524f}
/* Flanking commander portraits: deliberately square, not a web list. */
.command-team{display:flex;align-items:flex-start;justify-content:flex-start;gap:5px;min-width:0;padding-top:2px;pointer-events:none}
.command-rivals{justify-content:flex-end}
.legion-game.mode-formal .command-seat{position:relative;display:flex;flex-direction:column;align-items:center;gap:3px;flex:0 1 48px;min-width:0;
 border:0;background:none;color:#a5bbc5;padding:0;opacity:.92;transition:opacity .13s,filter .13s;}
.command-seat-face{position:relative;display:grid;place-items:center;box-sizing:border-box;width:100%;aspect-ratio:1 / 1;
 min-height:32px;max-height:50px;border:1px solid #6b9daf;background:linear-gradient(145deg,#365b68,#152f3e 65%,#15232b);
 color:#9cbcca;font:700 23px Georgia,serif;text-shadow:0 0 9px #79b9c77c;overflow:hidden;}
.command-rivals .command-seat-face{border-color:#af6873;background:linear-gradient(145deg,#66434e,#36252f 68%,#231b23);color:#d7a3ab;text-shadow:0 0 9px #da717670}
.command-seat-number{position:absolute;top:2px;left:3px;font:700 9px Consolas,monospace;color:#e8f9fa;letter-spacing:.5px}
.command-seat-state{display:block;width:100%;font-size:9px;line-height:1.1;text-align:center;white-space:nowrap;color:#a8c6d0}
.command-rivals .command-seat-state{color:#d6a0a8}
.command-seat .command-eye,.command-king .command-eye{display:none;position:absolute;top:1px;right:0;background:#083d55;border:1px solid #8ce8ff;
 width:19px;height:17px;align-items:center;justify-content:center;color:#ddffff;font:700 14px Consolas,monospace;box-shadow:0 0 11px #46bcf19c}
.legion-game.mode-formal .command-seat.is-watching .command-seat-face{border-color:#c1eeff;box-shadow:0 0 0 2px #63d9f7,0 0 15px #41bce9a3,inset 0 0 18px #31a7d57c;filter:saturate(1.25)}
.legion-game.mode-formal .command-seat.is-watching .command-eye,.legion-game.mode-formal .command-king.is-watching .command-eye{display:flex}
.legion-game.mode-formal .command-seat.is-self .command-seat-face:before{content:'';position:absolute;bottom:0;left:0;right:0;height:3px;background:#75ded1}
.legion-game.mode-formal .command-seat:hover:not(:disabled) .command-seat-face{border-color:#e5fff3;filter:brightness(1.23)}
.legion-game.mode-formal .command-seat:disabled{opacity:.56}
.legion-game.mode-formal .command-seat:focus-visible,.legion-game.mode-formal .command-king:focus-visible,.legion-game.mode-formal .command-center button:focus-visible{outline:2px solid #adf5dc;outline-offset:2px}
/* Kings are persistent status objects. Their death changes the portrait,
   never decides match victory and never removes the portrait itself. */
.legion-game.mode-formal .command-king{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;
 min-width:0;width:100%;height:100px;gap:2px;padding:4px 7px 7px;border:1px solid #5c8a9b;background:linear-gradient(180deg,#1d3c4bda,#10212bdc);color:#e3f7ff;
 box-shadow:inset 0 1px #bae7ff26,0 5px 18px #0008}
.legion-game.mode-formal .command-king-red{border-color:#b47d85;background:linear-gradient(180deg,#4b3038da,#231d25dc);color:#ffe5e5}
.command-king-crest{display:grid;place-items:center;position:relative;min-height:29px;width:34px;font:30px Georgia,serif;color:#9bdfff;text-shadow:0 0 15px #54d6ff77}
.command-king-red .command-king-crest{color:#ff9b9e;text-shadow:0 0 14px #ec666b77}
.command-king-title{font-size:10px;letter-spacing:1px;font-weight:700}
.command-king strong{font:700 14px Consolas,monospace;font-variant-numeric:tabular-nums}
.command-king-bar{display:block;width:90%;height:4px;margin-top:3px;overflow:hidden;background:#0a1015;border:1px solid #375866}
.command-king-bar i{display:block;height:100%;width:100%;background:linear-gradient(90deg,#429ec7,#a3e3ff);transition:width .25s linear}
.command-king-red .command-king-bar i{background:linear-gradient(90deg,#b34b60,#f19fa0)}
.legion-game.mode-formal .command-king.is-watching{outline:2px solid #a7e9fc;box-shadow:0 0 15px #4dc3f577}
.legion-game.mode-formal .command-king.is-fallen{filter:grayscale(.95);color:#a0aab0;border-color:#5a6268;background:linear-gradient(180deg,#262d30,#1b2226)}
.legion-game.mode-formal .command-king.is-fallen .command-king-crest{color:#7a878d;text-shadow:none;filter:brightness(.6)}
.legion-game.mode-formal .command-king.is-fallen .command-king-crest:before{content:'╱';position:absolute;color:#bd8e90;font-size:19px;opacity:.8;transform:rotate(10deg)}
.legion-game.mode-formal .command-king.is-fallen .command-king-bar{border-color:#464f54}
.legion-game.mode-formal .command-king:disabled{opacity:.72}
.legion-game.mode-formal .command-king:hover:not(:disabled){border-color:#dbf8f3;filter:brightness(1.12)}
/* Centre is one condensed tactical ribbon (not a big dashboard card). */
.command-center{min-width:0;height:100px;background:linear-gradient(180deg,#162b32ed,#0d2028e7);
 border:1px solid #5b8386;box-shadow:0 5px 21px #0008;pointer-events:auto;display:flex;flex-direction:column;}
.command-core-top{display:flex;flex:1;align-items:center;justify-content:space-between;gap:8px;padding:7px 12px 4px;min-width:0}
.command-core-top>span{display:flex;flex-direction:column;gap:4px;white-space:nowrap}
.command-core-top small,.command-unit-cap small{color:#809da6;font:8px Consolas,monospace;letter-spacing:.8px}
.command-wave strong{color:#effbfa;font:700 15px Consolas,monospace}
.command-phase{align-items:center;flex:1;min-width:0}
.command-phase strong{color:#9ce2cc;font-size:15px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.command-funds strong{color:#edcb87;font:700 15px Consolas,monospace}
.command-funds i{font-size:13px;font-style:normal}
.command-core-bottom{display:flex;align-items:center;justify-content:center;gap:5px;min-height:36px;padding:4px 8px;background:#102029;border-top:1px solid #38575c9e}
.legion-game.mode-formal .command-core-bottom button{border:1px solid #5d898b;background:#203e47;color:#d6f5ef;font-size:10px;
 font-weight:700;min-height:27px;white-space:nowrap;padding:3px 8px}
.legion-game.mode-formal .command-core-bottom button span{font-size:13px;color:#ace6e1;margin-right:3px}
.legion-game.mode-formal .command-core-bottom button.is-active{border-color:#a4eff0;background:#24626e}
.legion-game.mode-formal .command-core-bottom button:hover:not(:disabled){background:#386d69;border-color:#aeedcc}
.legion-game.mode-formal .command-core-bottom button:disabled{opacity:.42}
.legion-game.mode-formal .command-core-bottom button[hidden]{display:none!important}
.command-unit-cap{display:flex;align-items:center;gap:4px;white-space:nowrap;margin-left:auto;color:#bed6df}
.command-unit-cap strong{font:700 12px Consolas,monospace}
.command-clock{min-width:40px;text-align:right;color:#e8c890;font:700 11px Consolas,monospace}
.command-clock[hidden]{display:none!important}
/* Keep scenes readable: only the command ribbon and buttons overlay the
   top 115px, nothing blackens the full screen. */
.legion-game.mode-formal .battle-top,.legion-game.mode-formal .view-toolbar{display:none!important}
.legion-game.mode-formal .formal-toolbar .formal-nav-utility button{font-family:'Microsoft Yahei',sans-serif}
@media(max-width:1250px){
 .legion-game.mode-formal .command-hud{left:6px;right:6px;grid-template-columns:minmax(126px,1fr) 82px minmax(335px,2fr) 82px minmax(126px,1fr);gap:4px}
 .legion-game.mode-formal .command-king{height:94px;padding:3px}
 .legion-game.mode-formal .command-center{height:94px}
 .command-seat-face{min-height:28px}.command-seat-state{font-size:8px}.command-team{gap:3px}
 .legion-game.mode-formal .formal-toolbar{padding-right:260px}
 .formal-toolbar-brand{min-width:175px}
 .legion-game.mode-formal .formal-nav-actions button{min-width:0;padding:6px 7px;font-size:10px}
 .legion-game.mode-formal .formal-nav-utility{gap:3px;padding-left:4px;margin-left:2px}
}
@media(max-width:920px){
 .legion-game.mode-formal .command-hud{grid-template-columns:minmax(120px,1fr) 67px minmax(240px,1.85fr) 67px minmax(120px,1fr);top:5px;gap:3px}
 .legion-game.mode-formal .command-king{height:89px}.legion-game.mode-formal .command-center{height:89px}
 .command-king-crest{font-size:23px;min-height:25px}.command-king strong{font-size:11px}
 .command-core-top{padding:5px 6px 2px;gap:4px}.command-core-bottom{padding:3px 5px;gap:3px}
 .command-core-top small{font-size:7px}.command-wave strong,.command-funds strong{font-size:12px}.command-phase strong{font-size:12px}
 .legion-game.mode-formal .command-core-bottom button{font-size:9px;padding:2px 5px}
 .command-unit-cap small{display:none}.command-unit-cap strong{font-size:10px}
 .command-clock{display:none}
 .legion-game.mode-formal .formal-nav-utility button{min-width:0;padding:5px!important;font-size:9px!important}
}
@media(max-width:720px){
 .legion-game.mode-formal .command-hud{grid-template-columns:1fr 55px minmax(185px,1.8fr) 55px 1fr;gap:2px;left:3px;right:3px}
 .legion-game.mode-formal .command-king{height:78px}.legion-game.mode-formal .command-center{height:78px}
 .command-seat-state{font-size:7px}.command-seat-face{min-height:24px}
 .command-king-title{font-size:8px}.command-king strong{font-size:9px}
 .command-core-top small{display:none}.command-core-top strong{font-size:10px!important}
 .legion-game.mode-formal .command-core-bottom button{font-size:8px}
 .command-unit-cap{display:none}
}
@media(prefers-reduced-motion:reduce){.command-seat,.command-king-bar i{transition:none}}

/* v1.6.6y: exhaustion deadline in the persistent command ribbon. */
.command-drain-clock{white-space:nowrap;font:700 10px Consolas,monospace;color:#f2ce85;padding:2px 5px;border:1px solid #886b44;background:#302c22;border-radius:3px}
.command-drain-clock[hidden]{display:none!important}
.command-drain-clock.is-urgent{color:#ffd5d0;border-color:#c66a72;background:#54282f}
.legion-game.mode-formal .siege-waiting-status,.legion-game.mode-formal .combat-complete-status{display:none!important}
.command-core-top .command-phase #command-watch-status.is-watch-status{display:block;max-width:100%;padding:2px 5px;white-space:normal;text-align:center;letter-spacing:0;font:700 clamp(9px,.85vw,12px)/1.15 'Microsoft YaHei',sans-serif;color:#c5ffe5;background:#194039;border:1px solid #528c79;border-radius:2px}
.command-core-top .command-phase #command-watch-status.is-failed{color:#ffd6da;border-color:#94575d;background:#492b32}
@media(max-width:1050px){.command-drain-clock{font-size:9px;max-width:100px;white-space:normal;line-height:1.1;text-align:center}}
/* Player portraits and mirrored observed-command identity. */
.command-player-portrait{width:100%;height:100%;position:absolute;inset:0;object-fit:cover}
.command-player-portrait[hidden]{display:none}
.command-seat-number,.command-seat .command-eye{z-index:1;text-shadow:0 1px 3px #000;background:#13242a9c}
.command-seat.is-self .command-seat-face:before{z-index:2}
.command-core-top{display:grid;grid-template-columns:auto minmax(0,1fr) minmax(82px,1.02fr) minmax(0,1fr) auto;align-items:center;gap:5px}
.command-core-top .command-wave{grid-column:1;grid-row:1}
.command-core-top .command-phase{grid-column:3;grid-row:1;text-align:center;gap:2px}
.command-core-top .command-funds{grid-column:5;grid-row:1}
.command-core-top .commander-identity-chip:not([hidden]){display:flex!important;grid-column:2;grid-row:1;width:100%;max-width:none;margin:0;padding:4px;gap:5px;min-width:0}
.command-core-top .commander-identity-chip[data-side="red"]:not([hidden]){grid-column:4;flex-direction:row-reverse;text-align:right}
.command-core-top .commander-identity-chip #commander-identity-portrait{width:clamp(24px,2.6vw,40px);height:clamp(24px,2.6vw,40px);object-fit:cover}
.command-core-top .commander-identity-chip[data-side="red"] #commander-identity-portrait{transform:scaleX(-1)}
.command-core-top .commander-identity-chip #commander-identity-logo{width:clamp(13px,1.25vw,21px);height:clamp(13px,1.25vw,21px);object-fit:contain;border:0;background:none;margin-left:auto}
.command-core-top .commander-identity-chip[data-side="red"] #commander-identity-logo{margin-left:0;margin-right:auto}
.command-core-top .commander-identity-copy{flex:1;min-width:0}
.command-core-top .commander-identity-copy strong{font-size:clamp(10px,.9vw,15px);line-height:1.2}
.command-core-top .commander-identity-copy small{display:block;font-size:clamp(8px,.7vw,11px);letter-spacing:0}
#commander-identity-glyph{font-size:24px;color:#e2a0a6}
#commander-identity-glyph[hidden],#command-kills[hidden]{display:none!important}
.command-core-top .command-phase #command-kills:not([hidden]){display:block;color:#f0d8a4;font:700 clamp(9px,.8vw,13px) Consolas,'Microsoft YaHei',sans-serif;letter-spacing:0}
@media(max-width:1250px){.command-core-top{grid-template-columns:auto minmax(0,1fr) minmax(70px,.82fr) minmax(0,1fr) auto;gap:3px;padding-inline:5px}.command-core-top .commander-identity-chip:not([hidden]){gap:3px;padding:2px}.command-core-top .commander-identity-copy small{font-size:8px}}
@media(max-width:920px){.command-core-top{grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto auto}.command-core-top .command-phase{grid-column:2}.command-core-top .command-funds{grid-column:3}.command-core-top .commander-identity-chip:not([hidden]){grid-row:2;grid-column:1 / 3;width:max-content;max-width:100%;justify-self:start}.command-core-top .commander-identity-chip[data-side="red"]:not([hidden]){grid-column:2 / 4;justify-self:end}.command-core-top .commander-identity-chip #commander-identity-portrait{width:20px;height:20px}.command-core-top .commander-identity-copy{flex:initial}.command-core-top .commander-identity-copy small{display:none}}
