@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

/* ==========================================================================
   DP QUIZ — Dr Paul's Newsroom Pub Quiz
   8-bit newsprint arcade. Hot orange, tabloid red, cream, arcade yellow.
   Chunky borders, hard shadows, halftone dots, CRT scanlines.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- Dr Paul palette ---- */
  --orange: #f26522;
  --orange-hot: #ff7a1a;
  --orange-deep: #d94e0f;
  --red: #e01b24;
  --red-deep: #a3121a;
  --yellow: #ffd400;
  --yellow-hot: #ffe81a;
  --cream: #fff4dc;
  --cream-2: #ffe9c4;
  --ink: #12100e;
  --black: #0b0b0b;

  /* ---- semantic ---- */
  --good: #2fbf71;
  --good-deep: #178a4c;
  --bad: #e01b24;
  --warn: #ff9f1c;

  /* ---- legacy token names used across the game scripts ---- */
  --bg: var(--orange);
  --bg-2: var(--orange-deep);
  --panel: var(--cream);
  --panel-strong: #fffaf0;
  --line: var(--black);
  --line-strong: var(--black);
  --muted: #5b4030;
  --faint: #8a6a52;
  --violet: var(--orange-deep);
  --violet-2: var(--yellow);
  --cyan: var(--yellow);
  --lime: var(--good);
  --green: var(--good);
  --teal: var(--orange);
  --amber: var(--warn);
  --gold: var(--yellow);

  --font-display: 'Bricolage Grotesque', 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-pixel: 'Press Start 2P', 'Bricolage Grotesque', monospace;
  --font-mono: 'VT323', 'Space Grotesk', monospace;

  --radius: 10px;
  --radius-lg: 14px;
  --border: 4px;
  --shadow: 8px 8px 0 var(--black);
  --shadow-sm: 4px 4px 0 var(--black);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --halftone: radial-gradient(circle at 1px 1px, rgba(11, 11, 11, 0.16) 1.2px, transparent 1.7px);
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--orange);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.055) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
  opacity: 0.55;
}

img { max-width: 100%; }

::selection { background: var(--yellow); color: var(--black); }

/* ==========================================================================
   Animated backdrop
   ========================================================================== */

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(1100px 720px at 84% -10%, rgba(255, 212, 0, 0.62), transparent 62%),
    radial-gradient(900px 700px at -5% 108%, rgba(163, 18, 26, 0.7), transparent 60%),
    repeating-linear-gradient(45deg, rgba(11, 11, 11, 0.055) 0 16px, transparent 16px 32px),
    var(--orange);
}

.bg-decor::before {
  content: '';
  position: absolute;
  inset: -10%;
  background-image: var(--halftone);
  background-size: 14px 14px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse at 50% 40%, black 20%, transparent 78%);
  animation: grid-drift 40s linear infinite;
}

.bg-decor::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.09) 0 2px, transparent 2px 4px);
  opacity: 0.5;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: blob-float 18s var(--ease) infinite alternate;
}

.blob--violet { width: 46vw; height: 46vw; left: -10vw; top: -14vh; background: #e01b24; }
.blob--cyan { width: 42vw; height: 42vw; right: -12vw; top: 18vh; background: #ffd400; animation-delay: -6s; }
.blob--lime { width: 34vw; height: 34vw; left: 26vw; bottom: -20vh; background: #ff7a1a; animation-delay: -12s; opacity: 0.45; }

@keyframes blob-float {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(4vw, -5vh, 0) scale(1.15); }
}

@keyframes grid-drift { to { transform: translate3d(56px, 56px, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-6px) rotate(-4deg); }
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.35; }
}

/* ==========================================================================
   Per-game accents — all pulled back to the newsroom palette
   ========================================================================== */

body.theme-stats,
body.theme-board,
body.theme-outline,
body.theme-subject,
body.theme-violet,
body.theme-blue {
  --violet: var(--orange-deep);
  --violet-2: var(--yellow);
  --cyan: var(--yellow);
  --lime: var(--good);
  --amber: var(--warn);
  --teal: var(--orange);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.wrap {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
}

.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--black);
  border-bottom: var(--border) solid var(--black);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
}

.nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
  background: repeating-linear-gradient(45deg, var(--yellow) 0 10px, var(--red) 10px 20px);
  border-block: 2px solid var(--black);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--cream);
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--orange);
  border: 3px solid var(--cream);
  box-shadow: 0 0 0 3px var(--black);
  object-fit: cover;
  transition: transform 0.25s var(--ease);
}

.brand:hover img { transform: rotate(-14deg) scale(1.08); }

.brand span em {
  font-style: normal;
  color: var(--yellow);
  background: none;
  -webkit-text-fill-color: currentColor;
}

.nav-links { display: flex; align-items: center; gap: 0.4rem; }

.nav-links a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav-links a:hover { color: var(--black); background: var(--yellow); border-color: var(--black); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-bg: var(--yellow);
  appearance: none;
  border: var(--border) solid var(--black);
  border-radius: 6px;
  padding: 0.95rem 1.5rem;
  font-family: var(--font-pixel);
  font-size: 0.64rem;
  line-height: 1.7;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--black);
  background: var(--btn-bg);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s steps(2), box-shadow 0.12s steps(2), background 0.15s;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--black);
  background: var(--yellow-hot);
}

.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--black); }
.btn:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }

.btn--ghost { background: var(--cream); color: var(--black); }
.btn--ghost:hover { background: #fff; }

.btn--big { padding: 1.15rem 2rem; font-size: 0.82rem; }

.btn--link {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--red);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  padding: 0.5rem 0.6rem;
}
.btn--link:hover { background: none; transform: none; box-shadow: none; color: var(--red-deep); }

.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--black);
  background: var(--yellow);
  border: 3px solid var(--black);
  border-radius: 5px;
  padding: 0.65rem 1rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  padding: clamp(2rem, 6vw, 4rem) 0 clamp(1.5rem, 4vw, 2.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(1rem, 4vw, 2.5rem);
}

.hero::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(96vw, 900px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 212, 0, 0.2) 0deg 8deg, transparent 8deg 16deg);
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  animation: spin 140s linear infinite;
}

.hero-copy { text-align: left; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  border: 3px solid var(--black);
  background: var(--yellow);
  color: var(--black);
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  line-height: 1.8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--black);
  transform: rotate(-2deg);
}

.hero h1 {
  font-family: var(--font-pixel);
  font-size: clamp(1.5rem, 4.6vw, 2.7rem);
  line-height: 1.5;
  letter-spacing: 0;
  margin: 1.3rem 0 1.1rem;
  font-weight: 800;
  color: var(--cream);
  -webkit-text-stroke: 4px var(--black);
  paint-order: stroke fill;
  text-shadow: 6px 6px 0 var(--red-deep), 10px 10px 0 rgba(0, 0, 0, 0.18);
  animation: hero-pop 0.55s var(--ease) both;
}

@keyframes hero-pop {
  0% { opacity: 0; transform: translateY(18px) scale(0.96); }
  100% { opacity: 1; transform: none; }
}

.grad,
.hero h1 .grad {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: var(--yellow-hot);
  -webkit-text-fill-color: currentColor;
  animation: none;
}

.hero p {
  max-width: 560px;
  margin: 0;
  padding: 1rem 1.2rem;
  color: var(--ink);
  font-size: clamp(0.95rem, 1.7vw, 1.05rem);
  font-weight: 600;
  background: var(--cream);
  border: var(--border) solid var(--black);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-0.6deg);
}

/* the face */
.hero-face {
  position: relative;
  justify-self: center;
  width: min(420px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.hero-face::before {
  content: '';
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--yellow) 0deg 7deg, var(--orange-deep) 7deg 14deg);
  border: var(--border) solid var(--black);
  box-shadow: var(--shadow);
  animation: spin 26s linear infinite;
}

.hero-face::after {
  content: '';
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: var(--black);
  border: 3px solid var(--cream);
}

.hero-face img {
  position: relative;
  z-index: 1;
  width: 84%;
  height: auto;
  border-radius: 50%;
  filter: drop-shadow(6px 5px 0 rgba(0, 0, 0, 0.35));
  animation: face-float 6s ease-in-out infinite;
}

@keyframes face-float {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-8px) rotate(1.5deg); }
}

.hero-face .face-sticker {
  position: absolute;
  z-index: 3;
  right: -4%;
  bottom: 4%;
  transform: rotate(8deg);
  background: var(--red);
  color: #fff;
  border: 3px solid var(--black);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--black);
  font-family: var(--font-pixel);
  font-size: 0.44rem;
  line-height: 1.8;
  text-transform: uppercase;
  padding: 0.45rem 0.6rem;
}

/* ==========================================================================
   Ticker tape
   ========================================================================== */

.ticker {
  overflow: hidden;
  background: var(--yellow);
  border-block: var(--border) solid var(--black);
  margin-block: 0.5rem 1rem;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  width: max-content;
  padding-block: 0.7rem;
  animation: ticker-run 34s linear infinite;
}

.ticker-track span {
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--black);
  white-space: nowrap;
}

.ticker-track b { color: var(--red); font-size: 0.9rem; line-height: 1; }

@keyframes ticker-run {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

/* ==========================================================================
   Player form
   ========================================================================== */

.player-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.player-form label {
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  line-height: 1.8;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--cream);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.player-form input {
  flex: 1 1 180px;
  min-width: 0;
  background: #fff;
  border: 3px solid var(--black);
  border-radius: 6px;
  padding: 0.8rem 1.1rem;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: inset 3px 3px 0 rgba(11, 11, 11, 0.08);
}

.player-form input::placeholder { color: #b09478; }
.player-form input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--yellow); }

/* ==========================================================================
   Game cards
   ========================================================================== */

.grid {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.card {
  position: relative;
  border-radius: 12px;
  border: var(--border) solid var(--black);
  background: var(--cream);
  padding: 2.2rem 1.5rem 1.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 13px;
  background: repeating-linear-gradient(45deg, var(--orange) 0 8px, var(--yellow) 8px 16px);
  border-bottom: 3px solid var(--black);
}

.card:nth-child(3n+1) { transform: rotate(-0.7deg); }
.card:nth-child(3n+2) { transform: rotate(0.5deg); }
.card:nth-child(3n)   { transform: rotate(-0.3deg); }

.card:hover,
.card:focus-visible {
  transform: translate(-3px, -3px) rotate(0deg);
  box-shadow: 12px 12px 0 var(--black);
  outline: none;
}

.card--playable { cursor: pointer; }

.card-icon {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  background: var(--orange);
  border: 3px solid var(--black);
  box-shadow: 3px 3px 0 var(--black);
  margin-bottom: 0.9rem;
  transform: rotate(-5deg);
}

.card:hover .card-icon { animation: bob 0.9s var(--ease) infinite; }

.card--amber .card-icon { background: var(--yellow); }
.card--blue .card-icon { background: #6ec6ff; }
.card--paper .card-icon { background: var(--cream-2); }
.card--jungle .card-icon { background: var(--good); }
.card--spark .card-icon { background: var(--red); }
.card--soon .card-icon { background: #c9b7a3; }

.card h3 {
  font-family: var(--font-pixel);
  font-size: 0.78rem;
  line-height: 1.75;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
  letter-spacing: 0;
}

.card p { margin: 0 0 1rem; color: var(--muted); font-size: 0.93rem; flex: 1; }

.card-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.1rem; }

.chip {
  font-family: var(--font-pixel);
  font-size: 0.44rem;
  line-height: 1.7;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--black);
  border: 2px solid var(--black);
  background: var(--yellow);
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
  box-shadow: 2px 2px 0 var(--black);
}

.card--soon { opacity: 0.82; }
.card--soon .card-icon { filter: grayscale(0.7); }

.card-cta::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 7px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  margin-left: 2px;
}

.card-cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-pixel);
  font-size: 0.52rem;
  line-height: 1.7;
  text-transform: uppercase;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--black);
  border-radius: 4px;
  padding: 0.55rem 0.8rem;
  box-shadow: 3px 3px 0 var(--black);
}

.card:hover .card-cta { background: var(--orange-deep); }

/* ==========================================================================
   Section headings
   ========================================================================== */

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-head h2 {
  font-family: var(--font-pixel);
  font-size: clamp(0.95rem, 2.6vw, 1.4rem);
  line-height: 1.6;
  margin: 0;
  text-transform: uppercase;
  color: var(--cream);
  -webkit-text-stroke: 3px var(--black);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--red-deep);
}

.section-head p {
  margin: 0;
  color: var(--cream);
  font-weight: 600;
  font-size: 0.92rem;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Leaderboard
   ========================================================================== */

.board {
  border: var(--border) solid var(--black);
  border-radius: 10px;
  background: var(--cream);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.board-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.72rem 1rem;
  border-bottom: 2px dashed rgba(11, 11, 11, 0.35);
  animation: row-in 0.4s var(--ease) both;
}

.board-row:last-child { border-bottom: 0; }
.board-row:nth-child(odd) { background: rgba(242, 101, 34, 0.07); }
.board-row:hover { background: var(--yellow); }

.board-row .rank {
  font-family: var(--font-pixel);
  font-weight: 800;
  color: var(--ink);
  font-size: 0.68rem;
}

.board-row:nth-child(1) .rank { color: var(--red); }
.board-row:nth-child(2) .rank { color: var(--orange-deep); }
.board-row:nth-child(3) .rank { color: #a06a00; }

.board-row .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.board-row .score {
  font-family: var(--font-pixel);
  font-weight: 700;
  color: var(--red);
  font-size: 0.6rem;
  font-variant-numeric: tabular-nums;
}

.board-empty {
  padding: 2rem 1.2rem;
  text-align: center;
  color: var(--faint);
  font-size: 0.92rem;
  font-weight: 600;
}

.board:empty { min-height: 104px; display: grid; place-items: center; }
.board:empty::after {
  content: 'NO SCORES YET — BE THE FIRST!';
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  line-height: 1.9;
  color: var(--faint);
  text-align: center;
  padding: 1rem;
}

.board--picks .board-row .name { cursor: pointer; text-decoration: underline dotted transparent; text-underline-offset: 3px; }
.board--picks .board-row .name:hover { color: var(--red); text-decoration-color: currentColor; }

@keyframes row-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  background: var(--black);
  border-top: var(--border) solid var(--black);
  margin-top: 2rem;
  padding: 2rem 0 2.5rem;
  color: var(--cream);
  font-size: 0.86rem;
  text-align: center;
}

.footer a { color: var(--yellow); font-weight: 700; text-decoration: none; }
.footer a:hover { text-decoration: underline; text-decoration-thickness: 3px; }

/* ==========================================================================
   Game page shell
   ========================================================================== */

.game-shell {
  min-height: calc(100dvh - 92px);
  display: grid;
  place-items: center;
  padding: 1.8rem 1rem 3rem;
  position: relative;
}

.screen { display: none; width: min(880px, 100%); }
.screen.active { display: block; animation: screen-in 0.45s var(--ease); }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.panel {
  border: var(--border) solid var(--black);
  border-radius: var(--radius-lg);
  background: var(--cream);
  padding: clamp(1.4rem, 4vw, 2.4rem);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.panel::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--halftone);
  background-size: 16px 16px;
  opacity: 0.16;
  mask-image: linear-gradient(to bottom, black, transparent 45%);
}

/* ==========================================================================
   Start screen
   ========================================================================== */

.start-panel { text-align: center; }

.start-panel .game-icon {
  width: 92px;
  height: 92px;
  margin: 0 auto 1.2rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 2.7rem;
  background: var(--orange);
  border: var(--border) solid var(--black);
  box-shadow: 6px 6px 0 var(--black);
  animation: bob 3s var(--ease) infinite;
}

.start-panel h1 .grad {
  color: var(--yellow);
  -webkit-text-stroke: 4px var(--black);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--red-deep);
}

.start-panel h1 {
  font-family: var(--font-pixel);
  font-size: clamp(1.35rem, 4.4vw, 2.2rem);
  line-height: 1.5;
  margin: 0 0 0.9rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--yellow);
}

.start-panel .sub { color: var(--muted); max-width: 54ch; margin: 0 auto 1.6rem; font-weight: 500; }

.rules {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 0 auto 1.8rem;
  max-width: 660px;
  text-align: left;
}

.rule {
  border: 3px solid var(--black);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  background: var(--cream-2);
  font-size: 0.86rem;
  color: var(--muted);
  box-shadow: 3px 3px 0 var(--black);
}

.rule:nth-child(odd) { transform: rotate(-0.6deg); }
.rule:nth-child(even) { transform: rotate(0.6deg); }

.rule b {
  display: block;
  color: var(--ink);
  margin-bottom: 0.3rem;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  line-height: 1.7;
  text-transform: uppercase;
}

.start-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; margin-top: 0.6rem; }

.best-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.2rem;
  padding: 0.5rem 0.9rem;
  color: var(--black);
  background: var(--yellow);
  border: 3px solid var(--black);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--black);
  transform: rotate(-2deg);
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.8;
  font-weight: 700;
  text-transform: uppercase;
}

.start-board { max-width: 460px; margin: 1.8rem auto 0; text-align: left; }

.start-board h4,
.results-board h4 {
  margin: 0 0 0.6rem;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.9;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

/* difficulty picker */
.difficulty-row {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1.2rem auto 1.4rem;
}

.diff-btn {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.8;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--cream);
  border: 3px solid var(--black);
  border-radius: 6px;
  padding: 0.62rem 0.9rem 0.7rem;
  line-height: 1.9;
  box-shadow: 3px 3px 0 var(--black);
  cursor: pointer;
}

.diff-btn span { font-family: var(--font-body); font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: none; letter-spacing: 0; }
.diff-btn:hover { background: var(--cream-2); }
.diff-btn.active { background: var(--orange); color: #fff; box-shadow: 3px 3px 0 var(--black); }
.diff-btn.active span { color: rgba(255, 255, 255, 0.9); }

/* ==========================================================================
   Countdown
   ========================================================================== */

.countdown {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  background: rgba(11, 11, 11, 0.94);
}

.countdown.active { display: grid; }

.countdown span {
  font-family: var(--font-pixel);
  font-size: clamp(4rem, 16vw, 7.5rem);
  font-weight: 800;
  color: var(--yellow);
  text-shadow: 8px 8px 0 var(--red-deep);
  animation: count-pop 0.9s var(--ease);
}

.countdown span.go { color: var(--good); text-shadow: 8px 8px 0 var(--good-deep); }

@keyframes count-pop {
  0% { opacity: 0; transform: scale(0.6); }
  30% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.9; transform: scale(1); }
}

/* ==========================================================================
   HUD
   ========================================================================== */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.hud .hud-left { display: flex; align-items: center; gap: 0.7rem; }

.hud-title {
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: 0.62rem;
  line-height: 1.8;
  text-transform: uppercase;
  color: var(--cream);
  -webkit-text-stroke: 3px var(--black);
  paint-order: stroke fill;
}

.hud-progress {
  color: var(--black);
  background: var(--cream);
  border: 2px solid var(--black);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hud-score {
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  color: var(--red);
  background: var(--cream);
  border: var(--border) solid var(--black);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--black);
  padding: 0.35rem 0.7rem 0.45rem;
  text-align: right;
  -webkit-text-fill-color: currentColor;
  background-clip: border-box;
}

.hud-score small {
  display: block;
  font-size: 0.38rem;
  line-height: 1.6;
  color: var(--muted);
  -webkit-text-fill-color: currentColor;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
}

/* ==========================================================================
   Timer — ring (true/false, clue ladder, before/after, outline)
   ========================================================================== */

.timer {
  position: relative;
  width: clamp(124px, 20vw, 168px);
  aspect-ratio: 1;
  margin: 0 auto 1.2rem;
  display: grid;
  place-items: center;
  background: var(--cream);
  border: var(--border) solid var(--black);
  border-radius: 50%;
  box-shadow: 6px 6px 0 var(--black);
}

.timer svg {
  position: absolute;
  inset: 8px;
  transform: rotate(-90deg);
  width: calc(100% - 16px);
  height: calc(100% - 16px);
}

.timer-track { fill: none; stroke: rgba(11, 11, 11, 0.15); stroke-width: 10; }
.timer-bar { fill: none; stroke: var(--good); stroke-width: 10; stroke-linecap: butt; transition: stroke 0.3s; }

.timer-value {
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: clamp(1.8rem, 5.5vw, 2.4rem);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.timer-value small { font-size: 0.7rem; color: var(--muted); margin-left: 0.15rem; }

.timer.is-warn .timer-bar { stroke: var(--warn); }
.timer.is-warn .timer-value { color: #b45f00; }
.timer.is-danger .timer-bar { stroke: var(--red); }
.timer.is-danger .timer-value { color: var(--red); animation: pulse 1s steps(2) infinite; }
.timer.is-danger:not(:has(.fuse-wrap)) { box-shadow: 6px 6px 0 var(--red); }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ==========================================================================
   Timer — fuse to dynamite (Stats!)
   ========================================================================== */

.timer:has(.fuse-wrap) {
  width: min(560px, 100%);
  aspect-ratio: auto;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.timer:has(.fuse-wrap) .timer-value {
  flex: none;
  min-width: 3.2rem;
  text-align: right;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
}

.timer:has(.fuse-wrap) .timer-value small { font-size: 0.6rem; }

.fuse-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
}

.fuse-track {
  flex: 1;
  height: 22px;
  border: 3px solid var(--black);
  border-radius: 4px;
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--black);
  overflow: visible;
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.fuse-fill {
  position: relative;
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(45deg, var(--orange) 0 12px, var(--red) 12px 24px);
  transition: width 0.25s linear, background 0.3s;
}

.fuse-spark {
  position: absolute;
  left: -7px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background: var(--yellow);
  border: 2px solid var(--black);
  border-radius: 50%;
  animation: blink 0.3s steps(2) infinite;
}

.fuse-bomb {
  position: relative;
  flex: none;
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.3));
}

.fuse-boom { display: none; }

.timer.is-warn .fuse-fill,
.fuse-wrap.is-warn .fuse-fill { background: repeating-linear-gradient(45deg, var(--warn) 0 12px, var(--orange) 12px 24px); }

.timer.is-danger .fuse-fill,
.fuse-wrap.is-danger .fuse-fill { background: repeating-linear-gradient(45deg, var(--red) 0 10px, var(--black) 10px 20px); }

.timer.is-boom .fuse-bomb { animation: bomb-shake 0.12s linear 4; }
.timer.is-boom .fuse-boom { display: inline; }
.timer.is-boom .fuse-spark { opacity: 0; }

.game-shell:has(.timer.is-boom) { animation: shake 0.5s steps(3); }

@keyframes bomb-shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  20% { transform: translate(-3px, 2px) rotate(-12deg); }
  40% { transform: translate(3px, -2px) rotate(12deg); }
  60% { transform: translate(-3px, -1px) rotate(-10deg); }
  80% { transform: translate(3px, 1px) rotate(10deg); }
}

/* ==========================================================================
   Question
   ========================================================================== */

.q-card {
  position: relative;
  border: var(--border) solid var(--black);
  border-radius: var(--radius);
  background: var(--cream);
  padding: clamp(1.5rem, 3.5vw, 2.2rem);
  text-align: center;
  min-height: 268px;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.q-chip {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  line-height: 1.7;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--black);
  box-shadow: 2px 2px 0 var(--black);
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  transform: rotate(-3deg);
}

.q-text {
  font-family: var(--font-display);
  font-size: clamp(1.12rem, 2.9vw, 1.7rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  animation: q-in 0.4s var(--ease);
}

@keyframes q-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Answers
   ========================================================================== */

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.2rem;
}

.answer {
  --a: var(--good);
  position: relative;
  border: var(--border) solid var(--black);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  padding: 1.15rem 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.8vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 6px 6px 0 var(--black);
  transition: transform 0.12s steps(2), box-shadow 0.12s steps(2), background 0.15s;
  overflow: hidden;
  text-align: center;
}

.answer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--a);
  opacity: 0.12;
  transition: opacity 0.2s;
}

.answer > * { position: relative; z-index: 1; }

.answer:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--a); }
.answer:hover::before { opacity: 0.28; }
.answer:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--black); }
.answer:focus-visible { outline: 3px solid var(--black); outline-offset: 3px; }

.answer--true, .answer--a { --a: var(--good); }
.answer--false, .answer--b { --a: var(--red); }
.answer--c { --a: #3b82f6; }
.answer--d { --a: var(--orange); }

.answer .key {
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  line-height: 1;
  font-weight: 700;
  color: var(--black);
  background: var(--yellow);
  border: 2px solid var(--black);
  border-radius: 3px;
  padding: 0.35rem 0.4rem;
}

.answer .mark { font-size: 1.3rem; color: var(--a); }
.answer .label { display: block; text-wrap: balance; }
.answer .name { overflow-wrap: break-word; }

.answer.is-picked { border-color: var(--black); box-shadow: 6px 6px 0 var(--a); }
.answer.is-picked::before { opacity: 0.4; }
.answer.is-answer {
  background: var(--good);
  color: #fff;
  border-color: var(--black);
  box-shadow: 6px 6px 0 var(--black);
}
.answer.is-answer::before { opacity: 0; }
.answer.is-answer .key { background: var(--cream); }
.answer.is-answer .mark { color: #fff; }
.answer.is-dim { opacity: 0.4; filter: grayscale(0.7); }
.answer.is-bad { background: var(--red); color: #fff; box-shadow: 6px 6px 0 var(--black); }
.answer.is-bad .mark { color: #fff; }

/* 4-up answer grids (outline, mastermind) */
.theme-outline .answers,
.theme-subject .answers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }

.theme-outline .answer,
.theme-subject .answer {
  min-height: 82px;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.5rem;
  font-size: clamp(0.9rem, 3.2vw, 1.25rem);
  line-height: 1.2;
}

/* ==========================================================================
   Outline silhouette
   ========================================================================== */

.silhouette {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(150px, 34vw, 240px);
  margin: 0.5rem auto 0.9rem;
  border: 3px dashed var(--black);
  border-radius: var(--radius);
  background-color: var(--cream-2);
  background-image: var(--halftone);
  background-size: 12px 12px;
  overflow: hidden;
}

.silhouette::before {
  content: '?';
  position: absolute;
  font-family: var(--font-pixel);
  font-size: clamp(8rem, 24vw, 14rem);
  font-weight: 800;
  color: var(--ink);
  opacity: 0.06;
  pointer-events: none;
}

.silhouette-img {
  position: relative;
  display: block;
  max-inline-size: 100%;
  max-block-size: clamp(150px, 34vw, 240px);
  inline-size: auto;
  block-size: auto;
  object-fit: contain;
  animation: q-in 0.35s var(--ease) both;
}

.silhouette-glyph {
  position: relative;
  font-size: clamp(5rem, 20vw, 9rem);
  line-height: 1;
  filter: grayscale(1) brightness(0);
  animation: q-in 0.35s var(--ease) both;
}

.silhouette-img[hidden], .silhouette-glyph[hidden] { display: none; }

/* ==========================================================================
   Clue Ladder
   ========================================================================== */

.q-card.clue-card { display: block; text-align: center; }

.clue-worth {
  margin: 1.4rem 0 0.7rem;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.9;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.clue-worth b {
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  color: var(--red);
  margin-inline: 0.2rem;
}

.clue-list {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 0.55rem;
  text-align: left;
}

.clue-list li.clue {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  border: 3px solid var(--black);
  border-radius: 6px;
  background: var(--cream-2);
  box-shadow: 3px 3px 0 var(--black);
  padding: 0.62rem 0.8rem;
  font-weight: 600;
  font-size: 0.94rem;
  animation: q-in 0.3s var(--ease) both;
}

.clue-list li.clue:nth-child(odd) { transform: rotate(-0.35deg); }
.clue-list li.clue:nth-child(even) { transform: rotate(0.35deg); }

.clue-list li.clue.is-new {
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--black);
}

.clue-num {
  flex: none;
  font-family: var(--font-pixel);
  font-size: 0.44rem;
  line-height: 1.9;
  color: var(--cream);
  background: var(--red);
  border: 2px solid var(--black);
  border-radius: 3px;
  padding: 0.22rem 0.42rem;
  box-shadow: 2px 2px 0 var(--black);
}

.guess-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.guess-input {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 3px solid var(--black);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: inset 3px 3px 0 rgba(11, 11, 11, 0.08);
}

.guess-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--yellow); }

.clue-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

/* ==========================================================================
   Which Came First — sticky notes
   ========================================================================== */

.q-card.note-card {
  display: block;
  text-align: center;
  border-radius: 8px;
  background: var(--cream-2);
  border: var(--border) solid var(--black);
  box-shadow: var(--shadow);
  transform: rotate(-1deg);
  overflow: visible;
  padding-top: 1.8rem;
}

.q-card.note-card::before {
  content: '';
  position: absolute;
  top: -13px;
  left: 50%;
  width: 112px;
  height: 24px;
  transform: translateX(-50%) rotate(-2deg);
  background: rgba(255, 212, 0, 0.85);
  border: 2px solid var(--black);
  box-shadow: 2px 2px 0 var(--black);
  z-index: 2;
}

.q-card.note-card .q-text {
  color: var(--ink);
  font-size: clamp(1.7rem, 5.5vw, 2.6rem);
  line-height: 1.15;
  margin-top: 0.8rem;
}

.q-card.note-card:has(.feedback.active) { transform: none; }

.note-cutoff {
  margin: 1rem auto 0;
  padding-top: 0.55rem;
  max-width: 340px;
  border-top: 2px dashed rgba(11, 11, 11, 0.35);
  font-family: var(--font-pixel);
  font-size: 0.44rem;
  line-height: 1.9;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.theme-board .answers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }

.theme-board .answer {
  flex-direction: column;
  gap: 0.4rem;
  min-height: 130px;
  padding: 1rem 0.7rem;
  font-size: clamp(1.05rem, 3.6vw, 1.45rem);
  line-height: 1.2;
  transform: rotate(-1deg);
}

.theme-board .answer--b { transform: rotate(1deg); }

/* ==========================================================================
   Mastermind generator
   ========================================================================== */

.subject-form { margin: 1.1rem auto 0; max-inline-size: 520px; }
.subject-form input { font-size: 1rem; }

.gen-note {
  margin: 0.8rem auto 0;
  max-inline-size: 46ch;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

.gen-progress { margin: 1rem auto 0; max-inline-size: 420px; text-align: center; }
.gen-progress[hidden], .gen-error[hidden] { display: none; }

.gen-bar {
  height: 20px;
  border: 3px solid var(--black);
  border-radius: 4px;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--black);
}

.gen-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(45deg, var(--yellow) 0 10px, var(--orange) 10px 20px);
  transition: width 0.4s var(--ease);
}

.gen-progress p {
  margin: 0.6rem 0 0;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.9;
  text-transform: uppercase;
  color: var(--muted);
}

.gen-error {
  margin: 0.9rem auto 0;
  max-width: 46ch;
  padding: 0.7rem 0.9rem;
  background: var(--red);
  color: #fff;
  border: 3px solid var(--black);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--black);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ==========================================================================
   Feedback
   ========================================================================== */

.feedback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1.25rem 1.3rem;
  background: var(--black);
  border-top: 10px solid var(--yellow);
  overflow-y: auto;
  animation: screen-in 0.25s var(--ease);
}

.feedback.active { display: flex; }

.feedback-badge {
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: clamp(0.95rem, 3.2vw, 1.35rem);
  line-height: 1.6;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.feedback.is-correct .feedback-badge { color: var(--good); text-shadow: 2px 2px 0 var(--good-deep); }
.feedback.is-wrong .feedback-badge { color: #ff6b6b; text-shadow: 2px 2px 0 var(--red-deep); }
.feedback.is-timeout .feedback-badge { color: var(--yellow); text-shadow: 2px 2px 0 #8a6a00; }

.feedback-answer {
  margin: 0 0 0.35rem;
  color: var(--yellow);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  line-height: 1.9;
  text-transform: uppercase;
}

.feedback-fact { margin: 0 0 0.35rem; color: var(--cream); max-width: 60ch; font-size: 0.92rem; }

.feedback-source {
  margin: 0 0 0.9rem;
  color: rgba(255, 244, 220, 0.55);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.feedback-points {
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--yellow);
  margin-bottom: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-shadow: 3px 3px 0 var(--red-deep);
}

.feedback-points.is-zero { color: rgba(255, 244, 220, 0.5); text-shadow: none; }

.feedback-next { width: min(280px, 80%); }

.feedback-next .fb-label {
  font-family: var(--font-pixel);
  font-size: 0.42rem;
  line-height: 1.9;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 244, 220, 0.6);
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.feedback-bar { height: 12px; border: 2px solid var(--cream); background: rgba(255, 244, 220, 0.15); overflow: hidden; }
.feedback-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--yellow) 0 8px, var(--orange) 8px 16px); }

.sad-face { font-size: 2.2rem; line-height: 1; margin-bottom: 0.4rem; }

/* ==========================================================================
   Progress dots & streak
   ========================================================================== */

.dots { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1.3rem; flex-wrap: wrap; }

.dot {
  width: 15px;
  height: 15px;
  border-radius: 2px;
  border: 2px solid var(--black);
  background: var(--cream);
  transition: transform 0.2s, background 0.2s;
}

.dot.is-correct { background: var(--good); }
.dot.is-wrong { background: var(--red); }
.dot.is-current { transform: scale(1.35); background: var(--yellow); animation: blink 1s steps(2) infinite; }

.streak {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-family: var(--font-pixel);
  font-size: 0.44rem;
  line-height: 1.8;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--black);
  background: var(--yellow);
  border: 2px solid var(--black);
  box-shadow: 2px 2px 0 var(--black);
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  transform: rotate(3deg);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}

.streak.show { opacity: 1; transform: rotate(3deg); }

/* ==========================================================================
   Results
   ========================================================================== */

.results-panel { text-align: center; }

.results-kicker {
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  line-height: 1.9;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.results-score {
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: clamp(1.8rem, 8vw, 3.1rem);
  line-height: 1.35;
  letter-spacing: 0;
  margin: 0.5rem 0 0.3rem;
  color: var(--yellow);
  -webkit-text-stroke: 5px var(--black);
  paint-order: stroke fill;
  text-shadow: 6px 6px 0 var(--red-deep);
  font-variant-numeric: tabular-nums;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.results-verdict { color: var(--muted); margin: 0 0 1.4rem; font-weight: 600; }

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  max-width: 520px;
  margin: 0 auto 1.5rem;
}

.rstat {
  border: 3px solid var(--black);
  border-radius: 8px;
  padding: 0.9rem 0.6rem;
  background: var(--cream-2);
  box-shadow: 3px 3px 0 var(--black);
}

.rstat b {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  line-height: 1.6;
}

.rstat span {
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.new-best {
  display: none;
  margin: 0 auto 1.2rem;
  width: fit-content;
  padding: 0.5rem 0.95rem;
  border-radius: 4px;
  background: var(--yellow);
  border: 3px solid var(--black);
  box-shadow: 3px 3px 0 var(--black);
  color: var(--black);
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.8;
  font-weight: 700;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.new-best.show { display: block; animation: pop 0.5s var(--ease); }

@keyframes pop {
  0% { transform: scale(0.6) rotate(-2deg); opacity: 0; }
  60% { transform: scale(1.08) rotate(-2deg); }
  100% { transform: scale(1) rotate(-2deg); opacity: 1; }
}

.score-form { display: flex; gap: 0.6rem; max-width: 460px; margin: 0 auto 1.6rem; }

.score-form input {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 3px solid var(--black);
  border-radius: 6px;
  padding: 0.8rem 1.1rem;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: inset 3px 3px 0 rgba(11, 11, 11, 0.08);
}

.score-form input::placeholder { color: #b09478; }
.score-form input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--yellow); }

.results-board { max-width: 520px; margin: 0 auto 1.6rem; text-align: left; }
.results-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   Confetti, toast, sound toggle
   ========================================================================== */

#confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translate(-50%, 160%);
  z-index: 100;
  background: var(--black);
  border: 3px solid var(--yellow);
  color: var(--cream);
  padding: 0.7rem 1.1rem;
  border-radius: 4px;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.9;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--red-deep);
  transition: transform 0.35s var(--ease);
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast.show { transform: translate(-50%, 0); }

.sound-toggle {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 70;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid var(--black);
  background: var(--cream);
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--black);
  transition: transform 0.15s steps(2), box-shadow 0.15s steps(2);
}

.sound-toggle:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--black); }

/* ==========================================================================
   Misc utilities
   ========================================================================== */

.muted { color: var(--muted); }
.center { text-align: center; }
.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: 1.5rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.version-badge {
  font-family: var(--font-pixel);
  font-size: 0.42rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--black);
  border: 2px solid var(--black);
  background: var(--yellow);
  border-radius: 3px;
  padding: 0.35rem 0.55rem;
  box-shadow: 2px 2px 0 var(--black);
}

/* ==========================================================================
   INTRO — DP QUIZ slams down, Dr Paul spins in
   ========================================================================== */

html.intro-off .intro { display: none; }
html.intro-open { overflow: hidden; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #07060a;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.25s linear;
}

/* starfield + 80s floor grid */
.intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 70% 18%, rgba(255, 244, 220, 0.7) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 42% 62%, rgba(255, 244, 220, 0.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 72%, rgba(255, 244, 220, 0.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 12% 80%, rgba(255, 244, 220, 0.55) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 88%, rgba(255, 244, 220, 0.4) 50%, transparent 51%);
  animation: intro-twinkle 2.4s steps(3) infinite;
}

@keyframes intro-twinkle {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.5; }
}

.intro-grid {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -10%;
  height: 55%;
  background-image:
    linear-gradient(rgba(242, 101, 34, 0.55) 2px, transparent 2px),
    linear-gradient(90deg, rgba(242, 101, 34, 0.55) 2px, transparent 2px);
  background-size: 64px 44px;
  transform: perspective(320px) rotateX(62deg);
  transform-origin: top center;
  mask-image: linear-gradient(to top, black 10%, transparent 80%);
  animation: intro-floor 2.6s linear infinite;
  pointer-events: none;
}

@keyframes intro-floor {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 44px, 0 0; }
}

.intro-horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 42%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  opacity: 0.6;
}


.intro-inner {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 1.5rem;
  text-align: center;
  width: min(92vw, 720px);
}

/* the wordmark */
.intro-slam {
  margin: 0 0 0.2rem;
  font-family: var(--font-pixel);
  font-size: clamp(2.2rem, 9.5vw, 4.6rem);
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--yellow);
  -webkit-text-stroke: 5px var(--black);
  paint-order: stroke fill;
  text-shadow:
    6px 6px 0 var(--red-deep),
    -4px 0 0 rgba(255, 0, 80, 0.55),
    4px 0 0 rgba(0, 220, 255, 0.45);
  animation: intro-slam 0.85s cubic-bezier(0.15, 1.6, 0.3, 1) both;
}

.intro-slam span { display: block; }
.intro-slam .intro-dp { color: var(--cream); }

@keyframes intro-slam {
  0% { transform: translateY(-130%) rotate(-6deg) scale(1.7); opacity: 0; }
  55% { transform: translateY(4%) rotate(1deg) scale(0.94); opacity: 1; }
  72% { transform: translateY(-2%) rotate(-0.5deg) scale(1.04); }
  86% { transform: translateY(1%) scale(0.99); }
  100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

/* shockwave rings on impact */
.intro-ring {
  position: absolute;
  top: 24%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  border: 6px solid var(--cream);
  border-radius: 50%;
  opacity: 0;
  animation: intro-ring 0.85s 0.42s ease-out forwards;
  pointer-events: none;
}

.intro-ring:nth-of-type(2) { animation-delay: 0.52s; border-color: var(--yellow); }

@keyframes intro-ring {
  0% { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(11); opacity: 0; border-width: 1px; }
}

/* the spinning head */
.intro-face-wrap {
  position: relative;
  width: min(48vw, 290px);
  aspect-ratio: 1;
  margin-top: 1.6rem;
  display: grid;
  place-items: center;
  opacity: 0;
  animation: intro-face-in 0.2s 0.95s linear forwards;
}

@keyframes intro-face-in { to { opacity: 1; } }

/* rotating sunburst ring */
.intro-face-wrap::before {
  content: '';
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--yellow) 0deg 9deg, var(--red) 9deg 18deg);
  border: 4px solid var(--black);
  animation:
    intro-burst-spin 1.4s 0.95s steps(10) both,
    intro-burst-idle 26s 2.4s linear infinite;
}

@keyframes intro-burst-idle {
  from { transform: rotate(360deg) scale(1); }
  to { transform: rotate(720deg) scale(1); }
}

/* cream plate the face sits on */
.intro-face-wrap::after {
  content: '';
  position: absolute;
  inset: 2%;
  border-radius: 50%;
  background: var(--cream);
  border: 4px solid var(--black);
  animation: intro-plate 0.45s 0.95s steps(5) both;
}

@keyframes intro-plate {
  0% { transform: scale(0.15); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes intro-burst-spin {
  from { transform: rotate(0deg) scale(1); opacity: 1; }
  to { transform: rotate(360deg) scale(1); opacity: 1; }
}

.intro-face {
  position: relative;
  z-index: 2;
  width: 84%;
  height: 84%;
  object-fit: cover;
  object-position: 50% 38%;
  border-radius: 50%;
  border: 3px solid var(--black);
  background: var(--cream);
  image-rendering: pixelated;
  clip-path: circle(50% at 50% 50%);
  animation: intro-face-spin 1.5s 1.0s steps(14) both;
  transform-style: preserve-3d;
}

@keyframes intro-face-spin {
  0% { transform: rotateY(-540deg) scale(0.15) rotate(-25deg); opacity: 0; }
  25% { opacity: 1; }
  80% { transform: rotateY(18deg) scale(1.06) rotate(4deg); }
  100% { transform: rotateY(0deg) scale(1) rotate(0deg); opacity: 1; }
}

.intro-tag {
  margin-top: 3.4rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.46rem, 1.9vw, 0.68rem);
  line-height: 2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0;
  animation: intro-tag-in 0.45s 2.05s steps(3) forwards;
}

@keyframes intro-tag-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.intro-start {
  margin-top: 1.1rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.62rem, 2.4vw, 0.85rem);
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--black);
  background: var(--yellow);
  border: 5px solid var(--black);
  border-radius: 6px;
  padding: 1rem 1.6rem;
  box-shadow: 7px 7px 0 var(--black);
  cursor: pointer;
  opacity: 0;
  animation: intro-start-in 0.3s 2.35s steps(2) forwards;
  transition: transform 0.1s steps(2), box-shadow 0.1s steps(2), background 0.15s;
}

@keyframes intro-start-in { to { opacity: 1; } }

.intro-start:hover { background: var(--yellow-hot); transform: translate(-2px, -2px); box-shadow: 9px 9px 0 var(--black); }
.intro-start:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--black); }
.intro-start:focus-visible { outline: 3px dashed var(--yellow); outline-offset: 6px; }
.intro-start.is-ready { animation: intro-blink 1.1s steps(2) infinite; }

@keyframes intro-blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.55; }
}

.intro-skip {
  margin-top: 0.9rem;
  font-family: var(--font-pixel);
  font-size: 0.44rem;
  line-height: 2;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 244, 220, 0.45);
  opacity: 0;
  animation: intro-tag-in 0.4s 2.6s linear forwards;
}

/* the CRT switch-off when you press start */
.intro.is-out {
  animation: intro-off 0.45s cubic-bezier(0.6, 0, 0.3, 1) forwards;
}

@keyframes intro-off {
  0% { transform: scaleY(1) scaleX(1); filter: brightness(1); opacity: 1; }
  40% { transform: scaleY(0.02) scaleX(1.2); filter: brightness(3); opacity: 1; }
  70% { transform: scaleY(0.02) scaleX(0.02); filter: brightness(6); opacity: 1; }
  100% { transform: scaleY(0.02) scaleX(0.02); filter: brightness(6); opacity: 0; }
}

/* big impact shake on the whole screen */
.intro.shake { animation: intro-shake 0.35s 0.45s steps(2) both; }

@keyframes intro-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 4px); }
  40% { transform: translate(5px, -5px); }
  60% { transform: translate(-4px, -3px); }
  80% { transform: translate(3px, 4px); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 1.5rem;
  }
  .hero-copy { text-align: center; }
  .hero p { margin-inline: auto; }
  .player-form { justify-content: center; }
  .hero-face { width: min(300px, 72vw); order: -1; }
  .hero h1 { margin-top: 1rem; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .answers { grid-template-columns: 1fr; }
  .theme-outline .answers, .theme-board .answers, .theme-subject .answers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer { padding: 1rem 0.9rem; }
  .hud { gap: 0.6rem; }
  .results-stats { gap: 0.5rem; }
  .score-form { flex-direction: column; }
  .nav-links a:not(.btn) { display: none; }
  .brand { font-size: 0.66rem; }
  .brand img { width: 34px; height: 34px; }
  .hero h1 { -webkit-text-stroke: 3px var(--black); text-shadow: 4px 4px 0 var(--red-deep); }
  .hero p { transform: none; }
  .card:nth-child(n) { transform: none; }
  .card:hover { transform: translate(-2px, -2px); }
  .section-head { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .section-head p { font-size: 0.84rem; }
  .guess-row { flex-direction: column; }
  .guess-row .btn { width: 100%; }
  .fuse-wrap { gap: 0.5rem; }
  .fuse-bomb { font-size: 1.6rem; }
  .diff-btn { padding: 0.5rem 0.7rem; }
  .intro-tag { margin-top: 2.8rem; }
  .intro-face-wrap { width: min(64vw, 240px); }
}

@media (max-width: 400px) {
  .theme-outline .answers, .theme-subject .answers { grid-template-columns: 1fr; }
  .theme-board .answers { grid-template-columns: 1fr; }
  .theme-board .answer { min-height: 96px; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  /* make sure the intro is instantly usable without motion */
  .intro-start, .intro-tag, .intro-skip, .intro-face-wrap { opacity: 1 !important; }
  .intro-face { transform: none !important; }
}

/* Print */
@media print {
  .bg-decor, .nav, .footer, .sound-toggle, .intro, #confetti { display: none !important; }
  body { background: #fff; color: #000; }
}
