* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #1a1c1f;
  color: #d4d6d9;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: #1a1c1f;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 13px;
  z-index: 100;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Every header control gets real button chrome — several are injected at
   runtime with no class, so this covers them all uniformly. */
.header button {
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #777;
  border-radius: 3px;
  background: #2a2d31;
  color: #eee;
  white-space: nowrap;
  line-height: 1.5;
}

.header button:hover {
  background: #444;
  border-color: #999;
}

.scenario-name {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.off-map-note {
  color: #999;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.unit-counts {
  color: #bbb;
  font-size: 12px;
  white-space: nowrap;
}

.viewport {
  position: fixed;
  top: 44px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: auto;
  background: #111;
  cursor: grab;
  user-select: none;
}

.viewport.grabbing {
  cursor: grabbing;
}

.board {
  position: absolute;
  top: 0;
  left: 0;
  width: 3338px;
  height: 2569px;
  transform-origin: 0 0;
  will-change: transform;
}

.map-art {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.map-art.hidden {
  display: none;
}

#terrain-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

:root {
  /* Synced from app.js syncCounterGeometry() — ~0.77 × hex circumradius (~34px default). */
  --counter-size: 34px;
}

.counter {
  position: absolute;
  width: var(--counter-size);
  height: var(--counter-size);
  transform: translate(-50%, -50%);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  border: 0;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  overflow: visible;
  z-index: 10;
  user-select: none;
  pointer-events: none;
}

.counter-face {
  display: block;
  width: var(--counter-size);
  height: var(--counter-size);
  border-radius: 2px;
}

.counter.german {
  background: #6b7065;
  color: #f5f5f5;
  border-color: #4a4d45;
}

.counter.russian {
  background: #b8a172;
  color: #1a1c1f;
  border-color: #8c734d;
}

/* GotA faction counter fills — hue-matched to GOTA_VP_FACTION_COLORS,
   muted to printed-counter weight; solid so they read over the map raster. */
.counter.USA {
  background: #3d6a99;
  color: #f5f5f5;
  border-color: #2c4d70;
}

.counter.CSA {
  background: #a8752f;
  color: #16181b;
  border-color: #7d5722;
}

.counter.MEX {
  background: #4a8a4a;
  color: #f5f5f5;
  border-color: #346334;
}

.counter.CAN {
  background: #a04f4f;
  color: #f5f5f5;
  border-color: #713838;
}

.popup-dot.USA { background: #4aa3ff; }
.popup-dot.CSA { background: #e09535; }
.popup-dot.MEX { background: #50c850; }
.popup-dot.CAN { background: #c95a5a; }

.counter.disrupted {
  filter: grayscale(60%) brightness(0.85);
}

/* entry 16 lock 2026-07-12: Pocketed marker — an encircled force held in place. */
.counter.pocketed {
  box-shadow: 0 0 0 2px #d94f8a, 0 1px 3px rgba(0, 0, 0, 0.6);
}
.pocket-badge {
  position: absolute;
  bottom: -6px;
  left: -6px;
  padding: 0 4px;
  height: 12px;
  border-radius: 6px;
  background: #d94f8a;
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  line-height: 12px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  pointer-events: none;
}

.status-dot {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e74c3c;
  box-shadow: 0 0 3px rgba(231, 76, 60, 0.7);
  pointer-events: none;
}

.counter.disrupted .status-dot {
  display: block;
}

.stack-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  border-radius: 7px;
  background: #c0392b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  z-index: 15;
  pointer-events: none;
}

.hex-zone {
  position: absolute;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  pointer-events: auto;
  z-index: 20;
  cursor: help;
}

.hex-zone:hover {
  background: rgba(255, 255, 255, 0.08);
}

.popup {
  position: fixed;
  z-index: 1000;
  max-width: 320px;
  background: #1a1c1f;
  color: #d4d6d9;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 8px 10px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  opacity: 1;
}

.popup.hidden {
  opacity: 0;
}

.popup-header {
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  border-bottom: 1px solid #444;
  padding-bottom: 4px;
}

.popup-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 5px 0;
}

.popup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.popup-dot.german {
  background: #6b7065;
}

.popup-dot.russian {
  background: #b8a172;
}

.popup-info {
  flex: 1;
}

.popup-notes {
  color: #888;
  font-size: 10px;
  margin-top: 2px;
}

.popup-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 2px;
  background: #2c3e50;
  color: #ecf0f1;
  margin-left: 4px;
}

.popup-tag.disrupted {
  background: #7b241c;
}

.phase-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-size: 13px;
}
.phase-hud span {
  font-weight: 600;
}
.phase-hud button {
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #888;
  border-radius: 3px;
  background: #222;
  color: #eee;
}
.phase-hud button:hover {
  background: #444;
}
/* ── Counter national markings + disrupted clarity ───────────────────── */
.counter.german::after {
  content: "+";
  position: absolute;
  bottom: 1px;
  left: 2px;
  font-size: 6px;
  color: rgba(0, 0, 0, 0.5);
  font-weight: 900;
  pointer-events: none;
}

.counter.russian::after {
  content: "○";
  position: absolute;
  bottom: 1px;
  left: 2px;
  font-size: 6px;
  color: rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.counter.disrupted {
  border-left: 2px solid #c0392b;
}

/* ── Phase HUD national color coding ──────────────────────────────────── */
.phase-hud.hud-USA {
  border-left: 4px solid #4aa3ff;
}
.phase-hud.hud-CSA {
  border-left: 4px solid #e09535;
}
.phase-hud.hud-MEX {
  border-left: 4px solid #50c850;
}
.phase-hud.hud-CAN {
  border-left: 4px solid #c95a5a;
}
#hud-turn {
  font-size: 11px;
  color: #c8cacd;
  font-weight: 400;
}
#hud-phase {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
#hud-vp {
  color: #c8cacd;
  font-size: 11px;
  font-weight: 400;
}
.phase-hud.hud-USA #hud-side {
  color: #4aa3ff;
}
.phase-hud.hud-CSA #hud-side {
  color: #e09535;
}
.phase-hud.hud-MEX #hud-side {
  color: #50c850;
}
.phase-hud.hud-CAN #hud-side {
  color: #c95a5a;
}

/* guns-038 / entry 1 lock 2026-07-12 — two sides with CSA allied-pool badges */
.hud-turn-order {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border: 1px solid rgba(168, 144, 96, 0.55);
  background: linear-gradient(180deg, rgba(58, 46, 30, 0.72), rgba(32, 26, 18, 0.78));
  box-shadow: inset 0 1px 0 rgba(240, 230, 208, 0.08);
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.4;
  white-space: nowrap;
  flex: none;
}
.hud-turn-order__seat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hud-turn-order__sep {
  color: rgba(168, 144, 96, 0.45);
  font-weight: 400;
  padding: 0 1px;
  user-select: none;
}
.hud-turn-order__faction {
  font-weight: 600;
  padding: 1px 3px;
  border-radius: 1px;
  border: 1px solid transparent;
  color: #b8a888;
}
.hud-turn-order__faction.is-done {
  opacity: 0.32;
  color: #8a7a60;
  font-weight: 500;
}
.hud-turn-order__faction.is-pending {
  opacity: 0.78;
  color: #c8b890;
}
.hud-turn-order__faction.is-active {
  opacity: 1;
  font-weight: 800;
  color: #f0e6d0;
  background: rgba(168, 120, 48, 0.28);
  border-color: rgba(168, 144, 96, 0.7);
  box-shadow: 0 0 0 1px rgba(240, 230, 208, 0.12);
}
.hud-turn-order__faction--USA.is-active { color: #7ec0ff; border-color: rgba(74, 163, 255, 0.55); }
.hud-turn-order__faction--CSA.is-active { color: #f0b060; border-color: rgba(224, 149, 53, 0.55); }
.hud-turn-order__allies {
  display: flex;
  gap: 3px;
  margin-top: 1px;
  font-size: 7px;
  line-height: 1;
  letter-spacing: 0.04em;
}
.hud-turn-order__ally { opacity: 0.85; }
.hud-turn-order__ally--CAN { color: #e08080; }
.hud-turn-order__ally--MEX { color: #78d878; }
.hud-turn-order__ally.is-locked { color: #777; opacity: 0.45; filter: grayscale(1); }

#legal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}
.legal-hex-dot {
  position: absolute;
  pointer-events: all;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  border-radius: 50%;
  background: rgba(80, 200, 80, 0.45);
  border: 2px solid rgba(80, 200, 80, 0.85);
  cursor: pointer;
  z-index: 15;
}
.legal-hex-dot:hover {
  background: rgba(80, 200, 80, 0.75);
}
/* guns-014 — whole-stack move mode: gold instead of green, so the whole-force
   order is visually distinct from a single-unit move. */
.legal-hex-dot.stack-move {
  background: rgba(210, 165, 60, 0.5);
  border-color: rgba(210, 165, 60, 0.9);
}
.legal-hex-dot.stack-move:hover {
  background: rgba(210, 165, 60, 0.8);
}

/* guns-037 — hovered cheapest-path trail (flat-top hex, period-map ochre ink) */
.path-hex-highlight {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 14;
  background: rgba(168, 120, 48, 0.42);
  /* flat-top hex matching hexPolygon vertices at 0°,60°,… */
  clip-path: polygon(
    100% 50%,
    75% 6.7%,
    25% 6.7%,
    0% 50%,
    25% 93.3%,
    75% 93.3%
  );
  box-shadow: inset 0 0 0 1.5px rgba(110, 72, 28, 0.75);
}

/* guns-037 — MP cost label on hovered destination */
.path-cost-label {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 16;
  font: 700 10px/1 "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: #f0e6d0;
  background: rgba(40, 28, 16, 0.86);
  border: 1px solid rgba(168, 120, 48, 0.65);
  padding: 2px 4px;
  border-radius: 2px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* ── ZOC overlay (enemy zone-of-control indicators) ────────────────────── */
#zoc-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}
.zoc-hex-marker {
  position: absolute;
  pointer-events: none;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
  border-radius: 50%;
  background: rgba(255, 60, 60, 0.12);
  border: 1.5px solid rgba(255, 60, 60, 0.45);
  z-index: 10;
}
.counter.selected {
  outline: 2px solid yellow;
  outline-offset: 1px;
  z-index: 20;
}

/* ── Combat highlights (Phase 3b) ─────────────────────────────────────── */
.counter.attacker {
  outline: 2px solid #4aa3ff;
  outline-offset: 1px;
  box-shadow: 0 0 6px 2px rgba(74, 163, 255, 0.75);
  z-index: 20;
}
.counter.defender {
  outline: 2px solid #ff5252;
  outline-offset: 1px;
  box-shadow: 0 0 6px 2px rgba(255, 82, 82, 0.75);
  z-index: 20;
}

/* ── Combat preview / result panel ────────────────────────────────────── */
.combat-panel {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1100;
  width: 420px;
  max-width: calc(100vw - 24px);
  background: #1a1c1f;
  color: #d4d6d9;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 12px 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
}
.combat-panel.hidden {
  display: none;
}
.combat-panel-header {
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}
.combat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 3px 0;
}
.combat-row > span:last-child {
  text-align: right;
  word-break: break-word;
}
.combat-label {
  color: #9aa0a6;
  flex-shrink: 0;
}
.combat-drm-note {
  display: block;
  color: #888;
  font-size: 10px;
  margin-top: 4px;
}
.combat-result {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #444;
}
.combat-result-code {
  font-weight: 700;
  color: #ffd24a;
}
.combat-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.combat-buttons button {
  flex: 1;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #888;
  border-radius: 3px;
  background: #222;
  color: #eee;
}
.combat-buttons button:hover {
  background: #444;
}
.combat-buttons button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#combat-resolve {
  border-color: #4aa3ff;
}
#combat-advance {
  border-color: #50c850;
}
.combat-band {
  color: #ffd24a;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* guns-016 — DRM breakdown + per-die outcome row (TWU twu-018 pattern) */
.combat-drm-block {
  border-top: 1px solid #444;
  margin-top: 4px;
  padding-top: 4px;
}
.combat-drm-line {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #9aa0a6;
  padding: 1px 0;
  gap: 8px;
}
.combat-drm-line .drm-val {
  color: #d4d6d9;
  font-weight: 700;
}
.combat-drm-total {
  font-weight: 700;
  font-size: 10px;
  color: #ffd24a;
  text-align: right;
  padding-top: 2px;
}
.combat-outcome-row {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.combat-outcome-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 22px;
  font-size: 9px;
  padding: 2px 2px;
  border: 1px solid #444;
  border-radius: 2px;
}
.combat-outcome-cell .die-face {
  font-weight: 700;
  color: #888;
}
.combat-outcome-cell .die-result {
  font-weight: 700;
  color: #d4d6d9;
}
.combat-outcome-cell.r-de .die-result { color: #c8584a; }
.combat-outcome-cell.r-ae .die-result { color: #8fa6c4; }
.combat-outcome-cell.r-ex .die-result { color: #ffd24a; }
.combat-outcome-cell.r-d .die-result { color: #e09535; }
.combat-outcome-cell.r-a .die-result { color: #4aa3ff; }

/* ── Turn / phase tracker overlay ─────────────────────────────────────── */
.turn-overlay {
  position: fixed;
  top: 50px;
  right: 12px;
  z-index: 1050;
  width: 200px;
  background: #1a1c1f;
  color: #d4d6d9;
  border: 1px solid #555;
  border-left: 4px solid #888;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  user-select: none;
}
.turn-overlay-season {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  margin-bottom: 6px;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}
.turn-overlay-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0;
}
.turn-overlay-row > span:last-child {
  text-align: right;
  color: #fff;
}
.turn-overlay-label {
  color: #9aa0a6;
}
.turn-overlay-reinforcements {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #444;
  color: #9aa0a6;
  font-size: 11px;
}

/* ── Theater card-hand overlay (guns card-hand UI) ─────────────────────── */
.card-hand-overlay {
  position: fixed;
  left: 12px;
  bottom: 16px;
  z-index: 1100;
  width: 240px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #1a1c1f;
  color: #d4d6d9;
  border: 1px solid #555;
  border-left: 4px solid #888;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  user-select: none;
}
.card-hand-overlay.hidden {
  display: none;
}
.card-hand-overlay-header {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  margin-bottom: 6px;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}
.card-hand-overlay-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0;
}
.card-hand-overlay-row > span:last-child {
  text-align: right;
  color: #fff;
}
.card-hand-overlay-label {
  color: #9aa0a6;
}
.card-hand-empty {
  margin: 8px 0;
  color: #9aa0a6;
  font-size: 11px;
  text-align: center;
}
.card-hand-tiles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}
.card-tile {
  background: #23262b;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 6px 8px;
}
.card-tile-theater {
  font-weight: 700;
  color: #fff;
  font-size: 12px;
}
.card-tile-intensity {
  color: #9aa0a6;
  font-size: 11px;
  margin-top: 1px;
}
.card-tile-title {
  font-weight: 700;
  color: #e8eaed;
  font-size: 12px;
  margin-bottom: 2px;
}
.card-tile-snippet {
  color: #b8bcc2;
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.35;
}
.card-tile-effect {
  color: #d4d6d9;
  font-size: 11px;
  margin-top: 3px;
}
.card-tile-actions {
  display: flex;
  gap: 6px;
  margin-top: 5px;
}
.card-hand-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  border-top: 1px solid #444;
  padding-top: 6px;
}
.card-hand-btn {
  flex: 1;
  background: #2c3036;
  color: #d4d6d9;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 3px 6px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.card-hand-btn:hover:not(:disabled) {
  background: #3a3f47;
  color: #fff;
}
.card-hand-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.card-hand-feedback {
  margin: 6px 0 2px;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 3px;
}
.card-hand-feedback--error {
  background: #3a1f1f;
  color: #f0b4b4;
  border: 1px solid #6a3030;
}
.card-hand-feedback--ok {
  background: #1f3a28;
  color: #b8e0c2;
  border: 1px solid #306a40;
}
.card-hand-target {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #444;
}
.card-hand-target-title {
  font-size: 11px;
  color: #c8cad0;
  margin-bottom: 4px;
}
.card-hand-select {
  background: #2c3036;
  color: #d4d6d9;
  border: 1px solid #555;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  padding: 2px 4px;
  max-width: 160px;
}

/* ── Build-point expenditure panel ─────────────────────────────────────── */
.production-panel {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1150;
  width: 420px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #1a1c1f;
  color: #d4d6d9;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 12px 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
}
.production-panel.hidden {
  display: none;
}
.production-panel-header {
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}
.production-bp-summary {
  margin-bottom: 8px;
}
.production-bp-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 3px 0;
}
.production-bp-row > span:last-child {
  text-align: right;
  color: #fff;
}
.production-bp-label {
  color: #9aa0a6;
}
.production-bp-total {
  font-weight: 700;
  color: #ffd24a;
}
.production-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #444;
}
.production-section-title {
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.production-input-row {
  display: flex;
  gap: 6px;
  margin: 3px 0;
  align-items: center;
}
.production-input-row input,
.production-input-row select {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font-size: 12px;
  background: #111;
  color: #d4d6d9;
  border: 1px solid #555;
  border-radius: 3px;
}
.production-input-row input[type="number"] {
  max-width: 60px;
  flex: 0 0 60px;
}
.production-cost-tag {
  color: #9aa0a6;
  font-size: 10px;
  white-space: nowrap;
}
.production-queue {
  margin: 4px 0;
}
.production-queue-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
  padding: 2px 4px;
  background: #222;
  border-radius: 3px;
  font-size: 11px;
}
.production-queue-item button {
  padding: 1px 6px;
  font-size: 10px;
  cursor: pointer;
  border: 1px solid #666;
  border-radius: 2px;
  background: #333;
  color: #ccc;
}
.production-queue-empty {
  color: #666;
  font-size: 11px;
  font-style: italic;
}
.production-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.production-buttons button {
  flex: 1;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #888;
  border-radius: 3px;
  background: #222;
  color: #eee;
}
.production-buttons button:hover {
  background: #444;
}
.production-buttons button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#production-spend {
  border-color: #4aa3ff;
}
.production-result {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #444;
}
.production-result-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 3px 0;
}
.production-result-row > span:last-child {
  text-align: right;
  word-break: break-word;
}
.production-result-code {
  font-weight: 700;
  color: #50c878;
}
.production-rejected {
  color: #ff5252;
  font-size: 11px;
}
.production-note {
  color: #888;
  font-size: 10px;
  margin-top: 4px;
}

/* ── Stack inspection panel ────────────────────────────────────────────── */
.stack-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1100;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #1a1c1f;
  color: #d4d6d9;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 12px 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
}
.stack-panel.hidden {
  display: none;
}
.stack-panel-header {
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}
.stack-panel-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  padding: 3px 0;
  border-bottom: 1px solid #333;
}
.stack-panel-row:last-of-type {
  border-bottom: none;
}
.stack-panel-info {
  flex: 1;
}
.stack-panel-leader {
  color: #ffd24a;
  font-size: 11px;
  margin-top: 2px;
}
.stack-panel-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.stack-panel-buttons button {
  flex: 1;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #888;
  border-radius: 3px;
  background: #222;
  color: #eee;
}
.stack-panel-buttons button:hover {
  background: #444;
}

/* ── VP / objective-control summary panel ──────────────────────────────── */
.vp-panel {
  position: fixed;
  bottom: 16px;
  left: 12px;
  z-index: 1050;
  width: 270px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #1a1c1f;
  color: #d4d6d9;
  border: 1px solid #555;
  border-left: 4px solid #50c878;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
}
.vp-panel-header {
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}
.vp-panel.collapsed .vp-panel-header {
  border-bottom: none;
}
.vp-panel.expanded .vp-panel-header {
  margin-bottom: 8px;
}
.vp-section {
  margin-top: 8px;
  padding-top: 5px;
  border-top: 1px solid #444;
  color: #9aa0a6;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.vp-faction-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}
.vp-faction-name {
  font-weight: 700;
  flex-shrink: 0;
  min-width: 36px;
}
.vp-value {
  text-align: right;
  color: #fff;
}
.vp-progress {
  flex: 1;
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
  max-width: 80px;
}
.vp-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.vp-objective-row {
  display: flex;
  gap: 8px;
  margin: 2px 0;
  align-items: baseline;
}
.vp-faction-tag {
  font-weight: 700;
  flex-shrink: 0;
  min-width: 36px;
}
.vp-objective-detail {
  color: #d4d6d9;
  word-break: break-word;
  font-size: 11px;
}
.vp-blockade-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
}
.vp-blockade-label {
  color: #9aa0a6;
}
.vp-blockade-level {
  color: #fff;
  letter-spacing: 0.08em;
}
.vp-collapse-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
  align-items: baseline;
}
.vp-collapse-status {
  text-align: right;
  color: #fff;
  font-size: 11px;
}
.vp-warn {
  color: #ffd24a;
}
.vp-victory-won {
  color: #50c878;
  font-weight: 700;
  margin: 4px 0;
}
.vp-victory-reason {
  color: #9aa0a6;
  font-size: 11px;
  margin-bottom: 4px;
}
.vp-victory-pending {
  color: #9aa0a6;
  margin: 4px 0;
}
.vp-muted {
  color: #666;
  font-style: italic;
  font-size: 11px;
}
.vp-stub-note {
  margin-top: 8px;
  padding-top: 5px;
  border-top: 1px solid #444;
  color: #666;
  font-size: 10px;
  font-style: italic;
}

/* ── Nav controls (pan/zoom buttons) ─────────────────────────────── */
.nav-controls {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: rgba(26, 28, 31, 0.9);
  border: 1px solid #333;
  border-radius: 6px;
}
.nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-family: monospace;
  background: #2a2d31;
  color: #d4d6d9;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  user-select: none;
}
.nav-btn:hover {
  background: #3a3d41;
  border-color: #666;
}
.nav-btn:active {
  background: #1a1c1f;
}
.nav-dpad {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(2, 32px);
  gap: 2px;
  margin-top: 2px;
}
.nav-up { grid-column: 2; grid-row: 1; }
.nav-left { grid-column: 1; grid-row: 2; }
.nav-right { grid-column: 3; grid-row: 2; }
.nav-down { grid-column: 2; grid-row: 2; }

/* ── Supply-line visualization overlay ────────────────────────────────── */
.supply-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 5;
}
.supply-path-line {
  stroke: #50c878;
  stroke-width: 2;
  stroke-dasharray: 4 2;
  opacity: 0.7;
}
.supply-depot-marker {
  fill: #50c878;
  fill-opacity: 0.2;
  stroke: #50c878;
  stroke-width: 2;
}
/* entry 15 lock 2026-07-12: captured/home cities can be supply sources too. */
.supply-source-marker {
  fill: #50c878;
  fill-opacity: 0.2;
  stroke: #50c878;
  stroke-width: 2;
}
.supply-city-marker {
  fill-opacity: 0.12;
  stroke-dasharray: 3 2;
}
.counter.supply-ok {
  box-shadow: 0 0 0 2px #50c878, 0 1px 3px rgba(0, 0, 0, 0.6);
}
.counter.supply-no {
  box-shadow: 0 0 0 2px #e05050, 0 1px 3px rgba(0, 0, 0, 0.6);
}
#hud-supply.active {
  background: #50c878;
  color: #1a1c1f;
}

#hud-hotkeys {
  min-width: 28px;
  padding: 3px 8px;
  font-weight: 700;
}

/* Customer footer — bottom-right strip, left of .nav-controls; clear of left panels */
.app-footer {
  position: fixed;
  bottom: 8px;
  right: 130px; /* left of .nav-controls (~112px wide at right:16) */
  left: auto;
  z-index: 1215;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: min(360px, calc(100vw - 300px));
  text-align: right;
  font: 11px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: rgba(212, 214, 217, 0.72);
  pointer-events: none;
}
.app-footer a {
  pointer-events: auto;
  color: rgba(212, 214, 217, 0.88);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.app-footer a:hover {
  color: #eee;
}
.app-footer__brand {
  color: rgba(212, 214, 217, 0.62);
}
.app-footer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.app-footer__bug {
  font-size: 11px;
}

/* How to Play help panel */
.help-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 17, 17, 0.72);
}
.help-panel-overlay.open {
  display: flex;
}
.help-panel {
  width: min(480px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  background: #1a1c1f;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 14px 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
  font-size: 13px;
  line-height: 1.45;
  color: #d4d6d9;
}
.help-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.help-panel-title {
  margin: 0;
  font-size: 18px;
  color: #fff;
}
.help-panel-close {
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid #888;
  border-radius: 3px;
  background: #222;
  color: #eee;
}
.help-panel-close:hover {
  background: #444;
}
.help-panel-list {
  margin: 0;
  padding-left: 1.15em;
  display: grid;
  gap: 6px;
}
.help-panel-note {
  margin: 12px 0 0 0;
  color: #9aa0a6;
  font-size: 12px;
}
.help-panel-hotkeys {
  margin-top: 10px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #666;
  border-radius: 3px;
  background: #222;
  color: #ddd;
}
.help-panel-hotkeys:hover {
  background: #333;
}

/* About + phase-help modals (playtest-preview 2026-07-28) */
#about-btn {
  margin-left: 8px;
  flex-shrink: 0;
}
.hud-phase-btn {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.hud-phase-btn:hover {
  background: transparent;
  color: #fff;
}
#hud-phase-help {
  min-width: 1.6em;
  padding-left: 6px;
  padding-right: 6px;
  font-weight: 700;
}
.about-panel-overlay,
.phase-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 9400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 17, 17, 0.72);
}
.about-panel-overlay.open,
.phase-help-overlay.open {
  display: flex;
}
.about-panel,
.phase-help-panel {
  width: min(520px, 100%);
  max-height: min(85vh, 720px);
  overflow: auto;
  background: #1a1c1f;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 14px 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
  font-size: 13px;
  line-height: 1.45;
  color: #d4d6d9;
}
.about-panel-header,
.phase-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.about-panel-title,
.phase-help-title {
  margin: 0;
  font-size: 18px;
  color: #fff;
}
.about-panel-close,
.phase-help-close {
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid #888;
  border-radius: 3px;
  background: #222;
  color: #eee;
}
.about-panel-close:hover,
.phase-help-close:hover {
  background: #444;
}
.about-cover {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto 8px;
  border: 1px solid #444;
}
.about-cover-credit {
  margin: 0 0 12px 0;
  text-align: center;
  color: #9aa0a6;
  font-size: 12px;
}
.about-blurb {
  margin: 0;
  color: #d4d6d9;
}
.about-blurb p {
  margin: 0 0 0.7em 0;
}
.about-blurb p:last-child {
  margin-bottom: 0;
}
.phase-help-meta {
  margin: 0 0 10px 0;
  color: #9aa0a6;
  font-size: 12px;
}
.phase-help-section {
  margin: 0 0 10px 0;
}
.phase-help-section h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #fff;
}
.phase-help-section ul {
  margin: 0;
  padding-left: 1.15em;
  display: grid;
  gap: 4px;
}
.phase-help-sequence {
  margin: 10px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  color: #9aa0a6;
}
.phase-help-sequence li {
  padding: 2px 6px;
  border: 1px solid #444;
  border-radius: 3px;
}
.phase-help-sequence li.current {
  color: #fff;
  border-color: #888;
  background: #2a2e34;
}

/* First-visit onboarding notice */
.gota-toast-notice {
  position: fixed;
  z-index: 9200;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  background: #1a1c1f;
  border: 1px solid #555;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  padding: 12px 14px;
  color: #d4d6d9;
  font-size: 13px;
  line-height: 1.4;
}
.gota-toast-notice[hidden] {
  display: none !important;
}
.gota-reaction-notice {
  top: 56px;
  z-index: 9250;
}
.gota-reaction-notice .gota-reaction-rolls {
  margin: 0 0 10px 0;
  max-height: 40vh;
  overflow: auto;
}
.gota-onboarding-notice {
  top: 56px;
}
.gota-game-over-notice {
  top: 56px;
  border-color: #50c878;
  z-index: 9300;
}
.gota-game-over-notice .gota-toast-notice__text strong {
  color: #50c878;
  font-size: 15px;
}
.gota-toast-notice__text {
  margin: 0 0 10px 0;
}
.gota-toast-notice__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.gota-toast-notice__btn {
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #888;
  border-radius: 3px;
  background: #222;
  color: #eee;
}
.gota-toast-notice__btn:hover {
  background: #444;
}
.gota-toast-notice__btn--primary {
  border-color: #a89060;
  color: #f0e6d0;
}

/* guns-040: illegal-order feedback + keyboard focus + between-turn recap */
.order-feedback {
  position: fixed;
  z-index: 9100;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 24px));
  padding: 8px 12px;
  background: #2a1c1c;
  border: 1px solid #8a4a4a;
  border-radius: 4px;
  color: #f0d0d0;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.order-feedback--visible {
  opacity: 1;
}
.legal-hex-dot.keyboard-focus {
  outline: 2px solid #f0e6d0;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(240, 230, 208, 0.35);
}
.gota-activity-recap {
  margin: 0 0 10px 0;
  max-height: 36vh;
  overflow: auto;
  border: 1px solid #444;
  border-radius: 3px;
  background: #15171a;
  padding: 8px 10px;
}
.gota-activity-recap__header {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9aa0a6;
  margin-bottom: 6px;
}
.gota-activity-recap__list {
  margin: 0;
  padding-left: 18px;
  color: #d4d6d9;
  font-size: 12px;
  line-height: 1.45;
}
.gota-activity-recap__list li {
  margin-bottom: 3px;
}
.gota-activity-recap__empty {
  color: #9aa0a6;
  font-size: 12px;
}

/* ── Header/HUD chrome, unified (2026-07-11) ─────────────────────────────
   Placed last so it wins over the earlier .phase-hud button + .header button
   rules. The old values (#222/#2a2d31 fills on a #1a1c1f bar) were near-
   invisible; these are deliberately high-contrast so controls read as
   buttons at a glance. */
.header button,
.phase-hud button {
  padding: 3px 11px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #9aa0a8;
  border-radius: 3px;
  background: #3d434a;
  color: #f5f5f5;
  white-space: nowrap;
  line-height: 1.5;
  font-weight: 500;
}

.header button:hover,
.phase-hud button:hover {
  background: #4d545c;
  border-color: #c2c8d0;
}

/* Phase name is a help trigger, not a chrome button — keep label look. */
.phase-hud button.hud-phase-btn {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.phase-hud button.hud-phase-btn:hover {
  background: transparent;
  border-color: transparent;
  color: #fff;
}

#hud-turn, #hud-vp {
  color: #e8eaed;
}

.scenario-name {
  color: #fff;
}

/* ── Header layout discipline (2026-07-11): the bar's content can exceed the
   viewport; without these rules flex crushes the VP tally into a vertical
   column and lets text spans overflow into each other. ── */
.header { gap: 10px; }
.header-left, .header-right { flex: 0 1 auto; overflow: hidden; }
.phase-hud { flex: 0 0 auto; margin-left: auto; }
#hud-turn, #hud-side, #hud-phase { white-space: nowrap; }
.hud-turn-order { white-space: nowrap; }
#hud-vp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex: none;
}
#hud-vp > span { white-space: nowrap; }
.unit-counts { overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
@media (max-width: 1560px) { .unit-counts { display: none; } }
@media (max-width: 1280px) { .off-map-note { display: none; } }


/* guns-053 pre-game mobilization wizard */
.pregame-overlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: rgba(8, 10, 12, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pregame-overlay.hidden { display: none; }
.pregame-panel {
  width: min(560px, 94vw);
  max-height: 90vh;
  overflow: auto;
  background: #23262b;
  border: 1px solid #4a5058;
  padding: 20px 22px;
  color: #e6e8eb;
}
.pregame-panel h2 { margin: 0 0 10px; font-size: 1.25rem; }
.pregame-note, .pregame-lean { font-size: 0.9rem; line-height: 1.4; color: #b8bec6; }
.pregame-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pregame-actions button {
  background: #3a4048;
  color: #e6e8eb;
  border: 1px solid #5a616a;
  padding: 8px 12px;
  cursor: pointer;
}
.pregame-actions button.primary {
  background: #4a6fa5;
  border-color: #6a8fc0;
}
