/* A single battle surface: formation, commands, then a separately readable log. */
body.battle-stage-open{overflow:hidden}
#battle-stage-dialog{position:fixed;inset:0;width:min(920px,calc(100vw - 16px));height:min(900px,calc(100vh - 16px));height:min(900px,calc(100dvh - 16px));max-width:none;max-height:none;margin:auto;padding:10px;border:1px solid var(--line,#cbdcd6);border-radius:14px;background:var(--panel,#f9fcfa);color:var(--ink,#2b3c34);overflow:hidden;box-shadow:0 16px 60px #18372c30;overscroll-behavior:contain}
#battle-stage-dialog::backdrop{background:#17352b66;backdrop-filter:blur(2px)}
#battle-stage-dialog .battle-stage{height:100%;min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) minmax(96px,23%);gap:7px;font-size:12px;line-height:1.4}
#battle-stage-dialog .battle-stage:has(>.stage-error){grid-template-rows:auto auto minmax(0,1fr) minmax(80px,22%)}
.battle-stage *{min-width:0;box-sizing:border-box}.battle-stage [hidden]{display:none!important}
.battle-stage h2,.battle-stage h3,.battle-stage p{margin:0}.battle-stage button{min-height:30px;padding:4px 7px;font-size:11px;line-height:1.3;border-radius:7px;white-space:normal;touch-action:manipulation}
.battle-stage button.with-icon{gap:3px}.battle-stage button .game-icon{width:13px;height:13px;flex-basis:13px}.battle-stage .text-action::before,.battle-stage .text-action::after{content:none}
.battle-stage button:focus-visible{outline:2px solid #ab8b4d;outline-offset:-2px}.battle-stage button[aria-pressed=true],.battle-stage button[aria-selected=true]{color:var(--green,#426f61);background:color-mix(in srgb,var(--green,#426f61) 10%,var(--panel,#fff));border-color:var(--green,#426f61)}
.battle-stage-header{display:flex;align-items:center;gap:8px;min-height:28px;padding:0 2px;border-bottom:1px solid var(--line);padding-bottom:6px}.battle-stage-header h2{font:600 15px/1.35 'Songti SC',SimSun,serif;letter-spacing:.4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.battle-stage-header .battle-state{margin-left:auto;font-size:11px;white-space:nowrap}.stage-error{padding:4px 8px;border-left:3px solid var(--red);background:color-mix(in srgb,var(--red) 8%,var(--panel));font-size:11px;color:var(--red)}
.battle-stage-body{display:grid;grid-template-rows:auto minmax(0,1fr);gap:7px;min-height:0}.battle-stage-field{min-height:0}.battle-stage .battle-field{border:1px solid var(--line);border-radius:10px;padding:6px;background:color-mix(in srgb,var(--green) 3%,var(--panel));display:grid;gap:5px;margin:0}.battle-stage .battle-field-side>header{display:flex;justify-content:space-between;align-items:center;margin-bottom:3px;font-size:10px;line-height:1.2;color:var(--muted)}.battle-stage .field-enemy>header>strong{color:var(--red)}.battle-stage .field-team>header>strong{color:var(--green)}
.battle-stage .battle-field-row{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.battle-stage .battle-field-row[data-field-count='1']{grid-template-columns:1fr}.battle-stage .battle-field-row[data-field-count='2']{grid-template-columns:repeat(2,minmax(0,1fr))}.battle-stage .battle-field-row[data-field-count='4']{grid-template-columns:repeat(4,minmax(0,1fr))}.battle-stage .battle-field-row[data-field-count='5']{grid-template-columns:repeat(5,minmax(0,1fr))}.battle-stage .field-single>.battle-field-unit{grid-column:auto}
.battle-stage .battle-field-unit{position:relative;padding:4px 5px;border:1px solid var(--line);border-radius:8px;background:var(--panel);min-height:0}.battle-stage .field-target,.battle-stage .field-unit-label{position:relative;display:flex;align-items:center;gap:4px;min-height:32px;width:100%;padding:11px 0 0;border:0;background:none;text-align:left;line-height:1.15}.battle-stage .field-target{border-radius:4px}.battle-stage .field-target[aria-pressed=true]{outline:1px solid var(--red);outline-offset:2px;color:var(--red);background:transparent}.battle-stage .field-position{position:absolute;top:0;left:0;font-size:9px;line-height:10px;color:var(--muted)}.battle-stage .field-unit-mark{display:grid;place-items:center;flex:0 0 18px;width:18px;height:18px;border:1px solid color-mix(in srgb,var(--red) 28%,var(--line));border-radius:50%;color:var(--red);font:11px/1 Georgia,serif}.battle-stage .field-unit-name{display:block;padding:0;min-height:0;font-size:12px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.battle-stage .hero-portrait{flex:0 0 23px;width:23px;height:27px;border-radius:4px;margin:0;object-fit:cover}.battle-stage .field-health{display:flex;align-items:baseline;gap:2px;font-size:11px;line-height:15px;font-variant-numeric:tabular-nums}.battle-stage .field-health small{font-size:9px;color:var(--muted)}.battle-stage .field-hp{height:4px;margin:1px 0 2px;accent-color:var(--green)}.battle-stage .field-enemy .field-hp{accent-color:var(--red)}.battle-stage .field-rage-line{display:flex;align-items:center;gap:4px;font-size:9px;color:var(--muted);line-height:11px}.battle-stage .field-rage-line>span{white-space:nowrap}.battle-stage .field-rage{flex:1;width:0;height:3px;margin:0;accent-color:#aa8f52}.battle-stage .field-status{display:block;font-size:9px;line-height:11px;min-height:11px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--muted)}.battle-stage .field-winding{border-color:var(--red);background:color-mix(in srgb,var(--red) 5%,var(--panel))}.battle-stage .field-winding .field-status{color:var(--red)}.battle-stage .field-down{opacity:.45}.battle-stage .field-troops{font-size:10px;line-height:1.2;margin:0;color:var(--muted)}
.stage-threat{display:flex;align-items:center;justify-content:space-between;gap:4px;margin-top:4px;padding:4px 7px;border-left:2px solid var(--green);background:color-mix(in srgb,var(--green) 5%,var(--panel));font-size:10px;line-height:1.25}.stage-threat strong{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.stage-threat>span{white-space:nowrap;font-variant-numeric:tabular-nums}.stage-threat.is-pending{border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 7%,var(--panel))}
.battle-stage-controls{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:5px;min-height:0}.stage-transport{display:flex;align-items:center;gap:5px}.stage-transport>.secondary:first-child{font-weight:600;color:var(--green)}.battle-stage .battle-speed{display:flex;align-items:center;gap:3px;margin-left:auto}.battle-stage .battle-speed button{min-width:32px;padding-inline:5px}.stage-transport>.text-action{padding:4px;color:var(--muted);min-width:30px}.stage-action-bar{display:flex;gap:5px;align-items:center}.stage-tabs{display:flex;flex:1;gap:4px}.stage-tabs button{flex:1;min-height:28px;border:0;border-bottom:2px solid transparent;border-radius:5px 5px 0 0;color:var(--muted);padding:3px}.battle-stage .stage-tabs button[aria-selected=true]{border-bottom-color:var(--green);font-weight:600}.stage-auto{font-size:10px!important;min-height:28px!important;min-width:62px}.battle-stage-action-panel{min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;overscroll-behavior:contain;padding:1px 1px 3px}.stage-skills{margin:0;padding:0}.stage-skill-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.stage-skill-grid[data-skill-count='1']{grid-template-columns:1fr}.stage-skill-grid[data-skill-count='2']{grid-template-columns:repeat(2,minmax(0,1fr))}.stage-hero-skills{min-width:0}.stage-hero-skills h3{display:flex;align-items:center;justify-content:space-between;gap:2px;font-size:11px;line-height:17px;padding:0 2px;color:var(--green)}.stage-hero-skills h3>span{font-size:9px;color:var(--muted);font-weight:400}.stage-skill{margin-top:3px}.stage-skill button{width:100%;min-height:29px;padding:4px;white-space:normal;font-size:11px}.stage-skill button:not(:disabled){color:var(--green);background:color-mix(in srgb,var(--green) 8%,var(--panel));border-color:color-mix(in srgb,var(--green) 40%,var(--line))}.stage-skill .game-icon{display:none}.stage-skill-state,.stage-skill-effect{display:block;margin:1px 2px 0;font-size:9px;line-height:12px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;color:var(--muted)}.stage-skill-effect{color:var(--ink)}
.stage-help{font-size:10px;line-height:1.4;color:var(--muted);margin:0 0 5px!important}.stage-medicine-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.stage-medicine-grid button{width:100%;font-size:10px;min-height:30px;padding:4px}.stage-medicine-grid small{display:block;font-size:9px;line-height:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.battle-stage .battle-orders{margin:0;padding:0}.battle-stage .battle-orders>.subhead{display:none}.battle-stage .battle-orders .note,.battle-stage .battle-orders .meta{font-size:10px;line-height:1.4;margin:3px 0}.battle-stage .battle-orders .actions{display:flex;gap:4px;margin:4px 0}.battle-stage .battle-orders button{min-height:28px;font-size:10px;padding:4px 6px}.battle-stage details{margin:5px 0;font-size:10px;line-height:1.4}.battle-stage details>summary{min-height:23px;padding:3px 0;font-size:10px}.stage-battle-details{border-top:1px solid var(--line);padding-top:3px}.stage-details p{margin:4px 0;font-size:11px;line-height:1.5}.stage-details h3,.stage-details h2{font-size:12px;line-height:1.4;margin:4px 0}.stage-details .subhead{font-size:11px;margin:4px 0}.stage-details .card,.stage-details section{padding:5px 0;margin:4px 0}.stage-details .note{font-size:10px;line-height:1.5}.stage-paused{padding:3px 6px;border-left:2px solid #ab8c54;color:var(--muted);font-size:10px;line-height:1.3}.stage-lesson-tip{font-size:10px;line-height:1.4;color:var(--green);margin-bottom:5px!important}.stage-lesson>.primary{margin-bottom:4px}.battle-stage.is-lesson .battle-stage-controls{grid-template-rows:auto minmax(0,1fr) auto}.battle-stage.is-lesson .stage-skill-grid{margin-top:3px}
.battle-stage-journal{display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0;border:1px solid var(--line);border-radius:9px;background:color-mix(in srgb,var(--green) 3%,var(--panel));overflow:hidden}.battle-stage-journal>header{display:flex;align-items:center;justify-content:space-between;gap:6px;border-bottom:1px solid var(--line);padding:4px 7px;color:var(--muted);font-size:10px;line-height:1.3}.battle-stage-journal h3{font-size:11px;font-weight:600;color:var(--green)}.battle-stage-journal>header>span{font-size:9px}.battle-stage-log{min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;padding:5px 8px;font-size:11px;line-height:1.6;overflow-wrap:anywhere}.battle-stage-log p{margin:0 0 4px;padding-left:7px;border-left:2px solid transparent}.battle-stage-log strong{font-weight:600;color:var(--green)}.battle-stage-log p.log-skill{border-left-color:#b19a65;background:color-mix(in srgb,#b19a65 6%,var(--panel));padding-block:2px}.battle-stage-log p.log-skill strong{color:#947137}.battle-launcher{padding:16px;border:1px solid var(--line);border-radius:10px;background:var(--panel)}.battle-launcher h1{font-size:20px;margin:0 0 8px}.battle-launcher p{font-size:12px;margin:0 0 12px}
@media(min-width:700px) and (min-height:580px){#battle-stage-dialog{width:min(920px,calc(100vw - 32px));height:min(820px,calc(100dvh - 32px));padding:15px}#battle-stage-dialog .battle-stage{grid-template-rows:auto minmax(0,1fr) minmax(140px,28%);gap:10px}.battle-stage-body{grid-template-rows:auto minmax(0,1fr);gap:10px}.battle-stage .battle-field{padding:9px;gap:8px}.battle-stage .battle-field-row{gap:8px}.battle-stage .battle-field-unit{padding:7px 9px}.battle-stage .field-unit-label,.battle-stage .field-target{min-height:43px;padding-top:12px}.battle-stage .hero-portrait{width:31px;height:36px;flex-basis:31px}.battle-stage .field-unit-name{font-size:14px}.battle-stage .field-health{font-size:13px;line-height:19px}.battle-stage .field-status{font-size:11px;line-height:14px}.battle-stage-header h2{font-size:19px}.battle-stage-header .battle-state{font-size:13px}.battle-stage button{min-height:34px;font-size:12px}.stage-skill-state,.stage-skill-effect{font-size:11px;line-height:16px}.stage-hero-skills h3{font-size:13px;line-height:22px}.battle-stage-log{font-size:13px;line-height:1.7}.stage-threat{font-size:12px;padding:6px 9px}}
@media(max-width:350px){#battle-stage-dialog{padding:7px;width:calc(100vw - 10px);height:calc(100dvh - 10px);border-radius:10px}#battle-stage-dialog .battle-stage{gap:5px;grid-template-rows:auto minmax(0,1fr) minmax(88px,21%)}.battle-stage-body{gap:5px}.battle-stage .battle-field{padding:4px;gap:4px}.battle-stage .battle-field-row{gap:4px}.battle-stage .battle-field-unit{padding:3px}.battle-stage .field-unit-name{font-size:11px}.battle-stage .field-target,.battle-stage .field-unit-label{gap:3px}.battle-stage .field-unit-mark{display:none}.battle-stage .field-unit-name{max-width:100%}.battle-stage .battle-field-row[data-field-count='5'] .field-unit-name{font-size:9px}.battle-stage .field-health{font-size:10px}.battle-stage .field-health small{font-size:8px}.battle-stage .field-rage-line,.battle-stage .field-status{font-size:8px;line-height:10px}.stage-threat{font-size:9px;padding:3px 5px}.battle-stage-controls{gap:4px}.battle-stage button{font-size:10px;min-height:28px}.stage-skill button{font-size:10px;padding:3px}.stage-hero-skills h3{font-size:10px}.stage-skill-state,.stage-skill-effect{font-size:8px;line-height:10px}.stage-paused{font-size:9px}.battle-stage-header h2{font-size:13px}.battle-stage-header .battle-state{font-size:10px}.battle-stage-log{font-size:10px;padding:4px 5px}.battle-stage .hero-portrait{width:18px;height:23px;flex-basis:18px}}
@media(max-height:480px) and (min-width:600px){#battle-stage-dialog{width:calc(100vw - 14px);height:calc(100dvh - 12px);padding:7px;border-radius:10px}#battle-stage-dialog .battle-stage{grid-template-rows:auto minmax(0,1fr) minmax(76px,25%);gap:5px}.battle-stage-body{grid-template-columns:minmax(0,.96fr) minmax(0,1.04fr);grid-template-rows:minmax(0,1fr);gap:9px}.battle-stage-field{align-self:start}.battle-stage .battle-field{padding:4px;gap:4px}.battle-stage .battle-field-unit{padding:3px 4px}.battle-stage .field-target,.battle-stage .field-unit-label{min-height:28px;padding-top:9px}.battle-stage .field-unit-name{font-size:10px}.battle-stage .field-unit-mark{width:14px;height:14px;flex-basis:14px;font-size:9px}.battle-stage .hero-portrait{width:20px;height:23px;flex-basis:20px}.battle-stage .field-health{font-size:10px;line-height:13px}.battle-stage .field-rage-line{font-size:8px;line-height:10px}.battle-stage .field-status{font-size:8px;line-height:10px;min-height:10px}.battle-stage .field-position{font-size:8px;line-height:9px}.battle-stage .field-health small{font-size:8px}.stage-threat{font-size:9px;margin-top:3px;padding:3px 5px}.battle-stage-header{padding-bottom:4px;min-height:22px}.battle-stage-header h2{font-size:13px}.battle-stage-header .battle-state{font-size:10px}.battle-stage-controls{gap:4px}.stage-skill-effect,.stage-skill-state{font-size:9px;line-height:11px}.stage-hero-skills h3{font-size:10px;line-height:15px}.stage-skill button{font-size:10px;min-height:25px;padding:3px}.battle-stage button{min-height:27px}.stage-paused{font-size:9px;padding:2px 5px}.battle-stage-journal>header{padding:3px 7px}.battle-stage-log{font-size:10px;line-height:1.4;padding:3px 7px}.battle-stage-log p{margin-bottom:3px}.stage-lesson-tip{font-size:9px}.stage-action-bar{gap:4px}.stage-auto{font-size:9px!important}}
@media(prefers-reduced-motion:reduce){.battle-stage *{animation:none!important;transition:none!important}}

.battle-stage-header>.text-action{flex:0 0 auto;min-height:24px;padding:2px 3px;font-size:10px;color:var(--muted)}.battle-stage-header>.text-action .game-icon{display:none}.stage-error{display:flex;align-items:center;gap:8px}.stage-error>span{flex:1}.stage-error button{min-height:24px;flex:0 0 auto;padding:3px 6px;font-size:10px}.battle-stage-journal>header>.text-action{min-height:20px;padding:1px 3px;font-size:9px;line-height:1}.battle-stage-journal>header>span{margin-left:auto}.battle-stage-journal>header>.text-action .game-icon{display:none}.battle-stage-log .log-attack{color:var(--muted)}

:root[data-theme=night] #battle-stage-dialog{box-shadow:0 18px 70px #0008}:root[data-theme=night] #battle-stage-dialog::backdrop{background:#08160fcc}:root[data-theme=night] .battle-stage-log p.log-skill strong{color:#dbc485}:root[data-theme=night] .battle-stage-log p.log-skill{background:#b19a6512}:root[data-theme=night] .battle-stage button[aria-selected=true]{color:#c7ddcf}:root[data-theme=night] .battle-stage .field-rage{accent-color:#c3a761}

#battle-stage-dialog .hero-portrait{overflow:hidden;float:none;aspect-ratio:auto}#battle-stage-dialog .hero-portrait>img{display:block;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:cover;object-position:center 20%}

@media(min-height:700px) and (max-width:699px){#battle-stage-dialog .battle-stage{grid-template-rows:auto minmax(0,1fr) minmax(200px,36%)}#battle-stage-dialog .battle-stage:has(>.stage-error){grid-template-rows:auto auto minmax(0,1fr) minmax(180px,34%)}}

/* Let the journal use spare height instead of stretching the skill area. */
#battle-stage-dialog .battle-stage{grid-template-rows:auto minmax(0,auto) minmax(80px,1fr)}#battle-stage-dialog .battle-stage:has(>.stage-error){grid-template-rows:auto auto minmax(0,auto) minmax(72px,1fr)}.battle-stage-body{grid-template-rows:auto minmax(0,auto)}.battle-stage-controls{grid-template-rows:auto auto minmax(0,auto) auto;align-content:start}.battle-stage-action-panel{max-height:clamp(96px,22dvh,210px)}.battle-stage.is-lesson .battle-stage-controls{grid-template-rows:auto minmax(0,auto) auto}.stage-paused{margin-top:1px!important}#battle-stage-title{outline:none}
@media(max-height:480px) and (min-width:600px){.battle-stage-body{grid-template-rows:minmax(0,auto)}.battle-stage-action-panel{max-height:clamp(70px,22dvh,110px)}}

/* Keep each action legible while its line is being read. No ticking clock or entry animation. */
.battle-stage-log{font-size:12px;line-height:1.75;padding:7px 9px}.battle-stage-log p{margin-bottom:6px;padding:3px 7px;border-radius:0 5px 5px 0}.battle-stage-log .log-attack{color:var(--ink)}.battle-stage-log p[data-current-log=true]{color:var(--ink);background:color-mix(in srgb,var(--green) 9%,var(--panel));border-left-color:var(--green);font-weight:500}.battle-stage-log p[data-current-log=true].log-skill{background:color-mix(in srgb,#b19a65 12%,var(--panel));border-left-color:#a68c4f}.battle-stage-journal.has-opening-effects{grid-template-rows:auto auto minmax(0,1fr)}.battle-stage .stage-opening-effects{margin:0;border-bottom:1px solid var(--line);padding:0 9px;color:var(--muted)}.battle-stage .stage-opening-effects>summary{min-height:24px;font-size:10px;padding:4px 0}.stage-opening-effects>div{max-height:90px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;font-size:11px;line-height:1.6;padding:0 0 5px}.stage-opening-effects p+p{margin-top:4px}.stage-opening-effects strong{color:var(--green);font-weight:500}
@media(min-width:700px) and (min-height:580px){.battle-stage-log{font-size:14px;line-height:1.8}.battle-stage .stage-opening-effects>summary{font-size:11px}}
@media(max-width:350px),(max-height:480px){.battle-stage-log{font-size:11px;line-height:1.65;padding:4px 6px}.battle-stage-log p{padding:2px 5px;margin-bottom:4px}.battle-stage .stage-opening-effects>summary{font-size:9px;min-height:21px;padding:3px 0}.stage-opening-effects>div{font-size:10px;max-height:62px}}
:root[data-theme=night] .battle-stage-log p[data-current-log=true]{background:#547e6426}:root[data-theme=night] .battle-stage-log p[data-current-log=true].log-skill{background:#b19a6520}

/* An expanded opening note shares the existing journal instead of pushing live actions off-screen. */
.battle-stage-journal.has-opening-effects:has(>.stage-opening-effects[open]){grid-template-rows:auto minmax(0,1fr) minmax(0,1.2fr)}.battle-stage .stage-opening-effects[open]{display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0;overflow:hidden}.battle-stage .stage-opening-effects[open]>div{min-height:0;max-height:none;overflow-y:auto;padding-bottom:2px}.battle-stage .stage-opening-effects>summary{flex:none}

/* Compact the formation and commands so the journal keeps the largest continuous reading area. */
.battle-stage .battle-field{padding:4px 5px;gap:4px;border-radius:8px}.battle-stage .battle-field-side>header{margin-bottom:2px;font-size:10px;line-height:12px}.battle-stage .battle-field-row{gap:4px}.battle-stage .battle-field-unit{padding:3px 4px;border-radius:6px}.battle-stage .field-target,.battle-stage .field-unit-label{min-height:25px;padding:0;gap:3px;line-height:1.15}.battle-stage .field-position{position:static;flex:0 0 auto;font-size:9px;line-height:11px}.battle-stage .field-unit-mark{flex-basis:14px;width:14px;height:14px;font-size:9px}.battle-stage .field-unit-name{font-size:12px;line-height:1.2}.battle-stage .hero-portrait{flex-basis:19px;width:19px;height:23px}.battle-stage .field-health{font-size:11px;line-height:13px}.battle-stage .field-health small{font-size:9px}.battle-stage .field-hp{display:block;width:100%;height:3px;margin:1px 0}.battle-stage .field-rage-line{font-size:9px;line-height:10px;gap:3px}.battle-stage .field-rage{height:3px}.battle-stage .field-status{font-size:9px;line-height:11px;min-height:11px}.battle-stage .field-status[aria-label$="状态：无"]{display:block}.battle-stage .field-troops{font-size:10px;line-height:12px}.stage-threat{margin-top:3px;padding:3px 6px;line-height:14px}.battle-stage-body{gap:5px}.battle-stage-controls{gap:4px}.stage-transport{gap:4px}.stage-transport button{min-height:28px}.stage-action-bar{gap:4px}.stage-tabs button{min-height:25px}.stage-auto{min-height:25px!important}.stage-skill-grid{gap:5px}.stage-hero-skills h3{font-size:11px;line-height:15px}.stage-skill{margin-top:2px}.stage-skill button{min-height:26px;padding:3px 4px;font-size:11px}.stage-skill-state{font-size:9px;line-height:11px;margin:1px 1px 0}.stage-skill-effect.sr-only{margin:0;padding:0}.battle-stage-action-panel{max-height:clamp(90px,18dvh,160px);padding:0 1px 1px}.stage-paused{font-size:10px;line-height:13px;padding:2px 5px}.stage-tutorial-note{display:flex;align-items:center;gap:5px;margin-bottom:4px;padding:2px 0;color:var(--green)}.stage-tutorial-note>p{flex:1;font-size:10px;line-height:1.4}.stage-tutorial-note>button{flex:0 0 auto;max-width:105px;min-height:26px;font-size:10px;padding:3px 5px}.stage-tutorial-note .game-icon{display:none}.battle-stage .battle-field-row[data-field-count="5"] .field-target{padding-top:10px}.battle-stage .battle-field-row[data-field-count="5"] .field-position{position:absolute;top:0;left:0}.battle-stage .battle-field-row[data-field-count="5"] .field-unit-mark{display:none}
@media(min-width:700px) and (min-height:580px){.battle-stage .battle-field{padding:6px 8px;gap:5px}.battle-stage .field-target,.battle-stage .field-unit-label{min-height:29px}.battle-stage .hero-portrait{flex-basis:23px;width:23px;height:27px}.battle-stage .field-unit-name{font-size:13px}.battle-stage .field-health{font-size:12px;line-height:15px}.battle-stage .field-status{font-size:10px;line-height:12px}.stage-hero-skills h3{font-size:12px;line-height:18px}.stage-skill-state{font-size:10px;line-height:13px}.stage-skill button{min-height:29px;font-size:12px}}
@media(max-width:350px){.battle-stage .battle-field{padding:3px 4px;gap:3px}.battle-stage .battle-field-row{gap:3px}.battle-stage .battle-field-unit{padding:2px 3px}.battle-stage .field-target,.battle-stage .field-unit-label{min-height:24px;gap:2px}.battle-stage .field-position{font-size:8px;line-height:10px}.battle-stage .field-unit-name{font-size:11px}.battle-stage .hero-portrait{flex-basis:18px;width:18px;height:22px}.battle-stage .field-health{font-size:10px;line-height:12px}.battle-stage .field-health small{font-size:8px}.battle-stage .field-rage-line{font-size:8px;line-height:10px}.battle-stage .field-status{font-size:8px;line-height:10px;min-height:10px}.stage-hero-skills h3{font-size:10px;line-height:14px}.stage-skill button{min-height:25px;font-size:10px;padding:3px}.stage-skill-state{font-size:8px;line-height:10px}.stage-tutorial-note>p{font-size:9px}.stage-tutorial-note>button{font-size:9px;max-width:94px}.stage-paused{font-size:9px;line-height:12px}.battle-stage-action-panel{max-height:120px}}
@media(max-height:480px) and (min-width:600px){.battle-stage .battle-field-unit{padding:2px 3px}.battle-stage .field-target,.battle-stage .field-unit-label{min-height:22px;gap:3px}.battle-stage .hero-portrait{flex-basis:17px;width:17px;height:21px}.battle-stage .field-unit-name{font-size:11px}.battle-stage .field-position{font-size:8px}.battle-stage .field-health{font-size:10px;line-height:12px}.battle-stage .field-status{font-size:9px;line-height:10px;min-height:10px}.stage-hero-skills h3{font-size:10px;line-height:14px}.stage-skill button{min-height:24px;font-size:10px;padding:2px 3px}.stage-skill-state{font-size:9px;line-height:10px}.battle-stage-action-panel{max-height:100px}.stage-tutorial-note>p{font-size:9px}.stage-tutorial-note>button{font-size:9px;min-height:24px}}

/* Compact visible skill purposes supplement the complete accessible descriptions. */
.stage-skill-summary{display:block;margin:1px 1px 0;font-size:9px;line-height:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink)}
.battle-stage-log p.log-combo{border-left-color:#aa7d35;background:color-mix(in srgb,#b7954c 12%,var(--panel));font-weight:500}.battle-stage-log p.log-combo strong{color:#947137}.battle-stage-log p[data-current-log=true].log-combo{background:color-mix(in srgb,#b7954c 19%,var(--panel));border-left-width:3px}
@media(min-width:700px) and (min-height:580px){.stage-skill-summary{font-size:10px;line-height:13px}}
@media(max-width:350px){.stage-skill-summary{font-size:8px;line-height:10px}}
:root[data-theme=night] .battle-stage-log p.log-combo{background:#b7954c20}:root[data-theme=night] .battle-stage-log p.log-combo strong{color:#e1c37e}

/* Opportunity cues reuse the single threat strip; they do not add another battlefield panel. */
.stage-skill.has-opportunity button:not(:disabled){border-color:#ad873e;background:color-mix(in srgb,#b7954c 15%,var(--panel));color:#806024}.stage-skill.has-opportunity .stage-skill-state{color:#947137;font-weight:600}.stage-tactical-window.is-open{border-color:#ad873e;background:color-mix(in srgb,#b7954c 12%,var(--panel));color:#806024}.stage-tactical-window>strong{flex:0 0 auto}.stage-tactical-window>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}
:root[data-theme=night] .stage-skill.has-opportunity button:not(:disabled),:root[data-theme=night] .stage-skill.has-opportunity .stage-skill-state,:root[data-theme=night] .stage-tactical-window.is-open{color:#e1c37e}

/* The legacy inline speed selector has 10px vertical margins; the modal owns this row. */
.battle-stage .battle-speed{margin-block:0;flex-wrap:nowrap}

/* Reserve one status line, and keep long skill names from consuming the live journal. */
@media(max-width:350px){.battle-stage .stage-skill button>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}

@media(max-width:350px){.stage-hero-skills h3{line-height:12px}.stage-skill{margin-top:1px}.stage-skill-summary,.stage-skill-state{line-height:9px;margin-top:0}}
/* New combat reads a separate structured cooperation lane; character cards keep their compact height. */
.v12-cooperation{margin-top:4px;padding:4px 6px;border:1px solid var(--line);border-radius:7px;background:color-mix(in srgb,var(--green) 4%,var(--panel));font-size:10px;line-height:1.3;max-height:92px;overflow:auto;scrollbar-width:thin}.v12-cooperation>header{display:flex;align-items:center;gap:6px;color:var(--green);font-size:10px}.v12-cooperation>header>span{font-size:9px;color:var(--muted)}.v12-cooperation-row{display:grid;grid-template-columns:minmax(36px,auto) minmax(0,1fr);gap:5px;align-items:center;margin-top:3px}.v12-cooperation-row>strong{font-size:9px;font-weight:500;white-space:nowrap}.v12-cooperation-row>div{display:flex;gap:3px;flex-wrap:wrap}.v12-state-chip{display:inline-block;padding:1px 4px;border-radius:4px;background:color-mix(in srgb,#b59654 12%,var(--panel));border:1px solid color-mix(in srgb,#b59654 24%,var(--line));font-size:9px;line-height:1.25;color:var(--ink);white-space:nowrap}.v12-objective{padding:5px 6px!important;border:1px solid var(--line);border-radius:7px}.v12-objective>header{display:flex;justify-content:space-between;gap:5px;font-size:11px}.v12-objective>progress{display:block;width:100%;height:5px;margin:4px 0;accent-color:var(--green)}.v12-objective>p,.v12-work-progress{font-size:10px;line-height:1.4}.v12-work-controls{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px}.v12-finite{padding-left:16px;margin:3px 0}.v12-finite>li{font-size:10px;line-height:1.5}.v12-links p,.v12-auto-reason p{font-size:10px!important;line-height:1.4!important}.v12-receipt{display:flex;flex-wrap:wrap;gap:5px;margin:6px 0}.v12-receipt>span{padding:3px 6px;border:1px solid var(--line);border-radius:5px;font-size:11px}.v12-objective.is-complete{opacity:.8}
@media(max-width:350px){.v12-cooperation{padding:3px 4px;max-height:75px;font-size:9px}.v12-cooperation>header{font-size:9px}.v12-cooperation>header>span,.v12-cooperation-row>strong,.v12-state-chip{font-size:8px}.v12-state-chip{padding:1px 3px}.v12-cooperation-row{gap:3px;margin-top:2px}.v12-work-controls button{min-height:28px}.v12-objective>p{font-size:9px}}
@media(max-height:480px) and (min-width:600px){.v12-cooperation{max-height:70px;font-size:9px}.v12-cooperation-row{margin-top:2px}.v12-state-chip{font-size:8px}}
.v12-objective-compact{display:flex;justify-content:space-between;align-items:center;gap:6px;margin-top:4px;padding:4px 6px;border-left:2px solid #ad9257;background:color-mix(in srgb,#ad9257 8%,var(--panel));font-size:10px;line-height:1.3}.v12-objective-compact>strong{font-weight:600;white-space:nowrap}.v12-objective-compact>span{font-size:9px;color:var(--muted);text-align:right}.battle-stage.is-v12 .battle-stage-field{max-height:44dvh;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;overscroll-behavior:contain}@media(min-width:700px) and (min-height:580px){.battle-stage.is-v12 .battle-stage-field{max-height:350px}}@media(max-height:480px) and (min-width:600px){.battle-stage.is-v12 .battle-stage-field{max-height:48dvh}}

.battle-stage.is-v12 .battle-field-row[data-field-count="4"] .field-target{padding-top:10px}.battle-stage.is-v12 .battle-field-row[data-field-count="4"] .field-position{position:absolute;top:0;left:0}.battle-stage.is-v12 .battle-field-row[data-field-count="4"] .field-unit-mark{display:none}

.combat-loadout{padding:9px;border:1px solid var(--line);border-radius:8px;margin:0 0 10px}.combat-loadout-options{display:grid;gap:6px}.combat-loadout-options button{width:100%;white-space:normal;text-align:left}.combat-loadout-options .note{font-size:11px;margin:2px 0 4px}
