@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 300 800; font-display: swap; src: url(/fonts/hanken-grotesk-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/plex-mono-400.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/plex-mono-500.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/plex-mono-600.woff2) format('woff2'); }

:root {
  --bg: #0c0b0a;
  --bg-2: #151311;
  --ink: #ece7df;
  --ink-2: #b9b2a7;
  --dim: #7d776e;
  --line: #2a2622;
  --red: #ff4b36;
  --red-dim: rgba(255, 75, 54, 0.14);
  --sans: 'Hanken Grotesk', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --col: 700px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
::selection { background: var(--red); color: var(--bg); }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim);
  background: linear-gradient(var(--bg) 60%, transparent);
  pointer-events: none;
}
.rec { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.rec i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px var(--red); animation: blink 1.4s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.top-note { opacity: 0; transition: opacity 0.6s; }
.top-note.on { opacity: 1; }

/* ---------- screens ---------- */
main { max-width: var(--col); margin: 0 auto; padding: 0 20px; }
.screen { display: none; }
.screen.is-on { display: block; }

#intro {
  min-height: 100vh; min-height: 100dvh;
  padding: 120px 0 64px;
  display: none; flex-direction: column; justify-content: center;
}
#intro.is-on { display: flex; }

.kicker {
  margin: 0 0 18px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--red);
}
h1 {
  margin: 0 0 22px;
  font-size: clamp(40px, 9vw, 76px); line-height: 0.98; letter-spacing: -0.035em; font-weight: 800;
  text-wrap: balance;
}
h1 em { font-style: normal; color: var(--red); }
.lede { margin: 0 0 34px; max-width: 34em; font-size: clamp(17px, 2.4vw, 20px); color: var(--ink-2); }
.fine { margin: 26px 0 0; max-width: 34em; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--dim); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2);
  font-family: var(--mono); font-size: 15px; font-weight: 500; text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--dim); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--red); border-color: var(--red); color: #140805; }
.btn-primary:hover { background: #ff5f4b; border-color: #ff5f4b; }
.btn-ghost { background: transparent; }
#start { align-self: flex-start; font-size: 17px; min-height: 58px; padding: 0 30px; }

.debug {
  margin: 32px 0 0; padding: 16px; max-height: 50vh; overflow: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); white-space: pre-wrap; word-break: break-all;
}

/* ---------- story ---------- */
#story { padding: 96px 0 160px; }
.chapter {
  margin: 48px 0 18px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--red);
  display: flex; align-items: center; gap: 12px;
}
.chapter::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.chapter:first-child { margin-top: 0; }

.line {
  margin: 0 0 18px;
  font-family: var(--mono); font-size: clamp(16px, 2.3vw, 18.5px); line-height: 1.6;
  color: var(--ink-2);
}
.line b { color: var(--ink); font-weight: 600; }
.line.aside { padding-left: 14px; border-left: 2px solid var(--red); color: var(--ink); }
.line.aside::before { content: 'interruption'; display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); margin-bottom: 2px; }
.line.final b { color: var(--red); }
.caret { display: inline-block; width: 0.6em; height: 1.1em; margin-left: 2px; vertical-align: -0.18em; background: var(--red); animation: blink 1s steps(2, start) infinite; }

.receipt {
  display: none;
  margin-top: 6px; padding: 6px 10px;
  background: var(--red-dim); border-radius: 6px;
  font-size: 12px; line-height: 1.5; color: #ffb3a8; word-break: break-word;
}
.receipts-on .receipt { display: block; }

/* ---------- verdict ---------- */
#verdict { padding: 96px 0 140px; animation: rise 0.7s cubic-bezier(.2,.7,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.verdict-pre { margin: 0; font-family: var(--mono); color: var(--ink-2); font-size: 16px; }
.verdict-name {
  margin: 6px 0 14px;
  font-size: clamp(44px, 11vw, 92px); line-height: 0.95; letter-spacing: -0.04em; font-weight: 800;
  color: var(--red); text-wrap: balance;
}
.verdict-blurb { margin: 0 0 18px; font-size: 20px; color: var(--ink-2); max-width: 30em; }
.verdict-class {
  display: inline-block; margin: 0 0 36px; padding: 8px 14px;
  border: 1px solid var(--red); border-radius: 12px; background: var(--red-dim);
  font-family: var(--mono); font-size: 14px; color: #ffb3a8;
}
.verdict-class b { color: var(--ink); font-weight: 600; }

/* ---------- class meter ---------- */
.meter { margin: 8px 0 24px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); font-family: var(--mono); }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.meter-num { font-size: 34px; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.meter-track { position: relative; height: 12px; margin: 12px 0 8px; border-radius: 999px; background: #221f1c; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, #6b3a2f, var(--red)); }
.meter-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--dim); }
.meter-tier { margin: 18px 0 4px; font-family: var(--sans); font-size: clamp(30px, 6vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--red); animation: stamp 0.45s cubic-bezier(.2,1.6,.4,1); }
.meter-shout { margin: 6px 0 8px; font-family: var(--mono); font-size: clamp(17px, 2.6vw, 20px); font-weight: 600; color: var(--ink); animation: stamp 0.4s cubic-bezier(.2,1.6,.4,1); }
.meter-blurb { margin: 0; font-family: var(--sans); font-size: 17px; color: var(--ink-2); }
@keyframes stamp { from { opacity: 0; transform: scale(1.35); } }
.card-wrap { margin: 0 0 24px; }
.card-wrap img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 48px; }

.how { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0; }
.how summary { cursor: pointer; padding: 16px 0; font-family: var(--mono); font-size: 14px; letter-spacing: 0.04em; color: var(--ink); }
.how p { margin: 0 0 16px; color: var(--ink-2); }
.credit { margin: 36px 0 0; font-family: var(--mono); font-size: 13px; color: var(--dim); }
.credit a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- hud ---------- */
.hud {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
  padding: 24px 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 45%);
}
.hud[hidden] { display: none; }
.chip {
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2);
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--dim); }
.chip[aria-pressed="true"]#receiptsBtn { background: var(--red-dim); border-color: var(--red); color: #ffb3a8; }

@media (max-width: 480px) {
  main { padding: 0 16px; }
  .top { padding-left: 16px; padding-right: 16px; }
  .actions .btn { flex: 1 1 auto; }
  #start { align-self: stretch; }
}

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