/* V1.4.6 — Fixed purchase-category rail, independent slide-in content sheet.
   View-only layer around the existing purchases: no new rolls, fake items or currencies. */
.legion-game.mode-formal .formal-toolbar{z-index:65!important}
.legion-game.mode-formal .formal-old-shop{display:none!important}
.legion-game.mode-formal .formal-shop-rail{
 position:fixed;right:12px;bottom:18px;z-index:66;width:84px;display:flex;flex-direction:column;
 gap:10px;align-items:stretch;pointer-events:auto;font-family:'Microsoft Yahei',sans-serif;
}
.legion-game:not(.mode-formal) .formal-shop-rail{display:none!important}
.legion-game.mode-formal .formal-shop-rail button{cursor:pointer;color:#d5ece8;border:1px solid #577c80;
 background:linear-gradient(135deg,#234149ed,#101e27f7);font:700 11px 'Microsoft Yahei',sans-serif;
 padding:6px 3px;min-height:49px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;
 box-shadow:0 4px 14px #0008}
.legion-game.mode-formal .formal-shop-rail button>span{font-size:17px;line-height:22px;color:#a8dcd5}
.legion-game.mode-formal .formal-shop-rail button:hover:not(:disabled){border-color:#9ee6d4;background:#345b59}
.legion-game.mode-formal .formal-shop-rail button.active{border-color:#bdeddb;background:#285b53;box-shadow:inset 3px 0 #a0f6d6,0 0 14px #5ec9a73b}
.legion-game.mode-formal .formal-shop-rail button:disabled{opacity:.34;cursor:not-allowed}
.legion-game.mode-formal .formal-shop-rail .formal-ready-main{min-height:62px;background:#195a50;border-color:#95d9c2;color:#e8fff5;letter-spacing:1px}
.legion-game.mode-formal .formal-shop-rail .formal-ready-main:disabled{filter:grayscale(.7);opacity:.6}
.legion-game.mode-formal .formal-shop-rail .formal-ready-main[hidden]{display:none!important}
.legion-game.mode-formal .formal-shop-rail-tabs{display:flex;flex-direction:column;gap:5px;padding:7px;background:#0b1b24d9;border:1px solid #4b7179}
/* Never obstruct the launcher: it remains clickable while a sheet is open. */
.legion-game.mode-formal .room-main .formal-drawer-shade{z-index:48;top:var(--terra-toolbar-height,56px);bottom:0;backdrop-filter:blur(1px);background:#030c1284}
.legion-game.mode-formal .room-main .panel.buy-panel{
 display:block!important;z-index:54;position:fixed!important;
 top:var(--terra-toolbar-height,56px)!important;bottom:0!important;right:104px!important;left:auto!important;
 width:clamp(310px,29vw,445px)!important;max-width:calc(100vw - 112px)!important;
 height:auto!important;min-height:0!important;max-height:none!important;
 overflow-y:auto!important;overscroll-behavior:contain;padding:0 17px 26px!important;
 border-left:1px solid #78a69e!important;border-right:1px solid #44666e!important;
 background:linear-gradient(140deg,#24363bfa,#101e26fc 75%)!important;
 box-shadow:-16px 0 30px #000c!important;
 opacity:0;transform:translateX(calc(100% + 112px));
 pointer-events:none;visibility:hidden;
 transition:transform 210ms cubic-bezier(.2,.8,.25,1),opacity 160ms ease,visibility 0s linear 220ms;
}
.legion-game.mode-formal:is([data-formal-drawer="recruit"],[data-formal-drawer="dispatch"],[data-formal-drawer="upgrade"],[data-formal-drawer="settings"]) .room-main .panel.buy-panel{
 opacity:1;transform:translateX(0);pointer-events:auto;visibility:visible;transition:transform 210ms cubic-bezier(.2,.8,.25,1),opacity 160ms ease;
}
.legion-game.mode-formal .room-main .panel.buy-panel.shop-appearing{animation:terra-shop-category 185ms cubic-bezier(.2,.9,.25,1)}
@keyframes terra-shop-category{from{opacity:.4;translate:48px 0}to{opacity:1;translate:0 0}}
.legion-game.mode-formal .room-main .panel.watch-panel{z-index:54;top:var(--terra-toolbar-height,56px)}
.legion-game.mode-formal .buy-group[data-buy-group="recruit"] #shop-upgrade-intro{display:none}
.legion-game.mode-formal[data-formal-drawer="upgrade"] .buy-group[data-buy-group="recruit"]{display:block}
.legion-game.mode-formal[data-formal-drawer="upgrade"] .buy-group[data-buy-group="recruit"] > :not(#shop-upgrade-intro):not(#upgrade-cap):not(#shop-upgrade){display:none!important}
.legion-game.mode-formal[data-formal-drawer="upgrade"] .buy-group[data-buy-group="recruit"] #shop-upgrade-intro{display:block!important;margin-top:16px}
.legion-game.mode-formal[data-formal-drawer="recruit"] .buy-group[data-buy-group="recruit"] #upgrade-cap,.legion-game.mode-formal[data-formal-drawer="recruit"] .buy-group[data-buy-group="recruit"] #shop-upgrade{display:none!important}
.legion-game.mode-formal .formal-shop-rail~.buy-panel .formal-drawer-head{z-index:3;top:0;padding:15px 0 12px;margin:0 0 14px;position:sticky;background:#23373e}
.legion-game.mode-formal .room-main .panel.buy-panel .roster{overflow-y:visible}
.legion-game.mode-formal .room-main .panel.buy-panel .recruit{min-height:62px}
/* Preserve the actual classic controls in debug, but in formal there is only
   one readiness action and the panel never asks to begin a second time. */
.legion-game.mode-formal .formal-board-actions{display:none!important}
.legion-game.mode-formal .buy-group .command-actions{display:none!important}
.legion-game.mode-formal #upgrade-cap{display:block;margin-top:16px;width:100%;min-height:44px}
.legion-game.mode-formal .formal-shop-rail button:focus-visible,.legion-game.mode-formal .formal-close:focus-visible{outline:2px solid #a7f5d7;outline-offset:2px}
@media(max-width:920px){
 .legion-game.mode-formal .formal-shop-rail{width:64px;right:5px;bottom:8px}
 .legion-game.mode-formal .formal-shop-rail button{font-size:9px;min-height:42px}
 .legion-game.mode-formal .formal-shop-rail .formal-ready-main{min-height:48px}
 .legion-game.mode-formal .room-main .panel.buy-panel{right:75px!important;max-width:calc(100vw - 81px)!important;width:min(385px,60vw)!important}
}
@media(max-height:700px){
 .legion-game.mode-formal .formal-shop-rail-tabs{gap:2px;padding:4px}
 .legion-game.mode-formal .formal-shop-rail button{min-height:37px;padding:3px 2px}
 .legion-game.mode-formal .formal-shop-rail .formal-ready-main{min-height:45px}
}
@media(prefers-reduced-motion:reduce){.legion-game.mode-formal .room-main .panel.buy-panel{transition:none!important}.legion-game.mode-formal .panel.buy-panel.shop-appearing{animation:none!important}}

/* Eight full-size display slots, without sideways expansion of the whole stage. */
.legion-game.mode-formal .world-reserve-actor{width:5.6%;max-width:81px}

.legion-game.mode-formal .shop-roll-actions{display:flex;gap:8px;margin:12px 0 10px}
.legion-game.mode-formal .shop-roll-actions button{flex:1;min-height:32px;border:1px solid #455d63;background:#14262d;color:#a5bbc0;opacity:.55;cursor:not-allowed;font-size:11px}
