:root {
  color-scheme: dark;
  --bg: #111412;
  --bg-2: #171b18;
  --panel: #1d241f;
  --panel-2: #222923;
  --ink: #d8dec8;
  --muted: #8c967f;
  --amber: #d3a343;
  --amber-2: #f0ce73;
  --green: #8aa66a;
  --green-2: #b8d58b;
  --red: #b85e57;
  --red-text: #d07a72; /* AA-safe red for small text on dark panels (~5:1); --red stays for borders/bars */
  --cyan: #7ea6a0;
  --line: #344033;
  --shadow: rgba(0, 0, 0, 0.35);
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Art Direction Bible semantic palette — mapped to the existing "grim and
     controlled" values rather than the Bible's hotter literals, so the
     established mood is preserved. Use these names in new components. */
  --terminal-green: var(--green-2);
  --terminal-green-dim: var(--green);
  --warning-amber: var(--amber);
  --warning-amber-bright: var(--amber-2);
  --collapse-red: var(--red);
  --line-muted: var(--line);
  --paper-white: var(--ink);
  --ash-gray: var(--muted);
  --blackout: #000000;
  /* Cascade threshold: visible metrics mutate the rules when they fall below this. */
  --cascade-threshold: 35%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(126, 166, 160, 0.09), transparent 28rem),
    radial-gradient(circle at 80% 20%, rgba(211, 163, 67, 0.08), transparent 30rem),
    linear-gradient(180deg, #111412 0%, #0d100e 100%);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

/* Visible keyboard focus for all interactive controls. */
:focus-visible {
  outline: 2px solid var(--amber-2);
  outline-offset: 2px;
  border-radius: 3px;
}

.choice-button:focus-visible,
.archive-replay:focus-visible {
  outline-offset: -2px;
}

/* Mouse users keep the clean look; focus ring is for keyboard nav only. */
button:focus:not(:focus-visible) {
  outline: none;
}

.scanline {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.028),
      rgba(255, 255, 255, 0.028) 1px,
      transparent 1px,
      transparent 4px
    );
  mix-blend-mode: soft-light;
  opacity: 0.65;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  max-width: 1440px;
  margin: 0 auto 14px;
  padding: 14px 0 6px;
  border-bottom: 1px solid var(--line);
}

.brand-kicker,
.section-kicker,
.choice-kicker,
.report-kicker {
  margin: 0 0 6px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  color: #f1f3df;
  font-family: var(--mono);
  font-size: clamp(1.8rem, 4vw, 3.35rem);
  font-weight: 800;
  line-height: 0.95;
  text-transform: uppercase;
}

.subtitle {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.run-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, auto));
  gap: 8px;
}

.briefing-shell {
  display: grid;
  place-items: center;
}

.briefing-screen {
  position: relative;
  width: min(1120px, 100%);
  display: grid;
  gap: 18px;
}

.briefing-screen > :not(.briefing-bg) {
  position: relative;
  z-index: 1;
}

.briefing-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  object-fit: cover;
  opacity: 0.16;
  filter: saturate(0.85) contrast(1.05);
  -webkit-mask-image: radial-gradient(circle at 50% 38%, rgba(0, 0, 0, 0.9), transparent 72%);
  mask-image: radial-gradient(circle at 50% 38%, rgba(0, 0, 0, 0.9), transparent 72%);
  pointer-events: none;
}

.briefing-hero {
  min-height: 430px;
  display: grid;
  align-content: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 52px);
  background:
    linear-gradient(180deg, rgba(10, 13, 11, 0.12), rgba(10, 13, 11, 0.82)),
    repeating-linear-gradient(90deg, rgba(211, 163, 67, 0.08) 0 1px, transparent 1px 22px),
    radial-gradient(circle at 76% 22%, rgba(211, 163, 67, 0.28), transparent 16rem),
    linear-gradient(135deg, #25312c, #111412 58%, #0b0d0c);
  box-shadow: 0 24px 70px var(--shadow);
  overflow: hidden;
  position: relative;
}

.briefing-hero::after {
  content: "CONTINUITY MANDATE";
  position: absolute;
  right: 22px;
  top: 22px;
  border: 1px solid rgba(240, 206, 115, 0.4);
  color: rgba(240, 206, 115, 0.58);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  transform: rotate(2deg);
}

.briefing-copy {
  max-width: 680px;
  margin-bottom: 22px;
  color: #cdd5c1;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.55;
}

.briefing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.briefing-shortcut {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.briefing-settings {
  margin-top: 2px;
}

.settings-toggle {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  transition: border-color 160ms ease, color 160ms ease;
}

.settings-toggle:hover {
  border-color: var(--amber);
}

.settings-toggle[aria-pressed="true"] {
  border-color: var(--green);
  color: var(--green-2);
}

/* Reduce visual corruption: strip the decorative Signal-Decay glitch, chroma
   split, and pulse for readability / photosensitivity. Gameplay redaction
   (REDACTED text, hidden-pressure obscuring) is intentionally left intact. */
body.reduced-corruption .crisis-text,
body.reduced-corruption .metric-name {
  text-shadow: none !important;
}

body.reduced-corruption .card-stage,
body.reduced-corruption .app-shell,
body.reduced-corruption .px-line {
  animation: none !important;
}

body.reduced-corruption .scanline {
  opacity: 0.22 !important;
}

.seed-input {
  background: var(--bg-panel-deep, #07100e);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--terminal-green, #b8d58b);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 9px 11px;
  width: 160px;
}

.seed-input::placeholder {
  color: var(--muted);
  letter-spacing: 0.04em;
}

.seed-input:focus {
  outline: none;
  border-color: var(--warning-amber, #d3a343);
}

.seed-caption {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  margin: 8px 0 0;
}

.autopsy-key {
  color: var(--warning-amber-bright, #f0ce73);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.briefing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.briefing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(29, 36, 31, 0.78);
  padding: 15px;
}

.briefing-card h2 {
  margin-bottom: 8px;
  color: var(--amber-2);
  font-family: var(--mono);
  font-size: 0.92rem;
  text-transform: uppercase;
}

.briefing-card p {
  margin-bottom: 0;
  color: #b8c2ae;
  line-height: 1.45;
}

.archive-summary {
  margin-top: 14px;
}

.archive-card {
  max-width: 560px;
}

.archive-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.archive-head h2 {
  margin-bottom: 0;
}

.archive-stats {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.archive-list {
  list-style: none;
  margin: 10px 0 8px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.archive-replay {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(17, 20, 18, 0.6);
  padding: 7px 10px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.archive-replay:hover {
  border-color: var(--amber);
  background: rgba(211, 163, 67, 0.08);
}

.archive-ending {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.archive-ending.is-terminal { color: #d79a93; }
.archive-ending.is-survival { color: var(--green-2); }

.archive-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.archive-foot {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.status-cell {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(29, 36, 31, 0.72);
  padding: 10px 12px;
  box-shadow: 0 8px 24px var(--shadow);
}

.status-label {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.status-value {
  display: block;
  color: var(--amber-2);
  font-family: var(--mono);
  font-size: 0.96rem;
  font-weight: 700;
}

.status-value.reliability-good { color: var(--green-2); }
.status-value.reliability-warn { color: var(--amber-2); }
.status-value.reliability-bad { color: var(--red-text); }

.game-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.78fr) minmax(360px, 1.45fr) minmax(230px, 0.78fr);
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
}

.panel,
.card-stage,
.choice-strip,
.ending-screen {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(29, 36, 31, 0.78);
  box-shadow: 0 18px 44px var(--shadow);
}

.panel {
  padding: 14px;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h2,
.card-copy h2 {
  margin: 0;
  color: #eef2db;
  font-family: var(--mono);
  font-size: 1rem;
  text-transform: uppercase;
}

.small-note {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.metric-list {
  display: grid;
  gap: 12px;
}

.metric-row {
  display: grid;
  gap: 6px;
}

.metric-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.metric-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.metric-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.78;
}

.metric-icon svg {
  width: 100%;
  height: 100%;
}

.pressure-row .metric-icon {
  color: var(--red);
  opacity: 0.7;
}

.metric-value {
  color: var(--amber-2);
}

.bar-shell {
  height: 10px;
  overflow: hidden;
  border: 1px solid #42513f;
  border-radius: 3px;
  background: #0c100d;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: linear-gradient(90deg, var(--green), var(--amber));
  transition: width 260ms ease;
}

/* Cascade-threshold tick at 35% on visible metric bars only. Below this line a
   metric starts mutating the system rules, so it is marked permanently. */
.metric-row:not(.pressure-row) .bar-shell {
  position: relative;
}

.metric-row:not(.pressure-row) .bar-shell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--cascade-threshold);
  width: 2px;
  transform: translateX(-1px);
  z-index: 2;
  pointer-events: none;
  background: var(--collapse-red);
  opacity: 0.72;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.55);
}

.metric-row.danger .bar-fill,
.pressure-row.danger .bar-fill {
  background: linear-gradient(90deg, var(--red), #d39960);
}

.pressure-row .bar-fill {
  background: linear-gradient(90deg, #536d63, var(--red));
}

.pressure-row.obscured .metric-value,
.pressure-row.obscured .bar-shell {
  filter: blur(1.6px);
}

.pressure-row.redacted .metric-value {
  color: var(--red-text);
}

.pressure-row.redacted .bar-fill {
  background: repeating-linear-gradient(
    90deg,
    #8a3e3a 0,
    #8a3e3a 8px,
    #1b201d 8px,
    #1b201d 15px
  );
}

.card-stage {
  min-height: 560px;
  display: grid;
  grid-template-rows: auto auto auto auto;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(34, 41, 35, 0.94), rgba(17, 20, 18, 0.98)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0, rgba(255,255,255,0.02) 2px, transparent 2px, transparent 7px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 11, 0.46);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.mandate-chip {
  color: var(--amber-2);
}

.diorama {
  position: relative;
  isolation: isolate;
  /* Card art is square (1000x1000). Keep the slot near-square so the whole
     diorama reads instead of cropping it to a thin 2:1 letterbox band.
     The max-height scales with viewport so tall screens get the full
     near-square art while short screens stay compact (and crop a little
     more) to keep the policy choices reachable.
     --diorama-ratio is a reserved per-card override hook (unset = 5/4).
     min-height is clamped below the 44vh cap so it can't override it on
     short/landscape viewports (a bare 240px floor would win over 44vh
     under ~545px tall and defeat the compact-on-short-screens goal). */
  aspect-ratio: var(--diorama-ratio, 5 / 4);
  min-height: clamp(160px, 30vh, 240px);
  max-height: min(520px, 44vh);
  width: 100%;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(11, 14, 13, 0.18), rgba(0, 0, 0, 0.45)),
    var(--art-bg, linear-gradient(135deg, #27332f, #111412));
  overflow: hidden;
}

.diorama::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, transparent 0 64%, rgba(0, 0, 0, 0.42) 64% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 8px);
  mix-blend-mode: screen;
  opacity: 0.6;
}

.diorama::after {
  content: "";
  position: absolute;
  inset: 15% 9% 18%;
  z-index: 2;
  border: 2px solid rgba(240, 206, 115, 0.28);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.12), 0 18px 40px rgba(0, 0, 0, 0.28);
}

.pixel-scene {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.diorama-art {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.pixel {
  position: absolute;
  display: block;
  background: var(--pixel-color, #d3a343);
  image-rendering: pixelated;
  box-shadow: 0 0 18px rgba(211, 163, 67, 0.2);
}

.px-building-a {
  left: 13%;
  bottom: 18%;
  width: 12%;
  height: 42%;
  background: #263129;
}

.px-building-b {
  left: 28%;
  bottom: 18%;
  width: 18%;
  height: 55%;
  background: #303c34;
}

.px-building-c {
  right: 16%;
  bottom: 18%;
  width: 17%;
  height: 47%;
  background: #202923;
}

.px-line {
  left: 0;
  bottom: 36%;
  width: 100%;
  height: 3px;
  background: rgba(240, 206, 115, 0.45);
  animation: flicker 1.8s infinite steps(2);
}

.px-sun {
  right: 22%;
  top: 17%;
  width: 9%;
  aspect-ratio: 1;
  border-radius: 2px;
  background: rgba(211, 163, 67, 0.7);
  filter: blur(0.2px);
}

.px-ground {
  left: 0;
  right: 0;
  bottom: 0;
  height: 18%;
  background:
    repeating-linear-gradient(90deg, #20261f 0 18px, #161b17 18px 34px);
}

.px-object-a,
.px-object-b,
.px-object-c {
  background: var(--pixel-color, #d3a343);
}

.px-object-a {
  left: 51%;
  bottom: 24%;
  width: 12%;
  height: 9%;
}

.px-object-b {
  left: 59%;
  bottom: 33%;
  width: 4%;
  height: 22%;
}

.px-object-c {
  right: 28%;
  bottom: 18%;
  width: 3%;
  height: 34%;
  opacity: 0.7;
}

.scene-stamp {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 6;
  border: 1px solid rgba(240, 206, 115, 0.36);
  background: rgba(10, 13, 11, 0.48);
  color: rgba(240, 206, 115, 0.76);
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.scene-breadRiots .px-object-a,
.scene-borderRefugees .px-object-a {
  left: 44%;
  bottom: 18%;
  width: 31%;
  height: 5%;
}

.scene-breadRiots .px-object-b,
.scene-borderRefugees .px-object-b {
  left: 47%;
  bottom: 23%;
  width: 5%;
  height: 15%;
  box-shadow:
    34px 6px 0 rgba(211, 163, 67, 0.72),
    72px 0 0 rgba(211, 163, 67, 0.54),
    108px 8px 0 rgba(211, 163, 67, 0.5);
}

.scene-soilExhaustion .px-ground,
.scene-falseHarvestReports .px-ground {
  background: repeating-linear-gradient(90deg, #2c261d 0 22px, #15150f 22px 38px);
}

.scene-soilExhaustion .px-object-a,
.scene-falseHarvestReports .px-object-a {
  left: 47%;
  bottom: 20%;
  width: 24%;
  height: 20%;
  background: rgba(138, 166, 106, 0.52);
}

.scene-whistleblowerLeak .px-object-a,
.scene-archiveFires .px-object-a {
  left: 53%;
  bottom: 22%;
  width: 18%;
  height: 40%;
  background: repeating-linear-gradient(180deg, #263129 0 12px, var(--pixel-color) 12px 14px);
}

.scene-archiveFires .px-object-b {
  left: 57%;
  bottom: 61%;
  width: 10%;
  height: 10%;
  background: #c56f45;
  animation: flicker 900ms infinite steps(2);
}

.scene-algorithmicPanic .px-line {
  bottom: 48%;
  height: 2px;
  box-shadow: 0 22px 0 rgba(126, 166, 160, 0.38), 0 -22px 0 rgba(126, 166, 160, 0.35);
}

.scene-charismaticDemagogue .px-object-a {
  left: 52%;
  bottom: 20%;
  width: 18%;
  height: 12%;
}

.scene-charismaticDemagogue .px-object-b {
  left: 58%;
  bottom: 32%;
  width: 4%;
  height: 34%;
}

.scene-infrastructureDecay .px-object-a {
  left: 38%;
  bottom: 35%;
  width: 42%;
  height: 6%;
  transform: rotate(-6deg);
}

.scene-infrastructureDecay .px-object-b {
  left: 60%;
  bottom: 26%;
  width: 5%;
  height: 22%;
  transform: rotate(13deg);
}

.scene-despairEpidemic .px-line {
  opacity: 0.22;
  animation-duration: 3.2s;
}

.scene-despairEpidemic .px-object-a {
  left: 50%;
  bottom: 54%;
  width: 4%;
  height: 4%;
  opacity: 0.3;
  box-shadow:
    28px 18px 0 rgba(240, 206, 115, 0.28),
    62px 4px 0 rgba(240, 206, 115, 0.2),
    104px 26px 0 rgba(240, 206, 115, 0.16);
}

.scene-militaryDefection .px-object-a {
  left: 51%;
  bottom: 24%;
  width: 22%;
  height: 6%;
}

.scene-militaryDefection .px-object-b {
  left: 54%;
  bottom: 31%;
  width: 2%;
  height: 36%;
}

.scene-militaryDefection .px-object-c {
  left: 56%;
  bottom: 56%;
  width: 16%;
  height: 9%;
  transform: skewY(-10deg);
}

.card-copy {
  padding: 18px 18px 14px;
}

.card-copy h2 {
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1;
}

.crisis-text {
  margin: 0;
  color: #cbd3bd;
  line-height: 1.55;
}

.report-panel {
  margin: 0 18px 18px;
  padding: 12px 13px;
  border: 1px solid rgba(211, 163, 67, 0.3);
  border-radius: 6px;
  background: rgba(10, 13, 11, 0.42);
}

.report-panel p {
  margin-bottom: 0;
  color: #d9dbca;
  line-height: 1.45;
}

.momentum-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.momentum-chip {
  border: 1px solid rgba(126, 166, 160, 0.38);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.side-module {
  margin-top: 16px;
  border-top: 1px solid rgba(52, 64, 51, 0.78);
  padding-top: 12px;
}

.side-module h3 {
  margin: 0 0 8px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.side-module p,
.side-module li {
  margin: 0;
  color: #abb6a2;
  font-size: 0.8rem;
  line-height: 1.38;
}

.side-module p + p {
  margin-top: 5px;
}

.side-module ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 16px;
}

.threat-module {
  display: grid;
  gap: 10px;
}

.threat-row {
  border: 1px solid rgba(52, 64, 51, 0.8);
  border-radius: 6px;
  padding: 8px;
  background: rgba(10, 13, 11, 0.25);
}

.threat-topline {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 7px;
  align-items: baseline;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.threat-topline span {
  color: var(--muted);
}

.threat-topline strong {
  color: #e3e7cf;
  font-size: 0.72rem;
}

.threat-topline em {
  color: var(--red-text);
  font-style: normal;
}

.warning-module li {
  color: #d5c199;
}

.delta-ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.delta-chip {
  border: 1px solid rgba(52, 64, 51, 0.9);
  border-radius: 999px;
  padding: 4px 7px;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.delta-chip.gain {
  color: var(--green-2);
}

.delta-chip.loss {
  color: #e09a80;
}

.cascade-flags {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.cascade-flag {
  border-left: 2px solid var(--red);
  background: rgba(184, 94, 87, 0.1);
  padding: 4px 8px;
  color: #e3a99f;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.35;
}

.choice-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  background: rgba(17, 20, 18, 0.84);
}

.tool-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 20, 18, 0.7);
}

.tool-bar-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--amber-dim, #a96f2e);
  border-radius: 4px;
  background: rgba(211, 163, 67, 0.08);
  color: var(--amber-2);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  padding: 7px 11px;
  transition: background 160ms ease, border-color 160ms ease;
}

.tool-button:hover:not(:disabled) {
  background: rgba(211, 163, 67, 0.16);
  border-color: var(--amber);
}

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

.tool-count {
  min-width: 1.2em;
  padding: 0 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--green-2);
  font-size: 0.7rem;
  text-align: center;
}

.tool-active {
  color: var(--green-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.policy-record .policy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.policy-tag {
  border: 1px solid rgba(184, 94, 87, 0.5);
  border-radius: 3px;
  background: rgba(184, 94, 87, 0.1);
  color: #d79a93;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  padding: 3px 6px;
  text-transform: uppercase;
}

.scar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.scar {
  display: grid;
  gap: 1px;
  border-left: 2px solid var(--red);
  padding: 3px 0 3px 8px;
}

.scar-virtue {
  border-left-color: var(--green);
}

.scar-name {
  color: #d79a93;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scar-virtue .scar-name {
  color: var(--green-2);
}

.scar-text {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.analyst-note {
  margin: 8px 0 0;
  border-left: 2px solid var(--amber);
  padding: 4px 0 4px 9px;
  color: var(--amber-2);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-style: italic;
  line-height: 1.4;
}

.choice-button {
  min-height: 210px;
  border: 1px solid #3b4739;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(34, 41, 35, 0.96), rgba(24, 30, 25, 0.96));
  color: var(--ink);
  padding: 14px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: rgba(240, 206, 115, 0.72);
  background:
    linear-gradient(180deg, rgba(41, 49, 42, 0.98), rgba(25, 31, 26, 0.98));
  outline: none;
  transform: translateY(-2px);
}

.choice-button h3 {
  margin-bottom: 8px;
  color: #f0f2dc;
  font-family: var(--mono);
  font-size: 1rem;
  text-transform: uppercase;
}

.choice-button p {
  margin-bottom: 12px;
  color: #aeb9a2;
  font-size: 0.92rem;
  line-height: 1.38;
}

.choice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.choice-meta span,
.choice-warnings span {
  border: 1px solid rgba(126, 166, 160, 0.26);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.preview-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preview-list li {
  color: #d4cfad;
  font-family: var(--mono);
  font-size: 0.76rem;
}

.preview-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pv-arrow {
  min-width: 2.5em;
  font-size: 0.7rem;
  letter-spacing: -1px;
  color: var(--amber);
}

.tone-good .pv-arrow { color: var(--green-2); }
.tone-bad .pv-arrow { color: var(--red); }
.tone-unknown .pv-arrow { color: var(--amber); }

.preview-item.approx .pv-arrow::after { content: " ~"; opacity: 0.7; }
.preview-item.redacted .pv-arrow { color: var(--red); letter-spacing: 2px; }
.preview-item.unreliable .pv-label::after {
  content: " ⚠";
  color: var(--amber-2);
  font-size: 0.7em;
}

.preview-list li.hidden-effect {
  color: #b89179;
}

.hidden-effect .pv-label { font-style: italic; opacity: 0.9; }

.preview-list li.unreliable {
  color: #e0bd64;
}

.pv-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.choice-warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.choice-warnings span {
  border-color: rgba(184, 94, 87, 0.38);
  color: #d9a08e;
}

.ending-screen {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  max-width: 1100px;
  margin: 26px auto;
  padding: 22px;
}

.ending-screen > :not(.ending-bg) {
  position: relative;
  z-index: 1;
}

.ending-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.17;
  filter: saturate(0.85) contrast(1.05);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.28) 58%, transparent);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.28) 58%, transparent);
}

.ending-terminal {
  box-shadow: inset 0 0 140px rgba(184, 94, 87, 0.13);
}

.ending-terminal .ending-bg {
  opacity: 0.2;
}

.ending-survival {
  box-shadow: inset 0 0 140px rgba(138, 166, 106, 0.1);
}

.ending-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

/* Framed "case-file photo" of the run's outcome — a clear graphic on the
   final screen. Treated (desaturated, amber-tinted, scanlined) so it reads as
   an archival record rather than a live crisis card. */
.ending-photo {
  position: relative;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #0b0e0d;
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.35), 0 14px 30px rgba(0, 0, 0, 0.35);
}

.ending-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center 42%;
  filter: grayscale(0.55) sepia(0.22) saturate(0.9) contrast(1.05) brightness(0.92);
}

.ending-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0 62%, rgba(0, 0, 0, 0.55) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px);
  mix-blend-mode: soft-light;
}

.ending-photo figcaption {
  position: absolute;
  left: 8px;
  bottom: 7px;
  z-index: 1;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber-2);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.ending-terminal .ending-photo {
  border-color: rgba(208, 122, 114, 0.4);
}

body.reduced-corruption .ending-photo::after {
  background: linear-gradient(180deg, transparent 0 62%, rgba(0, 0, 0, 0.55) 100%);
}

body.reduced-corruption .ending-photo img {
  filter: grayscale(0.3) saturate(0.95) contrast(1.02);
}

.ending-title {
  margin-bottom: 8px;
  color: #f3f0d7;
  font-family: var(--mono);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.ending-cause {
  margin-bottom: 20px;
  color: var(--amber-2);
  font-family: var(--mono);
  text-transform: uppercase;
}

.report-block {
  border-top: 1px solid var(--line);
  padding: 14px 0 0;
}

.report-block h3 {
  margin-bottom: 6px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.report-block p {
  color: #d5dac8;
  line-height: 1.5;
}

.final-line {
  color: #f0ce73;
  font-family: var(--mono);
  font-size: 1.1rem;
}

.score-grid {
  display: grid;
  gap: 10px;
}

.score-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: rgba(10, 13, 11, 0.36);
}

.score-card span {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.score-card strong {
  display: block;
  color: var(--amber-2);
  font-family: var(--mono);
  font-size: 1.8rem;
}

.history-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  border-left: 2px solid rgba(211, 163, 67, 0.45);
  padding-left: 10px;
  color: #bac2ad;
  font-size: 0.86rem;
  line-height: 1.35;
}

.share-report {
  width: 100%;
  min-height: 168px;
  margin-top: 10px;
  border: 1px solid #3b4739;
  border-radius: 6px;
  background: rgba(10, 13, 11, 0.58);
  color: #dce1cc;
  padding: 10px;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.45;
  resize: vertical;
}

.share-report:focus {
  border-color: rgba(240, 206, 115, 0.72);
  outline: none;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  border: 1px solid rgba(240, 206, 115, 0.58);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.primary-button {
  background: var(--amber);
  color: #111412;
  font-weight: 800;
}

.secondary-button {
  background: transparent;
  color: var(--amber-2);
}

.copy-status {
  min-height: 1.2em;
  margin-top: 10px;
  color: var(--green-2);
  font-family: var(--mono);
  font-size: 0.78rem;
}

body[data-decay-tier="3"] .card-stage,
body[data-decay-tier="4"] .card-stage {
  animation: lowGlitch 2.8s infinite steps(2);
}

body[data-decay-tier="4"] .metric-row:nth-child(2n) .metric-name,
body[data-decay-tier="4"] .crisis-text {
  text-shadow: 1px 0 var(--red), -1px 0 var(--cyan);
}

/* --- Signal Decay tier escalation: the whole console degrades with decay --- */
.scanline,
.panel,
.card-stage,
.app-shell {
  transition: opacity 600ms ease, box-shadow 600ms ease, border-color 600ms ease;
}

body[data-decay-tier="2"] .scanline { opacity: 0.78; }
body[data-decay-tier="3"] .scanline { opacity: 0.95; }
body[data-decay-tier="4"] .scanline { opacity: 1; }
body[data-decay-tier="5"] .scanline { opacity: 0.42; }

/* Tier 2 — euphemism: institutional caution creeps in */
body[data-decay-tier="2"] .panel { border-color: rgba(211, 163, 67, 0.28); }

/* Tier 3 — contradiction: amber and red compete, faint instability */
body[data-decay-tier="3"] .panel {
  border-color: rgba(211, 163, 67, 0.42);
  box-shadow: inset 0 0 0 1px rgba(184, 94, 87, 0.12), 0 0 18px rgba(211, 163, 67, 0.06);
}
body[data-decay-tier="3"] .diorama::after { border-color: rgba(211, 163, 67, 0.4); }

/* Tier 4 — fog of governance: red bleed, broken borders, harsher readouts */
body[data-decay-tier="4"] .panel {
  border-color: rgba(184, 94, 87, 0.5);
  box-shadow: inset 0 0 0 1px rgba(184, 94, 87, 0.2), 0 0 22px rgba(184, 94, 87, 0.08);
}
body[data-decay-tier="4"] .diorama::after {
  border-color: rgba(184, 94, 87, 0.45);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.25);
}
body[data-decay-tier="4"] .pressure-row .bar-shell { filter: contrast(1.12) saturate(0.85); }

/* Tier 5 — BRIGHT LIE: false-clean green calm over a failed civilization */
body[data-decay-tier="5"] .panel {
  border-color: rgba(184, 213, 139, 0.55);
  box-shadow: 0 0 26px rgba(138, 166, 106, 0.18), inset 0 0 0 1px rgba(184, 213, 139, 0.12);
}
body[data-decay-tier="5"] .mandate-chip { color: var(--green-2); }
body[data-decay-tier="5"] .scene-stamp {
  color: rgba(184, 213, 139, 0.72);
  border-color: rgba(184, 213, 139, 0.4);
}
body[data-decay-tier="5"] .crisis-text,
body[data-decay-tier="5"] .metric-name { text-shadow: none; }
body[data-decay-tier="5"] .app-shell { animation: brightLiePulse 6s ease-in-out infinite; }

@keyframes brightLiePulse {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.04) saturate(1.07); }
}

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

  /* The chroma-split is a static text-shadow (not animation), so remove it
     explicitly for reduced-motion users — it smears body-copy glyph edges. */
  body[data-decay-tier="4"] .metric-row:nth-child(2n) .metric-name,
  body[data-decay-tier="4"] .crisis-text {
    text-shadow: none !important;
  }
}

@keyframes flicker {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.95; }
}

@keyframes lowGlitch {
  0%, 94%, 100% { transform: translate(0, 0); filter: none; }
  95% { transform: translate(1px, 0); filter: hue-rotate(8deg); }
  97% { transform: translate(-1px, 0); }
}

@media (max-width: 1060px) {
  .topbar,
  .game-grid {
    max-width: 760px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .briefing-grid {
    grid-template-columns: 1fr;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .choice-strip {
    grid-template-columns: 1fr;
  }

  .card-stage {
    min-height: 520px;
  }

  .ending-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .run-status {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 12px;
  }

  .card-copy {
    padding: 14px;
  }

  .report-panel {
    margin: 0 14px 14px;
  }

  .choice-button {
    min-height: auto;
  }
}
