:root {
  --ink: #152027;
  --ink-2: #223139;
  --panel: #2c3b3c;
  --paper: #d6d1af;
  --paper-dark: #8b8a6c;
  --gold: #edc86c;
  --gold-dark: #a36932;
  --red: #d85e50;
  --red-dark: #7d3536;
  --mint: #a8d4a8;
  --line: rgba(222, 214, 166, .32);
  --mono: "Courier New", Consolas, monospace;
  --ui: "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: #10171c; color: var(--paper); font-family: var(--ui); }
button { font: inherit; color: inherit; }

.war-room { width: min(1500px, 100%); min-height: 100vh; margin: 0 auto; padding: 18px 22px 12px; background: radial-gradient(ellipse at 50% -30%, #35434a 0, #1c282e 42%, #10171c 85%); }
.war-header { min-height: 66px; display: flex; align-items: center; gap: 14px; padding: 9px 15px; border: 2px solid #6e725d; outline: 1px solid #1b2529; background: linear-gradient(#35444a, #202d31); box-shadow: inset 0 0 0 2px #151e21, 0 7px 20px #0007; }
.crest { position: relative; width: 35px; height: 37px; display: flex; align-items: end; justify-content: center; gap: 2px; border: 1px solid #eac675; background: #28393a; overflow: hidden; }
.crest:after { content: ''; position: absolute; inset: 4px; border: 1px solid #6e724f; }.crest i { position: relative; z-index: 1; display: block; width: 6px; background: var(--gold); }.crest i:nth-child(1) { height: 15px; }.crest i:nth-child(2) { height: 24px; background: #ffe19a; }.crest i:nth-child(3) { height: 19px; background: #b94f42; }
.title-block p, .title-block h1 { margin: 0; }.title-block p { color: #99aaa0; font: 9px var(--mono); letter-spacing: .16em; }.title-block h1 { margin-top: 4px; color: #f3d77f; font: 700 20px/1 var(--mono); letter-spacing: .13em; text-shadow: 2px 2px #80542d; }
.header-divider { width: 1px; align-self: stretch; margin: 4px 7px; background: #63706d; }.chapter { display: flex; flex-direction: column; gap: 4px; }.chapter span, .header-stats span { color: #a6aea1; font: 9px var(--mono); letter-spacing: .08em; }.chapter b { font-size: 13px; color: #f3ebc5; }.header-stats { margin-left: auto; display: flex; align-items: center; gap: 17px; }.header-stats b { color: var(--gold); font-size: 13px; }.header-stats button { width: 30px; height: 30px; border: 1px solid #8b916f; background: #1e2a2e; color: var(--gold); cursor: pointer; }.header-stats button:hover { background: #42504b; }
.difficulty-set { display: flex; gap: 3px; margin-left: auto; }.difficulty-set button { padding: 5px 7px; border: 1px solid #667665; background: #1c2a2e; color: #abb9a1; cursor: pointer; font: 9px var(--mono); }.difficulty-set button:hover { border-color: #e8c96d; color: #f5df98; }.difficulty-set button.active { border-color: #e5c36b; background: #705637; color: #fff0b3; }

.battle-layout { display: grid; grid-template-columns: 184px minmax(0, 1fr) 184px; gap: 12px; height: min(690px, calc(100vh - 230px)); min-height: 580px; margin-top: 14px; align-items: stretch; }
.field-ledger { min-height: 0; height: 100%; padding: 12px 10px; overflow: hidden; border: 2px solid #656d5d; outline: 1px solid #11191c; background: linear-gradient(135deg, #334146, #253238); box-shadow: inset 0 0 0 2px #1b262a, 0 9px 18px #0004; }
.ledger-title { padding-bottom: 9px; border-bottom: 1px solid var(--line); }.ledger-title span, .formation-card > span, .battle-report > span, .campaign > span { display: block; color: #b4c4a4; font: 9px var(--mono); letter-spacing: .1em; }.ledger-title b { display: block; margin-top: 4px; color: #f4e0a1; font-size: 13px; }.ledger-note { margin: 11px 1px 12px; color: #bcc5af; font-size: 10px; line-height: 1.65; }
.squad-cards { display: grid; gap: 7px; }.squad-card { min-height: 72px; display: grid; grid-template-columns: 34px 1fr; gap: 7px; padding: 7px; border: 1px solid #6f765e; background: #26343a; color: #e9e4c2; cursor: pointer; text-align: left; transition: transform .12s, background .12s; }.squad-card:hover { transform: translateX(2px); background: #3a4a49; }.squad-card.selected { border-color: #ffd775; background: #3b4941; box-shadow: inset 3px 0 #edc86c; }.squad-card.danger { border-color: #ca6251; }.squad-icon { width: 32px; height: 37px; display: grid; place-items: center; align-self: center; border: 1px solid #8f8152; background: #6c5637; color: #fff0aa; font: 700 16px var(--mono); }.squad-card.danger .squad-icon { border-color: #d56d5b; background: #65393a; color: #ffc0a1; }.squad-card b { display: block; font-size: 11px; font-weight: 700; }.squad-card small { display: block; margin-top: 4px; color: #aeb9a5; font: 8px var(--mono); }.unit-bar { height: 4px; margin-top: 8px; background: #172225; }.unit-bar i { display: block; height: 100%; background: #b4d390; }.squad-card.danger .unit-bar i { background: #de705d; }
.ledger-rule { height: 1px; margin: 14px 0; background: var(--line); }.formation-preview { width: 82px; height: 54px; margin: 10px 0 5px; display: grid; grid-template-columns: repeat(3, 8px); grid-auto-rows: 8px; gap: 4px; align-content: center; justify-content: center; border: 1px solid #737b66; background: #203036; }.formation-preview i { width: 8px; height: 8px; border-radius: 50%; background: #e1bf68; box-shadow: 1px 1px #724832; }.formation-card p { margin: 0; color: #d6d5b7; font-size: 10px; }

.battle-stage { min-width: 0; display: flex; flex-direction: column; }.screen-labels { display: flex; justify-content: space-between; padding: 0 5px 7px; color: #c5caab; font: 10px var(--mono); letter-spacing: .04em; }.screen-labels span:last-child { color: var(--gold); }.screen-bezel { position: relative; flex: 1; min-height: 500px; padding: 9px; border: 2px solid #c2a65f; outline: 2px solid #273238; background: linear-gradient(135deg, #7a6336, #d8bd73 45%, #795d32); box-shadow: 0 15px 35px #0007, inset 0 0 0 2px #503d25; }.screen-bezel:before, .screen-bezel:after { content: ''; position: absolute; z-index: 3; width: 11px; height: 11px; border: 2px solid #f8de92; background: #6c4e2d; }.screen-bezel:before { top: 3px; left: 3px; }.screen-bezel:after { right: 3px; bottom: 3px; }.screen-bezel canvas { display: block; width: 100%; height: 100%; min-height: 500px; border: 3px solid #172022; image-rendering: pixelated; image-rendering: crisp-edges; background: #63824a; touch-action: none; }.scanlines { position: absolute; pointer-events: none; z-index: 2; inset: 9px; opacity: .12; background: repeating-linear-gradient(to bottom, transparent 0 3px, #061014 3px 4px); mix-blend-mode: multiply; }.battle-tip { position: absolute; z-index: 4; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 5px 9px; border: 1px solid rgba(250,234,177,.45); background: rgba(16, 29, 29, .76); color: #f5e7bb; font: 9px var(--mono); pointer-events: none; transition: opacity .3s; }.battle-tip.hide { opacity: 0; }.result-curtain { position: absolute; z-index: 7; inset: 9px; display: grid; place-items: center; background: rgba(15, 25, 24, .7); }.result-curtain[hidden] { display: none; }.result-card { width: min(370px, calc(100% - 30px)); padding: 25px; text-align: center; border: 2px solid #cba95e; background: #273538; box-shadow: inset 0 0 0 2px #151f21, 7px 8px #0c1315; }.result-card p { margin: 0; color: #b3c6a5; font: 10px var(--mono); letter-spacing: .12em; }.result-card h2 { margin: 10px 0 8px; color: #f2d67d; font-size: 23px; }.result-card span { display: block; color: #d6d4b6; font-size: 12px; }.result-card button { margin-top: 17px; padding: 9px 20px; border: 1px solid #ebca74; background: #735331; color: #fff0b2; cursor: pointer; }.result-card button:hover { background: #957240; }
.battle-caption { display: flex; gap: 12px; align-items: center; min-height: 28px; padding: 7px 4px 0; color: #9da99a; font: 9px var(--mono); }.battle-caption span:last-child { margin-left: auto; color: #b3ae90; }.battle-caption i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border: 1px solid #191d1b; }.gold-dot { background: var(--gold); }.red-dot { background: var(--red); }

.enemy-board { display: grid; gap: 7px; margin-top: 12px; }.enemy-row { padding: 7px; border: 1px solid #714b48; background: #352d31; }.enemy-row b { color: #edc49d; font-size: 11px; }.enemy-row span { float: right; color: #e5715f; font: 10px var(--mono); }.enemy-row small { display: block; margin-top: 4px; color: #c8aa9e; font: 8px var(--mono); }.enemy-bar { height: 4px; margin-top: 8px; background: #211f22; }.enemy-bar i { display: block; height: 100%; background: #cf6353; }.battle-report p { margin: 8px 0 0; color: #d0c8ab; font-size: 11px; line-height: 1.6; }.campaign-nodes { display: flex; align-items: flex-start; margin-top: 12px; }.campaign-nodes button { position: relative; width: 26px; height: 26px; flex: 0 0 26px; padding: 0; border: 1px solid #6a7568; border-radius: 50%; background: #1f2c31; color: #a6b19e; cursor: pointer; }.campaign-nodes button:hover { border-color: #e5c46d; }.campaign-nodes button.active { border-color: #edc86c; background: #735733; color: #ffdf81; box-shadow: 0 0 0 3px #755f3a55; }.campaign-nodes button b { font: 8px var(--mono); }.campaign-nodes button small { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); color: #abb59d; font-size: 8px; white-space: nowrap; }.campaign-nodes i { height: 1px; flex: 1; margin-top: 13px; background: #6b7568; }
.outpost-board > span { display: block; color: #b4c4a4; font: 9px var(--mono); letter-spacing: .1em; }.outpost-board > div { display: grid; gap: 5px; margin-top: 8px; }.outpost-row { padding: 6px; border: 1px solid #7d4c48; background: #382e30; }.outpost-row.secured { border-color: #78946e; background: #314339; }.outpost-row b { display: block; color: #f0c698; font-size: 10px; }.outpost-row.secured b { color: #cce3ab; }.outpost-row small { display: block; margin-top: 3px; color: #b7a79a; font: 8px var(--mono); }.outpost-row.secured small { color: #a9caa1; }.outpost-bar { height: 3px; margin-top: 6px; background: #241f20; }.outpost-bar i { display: block; height: 100%; background: #d66555; }.outpost-row.secured .outpost-bar i { background: #a7d180; }

.command-deck { display: grid; grid-template-columns: 215px minmax(340px, 1fr) 242px; gap: 12px; margin-top: 14px; padding: 9px; border: 2px solid #65715f; outline: 1px solid #121b1e; background: linear-gradient(#344348, #263339); box-shadow: inset 0 0 0 2px #172225, 0 8px 18px #0005; }.selected-unit { display: grid; grid-template-columns: 39px 1fr; grid-template-rows: auto 1fr; gap: 4px 8px; align-items: center; padding: 3px 6px; border-right: 1px solid var(--line); }.section-label { grid-column: span 2; color: #aebb9e; font: 8px var(--mono); letter-spacing: .08em; }.unit-glyph { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid #e6c36a; background: #775c35; color: #fff1ac; font: 700 16px var(--mono); }.selected-unit b { display: block; color: #f1e6ba; font-size: 12px; }.selected-unit small { display: block; margin-top: 3px; color: #adb9a1; font: 8px var(--mono); }.order-deck { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }.order { min-height: 52px; display: grid; grid-template-columns: 20px 1fr; grid-template-rows: 1fr 12px; align-items: center; gap: 0 4px; padding: 5px 7px; border: 1px solid #74806b; background: #263439; text-align: left; cursor: pointer; }.order:hover { background: #405049; }.order.active { border-color: #f0cb71; background: #4b503f; box-shadow: inset 0 -2px #e9c169; }.order kbd, .support-deck kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border: 1px solid #90a18a; background: #182327; color: #c9d4b4; font: 9px var(--mono); }.order span { color: #eee4ba; font-size: 12px; }.order small { grid-column: 2; color: #aeb89c; font: 8px var(--mono); letter-spacing: .08em; }.support-deck { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 6px; padding-left: 10px; border-left: 1px solid var(--line); }.power-readout { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }.power-readout span { color: #aeb89b; font: 8px var(--mono); }.power-readout b { color: #f2d572; font: 11px var(--mono); }.power-meter { height: 5px; background: #152023; }.power-meter i { display: block; width: 100%; height: 100%; background: linear-gradient(to right, #a8d186, #f0cc67); }.support-deck button { min-height: 30px; border: 1px solid #c3a762; background: #695234; color: #fff0af; cursor: pointer; font-size: 11px; }.support-deck button:hover { background: #88693d; }.support-deck .retreat-button { border-color: #8e6760; background: #453334; color: #eac5af; }.support-deck .retreat-button:hover { background: #674344; }
.instruction-line { margin: 9px 0 0; color: #81908a; text-align: center; font: 9px var(--mono); }.toast { position: fixed; z-index: 20; left: 50%; bottom: 22px; padding: 9px 13px; transform: translate(-50%, 20px); border: 1px solid #d9bf71; background: #263437; color: #f7e6b0; font: 10px var(--mono); opacity: 0; pointer-events: none; transition: .2s; box-shadow: 4px 4px #0008; }.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1100px) { .war-room { padding: 12px; }.battle-layout { grid-template-columns: 164px minmax(0, 1fr); }.right-ledger { display: none; }.command-deck { grid-template-columns: 200px minmax(340px, 1fr); }.support-deck { grid-column: span 2; grid-template-columns: 1fr 130px 80px; padding: 9px 0 0; border-top: 1px solid var(--line); border-left: 0; } }
@media (max-width: 700px) { .war-room { padding: 7px; }.war-header { min-height: 53px; padding: 6px 8px; gap: 8px; }.crest { width: 29px; height: 31px; }.title-block p, .chapter span { display: none; }.title-block h1 { font-size: 15px; }.header-divider { margin: 3px 0; }.chapter b { font-size: 11px; }.difficulty-set { margin-left: 0; gap: 2px; }.difficulty-set button { padding: 4px 5px; font-size: 8px; }.header-stats { gap: 7px; }.header-stats span { font-size: 8px; }.battle-layout { display: block; margin-top: 8px; }.left-ledger { min-height: 0; margin-bottom: 8px; padding: 8px; }.left-ledger .ledger-title, .left-ledger .ledger-note, .left-ledger .ledger-rule, .formation-card { display: none; }.squad-cards { grid-template-columns: repeat(3, 1fr); gap: 4px; }.squad-card { min-height: 54px; grid-template-columns: 25px 1fr; padding: 4px; gap: 4px; }.squad-icon { width: 24px; height: 29px; font-size: 13px; }.squad-card b { font-size: 9px; }.squad-card small { font-size: 7px; margin-top: 2px; }.unit-bar { margin-top: 5px; }.screen-labels { padding-bottom: 4px; font-size: 8px; }.screen-bezel { min-height: 300px; padding: 5px; }.screen-bezel canvas { min-height: 300px; }.scanlines { inset: 5px; }.battle-caption span:last-child { display: none; }.command-deck { grid-template-columns: 1fr; gap: 7px; margin-top: 8px; }.selected-unit { display: none; }.order-deck { gap: 3px; }.order { min-height: 48px; grid-template-columns: 15px 1fr; padding: 4px; }.order kbd { min-width: 14px; height: 15px; font-size: 7px; }.order span { font-size: 10px; }.order small { font-size: 7px; }.support-deck { grid-column: auto; grid-template-columns: 1fr 120px 68px; padding: 7px 0 0; }.instruction-line { display: none; }.battle-tip { bottom: 10px; font-size: 8px; }.result-card { padding: 18px; }.result-card h2 { font-size: 18px; } }

.selected-unit { grid-template-rows: auto 1fr auto; }
.formation-buttons { grid-column: span 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 3px; }
.formation-buttons button { padding: 3px 1px; border: 1px solid #637565; background: #1d2b2f; color: #afbd9e; cursor: pointer; font: 8px var(--mono); }
.formation-buttons button:hover { border-color: #d6ba6b; color: #f3dd96; }
.formation-buttons button.active { border-color: #e7c867; background: #5b5438; color: #fff0ad; }
.unit-bar, .outpost-bar { display: block; overflow: hidden; width: 100%; }
.planning-curtain { position: absolute; z-index: 6; inset: 9px; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 22px; pointer-events: none; background: linear-gradient(to bottom, rgba(12,23,22,.08), rgba(12,23,22,.38)); }
.planning-curtain[hidden] { display: none; }
.planning-card { width: min(650px, calc(100% - 28px)); display: grid; grid-template-columns: 1fr auto; gap: 7px 18px; align-items: center; padding: 13px 15px; border: 2px solid #d1b364; background: rgba(32,46,46,.95); box-shadow: inset 0 0 0 2px #172225, 5px 6px #0a1113aa; pointer-events: auto; }
.planning-card p, .planning-card h2, .planning-card span { margin: 0; }.planning-card p { color: #b5c6a3; font: 9px var(--mono); letter-spacing: .12em; }.planning-card h2 { color: #f1d37b; font-size: 17px; }.planning-card span { grid-column: 1; color: #d3d0aa; font-size: 10px; }.planning-card button { grid-column: 2; grid-row: 1 / span 3; align-self: stretch; padding: 7px 17px; border: 1px solid #f0cf73; background: #765937; color: #fff0ad; cursor: pointer; font-weight: 700; }.planning-card button:hover { background: #947341; }

@media (max-width: 700px) { .selected-unit { display: grid; grid-template-columns: 28px 1fr; padding: 3px 4px; border-right: 0; border-bottom: 1px solid var(--line); }.selected-unit .unit-glyph { width: 26px; height: 28px; font-size: 12px; }.selected-unit b { font-size: 10px; }.selected-unit small { font-size: 7px; }.formation-buttons button { padding: 4px 1px; font-size: 8px; } }
@media (max-width: 700px) { .planning-curtain { inset: 5px; padding-bottom: 8px; }.planning-card { grid-template-columns: 1fr; gap: 5px; padding: 9px; }.planning-card h2 { font-size: 13px; }.planning-card span { font-size: 8px; }.planning-card button { grid-column: 1; grid-row: auto; padding: 7px; } }

@media (max-height: 500px) and (max-width: 1000px) {
  html, body { height: 100%; overflow: hidden; }
  .war-room { width: 100%; height: 100vh; padding: 4px; overflow: hidden; }
  .war-header { min-height: 43px; height: 43px; padding: 4px 8px; gap: 7px; }
  .crest { width: 26px; height: 29px; }.title-block p { display: none; }.title-block h1 { font-size: 14px; }.chapter span { display: none; }.chapter b { font-size: 10px; }
  .difficulty-set button { padding: 3px 5px; font-size: 7px; }.header-stats { gap: 6px; }.header-stats span { font-size: 7px; }.header-stats button { width: 25px; height: 25px; }
  .battle-layout { display: block; height: calc(100vh - 132px); margin-top: 4px; }
  .field-ledger { display: none; }.battle-stage { height: 100%; }.screen-labels { height: 15px; padding: 0 3px 3px; font-size: 7px; }
  .screen-bezel { flex: 1; min-height: 0; height: calc(100% - 15px); padding: 4px; }.screen-bezel canvas { min-height: 0; height: 100%; }.scanlines { inset: 4px; }.battle-caption { display: none; }
  .command-deck { position: fixed; z-index: 12; left: 4px; right: 4px; bottom: 4px; height: 80px; margin: 0; padding: 5px; grid-template-columns: 185px 1fr 170px; gap: 5px; }
  .selected-unit { display: grid; grid-template-columns: 25px 1fr; padding: 1px 4px; border-right: 1px solid var(--line); border-bottom: 0; }.section-label { font-size: 6px; }.selected-unit .unit-glyph { width: 23px; height: 24px; font-size: 10px; }.selected-unit b { font-size: 9px; }.selected-unit small { font-size: 6px; margin-top: 1px; }.formation-buttons { gap: 2px; margin-top: 1px; }.formation-buttons button { padding: 2px 0; font-size: 6px; }
  .order-deck { gap: 3px; }.order { min-height: 0; height: 67px; grid-template-columns: 13px 1fr; grid-template-rows: 1fr 10px; padding: 3px; }.order kbd { min-width: 12px; height: 13px; font-size: 6px; }.order span { font-size: 8px; }.order small { font-size: 6px; }
  .support-deck { grid-column: auto; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 3px; padding: 0 0 0 5px; border-top: 0; border-left: 1px solid var(--line); }.power-readout span, .power-readout b { font-size: 6px; }.support-deck button { min-height: 0; font-size: 8px; }.support-deck .retreat-button { height: 30px; }
  .instruction-line { display: none; }.battle-tip { bottom: 8px; font-size: 7px; }.planning-curtain { inset: 4px; align-items: flex-start; padding: 12px 0 0; }.planning-card { width: min(560px, calc(100% - 20px)); padding: 7px 9px; }.planning-card p { font-size: 6px; }.planning-card h2 { font-size: 11px; }.planning-card span { font-size: 7px; }.planning-card button { padding: 5px 9px; font-size: 8px; }
}

.campaign-nodes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px 5px; margin: 12px 0 22px; }
.campaign-nodes > i { display: none; }
.campaign-nodes button { justify-self: center; }
.campaign-nodes button[data-grade]::after { content: attr(data-grade); position: absolute; top: -7px; right: -7px; width: 13px; height: 13px; display: grid; place-items: center; border: 1px solid #edc86c; border-radius: 50%; background: #253238; color: #f4d778; font: 7px var(--mono); }
.right-ledger .enemy-board { gap: 4px; margin-top: 8px; }.right-ledger .enemy-row { padding: 5px 6px; }.right-ledger .enemy-row small { margin-top: 2px; }.right-ledger .enemy-bar { margin-top: 5px; }
.right-ledger .ledger-rule { margin: 9px 0; }.right-ledger .outpost-board > div { gap: 4px; margin-top: 6px; }.right-ledger .outpost-row { padding: 4px 6px; }.right-ledger .outpost-row small { margin-top: 2px; }.right-ledger .outpost-bar { margin-top: 4px; }
.right-ledger .battle-report p { margin-top: 5px; font-size: 10px; line-height: 1.45; }.right-ledger .campaign-nodes { gap: 21px 4px; margin: 8px 0 17px; }
