:root {
  color-scheme: dark;
  --chrome: #202820;
  --chrome-2: #293329;
  --chrome-3: #343d32;
  --line: #566048;
  --ink: #f4f0df;
  --muted: #b8bdab;
  --gold: #efbd63;
  --green: #8fc873;
  --red: #e9a175;
  --field-line: #66543d;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #171d18; color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid #ffdc8e; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-shell { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 20px; min-height: 62px; padding: 8px 18px; background: linear-gradient(#303b2f,#202820); border-bottom: 1px solid #495344; box-shadow: 0 3px 12px #10180f88; z-index: 4; }
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; min-width: 224px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--gold); border-radius: 6px; background: #434a30; color: #ffdb7c; font-size: 24px; transform: rotate(-5deg); box-shadow: inset 0 2px #ffffff24, 0 2px #111a14; }
.brand-overline { display: block; color: var(--gold); font-size: 9px; letter-spacing: .26em; font-weight: 800; line-height: 1.2; }
.brand strong { display: block; margin-top: 2px; font-size: 15px; font-weight: 900; letter-spacing: .04em; white-space: nowrap; }
.plan-name-wrap { min-width: 130px; width: min(24vw, 310px); margin-left: auto; }
.plan-name { width: 100%; height: 38px; padding: 0 12px; background: #141c15; border: 1px solid #4b5648; border-radius: 5px; color: var(--ink); font-weight: 650; text-overflow: ellipsis; }
.plan-name:hover { border-color: #7b8a69; }
.top-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid #65705a; border-radius: 5px; color: var(--ink); background: linear-gradient(#485445,#303a30); font-weight: 750; white-space: nowrap; box-shadow: inset 0 1px #ffffff1b, 0 2px #121914; }
.button:hover { filter: brightness(1.13); }
.button:active { transform: translateY(1px); box-shadow: inset 0 1px #121914; }
.button-quiet { background: #313b31; color: #eeeeda; }
.button-primary { background: linear-gradient(#4b8d2c,#276518); border-color: #80c95f; color: #fff; text-shadow: 0 1px #194813; }
.button-remove { border-color: #a45e47; background: #59342c; color: #ffe4d8; }
.workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.battle-column { position: relative; display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; background: #182019; }
.editor-options { position: absolute; top: 0; left: 0; right: 0; z-index: 6; box-shadow: 0 15px 28px #141b13c9; }
.modebar { min-height: 78px; padding: 13px 22px; display: flex; justify-content: space-between; align-items: center; gap: 22px; background: #293329; border-bottom: 1px solid #4d5946; }
.modebar-title { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.eyebrow { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.modebar-title strong { font-size: 18px; letter-spacing: -.02em; }
.background-control { display: flex; flex-direction: column; gap: 4px; min-width: 138px; margin-left: auto; color: var(--gold); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.background-control select { width: 100%; height: 35px; padding: 0 7px; border: 1px solid #68765e; border-radius: 4px; background: #364135; color: #f4f0df; font-size: 12px; font-weight: 750; letter-spacing: 0; text-transform: none; }
.mode-tabs { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.mode-tabs button { min-width: 91px; min-height: 48px; padding: 4px 10px; border: 1px solid #53614f; border-radius: 4px; color: #d7deca; background: #364135; font-weight: 800; line-height: 1.1; }
.mode-tabs button span { display: block; margin-top: 2px; font-size: 10px; font-weight: 600; color: #adb9a2; }
.mode-tabs button:hover { border-color: #9bac81; }
.mode-tabs button.is-active { color: #fff9e7; background: #6c743e; border-color: #d3b66c; box-shadow: inset 0 0 0 1px #e6d49255, 0 2px 0 #171e17; }
.mode-tabs button.is-active span { color: #e6e1b8; }
.formation-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 7px 18px; border-bottom: 1px solid #4d5946; background: #263126; }
.view-switch, .wave-controls { display: flex; align-items: center; gap: 5px; }
.view-switch button, .wave-controls button, .wave-controls select, .library-button { min-height: 32px; padding: 5px 9px; border: 1px solid #5c6b54; border-radius: 4px; background: #344133; color: #e6ead9; font-size: 11px; font-weight: 750; white-space: nowrap; }
.library-button { border-color: #a18a55; color: #ffe3a6; }
.library-button:hover { background: #4a5438; }
.view-switch button.is-active { background: #6b7540; border-color: #d1bb72; color: #fff9e7; }
.wave-controls label { margin-right: 3px; color: var(--gold); font-size: 10px; font-weight: 850; white-space: nowrap; }
.wave-controls button:disabled, .side-switch button:disabled { opacity: .5; cursor: default; }
.battle-frame { position: relative; flex: 1; min-height: 0; background: #c99d65 url('assets/battle-map-raider.png') center center / cover; overflow: hidden; border-bottom: 2px solid #111a14; }
.battle-frame[data-view="player"] .field-label-enemy, .battle-frame[data-view="player"] .battle-topline span:last-child, .battle-frame[data-view="hostile"] .field-label-player, .battle-frame[data-view="hostile"] .battle-topline span:first-child { display: none; }
.battle-topline { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 11px 20px; color: #fff6d9; font-size: 10px; letter-spacing: .18em; font-weight: 900; text-shadow: 0 1px 3px #24170c; z-index: 2; pointer-events: none; }
.scene-scroller { width: 100%; height: 100%; overflow: auto; scrollbar-color: #786346 #293327; scrollbar-width: thin; touch-action: pan-x pan-y; }
.battlefield { display: block; width: 100%; height: 100%; min-width: 850px; min-height: 500px; user-select: none; }
.field-label { position: absolute; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 7px 11px; background: linear-gradient(#303a30eb,#1e281feb); border: 1px solid #708168; border-radius: 3px; box-shadow: 0 3px 0 #111b15a6, inset 0 1px #ffffff27; font-size: 13px; font-weight: 800; text-shadow: 0 1px #0a130d; pointer-events: none; }
.field-label b { font-size: 12px; margin-left: 9px; color: #ffdf9e; }
.field-label-player { left: 18px; top: 34px; }
.field-label-enemy { right: 18px; top: 34px; }
.field-dot { width: 8px; height: 8px; border-radius: 50%; background: #93d073; box-shadow: 0 0 0 2px #486345; }
.field-label-enemy .field-dot { background: #ffb17d; box-shadow: 0 0 0 2px #8d5b44; }
.selection-tip { position: absolute; left: 18px; bottom: 18px; max-width: calc(100% - 36px); padding: 9px 12px; border: 1px solid #715d3b; border-radius: 3px; background: #272d24e6; color: #fff3d5; font-size: 13px; font-weight: 750; box-shadow: 0 2px 8px #382a1d88; pointer-events: none; }
.battle-footer { display: flex; min-height: 36px; padding: 5px 14px; align-items: center; gap: 20px; background: #263126; border-top: 1px solid #687455; color: #d6ddca; font-size: 12px; }
.formation-status { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; font-weight: 700; }
.formation-source { flex: 0 0 auto; color: #ffdb95; font-weight: 700; }
.save-dot { width: 7px; height: 7px; background: #a3cf7b; border-radius: 50%; }
.save-dot.warning { background: #efae75; }
.field-hint { margin-left: auto; color: #a8b5a3; text-align: right; }
.roster { position: relative; display: flex; flex: 0 0 180px; flex-direction: column; min-width: 0; min-height: 0; border-top: 3px solid #151c14; background: #242824; box-shadow: 0 -5px 14px #121b1588; z-index: 3; }
.roster-body { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.roster-controls { display: flex; align-items: center; gap: 10px; flex: 0 0 38px; padding: 3px 12px; background: #242e25; }
.roster-count { color: #c4cbbb; font-size: 11px; white-space: nowrap; }
.side-switch { display: flex; gap: 5px; }
.side-switch button { min-height: 30px; min-width: 105px; padding: 3px 10px; border: 1px solid #586353; border-radius: 4px; color: #d4ddcd; background: #303a30; font-size: 11px; font-weight: 800; }
.side-switch button.is-active { background: #526745; border-color: #adc490; color: #fff; }
.side-switch button[data-side="Hostile"].is-active { background: #70513e; border-color: #dfa271; }
.side-symbol { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.side-symbol-player { background: #96d078; }
.side-symbol-hostile { background: #f0ae7c; }
.search-wrap { display: flex; align-items: center; width: min(310px, 30vw); height: 30px; margin-left: auto; background: #151e18; border: 1px solid #556452; border-radius: 5px; }
.search-wrap:focus-within { border-color: #e2c17a; }
.search-icon { padding-left: 11px; font-size: 23px; line-height: 1; color: #a7b397; }
.search-wrap input { width: 100%; min-width: 0; height: 100%; padding: 0 10px; border: 0; outline: 0; background: transparent; color: white; font-size: 13px; }
.search-wrap input::placeholder { color: #aab4a3; }
.category-tabs { display: flex; flex: 0 0 40px; overflow-x: auto; gap: 4px; padding: 0 10px; align-items: end; border-bottom: 3px solid #161a16; background: #293229; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs button { flex: 0 0 auto; min-height: 35px; padding: 5px 15px; border: 2px solid #8e2921; border-radius: 8px 8px 0 0; background: linear-gradient(#ff562b,#d11f17); color: #fff4de; font-size: 13px; font-weight: 850; text-shadow: 0 1px #6d1b18; }
.category-tabs button.is-active { background: #f0e9dc; border-color: #b3afa2; color: #292a28; text-shadow: none; }
.roster-list-wrap { display: flex; flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; background: #303330; scrollbar-color: #887655 #1a241c; }
.tray-label { position: sticky; left: 0; display: grid; place-items: center; flex: 0 0 68px; z-index: 1; border-right: 2px solid #4a5548; background: #242924; color: #a6d0e7; font-size: 12px; font-weight: 850; }
.unit-list { display: flex; gap: 1px; min-width: max-content; height: 100%; padding: 3px 7px; }
.unit-card { position: relative; display: flex; flex: 0 0 106px; flex-direction: column; justify-content: center; align-items: center; gap: 0; min-width: 0; height: 100%; padding: 3px 5px; text-align: center; border: 1px solid #505b4e; border-radius: 2px; background: #373c37; color: #f3f2e6; cursor: grab; }
.unit-card:hover { background: #495648; border-color: #ddc077; }
.unit-card.is-drag-source { opacity: .54; cursor: grabbing; }
.unit-card img { display: block; width: 72px; height: 72px; flex: 0 0 72px; object-fit: contain; image-rendering: auto; touch-action: none; }
.unit-card-copy { width: 100%; min-width: 0; }
.unit-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; line-height: 1.2; }
.unit-card small { display: none; }
.unit-card .add-symbol { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 1px 4px; border: 1px solid #b4ad78; border-radius: 3px; background: #293128d9; color: #fff5c9; font-size: 12px; font-weight: 850; }
.empty-results { padding: 20px; color: #b8c5af; font-size: 13px; }
.roster.is-remove-target { border-top-color: #f4b278; }
.roster.is-remove-target::after { content: 'Release to remove unit'; position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: #462a26e8; color: #ffe0c5; font-size: 19px; font-weight: 850; pointer-events: none; }
.tile { cursor: pointer; transition: fill .12s ease, stroke .12s ease; }
.tile:focus { outline: none; }
.tile .tile-shape { fill: #efd0a916; stroke: var(--field-line); stroke-width: 1.35; vector-effect: non-scaling-stroke; }
.tile.is-active .tile-shape { fill: #dff2aa16; stroke: #7b7351; }
.tile:hover .tile-shape, .tile:focus-visible .tile-shape { fill: #a6f47678; stroke: #e4f98a; stroke-width: 2.5; }
.tile.is-selected .tile-shape { fill: #c9f18a77; stroke: #ebf994; stroke-width: 3; }
.tile.is-invalid .tile-shape { fill: #ed695575; stroke: #a72716; stroke-width: 3; }
.tile.is-blocked .tile-shape { fill: #5d4c3428; stroke: #6f584844; stroke-dasharray: 4 5; }
.tile.is-drop-target .tile-shape { fill: #9aef5b9c; stroke: #f3ffaf; stroke-width: 3.5; }
.tile.is-drop-invalid .tile-shape { fill: #ed695575; stroke: #ff9d78; stroke-width: 3; }
.tile-number { fill: #3c3b26; font-size: 10px; font-weight: 850; text-anchor: middle; pointer-events: none; opacity: 0; }
.tile:hover .tile-number, .tile:focus-visible .tile-number { opacity: 1; }
.unit-figure { cursor: grab; }
.unit-figure .unit-shadow { fill: #3a2716aa; filter: url(#unit-shadow); pointer-events: none; }
.unit-figure .unit-art { filter: drop-shadow(0 4px 1px #4c341d9c); touch-action: none; }
.unit-figure.is-drag-source { opacity: .35; }
#unit-layer.is-dragging-figure, #unit-layer.is-placing { pointer-events: none; }
.unit-figure.is-selected .unit-art { filter: drop-shadow(0 0 7px #dfff87) drop-shadow(0 4px 1px #4c341d9c); }
.unit-figure.is-new .unit-art { transform-box: fill-box; transform-origin: center bottom; animation: deploy-pop .3s cubic-bezier(.16,.85,.25,1.2); }
.rank-badge { pointer-events: none; }
.rank-badge circle { fill: #227c89; stroke: #d6faf0; stroke-width: 2; filter: drop-shadow(0 2px 2px #1b211acc); }
.rank-badge text { fill: #fff; font-size: 14px; font-weight: 850; text-anchor: middle; }
.wiki-placeholder { fill: #35473a; stroke: #efc47b; stroke-width: 2; filter: drop-shadow(0 4px 2px #3b2a1c9c); }
.wiki-placeholder-label, .wiki-placeholder-id { fill: #fff0ce; text-anchor: middle; pointer-events: none; }
.wiki-placeholder-label { font-size: 10px; font-weight: 800; }
.wiki-placeholder-id { font-size: 8px; }
@keyframes deploy-pop { 0% { opacity: .3; transform: translateY(-21px) scale(1.15); } 75% { opacity: 1; transform: translateY(3px) scale(.96); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; transform: translate(-50%, -68%) scale(1.04); }
.drag-ghost img { display: block; width: var(--art-width); height: var(--art-height); object-fit: contain; filter: drop-shadow(0 4px 3px #080f0aba); }
.drag-ghost.can-drop img { filter: drop-shadow(0 0 5px #b8fa83) drop-shadow(0 4px 3px #080f0aba); }
.drag-ghost.can-remove img { filter: drop-shadow(0 0 6px #ff8269) drop-shadow(0 4px 3px #080f0aba); }
.drag-ghost.cannot-drop img { filter: drop-shadow(0 0 5px #ff8269) drop-shadow(0 4px 3px #080f0aba); }
.drag-placeholder { display: grid; place-items: center; width: 114px; min-height: 72px; padding: 8px; border: 2px solid #efc47b; border-radius: 8px; background: #35473a; color: #fff0ce; font-size: 11px; font-weight: 800; text-align: center; }
.drag-ghost.is-settling { opacity: 0; transform: translate(-50%, -72%) scale(.65); transition: left .22s ease-out, top .22s ease-out, transform .22s ease-out, opacity .22s ease-out; }
.is-dragging-unit, .is-dragging-unit * { cursor: grabbing !important; user-select: none !important; }
.unit-inspector { width: min(590px, calc(100vw - 24px)); max-height: min(88dvh, 780px); padding: 0; border: 1px solid #ad9a6b; border-radius: 8px; background: #263126; color: #f4f0df; box-shadow: 0 18px 60px #080e09d9; }
.unit-inspector::backdrop { background: #0a100bc9; }
.unit-inspector-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: #303b2f; border-bottom: 1px solid #586a50; }
.unit-inspector-header h2 { margin: 3px 0 0; font-size: 20px; }
.unit-inspector-body { max-height: calc(88dvh - 140px); overflow-y: auto; padding: 16px 18px; }
.unit-inspector-summary { display: flex; gap: 18px; align-items: center; }
.unit-inspector-summary img { width: 94px; height: 94px; object-fit: contain; }
.unit-inspector-summary > div { flex: 1; min-width: 0; }
.unit-inspector-summary p { margin: 2px 0 9px; color: #c0cdb8; font-size: 12px; }
.unit-inspector-summary label { display: block; color: #efbd63; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.unit-inspector-summary select { width: 130px; height: 35px; margin-top: 4px; padding: 0 8px; border: 1px solid #738267; border-radius: 4px; background: #172018; color: #f4f0df; font-weight: 750; }
.unit-inspector-summary select:disabled { opacity: .65; }
.unit-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 16px 0; border: 1px solid #596b51; background: #596b51; }
.unit-stats > div { padding: 8px 10px; background: #303d32; }
.unit-stats dt { color: #b9c8b4; font-size: 10px; }
.unit-stats dd { margin: 2px 0 0; color: #fff5db; font-size: 16px; font-weight: 800; }
.unit-inspector-body h3 { margin: 18px 0 5px; color: #ffe2a2; font-size: 15px; }
.unit-inspector-caveat { margin: 0 0 12px; color: #bdc8b7; font-size: 11px; line-height: 1.4; }
.inspector-weapon { margin: 0 0 12px; padding: 10px; border: 1px solid #4f624c; border-radius: 5px; background: #303d32; }
.inspector-weapon h4 { margin: 0; color: #f3e3b8; font-size: 13px; }
.inspector-weapon-base { margin: 3px 0 8px; color: #c8d4c1; font-size: 11px; }
.inspector-attack { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 6px 0; border-top: 1px solid #4e604b; font-size: 11px; }
.inspector-attack strong { min-width: 120px; color: #fff9e8; }
.inspector-attack span { color: #c4d2bf; }
.inspector-attack small { width: 100%; color: #e7c885; }
.inspector-attack small.is-rank-locked { color: #f2a588; }
.unit-inspector-footer { display: flex; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid #586a50; }
.boss-library { width: min(780px, calc(100vw - 28px)); max-height: min(88dvh, 900px); padding: 0; border: 1px solid #ad9a6b; border-radius: 8px; background: #263126; color: #f4f0df; box-shadow: 0 18px 60px #080e09d9; }
.boss-library::backdrop { background: #0a100bc9; }
.boss-library-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px 12px; border-bottom: 1px solid #586a50; background: #303b2f; }
.boss-library-header h2 { margin: 3px 0 0; font-size: 22px; }
.boss-library-close { width: 36px; height: 36px; border: 1px solid #68765e; border-radius: 4px; background: #3b4739; color: #fff2d6; font-size: 26px; line-height: 1; }
.boss-library-intro { margin: 0; padding: 14px 22px; color: #cbd2c3; font-size: 13px; line-height: 1.45; }
.boss-library-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 22px 14px; }
.boss-library-selects label { display: grid; gap: 5px; min-width: 0; color: #efbd63; font-size: 11px; font-weight: 800; }
.boss-library-selects select { width: 100%; min-width: 0; height: 38px; padding: 0 8px; border: 1px solid #738267; border-radius: 4px; background: #172018; color: #f4f0df; font-size: 12px; }
.boss-library-status { min-height: 38px; margin: 0; padding: 11px 22px; border-top: 1px solid #475845; color: #cfd7c7; font-size: 12px; }
.boss-wave-preview { max-height: min(43dvh, 420px); overflow-y: auto; padding: 0 22px; scrollbar-color: #657657 #1a241c; }
.boss-wave { padding: 10px 0 15px; border-top: 1px solid #465844; }
.boss-wave h3 { margin: 0 0 10px; color: #ffe2a2; font-size: 14px; }
.boss-wave-units { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 0; padding: 0; list-style: none; }
.boss-wave-units li { display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 44px; padding: 4px 6px; border: 1px solid #465844; border-radius: 4px; background: #303d32; }
.boss-wave-units li > b { flex: 0 0 17px; color: #efbd63; font-size: 10px; }
.boss-wave-units img, .boss-unknown-icon { width: 36px; height: 36px; flex: 0 0 36px; object-fit: contain; }
.boss-unknown-icon { display: grid; place-items: center; border: 1px solid #ac9360; border-radius: 4px; color: #ffe2a2; font-weight: 800; }
.boss-wave-units li > span:last-child { min-width: 0; }
.boss-wave-units strong, .boss-wave-units small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boss-wave-units strong { font-size: 10px; }
.boss-wave-units small { margin-top: 2px; color: #b5c3ae; font-size: 9px; }
.boss-library-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 22px 18px; border-top: 1px solid #586a50; }
.boss-library-footer a { color: #ffe2a2; font-size: 12px; }
.boss-library-footer .button:disabled { opacity: .55; cursor: default; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 12px); z-index: 10; padding: 10px 14px; border: 1px solid #9fba79; border-radius: 5px; background: #243123; box-shadow: 0 8px 28px #0b130ca8; color: #fff; font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1180px) {
  .topbar { gap: 10px; padding-inline: 14px; }
  .brand { min-width: 198px; }
  .top-actions { gap: 4px; }
  .button { padding-inline: 10px; }
  .modebar { flex-wrap: wrap; gap: 8px; }
  .mode-tabs { justify-content: start; }
}
@media (max-width: 830px) {
  .topbar { min-height: 66px; flex-wrap: wrap; gap: 8px; }
  .brand { min-width: 0; flex: 0 0 auto; }
  .brand strong { font-size: 13px; }
  .plan-name-wrap { order: 0; flex: 1 1 130px; min-width: 0; width: auto; margin: 0; }
  .plan-name { height: 34px; }
  .top-actions { order: 1; flex: 0 0 100%; justify-content: space-between; gap: 3px; margin: 0; }
  .top-actions .button { padding-inline: 5px; font-size: 10px; }
  .modebar { min-height: 90px; padding: 9px 12px; }
  .modebar-title strong { font-size: 14px; }
  .background-control { min-width: 130px; }
  .mode-tabs { flex: 1 1 100%; flex-wrap: nowrap; justify-content: space-between; overflow-x: auto; }
  .mode-tabs button { min-width: 76px; min-height: 39px; padding-inline: 5px; font-size: 11px; }
  .mode-tabs button span { font-size: 9px; }
  .formation-toolbar { flex-wrap: wrap; justify-content: center; gap: 5px; padding: 5px 8px; }
  .library-button { flex: 1; }
  .view-switch, .wave-controls { justify-content: center; width: 100%; }
  .view-switch button { flex: 1; }
  .wave-controls select { flex: 1; min-width: 0; }
  .battlefield { min-width: 850px; }
  .battle-footer { min-height: 34px; padding: 4px 9px; }
  .field-hint { display: none; }
  .roster { flex-basis: 165px; }
  .roster-controls { gap: 5px; padding-inline: 6px; }
  .side-switch button { min-width: 80px; padding-inline: 4px; font-size: 10px; }
  .search-wrap { width: auto; flex: 1; min-width: 90px; }
  .roster-count { display: none; }
  .category-tabs { flex-basis: 36px; padding-inline: 5px; }
  .category-tabs button { min-height: 32px; padding-inline: 10px; font-size: 11px; }
  .tray-label { flex-basis: 55px; font-size: 10px; }
  .unit-card { flex-basis: 90px; }
  .unit-card img { width: 62px; height: 62px; flex-basis: 62px; }
  .toast { bottom: 173px; }
}
@media (max-width: 530px) {
  .topbar { padding: 8px 10px; }
  .brand-mark { width: 32px; height: 32px; font-size: 20px; }
  .brand-overline { font-size: 8px; }
  .brand strong { font-size: 12px; }
  .top-actions { overflow-x: auto; justify-content: flex-start; white-space: nowrap; }
  .top-actions .button { flex: 0 0 auto; }
  .button-primary { min-height: 33px; font-size: 11px; }
  .modebar { min-height: 86px; }
  .battle-topline { font-size: 8px; padding: 10px; }
  .field-label { font-size: 10px; padding: 5px 7px; top: 29px; }
  .field-label b { margin-left: 3px; font-size: 10px; }
  .field-label-player { left: 8px; }
  .field-label-enemy { right: 8px; }
  .selection-tip { font-size: 11px; bottom: 9px; left: 8px; }
  .battle-footer { font-size: 11px; }
  .roster { flex-basis: 158px; }
  .side-switch button { min-width: 70px; }
  .unit-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .boss-library-selects { grid-template-columns: 1fr; }
  .boss-library[open] { display: flex; flex-direction: column; height: 88dvh; }
  .boss-library-header, .boss-library-intro, .boss-library-selects, .boss-library-status, .boss-library-footer { flex-shrink: 0; }
  .boss-wave-preview { flex: 1; min-height: 0; max-height: none; }
  .boss-wave-units { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
