/* Public battle instruments and a recorder that opens over the scene. */
#app:has(.battle-history-sheet),.battle-root:has(.battle-history-sheet),.battle-view:has(.battle-history-sheet){isolation:auto}
.battle-enemy-header{min-height:124px;flex-shrink:0}
.battle-enemy-header>.battle-commander{z-index:1;width:min(calc(100% - 112px),300px)}
.battle-enemy-name{text-shadow:0 1px 4px #020b12,0 1px 9px #020b12}
.enemy-console .commander-console-identity>p+p{max-width:32ch;margin-top:10px}
.enemy-hand-count{position:absolute;z-index:0;left:50%;top:57px;transform:translateX(-50%);width:min(60%,230px);height:63px;display:block;pointer-events:none;user-select:none}
.enemy-hand-fan{position:absolute;inset:0}
.enemy-hand-card{position:absolute;left:calc(50% + var(--enemy-delta)*22px);top:calc(11px - var(--enemy-distance)*3px);width:34px;height:49px;transform:translateX(-50%) rotate(calc(var(--enemy-delta)*-8deg));transform-origin:50% 50%;filter:drop-shadow(0 4px 7px #0009)}


.enemy-piles{position:absolute;inset:0;pointer-events:none}
.enemy-pile{position:absolute;left:0;top:2px;pointer-events:auto}
.enemy-pile .battle-icon,.battle-piles .run-pile .battle-icon{width:20px;height:20px}
.enemy-instruments{left:calc(50% + 46px);right:auto;top:30px;width:auto;max-width:45px;pointer-events:none}
.enemy-matter{justify-content:flex-start;gap:3px}
.enemy-matter i{border:0;border-radius:50%;background:#e9c8752e;box-shadow:inset 0 0 0 1px #f1d16d33}
.enemy-matter i.is-filled{background:linear-gradient(135deg,#fff0ad,#f1d16d 65%,#b58b2c);box-shadow:0 0 5px #f1d16d22}
.enemy-draw-stack{position:absolute;top:5px;right:0;width:55px;height:70px;isolation:isolate}
.enemy-draw-stack .run-deck-stack{top:0;right:4px;width:39px;height:58px;transform:rotate(-13deg)}

.enemy-draw-stack .run-deck-count{left:auto;right:0;top:37px;min-width:22px;width:auto;height:22px;padding-inline:3px;font-size:12px}
.battle-history-open{position:absolute;z-index:8;right:0;top:44dvh;translate:0 -50%;display:grid;place-items:center;width:40px;height:44px;padding:0;border:1px solid var(--battle-line);border-right:0;background:#07141d88;backdrop-filter:blur(8px);color:#c7dce1}
.battle-history-open .battle-icon{width:21px;height:21px}
.battle-history-open:hover{color:#f2dfb1;background:#d6e8e51c}
.battle-root .battle-history-open:focus-visible{outline-offset:-3px}
.battle-history-cancel{top:calc(44dvh + 25px);right:0;z-index:8}
@media(min-width:600px){
 .battle-enemy-header{min-height:138px}
 .enemy-hand-count{top:64px;height:73px}
 .enemy-hand-card{width:41px;height:59px;left:calc(50% + var(--enemy-delta)*26px)}
 .enemy-draw-stack{right:3px;width:62px;height:82px}
 .enemy-draw-stack .run-deck-stack{width:46px;height:67px}
 .enemy-draw-stack .run-deck-count{top:43px}
}
@media(max-width:599px){.battle-field{padding-inline-end:24px}}
@media(max-height:760px) and (max-width:599px){
 .battle-enemy-header{min-height:111px}
 .enemy-hand-count{top:48px;height:61px}
 .enemy-hand-card{height:46px;width:32px;left:calc(50% + var(--enemy-delta)*20px)}
}
.battle-history-layer{position:fixed;inset:0;z-index:230;isolation:isolate;color:#e7eadf;font-family:var(--font-ui,sans-serif)}
.battle-history-scrim{position:absolute;inset:0;background:#020c1466;backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
.battle-history-sheet{position:absolute;right:0;top:0;bottom:0;width:min(440px,96vw);display:flex;flex-direction:column;background:linear-gradient(140deg,#173340f5,#07151efc);border-left:1px solid #b8dae346;box-shadow:-20px 0 70px #0007;padding:max(18px,env(safe-area-inset-top)) 0 max(12px,env(safe-area-inset-bottom));animation:history-enter .16s cubic-bezier(.2,.7,.2,1);overflow:hidden;overscroll-behavior:contain}
.history-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 20px 18px;flex-shrink:0}
.history-heading h2{font:400 23px/1.2 var(--font-display,sans-serif);margin:6px 0 0;color:#f3e9cb}
.history-heading .icon-button{flex-shrink:0;width:42px;height:42px;border:1px solid #a8ccd52e;border-radius:0;background:#06131d66;color:#e5e8db;display:grid;place-items:center}
.history-battles{display:flex;gap:6px;padding:0 18px 12px;overflow-x:auto;flex-shrink:0;scrollbar-width:thin}
.history-battles button{min-width:115px;max-width:165px;flex-shrink:0;text-align:left;padding:9px 11px;border:1px solid #abc9ce30;background:#091b25a3;color:#becdd0;font:500 11px/1.2 var(--font-ui,sans-serif)}
.history-battles button small{display:block;font-size:9px;margin-top:5px;color:#b2c0b4}.history-battles .is-current{border-color:#e5d29a;color:#fff0bf}
.history-opponent{display:flex;justify-content:space-between;gap:12px;padding:9px 20px 12px;border-bottom:1px solid #a8c9d026;font-size:12px;flex-shrink:0}
.history-opponent small{color:#9eb9c2;font-size:10px;align-self:center;white-space:nowrap}
.history-timeline{padding:0 18px 28px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;flex:1;min-height:0;outline-offset:-3px}
.history-turn{margin-top:19px}.history-turn h3{display:flex;align-items:center;justify-content:space-between;gap:14px;font-size:10px;color:#afccd8;margin:0 0 10px;border-bottom:1px solid #8eb5c326;padding-bottom:8px}
.history-turn h3 span{font-weight:500;text-transform:uppercase;letter-spacing:.1em}.history-turn h3 b{font-weight:500;max-width:70%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#dfd6b9}
.history-turn ol,.history-effects{list-style:none;padding:0;margin:0}
.history-entry{position:relative;padding:9px 0 13px 23px;border-left:1px solid #8bb6c32e;margin-left:4px}
.history-order{position:absolute;left:-9px;top:21px;display:grid;place-items:center;width:17px;height:17px;border:1px solid #7193a348;background:#102733;color:#b7c9cb;font-size:8px;font-variant-numeric:tabular-nums}
.history-card{display:flex;width:100%;gap:12px;align-items:center;background:none;border:0;padding:0;text-align:left;color:#f0e7cc;font-family:var(--font-ui,sans-serif)}
.history-entry-actions{display:flex;align-items:center;gap:8px}
.history-locate{flex:0 0 44px;height:44px;display:grid;place-items:center;border:1px solid #6eafca4a;background:#122936;color:#b8e8fb}
.history-locate:is(:hover,:focus-visible){color:#fff;border-color:#a5ddf4;background:#234457}
.history-locate .icon{width:18px;height:18px}
.is-recorder-located{outline:2px solid #aae8ff!important;outline-offset:4px}
.history-card img{width:44px;height:58px;flex-shrink:0;object-fit:cover;border:1px solid #a5c3cb;border-radius:3px}
.history-card>span{min-width:0}.history-card strong{display:block;font-weight:600;font-size:16px;line-height:1.25}.history-card small{display:block;margin-top:5px;color:#b2c7cc;font-size:12px;line-height:1.45}.history-card i{font-style:normal;padding:0 3px;color:#e0cc94}
.history-effects{margin:9px 0 0 56px;color:#b5cbd2;font-size:13px;line-height:1.5}.history-effects li+li{margin-top:4px}.history-effect.is-silence{color:#e5d7ae}.history-effect.is-death{color:#edafb2}.history-effect.is-exhaust,.history-effect.is-evaporate{color:#c8b8d4}
.history-card-preview{width:min(100%,228px);margin:16px auto 2px}.history-notice,.history-empty{font-size:12px;line-height:1.5;color:#b9cbd1;margin:20px 4px}
.history-notice{color:#d8cba6}.history-empty{text-align:center;padding-top:30px}
@keyframes history-enter{from{transform:translateX(24px);opacity:0}to{transform:translateX(0);opacity:1}}
@media(prefers-reduced-motion:reduce){.battle-history-sheet{animation:none}}
.reduce-motion .battle-history-sheet{animation:none}
