:root {
  --bg: #0b1015;
  --bg-2: #10171e;
  --panel: #151e27;
  --panel-2: #1b2631;
  --line: #2a3745;
  --text: #e3e9ef;
  --muted: #8d9bab;
  --amber: #e8b04a;
  --amber-ink: #1b1304;
  --good: #5ec49a;
  --bad: #ee6b57;
  --flat: #8d9bab;
  --blue: #6fa8d6;
  --violet: #a58be0;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font-body);
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.1; letter-spacing: 0.01em; }
h1 { font-size: clamp(30px, 5vw, 46px); }
h2 { font-size: 26px; }
h3 { font-size: 21px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.lede { color: var(--muted); max-width: 62ch; margin-top: 8px; }

button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible, input:focus-visible, label:focus-within { outline: 2px solid var(--amber); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: rgba(11, 16, 21, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { font: 700 22px var(--font-display); letter-spacing: 0.04em; color: var(--amber); }
.status { display: flex; gap: 14px; margin-left: auto; align-items: baseline; font-family: var(--font-display); }
.status-day { font-size: 24px; font-weight: 600; }
.status-turn { font-size: 17px; color: var(--muted); }
#drawer-toggle { margin-left: 0; }

.ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; color: var(--muted);
}
.ghost:hover { color: var(--text); border-color: var(--muted); }
.primary {
  background: var(--amber); color: var(--amber-ink); border: 0; border-radius: 6px;
  padding: 12px 24px; font: 700 20px var(--font-display); letter-spacing: 0.03em;
}
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary:disabled { opacity: 0.4; cursor: not-allowed; }

.shell { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.banner { background: #3a1814; border: 1px solid var(--bad); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.screen > * + * { margin-top: 20px; }

/* setup */
.scenario-list { display: grid; gap: 20px; }
.scenario { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.scenario-meta { color: var(--muted); margin-top: 4px; }
.scenario p.intro { margin-top: 12px; max-width: 70ch; }
.actor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.actor-card {
  text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px; min-height: 150px;
}
.actor-card:hover { border-color: var(--amber); }
.actor-card h3 { color: var(--amber); }
.actor-card .primer { font-size: 14px; color: var(--muted); flex: 1; }
.actor-card .pick { font: 600 17px var(--font-display); }

/* theatre */
.theatre { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .theatre { grid-template-columns: 1.15fr 1fr; align-items: start; } }
.dashboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gauge { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; position: relative; overflow: hidden; }
.gauge-label { font-size: 14px; color: var(--muted); line-height: 1.25; min-height: 2.5em; }
.gauge-value { font: 600 38px/1 var(--font-display); margin-top: 6px; font-variant-numeric: tabular-nums; }
.gauge-value small { font-size: 16px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.gauge-delta { font: 600 16px var(--font-display); margin-top: 4px; }
.gauge-bar { height: 3px; background: var(--line); margin-top: 8px; border-radius: 2px; }
.gauge-bar i { display: block; height: 100%; background: var(--muted); border-radius: 2px; }
.d-good { color: var(--good); }
.d-bad { color: var(--bad); }
.d-flat { color: var(--flat); }

.map { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; aspect-ratio: 1350 / 960; background: #0e1a2b; }
.map-basemap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.map-dots { position: absolute; inset: 0; }
.dot { position: absolute; transform: translate(-50%, -9px); /* centre the circle, not circle+label, on the point */ display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.dot i { width: 14px; height: 14px; border-radius: 50%; background: var(--blue); border: 2px solid #0b1015; position: relative; }
.dot.me i { background: var(--amber); }
.dot span { font: 600 14px var(--font-display); background: rgba(11, 16, 21, 0.82); padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.dot.active i::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid var(--bad);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dot.active i::after { animation: none; } }

.ladder { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ladder-head { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.ladder-head b { color: var(--text); font-family: var(--font-display); font-size: 18px; }
.rungs { display: flex; gap: 3px; margin-top: 8px; }
.rung { flex: 1; height: 12px; background: var(--line); border-radius: 2px; }
.rung.on { background: var(--amber); }
.rung.hot { background: var(--bad); }

/* orders */
.orders { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.orders-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 12px; }
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.personal { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.card h3 { color: var(--text); }
.card .why { font-size: 14px; color: var(--amber); }
.card .summary { font-size: 15px; color: var(--muted); }
.staff-line { font-size: 14px; background: var(--panel-2); border-radius: 5px; padding: 6px 8px; }
.mode { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.mode button { flex: 1; background: transparent; border: 0; padding: 7px 8px; font: 600 16px var(--font-display); color: var(--muted); }
.mode button[aria-pressed="true"] { background: var(--amber); color: var(--amber-ink); }
.mode button + button { border-left: 1px solid var(--line); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: block; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .opt-label { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.opt .opt-desc { font-size: 14px; color: var(--muted); margin-top: 2px; }
.opt .opt-advice { font-size: 13px; color: var(--blue); margin-top: 4px; }
.opt.selected { border-color: var(--amber); background: rgba(232, 176, 74, 0.1); }
.opts.locked .opt { opacity: 0.4; cursor: not-allowed; }
.stance { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; align-self: flex-start; white-space: nowrap; }
.submit-bar { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }

/* modal report */
.modal { position: fixed; inset: 0; background: rgba(4, 7, 10, 0.82); z-index: 40; overflow-y: auto; padding: 16px; }
.modal-card { max-width: 920px; margin: 0 auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.report-sec { margin-top: 22px; }
.report-sec h3 { margin-bottom: 8px; color: var(--amber); }
.ticker { list-style: none; margin: 0; padding: 0; border-left: 3px solid var(--amber); }
.ticker li { padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--bg); }
.ticker li.mine { border-left: 3px solid var(--amber); margin-left: -3px; }
.ticker li.event { color: #d9cffa; }
.ticker .tag { font: 600 14px var(--font-display); color: var(--muted); margin-right: 8px; }
.plain-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.plain-list li { background: var(--panel); border-radius: 6px; padding: 8px 12px; }
.plain-list .by { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; }
table.changes { width: 100%; border-collapse: collapse; min-width: 560px; }
.changes th { text-align: left; font: 600 15px var(--font-display); color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
.changes td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.changes td.num { font: 600 19px var(--font-display); white-space: nowrap; font-variant-numeric: tabular-nums; }
.changes td.num .arrow { color: var(--muted); margin: 0 4px; }
.changes .unit { color: var(--muted); font-size: 14px; }
.chip { display: inline-block; font-size: 13px; border-radius: 4px; padding: 1px 7px; margin: 0 4px 4px 0; border: 1px solid var(--line); background: var(--panel); }
.chip.your_decisions { border-color: var(--amber); }
.chip.other_nations { border-color: var(--blue); }
.chip.events { border-color: var(--violet); }
.chip.world { border-color: var(--flat); }
.chip.unexplained { border-style: dashed; border-color: var(--bad); color: #f3b4aa; }
.report-foot { display: flex; justify-content: flex-end; margin-top: 24px; }
.empty { color: var(--muted); font-style: italic; }

/* end */
.outcome { border-radius: 10px; padding: 24px; border: 1px solid var(--line); background: var(--panel); border-left: 8px solid var(--flat); }
.outcome.good { border-left-color: var(--good); }
.outcome.bad { border-left-color: var(--bad); }
.outcome.mixed { border-left-color: var(--amber); }
.outcome p { margin-top: 12px; max-width: 70ch; font-size: 18px; line-height: 1.6; }
.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.chart-box svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 14px; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.timeline { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 12px; }
.timeline > li { display: grid; grid-template-columns: 90px 1fr; gap: 12px; }
.timeline .when { font: 600 18px var(--font-display); color: var(--amber); }
.timeline ul { margin: 0; padding-left: 18px; color: var(--text); }
.end-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--bg-2); border-left: 1px solid var(--line); z-index: 30; overflow-y: auto; padding: 16px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.var-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.var-row .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.var-row .desc { font-size: 14px; color: var(--muted); margin-top: 2px; }

.foot { color: #5d6b79; font-size: 12px; text-align: center; padding: 0 16px 24px; }

@media (max-width: 600px) {
  .status-turn { display: none; }
  .gauge-value { font-size: 32px; }
  .modal-card { padding: 14px; }
  .timeline > li { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 600px) {
  table.changes { min-width: 0; display: block; }
  .changes thead { display: none; }
  .changes tbody, .changes tr { display: block; }
  .changes tr { display: grid; grid-template-columns: 1fr auto auto; gap: 0 10px; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .changes td { border: 0; padding: 2px 0; }
  .changes td:last-child { grid-column: 1 / -1; padding-top: 4px; }
}

.dot.offmap i { border-style: dashed; }
.dot.offmap span::after { content: " (abroad)"; opacity: 0.7; }
.landmark { position: absolute; transform: translate(-7px, -50%); display: flex; align-items: center; gap: 4px; pointer-events: none; }
.landmark i { width: 10px; height: 10px; transform: rotate(45deg); border: 2px solid var(--amber); }
.landmark span { font: 600 12px var(--font-display); color: var(--amber); text-shadow: 0 1px 2px #000; white-space: nowrap; }

/* ===================== v2: calmer, wordier ===================== */
.shell { padding-top: 28px; }
.screen > * + * { margin-top: 28px; }
.primary.big { font-size: 24px; padding: 14px 44px; }
.debug-tag { font: 600 13px var(--font-display); color: var(--bad); border: 1px solid var(--bad); border-radius: 10px; padding: 0 8px; }
.dbg { font: 500 13px var(--font-body); color: var(--blue); }
.debug-flag { color: var(--bad); font: 600 15px var(--font-display); margin-top: 28px; }
.debug-block { border-top: 1px dashed var(--bad); margin-top: 28px; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--amber); font: 600 16px var(--font-body); text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }
.linkish:hover { color: #f3c876; }
.sec-title { font-size: 22px; color: var(--muted); margin-bottom: 12px; }

/* welcome */
body.on-welcome { overflow: hidden; }
.welcome { position: fixed; inset: 0; z-index: 50; background: #070b10; overflow-y: auto; display: flex; align-items: center; }
.wmap { position: fixed; inset: 0; overflow: hidden; }
.wmap-drift { position: absolute; inset: 0; animation: drift 70s ease-in-out infinite alternate; transform-origin: 70% 48%; }
.wmap-stage { position: absolute; left: 50%; top: 50%; --wr: 1.40625; width: max(100vw, calc(100vh * var(--wr))); aspect-ratio: var(--wr); transform: translate(-50%, -50%); }
.wmap-img { position: absolute; inset: 0; width: 100%; height: 100%; filter: saturate(0.9) brightness(1.25) contrast(1.1); }
.wmap-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lane { fill: none; stroke: rgba(232, 176, 74, 0.8); stroke-width: 3; stroke-dasharray: 3 22; stroke-linecap: round; animation: flow 6s linear infinite; vector-effect: non-scaling-stroke; }
.lane2 { stroke: rgba(111, 168, 214, 0.75); animation-duration: 8s; animation-direction: reverse; }
.lane3 { stroke: rgba(232, 176, 74, 0.55); animation-duration: 10s; }
.hot circle:first-child { fill: var(--amber); stroke: #0b1015; stroke-width: 2; }
.hot .ring { fill: none; stroke: var(--amber); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 3s ease-out infinite; }
.hot .r2 { animation-delay: 1.5s; }
.hot.landmark-hot circle:first-child { fill: var(--bad); }
.hot.landmark-hot .ring { stroke: var(--bad); }
.hot:nth-of-type(2) .ring { animation-delay: .6s; } .hot:nth-of-type(3) .ring { animation-delay: 1.2s; } .hot:nth-of-type(4) .ring { animation-delay: 1.8s; }
.wmap-sweep { position: absolute; left: 69.8%; top: 48.4%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(232, 176, 74, 0.0) 0deg, rgba(232, 176, 74, 0.0) 300deg, rgba(232, 176, 74, 0.16) 360deg);
  animation: sweep 12s linear infinite; mix-blend-mode: screen; }
.wmap-shade { position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(7, 11, 16, 0.94) 0%, rgba(7, 11, 16, 0.78) 45%, rgba(7, 11, 16, 0.3) 100%),
              radial-gradient(ellipse at 50% 120%, rgba(7, 11, 16, 0.9), transparent 60%); }
@keyframes drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.14) translate(-2.5%, 1.5%); } }
@keyframes flow { to { stroke-dashoffset: -250; } }
@keyframes ping { from { transform: scale(1); opacity: 0.9; } to { transform: scale(4.5); opacity: 0; } }
@keyframes sweep { to { transform: translate(-50%, -50%) rotate(360deg); } }
.welcome-copy { position: relative; max-width: 640px; padding: 48px 24px 48px max(24px, 7vw); margin: auto 0; }
.welcome-kicker { color: var(--amber); font: 600 20px var(--font-display); letter-spacing: 0.06em; }
.welcome-copy h1 { font-size: clamp(56px, 11vw, 110px); line-height: 0.95; margin: 6px 0 18px; letter-spacing: 0.02em; }
.welcome-hook { font-size: 21px; line-height: 1.45; max-width: 40ch; }
.how { list-style: none; margin: 30px 0 34px; padding: 0; display: grid; gap: 14px; }
.how li { padding-left: 16px; border-left: 2px solid var(--amber); color: #c5d0db; font-size: 17px; }
.how b { color: var(--text); }
@media (max-width: 600px) {
  .welcome-copy { padding: 28px 20px 40px; }
  .wmap-shade { background: linear-gradient(180deg, rgba(7, 11, 16, 0.9), rgba(7, 11, 16, 0.8)); }
  .welcome-hook { font-size: 19px; }
  .how li { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .wmap-drift, .lane, .hot .ring, .wmap-sweep { animation: none; }
}

/* news panel */
.news { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 8px; padding: 22px 26px; }
.news h2 { color: var(--amber); font-size: 24px; margin-bottom: 10px; }
.news p { max-width: 72ch; font-size: 17px; line-height: 1.6; }
.news p + p { margin-top: 10px; }
.news-text p { font-size: 17px; line-height: 1.65; margin-top: 14px; }

/* tiles */
.dashboard { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 16px 14px; }
.tile-label { font-size: 15px; color: var(--muted); }
.tile-reading { font: 600 30px/1.1 var(--font-display); margin: 8px 0 6px; text-transform: capitalize; }
.tile-trend { font: 600 17px var(--font-display); }
.dash-col .linkish { margin-top: 14px; }
.trend-line { font: 600 15px var(--font-display); margin-top: 2px; }
.journey { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.journey li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.j-label { color: var(--muted); }
.j-words b { font-weight: 600; }

/* orders */
.orders { padding: 22px; }
.orders-head { flex-direction: column; gap: 8px; margin-bottom: 18px; align-items: flex-start; }
.orders-head .muted { font-size: 16px; }
.slot { display: inline-block; margin-left: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; font-size: 14px; }
.slot.used { border-color: var(--amber); color: var(--amber); }
.cards { gap: 18px; }
.card { padding: 20px; gap: 12px; }
.card .summary { line-height: 1.5; }
.staff-line.divided { color: var(--muted); }
.staff-line.mine { color: var(--amber); background: rgba(232, 176, 74, 0.1); }
.mode-btn { margin-top: auto; background: transparent; border: 1px solid var(--amber); color: var(--amber); border-radius: 6px; padding: 9px 10px; font: 600 18px var(--font-display); }
.mode-btn:hover { background: rgba(232, 176, 74, 0.12); }
.mode-btn.on { border-color: var(--line); color: var(--muted); }
.opts { gap: 10px; }

/* report */
.modal-card.narrow { max-width: 640px; margin-top: 8vh; }
.report-sec { margin-top: 28px; }
.plain-list { gap: 8px; }
.plain-list li { padding: 12px 14px; }
.who { display: block; font: 600 14px var(--font-display); color: var(--muted); }
.who.you { color: var(--amber); }
.var-row { padding: 14px 0; }
#end-body > * + * { margin-top: 24px; }
@media (max-width: 600px) {
  .dashboard { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 12px; }
  .tile-reading { font-size: 25px; }
  .wmap-shade { background: linear-gradient(180deg, rgba(7, 11, 16, 0.78), rgba(7, 11, 16, 0.7)); }
}
#news-modal-body .muted { margin-top: 6px; }

/* ------------------------------------------------------------ multiplayer page */
.admin-body .shell { max-width: 860px; }
.brand-link { text-decoration: none; }
.admin-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 16px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 22px; }
.step-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--amber); color: var(--amber-ink); font: 700 18px var(--font-display); }
.pick-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pick-card { display: grid; gap: 6px; align-content: start; text-align: left; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; padding: 14px; color: var(--text); }
.pick-card b { font: 600 22px var(--font-display); color: var(--amber); }
.pick-card .muted { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.pick-card:hover { border-color: var(--muted); }
.pick-card.on { border-color: var(--amber); background: #1f2a36; }
.pick-meta { font-size: 13px; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: grid; gap: 6px; font-weight: 600; }
.field select, .field input, .style-select, .link-input {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit;
}
.narrow-field select { max-width: 260px; }
.seat-rows { display: grid; gap: 8px; }
.seat-row { display: grid; grid-template-columns: minmax(120px, 1fr) auto minmax(150px, 200px); gap: 12px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.seat-row.is-human { border-color: var(--amber); }
.seat-who { display: grid; gap: 2px; min-width: 0; }
.seat-primer { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name { font: 600 19px var(--font-display); color: var(--amber); }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tg { background: transparent; border: 0; padding: 6px 14px; color: var(--muted); }
.tg.on { background: var(--amber); color: var(--amber-ink); font-weight: 700; }
.tg:disabled { opacity: 0.35; cursor: not-allowed; }
.howto { margin: 12px 0 0 20px; display: grid; gap: 6px; color: var(--muted); max-width: 62ch; }
.howto b { color: var(--text); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr auto; gap: 10px; align-items: center; }
.link-actions { display: inline-flex; gap: 6px; }
.link-input { width: 100%; min-width: 0; font-size: 14px; }
.status-list { display: grid; gap: 6px; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.status-row .status-who { flex: 1; min-width: 100px; }
.chip { font-size: 13px; font-weight: 600; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--line); }
.chip-ok { color: #8fd18f; border-color: #3d6b3d; }
.chip-live { color: var(--amber); border-color: var(--amber); }
.chip-wait { color: #d9a07a; border-color: #7a553a; }
.chip-ai, .chip-idle { color: var(--muted); }
.admin-actions { display: flex; gap: 12px; }
.linklike { text-decoration: none; display: inline-block; }
.amber { color: var(--amber); }
.seat-table td, .seat-table th { text-align: left; }
@media (max-width: 640px) {
  .seat-row { grid-template-columns: 1fr auto; }
  .seat-row .style-select { grid-column: 1 / -1; }
  .link-actions { flex-wrap: wrap; }
  .link-row { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ multiplayer: join, waiting, countdown */
.join-card { max-width: 560px; margin: 40px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }
.join-card .kicker { color: var(--muted); font: 600 16px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.join-card h1 { color: var(--amber); }
.waiting { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; padding: 18px 20px; display: grid; gap: 6px; }
.waiting h2 { font-size: 24px; }
.countdown { background: #2a2210; border: 1px solid var(--amber); border-radius: 8px; padding: 14px 18px; display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.countdown .time { font: 700 38px var(--font-display); color: var(--amber); font-variant-numeric: tabular-nums; }
.countdown .msg { font: 600 20px var(--font-display); }
.countdown.urgent { border-color: var(--bad); background: #301511; }
.countdown.urgent .time { color: var(--bad); }
.pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); margin-right: 8px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.timeout-note { color: var(--amber); font-style: italic; }

/* Report: each choice reads on its own, even for cards the player never opened. */
.choice { display: grid; gap: 4px; }
.choice-q { margin: 0; color: var(--muted, #9aa7b4); }
.choice-q b { color: inherit; font-weight: 600; }
.choice-a { margin: 0; }
.choice-a b { color: var(--amber); }
.choice-d { display: block; color: var(--muted, #9aa7b4); font-size: 0.92em; margin-top: 2px; }
.choice.mine { border-left: 3px solid var(--amber); }
.secret-tag { font-style: normal; font-size: 0.85em; opacity: 0.75; margin-left: 6px; }

/* ------------------------------------------------------------ v4: adviser flip cards */
.card { padding: 0; background: transparent; border: 0; box-shadow: none; perspective: 1400px; display: block; }
.card.personal { border: 0; box-shadow: none; }
.card-inner { position: relative; transform-style: preserve-3d; transition: transform 450ms cubic-bezier(.4, .1, .2, 1), height 450ms ease; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face {
  position: absolute; top: 0; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.face.back { transform: rotateY(180deg); border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.adviser { display: flex; align-items: center; gap: 12px; }
.adv-name { font: 600 19px/1.1 var(--font-display); }
.adv-role { font-size: 13px; color: var(--muted); line-height: 1.25; }
.avatar { position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: #2b3a4b; border: 2px solid var(--line); display: inline-grid; place-items: center; }
.avatar b { font: 700 20px var(--font-display); color: var(--amber); letter-spacing: 0.03em; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 36px; height: 36px; }
.avatar.sm b { font-size: 14px; }
.bubble { position: relative; margin: 6px 0 0; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-size: 15px; line-height: 1.45; font-style: italic; }
.bubble::before { content: ""; position: absolute; top: -7px; left: 22px; width: 12px; height: 12px; background: var(--panel-2); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.bubble.divided { color: var(--muted); }
.bubble.overruled { border-color: var(--bad); }
.bubble.agreed { border-color: var(--good); }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: auto; }
.leave-btn { background: rgba(232, 176, 74, 0.14); border: 1px solid var(--amber); color: var(--amber); border-radius: 6px; padding: 9px 10px; font: 600 17px var(--font-display); cursor: default; }
.overrule-btn { margin-top: 0; padding: 9px 14px; }
.back-head { display: flex; align-items: center; gap: 10px; }
.back-title { font: 600 18px/1.15 var(--font-display); color: var(--amber); }
.opt:hover { border-color: var(--muted); }
.reaction { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; }
.reaction .bubble { margin-top: 4px; }
.reaction .bubble::before { left: 16px; }
.react-who { font: 600 14px var(--font-display); color: var(--muted); }
.who.with-avatar { display: flex; align-items: center; gap: 10px; }
@media (prefers-reduced-motion: reduce) {
  .card-inner { transform: none !important; transition: none; }
  .face { transition: opacity 250ms ease; }
  .face.back { transform: none; opacity: 0; pointer-events: none; }
  .card.flipped .face.front { opacity: 0; pointer-events: none; }
  .card.flipped .face.back { opacity: 1; pointer-events: auto; }
}

/* ------------------------------------------------------------ v4: living map */
.map-live { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.vignette { position: fixed; inset: 0; z-index: 4; pointer-events: none; --vig-red: 0; --vig-blue: 0;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(238, 70, 50, var(--vig-red)) 100%),
    radial-gradient(ellipse at center, transparent 55%, rgba(80, 150, 230, var(--vig-blue)) 100%);
  transition: background 1.5s; }
.topbar .ghost[aria-pressed] { font-size: 14px; padding: 4px 10px; }
.topbar { z-index: 20; }
@media (max-width: 600px) { #sound-toggle { display: none; } .topbar { gap: 8px; } }

/* ------------------------------------------------------------ v4: night falls */
.night { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 12px 2vw;
  background: rgba(2, 5, 12, 0); transition: background 800ms ease; }
.night.on { background: rgb(2, 5, 12); }
.night-top { width: min(96vw, 1400px); display: flex; justify-content: space-between; align-items: flex-end; }
.night-label { display: block; font: 600 16px var(--font-display); letter-spacing: 0.25em; text-transform: uppercase; color: #7f93ad; }
.night-daynum { font: 700 clamp(40px, min(9vw, 11vh), 96px)/1 var(--font-display); color: var(--amber); font-variant-numeric: tabular-nums; text-shadow: 0 0 24px rgba(232, 176, 74, 0.35); }
.night-daynum small { font-size: 0.35em; letter-spacing: 0.2em; text-transform: uppercase; color: #7f93ad; font-weight: 600; }
.night-btns { display: flex; gap: 8px; }
.night-btn { background: rgba(255, 255, 255, 0.06); border: 1px solid #34455a; color: #cfd8e3; border-radius: 6px; padding: 8px 14px; font: 600 16px var(--font-display); display: inline-flex; align-items: center; }
.night-btn:hover { border-color: var(--amber); color: #fff; }
.night-stage { flex: 1 1 0; min-height: 0; width: 100%; display: grid; place-items: center; container-type: size; }
.night-map { position: relative; --ar: 1.40625; width: min(100cqw, calc(100cqh * var(--ar))); aspect-ratio: var(--ar); border: 1px solid #22303f; border-radius: 8px; overflow: hidden; background: #060b14; }
.night-basemap { position: absolute; inset: 0; width: 100%; height: 100%; filter: brightness(0.5) saturate(0.7) hue-rotate(8deg); }
.night-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.night-vignette { position: absolute; inset: 0; pointer-events: none; --vig-red: 0; --vig-blue: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(238, 70, 50, var(--vig-red)) 100%), radial-gradient(ellipse at center, transparent 50%, rgba(80, 150, 230, var(--vig-blue)) 100%), radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.55) 100%); }
.night-ticker { width: min(96vw, 1100px); flex: none; min-height: 108px; font: 500 15px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #bfe3d0; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.tick-line { margin: 0; opacity: 0.55; }
.tick-line:last-child { opacity: 1; }
.tick-line .tick-tag { color: #7f93ad; margin-right: 10px; font-size: 12px; letter-spacing: 0.08em; }
.tick-line.event .tick-tag { color: #d9cffa; }
.tick-line.mine .tick-tag { color: var(--amber); }
.caret { display: inline-block; width: 8px; height: 15px; background: #bfe3d0; vertical-align: -2px; margin-left: 2px; animation: caret 0.7s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@media (max-width: 600px) {
  .night { padding-top: 14px; }
  .night-ticker { font-size: 13px; min-height: 120px; }
  .night-card { width: 52%; }
}
.night-card { position: absolute; right: 2.5%; top: 4%; width: 36%; max-width: 440px; margin: 0; transform: translateX(120%) rotate(2deg); opacity: 0; pointer-events: none;
  border: 2px solid var(--amber); border-radius: 6px; overflow: hidden; background: #060b14; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.night-card.show { animation: card-in 550ms cubic-bezier(.2, .8, .2, 1) forwards; }
.night-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.night-card figcaption { position: absolute; left: 0; top: 0; background: var(--amber); color: var(--amber-ink); font: 700 13px var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 10px; }
@keyframes card-in { from { transform: translateX(120%) rotate(4deg); opacity: 0; } to { transform: translateX(0) rotate(-1deg); opacity: 1; } }

/* ------------------------------------------------------------ v5: scenarios, scenes, endings gallery */
.scenario-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: stretch; }
.scenario-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.scenario-card:hover { border-color: var(--amber); }
.scenario-pick { all: unset; box-sizing: border-box; display: flex; flex-direction: column; flex: 1; cursor: pointer; color: var(--text); }
.scenario-pick:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.thumb { background: #060b14; display: grid; place-items: center; height: 150px; flex: none; overflow: hidden; border-bottom: 1px solid var(--line); }
.thumb-map { position: relative; height: 150px; max-width: 100%; }
.thumb-map img { display: block; height: 100%; width: 100%; object-fit: fill; filter: brightness(1.1) saturate(0.9); }
.thumb-pin { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--amber); border: 1.5px solid #0b1015; box-shadow: 0 0 0 3px rgba(232, 176, 74, 0.25); }
.sc-body { display: grid; gap: 6px; padding: 14px 16px 10px; }
.sc-title { font: 600 26px/1.1 var(--font-display); color: var(--amber); }
.sc-hook { font-size: 15px; color: #c5d0db; line-height: 1.45; }
.sc-meta { font-size: 14px; color: var(--muted); }
.endings-link { margin: 0; padding: 10px 16px 14px; align-self: flex-start; font-size: 15px; }
.nation-list { display: grid; gap: 16px; }
.nation-list .intro { max-width: 70ch; margin: 0; }
.nation-list > .ghost { justify-self: start; }
.setup-head { margin-bottom: 18px; }

.head-thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); flex: none; }
.ticker li.with-thumb { display: flex; gap: 12px; align-items: center; }
.ticker li.with-thumb.no-scene { display: block; }
.head-text { flex: 1; min-width: 0; }

.end-hero { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #060b14; }
.end-hero img { display: block; width: 100%; max-height: min(52vh, 480px); object-fit: cover; }
.outcome .chip.verdict { margin-bottom: 8px; }
.chip.verdict { font: 600 14px var(--font-display); letter-spacing: 0.04em; border-radius: 12px; padding: 1px 10px; text-transform: uppercase; }
.chip.verdict.good { border-color: var(--good); color: var(--good); }
.chip.verdict.bad { border-color: var(--bad); color: var(--bad); }
.chip.verdict.mixed { border-color: var(--amber); color: var(--amber); }


.gallery { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.end-tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.end-tile.just { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.end-img { position: relative; aspect-ratio: 3 / 2; background: linear-gradient(135deg, #14202e, #0b1015); overflow: hidden; }
.end-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.end-tile.locked .end-img img { filter: blur(14px) grayscale(1) brightness(0.3); transform: scale(1.2); }
.lock-wrap { position: absolute; inset: 0; display: grid; place-items: center; color: #8d9bab; }
.lock-wrap .lock { width: 30px; height: 30px; }
.end-cap { padding: 8px 10px 10px; display: grid; gap: 4px; align-content: start; flex: 1; }
.end-cap b { font: 600 17px/1.15 var(--font-display); }
.end-tile.locked .end-cap b { color: var(--muted); letter-spacing: 0.2em; }
.end-cap .chip { justify-self: start; margin: 0; }
.just-tag { font: 700 12px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber); }
#endings-modal .modal-card { max-width: 1000px; }
@media (prefers-reduced-motion: reduce) { .night-card.show { animation-duration: 1ms; } }
@media (max-width: 600px) { .gallery { grid-template-columns: repeat(2, 1fr); } .thumb { height: 120px; } }

/* Wide, short windows: the headlines move beside the map so the map can use the full height. */
@media (min-width: 900px) and (min-aspect-ratio: 16/10) {
  .night { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); gap: 8px 20px; align-items: stretch; justify-content: stretch; }
  .night-top { grid-column: 1 / -1; width: auto; }
  .night-stage { grid-column: 1; grid-row: 2; }
  .night-ticker { grid-column: 2; grid-row: 2; width: auto; min-height: 0; overflow: hidden; align-self: stretch; }
}
