:root {
  color-scheme: dark;
  --bg: #0a0f1d; --panel: #111a2c; --panel-2: #172238; --line: #243150; --line-2: #2f3e60;
  --ink: #e8ecf4; --ink-2: #b2bccf; --muted: #7c88a2;
  --central: #d08a52; --central-2: #e0b25a; --entente: #7da4dc; --entente-2: #5fb3a8;
  --neutral: #4a5366; --compromise: #a79bc4; --out: #2a3142;
  --sea: #17222e; --land: #1a2336; --border: #0a0f1d; --front: #e4472f;
  --accent: #f0a43a; --good: #3fbf7f;
  --shadow: 0 10px 30px rgb(0 0 0 / .35);
  --r: 14px; --gutter: 16px;
  --serif: 'Fraunces', Georgia, serif; --period: 'Old Standard TT', Georgia, serif; --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #efe8d6; --panel: #fbf7ec; --panel-2: #f1ead8; --line: #ddd3bb; --line-2: #c9bc9c;
    --ink: #151b2b; --ink-2: #3e4759; --muted: #6b7385;
    --central: #b5652c; --central-2: #b0801a; --entente: #2f5d9e; --entente-2: #12877b;
    --neutral: #c9ccd3; --compromise: #a18bd0; --out: #e2e2e2;
    --sea: #cfd9d6; --land: #ece8de; --border: #efe8d6; --front: #b3261e;
    --accent: #c97a12; --good: #1d7a4c; --shadow: 0 10px 30px rgb(30 30 50 / .12);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #efe8d6; --panel: #fbf7ec; --panel-2: #f1ead8; --line: #ddd3bb; --line-2: #c9bc9c;
  --ink: #151b2b; --ink-2: #3e4759; --muted: #6b7385;
  --central: #b5652c; --central-2: #b0801a; --entente: #2f5d9e; --entente-2: #12877b;
  --neutral: #c9ccd3; --compromise: #a18bd0; --out: #e2e2e2;
  --sea: #cfd9d6; --land: #ece8de; --border: #efe8d6; --front: #b3261e;
  --accent: #c97a12; --good: #1d7a4c; --shadow: 0 10px 30px rgb(30 30 50 / .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); overflow-x: hidden; }
a { color: var(--entente-2); }
h1, h3 { font-family: var(--serif); font-weight: 650; letter-spacing: .01em; }
h3 { margin: 0 0 10px; font-size: 1.05rem; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 12px; cursor: pointer;
  transition: background .2s, border-color .2s, transform .1s; }
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); color: #1a1205; border-color: transparent; font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
select, input[type=search], input[type=number] { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 10px; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=range] { accent-color: var(--accent); width: 100%; min-width: 0; }
.sel, .chk { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: .9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

.top { display: flex; align-items: center; gap: 16px; padding: 12px var(--gutter); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--bg)); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { margin: 0; font-size: 1.25rem; line-height: 1.1; }
.brand .sub { margin: 2px 0 0; font-size: .78rem; color: var(--muted); }
.mark { width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--central) 0 50%, var(--entente) 50% 100%); box-shadow: inset 0 0 0 6px var(--panel); }
.tabs { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs button { border: none; background: transparent; color: var(--ink-2); border-radius: 999px; white-space: nowrap; }
.tabs button[aria-selected=true] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tools select { max-width: 210px; }
.icon { width: 36px; padding: 6px 0; }
.caveat { margin: 0; padding: 8px var(--gutter); font-size: .82rem; color: var(--muted); border-bottom: 1px solid var(--line); }
#scenario-tag b { color: var(--accent); font-weight: 600; }

main { padding: var(--gutter); max-width: 1500px; margin: 0 auto; }
.tab { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }

/* play */
.play-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gutter); }
.map-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; align-self: start; }
.map-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 12px 14px 8px; flex-wrap: wrap; }
.date { font-family: var(--serif); font-size: 1.7rem; line-height: 1; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-2); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.c { background: var(--central); } .sw.e { background: var(--entente); } .sw.n { background: var(--neutral); }
.sw.o { background: repeating-linear-gradient(45deg, var(--out) 0 2px, var(--muted) 2px 3px); }
.map-wrap { position: relative; background: var(--sea); aspect-ratio: 10 / 7; overflow: hidden; }
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }
.zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.zoom button { background: color-mix(in srgb, var(--panel) 88%, transparent); width: 34px; height: 34px; padding: 0; font-weight: 600; }
.zoom button.small { font-size: .7rem; }
.mode { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.mode button { border: none; border-radius: 0; background: transparent; padding: 5px 16px; }
.mode button[aria-pressed=true] { background: var(--accent); color: #1a1205; font-weight: 600; }
.map-card > .legend { padding: 6px 14px 0; }
.legend .note { flex-basis: 100%; font-size: .74rem; }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.sw.tex-hills, .sw.tex-mountains { background-image: linear-gradient(135deg, transparent 45%, rgba(0,0,0,.35) 45% 55%, transparent 55%) !important; }
.sw.tex-forest, .sw.tex-stipple { background-image: radial-gradient(rgba(0,0,0,.35) 1px, transparent 1.4px) !important; background-size: 4px 4px !important; }
.sw.tex-marsh, .sw.tex-dunes { background-image: linear-gradient(rgba(0,0,0,.3) 1px, transparent 1px) !important; background-size: 100% 3px !important; }
.modebar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 14px 0; }
.modebar button { padding: 3px 10px; font-size: .78rem; border-radius: 999px; background: transparent; color: var(--ink-2); }
.modebar button[aria-pressed=true] { background: var(--accent); color: #1a1205; border-color: var(--accent); font-weight: 600; }
.map-wrap { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sw.h { background: repeating-linear-gradient(45deg, var(--entente) 0 2px, var(--central) 2px 4px); }
.ln { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--front); margin-right: 5px; vertical-align: 2px; }
.date { font-family: var(--period); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.side { display: flex; flex-direction: column; gap: var(--gutter); min-width: 0; }
.log-card { grid-column: 1 / -1; }
.prow { display: grid; grid-template-columns: 12px minmax(0, 1fr) 52px 52px 36px; gap: 8px; align-items: center; font-size: .82rem; padding: 3px 0; }
.prow.head { color: var(--muted); font-size: .72rem; }
.prow .dot { width: 10px; height: 10px; border-radius: 50%; }
.prow.out { opacity: .5; }
.prow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--ink-2); transition: width .5s ease; }
.bar.lo > i { background: var(--central); }
.frow { display: grid; grid-template-columns: minmax(0, 1fr) 110px 40px; gap: 8px; align-items: center; font-size: .82rem; padding: 2px 0; }
.fbar { position: relative; height: 8px; border-radius: 4px; background: var(--panel-2); }
.fbar::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line-2); }
.fbar > i { position: absolute; top: 0; bottom: 0; border-radius: 4px; transition: all .5s ease; }
.log { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow-y: auto; }
.log li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .86rem; }
.log li .m { color: var(--muted); font-variant-numeric: tabular-nums; }
/* newspaper feed: masthead, double rules, headline then deck */
.paper .masthead { font-family: var(--period); font-size: 1.5rem; text-align: center; letter-spacing: .04em; margin: 0; padding-bottom: 4px; border-bottom: 3px double var(--line-2); }
.paper .dateline { text-align: center; color: var(--muted); font-family: var(--period); font-style: italic; margin: 4px 0 6px; border-bottom: 1px solid var(--line-2); padding-bottom: 6px; }
.paper .log li { font-family: var(--period); }
.paper .log li[data-k] { cursor: pointer; }
.paper .log li[data-k]:hover, .paper .log li[data-k]:focus-visible { background: var(--panel-2); outline: none; }
.paper .log li .m { font-variant: small-caps; letter-spacing: .03em; }
.paper .log .o { display: block; font-weight: 700; font-size: .98rem; line-height: 1.2; }
.paper .log .q { display: block; font-style: italic; color: var(--ink-2); font-size: .82rem; }
@media (min-width: 900px) { .paper .log { columns: 2; column-gap: 28px; column-rule: 1px solid var(--line); } .paper .log li { break-inside: avoid; } }
/* event cards */
.drawer { overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px 10px; z-index: 6; min-height: 0; }
.drawer[hidden] { display: none; }
.evnav { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.evnav span { flex: 1; text-align: center; }
.evnav button { padding: 2px 9px; }
.evcard { display: grid; gap: 10px; }
.dialog.wide .evcard { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
.evfig { margin: 0; }
.evfig img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 4px; filter: sepia(.25); background: var(--panel-2); }
.evfig figcaption { font-size: .68rem; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.evfig:not(.noimg) .cutting, .evfig.noimg img, .evfig.noimg figcaption { display: none; }
.cutting { display: block; background: var(--panel-2); border: 1px solid var(--line-2); border-top: 3px double var(--ink-2); padding: 10px 12px; font-family: var(--period); text-align: center; transform: rotate(-.6deg); }
.cutting .mast { display: block; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line-2); padding-bottom: 4px; margin-bottom: 6px; }
.cutting .cuthl { display: block; font-weight: 700; font-size: 1.05rem; line-height: 1.2; text-transform: uppercase; }
.drawer .cutting .cuthl { font-size: .9rem; }
.drawer .evfig img { max-height: 130px; }
.evhead { font-family: var(--period); font-size: 1.15rem; line-height: 1.2; margin: 2px 0 6px; }
.dialog .evhead { font-size: 1.35rem; }
.evtext > p { margin: 0 0 6px; }
.evodds { list-style: none; margin: 6px 0; padding: 0; }
.evodds li { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 6px; padding: 3px 0; border-top: 1px solid var(--line); }
.evodds li.won { font-weight: 600; }
.evodds li.won .pct::before { content: '✓ '; color: var(--good); }
.evodds .pct { text-align: right; font-variant-numeric: tabular-nums; }
.log li.dev .o { color: var(--accent); }
.log li.exit .o { color: var(--central); }
.log li.sys { color: var(--muted); }
.tag { display: inline-block; font-size: .68rem; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.tag.hist { border-color: var(--good); color: var(--good); }
.tag.alt { border-color: var(--accent); color: var(--accent); }
/* evidence basis: line style carries the class, colour only reinforces it */
.basis { display: inline-block; font: 600 .62rem/1.5 var(--sans); padding: 0 5px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; vertical-align: 1px; letter-spacing: .02em; }
.basis.sourced { border-style: solid; border-color: var(--good); color: var(--good); }
.basis.derived { border-style: dashed; border-color: var(--entente); color: var(--entente); }
.basis.judgement { border-style: dotted; border-color: var(--accent); color: var(--accent); }
.basis.pending { font-style: italic; font-weight: 400; color: var(--muted); }
.readchk { color: var(--good); font-size: .7rem; }
details.why { margin: 2px 0 6px; font-size: .8rem; }
details.why > summary { cursor: pointer; color: var(--muted); font-size: .72rem; }
details.why h4 { margin: 6px 0 2px; font-size: .78rem; }
details.why ul { margin: 2px 0; padding-left: 16px; }
details.why p, details.why li { overflow-wrap: anywhere; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.kv { display: grid; grid-template-columns: minmax(0, 130px) minmax(0, 1fr); gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); font-size: .82rem; }
.kv > span:first-child { color: var(--muted); }
#info h3, .plan-card h3 { font-family: var(--period); }
button.link { background: none; border: none; padding: 0; color: var(--entente-2); text-decoration: underline; border-radius: 0; }
.plan-card h4, .end-grid h4, .howto h4, .bloc h4 { margin: 12px 0 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.op { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .86rem; }
.op.cancelled > div:first-child { opacity: .5; text-decoration: line-through; }
.opb { display: flex; gap: 4px; flex-wrap: wrap; }
.opb button { padding: 3px 9px; }
.post { display: grid; grid-template-columns: minmax(0, 1fr) 102px 102px; gap: 6px; align-items: center; font-size: .8rem; padding: 2px 0; }
.post.head { color: var(--muted); font-size: .72rem; }
.post select { padding: 2px 2px; font-size: .74rem; width: 100%; }
.srow { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 2px 8px; align-items: center; font-size: .82rem; padding: 3px 0; }
.srow > :last-child { grid-column: 2; }
.sdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); vertical-align: 0; }
.sdot.strained { background: #d9a400; } .sdot.cut { background: var(--front); }
textarea.code { width: 100%; font: .78rem ui-monospace, monospace; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px; resize: vertical; overflow-wrap: anywhere; margin: 4px 0 8px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgb(5 8 15 / .65); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: var(--gutter); }
.modal[hidden] { display: none; }
.dialog { background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: min(90vh, calc(100dvh - 2 * var(--gutter))); overflow: hidden; padding: 0; animation: pop .25s ease; display: flex; flex-direction: column; }
/* modal(): header and action bar stay put, only .m-scroll scrolls */
#modal-body { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.m-head { flex: none; padding: 20px 20px 4px; }
.m-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px; overscroll-behavior: contain; }
.m-head + .m-scroll { padding-top: 6px; }
.m-foot { flex: none; padding: 10px 20px 14px; border-top: 1px solid var(--line-2); }
.m-foot > .row { margin: 0; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.dialog.wide { width: min(980px, 100%); }
.dialog h2 { font-family: var(--serif); margin: 4px 0 12px; font-size: 1.35rem; line-height: 1.25; }
.kicker { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.choices { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.choice { text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 4px 10px; padding: 10px 12px; position: relative; overflow: hidden; }
.choice .pb { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--panel); }
.choice .pb > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.choice .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.choice.win { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.display { font-family: var(--period) !important; font-size: 2rem !important; letter-spacing: .02em; }
.blocs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; margin: 12px 0; }
.bloc { background: var(--panel-2); border-radius: 12px; padding: 4px 12px 10px; border-left: 4px solid var(--neutral); }
.bloc.central { border-color: var(--central); } .bloc.entente { border-color: var(--entente); }
.bloc .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.bloc .chip { border-left: none; background: var(--panel); }
.frow .sdot { margin-right: 3px; }
.howto ol { padding-left: 18px; margin: 4px 0 12px; } .howto li { margin: 4px 0; }
.end-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.endmap { width: 100%; aspect-ratio: 10 / 8; display: block; border-radius: 10px; background: var(--sea); }
.end-title { font-family: var(--period); font-size: 2rem; margin: 6px 0; }
.end-title.central_victory { color: var(--central); } .end-title.entente_victory { color: var(--entente); } .end-title.compromise_peace { color: var(--compromise); }
.devs { margin: 10px 0; padding-left: 18px; font-size: .86rem; max-height: 40vh; overflow-y: auto; }
.devs li { margin: 4px 0; }

/* monte carlo */
.mc-bar, .odds-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: var(--gutter); }
.progress { flex: 1 1 160px; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; min-width: 120px; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--entente), var(--central)); transition: width .2s; }
.mc-out { display: grid; gap: var(--gutter); }
.mc-col .hist { max-width: 640px; }
.mc-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--gutter); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.kpi { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }
.kpi b { display: block; font-family: var(--serif); font-size: 1.3rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .72rem; color: var(--muted); }
.donut-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 14px; align-items: center; }
.keys { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.keys div { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.keys b { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart text { fill: var(--muted); font: 11px var(--sans); }
.chart .axis path, .chart .axis line { stroke: var(--line-2); }
.chart .grid line { stroke: var(--line); }
.tp { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tp td, .tp th { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: middle; text-align: left; }
.tp th { color: var(--muted); font-weight: 500; font-size: .74rem; }
.tp td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dbar { position: relative; height: 8px; width: 100%; min-width: 60px; }
.dbar::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.dbar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.mc-workers { flex: 1 1 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 4px 18px; }
.mcw { display: grid; grid-template-columns: 4.6em minmax(80px, 1fr) auto; gap: 8px; align-items: center; font-size: .74rem; color: var(--muted); }
.mcw .progress { height: 5px; min-width: 80px; }
.mcw .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress[data-state=done] > div { background: var(--good); }
.progress[data-state=cancelled] > div, .progress[data-state=failed] > div { background: var(--muted); }
.empty { padding: 30px 0; text-align: center; }

/* scenario */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--gutter); }
.sc-grid .wide { grid-column: 1 / -1; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--gutter); }
.setup-col { display: grid; gap: 10px; align-content: start; min-width: 0; }
.setup-col h4 { margin: 0; }
.setup-col .sel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.setup-col .sel select, .su-save input { min-width: 0; width: 100%; }
.setup-col .sl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px; }
.su-reg { display: flex; gap: 10px; align-items: center; min-width: 0; }
.su-reg .sw { width: 16px; height: 16px; border-radius: 3px; margin-left: auto; flex: none; border: 1px solid var(--line); }
.su-save { flex-wrap: nowrap; } .su-save input { flex: 1; }
.su-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.su-list li { display: flex; gap: 6px; align-items: center; } .su-list li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sliders { display: grid; gap: 10px; }
.sl { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 52px; gap: 10px; align-items: center; font-size: .86rem; }
.sl output { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ptable, .ftable { display: grid; gap: 2px; }
.pe { display: grid; grid-template-columns: 140px 160px 110px repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.pe.head { color: var(--muted); font-size: .74rem; border-top: none; }
.pe label { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 4px; align-items: center; }
.pe output { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .78rem; text-align: right; }
.pe .lab { display: none; }
.fe { display: grid; grid-template-columns: 200px repeat(2, minmax(0, 1fr)); gap: 14px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.fe label { display: grid; grid-template-columns: 50px minmax(0, 1fr) 40px; gap: 6px; align-items: center; }
.fe output { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.changed { color: var(--accent); }
.start-state { margin-top: 12px; font-size: .86rem; }
.start-state .chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.chip { font-size: .74rem; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border-left: 3px solid var(--neutral); }
.chip.central { border-color: var(--central); } .chip.entente { border-color: var(--entente); } .chip.out { opacity: .55; text-decoration: line-through; }

/* odds */
.odds-bar input[type=search] { flex: 1 1 240px; }
.ogroup { margin-bottom: var(--gutter); }
.ogroup > h3 { margin: 6px 2px 8px; }
.oyear { font-size: .74rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 10px 2px 4px; }
details.node { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
details.node[open] { border-color: var(--line-2); }
details.node > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
details.node > summary::-webkit-details-marker { display: none; }
.nq { font-weight: 500; }
.nid { font-size: .74rem; color: var(--muted); font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.mini { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; grid-column: 1 / -1; }
.mini i { display: block; height: 100%; background: var(--ink-2); opacity: .45; }
.mini i.h { background: var(--good); opacity: .9; }
.nbody { padding: 4px 12px 12px; border-top: 1px solid var(--line); }
.orow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 200px) 52px 70px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.orow .ol { min-width: 0; }
.orow .ol small { display: block; color: var(--muted); }
.orow .pn { text-align: right; font-variant-numeric: tabular-nums; }
.orow .force { font-size: .78rem; }
.prose p, .nbody p { margin: 8px 0; }
.nbody h4 { margin: 12px 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nbody ul { margin: 0; padding-left: 18px; font-size: .84rem; }
.nbody li { margin: 3px 0; }
code { font-size: .8em; background: var(--panel-2); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }

/* sources */
.prose { margin-bottom: var(--gutter); max-width: 980px; }
.sources { padding-left: 22px; font-size: .88rem; }
.sources li { margin: 6px 0; }
.sources .n { color: var(--muted); font-size: .76rem; }
#srcq { width: 100%; margin: 4px 0 8px; }

.tip { position: fixed; pointer-events: none; z-index: 60; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; font-size: .8rem; max-width: 300px; box-shadow: var(--shadow); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 16px; z-index: 70; box-shadow: var(--shadow); font-size: .88rem; }

@media (max-width: 1000px) {
  .play-grid { grid-template-columns: minmax(0, 1fr); }
  .end-grid { grid-template-columns: minmax(0, 1fr); }
  .tabs { margin-left: 0; order: 3; width: 100%; }
  .pe { grid-template-columns: 1fr 1fr; }
  .pe.head { display: none; }
  .pe .pname { grid-column: 1 / -1; font-weight: 600; }
  .pe .lab { display: inline; color: var(--muted); }
  .pe label { grid-template-columns: 60px minmax(0, 1fr) 34px; grid-column: 1 / -1; }
  .fe { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 560px) {
  .brand .sub { display: none; }
  /* phone: all five tabs on one row without a hidden scroll overflow */
  .tabs { overflow: visible; gap: 2px; justify-content: space-between; }
  .tabs button { padding: 6px 6px; font-size: .8rem; flex: 1 1 auto; }
  .modebar button { padding: 3px 8px; font-size: .74rem; }
  .tools { width: 100%; }
  .tools select { flex: 1; max-width: none; }
  .donut-row { grid-template-columns: 1fr; justify-items: center; }
  .orow { grid-template-columns: minmax(0, 1fr) 52px; }
  .orow input[type=range] { grid-column: 1 / -1; grid-row: 2; }
  .orow .force { grid-column: 1 / -1; }
  .sl { grid-template-columns: minmax(0, 1fr) 52px; }
  .sl input { grid-column: 1 / -1; grid-row: 2; }
  .date { font-size: 1.4rem; }
  .map-wrap { aspect-ratio: 4 / 3.4; }
  .drawer .evfig img { max-height: 110px; }
  .dialog.wide .evcard { grid-template-columns: minmax(0, 1fr); }
  .evfig img { max-height: 160px; }
  #tp .tp th:nth-child(4), #tp .tp td:nth-child(4), #tp .tp th:nth-child(3), #tp .tp td:nth-child(3) { display: none; }
  .prow { grid-template-columns: 12px minmax(0, 1fr) 44px 44px 32px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================================================================ archive theme: a period war-office map room.
   Paper grain is an in-page SVG feTurbulence (no image files); it sits on static cards only, never over the map canvas. */
:root {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .26 0 0 0 0 .14 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .05' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --serif: 'IM Fell English', 'Old Standard TT', Georgia, serif; --period: 'Old Standard TT', Georgia, serif;
  --type: 'Courier Prime', 'Courier New', ui-monospace, monospace; --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 4px;
  /* lamplit archive (dark): ink-blue room, sepia paper under a warm lamp */
  color-scheme: dark;
  --bg: #111a27; --panel: #1f2633; --panel-2: #283041; --line: #39435a; --line-2: #56627e;
  --ink: #f0e4c8; --ink-2: #d8c8a6; --muted: #b0a184;
  --accent: #d9a74a; --brass: #c8963c; --stamp: #e0745e; --good: #6fc79a; --entente-2: #8fc3ea;
  --shadow: 0 8px 24px rgb(0 0 0 / .45); --desk: radial-gradient(120% 80% at 18% 0%, rgb(217 167 74 / .13), transparent 60%);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #ddd0b0; --panel: #f4ead2; --panel-2: #ebdfc1; --line: #d2c19a; --line-2: #a8925f;
    --ink: #2b2116; --ink-2: #4a3b28; --muted: #6a5839;
    --accent: #8a5d14; --brass: #a8792a; --stamp: #a3271c; --good: #1f6b43; --entente-2: #1f4f86;
    --shadow: 0 6px 18px rgb(60 40 10 / .18); --desk: radial-gradient(120% 90% at 50% 0%, rgb(255 250 230 / .5), transparent 70%);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ddd0b0; --panel: #f4ead2; --panel-2: #ebdfc1; --line: #d2c19a; --line-2: #a8925f;
  --ink: #2b2116; --ink-2: #4a3b28; --muted: #6a5839;
  --accent: #8a5d14; --brass: #a8792a; --stamp: #a3271c; --good: #1f6b43; --entente-2: #1f4f86;
  --shadow: 0 6px 18px rgb(60 40 10 / .18); --desk: radial-gradient(120% 90% at 50% 0%, rgb(255 250 230 / .5), transparent 70%);
}
body { background: var(--desk), var(--fibre), var(--bg); background-attachment: fixed; font-family: var(--period); font-size: 15.5px; }
h1, h2, h3, .dialog h2 { font-family: var(--serif); font-weight: 400; letter-spacing: .01em; }
/* card stock: grain, a hairline inner rule like a printed form */
.card, .dialog, details.node, .drawer, .tip { background-image: var(--grain); background-color: var(--panel); border-radius: var(--r);
  box-shadow: var(--shadow), inset 0 0 0 3px var(--panel), inset 0 0 0 4px var(--line); }
/* typed dossier labels on card headings */
.card > h3:first-of-type:not(.masthead), .ogroup > h3 { font: 700 .82rem/1.4 var(--type); text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2);
  border-bottom: 1px solid var(--line-2); padding-bottom: 4px; }
.kicker, .oyear, .prow.head, .post.head, .pe.head, .tp th, .nid, .sel, .chk, .kv > span:first-child, .kpi span, .legend, .tag { font-family: var(--type); }
.kicker { color: var(--accent); letter-spacing: .14em; }
/* buttons: brass fittings and ink */
button { border-radius: 3px; border-color: var(--line-2); font-family: var(--type); letter-spacing: .02em; }
button.primary, .mode button[aria-pressed=true], .modebar button[aria-pressed=true] { background: linear-gradient(180deg, color-mix(in srgb, var(--brass) 85%, #fff), var(--brass)); color: #1d1406; border-color: color-mix(in srgb, var(--brass) 70%, #000); }
select, input[type=search], input[type=number], textarea.code { border-radius: 3px; font-family: var(--type); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
/* letterhead and the brass seal */
.top { background: var(--grain), linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 60%, var(--bg))); border-bottom: 3px double var(--line-2); }
.brand h1 { font-size: 1.5rem; }
.brand .sub { font-family: var(--type); letter-spacing: .04em; }
.mark { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--brass) 60%, #fff), var(--brass) 55%, color-mix(in srgb, var(--brass) 55%, #000));
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--brass) 70%, #000), 0 1px 2px rgb(0 0 0 / .4); position: relative; }
.mark::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: conic-gradient(var(--central) 0 50%, var(--entente) 50% 100%); }
.caveat { font-style: italic; }
/* sections as file folders: manila tabs standing on the folder edge */
.tabs { gap: 2px; align-self: flex-end; margin-bottom: -15px; }
.tabs button { border: 1px solid var(--line-2); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--panel-2); color: var(--ink-2);
  font: 700 .8rem var(--type); text-transform: uppercase; letter-spacing: .08em; padding: 7px 14px 8px; }
.tabs button[aria-selected=true] { background: var(--panel); color: var(--ink); box-shadow: none; position: relative; top: 1px; }
/* rubber stamps: basis badges and file marks */
.basis { font: 700 .6rem/1.45 var(--type); text-transform: uppercase; letter-spacing: .06em; border-width: 1.5px; border-radius: 2px; transform: rotate(-2deg); padding: 0 4px; }
.basis.pending { color: var(--stamp); border: 1.5px dashed var(--stamp); font-style: normal; font-weight: 700; }
.stamp { display: inline-block; font: 700 .9rem/1 var(--type); letter-spacing: .2em; text-transform: uppercase; color: var(--stamp); border: 2.5px solid var(--stamp);
  border-radius: 3px; padding: 3px 8px 2px; transform: rotate(-6deg); opacity: .8; }
.log-card, .plan-card { position: relative; }
.card-stamp { position: absolute; right: 14px; top: 10px; pointer-events: none; }
/* map room: inked double frame, cartouche, compass */
.map-head { background-image: var(--grain); border-bottom: 1px solid var(--line-2); }
.cartouche { border: 1px solid var(--ink-2); outline: 1px solid var(--line-2); outline-offset: 3px; padding: 6px 14px 5px; text-align: center; margin: 4px; background: var(--panel); }
.cartouche .ctitle { font: 700 .66rem var(--type); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); display: block; }
.cartouche .date { font-family: var(--serif); font-size: 1.75rem; }
.map-wrap { border: 2px solid var(--ink-2); outline: 1px solid var(--line-2); outline-offset: -6px; margin: 8px; }
.compass { position: absolute; right: 12px; bottom: 12px; width: 62px; height: 62px; pointer-events: none; opacity: .88; color: var(--ink); }
.modebar button { border-radius: 3px; }
/* the gazette: newsprint with a deckled lower edge */
.paper { -webkit-mask: radial-gradient(5px 4px at 50% 100%, transparent 98%, #000) 0 0 / 9px 100% repeat-x, linear-gradient(#000 0 0) 0 0 / 100% calc(100% - 3px) no-repeat;
  mask: radial-gradient(5px 4px at 50% 100%, transparent 98%, #000) 0 0 / 9px 100% repeat-x, linear-gradient(#000 0 0) 0 0 / 100% calc(100% - 3px) no-repeat; padding-bottom: 18px; }
.paper .masthead { font-family: var(--serif); font-size: 1.8rem; }
.modal { background: rgb(20 14 6 / .6); }
.kpi, .bloc, .chip, .choice { border-radius: 3px; }
.dtree text, .chart text { font-family: var(--type); }
/* divergence tree (Monte Carlo) */
.tree-tools { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 8px 0 10px; }
.tree-tools input[type=search] { flex: 1 1 220px; min-width: 0; }
.tree-tools .sl { flex: 1 1 300px; min-width: 0; }
.dtree { width: 100%; display: block; touch-action: none; cursor: grab; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); }
.dtree:active { cursor: grabbing; }
.dtree .axis text { font-size: 10px; fill: var(--muted); }
.dtree .axis line { stroke: var(--line); }
.dtree .axis .domain { display: none; }
.dtree .lk { fill: none; stroke-opacity: .5; stroke-linecap: round; }
.dtree .lk.rest { stroke-dasharray: 5 4; }
.dtree .lk.hist { stroke: var(--brass, var(--accent)); stroke-opacity: .9; stroke-dasharray: none; }
.dtree .tnode { cursor: pointer; outline: none; }
.dtree .tnode text { font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--panel-2); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.dtree .tnode .l2 { fill: var(--ink-2); font-size: 10px; }
.dtree .pie path { stroke: var(--panel-2); stroke-width: .8; }
.dtree .ring { fill: var(--panel-2); stroke: none; stroke-width: 2; }
.dtree .shut .ring { stroke: var(--ink-2); stroke-dasharray: 2 2; }
.dtree .hist .ring { stroke: var(--brass, var(--accent)); stroke-dasharray: none; }
.dtree .other .pie { opacity: .55; }
.dtree .sel .ring, .dtree .hit .ring, .dtree .tnode:focus-visible .ring { stroke: var(--accent); stroke-width: 3; stroke-dasharray: none; }
.dtree .sel .l1 { font-weight: 700; }
.dtree .dim { opacity: .2; }
.dtree.tight .l2, .dtree.tiny text { display: none; }
.dtree.tiny .hist text, .dtree.tiny .sel text { display: inline; }
.mix { display: flex; height: 5px; border-radius: 2px; overflow: hidden; background: var(--line); }
.mix i { display: block; height: 100%; }
.tree-sel { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.tree-sel .mix { max-width: 320px; }
.tree-path { padding-left: 20px; }
.tree-path li { margin: 0 0 8px; }
button.prow { width: 100%; border: 0; border-bottom: 1px dotted var(--line); border-radius: 0; background: none; padding: 3px 0; font-family: var(--period); letter-spacing: 0; text-align: left; color: var(--ink); }
button.prow:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.brand .sub { font-size: .7rem; letter-spacing: .02em; }
.tools button, .tools select { font-size: .78rem; padding: 5px 9px; }
.tools .icon { width: 32px; padding: 5px 0; }
/* narrower than one letterhead row: the folder tabs get their own row on the lower edge */
@media (max-width: 1400px) and (min-width: 561px) { .tabs { order: 3; width: 100%; justify-content: flex-end; margin-top: -6px; } .tools { margin-left: auto; } }
@media (max-width: 1000px) { .tabs { margin-bottom: -13px; } }
@media (max-width: 560px) {
  .tabs button { padding: 6px 4px 7px; font-size: .68rem; letter-spacing: .03em; }
  .map-wrap { margin: 4px; }
  .compass { width: 40px; height: 40px; right: 6px; bottom: 6px; }
  .cartouche .date { font-size: 1.35rem; }
  .card-stamp { display: none; }
}

/* custom plans (Plan view) */
.pform { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 6px 8px; }
.pform label { display: grid; gap: 2px; font-size: .78rem; color: var(--muted); min-width: 0; }
.pform label.wide, .pform fieldset { grid-column: 1 / -1; }
.pform select, .pform input { width: 100%; min-width: 0; padding: 4px 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; color: var(--ink); }
.pform fieldset { border: 1px solid var(--line); border-radius: 3px; padding: 4px 8px; display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 0; }
.pform fieldset .chk { display: inline-flex; gap: 4px; color: var(--ink); }
.log li.plan .o { color: var(--accent); }

/* politics panel */
.polit { border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; margin: 8px 0; background: var(--panel-2); }
.pol-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.portrait { border-radius: 4px; flex: none; vertical-align: middle; object-fit: cover; }
.kv .portrait { width: 22px; height: 22px; }
.pol-charts { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-around; margin: 6px 0; }
.pol-charts figure { margin: 0; text-align: center; max-width: 150px; }
.pol-charts svg { color: var(--ink-2); display: block; margin: 0 auto; }
.parties { list-style: none; padding: 0; margin: 4px 0; } .parties li { margin: 2px 0; } .parties .dot { margin-right: 5px; }
.polit .chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* welcome screen */
.welcome .hero { position: relative; margin: -4px -4px 8px; border-radius: 4px; overflow: hidden; min-height: 150px; background: #3a3027; }
.welcome .hero img, .welcome .hero-art { display: block; width: 100%; height: 210px; object-fit: cover; }
.welcome .hero .credit { position: absolute; right: 6px; top: 4px; color: #fff; text-shadow: 0 1px 2px #000; font-size: .62rem; opacity: .75; max-width: 60%; text-align: right; z-index: 1; }
.welcome .hero .credit a { color: inherit; }
.credits { margin: 6px 0 0; line-height: 1.35; overflow-wrap: anywhere; }
img.flag { width: auto; border: 1px solid var(--line); border-radius: 2px; vertical-align: middle; }
.ctry-h { display: flex; align-items: center; gap: 8px; }
.credits-d summary { cursor: pointer; }
.hero-title { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: #f6ecd6;
  background: linear-gradient(transparent, rgb(20 16 12 / .82)); }
.hero-title h2 { margin: 0; color: #f6ecd6; } .hero-title .kicker { color: #e6c79a; } .hero-title p { margin: 0; }
.logo { flex: none; color: #f0d9a8; transform: rotate(-8deg); opacity: .92; }
.starts, .picks { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.picks { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.startb, .pick { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.pick { flex-direction: row; align-items: center; font-size: .84rem; }
.startb[aria-checked="true"], .pick[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.welcome details { margin: 10px 0; } .welcome summary { cursor: pointer; }
@media (max-width: 560px) { .welcome .hero img, .welcome .hero-art { position: absolute; inset: 0; height: 100%; } .logo { width: 64px; height: 64px; } .hero-title { position: relative; padding-top: 70px; flex-direction: column; align-items: flex-start; } }

/* ================================================================ play screen: one 16:9 board on landscape screens
   (top bar, details rail, map, powers rail, docked strip with map modes and the Gazette); stacked on phones / portrait */
button svg { width: 15px; height: 15px; vertical-align: -2px; flex: none; }
.rail-t svg, #zoom-world svg { fill: none; stroke: currentColor; stroke-width: 1.4; }
#play svg, #step svg { fill: currentColor; }
#play, #step { display: inline-flex; align-items: center; gap: 6px; }
.stage { display: grid; gap: 8px; grid-template-columns: var(--rl) minmax(0, 1fr) var(--rr); grid-template-rows: auto minmax(0, 1fr) var(--strip);
  grid-template-areas: "bar bar bar" "l map r" "strip strip strip"; --rl: clamp(230px, 19%, 330px); --rr: clamp(250px, 22%, 370px); --strip: clamp(118px, 21%, 210px); }
.playbar { grid-area: bar; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-width: 0; }
.playbar .controls { padding: 0; border: 0; flex: 1 1 auto; gap: 6px 8px; }
.playbar .cartouche { margin: 0 4px; padding: 3px 12px; display: flex; align-items: baseline; gap: 10px; text-align: left; }
.playbar .cartouche .date { font-size: 1.45rem; white-space: nowrap; }
.playbar .cartouche .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
.rail { min-height: 0; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; overscroll-behavior: contain; }
.rail > .card { flex: none; }
.rail-l { grid-area: l; } .rail-r { grid-area: r; }
.map-card { grid-area: map; min-height: 0; min-width: 0; display: flex; padding: 0; overflow: visible; align-self: stretch; }
.map-card .map-wrap { flex: 1; min-height: 0; aspect-ratio: auto; margin: 0; }
.drawer { grid-area: r; }
.strip { grid-area: strip; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; min-height: 0; }
.mapkey { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px 2px 0; }
.mapkey .modebar { padding: 0; } .mapkey .legend { padding: 0; }
.strip .log-card { grid-column: auto; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 14px; padding: 6px 12px 12px; }
.strip .masthead { font-size: 1.2rem; border-bottom: 0; padding: 0; text-align: left; }
.strip .dateline { margin: 0; padding: 0; border: 0; align-self: center; text-align: right; }
.strip .log { grid-column: 1 / -1; max-height: none; min-height: 0; border-top: 3px double var(--line-2); }
/* short strip: clamp so one report never splits across columns; the card holds the full story */
.strip .log .o, .strip .log .q { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.strip .log .q { -webkit-line-clamp: 2; }
.strip .log li { padding: 4px 0; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font: italic 1.05rem var(--period); color: var(--ink-2); background: color-mix(in srgb, var(--sea) 70%, transparent); z-index: 2; pointer-events: none; }
.loading[hidden] { display: none; }
.ptabs { display: none; }
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  body[data-tab=play] { height: 100vh; height: 100dvh; overflow: hidden; display: grid; place-items: center; }
  body[data-tab=play] .shell { width: min(100vw, 100dvh * 16 / 9); height: min(100dvh, 100vw * 9 / 16); display: flex; flex-direction: column; overflow: hidden; }
  body[data-tab=play] .top { position: static; padding: 6px var(--gutter); }
  body[data-tab=play] .top { flex-wrap: nowrap; gap: 12px; } body[data-tab=play] .brand .sub { display: none; } body[data-tab=play] .brand h1 { font-size: 1.25rem; white-space: nowrap; }
  body[data-tab=play] .tabs { order: 0; width: auto; margin: 0 0 -7px auto; } body[data-tab=play] .tools { margin-left: 0; flex-wrap: nowrap; }
  body[data-tab=play] .tabs button { padding: 5px 10px 6px; font-size: .74rem; }
  body[data-tab=play] .caveat { padding: 3px var(--gutter); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .74rem; }
  body[data-tab=play] main { flex: 1; min-height: 0; width: 100%; max-width: none; padding: 8px; }
  body[data-tab=play] #tab-play, body[data-tab=play] .stage { height: 100%; }
  .stage.no-l { --rl: 0px; } .stage.no-r { --rr: 0px; }
  .stage.no-l .rail-l, .stage.no-r .rail-r { display: none; }
  .stage.no-r:has(.drawer:not([hidden])) { --rr: clamp(250px, 22%, 370px); }
  .strip .log { columns: 2; column-gap: 24px; column-rule: 1px solid var(--line); }
  .strip .log li { break-inside: avoid; }
}
@media (min-width: 1700px) and (min-aspect-ratio: 4/3) { .stage { --strip: clamp(118px, 20%, 230px); } .strip .log { columns: 3; } }
/* phones and portrait: map first, then the map key, a panel switcher and one panel; events as a bottom sheet */
@media not ((min-width: 900px) and (min-aspect-ratio: 4/3)) {
  .stage { display: flex; flex-direction: column; gap: 8px; }
  .strip { display: contents; }
  .playbar { order: 0; } .map-card { order: 1; } .mapkey { order: 2; overflow: visible; } .ptabs { order: 3; } .rail, .strip .log-card { order: 4; }
  .map-card .map-wrap { aspect-ratio: 4 / 3.6; flex: none; width: 100%; }
  .rail { overflow: visible; }
  .rail-t { display: none; }
  .stage:not([data-pane=info]) .rail-l, .stage:not([data-pane=side]) .rail-r, .stage:not([data-pane=log]) .strip .log-card { display: none; }
  .strip .log { max-height: 60vh; }
  .ptabs { display: flex; gap: 4px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 4px 0; }
  .ptabs button { flex: 1; padding: 6px 4px; }
  .ptabs button[aria-pressed=true] { background: var(--panel); border-color: var(--accent); color: var(--ink); }
  .drawer { position: fixed; left: 0; right: 0; bottom: 0; max-height: 62dvh; border-radius: 10px 10px 0 0; z-index: 40; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); }
  .playbar .cartouche .small { max-width: 16ch; }
}
/* welcome hero: a paper scrim calms the busy period map/photo under the title */
.welcome .hero img { filter: sepia(.45) saturate(.7) contrast(.92); }
.welcome .hero::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgb(244 234 210 / .38), rgb(244 234 210 / .12) 40%, rgb(20 16 12 / .5)), var(--grain); }
.welcome .hero .hero-title, .welcome .hero .credit { z-index: 1; }

.su-prompt { margin: 0 0 .7rem; padding: .5rem .7rem; border-left: 3px solid var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); border-radius: 4px; }
.su-foot { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 8px 0; margin-top: 6px; background: var(--panel); border-top: 1px solid var(--line-2); }
#plan-edit > .row { position: sticky; bottom: 0; z-index: 2; padding: 6px 0; background: var(--panel); }
.drawer .evnav { position: sticky; top: -8px; z-index: 2; background: var(--panel); }
