/* V1.6.6ab7 · The battlefield itself is reframed by the shared perspective camera.
   Never translate/scale board-wrap here: the world projection, 3D camera and hit tests
   must all consume the same camera state. */
.legion-game.mode-formal[data-camera-presentation="combat"] .reserve-bay,
.legion-game.mode-formal[data-camera-presentation="combat"] #reserve-page-hud{display:none!important}
.legion-game.mode-formal[data-shop-rail="none"] #formal-shop-rail,
.legion-game.mode-formal[data-shop-rail="none"] .formal-ready-dock{display:none!important}
.legion-game.mode-formal[data-shop-rail="mercenary"] #formal-shop-rail button:not([data-formal-open="dispatch"]){opacity:.32;filter:grayscale(1);cursor:not-allowed}

/* Compact, square commander portraits. Teammates sit shoulder-to-shoulder. */
.legion-game.mode-formal .terra-player-observation:not([hidden]){
 position:absolute;top:116px;left:50%;transform:translateX(-50%);z-index:28;pointer-events:auto;
 display:flex;align-items:flex-start;justify-content:center;gap:5px;
 width:min(760px,calc(100% - 165px));font-family:'Microsoft Yahei','Segoe UI',sans-serif;
}
.terra-player-observation[hidden],.legion-game:not(.mode-formal) .terra-player-observation{display:none!important}
.terra-player-team{display:flex;align-items:flex-start;justify-content:center;gap:2px;min-width:0}
.terra-player-avatar{box-sizing:border-box;border:0;background:transparent;display:flex;flex-direction:column;align-items:center;gap:2px;
 width:52px;min-width:52px;padding:0;color:#b9d9da;cursor:pointer;white-space:nowrap;line-height:1.1}
.terra-player-portrait{box-sizing:border-box;width:51px;height:51px;display:grid;place-items:center;border:2px solid #5a9fb6;
 border-radius:3px;background:linear-gradient(145deg,#274957,#101c2b);color:#b2d9f1;
 font:800 16px Consolas,sans-serif;overflow:hidden;box-shadow:0 3px 10px #0009;transition:border-color .12s,box-shadow .12s,filter .12s}
.terra-player-portrait img{width:100%;height:100%;object-fit:cover}
.terra-player-label{font:600 9px/1.1 'Microsoft Yahei',sans-serif;max-width:52px;text-overflow:ellipsis;overflow:hidden}
.terra-player-team.red .terra-player-portrait{border-color:#bd6a72;background:linear-gradient(145deg,#65363c,#26151c);color:#ffd1d0}
.terra-player-avatar:hover .terra-player-portrait{filter:brightness(1.18)}
.terra-player-avatar.is-focused .terra-player-portrait{border-color:#e8faff;box-shadow:0 0 0 2px #d8ffff,0 0 18px #72c8ffcc}
.terra-player-team.red .terra-player-avatar.is-focused .terra-player-portrait{box-shadow:0 0 0 2px #ffe0d5,0 0 18px #f48f8fcc}
.terra-player-versus{color:#d7d3b8;font:800 16px Consolas,sans-serif;text-shadow:0 1px 10px #000;align-self:center;margin:0 4px 17px}

/* One seven-orb strip is reused. The observed king battlefield in preparation
   deliberately has no player-growth HUD; final defense exposes the matching team. */
.legion-game.mode-formal[data-observation-group="allies"] .rooted-bonds:not([hidden]),
.legion-game.mode-formal[data-observation-group="rivals"] .rooted-bonds:not([hidden]),
.legion-game.mode-formal[data-observation-group="pvp"] .rooted-bonds:not([hidden]){top:194px}
.legion-game.mode-formal[data-observation-group="allies"] .formal-field-tools,
.legion-game.mode-formal[data-observation-group="rivals"] .formal-field-tools,
.legion-game.mode-formal[data-observation-group="pvp"] .formal-field-tools{top:220px}
.legion-game.mode-formal[data-observation-group="pvp"] .formal-team-summary,
.legion-game.mode-formal[data-observation-group="allies"] .formal-team-summary,
.legion-game.mode-formal[data-observation-group="rivals"] .formal-team-summary{display:none}

/* A fast directional page turn when the observed commander changes. */
.rooted-bond-page-exit{position:absolute;left:0;right:0;top:0;z-index:5;display:flex;justify-content:center;pointer-events:none;
 animation:rootedBondPageExit 145ms cubic-bezier(.35,0,.7,.35) both}
.rooted-bond-page-exit .rooted-bond-strip{pointer-events:none}
.legion-game.mode-formal .rooted-bonds.is-page-entering>.rooted-bond-strip{
 animation:rootedBondPageEnter 145ms cubic-bezier(.16,.8,.3,1) both}
@keyframes rootedBondPageExit{to{opacity:0;transform:translateX(var(--rooted-exit-x, -26px))}}
@keyframes rootedBondPageEnter{from{opacity:0;transform:translateX(var(--rooted-enter-x, 26px))}to{opacity:1;transform:translateX(0)}}

/* Enemy theme is display-only; it never changes the source formulas. */
.legion-game.mode-formal[data-focused-team="red"] .rooted-bond.is-active .rooted-bond-orb{border-color:#e89490;background:radial-gradient(circle at 40% 25%,#b95f61,#632d3d 68%,#271821);box-shadow:inset 0 0 0 3px #381c26,0 0 15px #f6828888}
.legion-game.mode-formal[data-focused-team="red"] .rooted-bond.is-advanced .rooted-bond-orb{border-color:#eac78b;box-shadow:inset 0 0 0 3px #381c26,0 0 0 1px #e4bc7c,0 0 17px #f3d29c78}
.legion-game.mode-formal[data-focused-team="red"] .rooted-bond.is-active .rooted-bond-name{color:#ffd6d0}
.legion-game.mode-formal[data-focused-team="red"] .rooted-bond-detail{border-color:#c87b84}
.legion-game.mode-formal[data-focused-team="red"] .rooted-detail-head{background:linear-gradient(90deg,#582a34,#24232c)}
.legion-game.mode-formal[data-focused-team="red"] .rooted-detail-head>.rooted-icon{background:#65323e;border-color:#dc9b9a;color:#ffe8df}
.legion-game.mode-formal[data-focused-team="red"] .rooted-description-value,.legion-game.mode-formal[data-focused-team="red"] .rooted-live-number{color:#f5a5a1}

@media(max-width:850px){
 .legion-game.mode-formal .terra-player-observation:not([hidden]){top:101px;width:calc(100% - 95px);gap:3px}
 .terra-player-avatar{width:42px;min-width:42px}.terra-player-portrait{width:41px;height:41px;border-width:1px}
 .terra-player-label{font-size:8px;max-width:42px}.terra-player-team{gap:1px}
 .terra-player-versus{font-size:11px;margin:0 1px 12px}
 .legion-game.mode-formal[data-observation-group] .rooted-bonds:not([hidden]){top:159px}
 .legion-game.mode-formal[data-observation-group="none"] .rooted-bonds:not([hidden]){top:137px}
 .legion-game.mode-formal[data-observation-group="allies"] .formal-field-tools,
 .legion-game.mode-formal[data-observation-group="rivals"] .formal-field-tools,
 .legion-game.mode-formal[data-observation-group="pvp"] .formal-field-tools{top:147px}
}
@media(max-width:520px){
 .legion-game.mode-formal .terra-player-observation:not([hidden]){width:calc(100% - 14px);gap:2px}
 .terra-player-avatar{width:36px;min-width:36px}.terra-player-portrait{width:35px;height:35px}
 .terra-player-label{font-size:7px;max-width:36px}.terra-player-versus{font-size:9px;margin:0 1px 10px}
}
@media(prefers-reduced-motion:reduce){.rooted-bond-page-exit,.legion-game.mode-formal .rooted-bonds.is-page-entering>.rooted-bond-strip{animation:none!important}}

/* V1.6.6ac0 · Last-stand muster preview: the current wave's result is the
   ONLY source of color/unlock; a completed or teleported lane is not enough. */
.terra-player-avatar.is-defense-locked,
.terra-player-avatar.is-defense-locked .terra-player-portrait{
 filter:grayscale(1)!important;opacity:.53;cursor:not-allowed!important;
 box-shadow:none!important;transition:filter .2s ease,opacity .2s ease;
}
.terra-player-avatar.is-defense-locked:hover .terra-player-portrait{filter:grayscale(1)!important}
.terra-player-avatar:not(.is-defense-locked) .terra-player-portrait{transition:filter .2s ease,opacity .2s ease,box-shadow .12s ease,border-color .12s ease}
.legion-game.mode-formal[data-progression-grayscale="true"] .rooted-bond-strip,
.legion-game.mode-formal[data-progression-grayscale="true"] .rooted-bond-detail{
 filter:grayscale(1) saturate(0) brightness(.72);
}
/* One visible percentage applies to all seven of the observed seat's layers.
   It summarizes raw->effective totals, never a fabricated universal modifier. */
.terra-compression-rate{box-sizing:border-box;flex:0 0 auto;align-self:center;min-width:57px;
 padding:4px 5px;margin-right:4px;text-align:center;white-space:nowrap;
 color:#ff968f;background:linear-gradient(100deg,#372630,#241b24);
 border:1px solid #bb7579;border-radius:3px;text-shadow:0 0 8px #de7377bb;
 font:800 16px/1.35 Consolas,monospace;letter-spacing:-.5px;
}
.terra-compression-rate[hidden],.energy-interference[hidden]{display:none!important}
.terra-compression-rate-ghost{position:absolute;left:0;top:50%;z-index:7;pointer-events:none;
 animation:rootedBondPageExit 145ms ease-in both;transform:translateY(-50%)}
.terra-compression-rate.is-rate-entering{animation:rootedBondPageEnter 145ms ease-out both}
.energy-interference{box-sizing:border-box;position:absolute;z-index:35;pointer-events:none;
 top:195px;left:50%;transform:translateX(-50%);width:max-content;max-width:94vw;
 padding:6px 14px;border:1px solid #f09281;background:#341f2ff0;color:#f9bb95;
 box-shadow:0 0 25px #b7586477,inset 0 0 14px #893e5555;
 border-radius:3px;font:700 13px/1.3 'Microsoft YaHei',sans-serif;
 text-shadow:0 0 10px #d65762;letter-spacing:1px;
}
.legion-game.mode-formal[data-energy-interference="glitch"] .rooted-bond-strip{
 animation:terraEnergyGlitch .11s steps(2,end) infinite;filter:contrast(1.4) saturate(.35) hue-rotate(80deg);
}
.legion-game.mode-formal[data-energy-interference="glitch"] .rooted-bond-orb{
 border-color:#ef8b81!important;box-shadow:0 0 10px #eea18caa!important;
}
.legion-game.mode-formal[data-energy-interference="glitch"] .rooted-bond-layers{
 color:transparent!important;position:relative;
}
.legion-game.mode-formal[data-energy-interference="glitch"] .rooted-bond-layers::after{
 content:'?#!';position:absolute;left:0;right:0;top:0;color:#ffd1c6;
 animation:terraEnergyNoise .17s steps(3,end) infinite;
}
.legion-game.mode-formal[data-energy-interference="settled"] .rooted-bond-orb{
 border-color:#df928c;box-shadow:0 0 0 1px #9c5d62,0 0 13px #cc798977;
}
.legion-game.mode-formal[data-energy-interference="settled"] .rooted-bond-layers{color:#ffd6c4}
.legion-game.mode-formal[data-energy-interference="settled"] .rooted-bond-strip{
 filter:saturate(.7) sepia(.25);transition:filter .3s;
}
@keyframes terraEnergyGlitch{
 0%{transform:translateX(0);opacity:1}20%{transform:translateX(-4px);opacity:.68}
 45%{transform:translateX(3px);opacity:.96}70%{transform:translateX(-1px);opacity:.54}
 100%{transform:translateX(0);opacity:1}
}
@keyframes terraEnergyNoise{0%{content:'?#!'}33%{content:'%0?'}67%{content:'#!2'}100%{content:'??%'}}
.rooted-compression-info{margin:8px 13px;padding:8px 10px;display:flex;align-items:center;
 justify-content:space-between;gap:8px;flex-wrap:wrap;border:1px solid #be7878;
 color:#ffc2ba;background:#4e2b3266;font-size:12px}
.rooted-compression-info strong{color:#ffa394}
@media(max-width:850px){.terra-compression-rate{min-width:39px;font-size:11px;padding:2px 3px}}
@media(prefers-reduced-motion:reduce){.legion-game.mode-formal[data-energy-interference="glitch"] .rooted-bond-strip,
.legion-game.mode-formal[data-energy-interference="glitch"] .rooted-bond-layers::after{animation:none!important}}

/* Compressed state must not erase a golden advanced ring. */
.legion-game.mode-formal[data-energy-interference="settled"] .rooted-bond.is-advanced .rooted-bond-orb{
 border-color:#e8c180;box-shadow:inset 0 0 0 3px #412b2ce0,0 0 0 1px #dbb77a,0 0 17px #d8977a78;
}
