/* tutor v2 — dark paperback-textbook aesthetic.
 *
 * Body is a serif (Iowan / Charter / Baskerville fallback) on near-black paper.
 * Amber rule for accents — the colour of a reading lamp on a study desk.
 * Chrome is IBM Plex Mono, small, deferential. No icons, no gradients in the
 * content area. The "paper" panel has a faint grain and a thin rule top and
 * bottom — the impression is a single page lifted out of a paperback.
 *
 * v2 additions / changes (below the v0-v1 ruleset):
 *   - .calibration-banner: same banner, but the big readout is now an N / M
 *     count rather than a percentage. The percentage was reading schoolmarmy
 *     per Dan; the count keeps the same information and changes the register.
 *     The fading bar is unchanged — still the visual hook on reveal.
 *   - .lie-shape-tag: unchanged from v1.
 */

:root {
  --bg: #0c0a07;
  --bg-elev: #15120d;
  --paper: #14110c;
  --paper-edge: #1d1812;
  --ink: #e8e0cf;
  --ink-soft: #c9bfa9;
  --ink-dim: #8a7f6a;
  --muted: #5e5444;
  --rule: #2a2218;
  --rule-strong: #3b2f1f;
  --amber: #d49a3a;
  --amber-soft: rgba(212, 154, 58, 0.10);
  --amber-line: rgba(212, 154, 58, 0.40);
  --amber-deep: #b87333;
  --amber-hover: #e6ab48;
  --crimson: #b04a3a;
  --live-success: var(--success, #7ee787);
  --button-ink: var(--text-inverse, #14110c);
  --control-radius: var(--radius-sm, 2px);
  --game-focus: var(--border-focus, var(--amber-line));
  --serif: var(--font-prose, 'Iowan Old Style', 'Charter', 'Baskerville', 'Georgia', 'Sitka Text', serif);
  --mono: var(--font-mono, 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, 'Roboto Mono', monospace);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* paper grain — subtle noise wash for warmth */
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(212, 154, 58, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 0% 100%, rgba(184, 115, 51, 0.03) 0%, transparent 60%);
  opacity: 0.9;
}

/* masthead — like the running head of a textbook */
.masthead {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.masthead .brand { color: var(--amber); }
.masthead .meta { color: var(--muted); font-style: italic; text-transform: none; letter-spacing: 0.03em; }

/* main column */
main {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

/* screens */
.screen { display: none; }
.screen.active { display: block; animation: fade-up 0.45s ease both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* the paper panel — a textbook page lifted out */
.paper {
  background: var(--paper);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  padding: 2.5rem 2rem;
  position: relative;
}
.paper::before, .paper::after {
  content: "";
  position: absolute;
  left: 2rem;
  right: 2rem;
  height: 1px;
  background: var(--rule);
}
.paper::before { top: 6px; }
.paper::after { bottom: 6px; }

@media (max-width: 600px) {
  .paper { padding: 1.75rem 1.1rem; }
  .paper::before, .paper::after { left: 1rem; right: 1rem; }
  main { padding: 1.5rem 0.6rem 3rem; }
  html, body { font-size: 16px; }
}

/* kicker / title / lede */
.kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.7rem;
}
h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin-bottom: 0.2rem;
  color: var(--ink);
}
h1.alt {
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}
.byline {
  font-style: italic;
  color: var(--ink-dim);
  margin: 0.2rem 0 1.75rem;
  font-size: 1.02rem;
}

/* intro */
.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}
.rules {
  list-style: none;
  border-left: 2px solid var(--amber-line);
  padding: 0.2rem 0 0.2rem 1rem;
  margin: 1.25rem 0 1.5rem;
  color: var(--ink-soft);
}
.rules li {
  font-size: 0.95rem;
  padding: 0.18rem 0;
  font-style: italic;
}
.rules li::before {
  content: "—  ";
  color: var(--amber);
  font-style: normal;
}

/* lecture body */
.instruction {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  text-transform: uppercase;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 0;
  margin: 0.5rem 0 1.5rem;
  text-align: center;
}
.paragraphs { display: flex; flex-direction: column; gap: 0.4rem; }
.paragraph {
  position: relative;
  padding: 0.9rem 1.1rem 0.9rem 2.3rem;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  color: var(--ink-soft);
  font-size: 1.02rem;
}
.paragraph::before {
  content: attr(data-num);
  position: absolute;
  left: 0.5rem;
  top: 0.95rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-style: normal;
}
.paragraph:hover {
  background: var(--amber-soft);
  border-color: var(--amber-line);
  color: var(--ink);
}
.paragraph:hover::before { color: var(--amber); }
.paragraph.flagged { /* during reveal */
  border-color: var(--ink-dim);
  background: rgba(232, 224, 207, 0.04);
  color: var(--ink);
  cursor: default;
}
.paragraph.lie {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--ink);
  cursor: default;
}
.paragraph.lie::before { color: var(--amber); }
.paragraph.muted-after-guess {
  opacity: 0.35;
  cursor: default;
}

/* reveal */
.reveal-block {
  margin: 1.4rem 0;
  border-top: 1px solid var(--rule);
  padding-top: 1.1rem;
}
.block-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.5rem;
}
.excerpt {
  border-left: 2px solid var(--rule-strong);
  padding: 0.2rem 0 0.2rem 1rem;
  color: var(--ink-soft);
  font-style: italic;
}
.excerpt.amber { border-left-color: var(--amber); color: var(--ink); }
.lie-fragment {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--amber);
}
.lie-fragment::before { content: "the planted phrase: "; color: var(--ink-dim); }
.truth, .why { color: var(--ink-soft); }
.citation {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-dim);
  line-height: 1.55;
}

/* credibility */
.credibility-card {
  margin-top: 1.6rem;
  padding: 1.2rem 1.2rem;
  border: 1px solid var(--rule-strong);
  background: rgba(255,255,255,0.01);
}
.big-stat {
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 1.1;
  color: var(--amber);
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin: 0.3rem 0 0.7rem;
}
.big-suffix {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.trail-grid {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-dim);
}
.trail-grid .cell {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px solid var(--rule-strong);
  background: transparent;
}
.trail-grid .cell.filled { background: var(--amber); border-color: var(--amber); }
.trail-grid .cell.empty { background: transparent; }
.trail-grid .cell.pending { opacity: 0.3; }
.trail-grid .label { margin-left: 0.6rem; font-style: italic; }

/* intro credibility strip */
.credibility-strip {
  margin: 1.4rem 0 1.6rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.9rem;
}
.credibility-strip .lbl { letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.credibility-strip .val { color: var(--amber); }
.credibility-strip .trail { display: inline-flex; gap: 0.3rem; }
.credibility-strip .trail .cell {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1px solid var(--rule-strong);
}
.credibility-strip .trail .cell.filled { background: var(--amber); border-color: var(--amber); }

/* buttons */
button.primary, button.ghost {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.7rem 1.1rem;
  border-radius: var(--control-radius);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
button.primary {
  background: var(--amber);
  border: 1px solid var(--amber);
  color: var(--button-ink);
  margin-top: 1rem;
}
button.primary:hover { background: var(--amber-hover); border-color: var(--amber-hover); }
button:focus-visible {
  outline: 2px solid var(--game-focus);
  outline-offset: 3px;
}
button.ghost {
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--ink-dim);
}
button.ghost:hover { border-color: var(--amber-line); color: var(--ink); }

.action-row { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.4rem; }
.status { font-family: var(--mono); font-size: 0.75rem; margin-top: 0.5rem; min-height: 1.2em; }

/* misc */
.footnote { font-size: 0.86rem; margin-top: 1.1rem; }
.dim { color: var(--ink-dim); }

/* colophon */
.colophon {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--rule);
  padding: 0.8rem 1.25rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.colophon .sep { margin: 0 0.5rem; }
.colophon a { color: var(--ink-dim); text-decoration: underline; text-decoration-color: var(--rule-strong); }
.colophon a:hover { color: var(--amber); text-decoration-color: var(--amber); }

/* ---------- v2 banner (replaces v1 .cb-pct with .cb-count) ---------- */

/* calibration banner — shows up immediately under the reveal headline,
 * before all the other reveal-blocks. v2: big readout is "N / M" (lies
 * caught today out of attempts today), not a percentage. Same fading
 * bar; same amber wash; different register on the number. */
.calibration-banner {
  margin: 0.6rem 0 1.6rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--amber-line);
  background: linear-gradient(180deg, var(--amber-soft) 0%, transparent 100%);
  position: relative;
}
.calibration-banner .cb-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.65rem;
}
.calibration-banner .cb-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.calibration-banner .cb-count {
  font-family: var(--serif);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--amber);
  font-weight: 400;
  white-space: nowrap;
  min-width: 4.5rem;
  letter-spacing: -0.01em;
}
.calibration-banner .cb-count-sep {
  color: var(--ink-dim);
  font-size: 1.8rem;
  margin: 0 0.05rem;
}
.calibration-banner .cb-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.calibration-banner .cb-bar {
  height: 6px;
  width: 0%;
  background: linear-gradient(90deg, var(--amber-deep) 0%, var(--amber) 100%);
  border-radius: 1px;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 14px rgba(212, 154, 58, 0.35);
}
.calibration-banner .cb-bar-caption {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

@media (max-width: 520px) {
  .calibration-banner .cb-row { gap: 0.8rem; }
  .calibration-banner .cb-count { font-size: 2rem; min-width: 3.5rem; }
  .calibration-banner .cb-count-sep { font-size: 1.4rem; }
}

/* lie-shape tag — small mono caption under the why-plausible paragraph */
.lie-shape-tag {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.lie-shape-tag::before {
  content: "▸ ";
  color: var(--amber);
}
