/* ==========================================================================
   WORLD WAR SIMULATOR — modern operations console
   Dark editorial UI: near-black surfaces, mono metadata, faction red/blue.
   ========================================================================== */

@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/space-grotesk-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/space-grotesk-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/space-grotesk-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/space-grotesk-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../assets/fonts/ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/vazirmatn-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/vazirmatn-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/vazirmatn-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #08090a;
  --surface: #0c0e0f;
  --surface-2: #111314;
  --surface-3: #17191a;
  --line: #232527;
  --line-2: #34373a;
  --text: #f2f1ec;
  --muted: #8b9093;
  --muted-2: #5a5f61;
  --red: #e05a5a;
  --red-dim: #8e3a3a;
  --red-bg: rgba(224, 90, 90, 0.1);
  --blue: #4d93b8;
  --blue-dim: #2c586e;
  --blue-bg: rgba(77, 147, 184, 0.1);
  --ok: #93b593;
  --warn: #d0a35c;
  --map-ocean: #0b1012;
  --map-glow: rgba(38, 58, 66, 0.42);
  --map-sphere: #0d1417;
  --map-border: #4b5052;
  --map-graticule: rgba(242, 241, 236, 0.06);
  --map-neutral-0: #202426;
  --map-neutral-1: #23282a;
  --map-neutral-2: #1d2123;
  --map-neutral-3: #262b2d;
  --map-neutral-4: #1b1f21;
  --map-neutral-5: #222729;
  --map-red: #e05a5a;
  --map-blue: #4d93b8;
  --map-annex-a: #7d3d3d;
  --map-annex-b: #355d70;
  --map-hover: #f2f1ec;
  --map-selected-a: #ffd2d2;
  --map-selected-b: #cfe6f2;
  --map-annex-border: #3d4143;
  --map-label-halo: rgba(8, 9, 10, 0.86);
  --log-bg: #090a0b;
  --scrim: rgba(4, 5, 6, 0.78);
  --modal-scrim: rgba(4, 5, 6, 0.82);
  --map-loading-bg: rgba(8, 9, 10, 0.85);
  --map-shadow: rgba(0, 0, 0, 0.6);
  --map-pulse-from: rgba(242, 241, 236, 0.25);
  --map-pulse-to: rgba(242, 241, 236, 0.9);
  --event-bg: rgba(242, 241, 236, 0.03);
  --button-strong-hover: #d8d6d0;
  --font-latin: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-fa: 'Vazirmatn', Tahoma, sans-serif;
  --mono: 'IBM Plex Mono', 'Vazirmatn', ui-monospace, monospace;
  --body: var(--font-fa);
  --display: var(--font-fa);
}

html[data-theme='light'] {
  --bg: #f2f0ea;
  --surface: #fbfaf6;
  --surface-2: #f4f1ea;
  --surface-3: #ece8df;
  --line: #dad6cc;
  --line-2: #bdb8ac;
  --text: #121416;
  --muted: #6d7172;
  --muted-2: #94978f;
  --red: #c04343;
  --red-dim: #9e3030;
  --red-bg: rgba(192, 67, 67, 0.09);
  --blue: #2f7197;
  --blue-dim: #235066;
  --blue-bg: rgba(47, 113, 151, 0.09);
  --ok: #4b774b;
  --warn: #93651f;
  --map-ocean: #dde5e4;
  --map-glow: rgba(255, 255, 255, 0.55);
  --map-sphere: #d4dddc;
  --map-border: #a8a396;
  --map-graticule: rgba(17, 20, 22, 0.09);
  --map-neutral-0: #e6e1d6;
  --map-neutral-1: #eae5da;
  --map-neutral-2: #e2ddd2;
  --map-neutral-3: #ece7dc;
  --map-neutral-4: #dfdacf;
  --map-neutral-5: #e8e3d8;
  --map-red: #c04343;
  --map-blue: #2f7197;
  --map-annex-a: #c99892;
  --map-annex-b: #8fb2c2;
  --map-hover: #121416;
  --map-selected-a: #7c1f1f;
  --map-selected-b: #1d4d64;
  --map-annex-border: #b3aea1;
  --map-label-halo: rgba(248, 246, 240, 0.92);
  --log-bg: #f7f4ed;
  --scrim: rgba(36, 33, 28, 0.45);
  --modal-scrim: rgba(36, 33, 28, 0.5);
  --map-loading-bg: rgba(248, 246, 240, 0.9);
  --map-shadow: rgba(0, 0, 0, 0.18);
  --map-pulse-from: rgba(18, 20, 22, 0.25);
  --map-pulse-to: rgba(18, 20, 22, 0.85);
  --event-bg: rgba(18, 20, 22, 0.035);
  --button-strong-hover: #2b2e30;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 76px 76px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 72%);
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

html[data-theme='light'] body::before {
  background-image:
    linear-gradient(rgba(18, 20, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 20, 22, 0.035) 1px, transparent 1px);
}

[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;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a {
  color: var(--text);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 2px;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

html.lang-en {
  --body: var(--font-latin);
  --display: var(--font-latin);
}

html.lang-en body {
  font-size: 15.5px;
}

html.lang-en h1,
html.lang-en h2,
html.lang-en h3 {
  letter-spacing: -0.02em;
}

html.lang-fa h1,
html.lang-fa h2,
html.lang-fa h3 {
  letter-spacing: 0;
}

/* ---------------------------------------------------------------- utilities */

.mono-label,
.eyebrow,
.kicker,
.section-kicker,
.section-index {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

html.lang-fa .mono-label,
html.lang-fa .eyebrow,
html.lang-fa .kicker,
html.lang-fa .section-kicker {
  letter-spacing: 0.04em;
}

.is-muted {
  color: var(--muted-2);
}

/* ------------------------------------------------------------------- shell */

.site-header,
.app-grid,
.site-footer {
  position: relative;
  z-index: 2;
  width: min(1640px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  padding-top: 18px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  text-align: start;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  color: var(--text);
  border: 1px solid var(--line-2);
  background: var(--surface);
}

.brand-mark .icon {
  width: 22px;
  height: 22px;
}

.brand-text {
  min-width: 0;
}

.brand-text .kicker {
  display: block;
  margin: 0 0 2px;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
}

.subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

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

.campaign-stamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.campaign-stamp .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--surface);
}

.lang-toggle button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.18s ease, color 0.18s ease;
}

.lang-toggle button:last-child {
  border-inline-end: 0;
}

.lang-toggle button.active {
  background: var(--text);
  color: var(--bg);
}

.lang-toggle button:hover:not(.active) {
  color: var(--text);
}

.mode-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--surface);
}

.mode-switch button {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.18s ease, color 0.18s ease;
}

.mode-switch button:last-child {
  border-inline-end: 0;
}

.mode-switch button.active {
  background: var(--text);
  color: var(--bg);
}

.mode-switch button:hover:not(.active) {
  color: var(--text);
}

.mode-switch button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-2);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.theme-icon-sun {
  display: none;
}

html[data-theme='light'] .theme-icon-sun {
  display: block;
}

html[data-theme='light'] .theme-icon-moon {
  display: none;
}

/* ------------------------------------------------------------ year console */

.year-console {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(300px, 1fr) minmax(230px, 280px);
  align-items: center;
  gap: 26px;
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.year-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.year-readout .eyebrow {
  color: var(--muted);
}

.year-readout strong {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.95;
  color: var(--text);
}

html.lang-fa .year-readout strong {
  font-family: var(--font-fa);
  font-weight: 700;
  letter-spacing: 0;
}

.era-chip {
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.year-controls {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.step-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.step-button:hover:not(:disabled) {
  border-color: var(--text);
  color: var(--bg);
  background: var(--text);
}

.slider-shell {
  position: relative;
  flex: 1 1 auto;
  min-width: 140px;
  padding-block: 6px 18px;
  direction: ltr;
}

#year-slider {
  width: 100%;
  height: 24px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
}

#year-slider::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line-2);
}

#year-slider::-moz-range-track {
  height: 2px;
  background: var(--line-2);
}

#year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border: 1px solid var(--text);
  background: var(--text);
  border-radius: 0;
  box-shadow: 0 0 0 4px rgba(242, 241, 236, 0.08);
}

#year-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 1px solid var(--text);
  background: var(--text);
  border-radius: 0;
}

.year-ticks {
  position: absolute;
  inset-inline: 5px;
  bottom: -1px;
  height: 16px;
  pointer-events: none;
}

.year-tick {
  position: absolute;
  transform: translateX(-50%);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.year-tick::before {
  content: '';
  position: absolute;
  inset-inline-start: 50%;
  top: -5px;
  width: 1px;
  height: 3px;
  background: var(--line-2);
}

.year-form {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.year-form input {
  width: 84px;
  padding: 6px 9px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.year-form input::-webkit-outer-spin-button,
.year-form input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stamp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.stamp-button:hover:not(:disabled) {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.stamp-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.stamp-button .icon {
  width: 15px;
  height: 15px;
}

.snapshot-readout {
  min-width: 0;
  padding-inline-start: 20px;
  border-inline-start: 1px solid var(--line);
}

.snapshot-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
}

.snapshot-line strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
}

.snapshot-mode {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
}

.snapshot-readout p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.snapshot-readout.is-fallback .snapshot-line strong,
.snapshot-readout.is-fallback .snapshot-mode,
.snapshot-readout.is-fallback p {
  color: var(--red);
}

.quick-jumps {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 10px 12px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quick-jumps > .eyebrow {
  flex: 0 0 auto;
  padding-inline-end: 12px;
  border-inline-end: 1px solid var(--line);
}

.quick-jump-list {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-block: 2px;
  scrollbar-width: thin;
}

.quick-jump {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.quick-jump strong {
  color: var(--text);
  font-weight: 500;
}

.quick-jump:hover:not(:disabled) {
  border-color: var(--line-2);
  color: var(--text);
}

.quick-jump.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.quick-jump.active strong {
  color: var(--bg);
}

.snapshot-arrow {
  margin-inline-start: 3px;
  opacity: 0.6;
  font-size: 0.92em;
}

/* ------------------------------------------------------------------- grid */

.app-grid {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr) 372px;
  grid-template-areas: 'selection map battle';
  gap: 14px;
  align-items: start;
  padding-block: 16px 26px;
}

.panel,
.map-frame {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
}

.panel {
  padding: 18px;
}

.panel-selection {
  grid-area: selection;
}

.map-stage {
  grid-area: map;
  min-width: 0;
  align-self: start;
  position: sticky;
  top: 12px;
}

.panel-battle {
  grid-area: battle;
}

.panel-heading {
  position: relative;
  margin-bottom: 15px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.section-index {
  display: inline-block;
  margin-bottom: 7px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.6rem;
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------- robot command */

.robot-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}

.robot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.robot-head h3 {
  margin: 3px 0 0;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
}

.robot-status {
  padding: 2px 7px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.robot-status[data-state='target'] { color: var(--warn); border-color: var(--warn); }
.robot-status[data-state='war'] { color: var(--red); border-color: var(--red); }
.robot-status[data-state='win'] { color: var(--ok); border-color: var(--ok); }
.robot-status[data-state='lost'] { color: var(--red); border-color: var(--red); }

.robot-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
}

.robot-stats > div {
  padding: 7px 8px;
  border-inline-end: 1px solid var(--line);
}

.robot-stats > div:last-child {
  border-inline-end: 0;
}

.robot-stats strong {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
}

.robot-persona {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.robot-persona-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
}

.robot-persona-options button {
  min-height: 30px;
  padding: 0 5px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.robot-persona-options button:last-child {
  border-inline-end: 0;
}

.robot-persona-options button.active {
  background: var(--text);
  color: var(--bg);
}

.robot-persona-options button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.robot-target-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.robot-target-line strong {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.robot-intel {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.5;
}

.robot-proposal {
  padding: 9px;
  border: 1px solid var(--warn);
  background: rgba(208, 163, 92, 0.06);
}

.robot-proposal strong {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  font-weight: 600;
}

.robot-proposal p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.5;
}

.robot-proposal-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.robot-proposal-actions .stamp-button {
  flex: 1;
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

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

.robot-actions .stamp-button.broad {
  min-height: 38px;
}

/* ------------------------------------------------------- belligerent cards */

.belligerent-card {
  position: relative;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-inline-start: 2px solid var(--red);
  background: var(--surface-2);
}

.belligerent-card.side-b {
  border-inline-start-color: var(--blue);
}

.belligerent-card.is-selected {
  background: var(--surface-3);
}

.side-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.side-heading h3 {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-marker {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: var(--red);
}

.side-b .side-marker,
.side-marker.side-b {
  background: var(--blue);
}

.clear-side {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
}

.clear-side:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--line-2);
}

.combobox {
  position: relative;
  z-index: 1;
}

.combobox.open {
  z-index: 90;
}

.picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  text-align: start;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.picker-trigger:hover,
.combobox.open .picker-trigger {
  border-color: var(--text);
}

.picker-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 500;
}

.picker-value.is-placeholder {
  color: var(--muted);
  font-weight: 400;
}

.picker-value .picker-sub {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-caret {
  color: var(--muted);
  font-size: 0.62rem;
  transition: transform 0.18s ease;
}

.combobox.open .picker-caret {
  transform: rotate(180deg);
}

.picker-panel {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 4px);
  z-index: 95;
  padding: 7px;
  border: 1px solid var(--text);
  background: var(--surface-2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.picker-search-wrap {
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}

.picker-search {
  width: 100%;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--body);
  font-size: 0.8rem;
  outline: none;
}

.picker-search::placeholder {
  color: var(--muted-2);
}

.picker-list {
  max-height: 236px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}

.picker-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  cursor: pointer;
  border-inline-start: 2px solid transparent;
  color: var(--text);
}

.picker-option:hover,
.picker-option.is-active {
  background: var(--text);
  color: var(--bg);
}

.picker-option:hover .option-sub,
.picker-option.is-active .option-sub {
  color: var(--bg);
  opacity: 0.6;
}

.picker-option[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.3;
}

.picker-option[aria-selected='true'] .option-main::after {
  content: ' ✓';
  color: var(--ok);
}

.picker-option:hover .option-main::after,
.picker-option.is-active .option-main::after {
  color: var(--bg);
}

.option-main {
  font-size: 0.8rem;
}

.option-sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  direction: ltr;
  text-align: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-empty {
  margin: 4px 8px 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.versus-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 2px;
  color: var(--muted-2);
}

.versus-rule span {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.versus-rule .icon {
  width: 14px;
  height: 14px;
}

.side-stats {
  margin-top: 9px;
}

.stats-empty {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.stat-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.stat-row {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.71rem;
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-row .icon {
  width: 12px;
  height: 12px;
  color: var(--muted-2);
}

.stat-label {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  direction: ltr;
}

html.lang-fa .stat-value {
  font-family: var(--font-fa);
  font-size: 0.72rem;
}

.stat-value .estimate-mark,
.stat-value .curated-mark {
  margin-inline-end: 2px;
  color: var(--muted-2);
  font-size: 0.86em;
}

.stat-value .curated-mark {
  color: var(--text);
}

.stat-value.is-muted {
  color: var(--muted-2);
}

.stats-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.03em;
}

.stats-meta .realm-note {
  color: var(--muted);
}

.override-stamp {
  color: var(--muted-2);
  text-transform: uppercase;
}

.selection-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.stamp-button.broad {
  width: 100%;
  min-height: 44px;
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.stamp-button.broad:hover:not(:disabled) {
  background: var(--button-strong-hover);
}

.reroll-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tiny-button {
  padding: 7px 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tiny-button:hover:not(:disabled) {
  color: var(--bg);
  border-color: var(--text);
  background: var(--text);
}

.text-button {
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover:not(:disabled) {
  color: var(--text);
}

.text-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.selection-hint {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.55;
  text-align: center;
}

/* --------------------------------------------------------- diplomacy strip */

.diplomacy-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.diplomacy-strip-main {
  min-width: 0;
}

.diplomacy-strip-main strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.relation-chip b {
  color: var(--muted);
  font-weight: 500;
  direction: ltr;
}

.relation-chip b[data-tier='hostile'] {
  color: var(--red);
}

.relation-chip b[data-tier='tense'] {
  color: var(--warn);
}

.relation-chip b[data-tier='friendly'],
.relation-chip b[data-tier='cordial'] {
  color: var(--ok);
}

#diplomacy-status[data-kind='pact'],
#diplomacy-status-value[data-kind='pact'],
#diplomacy-status[data-kind='alliance'],
#diplomacy-status-value[data-kind='alliance'] {
  color: var(--ok);
}

#diplomacy-status[data-kind='war'],
#diplomacy-status-value[data-kind='war'] {
  color: var(--red);
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mini-button:hover:not(:disabled) {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.mini-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- lottery */

.lottery-stage {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  text-align: center;
}

.lottery-reels {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.reel {
  flex: 1;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reel.side-a {
  border-top: 2px solid var(--red);
}

.reel.side-b {
  border-top: 2px solid var(--blue);
}

.reel.rolling {
  color: var(--muted);
  animation: reel-jitter 0.14s linear infinite;
}

.reel.locked {
  border-color: var(--text);
}

.reel-vs {
  color: var(--muted-2);
  font-size: 0.58rem;
}

@keyframes reel-jitter {
  0% { transform: translateY(-1px); }
  50% { transform: translateY(1px); }
  100% { transform: translateY(-1px); }
}

/* ---------------------------------------------------------------- history */

.history-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.history-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.history-panel summary::-webkit-details-marker {
  display: none;
}

.history-panel summary strong {
  display: block;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
}

.history-panel summary small {
  display: block;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 0.62rem;
}

.summary-mark {
  color: var(--muted);
  font-size: 0.95rem;
  transition: transform 0.18s ease;
}

.history-panel[open] .summary-mark {
  transform: rotate(45deg);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 9px;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  text-align: start;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.history-item:hover:not(:disabled) {
  border-color: var(--text);
}

.history-item:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.history-item.active {
  border-color: var(--text);
  background: var(--surface-3);
}

.history-year {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  white-space: nowrap;
}

.history-name {
  min-width: 0;
}

.history-name strong {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-name small {
  display: block;
  color: var(--muted-2);
  font-size: 0.58rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-load {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.54rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.history-note,
.estimate-note {
  margin: 7px 0 0;
  color: var(--muted-2);
  font-size: 0.6rem;
  line-height: 1.5;
}

.estimate-note {
  display: flex;
  gap: 7px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.estimate-note > span:first-child {
  color: var(--muted);
}

/* -------------------------------------------------------------------- map */

.map-frame {
  padding: 8px;
}

.map-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 6px 9px;
}

.map-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.map-title .section-index {
  margin-bottom: 0;
}

.map-title .icon {
  width: 13px;
  height: 13px;
  color: var(--muted-2);
}

.map-title strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.map-count {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
}

.map-canvas {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--map-ocean);
}

#map-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 300px;
  max-height: 66vh;
  touch-action: none;
  cursor: grab;
  background:
    radial-gradient(ellipse at 50% 42%, var(--map-glow), transparent 70%),
    var(--map-ocean);
}

#map-svg:active {
  cursor: grabbing;
}

#map-svg.is-locked {
  cursor: default;
}

.ocean-bg {
  fill: transparent;
}

.ocean-sphere {
  fill: var(--map-sphere);
  stroke: var(--map-border);
  stroke-width: 0.5;
  opacity: 0.9;
}

.graticule {
  fill: none;
  stroke: var(--map-graticule);
  stroke-width: 0.4;
  pointer-events: none;
}

.country {
  stroke: var(--map-border);
  stroke-width: 0.34;
  vector-effect: non-scaling-stroke;
  transition: fill 0.4s ease, stroke 0.15s ease, filter 0.15s ease;
  cursor: pointer;
  outline: none;
}

.country:hover,
.country.is-hover {
  stroke: var(--map-hover);
  stroke-width: 0.8;
  filter: brightness(1.18);
}

.country.is-selected-a {
  stroke: var(--map-selected-a);
  stroke-width: 1;
}

.country.is-selected-b {
  stroke: var(--map-selected-b);
  stroke-width: 1;
}

.country.is-annexed {
  stroke: var(--map-annex-border);
}

#map-svg.is-locked .country {
  pointer-events: none;
  cursor: default;
}

.country.is-conquering {
  animation: conquest-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes conquest-pulse {
  from { stroke: var(--map-pulse-from); }
  to { stroke: var(--map-pulse-to); stroke-width: 1.1; }
}

.map-label {
  pointer-events: none;
}

.map-label .label-text {
  fill: var(--text);
  stroke: var(--map-label-halo);
  stroke-width: 3px;
  paint-order: stroke;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  direction: ltr;
}

html.lang-fa .map-label .label-text {
  direction: rtl;
  font-family: var(--font-fa);
  font-size: 10.5px;
}

.map-label .label-dot {
  fill: var(--red);
  stroke: var(--map-label-halo);
  stroke-width: 1;
}

.map-label.label-b .label-dot {
  fill: var(--blue);
}

.map-tooltip {
  position: absolute;
  z-index: 30;
  width: max-content;
  max-width: 260px;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 40px var(--map-shadow);
  pointer-events: none;
  transform: translate(0, -100%);
}

.map-tooltip h4 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 0.86rem;
  font-weight: 600;
}

.map-tooltip .tooltip-en {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  direction: ltr;
  text-align: start;
}

.map-tooltip .tooltip-meta {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  line-height: 1.7;
}

.map-tooltip .tooltip-annex {
  color: var(--red);
}

.map-loading,
.map-error {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--map-loading-bg);
  backdrop-filter: blur(2px);
  text-align: center;
}

.map-loading p,
.map-error p {
  margin: 0;
  max-width: 420px;
  color: var(--text);
  font-size: 0.8rem;
}

.map-error p {
  color: var(--red);
}

.loading-compass {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-2);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 1px;
  flex-wrap: wrap;
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  text-transform: uppercase;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.swatch {
  width: 9px;
  height: 9px;
  background: var(--map-neutral-0);
  border: 1px solid var(--line-2);
}

.swatch.side-a { background: var(--map-red); border-color: var(--map-red); }
.swatch.side-b { background: var(--map-blue); border-color: var(--map-blue); }
.swatch.annexed { background: linear-gradient(90deg, var(--map-annex-a) 0 50%, var(--map-annex-b) 50%); }

.map-hint {
  flex: 1;
  margin: 0;
  color: var(--muted-2);
  font-size: 0.56rem;
  text-align: center;
}

.zoom-controls {
  display: inline-flex;
  border: 1px solid var(--line);
}

.zoom-controls button {
  width: 28px;
  height: 27px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
}

.zoom-controls button:last-child {
  border-inline-end: 0;
}

.zoom-controls button:hover {
  color: var(--bg);
  background: var(--text);
}

.map-credit {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 7px 4px 1px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.02em;
}

/* ----------------------------------------------------------------- battle */

.battle-preview {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--line);
}

.preview-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-side.side-b {
  align-items: flex-end;
  text-align: end;
}

.preview-side strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 500;
}

.preview-flag {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.56rem;
  direction: ltr;
}

.preview-vs {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.battle-bars {
  padding: 10px 0 4px;
}

.battle-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.round-chip {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.speed-controls {
  display: inline-flex;
  border: 1px solid var(--line);
}

.speed-controls button {
  padding: 3px 7px;
  border: 0;
  border-inline-end: 1px solid var(--line);
  background: transparent;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.54rem;
}

.speed-controls button:last-child {
  border-inline-end: 0;
}

.speed-controls button.active {
  background: var(--text);
  color: var(--bg);
}

.battle-side-readout {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-inline-start: 2px solid var(--red);
  margin-bottom: 7px;
  background: var(--surface-2);
}

.battle-side-readout.side-b {
  border-inline-start-color: var(--blue);
}

.readout-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.readout-head strong {
  font-size: 0.72rem;
  font-weight: 500;
}

.bar-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.bar-label {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.54rem;
  text-transform: uppercase;
}

.bar {
  display: block;
  height: 4px;
  overflow: hidden;
  background: var(--line);
}

.bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--text);
  transition: width 0.3s ease;
}

.bar.army i {
  background: var(--red);
}

.side-b .bar.army i {
  background: var(--blue);
}

.bar-row b {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 500;
  text-align: end;
  direction: ltr;
}

.battle-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.war-button {
  flex: 1;
  min-height: 42px;
  background: var(--red);
  border-color: var(--red);
  color: #120607;
}

.war-button:hover:not(:disabled) {
  background: #f06d6d;
  border-color: #f06d6d;
  color: #120607;
}

.battle-actions .text-button {
  flex: 0 0 auto;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.secondary-button:hover:not(:disabled) {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.secondary-button.compact {
  min-height: 32px;
  padding: 0 11px;
  font-size: 0.58rem;
}

.war-diplomacy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 9px;
}

.pact-warning {
  margin: 0;
  padding: 7px 9px;
  border-inline-start: 2px solid var(--warn);
  background: rgba(208, 163, 92, 0.07);
  color: var(--warn);
  font-size: 0.66rem;
  line-height: 1.5;
}

.battle-idle {
  margin: 8px 0 0;
  color: var(--muted-2);
  font-size: 0.66rem;
  line-height: 1.55;
  text-align: center;
}

.log-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.log-heading h3,
.ledger-heading h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#log-count {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.56rem;
}

.war-log {
  max-height: 270px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--log-bg);
}

.log-empty {
  margin: 10px 0;
  color: var(--muted-2);
  font-size: 0.68rem;
  text-align: center;
}

.log-entry {
  position: relative;
  padding: 5px 0 5px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.6;
}

html[dir='rtl'] .log-entry {
  padding-inline: 16px 0;
  padding-left: 0;
}

.log-entry::before {
  content: '>';
  position: absolute;
  inset-inline-start: 2px;
  top: 5px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.6rem;
}

.log-entry strong {
  color: var(--text);
  font-weight: 500;
}

.log-entry.is-event {
  color: var(--text);
  background: var(--event-bg);
}

.log-entry.is-event .log-event-title {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
}

.log-entry.is-event .icon {
  width: 12px;
  height: 12px;
}

.log-entry.is-end {
  color: var(--text);
  border-bottom: 0;
}

.log-entry.is-start {
  color: var(--muted);
}

.log-round-tag {
  display: inline-block;
  min-width: 22px;
  margin-inline-end: 5px;
  color: var(--muted-2);
  direction: ltr;
}

.campaign-ledger {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ledger-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.ledger-heading .text-button {
  font-size: 0.56rem;
}

.leaderboard,
.diplomacy-record-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
}

.leaderboard li:last-child {
  border-bottom: 0;
}

.leaderboard .rank {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.leaderboard .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard .count {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 500;
  direction: ltr;
}

.leaderboard .empty,
.diplomacy-record-list .empty {
  display: block;
  color: var(--muted-2);
  font-size: 0.62rem;
  text-align: center;
  padding: 6px 0;
}

.diplomacy-record-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.diplomacy-record-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.64rem;
}

.diplomacy-record-list li:last-child {
  border-bottom: 0;
}

.record-kind {
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.record-kind[data-kind='pact'],
.record-kind[data-kind='alliance'] { color: var(--ok); border-color: var(--ok); }
.record-kind[data-kind='tribute'] { color: var(--warn); border-color: var(--warn); }
.record-kind[data-kind='submission'],
.record-kind[data-kind='surrender'] { color: var(--red); border-color: var(--red); }
.record-kind[data-kind='ceasefire'] { color: var(--blue); border-color: var(--blue); }

.record-pair {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.record-year {
  color: var(--muted-2);
  font-family: var(--mono);
  direction: ltr;
}

/* ----------------------------------------------------------- result modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-scrim);
  backdrop-filter: blur(4px);
  animation: fade-in 0.25s ease both;
}

.dispatch {
  position: relative;
  z-index: 2;
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  overflow-y: auto;
  padding: 30px clamp(20px, 4vw, 42px) 24px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.7);
  animation: dispatch-in 0.32s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.dispatch-header {
  position: relative;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dispatch-header .eyebrow {
  color: var(--muted);
}

.dispatch-header h2 {
  margin: 5px 0 0;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1;
}

.wax-seal {
  position: absolute;
  inset-inline-end: 0;
  bottom: -22px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  background: var(--red);
  color: #120607;
}

.wax-seal .icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.4;
}

.modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 14px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.result-body {
  padding-top: 18px;
}

.result-victor {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.result-victor .victor-name {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
}

.result-vs {
  color: var(--muted-2);
}

.result-victor .victor-side {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.result-defeated {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.result-defeated b {
  color: var(--text);
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  border: 1px solid var(--line);
}

.metric {
  padding: 11px 12px;
  border-inline-end: 1px solid var(--line);
}

.metric:last-child {
  border-inline-end: 0;
}

.metric span {
  display: block;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
}

.result-detail-line {
  margin: 9px 0 0;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.6rem;
  text-align: end;
}

.result-events {
  margin-top: 16px;
}

.result-events h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-events ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-events li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.result-events li:last-child {
  border-bottom: 0;
}

.result-events .icon {
  width: 13px;
  height: 13px;
  margin-top: 3px;
  color: var(--muted-2);
}

.result-events b {
  color: var(--text);
}

.result-conquest-note {
  margin: 15px 0 0;
  padding: 9px 11px;
  border-inline-start: 2px solid var(--red);
  background: var(--red-bg);
  color: var(--text);
  font-size: 0.7rem;
  line-height: 1.55;
}

.result-conquest-note.is-armistice {
  border-inline-start-color: var(--blue);
  background: var(--blue-bg);
}

.dispatch-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.dispatch-footer .stamp-button {
  min-height: 40px;
}

.dispatch-footer .stamp-button.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.dispatch-footer .stamp-button.primary:hover:not(:disabled) {
  background: var(--button-strong-hover);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dispatch-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------- layers / drawers */

.layer {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

.layer-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  animation: fade-in 0.2s ease both;
}

.drawer {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  display: flex;
  flex-direction: column;
  width: min(580px, 100%);
  padding: 24px clamp(18px, 3vw, 30px);
  border-inline-start: 1px solid var(--line-2);
  background: var(--surface);
  overflow-y: auto;
  animation: drawer-in 0.28s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

html[dir='rtl'] .drawer {
  animation-name: drawer-in-rtl;
}

@keyframes drawer-in-rtl {
  from { transform: translateX(-24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.05;
  text-transform: uppercase;
}

.drawer-close {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
}

.drawer-close:hover {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.diplomacy-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.pair-side {
  min-width: 0;
}

.pair-side.side-b {
  text-align: end;
}

.pair-side .mono-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.pair-side strong {
  display: block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pair-vs {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 1.1rem;
}

.diplomacy-envoys {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.diplomacy-envoy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.diplomacy-envoy.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.diplomacy-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.diplo-metric {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  border-inline-end: 1px solid var(--line);
}

.diplo-metric:nth-child(2n) {
  border-inline-end: 0;
}

.diplo-metric-wide {
  grid-column: 1 / -1;
  border-inline-end: 0;
}

.diplo-metric strong {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.diplo-metric small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.64rem;
}

.diplo-metric strong[data-tier='hostile'] { color: var(--red); }
.diplo-metric strong[data-tier='tense'] { color: var(--warn); }
.diplo-metric strong[data-tier='friendly'],
.diplo-metric strong[data-tier='cordial'] { color: var(--ok); }

.leverage-bar {
  display: flex;
  height: 5px;
  margin-top: 9px;
  background: var(--line);
}

.leverage-bar i {
  display: block;
  height: 100%;
}

.leverage-bar i:first-child {
  background: var(--red);
}

.leverage-bar i:last-child {
  background: var(--blue);
}

.leverage-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  direction: ltr;
}

.diplomacy-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.diplomacy-action {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  text-align: start;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.diplomacy-action:hover:not(:disabled) {
  border-color: var(--text);
  background: var(--surface-3);
}

.diplomacy-action.is-used {
  opacity: 0.4;
  cursor: not-allowed;
}

.diplomacy-action.is-danger {
  border-inline-start: 2px solid var(--red);
}

.action-index {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.action-copy {
  min-width: 0;
}

.action-copy strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
}

.action-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.45;
}

.action-chance {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.action-chance[data-band='likely'] { color: var(--ok); }
.action-chance[data-band='uncertain'] { color: var(--warn); }
.action-chance[data-band='unlikely'] { color: var(--red); }

.diplomacy-transcript {
  padding-top: 16px;
}

.diplomacy-transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.diplomacy-log {
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--log-bg);
}

.diplomacy-entry {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.diplomacy-entry:last-child {
  border-bottom: 0;
}

.entry-seq {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.56rem;
}

.entry-body small {
  display: block;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-body p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.diplomacy-entry.response p {
  color: var(--text);
}

.diplomacy-entry.response.is-rejected p {
  color: var(--red);
}

.diplomacy-note {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 0.64rem;
  line-height: 1.55;
}

.diplomacy-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------ cta / toast */

.mobile-war-cta {
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  min-width: 200px;
  padding: 10px 20px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.toast-stack {
  position: fixed;
  z-index: 1300;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

html[dir='rtl'] .toast-stack {
  right: auto;
  left: 18px;
  align-items: flex-start;
}

.toast {
  max-width: min(380px, calc(100vw - 36px));
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  font-size: 0.7rem;
  line-height: 1.5;
  animation: toast-in 0.22s ease both;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-error {
  border-color: var(--red);
  color: var(--red);
}

.toast.is-gold {
  border-color: var(--text);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------- footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 7px 20px;
  padding: 14px 0 24px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.03em;
}

.site-footer p {
  margin: 0;
}

/* --------------------------------------------------------------- scrollbar */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-thumb {
  background: var(--line-2);
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* ------------------------------------------------------------- responsive */

@media (min-width: 1341px) {
  .panel-battle {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
}

@media (max-width: 1340px) {
  .app-grid {
    grid-template-columns: 340px minmax(0, 1fr);
    grid-template-areas:
      'map map'
      'selection battle';
  }
  .map-stage {
    position: static;
  }
  #map-svg {
    max-height: 58vh;
  }
  .year-console {
    grid-template-columns: minmax(170px, 200px) minmax(280px, 1fr) minmax(210px, 260px);
    gap: 18px;
  }
}

@media (max-width: 1040px) {
  .masthead {
    align-items: flex-start;
  }
  .year-console {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'year controls'
      'snapshot snapshot';
  }
  .year-readout { grid-area: year; }
  .year-controls { grid-area: controls; }
  .snapshot-readout {
    grid-area: snapshot;
    padding-inline-start: 0;
    padding-top: 12px;
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }
  .snapshot-line {
    display: inline-flex;
  }
  .snapshot-readout p {
    display: inline;
    margin-inline-start: 6px;
  }
}

@media (max-width: 880px) {
  .site-header,
  .app-grid,
  .site-footer {
    width: min(100% - 22px, 780px);
  }
  .app-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'map'
      'selection'
      'battle';
    gap: 12px;
  }
  .map-stage {
    position: static;
  }
  .panel {
    padding: 15px;
  }
  .year-ticks {
    display: none;
  }
  .mobile-war-cta:not([hidden]) {
    display: inline-flex;
  }
  #map-svg {
    min-height: 260px;
    max-height: 52vh;
  }
  .quick-jumps {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .quick-jumps > .eyebrow {
    padding-inline-end: 0;
    border-inline-end: 0;
  }
  .quick-jump-list {
    width: 100%;
  }
  .masthead {
    flex-wrap: wrap;
  }
  .masthead-actions {
    margin-inline-start: auto;
  }
  .map-footer {
    justify-content: center;
  }
  .map-hint {
    flex-basis: 100%;
    order: 3;
  }
  .drawer {
    width: 100%;
    border-inline-start: 0;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 14.5px;
  }
  .site-header {
    padding-top: 12px;
  }
  .masthead {
    gap: 10px;
    padding-block: 7px 14px;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  h1 {
    font-size: 1.3rem;
  }
  .subtitle {
    display: none;
  }
  .campaign-stamp {
    padding: 0 8px;
  }
  .lang-toggle button {
    padding: 0 9px;
  }
  .year-console {
    grid-template-columns: 1fr;
    grid-template-areas:
      'year'
      'controls'
      'snapshot';
    gap: 10px;
    padding: 16px;
  }
  .year-readout {
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
  }
  .year-readout strong {
    margin-top: 0;
    font-size: 2.4rem;
  }
  .era-chip {
    margin-top: 0;
  }
  .year-controls {
    flex-wrap: wrap;
  }
  .slider-shell {
    order: 5;
    flex-basis: 100%;
    padding-bottom: 8px;
  }
  .year-form {
    margin-inline-start: auto;
  }
  .snapshot-readout p {
    display: block;
    margin-inline-start: 0;
  }
  .result-metrics {
    grid-template-columns: 1fr;
  }
  .metric {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }
  .metric:last-child {
    border-bottom: 0;
  }
  .dispatch {
    padding: 24px 16px 18px;
  }
  .dispatch-footer {
    flex-direction: column-reverse;
  }
  .dispatch-footer .stamp-button {
    width: 100%;
  }
  .diplomacy-pair {
    grid-template-columns: 1fr;
    text-align: start;
  }
  .pair-side.side-b {
    text-align: start;
  }
  .pair-vs {
    display: none;
  }
  .diplomacy-metrics {
    grid-template-columns: 1fr;
  }
  .diplo-metric,
  .diplo-metric:nth-child(2n) {
    border-inline-end: 0;
  }
  .diplomacy-action {
    grid-template-columns: 22px minmax(0, 1fr);
  }
  .action-chance {
    grid-column: 2;
  }
  .toast-stack {
    right: 10px;
    bottom: 10px;
    left: 10px;
    align-items: stretch;
  }
  html[dir='rtl'] .toast-stack {
    right: 10px;
    left: 10px;
    align-items: stretch;
  }
  .toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}