/* Follow the Future, "Situation room": a dark command table, a lit map board, teleprinter dispatches and a status rail.
   Signal colours: amber for focus and primary actions, red for alerts and bad changes, green for good.
   Surfaces separate by tint and a 1px tinted hairline. Nothing is lifted off the page and no border is dark. */
:root {
  --desk: #13221F;          /* the command table */
  --panel: #1B2E2A;         /* panels, a step lighter */
  --panel-2: #243A36;       /* cards on panels */
  --line: #34504A;          /* tinted hairline */
  --ink: #EDE8DA;
  --ink-soft: #A6BAB4;
  --amber: #F4A93A;
  --amber-hi: #FFC060;
  --amber-text: #F4A93A;
  --on-amber: #1C1304;
  --amber-tint: #3A2F18;
  --red: #FF7061;
  --red-tint: #3F2421;
  --green: #66D3A0;
  --green-tint: #1C3C30;
  --gauge: #6DB5A8;
  --borrow: #7A6532;
  --sea: #D5E9EB;           /* the lit board */
  --sea-grid: #BDD7DA;
  --land: #EFA63B;
  --land-far: #A7B7B1;
  --map-ink: #15302E;
  --map-halo: #D5E9EB;
  --paper: #EFE7D0;         /* teleprinter paper */
  --paper-alert: #F3DCCB;
  --paper-ink: #2B2518;
  --paper-soft: #6A5E45;
  --paper-line: #DACFAF;
  --p-good: #1D6A44;
  --p-bad: #A5291D;
  --backdrop: rgba(10, 22, 19, .72);
  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
  --type: "Courier Prime", "Courier New", Courier, monospace;
  --r: 8px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --desk: #E3E9E1;
  --panel: #F7F8F3;
  --panel-2: #ECF0E8;
  --line: #C9D4CA;
  --ink: #15292A;
  --ink-soft: #496460;
  --amber: #C27200;
  --amber-hi: #A96300;
  --amber-text: #8D5100;
  --on-amber: #FFFFFF;
  --amber-tint: #FBE8C8;
  --red: #B3261A;
  --red-tint: #FBE1DC;
  --green: #14764B;
  --green-tint: #D8EFE2;
  --gauge: #2F7A6D;
  --borrow: #EAD3A2;
  --sea: #E6F2F3;
  --sea-grid: #CFE3E5;
  --land: #EAA038;
  --land-far: #BCC8C2;
  --map-ink: #15302E;
  --map-halo: #E6F2F3;
  --paper: #FBF5E2;
  --paper-alert: #F7E1D3;
  --paper-line: #E2D8B8;
  --backdrop: rgba(30, 45, 42, .5);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; letter-spacing: -.04em; line-height: .98; }
h1.h-med { font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -.03em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.08rem; letter-spacing: -.01em; }
p { margin: 0 0 .8em; max-width: 66ch; }
a { color: var(--amber-text); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--amber-text); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }

/* Buttons */
button, .btn {
  font: inherit; font-weight: 600; color: var(--ink);
  min-height: 48px; padding: 10px 20px;
  border-radius: 999px; border: 0;
  background: var(--panel-2); cursor: pointer; text-align: center;
}
button:hover { background: var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary, .btn-go {
  background: var(--amber); color: var(--on-amber); font-weight: 700;
}
.btn-primary:hover:not(:disabled), .btn-go:hover:not(:disabled) { background: var(--amber-hi); }
.btn-primary { width: 100%; font-size: 1.1rem; min-height: 56px; margin-top: 6px; }
.btn-quiet { background: transparent; border: 1px solid var(--line); }
.btn-quiet:hover { background: var(--panel-2); }
.btn-link { background: none; min-height: 44px; padding: 6px 8px; border-radius: 4px; color: var(--amber-text); text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { background: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn-row > * { flex: 1 1 150px; }
.back { margin-bottom: 14px; min-height: 44px; }

/* Shell */
#app { min-height: 100vh; }
.wrap { max-width: 1480px; margin: 0 auto; padding: 14px 24px 32px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; background: none; padding: 4px 0; min-height: 44px; border-radius: 4px; color: var(--amber-text); }
.brand:hover { background: none; }
.where { font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .tools { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar .tools button { min-height: 44px; padding: 6px 16px; font-size: .95rem; background: transparent; }
.topbar .tools button:hover { background: var(--panel); }

/* The desk: rail, board, panel */
.desk { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; margin-top: 10px; }
.rail { background: var(--panel); border-radius: var(--r); padding: 16px; min-width: 0; }
.r-top { display: grid; gap: 12px; }
.r-q { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.timeline li { border-top: 6px solid var(--panel-2); padding: 4px 0 0; font-size: .7rem; color: var(--ink-soft); text-align: left; overflow: hidden; }
.timeline li .q { display: none; }
.timeline li.done { border-top-color: var(--gauge); }
.timeline li.now { border-top-color: var(--amber); color: var(--ink); font-weight: 700; }
.r-cashline { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.r-cashline { flex-wrap: wrap; }
.r-cashline strong { font-size: 1.35rem; letter-spacing: -.02em; color: var(--amber-text); white-space: nowrap; }
.r-gauges { margin-top: 12px; }
.r-gauges summary { min-height: 44px; }
.g-note { margin: 0 0 8px; }
.gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.gauge { min-width: 0; }
.g-top { display: flex; flex-direction: column; gap: 0; }
.g-label { font-size: .82rem; color: var(--ink-soft); line-height: 1.25; }
.g-val { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.g-bar { height: 5px; background: var(--panel-2); border-radius: 3px; margin-top: 5px; position: relative; overflow: hidden; }
.g-bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gauge); border-radius: 3px; }
.g-bar.centre { overflow: visible; }
.g-bar.centre::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line); }
.g-bar.centre > span { width: 10px; top: -3px; bottom: -3px; border-radius: 5px; background: var(--amber); }
.lean-ends { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-soft); margin-top: 4px; gap: 6px; }
.chg { font-weight: 700; font-size: .8rem; margin-left: 6px; letter-spacing: 0; }
.chg.good { color: var(--green); }
.chg.bad { color: var(--red); }
.chg.flat { color: var(--ink-soft); font-weight: 400; }

.board { min-width: 0; display: grid; gap: 10px; justify-items: center; align-content: start; }
.map-frame { position: relative; background: var(--sea); border-radius: var(--r); overflow: hidden; max-width: 100%; margin: 0 auto; }
.map-frame svg { display: block; width: 100%; height: auto; }
.no-map { width: 100%; background: var(--panel); border-radius: var(--r); padding: 16px; }
.panel { background: var(--panel); border-radius: var(--r); padding: 20px; min-width: 0; }
.panel h2 { font-size: 1.8rem; letter-spacing: -.03em; }
.panel h2:focus { outline: none; }
/* The one action of the step stays in reach while the text above it scrolls. */
.panel > .btn-primary { position: sticky; bottom: 8px; z-index: 4; border: 4px solid var(--panel); min-height: 64px; }

@media (min-width: 900px) {
  .desk { grid-template-columns: minmax(0, 1fr) 410px; grid-template-areas: "rail rail" "board panel"; }
  .rail { grid-area: rail; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 8px 28px; align-items: start; }
  .r-gauges { margin-top: 0; }
  .r-gauges summary { display: none; }
  .gauges { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .board { grid-area: board; position: sticky; top: 12px; }
  .panel { grid-area: panel; position: sticky; top: 12px; max-height: calc(100vh - 84px); overflow-y: auto; }
}
@media (min-width: 1280px) {
  .desk { grid-template-columns: 260px minmax(0, 1fr) 440px; grid-template-areas: "rail board panel"; }
  .rail { display: block; position: sticky; top: 12px; max-height: calc(100vh - 84px); overflow-y: auto; }
  .r-top { margin-bottom: 14px; }
  .gauges { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .g-top { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 8px; }
  .g-val { white-space: nowrap; font-size: 1rem; }
}
@media (max-width: 899px) {
  /* Phones and small tablets: the step and its one action come first, the map and the people after. */
  .r-top { order: 0; }
  .r-gauges { order: 1; }
  .panel { order: 2; }
  .board { order: 3; }
  .rail { display: contents; }
  .r-top { position: sticky; top: 0; z-index: 5; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--panel); padding: 10px 14px; border-radius: var(--r); align-items: center; }
  .r-gauges { background: var(--panel); border-radius: var(--r); padding: 4px 14px 14px; margin-top: 0; }
  .r-gauges summary { font-weight: 700; }
  .r-cashline { flex-direction: column; align-items: flex-start; gap: 0; }
  .r-cashline strong { font-size: 1.2rem; }
}

/* Steps in a quarter */
.steps { list-style: none; display: flex; gap: 3px; padding: 0; margin: 0 0 18px; }
.steps li { flex: 1; font-size: .8rem; color: var(--ink-soft); border-top: 3px solid var(--panel-2); padding-top: 6px; }
.steps li.done { border-color: var(--gauge); }
.steps li.now { border-color: var(--amber); color: var(--ink); font-weight: 700; }

/* Players on the board. Mood: green friendly, amber neutral, red cool. */
.map-actors { list-style: none; margin: 0; padding: 0; }
.has-actors .spot { position: absolute; transform: translateY(-50%); max-width: 29%; }
.badge {
  display: flex; align-items: center; gap: 8px; text-align: left;
  min-height: 44px; padding: 5px 12px 5px 9px; border-radius: 999px;
  background: var(--panel); color: var(--ink); font-weight: 400; line-height: 1.12;
  border: 1px solid var(--line);
}
.badge:hover { background: var(--panel-2); }
.b-dot { flex: none; width: 13px; height: 13px; border-radius: 50%; background: var(--amber); }
.mood-warm .b-dot { background: var(--green); }
.mood-cool .b-dot { background: var(--red); }
.b-text { display: flex; flex-direction: column; min-width: 0; }
.b-name { font-weight: 700; font-size: .82rem; }
.b-mood { font-size: .76rem; color: var(--ink-soft); }
.mood-warm .b-mood { color: var(--green); }
.mood-cool .b-mood { color: var(--red); }
.actor-mood { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.no-map .map-actors { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.spot-flat .badge { width: 100%; }

/* Panel content */
.crisis-title { color: var(--red); }
.strips { display: grid; gap: 10px; margin: 8px 0 14px; }
.strip { position: relative; background: var(--paper); color: var(--paper-ink); border-radius: 3px; padding: 10px 22px; margin: 8px 0; font-family: var(--type); font-size: .98rem; line-height: 1.45; overflow: hidden; }
.strips .strip { margin: 0; }
.strip::before, .strip::after { content: ""; position: absolute; top: 0; bottom: 0; width: 12px; background: radial-gradient(circle at 6px 7px, var(--panel) 2.6px, transparent 3.2px) 0 0 / 12px 14px repeat-y; }
.strip::before { left: 0; }
.strip::after { right: 0; }
.strip-head { font-weight: 700; color: var(--paper-soft); font-size: .9rem; margin-bottom: 2px; }
.strip-text { overflow-wrap: anywhere; }
.strip.alert { background: var(--paper-alert); }
.strip.alert .strip-head { color: var(--p-bad); }
.strip .chips { margin-top: 8px; }
.strip .chip { background: var(--paper-line); font-family: var(--font); }
.strip .chip.good { color: var(--p-good); }
.strip .chip.bad { color: var(--p-bad); }
.strip-why { margin: 8px 0 0; padding-left: 18px; font-family: var(--font); font-size: .88rem; color: var(--paper-soft); }
.strip-why li { margin-top: 2px; }
.strip-why.drift { list-style: none; padding-left: 0; }
.strip-why.drift li { margin-top: 5px; }
.strip-why b { color: var(--paper-ink); }
.strip-why b.good { color: var(--p-good); }
.strip-why b.bad { color: var(--p-bad); }
.strip-note { margin: 8px 0 0; font-family: var(--font); font-size: .88rem; color: var(--paper-soft); }
.strip-more { margin: 4px 0 0; font-family: var(--font); font-size: .9rem; }
.strip-more summary { min-height: 40px; }

.options { display: grid; gap: 8px; margin: 12px 0; }
.option, .card { text-align: left; font-weight: 400; display: block; width: 100%; border-radius: var(--r); background: var(--panel-2); }
.option { padding: 14px 18px; }
.option:hover:not(:disabled) { background: var(--line); }
.option strong { display: block; font-size: 1.05rem; }
.option .meta { display: block; color: var(--ink-soft); font-size: .9rem; margin-top: 2px; }
.option .meta b { color: var(--amber-text); }
.option.off { opacity: 1; }
.option.off > :not(.whynot) { opacity: .6; }
.whynot, .meta.whynot { color: var(--red); font-weight: 600; }
.ap { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.ap .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--amber); }
.ap .dot.used { background: var(--panel-2); }

.budget { background: var(--panel-2); border-radius: var(--r); padding: 14px 16px; margin: 6px 0 16px; }
.budget h3 { margin-bottom: 10px; font-size: 1.2rem; }
.bmeter { margin: 4px 0; }
.bm-track { position: relative; display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--line); }
.bm-cash { background: var(--amber); }
.bm-borrow { background: var(--borrow); }
.bm-use { position: absolute; left: 0; bottom: 0; height: 6px; background: var(--ink); }
.bmeter.over .bm-use { background: var(--red); }
.bm-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 4px; }
.lg-cash::before, .lg-borrow::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--amber); }
.lg-borrow::before { background: var(--borrow); }
.bm-sum { width: 100%; border-collapse: collapse; margin: 10px 0 8px; font-size: .95rem; }
.bm-sum th { text-align: left; font-weight: 400; padding: 5px 8px 5px 0; }
.bm-sum td { text-align: right; font-weight: 700; white-space: nowrap; padding: 5px 0; }
.bm-sum tr + tr th, .bm-sum tr + tr td { border-top: 1px solid var(--line); }
.budget p:last-child { margin-bottom: 0; }
.money-more { margin: 4px 0 0; }
.money-more summary { color: var(--amber-text); font-weight: 600; }
.money-more .budget { margin-top: 0; }

/* Close to a losing line: plain, amber, and only there when it is true */
.danger { background: var(--amber-tint); border-left: 4px solid var(--amber); border-radius: var(--r); padding: 12px 14px; margin: 10px 0 14px; }
.danger strong { display: block; margin-bottom: 2px; }
.danger ul { margin: 0; padding-left: 18px; }
.danger li { margin-top: 4px; font-size: .95rem; }

/* What others are asking for */
.asks { background: var(--panel-2); border-radius: var(--r); padding: 12px 14px; margin: 10px 0 14px; }
.asks h3 { margin-bottom: 6px; }
.asks ul { list-style: none; margin: 0 0 8px; padding: 0; }
.asks li { display: grid; gap: 1px; padding: 8px 0; border-top: 1px solid var(--line); }
.asks li:first-child { border-top: 0; padding-top: 2px; }
.asks p { margin: 0; }
.ask-who { font-weight: 700; }
.ask-when { font-size: .88rem; font-weight: 700; color: var(--amber-text); }
.ask-when.soon { color: var(--red); }
.ask-when.met { color: var(--green); }
.asks.done ul { margin-bottom: 0; }
.ask-tag { display: inline-block; font-family: var(--font); font-size: .82rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--paper-line); margin-top: 6px; }
.ask-tag.good { color: var(--p-good); }
.ask-tag.bad { color: var(--p-bad); }
.log .ask-tag { background: var(--panel-2); margin-top: 0; }
.log .ask-tag.good { color: var(--green); }
.log .ask-tag.bad { color: var(--red); }

.hit { background: var(--red-tint); border-radius: var(--r); padding: 12px 14px; margin: 10px 0; }
.hit p { margin: 8px 0 0; }

.cards { display: grid; gap: 10px; margin: 8px 0 14px; }
.card { padding: 14px 16px; }
.c-title { display: block; font-size: 1.08rem; }
.c-plain { display: block; color: var(--ink); margin-top: 2px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .9rem; color: var(--ink-soft); margin-top: 8px; }
.card .cost { color: var(--amber-text); font-weight: 700; }
.card.picked { outline: 2px solid var(--amber-text); outline-offset: -2px; }
.card.off > :not(.whynot):not(.more) { opacity: .6; }
.rest { display: inline-block; vertical-align: 2px; margin-left: 8px; font-size: .78rem; font-weight: 700; letter-spacing: 0; padding: 2px 10px; border-radius: 999px; background: var(--panel); color: var(--ink-soft); border: 1px solid var(--line); }
.payfail { margin: 4px 0 0; color: var(--ink-soft); }
.custom.off > summary { color: var(--ink-soft); }
.card .whynot { margin: 8px 0 0; }
.card .more { margin: 8px 0 0; }
.card .more summary { min-height: 40px; font-weight: 600; color: var(--amber-text); }
.card .btn-row { margin-top: 10px; }
.card .btn-row button { min-height: 48px; }
.preview { background: var(--panel); border-radius: var(--r); padding: 10px 12px; margin-top: 10px; }
.pv-head { font-weight: 700; font-size: .92rem; }
.moves { margin-bottom: 8px; }

.size, .lever { margin-top: 12px; }
.size-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.size-label { font-weight: 700; font-size: .95rem; margin: 0; }
.size-val { font-weight: 800; font-size: 1.15rem; color: var(--amber-text); white-space: nowrap; }
.size-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.step-btn { flex: none; min-height: 48px; min-width: 48px; padding: 8px 12px; font-size: .92rem; }
input[type="range"] { flex: 1 1 auto; min-width: 0; width: 100%; height: 48px; background: transparent; accent-color: var(--amber); cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--amber); border: 0; margin-top: -10px; }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--line); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--amber); border: 0; }

.tray { position: sticky; bottom: 0; background: var(--panel-2); border: 1px solid var(--amber-text); border-radius: var(--r); padding: 14px 16px; margin: 12px 0; z-index: 3; }
.tray h3 { margin-bottom: 6px; }
.pkg-list { list-style: none; margin: 0 0 8px; padding: 0; }
.pkg-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.pkg-list li:last-child { border-bottom: 0; }
.custom { background: var(--panel-2); border-radius: var(--r); padding: 4px 16px 16px; margin: 14px 0; }
.custom > summary { font-size: 1.05rem; color: var(--amber-text); }
.lever-help { margin: 2px 0 0; }
.cu-totals { background: var(--panel); border-radius: var(--r); padding: 12px 14px; margin-top: 14px; }

textarea, input[type="text"], input[type="number"], select {
  font: inherit; color: var(--ink); background: var(--desk);
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; width: 100%; min-height: 48px;
}
textarea { min-height: 96px; resize: vertical; }
label { font-weight: 700; display: block; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--ink-soft); font-size: .9rem; display: block; }
.result { border-radius: var(--r); padding: 14px 16px; margin: 12px 0; background: var(--panel-2); }
.result.ok { background: var(--green-tint); }
.result.fail { background: var(--red-tint); }
.result h3 { margin-bottom: 4px; }
.why { margin: 6px 0; padding-left: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: .85rem; padding: 3px 10px; border-radius: 999px; background: var(--panel); }
.chip.good { color: var(--green); }
.chip.bad { color: var(--red); }
.match { border-radius: var(--r); padding: 14px 16px; margin: 12px 0; background: var(--amber-tint); }
.notice { background: var(--amber-tint); border-radius: var(--r); padding: 10px 14px; margin: 10px 0; }
.error { background: var(--red-tint); border-radius: var(--r); padding: 10px 14px; margin: 10px 0; }
details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.panel-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; }
.log-why { list-style: none; margin: 2px 0 0; padding: 0; }
.log .log-why li { padding: 1px 0; border-bottom: 0; }
.causes { list-style: none; margin: 6px 0 0; padding: 0; font-size: .88rem; color: var(--ink-soft); }
.log .causes li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 0; }
.c-dv { white-space: nowrap; font-weight: 700; color: var(--ink); }
.why-more { margin: 2px 0 0; }
.why-more summary { min-height: 36px; font-size: .88rem; font-weight: 600; color: var(--amber-text); }

/* Start flow */
.start { max-width: 1180px; margin: 0 auto; padding-top: 8px; }
.start .lede, .lede { font-size: 1.2rem; max-width: 60ch; }
.pick-h { margin-top: 28px; font-size: 1.5rem; }
.countries { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.country { display: flex; flex-direction: column; text-align: left; padding: 0; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); overflow: hidden; font-weight: 400; }
.country:hover:not(:disabled) { background: var(--panel-2); border-color: var(--amber-text); }
.country:disabled { opacity: .6; }
.thumb { position: relative; height: 0; padding-top: 58%; background: var(--sea); display: block; flex: none; overflow: hidden; }
.thumb svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.c-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 16px; }
.c-name { font-size: 1.3rem; letter-spacing: -.02em; }
.c-game { color: var(--amber-text); font-weight: 700; }
.c-pitch { color: var(--ink-soft); font-size: .95rem; line-height: 1.35; }
.choices { display: grid; gap: 10px; margin: 20px 0 18px; }
.choice { text-align: left; padding: 18px 22px; min-height: 84px; font-weight: 400; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.choice:hover { background: var(--panel-2); }
.choice strong { display: block; font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.choice.main { background: var(--amber); color: var(--on-amber); border-color: var(--amber); }
.choice.main:hover { background: var(--amber-hi); }
.choice .tag { display: block; font-size: .88rem; font-weight: 700; margin-bottom: 4px; color: var(--amber-text); }
.choice.main .tag { color: var(--on-amber); }
.continue { margin: 16px 0 0; width: 100%; max-width: 640px; }
.disclaimer { font-size: .92rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 12px; }
.setup { max-width: 760px; margin: 0 auto; padding-top: 8px; }
.roles { display: grid; gap: 8px; margin: 16px 0; }
.role-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; background: var(--panel); border-radius: var(--r); padding: 10px 14px; }
.role-row input[type="checkbox"] { width: 28px; height: 28px; accent-color: var(--amber); }
.role-row label { margin: 0; }

.privacy { max-width: 640px; margin: 8vh auto; background: var(--panel); border-radius: var(--r); padding: 36px 28px; text-align: center; }
.privacy .big { font-weight: 800; letter-spacing: -.03em; font-size: clamp(2rem, 7vw, 3.2rem); margin: 8px 0 16px; }
.privacy .goal { text-align: left; background: var(--amber-tint); border-radius: var(--r); padding: 16px; margin: 16px 0; }

/* Dialogs */
dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); padding: 0; max-width: min(600px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: var(--backdrop); }
dialog .dlg-body { padding: 20px 24px 24px; }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
dialog .dlg-head h2 { margin: 0; font-size: 1.35rem; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; border-radius: 0; max-width: min(460px, 100vw); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-weight: 400; }
.radio input { width: 22px; height: 22px; margin-top: 4px; accent-color: var(--amber); flex: none; }
.radio-row { display: flex; flex-wrap: wrap; gap: 6px 14px; }
progress { width: 100%; height: 14px; accent-color: var(--amber); }
.field { margin-bottom: 12px; }

/* End */
.end { max-width: 1100px; margin: 16px auto 0; }
.end h1 { margin-top: 18px; }
.end h1.lost { color: var(--red); }
.end-text { font-size: 1.05rem; }
.style-card { display: grid; gap: 2px; background: var(--amber-tint); border-radius: var(--r); padding: 16px 20px; margin: 18px 0; max-width: 66ch; }
.style-card strong { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--amber-text); }
.end-sec { margin: 26px 0; }
.end-sec p { font-size: 1.05rem; }
.keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.keys li { display: grid; gap: 2px; align-content: start; background: var(--panel); border-radius: var(--r); padding: 14px 16px; }
.k-when { font-size: .88rem; }
.verdicts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); max-width: 80ch; }
.verdicts li { display: grid; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.verdicts strong { display: flex; align-items: center; gap: 8px; }
.lean-final { max-width: 520px; margin: 0 0 28px; }
.lean-final p { margin-bottom: 10px; }
.end .timeline { max-width: 560px; }
.score { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.score .total { font-weight: 800; letter-spacing: -.05em; font-size: 5.5rem; line-height: 1; color: var(--amber-text); }
.grades { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 24px; margin: 16px 0 28px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.grades li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.grade { font-weight: 800; font-size: 1.4rem; }
.grade.g-A, .grade.g-B { color: var(--green); }
.grade.g-D, .grade.g-E { color: var(--red); }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 24px; }
.charts figure { margin: 0; background: var(--panel); border-radius: var(--r); padding: 14px 16px; }
.charts figcaption { font-weight: 700; margin-bottom: 4px; }
.charts svg { width: 100%; height: auto; display: block; }

/* Board drawing: flat fills on a lit sea */
.m-sea { fill: var(--sea); }
.m-grat { stroke: var(--sea-grid); stroke-width: 1; fill: none; }
.m-land { fill: var(--land); }
.m-far { fill: var(--land-far); }
.m-sealbl { fill: var(--map-ink); opacity: .7; font-family: var(--font); font-weight: 500; font-style: italic; }
.m-lane { stroke: var(--map-ink); opacity: .5; stroke-width: 1.5; stroke-dasharray: 2 6; stroke-linecap: round; fill: none; }
.m-place { fill: var(--map-ink); }
.m-placelbl { fill: var(--map-ink); font-family: var(--font); font-weight: 600; paint-order: stroke; stroke: var(--map-halo); stroke-width: 3px; stroke-linejoin: round; }
.m-tie { stroke-width: 2.4; stroke-dasharray: 1 6; stroke-linecap: round; fill: none; stroke: var(--amber); }
.m-tie.mood-warm { stroke: var(--green); }
.m-tie.mood-cool { stroke: var(--red); }
.m-crisis { fill: var(--red); }
.m-crisis-ring { fill: none; stroke: var(--red); stroke-width: 2; }
.m-crisislbl { fill: var(--p-bad); font-family: var(--font); font-weight: 800; paint-order: stroke; stroke: var(--map-halo); stroke-width: 5px; stroke-linejoin: round; }
.pulse { transform-box: fill-box; transform-origin: center; animation: pulse 1.8s ease-out 1 both; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(3.4); opacity: 0; } }
.c-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.c-axis { stroke: var(--line); stroke-width: 1; }
.c-lbl { fill: var(--ink-soft); font: 12px var(--font); }
.c-dot { fill: var(--amber); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .pulse { opacity: .5; transform: scale(2); }
}

/* Narrow boards: badges leave the board and list under it */
@media (max-width: 1099px) {
  .has-actors { display: contents; }
  .has-actors svg { background: var(--sea); border-radius: var(--r); max-height: 58vh; width: 100%; }
  .has-actors .map-actors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .has-actors .spot { position: static; transform: none; max-width: none; }
  .has-actors .badge { width: 100%; height: 100%; }
  .m-tie { display: none; }
  .board { width: 100%; }
}
@media (max-width: 759px) {
  .m-sealbl { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .wrap { padding: 12px 16px 24px; }
  .panel { padding: 16px; }
  .panel h2 { font-size: 1.5rem; }
  .steps li { font-size: .7rem; }
  .role-row { grid-template-columns: auto minmax(0, 1fr); }
  .role-row input[type="text"] { grid-column: 1 / -1; }
  .score .total { font-size: 4rem; }
  .r-when { display: none; }
  .card { padding: 12px; }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
  .step-btn { padding: 8px 10px; }
  .countries { grid-template-columns: minmax(0, 1fr); }
  .country { flex-direction: row; }
  .thumb { width: 108px; height: auto; padding-top: 0; min-height: 96px; flex: none; }
  .tray { padding: 12px; }
  .style-card strong { font-size: 1.4rem; }
}
