/* ───────────────────────────────────────────────────────────────────────────
   DICTATOR — brutalist state-propaganda aesthetic.
   Bone on near-black, one arterial red, one bureaucratic ochre. Condensed
   uppercase display type, monospaced numerals, hard edges, no rounded corners
   above 2px. The interface should look like it was printed by a ministry.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --ink:        #ece7dd;   /* bone */
  --ink-dim:    #9a958c;
  --ink-faint:  #63605a;
  --void:       #08080a;
  --panel:      #121216;
  --panel-2:    #191920;
  --edge:       #2a2a33;
  --edge-hot:   #3d3d49;

  --red:        #e01b3c;
  --red-deep:   #8f1226;
  --red-glow:   #ff3355;
  --ochre:      #d9a521;
  --ochre-deep: #8a6a12;
  --green:      #58a463;
  --slate:      #454b58;

  --display: 'Arial Narrow', 'Helvetica Neue Condensed', 'Liberation Sans Narrow', Impact, system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --topbar-h: 58px;
  --meters-h: 46px;
  --bottom-h: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: var(--topbar-h) auto minmax(0, 1fr) var(--bottom-h);
  /* A faint vignette so the board reads as a lit table in a dark room. */
  background-image: radial-gradient(120% 90% at 50% 0%, #14141a 0%, var(--void) 70%);
}

button { font-family: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #0d0d10; }
::-webkit-scrollbar-thumb { background: #2c2c36; }
::-webkit-scrollbar-thumb:hover { background: var(--red-deep); }

/* ─── Type helpers ───────────────────────────────────────────────────────── */

.display {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ─── Top bar ────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 18px;
  background: linear-gradient(180deg, #17171d, #101014);
  border-bottom: 1px solid var(--edge);
  box-shadow: 0 1px 0 #000;
}

.brand { display: flex; align-items: baseline; gap: 9px; min-width: 0; }



.brand-name {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 700;
  font-size: 21px;
  color: var(--ink);
}

.brand-sub {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 1px solid var(--edge);
  padding-left: 10px;
}

/* Resource strip */

.resources { display: flex; gap: 4px; margin-left: auto; }

.res {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 10px;
  background: #0e0e12;
  border: 1px solid var(--edge);
  min-width: 84px;
}

.res-glyph { font-size: 13px; color: var(--ink-dim); width: 12px; text-align: center; }
.res-value { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.res-delta { font-family: var(--mono); font-size: 10.5px; color: var(--green); margin-left: auto; }
.res-delta.is-negative { color: var(--red); }

.res[data-key='power'] { border-color: var(--ochre-deep); background: #14100a; }
.res[data-key='power'] .res-glyph,
.res[data-key='power'] .res-value { color: var(--ochre); }
.res[data-key='power'].is-spendable { box-shadow: inset 0 0 0 1px var(--ochre); }

/* Turn + action points */

.turnbox { display: flex; align-items: center; gap: 14px; }

.turnbox-turn {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--ink-faint);
}
.turnbox-turn b { font-family: var(--mono); font-size: 16px; color: var(--ink); margin-left: 4px; }

.ap { display: flex; gap: 4px; }

.ap-pip {
  width: 11px;
  height: 22px;
  background: #1b1b22;
  border: 1px solid var(--edge-hot);
}
.ap-pip.is-full {
  background: var(--red);
  border-color: var(--red-glow);
  box-shadow: 0 0 8px rgb(224 27 60 / 55%);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  padding: 8px 14px;
  background: #1c1c24;
  border: 1px solid var(--edge-hot);
  color: var(--ink);
  transition: background 90ms linear, border-color 90ms linear, transform 60ms;
}
.btn:hover:not(:disabled) { background: #26262f; border-color: #565663; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; }

.btn-primary {
  background: var(--red-deep);
  border-color: var(--red);
  padding: 10px 22px;
  font-size: 14px;
}
.btn-primary:hover:not(:disabled) { background: var(--red); border-color: var(--red-glow); }

.btn-ghost { background: transparent; font-size: 11px; padding: 6px 10px; }

.kbd {
  font-family: var(--mono);
  font-size: 10px;
  border: 1px solid rgb(255 255 255 / 25%);
  padding: 0 4px;
  margin-left: 7px;
  opacity: 0.7;
}

/* ─── Meter row ──────────────────────────────────────────────────────────── */

.meters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 26px;
  padding: 4px 18px;
  background: #0c0c10;
  border-bottom: 1px solid var(--edge);
}

.meter { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.meter-label {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  color: var(--ink-faint);
  width: 74px;
  text-align: right;
}

.meter-bar { display: flex; gap: 2px; }

.meter-seg {
  width: 9px;
  height: 14px;
  background: #17171e;
  border: 1px solid #24242c;
}
.meter-seg.is-on { border-color: transparent; }

.meter[data-key='dread'] .meter-seg.is-on { background: var(--red-deep); }
.meter[data-key='dread'] .meter-seg.is-on.is-hot { background: var(--red); box-shadow: 0 0 6px rgb(224 27 60 / 60%); }
.meter[data-key='loyalty'] .meter-seg.is-on { background: var(--ochre-deep); }
.meter[data-key='loyalty'] .meter-seg.is-on.is-hot { background: var(--ochre); }
.meter[data-key='coalition'] .meter-seg.is-on { background: #2f5f8c; }
.meter[data-key='coalition'] .meter-seg.is-on.is-hot { background: #4b93d6; }
.meter[data-key='domination'] .meter-seg.is-on { background: var(--red); }

.meter-value { font-family: var(--mono); font-size: 13px; min-width: 46px; }
.meter-note {
  font-size: 10.5px;
  color: var(--ink-faint);
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.meter-note.is-warn { color: var(--ochre); }
.meter-note.is-danger { color: var(--red-glow); animation: pulse 1.5s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.42; } }

@media (prefers-reduced-motion: reduce) {
  .meter-note.is-danger, .node-ring { animation: none; }
  .btn { transition: none; }
}

/* ─── Stage: map + side panel ────────────────────────────────────────────── */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  min-height: 0;
  overflow: hidden;
}

.mapwrap {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  padding: 8px 14px 0;
  background:
    /* faint ministry grid over the ocean */
    repeating-linear-gradient(0deg, rgb(255 255 255 / 1.6%) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(90deg, rgb(255 255 255 / 1.6%) 0 1px, transparent 1px 46px),
    radial-gradient(90% 80% at 45% 40%, #101018 0%, #0a0a0d 75%);
  border-right: 1px solid var(--edge);
}

.map { width: 100%; height: 100%; display: block; align-self: center; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 6px 4px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9.5px;
  color: var(--ink-faint);
}
.legend-swatch { width: 10px; height: 10px; border: 1px solid #000; }

/* Permanent bulletin under the map — fills the letterbox a 2.3:1 map leaves in a
   squarer container, and keeps the regime's own account of events on screen. */

.bulletin {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-top: 1px solid var(--edge);
  margin: 6px -14px 0;
  background: linear-gradient(180deg, #0d0d11, #0a0a0d);
  min-height: 96px;
  max-height: 34vh;
}

.bulletin-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 7px 16px 6px;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-faint);
  border-bottom: 1px solid #1a1a20;
}
.bulletin-sigil { color: var(--red-deep); letter-spacing: 0; font-size: 12px; }
.bulletin-turn { margin-left: auto; font-family: var(--mono); letter-spacing: 0; color: #4a4844; }

.bulletin-feed { overflow-y: auto; padding: 4px 12px 10px; }

/* SVG map internals — real Natural Earth coastlines, treated as printed cartography */

.ocean { fill: url(#ocean); }

.graticule {
  fill: none;
  stroke: #f0e6d2;
  stroke-opacity: 0.055;
  stroke-width: 0.8;
}

/* Land is drawn in two passes: a filled body, then a bright coastline on top, so
   the shoreline reads as ink rather than as the edge of a fill. */
.land { fill: url(#landFill); }

.coast {
  fill: none;
  stroke: #b39a63;
  stroke-opacity: 0.62;
  stroke-width: 0.9;
  stroke-linejoin: round;
}

.inland-water { fill: #101a22; stroke: #6f8496; stroke-opacity: 0.35; stroke-width: 0.7; }

.world-edge {
  fill: none;
  stroke: #7d6b45;
  stroke-opacity: 0.45;
  stroke-width: 1.6;
}

.route {
  stroke: #cbb27a;
  stroke-opacity: 0.16;
  stroke-width: 0.9;
  stroke-dasharray: 5 7;
  fill: none;
}

/* Region markers */

.marker { cursor: pointer; }

.marker-seat {
  fill: #07080a;
  stroke: #d8cbab;
  stroke-opacity: 0.3;
  stroke-width: 0.8;
}

.marker-dot { stroke: #07080a; stroke-width: 1.2; transition: r 140ms ease-out; }
.marker:hover .marker-dot { stroke: #fff; stroke-width: 1.6; }
.marker:focus-visible { outline: none; }
.marker:focus-visible .marker-seat { stroke: #fff; stroke-opacity: 1; }

.marker[data-status='free'] .marker-dot { fill: #8d9099; }
.marker[data-status='destabilized'] .marker-dot {
  fill: #d9a521;
  filter: url(#markerGlow);
}
.marker[data-status='puppet'] .marker-dot { fill: #3a1f27; stroke: #e01b3c; stroke-width: 2.4; }
.marker[data-status='occupied'] .marker-dot {
  fill: #8f1226;
  stroke: #ff3355;
  stroke-width: 1.4;
  stroke-dasharray: 3 2;
}
.marker[data-status='subjugated'] .marker-dot {
  fill: #e01b3c;
  stroke: #ff6b83;
  filter: url(#markerGlow);
}

.marker-label {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  fill: #a9a294;
  text-anchor: middle;
  pointer-events: none;
  font-weight: 700;
  paint-order: stroke;
  stroke: #05070a;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.marker-label.is-end { text-anchor: end; }
.marker-label.is-start { text-anchor: start; }
.marker[data-held='yes'] .marker-label { fill: #efe7d6; }
.marker.is-selected .marker-label { fill: #fff; }

.marker-ring { fill: none; stroke-linecap: butt; pointer-events: none; }
.ring-unrest { stroke: #f0b52c; stroke-width: 2.6; }
.ring-indoc { stroke: #ff3355; stroke-width: 2.6; }

.marker-select { fill: none; stroke: #fff; stroke-width: 1.4; stroke-dasharray: 5 4; }
.marker-reach { fill: none; stroke: #d8cbab; stroke-opacity: 0.4; stroke-width: 1; stroke-dasharray: 2 5; }
.marker-capital { fill: #f2c744; pointer-events: none; }

.legend-ring { background: transparent !important; border-width: 2px; border-radius: 50%; }

/* ─── Side panel ─────────────────────────────────────────────────────────── */

.side {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--panel);
  min-width: 0;
}

.tabs { display: flex; border-bottom: 1px solid var(--edge); background: #0e0e12; }

.tab {
  flex: 1;
  padding: 11px 6px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--ink-faint);
}
.tab:hover { color: var(--ink-dim); background: #131319; }
.tab.is-active { color: var(--ink); border-bottom-color: var(--red); background: var(--panel); }

.tab-badge {
  display: none;
  background: var(--ochre);
  color: #14100a;
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 4px;
  margin-left: 4px;
}
.tab-badge.is-on { display: inline; }

.panel { overflow-y: auto; padding: 14px; }

/* Region panel */

.rp-head { border-bottom: 1px solid var(--edge); padding-bottom: 10px; margin-bottom: 12px; }

.rp-name {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 21px;
  margin: 0 0 3px;
  line-height: 1.05;
}
.rp-sub {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--ink-faint);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  padding: 2px 7px;
  border: 1px solid var(--edge-hot);
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9.5px;
}
.chip[data-status='free'] { color: var(--ink-dim); border-color: var(--slate); }
.chip[data-status='destabilized'] { color: var(--ochre); border-color: var(--ochre-deep); }
.chip[data-status='puppet'],
.chip[data-status='occupied'] { color: var(--red-glow); border-color: var(--red-deep); }
.chip[data-status='subjugated'] { color: #fff; background: var(--red-deep); border-color: var(--red); }
.chip.is-capital { color: var(--ochre); border-color: var(--ochre); }

.rp-blurb { font-size: 12.5px; line-height: 1.55; color: var(--ink-dim); margin: 0 0 14px; font-style: italic; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--edge); margin-bottom: 14px; }

.stat { background: #0e0e13; padding: 7px 9px; }
.stat-k {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9px;
  color: var(--ink-faint);
}
.stat-v { font-family: var(--mono); font-size: 14px; margin-top: 1px; }
.stat-v.is-hidden { color: var(--ink-faint); font-style: italic; font-family: var(--body); font-size: 12px; }
.stat-bar { height: 3px; background: #22222b; margin-top: 5px; }
.stat-bar span { display: block; height: 100%; background: var(--ink-faint); }
.stat[data-tone='unrest'] .stat-bar span { background: var(--ochre); }
.stat[data-tone='indoc'] .stat-bar span { background: var(--red); }
.stat[data-tone='stability'] .stat-bar span { background: #4b93d6; }
.stat[data-tone='sympathy'] .stat-bar span { background: var(--green); }

.section-title {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--edge);
  padding-bottom: 5px;
  margin: 16px 0 9px;
}
.section-title:first-child { margin-top: 0; }

/* Action buttons */

.actions { display: flex; flex-direction: column; gap: 6px; }

.action {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 9px;
  align-items: start;
  text-align: left;
  padding: 9px 10px;
  background: #15151b;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--edge-hot);
}
.action:hover:not(:disabled) { background: #1e1e26; border-left-color: var(--red); }
.action:disabled { opacity: 0.45; border-left-color: #222; }

.action-glyph { font-size: 16px; color: var(--red-glow); text-align: center; line-height: 1.2; }
.action:disabled .action-glyph { color: var(--ink-faint); }

.action-name {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12.5px;
}
.action-detail { font-size: 11px; color: var(--ink-dim); line-height: 1.45; margin-top: 2px; }
.action-reason { font-size: 11px; color: var(--ochre); line-height: 1.45; margin-top: 2px; }

.action-cost { text-align: right; white-space: nowrap; }
.action-cost .cost { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); display: block; }
.action-cost .ap-cost {
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--red-glow);
  display: block;
  margin-top: 2px;
}

/* Doctrine tree */

.tier { margin-bottom: 18px; }

.tier-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.tier-name {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
}
.tier-cost { font-family: var(--mono); font-size: 11px; color: var(--ochre); }
.tier-lock { font-size: 10.5px; color: var(--ink-faint); margin-left: auto; }
.tier.is-locked .tier-name { color: var(--ink-faint); }

.doctrine {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  margin-bottom: 5px;
  background: #15151b;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--edge-hot);
}
.doctrine:hover:not(:disabled) { background: #1e1e26; }
.doctrine.can-buy { border-left-color: var(--ochre); background: #17140d; }
.doctrine.can-buy:hover { background: #221c10; }
.doctrine.is-owned { border-left-color: var(--red); background: #16101300; opacity: 0.92; }
.doctrine:disabled:not(.is-owned) { opacity: 0.5; }

.doctrine-name {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 12.5px;
  display: flex;
  gap: 7px;
  align-items: baseline;
}
.doctrine.is-owned .doctrine-name::before { content: '★'; color: var(--red); }
.doctrine-effect { font-size: 11px; color: var(--ink-dim); line-height: 1.45; margin-top: 3px; }
.doctrine-flavour { font-size: 10.5px; color: var(--ink-faint); font-style: italic; margin-top: 4px; line-height: 1.4; }
.doctrine-block { font-size: 10.5px; color: var(--ochre); margin-top: 4px; }

/* Bulletin log */

.log { display: flex; flex-direction: column; gap: 1px; }

.log-line {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.5;
  background: #0f0f14;
  border-left: 2px solid var(--edge);
}
.log-turn { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); padding-top: 2px; }
.log-line[data-kind='great'] { border-left-color: var(--red); background: #150d11; }
.log-line[data-kind='good'] { border-left-color: var(--green); }
.log-line[data-kind='bad'] { border-left-color: var(--ochre); background: #14100a; }
.log-line[data-kind='doctrine'] { border-left-color: var(--ochre); }
.log-line[data-kind='edict'] { border-left-color: #4b93d6; }
.log-line[data-kind='notice'] {
  border-left-color: var(--red-glow);
  background: #1a0d12;
  color: var(--ink);
}
.log-line[data-kind='notice'] .log-turn { color: var(--red-glow); }

.log-line[data-kind='turn'] {
  border-left-color: transparent;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--display);
  letter-spacing: 0.16em;
  font-size: 10px;
  padding-top: 10px;
}

.empty { color: var(--ink-faint); font-size: 12.5px; line-height: 1.6; font-style: italic; }

/* ─── Bottom bar ─────────────────────────────────────────────────────────── */

.bottombar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  background: linear-gradient(0deg, #131319, #0d0d11);
  border-top: 1px solid var(--edge);
}

.global-actions { display: flex; gap: 7px; flex: 1; min-width: 0; overflow-x: auto; }

.gbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #16161d;
  border: 1px solid var(--edge);
  border-bottom: 2px solid var(--edge-hot);
  white-space: nowrap;
}
.gbtn:hover:not(:disabled) { background: #20202a; border-bottom-color: var(--red); }
.gbtn:disabled { opacity: 0.42; }
.gbtn-glyph { color: var(--red-glow); font-size: 14px; }
.gbtn:disabled .gbtn-glyph { color: var(--ink-faint); }
.gbtn-name {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 11.5px;
}
.gbtn-cost { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }

/* ─── Modals ─────────────────────────────────────────────────────────────── */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(4 4 6 / 88%);
  overflow-y: auto;
}

/* A `display` declaration in a class rule beats the UA sheet's `[hidden]`, so the
   overlay must be hidden explicitly or it veils the board and eats every click. */
.modal-root[hidden] { display: none; }

.card {
  width: min(680px, 100%);
  background: var(--panel-2);
  border: 1px solid var(--edge-hot);
  box-shadow: 0 30px 90px rgb(0 0 0 / 80%), 0 0 0 1px rgb(224 27 60 / 12%);
}

.card-band {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: linear-gradient(90deg, var(--red-deep), #2a0d15 70%);
  border-bottom: 1px solid var(--red-deep);
}
.card-sigil { font-size: 22px; color: var(--ink); }
.card-speaker {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
}
.card-tag {
  margin-left: auto;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 9.5px;
  color: rgb(255 255 255 / 55%);
}

.card-body { padding: 22px 24px; }
.card-text { font-size: 15px; line-height: 1.65; margin: 0 0 20px; }

.choices { display: grid; gap: 9px; }

.choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  background: #14141a;
  border: 1px solid var(--edge);
  border-left: 3px solid var(--red-deep);
}
.choice:hover { background: #1f1f28; border-left-color: var(--red-glow); }
.choice-label {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 14.5px;
}
.choice-detail { font-family: var(--mono); font-size: 11.5px; color: var(--ochre); margin-top: 4px; }

/* Start screen */

.start-title {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: clamp(34px, 7vw, 62px);
  margin: 0;
  line-height: 0.95;
  text-align: center;
  color: var(--ink);
  text-shadow: 0 0 40px rgb(224 27 60 / 35%);
}
.start-tagline {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 11px;
  color: var(--red);
  text-align: center;
  margin: 8px 0 22px;
}
.start-intro { font-size: 13px; line-height: 1.7; color: var(--ink-dim); margin: 0 0 20px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  color: var(--ink-faint);
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  padding: 9px 11px;
  background: #0d0d11;
  border: 1px solid var(--edge-hot);
  color: var(--ink);
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 15px;
}
.field input:focus { outline: 0; border-color: var(--red); }

.capitals { display: grid; gap: 8px; }

.capital {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  background: #14141a;
  border: 1px solid var(--edge);
  border-left: 3px solid var(--edge-hot);
}
.capital:hover { background: #1f1f28; }
.capital.is-chosen { border-left-color: var(--red); background: #1b1319; }
.capital-name {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.capital-stats { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); margin-left: auto; }
.capital-pitch { font-size: 11.5px; color: var(--ink-dim); line-height: 1.5; margin-top: 4px; }

/* Ending */

.ending-title {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: clamp(30px, 6vw, 52px);
  margin: 0 0 4px;
  line-height: 1;
}
.ending-title.is-win { color: var(--red-glow); text-shadow: 0 0 40px rgb(224 27 60 / 55%); }
.ending-title.is-loss { color: var(--ink-dim); }
.ending-kicker {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 10px;
  color: var(--ink-faint);
  margin-bottom: 18px;
}
.ending-text { font-size: 14.5px; line-height: 1.75; color: var(--ink-dim); margin: 0 0 20px; }

.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--edge); margin-bottom: 20px; }
.tally-cell { background: #0e0e13; padding: 9px 10px; }
.tally-k {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9px;
  color: var(--ink-faint);
}
.tally-v { font-family: var(--mono); font-size: 17px; margin-top: 2px; }

.card-foot { display: flex; gap: 9px; justify-content: flex-end; padding: 14px 24px; border-top: 1px solid var(--edge); background: #101014; }

.menu-list { display: grid; gap: 8px; }
.menu-note { font-size: 12px; color: var(--ink-faint); line-height: 1.6; margin: 12px 0 0; }

.help dl { margin: 0; }
.help dt {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  color: var(--ink);
  margin-top: 12px;
}
.help dd { margin: 3px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-dim); }
.help dt:first-child { margin-top: 0; }

/* ─── Narrow layouts ─────────────────────────────────────────────────────── */

@media (width <= 1080px) {
  html, body { overflow: auto; }
  body { grid-template-rows: auto auto auto auto; height: auto; min-height: 100%; }
  .stage { grid-template-columns: 1fr; }
  .mapwrap { border-right: 0; border-bottom: 1px solid var(--edge); }
  .map { max-height: none; }
  .side { grid-template-rows: auto auto; }
  .panel { max-height: none; overflow: visible; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 12px; }
  .resources { margin-left: 0; flex-wrap: wrap; }
  .bottombar { flex-wrap: wrap; padding: 10px 14px; height: auto; }
  /* Wrap rather than scroll: a clipped Coalition meter hides the thing most likely
     to end the run. */
  .meters { flex-wrap: wrap; overflow-x: visible; padding: 8px 14px; gap: 8px 22px; }
  .meter-label { width: auto; }
}

/* ─── Optional artwork ───────────────────────────────────────────────────────
   Every slot below is empty until the corresponding file exists in assets/. The
   <img> deletes itself on a 404, so these rules simply stop applying and the
   typographic treatment underneath is what the player sees. Nothing breaks, and
   the set can be filled in one asset at a time.
   ────────────────────────────────────────────────────────────────────────────── */

.edict-figure,
.ending-figure,
.title-figure { margin: 0; display: contents; }

/* Edict card: portrait to the left of the text, once a portrait exists. */
.edict-body { display: block; }

.edict-portrait {
  display: block;
  width: 100%;
  border: 1px solid var(--edge-hot);
  background: #0b0b0e;
  filter: saturate(0.9) contrast(1.04) brightness(1.08);
}

.card-edict[data-has-art] .edict-body {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.card-edict[data-has-art] .edict-figure {
  display: block;
  position: relative;
}
/* A hard inner shadow marries the painted edge to the panel it sits on. */
.card-edict[data-has-art] .edict-figure::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 28px rgb(0 0 0 / 70%);
  pointer-events: none;
}

.ending-art,
.title-art { display: block; width: 100%; height: 100%; object-fit: cover; }

.card[data-has-art] .ending-figure {
  display: block;
  height: 200px;
  overflow: hidden;
  border-bottom: 1px solid var(--red-deep);
  /* Fades the illustration down into the panel rather than butting against it. */
  mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}

.card[data-has-art] .title-figure {
  display: block;
  height: 216px;
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 40%, transparent 100%);
}
.card[data-has-art] .title-figure + .card-body { margin-top: -104px; position: relative; }

@media (width <= 720px) {
  .card-edict[data-has-art] .edict-body { grid-template-columns: 1fr; }
  .card-edict[data-has-art] .edict-portrait { max-width: 200px; }
}

/* ─── Heraldry ───────────────────────────────────────────────────────────────
   Drawn insignia (src/ui/insignia.js), sized by context. They inherit
   `currentColor`, so each context tints them by setting colour on the parent.
   ────────────────────────────────────────────────────────────────────────────── */

.crest, .seal { display: block; }

/* Topbar wordmark */
.brand-mark {
  display: flex;
  align-items: center;
  color: var(--red);
  filter: drop-shadow(0 0 9px rgb(224 27 60 / 55%));
  align-self: center;
}
.brand-mark .crest { width: 26px; height: 26px; }

/* Edict / ending / menu band */
.card-sigil { display: flex; align-items: center; color: var(--ink); }
.card-sigil .seal, .card-sigil .crest { width: 30px; height: 30px; }
.card-sigil .skull { font-size: 22px; line-height: 1; }

/* Start screen */
.start-crest {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  color: var(--red);
  filter: drop-shadow(0 0 26px rgb(224 27 60 / 45%));
}
.start-crest .crest { width: 62px; height: 62px; }
