/* The First AI PM
   Warm ink, late night at the office. Serif carries the story, mono carries the data.
   Dark is the default because you are always reading this at 11:40pm. */

:root {
  --serif: 'Newsreader', Iowan Old Style, Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #faf7f2;
  --bg-2: #f2ece2;
  --panel: #ffffff;
  --panel-2: #f7f2ea;
  --line: #e4dacb;
  --line-2: #d5c8b4;
  --text: #2a241d;
  --text-dim: #665c50;
  --muted: #8d8172;
  --accent: #a75f0c;
  --accent-hi: #8a4d05;
  --accent-soft: rgba(167, 95, 12, .10);
  --shadow: 0 1px 2px rgba(42, 36, 29, .06), 0 8px 24px rgba(42, 36, 29, .07);
  --shadow-lift: 0 2px 4px rgba(42, 36, 29, .07), 0 14px 38px rgba(42, 36, 29, .13);

  --m-trust: #2f6fbd;
  --m-quality: #2c8a5c;
  --m-burn: #c1462b;
  --m-speed: #7a4bc0;

  --good: #2c8a5c;
  --bad: #c1462b;
  --warn: #a97514;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }

/* A display rule on a component beats the UA sheet's [hidden]{display:none},
   so anything using display: must opt back in explicitly. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

/* The header is sticky, so anything we scroll to must reserve room for it or the
   first line lands underneath. One number here beats offset maths at 13 call sites. */
:root { --hud-h: 58px; }
.beat, .advance, .tr-verdict, .tr-code, .tr-next, .cl-verdict, .mp-verdict,
.jd-card, .jd-result, .iv-say, .sim, .debrief, .tr-summary, .tr-card {
  scroll-margin-top: calc(var(--hud-h) + 18px);
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; cursor: pointer; }

::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── HUD ─────────────────────────────────────────────────────────── */

#hud {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.hud-home {
  display: flex;
  align-items: baseline;
  gap: 9px;
  background: none;
  border: 0;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: 7px;
  min-width: 0;
  transition: background .15s var(--ease);
}
.hud-home:hover { background: var(--panel-2); }

.hud-ep {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.hud-ep b { color: var(--accent); font-weight: 700; }

.hud-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meters {
  display: flex;
  gap: 14px;
  margin-left: auto;
  align-items: center;
}

.meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 78px;
}

.meter-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}
.meter-top b {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.meter-bar {
  height: 4px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .8s var(--ease), background .3s;
}
.meter.trust   .meter-fill { background: var(--m-trust); }
.meter.quality .meter-fill { background: var(--m-quality); }
.meter.burn    .meter-fill { background: var(--m-burn); }
.meter.speed   .meter-fill { background: var(--m-speed); }

.meter.bump .meter-top b { animation: bump .6s var(--ease); }
@keyframes bump {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

.delta {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

.hud-right { display: flex; gap: 8px; align-items: center; }

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.ghost.icon { padding: 6px 9px; font-size: 14px; }

.pill {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  margin-left: 3px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
}

/* ── Stage ───────────────────────────────────────────────────────── */

#stage {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 22px 140px;
}

.beat {
  animation: rise .5s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* Episode opener */

.opener { padding: 44px 0 8px; }

.opener-no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.opener h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 6.5vw, 46px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.025em;
  margin: 10px 0 14px;
}

.opener .when {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--text-dim);
  margin: 0;
}

.opener-rule {
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  margin: 30px 0 6px;
  transform-origin: left;
  animation: sweep .9s var(--ease) both;
}
@keyframes sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Narrative */

.scene p {
  font-family: var(--serif);
  font-size: 19.5px;
  line-height: 1.72;
  color: var(--text);
  margin: 0 0 1.15em;
}
.scene p em { color: var(--text-dim); }
.scene p strong { font-weight: 600; }

.dialogue {
  margin: 0 0 1.3em;
  padding-left: 17px;
  border-left: 2px solid var(--line-2);
}
.dialogue .who {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
}
.dialogue .who span {
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
}
.dialogue p {
  font-family: var(--serif);
  font-size: 19.5px;
  line-height: 1.65;
  margin: 0 0 .5em;
}

/* Artifacts embedded in the story: slack messages, emails, dashboards */

.artifact {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  margin: 0 0 1.5em;
  overflow: hidden;
}
.artifact-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.artifact-head .from { color: var(--text); }
.artifact-head .meta { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.artifact-body { padding: 14px 16px; font-size: 15px; line-height: 1.62; }
.artifact-body p { margin: 0 0 .7em; }
.artifact-body p:last-child { margin-bottom: 0; }

/* ── Choices ─────────────────────────────────────────────────────── */

.choice { margin: 34px 0 8px; }

.choice-prompt {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 18px;
  letter-spacing: -.01em;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px 17px;
  transition: border-color .16s var(--ease), transform .16s var(--ease),
              box-shadow .16s var(--ease), background .16s var(--ease);
}
.option:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.option:active:not(:disabled) { transform: translateY(0); }

.option-label {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 3px;
}
.option-body { font-size: 14px; color: var(--text-dim); line-height: 1.55; }

.option:disabled { opacity: .32; cursor: default; }
.option.chosen {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option.chosen .option-label::after {
  content: '  ·  you chose this';
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0;
}

/* Outcome of a choice */

.outcome {
  margin: 26px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}
.outcome p {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  margin: 0 0 1.1em;
}

.effects {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0 0;
}
.effect {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.effect.up { color: var(--good); border-color: color-mix(in srgb, var(--good) 34%, var(--line)); }
.effect.down { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 34%, var(--line)); }
.effect.codex { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* ── Debrief: the teaching moment ────────────────────────────────── */

.debrief {
  margin: 40px 0 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px 13px 13px 4px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.debrief-head { padding: 18px 22px 0; }
.debrief-kicker {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 5px;
}
.debrief h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.015em;
  margin: 0;
}
.debrief-body { padding: 12px 22px 18px; }
.debrief-body p {
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--text-dim);
  margin: 0 0 .85em;
}
.debrief-body p strong { color: var(--text); font-weight: 600; }
.debrief-body p:last-child { margin-bottom: 0; }

.debrief-body ul { margin: 0 0 .9em; padding-left: 20px; }
.debrief-body li { font-size: 15.5px; line-height: 1.6; color: var(--text-dim); margin-bottom: .35em; }

/* Source citations live on the debrief as a data-source attribute for authoring.
   They are deliberately not rendered: the material they cite is not ours to show. */

/* ── Continue ────────────────────────────────────────────────────── */

.advance { margin: 34px 0 0; display: flex; align-items: center; gap: 14px; }

.btn {
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.005em;
  transition: background .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
  box-shadow: var(--shadow);
}
.btn:hover { background: var(--accent-hi); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }

.btn.secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.hint { font-size: 13px; color: var(--muted); }

/* ── Boot / loading / error, never blank ─────────────────────────── */

.boot, .oops {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}
.boot p { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); margin: 0; }

.boot-mark { display: flex; gap: 6px; }
.boot-mark i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.25s var(--ease) infinite;
}
.boot-mark i:nth-child(2) { animation-delay: .16s; }
.boot-mark i:nth-child(3) { animation-delay: .32s; }
@keyframes pulse {
  0%, 100% { opacity: .22; transform: scale(.75); }
  40%      { opacity: 1;   transform: scale(1); }
}

.oops h2 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -.015em;
}
.oops p { font-size: 15px; color: var(--text-dim); max-width: 42ch; margin: 0; line-height: 1.6; }
.oops code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--muted);
}

.noscript {
  max-width: 620px;
  margin: 90px auto;
  padding: 0 24px;
  text-align: center;
}
.noscript h1 { font-family: var(--serif); font-weight: 500; }

/* ── Modal (codex, season map) ───────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(8px);
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 84vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lift);
  padding: 26px 26px 24px;
  animation: rise .3s var(--ease) both;
}
.modal-x {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  transition: color .15s, border-color .15s;
}
.modal-x:hover { color: var(--accent); border-color: var(--accent); }

.modal-card h2 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -.015em;
  margin: 0 0 4px;
}
.modal-card .sub { font-size: 14px; color: var(--muted); margin: 0 0 20px; }

.codex-item {
  border-top: 1px solid var(--line);
  padding: 15px 0;
}
.codex-item:last-child { padding-bottom: 0; }
.codex-item h4 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 5px;
}
.codex-item p { font-size: 14.5px; line-height: 1.6; color: var(--text-dim); margin: 0 0 6px; }
.codex-item .src { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.empty {
  text-align: center;
  padding: 34px 10px;
}
.empty .mark { font-size: 26px; opacity: .5; margin-bottom: 10px; }
.empty p { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted); margin: 0 0 4px; }
.empty .sub2 { font-family: var(--sans); font-style: normal; font-size: 13.5px; color: var(--muted); }

/* Season map */

.map-ep {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.map-ep:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); }
.map-ep:disabled { opacity: .38; cursor: default; }

.map-no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  width: 22px;
  flex: none;
}
.map-body { min-width: 0; flex: 1; }
.map-title { font-family: var(--serif); font-size: 17px; font-weight: 500; }
.map-sim { font-size: 12px; color: var(--muted); }
.map-state { font-size: 11px; font-weight: 700; flex: none; }
.map-state.done { color: var(--good); }
.map-state.now { color: var(--accent); }
.map-state.locked { color: var(--muted); font-weight: 500; }

/* ── Sim host, shared chrome for the playable bits ───────────────── */

.sim {
  margin: 34px 0 0;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sim-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.sim-head h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 0 0 3px;
}
.sim-head p { font-size: 13.5px; color: var(--text-dim); margin: 0; line-height: 1.55; }
.sim-body { padding: 18px 20px; }
.sim-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sim-foot .status { font-size: 13px; color: var(--text-dim); flex: 1; }
.sim-foot .status b { color: var(--text); font-weight: 600; }

.counter {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 860px) {
  #hud { gap: 12px; padding: 9px 14px; flex-wrap: wrap; }
  .hud-title { display: none; }
  .meters { order: 3; width: 100%; margin-left: 0; gap: 10px; justify-content: space-between; }
  .meter { width: auto; flex: 1; }
}

@media (max-width: 520px) {
  #stage { padding: 26px 16px 110px; }
  .scene p, .dialogue p, .outcome p { font-size: 18px; }
  .opener { padding: 26px 0 4px; }
  .choice-prompt { font-size: 19px; }
  .option { padding: 13px 15px; }
  .option-label { font-size: 17px; }
  .sim-body { padding: 14px 14px; }
  .sim-head, .sim-foot { padding: 12px 14px; }
  .debrief-head { padding: 15px 16px 0; }
  .debrief-body { padding: 10px 16px 15px; }
    .meter-top { font-size: 9.5px; }
}

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

/* ── Trace reader (episode 6) ────────────────────────────────────── */

.tr-wrap { display: flex; flex-direction: column; gap: 14px; }

.tr-found {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tr-found-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 3px;
}
.tr-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-dim);
  transition: all .4s var(--ease);
}
.tr-chip.got {
  border-color: color-mix(in srgb, var(--good) 45%, var(--line));
  color: var(--good);
  background: color-mix(in srgb, var(--good) 9%, transparent);
}
.tr-chip.unknown { width: 46px; opacity: .5; }
.tr-chip.miss {
  border-color: color-mix(in srgb, var(--bad) 45%, var(--line));
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 9%, transparent);
}

.tr-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-2);
  overflow: hidden;
}

.tr-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.tr-head b { color: var(--accent); font-weight: 700; }
.tr-ask {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.tr-note {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.tr-steps { list-style: none; margin: 0; padding: 0; }
.tr-steps li { border-bottom: 1px solid var(--line); }
.tr-steps li:last-child { border-bottom: 0; }

.tr-step {
  display: flex;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  transition: background .12s var(--ease), border-color .12s var(--ease);
}
.tr-step:hover:not(:disabled) { background: var(--panel-2); border-left-color: var(--accent); }
.tr-step:disabled { cursor: default; }
.tr-step.right {
  background: color-mix(in srgb, var(--good) 11%, transparent);
  border-left-color: var(--good);
}

.tr-kind {
  flex: none;
  width: 52px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--muted);
  text-align: right;
}
.tr-kind.think  { color: var(--m-speed); }
.tr-kind.action { color: var(--bad); }
.tr-kind.tool   { color: var(--m-trust); }
.tr-kind.reply  { color: var(--m-quality); }

.tr-text {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--text);
  word-break: break-word;
}
.tr-result {
  display: block;
  margin-top: 3px;
  padding-left: 12px;
  border-left: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 11.5px;
}

.tr-clean { padding: 9px 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.tr-none {
  background: none;
  border: 1px dashed var(--line-2);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  transition: color .14s, border-color .14s;
}
.tr-none:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.tr-none:disabled { cursor: default; opacity: .4; }
.tr-none.right { color: var(--good); border-color: var(--good); border-style: solid; opacity: 1; }

.tr-v { padding: 14px; border-top: 1px solid var(--line); }
.tr-v.good  { background: color-mix(in srgb, var(--good) 8%, transparent); }
.tr-v.miss  { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.tr-v.nudge { background: color-mix(in srgb, var(--warn) 9%, transparent); }
.tr-v-head { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.tr-v.good .tr-v-head  { color: var(--good); }
.tr-v.miss .tr-v-head  { color: var(--bad); }
.tr-v.nudge .tr-v-head { color: var(--warn); }
.tr-v p { font-size: 14.5px; line-height: 1.62; color: var(--text-dim); margin: 0 0 .6em; }
.tr-v p:last-child { margin-bottom: 0; }
.tr-so { font-style: italic; color: var(--muted) !important; }

.tr-code { padding: 14px; border-top: 1px solid var(--line); }
.tr-code-q { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.tr-code-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tr-code-b {
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  transition: border-color .14s var(--ease), transform .14s var(--ease);
}
.tr-code-b:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.tr-code-b:disabled { cursor: default; opacity: .45; }
.tr-code-b b { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.tr-code-b span { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.tr-code-b.right { opacity: 1; border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.tr-code-b.wrong { opacity: 1; border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }

.tr-code-v { grid-column: 1 / -1; margin-top: 10px; font-size: 13.5px; line-height: 1.6; color: var(--text-dim); }
.tr-code-v.good b { color: var(--good); }
.tr-code-v.miss b { color: var(--bad); }

.tr-next { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.tr-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tr-foot .btn { margin-left: auto; padding: 8px 14px; font-size: 13px; }
.tr-dry { font-size: 12px; font-weight: 600; color: var(--muted); }
.tr-dry.warm { color: var(--warn); }

.tr-summary {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 18px;
  background: var(--bg-2);
}
.tr-summary.good { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.tr-summary.miss { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.tr-summary h4 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  margin: 0 0 10px;
}
.tr-summary.good h4 { color: var(--good); }
.tr-summary.miss h4 { color: var(--bad); }
.tr-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.tr-stats span { font-size: 12px; color: var(--muted); }
.tr-stats b { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--text); display: block; }
.tr-summary p { font-size: 14.5px; line-height: 1.65; color: var(--text-dim); margin: 0; }
.tr-missed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.tr-missed-label { font-size: 11px; font-weight: 600; color: var(--muted); }

@media (max-width: 560px) {
  .tr-code-opts { grid-template-columns: 1fr; }
  .tr-kind { width: 40px; font-size: 9.5px; }
  .tr-text { font-size: 11.5px; }
  .tr-head { flex-wrap: wrap; }
  .tr-ask { margin-left: 0; width: 100%; }
}

/* ── Judge calibration (episode 7) ───────────────────────────────── */

.jd-wrap { display: flex; flex-direction: column; gap: 14px; }

.jd-rubric {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg-2);
}
.jd-rubric-q { font-size: 14px; font-weight: 600; margin-bottom: 8px; line-height: 1.45; }
.jd-rubric-r { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin-bottom: 3px; }
.jd-rubric-r b {
  display: inline-block;
  min-width: 34px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}

.jd-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-2);
  padding: 16px;
}

.jd-prog { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.jd-prog-bar {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.jd-prog-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .35s var(--ease);
}

.jd-ticket, .jd-reply { margin-bottom: 12px; }
.jd-ticket span, .jd-reply span {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}
.jd-ticket {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
}
.jd-reply {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  padding: 11px 14px;
  border-left: 2px solid var(--line-2);
  background: var(--panel);
  border-radius: 0 9px 9px 0;
}

.jd-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.jd-b {
  padding: 13px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  font-size: 15px;
  font-weight: 700;
  transition: border-color .14s var(--ease), transform .14s var(--ease), background .14s var(--ease);
}
.jd-b em { display: block; font-size: 11.5px; font-weight: 500; font-style: normal; color: var(--muted); margin-top: 2px; }
.jd-b.pass:hover { border-color: var(--good); color: var(--good); transform: translateY(-1px); }
.jd-b.fail:hover { border-color: var(--bad); color: var(--bad); transform: translateY(-1px); }

.jd-hintline { font-size: 11.5px; color: var(--muted); text-align: center; }

/* Result */

.jd-result { display: flex; flex-direction: column; gap: 16px; }

.jd-matrix-wrap { overflow-x: auto; }
.jd-matrix {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 5px;
  min-width: 340px;
}
.jd-mh {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  text-align: center;
}
.jd-mh.side { justify-content: flex-end; text-align: right; padding-right: 9px; }

.jd-cell {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px 10px;
  text-align: center;
  background: var(--bg-2);
}
.jd-cell b { display: block; font-family: var(--mono); font-size: 26px; font-weight: 700; line-height: 1; }
.jd-cell span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.jd-cell.tp { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.jd-cell.tp b { color: var(--good); }
.jd-cell.tn b { color: var(--text-dim); }
.jd-cell.fp { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.jd-cell.fp b { color: var(--warn); }
.jd-cell.fn { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.jd-cell.fn b { color: var(--bad); }

.jd-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.jd-metric {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: var(--bg-2);
}
.jd-metric b { display: block; font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1; }
.jd-metric span { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-top: 6px; }
.jd-metric em { display: block; font-size: 11px; font-style: normal; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.jd-metric.bad b { color: var(--bad); }
.jd-metric.ok b { color: var(--good); }

.jd-verdict {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 4px 10px 10px 4px;
  padding: 16px 18px;
  background: var(--bg-2);
}
.jd-verdict.good { border-left-color: var(--good); }
.jd-verdict.miss { border-left-color: var(--bad); }
.jd-verdict h4 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  margin: 0 0 9px;
}
.jd-verdict.good h4 { color: var(--good); }
.jd-verdict.miss h4 { color: var(--bad); }
.jd-verdict p { font-size: 14.5px; line-height: 1.65; color: var(--text-dim); margin: 0 0 .7em; }
.jd-verdict p:last-child { margin-bottom: 0; }
.jd-verdict strong { color: var(--text); }

.jd-review {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  overflow: hidden;
}
.jd-review summary {
  cursor: pointer;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  list-style: none;
}
.jd-review summary::-webkit-details-marker { display: none; }
.jd-review summary::before { content: '▸ '; color: var(--accent); }
.jd-review[open] summary::before { content: '▾ '; }
.jd-review summary:hover { color: var(--accent); }
.jd-review-body { padding: 4px 14px 14px; }
.jd-you { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); margin: 0 0 12px; }

.jd-diff { border-top: 1px solid var(--line); padding: 12px 0; }
.jd-diff-h { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.jd-diff-h b { color: var(--accent); }
.jd-diff-r {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  padding-left: 11px;
  border-left: 2px solid var(--line-2);
  margin-bottom: 7px;
}
.jd-diff p { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); margin: 0; }

@media (max-width: 560px) {
  .jd-metrics { grid-template-columns: 1fr; }
  .jd-buttons { grid-template-columns: 1fr; }
  .jd-reply { font-size: 16.5px; }
}

/* ── Problem classifier (episode 2) ──────────────────────────────── */

.cl-wrap { display: flex; flex-direction: column; gap: 14px; }
.cl-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cl-leg {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 4px 9px 9px 4px;
  padding: 9px 12px;
  background: var(--bg-2);
}
.cl-leg.computational { border-left-color: var(--m-trust); }
.cl-leg.learning { border-left-color: var(--m-speed); }
.cl-leg b { display: block; font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.cl-leg.computational b { color: var(--m-trust); }
.cl-leg.learning b { color: var(--m-speed); }
.cl-leg span { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

.cl-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-2);
  padding: 16px;
}
.cl-card h4 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 7px;
}
.cl-ctx { font-size: 14px; line-height: 1.6; color: var(--text-dim); margin: 0 0 14px; }

.cl-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cl-b {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  font-size: 14.5px;
  font-weight: 700;
  transition: border-color .14s var(--ease), transform .14s var(--ease);
}
.cl-b em { display: block; font-size: 11px; font-weight: 500; font-style: normal; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.cl-b.computational:hover:not(:disabled) { border-color: var(--m-trust); color: var(--m-trust); transform: translateY(-1px); }
.cl-b.learning:hover:not(:disabled) { border-color: var(--m-speed); color: var(--m-speed); transform: translateY(-1px); }
.cl-b:disabled { cursor: default; opacity: .4; }
.cl-b.right { opacity: 1; border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.cl-b.wrong { opacity: 1; border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }

.cl-v { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.cl-v-head { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.cl-v.good .cl-v-head { color: var(--good); }
.cl-v.miss .cl-v-head { color: var(--bad); }
.cl-v p { font-size: 14.5px; line-height: 1.62; color: var(--text-dim); margin: 0 0 .6em; }
.cl-v p:last-child { margin-bottom: 0; }
.cl-cost { font-style: italic; color: var(--muted) !important; }

.cl-missed { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.cl-missed-i { font-size: 13px; color: var(--muted); }
.cl-missed-i b { color: var(--text-dim); font-weight: 600; }
.cl-trap {
  margin-top: 14px !important;
  padding: 12px 14px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--bad) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 32%, var(--line));
  color: var(--text-dim) !important;
  font-size: 14px !important;
}

@media (max-width: 560px) {
  .cl-legend, .cl-buttons { grid-template-columns: 1fr; }
}

/* ── PRD builder (episode 5) ─────────────────────────────────────── */

.pr-wrap { display: flex; flex-direction: column; gap: 16px; }

.pr-step {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-2);
  padding: 15px;
}
.pr-step-h { margin-bottom: 12px; }
.pr-step-h b { display: block; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.pr-step-h span { font-size: 12.5px; color: var(--muted); }
#pr-count { color: var(--accent); font-weight: 600; }

.pr-grid { display: flex; flex-direction: column; gap: 8px; }
.pr-cand {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color .14s var(--ease), background .14s var(--ease), transform .14s var(--ease);
}
.pr-cand:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.pr-cand.on { border-color: var(--accent); background: var(--accent-soft); }
.pr-cand:disabled { cursor: default; }
.pr-cand:disabled:not(.on) { opacity: .35; }

.pr-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-bottom: 6px;
}
.pr-tag.strong { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.pr-tag.weak { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }

.pr-ex {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 4px;
}
.pr-note { display: block; font-size: 12px; color: var(--muted); line-height: 1.45; }

.pr-thresh { display: flex; flex-direction: column; gap: 18px; }
.pr-t-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.pr-t-h b { font-size: 13.5px; font-weight: 600; }
.pr-t-v { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--accent); }

.pr-t input[type=range] {
  width: 100%;
  appearance: none;
  height: 4px;
  border-radius: 3px;
  background: var(--line-2);
  outline: none;
}
.pr-t input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 3px solid var(--bg-2);
  box-shadow: var(--shadow);
}
.pr-t input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 3px solid var(--bg-2);
}

.pr-t-n { font-size: 12.5px; line-height: 1.55; margin-top: 7px; min-height: 34px; }
.pr-t-n.good { color: var(--good); }
.pr-t-n.ok { color: var(--text-dim); }
.pr-t-n.bad { color: var(--bad); }

/* ── Prototype sprint (episode 3) ────────────────────────────────── */

.pt-wrap { display: flex; flex-direction: column; gap: 14px; }
.pt-budget { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg-2); }
.pt-bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 8px; }
.pt-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s var(--ease); }
.pt-bar span.full { background: var(--bad); }
.pt-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

.pt-list { display: flex; flex-direction: column; gap: 8px; }
.pt-a {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color .14s var(--ease), background .14s var(--ease), opacity .14s;
}
.pt-a:hover:not(:disabled) { border-color: var(--accent); }
.pt-a.on { border-color: var(--accent); background: var(--accent-soft); }
.pt-a:disabled { opacity: .3; cursor: default; }
.pt-cost {
  flex: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  width: 30px;
  padding-top: 1px;
}
.pt-body b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 2px; }
.pt-body span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* ── Feature map (episode 4) ─────────────────────────────────────── */

.mp-wrap { display: flex; flex-direction: column; gap: 14px; }
.mp-axes { display: flex; flex-direction: column; gap: 4px; }
.mp-axes span { font-size: 12px; color: var(--muted); }
.mp-axes b { color: var(--text-dim); font-weight: 700; }

.mp-card { border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); padding: 16px; }
.mp-card h4 { font-family: var(--serif); font-size: 20px; font-weight: 500; margin: 0 0 6px; line-height: 1.3; }

.mp-gridwrap { display: grid; grid-template-columns: 18px 1fr; grid-template-rows: 1fr auto; gap: 7px; margin-top: 6px; }
.mp-ylab {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
}
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 5px; }
.mp-cell {
  aspect-ratio: 1.6;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel);
  transition: background .14s var(--ease), border-color .14s var(--ease), transform .1s;
}
.mp-cell:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); transform: scale(1.03); }
.mp-cell:disabled { cursor: default; }
.mp-cell.truth { background: color-mix(in srgb, var(--good) 26%, transparent); border-color: var(--good); }
.mp-cell.yours { background: color-mix(in srgb, var(--bad) 22%, transparent); border-color: var(--bad); }
.mp-xlab { grid-column: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.mp-xlab span { font-size: 10px; color: var(--muted); text-align: center; }

/* ── Moat (episode 8) ────────────────────────────────────────────── */

.mo-timeline { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.mo-out {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 4px 10px 10px 4px;
  padding: 13px 15px;
  background: var(--bg-2);
}
.mo-out.lives { border-left-color: var(--good); }
.mo-out.dies { border-left-color: var(--bad); }
.mo-out-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.mo-out-h b { font-size: 14.5px; font-weight: 600; }
.mo-verdict { font-family: var(--mono); font-size: 11px; font-weight: 500; }
.mo-out.lives .mo-verdict { color: var(--good); }
.mo-out.dies .mo-verdict { color: var(--bad); }
.mo-out p { font-size: 14px; line-height: 1.62; color: var(--text-dim); margin: 0; }

/* ── Cost dial (episode 9) ───────────────────────────────────────── */

.co-readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.co-num {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
  background: var(--bg-2);
  transition: border-color .25s var(--ease);
}
.co-num b { display: block; font-family: var(--mono); font-size: 23px; font-weight: 700; line-height: 1; }
.co-num span { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-dim); margin-top: 6px; }
.co-num em { display: block; font-size: 10.5px; font-style: normal; color: var(--muted); margin-top: 2px; }
.co-num.ok { border-color: color-mix(in srgb, var(--good) 42%, var(--line)); }
.co-num.ok b { color: var(--good); }
.co-num.bad { border-color: color-mix(in srgb, var(--bad) 42%, var(--line)); }
.co-num.bad b { color: var(--bad); }

.co-target {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-dim);
  background: var(--bg-2);
}
.co-target.good { border-color: color-mix(in srgb, var(--good) 42%, var(--line)); }
.co-target.bad { border-color: color-mix(in srgb, var(--bad) 42%, var(--line)); }
.co-target b { color: var(--text); }

@media (max-width: 560px) {
  .co-readout { grid-template-columns: 1fr; }
}

/* ── The interview (episode 10) ──────────────────────────────────── */

.iv-card { border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); padding: 16px; }
.iv-q {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.iv-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.iv-card .option { background: var(--panel); }
.iv-card .option-label { font-size: 16px; }

.iv-out { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.iv-out-h { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.iv-out.true .iv-out-h { color: var(--good); }
.iv-out.thin .iv-out-h { color: var(--warn); }
.iv-out p { font-size: 15px; line-height: 1.65; color: var(--text-dim); margin: 0; }

/* ── Sign-in gate ────────────────────────────────────────────────── */

.gate {
  min-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
  transition: opacity .26s var(--ease), transform .26s var(--ease);
}
.gate.gate-out { opacity: 0; transform: translateY(-10px); }

.gate-inner { max-width: 30rem; text-align: center; }

.gate-mark { display: flex; gap: 7px; justify-content: center; margin-bottom: 26px; }
.gate-mark i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s var(--ease) infinite;
}
.gate-mark i:nth-child(2) { animation-delay: .18s; }
.gate-mark i:nth-child(3) { animation-delay: .36s; }

.gate-inner h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 7vw, 46px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.028em;
  margin: 0 0 18px;
}

.gate-lede {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.68;
  color: var(--text);
  margin: 0 0 14px;
}
.gate-sub {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--text-dim);
  margin: 0 0 26px;
}

.gate-btn { display: flex; justify-content: center; min-height: 44px; }

.gate-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 14px;
  min-height: 20px;
  transition: color .2s;
}
.gate-status.quiet { min-height: 4px; margin-top: 0; }
.gate-status.bad { color: var(--bad); font-weight: 600; }
.gate-status.bad span { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; font-size: 12.5px; }

.gate-fine {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  margin: 22px 0 0;
}

/* ── Account chip ────────────────────────────────────────────────── */

.hud-account {
  width: 30px; height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.hud-account:hover { border-color: var(--accent); transform: scale(1.06); }
.hud-account img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hud-initial { font-size: 12px; font-weight: 700; color: var(--accent); }

.acct { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.acct img { width: 46px; height: 46px; border-radius: 50%; }
.acct b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.acct span { font-size: 13.5px; color: var(--muted); }

.acct-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 6px; }
.acct-stats span { font-size: 12px; color: var(--muted); }
.acct-stats b { display: block; font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--text); }

/* ── Sync indicator ──────────────────────────────────────────────── */

.sync {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 7px 15px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-lift);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  animation: syncin .3s var(--ease);
}
@keyframes syncin {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.sync.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 38%, var(--line)); }
.sync.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 38%, var(--line)); }
.sync.busy::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s var(--ease) infinite;
  vertical-align: middle;
}

/* ── Glossary terms ──────────────────────────────────────────────── */

.gl {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: help;
  text-decoration: underline dotted var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: background .14s var(--ease);
  border-radius: 3px;
}
.gl:hover, .gl:focus-visible {
  background: var(--accent-soft);
  text-decoration-style: solid;
}
.gl::after {
  content: '?';
  font-family: var(--sans);
  font-size: .62em;
  font-weight: 700;
  color: var(--accent);
  vertical-align: super;
  margin-left: 1px;
  line-height: 0;
}

.gl-tip {
  position: fixed;
  z-index: 120;
  max-width: 21rem;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: var(--shadow-lift);
  animation: gltip .14s var(--ease);
}
@keyframes gltip {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.gl-tip b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 5px;
}
.gl-tip p {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}
.gl-tip .gl-more {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 13px;
}
/* little pointer, flips when the tip sits below the term */
.gl-tip::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 9px; height: 9px;
  margin-left: -4px;
  background: var(--panel);
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  transform: rotate(45deg);
}
.gl-tip.below::before {
  bottom: auto;
  top: -5px;
  border: 0;
  border-left: 1px solid var(--line-2);
  border-top: 1px solid var(--line-2);
}

@media (max-width: 520px) {
  .gl-tip { max-width: calc(100vw - 28px); }
}

.map-sim code {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 5px;
  margin-left: 7px;
}
.map-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.map-foot .btn { text-decoration: none; display: inline-block; }
