/* THE CITY IN LETTERS LARGE
 *
 * The world is drawn on canvas and is not styled here. This file styles the
 * overlay only, and its job is to stay out of the city's way: dark, translucent
 * chrome at the edges, warm parchment ink, and nothing that looks like
 * educational software.
 *
 * Deliberate absences: no progress-bar green/red morality colouring on the
 * metrics (valence is carried by a subtle left border, not by traffic lights),
 * no XP, no badges, no score.
 */

:root {
  --ink: #efe6d2;
  --ink-dim: #d2cab9;
  --ink-faint: #afa693;
  --ground: #141a1d;
  --panel: rgba(12, 19, 23, 0.96);
  --panel-solid: #0f171b;
  --edge: rgba(226, 214, 187, 0.14);
  --edge-strong: rgba(226, 214, 187, 0.26);
  --gold: #d9b74a;
  --gold-dim: #c3a94f;
  --rose: #c4646e;
  --sky: #6d9fc4;
  --olive: #8aa85e;
  --violet: #a986c9;
  --amber: #d38a58;
  --radius: 10px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

/* The UA stylesheet's [hidden] { display: none } loses to any author rule that
 * sets display, and several components below set display: flex. Without this
 * the "hidden" dialogue box sits on the map as an empty black bar. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17.5px;
  -webkit-font-smoothing: antialiased;
}

#city-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#city-canvas:active { cursor: grabbing; }

.overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.overlay > * { pointer-events: auto; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
/* A disabled action stays visible and says why on hover, rather than vanishing:
 * a control that appears only sometimes is a control students never learn. */
button[disabled] { opacity: 0.42; cursor: default; }

h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  background: linear-gradient(to bottom, rgba(12, 16, 18, 0.94), rgba(12, 16, 18, 0.0));
  backdrop-filter: blur(2px);
}

.brand { display: flex; flex-direction: column; line-height: 1.05; min-width: 120px; }
.city-name {
  font-family: var(--serif);
  font-size: 19.5px;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.brand-sub { font-size: 12.0px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }

.chapter-block { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.chapter {
  font-family: var(--serif);
  font-size: 14.0px;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  padding: 1px 6px;
}
.stage-title {
  font-family: var(--serif);
  font-size: 17.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clock { margin-left: auto; display: flex; gap: 8px; align-items: baseline; color: var(--ink-dim); font-size: 15.5px; }
.pop-num { color: var(--ink); font-variant-numeric: tabular-nums; }
.city-rewards {
  color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 9px;
  padding: 1px 6px; font-variant-numeric: tabular-nums; cursor: help;
}

.speeds { display: flex; gap: 3px; }
.speed {
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 12.0px;
  color: var(--ink-faint);
  letter-spacing: -1px;
  min-width: 26px;
}
.speed:hover { border-color: var(--edge-strong); color: var(--ink-dim); }
.speed.on { background: var(--gold); border-color: var(--gold); color: #1b1610; }

.top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--edge);
  border-radius: 6px;
  color: var(--ink-dim);
}
.icon-btn:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ------------------------------------------------------------- dashboard */

.dash {
  position: absolute;
  top: 66px; left: 12px;
  width: 324px;
  max-height: calc(100vh - 86px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(11px) saturate(0.65);
  overflow: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.dash.collapsed { transform: translateX(calc(-100% + 34px)); }
.dash.collapsed .collapse { transform: rotate(180deg); }

.dash-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--edge);
}
.dash-head h2 { font-family: var(--serif); font-size: 17.5px; letter-spacing: 0.02em; }
.collapse { color: var(--ink-faint); font-size: 18.5px; line-height: 1; padding: 0 4px; transition: transform 0.25s; }

.big-question {
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.035);
}
.q-mark { font-size: 11.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--gold-dim); }
.big-question p {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 16.0px;
  line-height: 1.35;
  color: var(--ink);
}

.metric-lesson {
  margin: 8px 9px 3px;
  padding: 9px 10px;
  border: 1px solid rgba(109, 159, 196, 0.34);
  border-radius: 7px;
  background: rgba(109, 159, 196, 0.075);
}
.metric-lesson-label {
  display: block;
  font-size: 11.0px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sky);
  margin-bottom: 3px;
}
.metric-lesson strong { color: var(--ink); font-size: 14.0px; font-weight: 600; }
.metric-lesson p { margin: 4px 0 0; color: var(--ink-faint); font-size: 13.5px; line-height: 1.45; }

.metrics {
  overflow-y: auto;
  padding: 4px 0 8px;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-gutter: stable;
}
.metrics::-webkit-scrollbar { width: 8px; }
.metrics::-webkit-scrollbar-thumb { background: rgba(226, 214, 187, 0.14); border-radius: 4px; }

.metric-group { padding: 6px 0 2px; }
.metric-group h3 {
  font-size: 11.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 4px 12px;
}

.metric {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 4px 12px 4px 10px;
  border-left: 2px solid transparent;
}
.metric:hover { background: rgba(226, 214, 187, 0.045); }
.metric.newly-introduced { background: rgba(217, 183, 74, 0.035); }
.metric.v-bad { border-left-color: rgba(196, 100, 110, 0.4); }
.metric.v-contested { border-left-color: rgba(217, 183, 74, 0.26); }

/* The reading's NAME is the one thing on this row that cannot be guessed from
 * context, so it wraps rather than truncating. In a 324px panel "Resource
 * pressure" next to an INFERRED badge became "Resource ...", which is not a
 * shorter label -- it is a missing one. §6: do not shrink text to preserve a
 * desktop composition. The badge drops to the next line before the name does. */
.m-left { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 5px; min-width: 0; }
.m-label { font-size: 15.0px; color: var(--ink-dim); line-height: 1.3; }
.metric:hover .m-label { color: var(--ink); }

.m-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.m-num { font-variant-numeric: tabular-nums; font-size: 15.0px; color: var(--ink); min-width: 32px; text-align: right; }
.m-band {
  font-size: 12.0px;
  letter-spacing: 0.09em;
  color: var(--ink-dim);
  min-width: 62px;
  text-align: right;
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px;
}
.m-band.tier-0, .m-band.tier-1 { color: var(--ink-faint); }
.m-band.tier-3 { color: var(--ink); }
.m-band.tier-4 { color: var(--gold); }

.conf-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.conf-dot.conf-high { background: var(--olive); }
.conf-dot.conf-moderate { background: var(--gold-dim); }
.conf-dot.conf-low { background: var(--amber); }
.conf-dot.conf-unknown { background: transparent; border: 1px solid var(--ink-faint); }

.m-trend { width: 9px; font-size: 11.5px; color: var(--ink-faint); }
.m-trend.up { color: var(--gold); }
.m-trend.down { color: var(--rose); }

.m-bar { width: 34px; height: 3px; background: rgba(226, 214, 187, 0.12); border-radius: 2px; overflow: hidden; }
.m-bar-fill { display: block; height: 100%; background: rgba(226, 214, 187, 0.5); }

/* provenance badge */
.prov {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid;
  cursor: help;
  flex-shrink: 0;
}
.prov-plato { color: var(--gold); border-color: rgba(217, 183, 74, 0.4); }
.prov-inference { color: var(--sky); border-color: rgba(109, 159, 196, 0.35); }
.prov-modern { color: var(--violet); border-color: rgba(169, 134, 201, 0.38); }

/* ------------------------------------------------------------------ lens */

.lens-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-top: 1px solid var(--edge);
  color: var(--ink-dim);
  font-size: 15.0px;
  text-align: left;
}
.lens-btn:hover { color: var(--ink); background: rgba(226, 214, 187, 0.05); }
.lens-btn.open { color: var(--gold); background: rgba(217, 183, 74, 0.07); }
.lens-eye { display: grid; place-items: center; }
.lens-badge {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--amber);
  border: 1px solid rgba(211, 138, 88, 0.4);
  border-radius: 3px;
  padding: 1px 5px;
}
.lens-btn.alerting .lens-eye { animation: blink 3.4s ease-in-out infinite; }
@keyframes blink { 0%, 92%, 100% { opacity: 1; } 96% { opacity: 0.25; } }

.lens-panel {
  max-height: 44vh;
  min-height: 0;
  flex: 0 1 44vh;
  overflow-y: auto;
  border-top: 1px solid var(--edge);
  background: rgba(10, 14, 16, 0.6);
  padding: 4px 0 10px;
}
.lens-empty { padding: 12px; color: var(--ink-faint); font-size: 14.0px; line-height: 1.5; margin: 0; }
.lens-reading { padding: 10px 12px; border-bottom: 1px solid var(--edge); }
.lens-reading:last-child { border-bottom: none; }
.lens-reading h3 { font-family: var(--serif); font-size: 15.0px; color: var(--gold); margin-bottom: 6px; }
.lens-rows { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.lens-rows td { padding: 2px 0; }
.lens-label { color: var(--ink-dim); }
.lens-value { text-align: right; color: var(--ink); letter-spacing: 0.06em; font-size: 11.5px; padding-left: 8px; }
.lens-arrow { width: 14px; text-align: right; color: var(--ink-faint); }
.lens-arrow.arrow-up { color: var(--gold); }
.lens-arrow.arrow-down { color: var(--rose); }
.lens-arrow.arrow-unsure { color: var(--amber); }
.lens-q {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--ink);
  border-left: 2px solid var(--gold-dim);
  padding-left: 8px;
}

/* ------------------------------------------------------------------ feed */

.feed {
  position: absolute;
  top: 66px; right: 12px;
  width: 286px;
  max-height: 42vh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
  overflow: hidden;
}
.feed header { padding: 9px 12px; border-bottom: 1px solid var(--edge); }
.feed h2 { font-family: var(--serif); font-size: 15.0px; }
.feed-list { overflow-y: auto; padding: 4px 0 8px; min-height: 0; }
.feed-item {
  display: flex; gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(226, 214, 187, 0.06);
  opacity: 0; transform: translateX(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.feed-item.in { opacity: 1; transform: none; }
.feed-when { font-size: 11.0px; color: var(--ink-faint); padding-top: 2px; white-space: nowrap; }
.feed-item strong { font-size: 15.0px; font-weight: 500; color: var(--ink); }
.feed-item p { margin: 2px 0 0; font-size: 14.0px; line-height: 1.45; color: var(--ink-faint); }
.feed-item.sev-4 strong, .feed-item.sev-5 strong { color: var(--gold); }
.feed-item.unseen { opacity: 0.5; }
/* News that happened somewhere. The button takes the camera there. */
.feed-go {
  margin-top: 5px;
  padding: 3px 9px;
  font-size: 12.0px;
  color: var(--gold);
  background: rgba(217, 183, 74, 0.08);
  border: 1px solid var(--gold-dim);
  border-radius: 11px;
}
.feed-go:hover { background: rgba(217, 183, 74, 0.18); color: var(--ink); }
/* The panel is removed entirely when nothing is happening, so this footer only
 * ever appears under something. */
.feed-more {
  flex: none;
  padding: 7px 12px;
  text-align: left;
  font-size: 12.0px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  border-top: 1px solid var(--edge);
}
.feed-more:hover { color: var(--gold); }

/* -------------------------------------------------------------- dialogue */

.dialogue {
  position: absolute;
  left: 50%; bottom: 22px;
  transform: translate(-50%, 16px);
  z-index: 30;
  width: min(740px, calc(100vw - 48px));
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--edge-strong);
  border-radius: 12px;
  box-shadow: 0 16px 52px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(217, 183, 74, 0.08);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.dialogue.in { opacity: 1; transform: translate(-50%, 0); }
.dialogue.speaker-socrates { border-left: 3px solid var(--gold); }
.dialogue.speaker-glaucon { border-left: 3px solid var(--rose); }
.dialogue.speaker-adeimantus { border-left: 3px solid var(--sky); }

.portrait { flex-shrink: 0; }
.dlg-body { flex: 1; min-width: 0; }
.dlg-name { display: flex; align-items: baseline; gap: 8px; }
.dlg-name > span:first-child {
  font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-faint); cursor: help;
}
.dlg-text {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 21.0px;
  line-height: 1.48;
  color: var(--ink);
}
.dlg-text.is-modern { color: #d7e5ee; }
.dlg-version-label {
  display: block;
  margin-top: 8px;
  color: var(--sky);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.dlg-actions {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 7px;
}
.dlg-modern-toggle, .dec-modern-toggle {
  padding: 5px 8px;
  border: 1px solid rgba(109, 159, 196, 0.42);
  border-radius: 5px;
  color: var(--sky);
  font-size: 14.0px;
  white-space: nowrap;
}
.dlg-modern-toggle:hover, .dec-modern-toggle:hover {
  border-color: var(--sky);
  background: rgba(109, 159, 196, 0.1);
}
.dlg-modern, .dec-modern {
  margin-top: 9px;
  padding: 8px 10px;
  border-left: 2px solid var(--sky);
  background: rgba(109, 159, 196, 0.08);
  border-radius: 0 5px 5px 0;
}
.dlg-modern[hidden], .dec-modern[hidden] { display: none; }
.dlg-modern-label {
  display: block;
  margin-bottom: 3px;
  color: var(--sky);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.dlg-modern p, .dec-modern p {
  margin: 0;
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.45;
}
.dlg-next {
  padding: 6px 14px;
  border: 1px solid var(--edge-strong);
  border-radius: 6px;
  font-size: 15.5px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.dlg-next:hover { background: var(--gold); border-color: var(--gold); color: #1b1610; }
.dlg-next[disabled] {
  min-width: 132px;
  color: var(--ink-faint);
  border-color: var(--edge);
}

.stephanus {
  font-size: 11.5px;
  color: var(--gold-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  cursor: help;
}
.stephanus.big { font-size: 14.0px; color: var(--gold); }
.stephanus-line { font-size: 14.0px; color: var(--ink-faint); }

.aside {
  position: absolute;
  left: 50%; bottom: 22px;
  transform: translate(-50%, 14px);
  display: flex; gap: 10px; align-items: center;
  max-width: min(560px, calc(100vw - 48px));
  padding: 9px 14px;
  background: rgba(18, 23, 26, 0.86);
  border: 1px solid var(--edge);
  border-radius: 24px;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s;
}
.aside.in { opacity: 1; transform: translate(-50%, 0); }
.aside .portrait svg { width: 28px; height: 28px; }
.aside p { margin: 0; font-size: 14.5px; color: var(--ink-dim); line-height: 1.35; }
.aside strong { color: var(--ink); font-weight: 500; }

/* --------------------------------------------------------- chapter cards */

.chapter-card {
  position: absolute;
  left: 50%; top: 42%;
  transform: translate(-50%, -50%) scale(0.97);
  text-align: center;
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.8);
}
.chapter-card.in { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.chapter-card .ch {
  font-size: 11.5px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold);
}
.chapter-card h2 { font-family: var(--serif); font-size: 48.5px; margin: 6px 0 4px; font-weight: 400; }
.chapter-card p { margin: 0; font-family: var(--serif); font-size: 18.5px; color: var(--ink-dim); font-style: italic; }

.stage-note {
  position: absolute;
  left: 50%; top: 68px;
  transform: translate(-50%, -8px);
  width: min(560px, calc(100vw - 48px));
  padding: 11px 14px;
  background: rgba(18, 23, 26, 0.93);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
  backdrop-filter: blur(8px);
}
.stage-note.in { opacity: 1; transform: translate(-50%, 0); }
.stage-note.prov-modern { border-left-color: var(--violet); }
.stage-note.prov-inference { border-left-color: var(--sky); }
.note-kind { font-size: 10.5px; letter-spacing: 0.17em; text-transform: uppercase; color: var(--gold); margin-right: 8px; }
.stage-note p { margin: 5px 0 0; font-size: 15.0px; line-height: 1.45; color: var(--ink-dim); }
.note-why { font-size: 12.0px; color: var(--ink-faint); text-decoration: underline dotted; cursor: help; }

/* ------------------------------------------------------------- decisions */

.decision-panel {
  position: absolute;
  z-index: 20;
  left: 50%; bottom: 20px;
  transform: translate(-50%, 18px);
  width: min(880px, calc(100vw - 40px));
  max-height: 72vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--edge-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(11px);
  padding: 16px 18px 18px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}
.decision-panel.in { opacity: 1; transform: translate(-50%, 0); }

.dec-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.dec-head h2 { font-family: var(--serif); font-size: 23.0px; }
.dec-prompt { margin: 5px 0 0; font-family: var(--serif); font-size: 17.0px; color: var(--ink-dim); line-height: 1.4; }
.dec-speaker { color: var(--gold); font-style: normal; }
.dec-head .x { margin-left: auto; color: var(--ink-faint); font-size: 23.0px; line-height: 1; }
.dec-head .dec-modern-toggle { margin-left: auto; }
.dec-head .dec-modern-toggle + .x { margin-left: 0; }
.dec-modern { margin: -3px 0 12px; }
.dec-multi-hint { margin: 0 0 10px; font-size: 14.0px; color: var(--ink-faint); }

.dec-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.dec-options.many { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.dec-option {
  display: flex; flex-direction: column; gap: 5px;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(226, 214, 187, 0.028);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.dec-option:hover { border-color: var(--edge-strong); background: rgba(226, 214, 187, 0.06); transform: translateY(-1px); }
.dec-option.picked { border-color: var(--gold); background: rgba(217, 183, 74, 0.10); }

.dec-route {
  font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-faint);
}
.dec-route.route-canonical { color: var(--gold); }
.dec-route.route-counterfactual { color: var(--violet); }
.dec-label { font-family: var(--serif); font-size: 17.5px; color: var(--ink); font-weight: 500; }
.dec-detail { font-size: 14.0px; color: var(--ink-dim); line-height: 1.4; }
.dec-cost { font-size: 13.5px; color: var(--amber); line-height: 1.4; }
.cost-tag {
  display: block;
  font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase;
  color: rgba(211, 138, 88, 0.72);
  margin-bottom: 2px;
}
.dec-cf {
  font-size: 13.0px; line-height: 1.4; color: var(--violet);
  border-top: 1px dashed rgba(169, 134, 201, 0.3);
  padding-top: 5px; margin-top: 2px;
}
.dec-confirm { margin-top: 12px; display: flex; justify-content: flex-end; }

/* ------------------------------------------------- tap to confirm (opt-in) */

.armed { border-color: var(--gold) !important; background: rgba(217, 183, 74, 0.12) !important; }
.confirm-hint {
  display: block;
  margin-top: 4px;
  font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold);
}
.dec-option.armed { transform: translateY(-1px); }

.menu-settings { margin: 14px 0 4px; }
.setting-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  cursor: pointer;
}
.setting-row:hover { border-color: var(--edge-strong); }
.setting-row input { margin-top: 2px; accent-color: var(--gold); }
.setting-row strong { display: block; font-size: 15.0px; font-weight: 500; }
.setting-note { display: block; margin-top: 2px; font-size: 13.5px; color: var(--ink-faint); line-height: 1.4; }

/* The bottom-right corner is a stack, not a pile. Newest on top; the decisions
 * button stays at the bottom where the student learned it was. */
.corner-stack {
  position: absolute;
  right: 12px; bottom: 20px;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
  max-width: min(320px, calc(100vw - 24px));
}

.consequence {
  width: 276px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--gold);
  border-radius: 9px;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.35s, transform 0.35s;
  backdrop-filter: blur(8px);
}
.consequence.in { opacity: 1; transform: none; }
.consequence strong { font-family: var(--serif); font-size: 16.0px; }
.consequence .cost { margin: 5px 0 0; font-size: 13.5px; color: var(--amber); line-height: 1.4; }
.consequence .delayed { margin: 7px 0 0; font-size: 13.0px; color: var(--ink-faint); line-height: 1.4; }

.open-decisions {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 24px;
  font-size: 15.0px;
  color: var(--ink-dim);
  backdrop-filter: blur(8px);
}
.open-decisions:hover { border-color: var(--gold-dim); color: var(--ink); }
.open-decisions.has { border-color: var(--gold-dim); color: var(--ink); }
.dec-count:not(:empty) {
  background: var(--gold); color: #1b1610;
  border-radius: 10px; padding: 0 6px;
  font-size: 13.0px; font-variant-numeric: tabular-nums;
}
/* Something has opened and has not been looked at yet. */
.open-decisions.urgent {
  border-color: var(--gold);
  color: var(--ink);
  animation: dec-pulse 1.9s ease-in-out infinite;
}
@keyframes dec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 183, 74, 0.34); }
  50% { box-shadow: 0 0 0 7px rgba(217, 183, 74, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .open-decisions.urgent { animation: none; box-shadow: 0 0 0 2px rgba(217, 183, 74, 0.4); }
}

/* A decision has opened. This does not time out: the student is meant to be
 * watching the city, so the city has to keep holding the question up. */
.dec-notice {
  width: 300px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  border-left: 3px solid var(--gold);
  border-radius: 9px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}
.dec-notice.in { opacity: 1; transform: none; }
.dec-notice-label {
  display: block;
  font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold);
}
.dec-notice strong {
  display: block; margin-top: 4px;
  font-family: var(--serif); font-size: 17.5px; font-weight: 500;
}
.dec-notice p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-dim); }
.dec-notice-held {
  display: block; margin-top: 7px;
  font-size: 12.0px; font-style: italic; color: var(--ink-faint);
}
.dec-notice-row { display: flex; gap: 8px; margin-top: 11px; }
.dec-notice-row button { font-size: 14.0px; padding: 6px 12px; }

.place-banner {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  backdrop-filter: blur(9px);
  box-shadow: var(--shadow);
}
.place-step { font-size: 11.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--gold); }
.place-banner strong { font-family: var(--serif); font-size: 18.5px; }
.place-banner p { margin: 2px 0 0; font-size: 14.0px; color: var(--ink-faint); max-width: 320px; }
.place-hint { font-size: 13.0px; color: var(--ink-faint); font-style: italic; }
.place-banner.refuse { animation: refuse 0.34s ease; border-color: var(--rose); }
.place-banner.refuse .place-hint { color: var(--rose); }
@keyframes refuse {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(calc(-50% - 6px)); }
  75% { transform: translateX(calc(-50% + 6px)); }
}

/* ------------------------------------------- optional Steward project shelf */

.planner {
  position: absolute;
  right: 310px;
  top: 66px;
  width: min(340px, calc(100vw - 36px));
  padding: 14px;
  background: rgba(17, 24, 29, 0.96);
  border: 1px solid var(--gold-dim);
  border-radius: 11px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  z-index: 16;
}
.planner[hidden] { display: none; }
.planner header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.planner-kicker {
  color: var(--gold);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.planner-body > strong { display: block; margin-top: 8px; font: 500 20px var(--serif); }
.planner-body > p { margin: 5px 0 11px; color: var(--ink-dim); font-size: 14px; line-height: 1.45; }
.project-sites { display: grid; gap: 7px; }
.project-site {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: rgba(104, 153, 164, 0.1);
  border: 1px solid rgba(127, 178, 188, 0.24);
  border-radius: 7px;
}
.project-site:hover, .project-site:focus-visible { background: rgba(104, 153, 164, 0.19); border-color: var(--gold-dim); }
.project-site strong { color: var(--ink); font-size: 14px; }
.project-site span { color: var(--ink-faint); font-size: 12.5px; line-height: 1.35; }
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.project-progress { height: 7px; margin: 12px 0 5px; overflow: hidden; background: rgba(255,255,255,0.08); border-radius: 99px; }
.project-progress span { display: block; height: 100%; background: var(--gold); transition: width 0.25s ease; }
.planner small { color: var(--ink-faint); }
.steward-place { padding-right: 10px; }
.steward-place .ghost { margin-left: 2px; }

.witness-concern {
  padding: 9px 11px;
  background: rgba(104, 153, 164, 0.1);
  border-left: 2px solid rgba(127, 178, 188, 0.5);
}
.witness-memory { display: grid; grid-template-columns: 58px 1fr; gap: 9px; padding: 8px 0; border-top: 1px solid var(--edge); }
.witness-memory span { color: var(--gold); font-size: 12px; }
.witness-memory p { margin: 0; }
.witness-list { display: grid; gap: 7px; }
.witness-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.7fr) minmax(90px, 0.6fr) 1.7fr;
  gap: 9px;
  align-items: center;
  padding: 9px 11px;
  text-align: left;
  background: rgba(104, 153, 164, 0.08);
  border: 1px solid var(--edge);
  border-radius: 7px;
}
.witness-row:hover { border-color: var(--gold-dim); }
.witness-row strong { font-family: var(--serif); font-size: 16px; }
.witness-row span { color: var(--ink-dim); font-size: 13px; }
.witness-row small { color: var(--ink-faint); font-size: 12px; line-height: 1.35; }
.follow-card {
  position: absolute;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px;
  min-width: min(360px, calc(100vw - 16px));
  padding: 10px 12px 10px 15px;
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.follow-card div { display: grid; flex: 1; }
.follow-card span { color: var(--gold); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.follow-card strong { font: 500 18px var(--serif); }
.follow-card small { color: var(--ink-faint); font-size: 12px; }

/* ------------------------------------------------ early work experiment */

.early-work {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  width: min(820px, calc(100vw - 300px));
  padding: 14px 16px;
  background: rgba(18, 23, 26, 0.96);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.early-work-copy { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; }
.early-work-copy .early-kicker {
  grid-row: 1 / span 2;
  color: var(--gold);
  font-size: 11.0px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.early-work-copy strong { font-family: var(--serif); font-size: 19.5px; font-weight: 500; }
.early-work-copy p { margin: 3px 0 0; color: var(--ink-faint); font-size: 14.0px; }

.generalist-crew, .worker-slots, .role-choices, .need-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 11px;
}
.crew-person, .worker-slot, .role-choice, .need-card {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  background: rgba(255,255,255,0.025);
}
.crew-person { display: flex; flex-direction: column; gap: 2px; }
.crew-person b { font-size: 13.5px; color: var(--ink-dim); }
.crew-person small { overflow: hidden; text-overflow: ellipsis; color: var(--ink-faint); font-size: 11.0px; white-space: nowrap; }

.need-label { display: flex; justify-content: space-between; gap: 6px; font-size: 13.0px; }
.need-label span { color: var(--ink-faint); }
.need-card.short .need-label span { color: var(--rose); }
.need-card.met .need-label span { color: var(--olive); }
.need-bar { display: block; height: 4px; margin: 7px 0 5px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.need-bar > span { display: block; height: 100%; background: var(--olive); }
.need-card.short .need-bar > span { background: var(--rose); }
.need-card small { display: block; color: var(--ink-faint); font-size: 11.0px; }
.need-card em { display: block; margin-top: 4px; font-size: 11.0px; font-style: normal; }
.need-card em.gain { color: var(--olive); }
.need-card em.loss { color: var(--rose); }

.early-work-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; margin-top: 12px; }
.early-count { margin-right: auto; color: var(--ink-faint); font-size: 13.0px; }
.worker-slot, .role-choice { text-align: left; }
.worker-slot span, .role-choice span { display: block; color: var(--ink-faint); font-size: 11.5px; }
.worker-slot strong, .role-choice strong { display: block; margin-top: 2px; font-size: 14.0px; }
.worker-slot.selected { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217,183,74,0.2); }
.worker-slot.assigned strong { color: var(--gold); }
.role-choice:hover { border-color: var(--edge-strong); background: rgba(255,255,255,0.05); }
.coverage { margin: 9px 0 0; font-size: 13.0px; }
.coverage.short { color: var(--amber); }
.coverage.complete { color: var(--olive); }
.labour-result { width: min(720px, calc(100vw - 300px)); }

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

.modal-scrim {
  position: fixed; inset: 0;
  z-index: 40;
  display: grid; place-items: center;
  background: rgba(8, 11, 13, 0.62);
  backdrop-filter: blur(4px);
  animation: fade 0.18s ease;
  padding: 24px;
  overflow-y: auto;
}
.modal-scrim.closing { animation: fadeout 0.18s ease forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--edge-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-scrim.wide .modal { width: min(940px, 100%); }
.modal-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--edge);
}
.modal-head h2 { font-family: var(--serif); font-size: 24.5px; font-weight: 400; }
.modal-head .sub { margin: 3px 0 0; font-size: 15.0px; color: var(--ink-faint); line-height: 1.4; }
.modal-head .x { margin-left: auto; font-size: 25.5px; line-height: 1; color: var(--ink-faint); }
.modal-head .x:hover { color: var(--ink); }
.modal-scrim.locked .modal-head .x { display: none; }

/* The opening sits over the live map, so it must not black it out. The land is
 * the reason anyone wants to play; the naming card is a label on top of it. */
.modal-scrim.opening {
  background: linear-gradient(to bottom, rgba(8, 11, 13, 0.30), rgba(8, 11, 13, 0.62));
  backdrop-filter: none;
  align-items: flex-end;
  padding-bottom: 6vh;
}
.modal-scrim.opening .modal {
  width: min(570px, 100%);
  background: rgba(14, 19, 22, 0.90);
  backdrop-filter: blur(10px);
  border-color: var(--gold-dim);
}
.modal-scrim.opening .modal-head { padding-bottom: 8px; }
.modal-scrim.opening .modal-head h2 { font-size: 28.0px; }
.modal-scrim.opening .opening-blurb p {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.5;
  margin: 0;
}
.modal-scrim.opening .city-form { margin: 14px 0 0; }
.mode-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.mode-choice {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 11px 12px; border: 1px solid var(--edge-strong); border-radius: 8px;
  color: var(--ink-dim); background: rgba(255,255,255,0.025);
}
.mode-choice strong { color: var(--ink); font-size: 15.0px; }
.mode-choice span { font-size: 13.0px; line-height: 1.35; }
.mode-choice.selected { border-color: var(--gold); background: rgba(217,183,74,0.1); }
.control-profile { margin-top: 12px; padding: 11px; border: 1px solid var(--edge); border-radius: 8px; }
.control-profile > span { display: block; margin-bottom: 8px; color: var(--ink-faint); font-size: 13px; }
.control-profile .mode-choices { margin-top: 0; }

@media (max-height: 720px) {
  .modal-scrim.opening { align-items: center; padding-bottom: 24px; }
}
.modal-body { padding: 16px 18px 20px; overflow-y: auto; }
.modal-body p { line-height: 1.55; color: var(--ink-dim); }
.modal-body h3 { font-family: var(--serif); font-size: 18.5px; color: var(--ink); margin: 20px 0 8px; }
.modal-body section:first-child h3 { margin-top: 0; }
.modal-body h4 { font-size: 14.0px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin: 14px 0 6px; }

.primary {
  padding: 9px 18px;
  background: var(--gold);
  color: #1b1610;
  border-radius: 7px;
  font-size: 15.0px;
  font-weight: 500;
}
.primary:hover { background: #e8c85e; }
.primary.big { font-size: 17.5px; padding: 12px 26px; }
.ghost {
  padding: 9px 16px;
  border: 1px solid var(--edge-strong);
  border-radius: 7px;
  font-size: 15.0px;
  color: var(--ink-dim);
}
.ghost:hover { color: var(--ink); border-color: var(--gold-dim); }
.ghost.danger:hover { border-color: rgba(196, 100, 110, 0.6); color: var(--rose); }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.button-wrap { display: inline-flex; }

.caution { font-size: 14.0px; color: var(--ink-faint); font-style: italic; line-height: 1.5; }
.empty, .loading { color: var(--ink-faint); font-style: italic; }
.hint { font-size: 14.5px; color: var(--ink-faint); margin-top: 0; }

.opening-blurb p { font-family: var(--serif); font-size: 17.5px; line-height: 1.55; }
.opening-blurb .dim { color: var(--ink-faint); }
.city-form { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.city-input {
  flex: 1; min-width: 180px;
  padding: 10px 12px;
  background: rgba(226, 214, 187, 0.05);
  border: 1px solid var(--edge);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  font-family: var(--serif);
  font-size: 17.5px;
}
.city-input.small { flex: 0 0 170px; font-size: 15.0px; font-family: var(--font); }
.city-input:focus { outline: none; border-color: var(--gold-dim); }

.run-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15.0px; margin: 0; }
.run-info dt { color: var(--ink-faint); }
.run-info dd { margin: 0; color: var(--ink); }
.city-key { font-family: var(--mono, monospace); letter-spacing: .04em; word-break: break-all; }
.save-success { color: var(--olive) !important; }
.checkpoint-list { display: flex; flex-direction: column; gap: 8px; }
.checkpoint-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid rgba(226, 214, 187, 0.08);
}
.checkpoint-row > div:first-child { min-width: 0; }
.checkpoint-row strong { display: block; color: var(--ink); font-family: var(--serif); font-size: 16.0px; font-weight: 500; }
.checkpoint-row span { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 13.0px; }
.checkpoint-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.checkpoint-delete { padding: 4px 7px; color: var(--ink-faint); font-size: 19.5px; }
.checkpoint-delete:hover { color: var(--rose); }
.resume-key { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--edge-strong); border-radius: 8px; background: rgba(217, 183, 74, .06); }
.resume-key span { display: block; color: var(--gold-dim); font-size: 10.5px; letter-spacing: .16em; }
.resume-key strong { display: block; margin-top: 4px; color: var(--ink); font: 17px var(--mono, monospace); letter-spacing: .08em; word-break: break-all; user-select: all; }
.resume-key p { margin: 6px 0 0; color: var(--ink-faint); font-size: 13.0px; }
.copy-status { align-self: center; color: var(--olive); font-size: 13.0px; }

/* ---------------------------------------------------------------- chains */

.chain-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chain-pick {
  padding: 6px 11px;
  border: 1px solid var(--edge);
  border-radius: 18px;
  font-size: 14.0px;
  color: var(--ink-dim);
}
.chain-pick:hover { border-color: var(--edge-strong); color: var(--ink); }
.chain-pick.on { background: var(--gold); border-color: var(--gold); color: #1b1610; }

.chain-head h3 { font-family: var(--serif); font-size: 25.5px; margin: 0; }
.chain-summary { margin: 4px 0 0; font-size: 15.0px; }
.chain-layers { margin-top: 14px; }
.chain-layer {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid rgba(226, 214, 187, 0.07);
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.chain-layer.in { transform: none; }
.chain-depth {
  flex: 0 0 82px;
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 5px;
}
.chain-nodes { display: flex; flex-wrap: wrap; gap: 6px; }
.chain-node {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  font-size: 14.0px;
  background: rgba(226, 214, 187, 0.03);
}
.chain-node.kind-import { border-color: rgba(211, 138, 88, 0.42); }
.chain-node.kind-raw { border-color: rgba(138, 168, 94, 0.35); }
.chain-node.kind-exchange { border-color: rgba(217, 183, 74, 0.35); }
.chain-node.kind-transport { border-color: rgba(109, 159, 196, 0.35); }
.chain-swatch { width: 8px; height: 8px; border-radius: 2px; }
.chain-kind { font-size: 10.5px; color: var(--ink-faint); letter-spacing: 0.06em; }

.chain-foot { margin-top: 18px; transform: translateY(8px); transition: opacity 0.5s, transform 0.5s; }
.chain-foot.in { transform: none; }
.chain-lesson { font-family: var(--serif); font-size: 18.5px; color: var(--ink); margin: 0 0 12px; }
.chain-stats { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 12px; }
.chain-stat { display: flex; flex-direction: column; }
.chain-stat strong { font-family: var(--serif); font-size: 30.0px; color: var(--gold); line-height: 1; }
.chain-stat span { font-size: 13.0px; color: var(--ink-faint); margin-top: 3px; }
.chain-point { font-size: 15.0px; border-left: 2px solid var(--gold-dim); padding-left: 10px; }
.chain-warn { font-size: 14.5px; color: var(--amber); }

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

.series-picker { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.series-chip {
  padding: 4px 9px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  font-size: 13.0px;
  color: var(--ink-faint);
}
.series-chip.on { border-color: var(--gold-dim); color: var(--gold); background: rgba(217, 183, 74, 0.09); }

.chart { background: rgba(8, 11, 13, 0.5); border: 1px solid var(--edge); border-radius: 8px; padding: 6px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 13.0px; color: var(--ink-dim); }
.leg { display: inline-flex; align-items: center; gap: 6px; }
.leg-swatch { width: 12px; height: 3px; border-radius: 2px; }
.leg-note { color: var(--ink-faint); font-size: 11.5px; }

.timeline {
  position: relative;
  height: 34px;
  margin: 18px 0 8px;
  border-top: 1px solid var(--edge);
}
.tl-pin { position: absolute; top: -7px; transform: translateX(-50%); padding: 4px; }
.tl-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.tl-pin.kind-stage .tl-dot { background: var(--gold); width: 10px; height: 10px; }
.tl-pin.kind-decision .tl-dot { background: var(--sky); }
.tl-pin.kind-event .tl-dot { background: var(--amber); }
.tl-pin.cf .tl-dot { background: var(--violet); }
.tl-pin.hidden-at-time .tl-dot { background: transparent; border: 1.5px solid var(--rose); }
.tl-pin:hover .tl-dot { transform: scale(1.4); }

.tl-detail { border-top: 1px solid var(--edge); padding-top: 12px; }
.tl-detail h3 { margin-top: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-when { font-size: 13.0px; color: var(--ink-faint); margin: 0 0 8px; }
.cf-tag {
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--violet); border: 1px solid rgba(169, 134, 201, 0.4);
  border-radius: 3px; padding: 1px 5px;
}
.cf-tag.hidden-tag { color: var(--rose); border-color: rgba(196, 100, 110, 0.4); }
.tl-changes { margin-top: 10px; }
.tl-change { display: flex; justify-content: space-between; font-size: 14.5px; padding: 3px 0; border-bottom: 1px solid rgba(226, 214, 187, 0.06); }
.tl-change .up { color: var(--gold); }
.tl-change .down { color: var(--rose); }

/* ---------------------------------------------------------------- mirror */

.mirror-offer {
  position: absolute;
  left: 50%; bottom: 24px;
  transform: translate(-50%, 14px);
  display: flex; gap: 11px; align-items: center;
  max-width: min(520px, calc(100vw - 48px));
  padding: 11px 16px;
  background: rgba(20, 16, 26, 0.9);
  border: 1px solid rgba(169, 134, 201, 0.45);
  border-radius: 26px;
  color: var(--ink-dim);
  text-align: left;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
  backdrop-filter: blur(9px);
}
.mirror-offer.in { opacity: 1; transform: translate(-50%, 0); }
.mirror-offer:hover { border-color: var(--violet); }
.mirror-icon { color: var(--violet); display: grid; place-items: center; }
.mirror-offer strong { display: block; font-size: 13.0px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--violet); }
.mirror-teaser { font-size: 14.5px; color: var(--ink-dim); }

.mirror-city, .mirror-q { padding: 12px 14px; border-radius: 9px; margin-bottom: 12px; }
.mirror-city { background: rgba(226, 214, 187, 0.05); border-left: 3px solid var(--gold-dim); }
.mirror-q { background: rgba(169, 134, 201, 0.08); border-left: 3px solid var(--violet); }
.mirror-tag { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }
.mirror-city p, .mirror-q p { margin: 5px 0 0; font-family: var(--serif); font-size: 18.5px; line-height: 1.45; color: var(--ink); }
.mirror-follow { font-size: 15.0px; }
.mirror-preview { font-size: 14.5px; color: var(--ink-faint); border-top: 1px solid var(--edge); padding-top: 10px; }
.mirror-note { font-size: 14.5px; color: var(--ink-faint); font-style: italic; }

/* -------------------------------------------------------------- incident */

.modal-scrim.incident .modal { border-color: rgba(217, 183, 74, 0.4); }
.inc-text { font-family: var(--serif); font-size: 18.5px; line-height: 1.5; color: var(--ink); margin-top: 0; }
.inc-note { font-size: 14.0px; color: var(--ink-faint); }
.inc-options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.inc-option {
  text-align: left;
  padding: 11px 14px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  font-family: var(--serif);
  font-size: 17.5px;
  color: var(--ink);
}
.inc-option:hover { border-color: var(--gold); background: rgba(217, 183, 74, 0.08); }
.inc-result { margin-bottom: 14px; }
.inc-lesson { font-family: var(--serif); font-size: 18.5px; line-height: 1.5; color: var(--ink); }
.inc-flag { font-size: 15.0px; color: var(--amber); }

/* -------------------------------------------------------------- autopsy */

.autopsy .modal { max-width: 980px; }
.ap-paths .paths { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.path h4 { margin-top: 0; }
.path-step { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; font-size: 15.0px; color: var(--ink-dim); }
.path-step.reached { color: var(--ink); }
.path-step.skipped { color: var(--ink-faint); }
.path-step .tick { color: var(--gold); font-size: 10.5px; }
.path-step .yr { font-size: 11.5px; color: var(--ink-faint); min-width: 34px; font-variant-numeric: tabular-nums; }
.path-step.source-counterfactual { color: var(--violet); }
.path-step.source-event { color: var(--amber); }

.obs { padding: 12px 14px; margin-bottom: 10px; border-radius: 9px; background: rgba(226, 214, 187, 0.04); border-left: 3px solid var(--edge-strong); }
.obs.kind-concealment { border-left-color: var(--rose); }
.obs.kind-divergence_from_plato { border-left-color: var(--violet); }
.obs.kind-tradeoff { border-left-color: var(--amber); }
.obs.kind-divergence { border-left-color: var(--sky); }
.obs-kind { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.obs p { margin: 5px 0 0; font-family: var(--serif); font-size: 17.5px; line-height: 1.5; color: var(--ink); }

.ap-graph { margin-bottom: 18px; }
.turns { display: flex; flex-direction: column; gap: 6px; }
.turn { display: flex; gap: 10px; font-size: 15.0px; padding: 5px 0; border-bottom: 1px solid rgba(226, 214, 187, 0.06); }
.turn .yr { color: var(--ink-faint); font-size: 13.0px; min-width: 40px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.turn strong { font-weight: 500; }
.turn.kind-stage strong { color: var(--gold); }
.turn-after { display: block; font-size: 13.5px; color: var(--ink-faint); margin-top: 2px; }

.mirror-pair { margin-bottom: 14px; padding-left: 12px; border-left: 2px solid var(--violet); }
.mp-city { margin: 0; font-family: var(--serif); font-size: 17.5px; color: var(--ink); }
.mp-q { margin: 4px 0 0; font-size: 15.5px; color: var(--violet); }

.ap-questions ol { padding-left: 20px; }
.ap-questions li { font-family: var(--serif); font-size: 17.5px; line-height: 1.5; margin-bottom: 10px; color: var(--ink); }
.ap-open ul { padding-left: 18px; }
.ap-open li { font-size: 15.0px; color: var(--ink-faint); line-height: 1.5; margin-bottom: 6px; }

.fork-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 16px; }
.fork-btn {
  display: flex; gap: 12px; align-items: baseline; text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  color: var(--ink-dim);
}
.fork-btn:hover { border-color: var(--gold-dim); color: var(--ink); }
.fork-btn .yr { font-size: 13.0px; color: var(--ink-faint); min-width: 40px; }
.fork-took { display: block; font-size: 13.5px; color: var(--ink-faint); }

/* --------------------------------------------------------------- sources */

.src-intro { font-size: 15.0px; }
.src-row { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid rgba(226, 214, 187, 0.07); }
.src-row .stephanus { min-width: 78px; padding-top: 2px; }
.src-row p { margin: 0; font-size: 15.5px; line-height: 1.5; }
.src-flag { font-size: 13.5px; color: var(--ink-faint); font-style: italic; }
.src-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.src-warn li { font-size: 15.0px; line-height: 1.55; color: var(--ink-dim); margin-bottom: 8px; }

/* ------------------------------------------------------- decision list */

.dec-list { display: flex; flex-direction: column; gap: 8px; }
.dec-list-item {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 11px 14px;
  border: 1px solid var(--edge);
  border-radius: 9px;
}
.dec-list-item:hover { border-color: var(--gold-dim); background: rgba(217, 183, 74, 0.05); }
.dec-list-item strong { font-family: var(--serif); font-size: 17.5px; color: var(--ink); font-weight: 500; }
.dec-list-item span { font-size: 14.5px; color: var(--ink-faint); line-height: 1.4; }

.neigh-block { margin-top: 22px; }
.neigh { padding: 11px 0; border-bottom: 1px solid rgba(226, 214, 187, 0.07); }
.neigh strong { font-family: var(--serif); font-size: 17.5px; }
.neigh-blurb { font-size: 14.0px; color: var(--ink-faint); margin-left: 8px; }
.neigh-stats { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 7px; }
.nstat { display: flex; flex-direction: column; }
.nstat-label { font-size: 10.5px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-faint); }
.nstat strong { font-size: 15.0px; font-family: var(--font); font-weight: 500; color: var(--ink); }
.neigh-problem { margin: 7px 0 0; font-size: 14.5px; color: var(--amber); font-style: italic; }
.neigh.posture-hostile { border-left: 2px solid var(--rose); padding-left: 10px; }
.neigh.posture-allied { border-left: 2px solid var(--olive); padding-left: 10px; }

/* ------------------------------------------------ visiting another city */

.visit-block { margin-top: 20px; }
.visit-block:first-child { margin-top: 4px; }
.visit-block h3 {
  margin: 0 0 8px;
  font-size: 11.5px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--gold);
}
.visit-works { display: flex; flex-direction: column; gap: 2px; }
.visit-work {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.visit-work.newest {
  border-color: var(--gold-dim);
  background: rgba(217, 183, 74, 0.06);
}
.visit-mark { color: var(--gold); flex: none; padding-top: 2px; opacity: 0.85; }
.visit-work strong { font-family: var(--serif); font-size: 17.0px; font-weight: 500; }
.visit-work p { margin: 3px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-dim); }
.visit-when {
  display: block; margin-top: 4px;
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint);
}
.visit-life { margin: 0; }
.visit-life dt {
  margin-top: 9px;
  font-size: 11.0px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint);
}
.visit-life dd { margin: 2px 0 0; font-size: 15.0px; line-height: 1.5; color: var(--ink); }
.visit-compare {
  margin: 0 0 4px;
  font-family: var(--serif); font-size: 15.5px; line-height: 1.5;
  border-left: 2px solid var(--gold-dim); padding-left: 9px;
}

/* ------------------------------------------------------------------ tips */

.tip {
  position: fixed;
  z-index: 60;
  max-width: 250px;
  padding: 8px 11px;
  background: rgba(12, 16, 18, 0.97);
  border: 1px solid var(--edge-strong);
  border-radius: 7px;
  font-size: 14.0px;
  line-height: 1.45;
  color: var(--ink-dim);
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: fade 0.12s ease;
}
.tip.wide { max-width: 340px; }
.tip strong { display: block; color: var(--ink); margin-bottom: 3px; font-size: 14.5px; }
.tip em { color: var(--gold-dim); font-style: normal; }
.has-tip { cursor: help; }

.fatal {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 26px;
  background: var(--panel-solid);
  border: 1px solid var(--edge-strong);
  border-radius: 12px;
  max-width: 420px;
}
.fatal h2 { font-family: var(--serif); font-size: 23.0px; margin-bottom: 8px; }

/* -------------------------------------------------------------- narrow */

@media (max-width: 1080px) {
  .dash { width: 286px; }
  .feed { width: 240px; max-height: 32vh; }
  .planner { right: 260px; width: 300px; }
}

@media (max-width: 820px) {
  .dash { top: 62px; left: 8px; width: 270px; max-height: 52vh; }
  .feed { display: none; }
  .planner { top: 62px; right: 8px; width: min(340px, calc(100vw - 16px)); }
  .chapter-card h2 { font-size: 35.0px; }
  .dec-options { grid-template-columns: 1fr; }
  .ap-paths .paths { grid-template-columns: 1fr; }
  .topbar { gap: 10px; }
  .chapter-block { display: none; }
  .early-work, .labour-result {
    width: calc(100vw - 16px);
    bottom: 8px;
    max-height: 58vh;
    overflow-y: auto;
  }
  .generalist-crew { display: none; }
  .worker-slots, .role-choices, .need-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .early-work-copy { grid-template-columns: 1fr; }
  .early-work-copy .early-kicker { grid-row: auto; }
}

/* Browser zoom reduces the CSS viewport just like a genuinely narrow screen.
 * At 175–250% zoom, panels must reflow and scroll rather than preserve their
 * desktop shape outside the viewport. Keep every active control reachable. */
@media (max-width: 620px) {
  .topbar {
    min-height: 96px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    padding: 6px 8px;
    background: rgba(12, 19, 23, 0.97);
  }
  .brand { min-width: 0; }
  .brand-sub { display: none; }
  .city-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .clock {
    grid-column: 2; grid-row: 1;
    margin-left: 0; gap: 4px;
    justify-content: flex-end; flex-wrap: wrap;
    font-size: 13.5px;
  }
  .speeds { grid-column: 1; grid-row: 2; align-self: center; }
  .top-actions { grid-column: 2; grid-row: 2; justify-content: flex-end; }

  .dash {
    top: 104px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 112px);
  }
  .planner {
    top: 104px;
    right: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 112px);
    overflow-y: auto;
  }
  .metric { align-items: flex-start; }
  .m-label { white-space: normal; overflow: visible; text-overflow: clip; }

  .dialogue {
    bottom: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .dialogue > .portrait { display: none; }
  .dlg-body { width: 100%; }
  .dlg-actions {
    width: 100%; align-self: auto;
    flex-direction: row; flex-wrap: wrap;
    align-items: center; justify-content: flex-end;
  }
  .dlg-modern-toggle, .dlg-next { white-space: normal; }

  .aside, .stage-note {
    width: calc(100vw - 16px);
    max-width: none;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }
  .aside { bottom: 8px; }
  .stage-note { top: 8px; }
  .decision-panel {
    bottom: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 12px;
  }
  .dec-head { flex-wrap: wrap; }
  .dec-head .dec-modern-toggle { margin-left: 0; }

  .corner-stack {
    right: 8px; bottom: 8px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }
  .consequence, .dec-notice { width: min(100%, 320px); }
  .place-banner {
    bottom: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    flex-wrap: wrap;
  }
  .modal-scrim { padding: 8px; }
  .modal { max-height: calc(100vh - 16px); }
  .mode-choices { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .clock .pop { display: none; }
  .icon-btn { width: 30px; height: 30px; }
  .speed { min-width: 24px; padding-inline: 5px; }
}

/* A short effective viewport is another common result of browser zoom. */
@media (max-height: 600px) {
  .dash { max-height: calc(100vh - 74px); }
  .dialogue, .aside, .decision-panel, .place-banner, .corner-stack,
  .early-work, .labour-result {
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }
  .dialogue, .aside, .decision-panel, .place-banner, .corner-stack,
  .early-work, .labour-result { bottom: 8px; }
}

@media (max-width: 620px) and (max-height: 600px) {
  .dash { max-height: calc(100vh - 112px); }
}

/* Projector: a teacher at the back of a room has to be able to read this. */
@media (min-width: 1700px) {
  html { font-size: 18.0px; }
  .dash { width: 360px; }
  .feed { width: 320px; }
  .dlg-text { font-size: 21.0px; }
  .chapter-card h2 { font-size: 62.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ----------------------------------------------------------- shared city */

/* The card is drawn twice: as a preview inside the share panel, and as the
 * whole of share.html. Same markup, same styles — a preview that flattered
 * the real thing would be worse than no preview.
 *
 * Note the absence: there is no summary bar, no total, no grade. The readings
 * are steps because the values behind them were words, not numbers. */

.city-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 26px 28px 20px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}
.city-card.compact { padding: 18px 20px 14px; box-shadow: none; }

.card-head { border-bottom: 1px solid var(--edge); padding-bottom: 14px; }
.card-city {
  margin: 0;
  font: 600 27px/1.15 var(--serif);
  color: var(--ink);
  letter-spacing: .01em;
}
.city-card.compact .card-city { font-size: 22px; }
.card-where { margin: 6px 0 0; color: var(--ink-faint); font-size: 13.5px; }
.card-dot { margin: 0 6px; opacity: .5; }

.card-note {
  margin: 16px 0 0;
  font: italic 17px/1.45 var(--serif);
  color: var(--gold-dim);
}

.card-site { margin-top: 18px; }
.card-site h3 {
  margin: 0;
  font: 600 12px/1 var(--font);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-dim);
}
.card-site p { margin: 5px 0 0; color: var(--ink-dim); font-size: 14px; }

.card-readings { margin-top: 20px; }
.card-readings h3,
.card-decisions h3 {
  margin: 0 0 10px;
  font: 600 12px/1 var(--font);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.card-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(226, 214, 187, .06);
}
.card-label { color: var(--ink-dim); font-size: 14.5px; }
.card-value {
  min-width: 78px;
  text-align: right;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: .08em;
}
.card-row.unsure .card-value { color: var(--ink-faint); }

.card-steps { display: inline-flex; gap: 3px; }
.card-steps i {
  width: 13px;
  height: 5px;
  border-radius: 1px;
  background: rgba(226, 214, 187, .14);
}
.card-steps i.on { background: var(--gold-dim); }
/* An estimate the city is not confident of is drawn as one. */
.card-steps.unsure i.on { background: rgba(217, 183, 74, .42); }

.card-decisions { margin-top: 20px; }
.card-decisions ul { margin: 0; padding: 0; list-style: none; }
.card-decisions li {
  padding: 4px 0;
  color: var(--ink-dim);
  font-size: 14px;
}
.card-route {
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid var(--edge-strong);
  border-radius: 10px;
  color: var(--violet);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.card-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--edge); }
.card-caveat { margin: 0; color: var(--ink-faint); font-size: 12.5px; line-height: 1.5; }
.card-seed { margin: 8px 0 0; color: var(--ink-faint); font-size: 12px; letter-spacing: .04em; }

/* ------------------------------------------------------- the share panel */

.share-intro { margin: 0 0 16px; color: var(--ink-dim); font-size: 14.5px; line-height: 1.5; }
.share-preview { margin-bottom: 18px; }
.share-link-row { display: block; margin-bottom: 8px; }
.share-link-row span {
  display: block;
  margin-bottom: 5px;
  color: var(--gold-dim);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.share-link {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--edge-strong);
  border-radius: 8px;
  background: rgba(226, 214, 187, .04);
  color: var(--ink);
  font: 13px var(--mono, monospace);
  user-select: all;
}
.share-status { min-height: 1.4em; margin: 0 0 14px; color: var(--ink-faint); font-size: 13px; line-height: 1.45; }

/* --------------------------------------------------- the share page only */

/* The game root clips scrolling on purpose — the city must not scroll under
 * the overlay. The share page is an ordinary document and has to, so it opts
 * out at the html element; a body rule alone is clipped by the html above it. */
html.share-doc, html.share-doc body {
  height: auto;
  min-height: 100%;
  overflow: auto;
}
body.share-page {
  display: block;
  padding: 40px 18px 60px;
}
.share-page #card-root { max-width: 560px; margin: 0 auto; }
.card-loading, .card-missing { text-align: center; color: var(--ink-faint); }
.card-missing h1 { font: 600 22px/1.2 var(--serif); color: var(--ink); }
.card-missing p { font-size: 14.5px; line-height: 1.5; }
.card-actions { margin-top: 22px; text-align: center; }
.card-cta {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  color: var(--gold);
  font-size: 14.5px;
  text-decoration: none;
}
.card-cta:hover { background: rgba(217, 183, 74, .1); }
.card-samesite { margin: 12px 0 0; color: var(--ink-faint); font-size: 12.5px; }

@media (max-width: 600px) {
  .city-card { padding: 20px 18px 16px; }
  .card-row { grid-template-columns: 1fr auto; }
  .card-steps { display: none; }
}

/* The site named under the opening blurb, while the camera drifts over it. */
.opening-site {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border-left: 2px solid var(--gold-dim);
  background: rgba(217, 183, 74, .05);
}
.opening-site h3 { margin: 0; font: 600 15px/1.2 var(--serif); color: var(--gold); }
.opening-site p { margin: 5px 0 0; color: var(--ink-dim); font-size: 14px; line-height: 1.5; }

/* ---------------------------------------------------------------------------
 * DECISIONS: Now / Policies / Past choices
 *
 * The review asked for a way back to earlier choices organised by year. These
 * styles serve that list and the standing-policy view beside it. Everything
 * here is a real button or a plain explanation of why a control is absent --
 * nothing is decorative state.
 * ------------------------------------------------------------------------ */

.dec-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 1px solid var(--edge);
}
.dec-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 15px 10px;
  font-size: 15px; color: var(--ink-faint);
  border: 1px solid transparent; border-bottom: none;
  border-radius: 9px 9px 0 0;
  margin-bottom: -1px;
}
.dec-tab:hover { color: var(--ink-dim); }
.dec-tab.on {
  color: var(--ink); background: rgba(217, 183, 74, 0.06);
  border-color: var(--edge); border-bottom-color: var(--panel-solid);
}
.dec-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.dec-tab-count {
  font-size: 12.5px; color: var(--ink-faint);
  padding: 1px 7px; border-radius: 9px;
  border: 1px solid var(--edge);
}
.dec-tab.on .dec-tab-count { color: var(--gold); border-color: var(--gold-dim); }

.past-intro {
  font-size: 14.5px; color: var(--ink-faint); line-height: 1.5;
  margin: 0 0 16px;
}

/* -- the record ----------------------------------------------------------- */

.past-years { display: flex; flex-direction: column; gap: 8px; }
.past-year { border: 1px solid var(--edge); border-radius: 9px; overflow: hidden; }
.past-year-toggle {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  width: 100%; padding: 11px 14px; text-align: left;
  background: rgba(226, 214, 187, 0.03);
}
.past-year-toggle:hover { background: rgba(217, 183, 74, 0.06); }
.past-year-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.past-year-name { font-family: var(--serif); font-size: 17.5px; color: var(--ink); }
.past-year-count { font-size: 13.5px; color: var(--ink-faint); }
/* Shape as well as colour, so the open/closed state does not depend on hue. */
.past-year-toggle::before {
  content: '\25B8'; color: var(--ink-faint); font-size: 12px;
  transition: transform 140ms ease;
}
.past-year-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }

.past-entries { display: flex; flex-direction: column; }
.past-entry {
  display: flex; flex-direction: column; gap: 5px;
  padding: 13px 15px 15px;
  border-top: 1px solid rgba(226, 214, 187, 0.07);
}
.past-when {
  font-size: 12.5px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.past-q { font-family: var(--serif); font-size: 17.5px; color: var(--ink); font-weight: 500; }
.past-prompt { margin: 0; font-size: 14.5px; color: var(--ink-faint); line-height: 1.45; }
.past-answer { margin: 3px 0 0; font-size: 15.5px; color: var(--ink-dim); line-height: 1.45; }
.past-answer-label { color: var(--ink-faint); }
.past-route {
  align-self: flex-start;
  font-size: 12.5px; color: var(--ink-faint);
  padding: 2px 8px; border: 1px solid var(--edge); border-radius: 9px;
}
.past-consequence { margin: 4px 0 0; font-size: 14.5px; color: var(--ink-dim); line-height: 1.45; }
.past-consequence-label { color: var(--ink-faint); }
.past-consequence.none { color: var(--ink-faint); font-style: italic; }

.past-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.past-actions button {
  padding: 7px 13px; font-size: 14px;
  border: 1px solid var(--edge); border-radius: 8px; color: var(--ink-dim);
}
.past-actions button:hover { border-color: var(--gold-dim); color: var(--ink); }
.past-actions button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.past-undo { border-color: rgba(196, 100, 110, 0.4) !important; }
.past-undo:hover { border-color: var(--rose) !important; }
.past-shut, .policy-shut {
  font-size: 13.5px; color: var(--ink-faint); font-style: italic;
  align-self: center;
}

/* -- standing policies ---------------------------------------------------- */

.policy-list { display: flex; flex-direction: column; gap: 2px; }
.policy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(226, 214, 187, 0.07);
}
.policy-what { display: flex; flex-direction: column; gap: 3px; }
.policy-what strong { font-family: var(--serif); font-size: 17.5px; color: var(--ink); font-weight: 500; }
.policy-current { font-size: 15px; color: var(--ink-dim); }
.policy-since { font-size: 12.5px; color: var(--ink-faint); }
.policy-change {
  flex: none;
  padding: 7px 13px; font-size: 14px;
  border: 1px solid var(--edge); border-radius: 8px; color: var(--ink-dim);
}
.policy-change:hover { border-color: var(--gold-dim); color: var(--ink); }
.policy-change:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

@media (max-width: 620px) {
  .dec-tabs { flex-wrap: wrap; }
  .policy-row { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .past-year-toggle::before { transition: none; }
}

/* ---------------------------------------------------------------------------
 * DASHBOARD FOCUS
 *
 * The dashboard used to render every eligible reading: 2 rows at the founding,
 * 29 by WHO_GUARDS. These styles serve the chapter's few readings, the one
 * urgent line that can interrupt them, and the full list one click away.
 * ------------------------------------------------------------------------ */

.metric-focus { margin-bottom: 10px; }

/* The star sits with the label, not in the value column: it is about the row,
 * not about the number. */
.m-pin {
  padding: 0 4px; margin-left: 2px;
  font-size: 14px; line-height: 1;
  color: var(--ink-faint);
  background: none; border: none;
}
.m-pin:hover { color: var(--gold-dim); }
.m-pin.on { color: var(--gold); }
.m-pin:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; border-radius: 4px; }

.metric-all-toggle {
  display: block; width: 100%;
  margin: 10px 0 0; padding: 8px 10px;
  font-size: 14px; color: var(--ink-faint); text-align: left;
  border: 1px solid var(--edge); border-radius: 8px;
}
.metric-all-toggle:hover { border-color: var(--gold-dim); color: var(--ink-dim); }
.metric-all-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.metric-all { margin-top: 10px; }

/* One line, with a way in. Not a second permanent list -- adding rows is how
 * the dashboard reached 29 in the first place. */
.metric-urgent {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 11px; margin: 10px 0 0;
  border: 1px solid rgba(196, 100, 110, 0.45);
  border-left-width: 3px;
  border-radius: 8px;
  background: rgba(196, 100, 110, 0.07);
}
.urgent-mark {
  flex: none;
  width: 17px; height: 17px; margin-top: 1px;
  font-size: 12px; font-weight: 700; line-height: 17px; text-align: center;
  color: var(--ground); background: var(--rose);
  border-radius: 50%;
}
.metric-urgent strong { font-size: 15px; color: var(--ink); }
.metric-urgent p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-dim); line-height: 1.4; }
.urgent-more { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-faint); }
.urgent-open {
  flex: none; margin-left: auto;
  padding: 5px 11px; font-size: 13.5px; color: var(--ink-dim);
  border: 1px solid var(--edge); border-radius: 7px;
}
.urgent-open:hover { border-color: var(--gold-dim); color: var(--ink); }
.urgent-open:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.metric-lesson-retired {
  margin: 6px 0 0;
  font-size: 12.5px; color: var(--ink-faint); line-height: 1.45;
}

/* ---------------------------------------------------------------------------
 * DECISION PANEL: focus, and a consequence note that waits to be acknowledged
 *
 * The note used to delete itself after nine seconds -- including the sentence
 * promising that some consequences would not arrive for several seasons. It
 * now stays until dismissed and offers a route back to the record.
 * ------------------------------------------------------------------------ */

/* Keyboard focus has to be visible on the option cards: it is where the panel
 * puts the keyboard when it opens. */
.dec-option:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.decision-panel .x:focus-visible,
.dec-modern-toggle:focus-visible,
.dec-confirm button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.consequence-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 9px;
}
.consequence-link, .consequence-close {
  padding: 5px 11px;
  font-size: 13.5px; color: var(--ink-dim);
  border: 1px solid var(--edge); border-radius: 7px;
}
.consequence-close { margin-left: auto; }
.consequence-link:hover, .consequence-close:hover {
  border-color: var(--gold-dim); color: var(--ink);
}
.consequence-link:focus-visible, .consequence-close:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px;
}

/* ---------------------------------------------------------------------------
 * OBSERVATION INTERVAL
 *
 * The beat between education episodes. Deliberately not a modal: the clock is
 * running, and the whole point is that the student looks at the city rather
 * than at another panel. It sits in the corner stack, says how long is left,
 * and can be ended at any time.
 * ------------------------------------------------------------------------ */

.observe {
  width: 276px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--sky);
  border-radius: 9px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 260ms ease, transform 260ms ease;
}
.observe.in { opacity: 1; transform: none; }

.observe-kicker {
  display: block;
  font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--sky);
}
.observe strong {
  display: block; margin-top: 3px;
  font-family: var(--serif); font-size: 17.5px; color: var(--ink); font-weight: 500;
}
.observe p {
  margin: 5px 0 0;
  font-size: 13.5px; color: var(--ink-faint); line-height: 1.45;
}

.observe-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px;
}
.observe-count { font-size: 12.5px; color: var(--ink-faint); }
.observe-go {
  padding: 6px 13px;
  font-size: 13.5px; color: var(--ink-dim);
  border: 1px solid var(--edge); border-radius: 7px;
}
.observe-go:hover { border-color: var(--gold-dim); color: var(--ink); }
.observe-go:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  .observe { transition: none; opacity: 1; transform: none; }
}

/* One control, not eleven. Opens every cost at once for comparison; a picked
 * option shows its own cost regardless, so nothing is ever committed blind. */
.dec-costs-toggle {
  align-self: flex-start;
  margin: 0 0 4px;
  padding: 6px 12px;
  font-size: 13.5px; color: var(--ink-faint);
  border: 1px solid var(--edge); border-radius: 7px;
}
.dec-costs-toggle:hover { border-color: var(--gold-dim); color: var(--ink-dim); }
.dec-costs-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* §9.1: City Memory's timeline explains what followed a choice; the record is
 * where a student can act on it. This is the bridge between them. */
.tl-to-record {
  align-self: flex-start;
  margin: 8px 0 4px;
  padding: 6px 12px;
  font-size: 13.5px; color: var(--ink-dim);
  border: 1px solid var(--edge); border-radius: 7px;
}
.tl-to-record:hover { border-color: var(--gold-dim); color: var(--ink); }
.tl-to-record:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* C-013: the provenance mark. A gradient of shapes -- full for Book II, half
 * for inferred, empty for ours -- so the distinction survives without the word
 * under every row, and without depending on colour recognition. */
.prov {
  /* Drawn, not typed. Full circle = Book II says it, half = inferred from it,
   * empty = ours. Shape carries the distinction so it survives without colour
   * recognition, and drawing it means no font gets to decide what a half
   * circle looks like. */
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  padding: 0;
  cursor: help;
  flex-shrink: 0;
  vertical-align: baseline;
  position: relative;
  top: 1px;
}
.prov-plato { background: currentColor; }
.prov-modern { background: transparent; }
.prov-inference {
  background: linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
}
.metric:hover .prov { filter: brightness(1.25); }
.prov:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 3px; }

.prov-legend {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  padding: 6px 12px 8px;
  font-size: 11.5px; color: var(--ink-faint);
}
.prov-legend-item { display: inline-flex; align-items: center; gap: 5px; }
