/* ─────────────────────────────────────────────────────────────
   Lyric Hunt — Neon Karaoke Night
   Midnight stage. Hot magenta + cyan. Words pop. Buttons glow.
   ───────────────────────────────────────────────────────────── */

:root {
  /* Palette — midnight stage with neon spotlights */
  --bg:         #0b0820;
  --bg-deep:    #060414;
  --stage:      #150b32;
  --stage-2:    #1f1244;

  --ink:        #fff8f0;
  --ink-soft:   rgba(255, 248, 240, 0.72);
  --ink-thin:   rgba(255, 248, 240, 0.42);
  --ink-faint:  rgba(255, 248, 240, 0.18);

  --pink:       #ff2d95;
  --pink-deep:  #c4126e;
  --cyan:       #00e5ff;
  --yellow:     #ffd60a;
  --lime:       #7cff6b;
  --red:        #ff3848;
  --violet:     #9b5cff;

  --rule:       rgba(255, 248, 240, 0.14);
  --rule-soft:  rgba(255, 248, 240, 0.06);

  /* Type */
  --serif: "Fraunces", "Newsreader", "EB Garamond", Georgia, serif;
  --mono:  "JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", monospace;

  /* Layout */
  --col: min(100% - 1.5rem, 480px);
  --gutter: 0.75rem;

  /* Motion */
  --ease:     cubic-bezier(0.2, 0.7, 0.1, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --bounce:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.4;
  font-feature-settings: "ss01", "ss02", "kern", "liga";
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  padding-top: max(var(--gutter), env(safe-area-inset-top));
  padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background:
    radial-gradient(80% 60% at 12% -10%, rgba(255, 45, 149, 0.28), transparent 60%),
    radial-gradient(70% 60% at 100% 10%, rgba(0, 229, 255, 0.22), transparent 65%),
    radial-gradient(90% 70% at 50% 110%, rgba(155, 92, 255, 0.28), transparent 65%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

main {
  width: var(--col);
  margin-inline: auto;
  position: relative;
}

/* Subtle film grain over the whole stage */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  mix-blend-mode: overlay;
  opacity: 0.18;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.10 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ────────────────────────────────────────────────────────────
   Masthead — neon marquee
   ──────────────────────────────────────────────────────────── */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0 0.7rem;
  border-bottom: 1.5px solid var(--rule);
  margin-bottom: 1rem;
  position: relative;
}
.masthead::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1.5px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--pink), var(--cyan), transparent);
  opacity: 0.7;
}

.masthead__title {
  font-family: var(--serif);
  font-weight: 800;
  font-style: italic;
  font-size: 1.05rem;
  letter-spacing: 0.005em;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45ch;
  color: var(--ink);
  text-shadow: 0 0 16px rgba(255, 45, 149, 0.45);
}
.masthead__title::before {
  content: "♪";
  color: var(--pink);
  font-size: 0.95em;
  font-style: normal;
  text-shadow: 0 0 12px rgba(255, 45, 149, 0.8);
}

.masthead__meta {
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-thin);
  display: inline-flex;
  align-items: center;
  gap: 0.55ch;
}
.masthead__meta .dot {
  width: 0.45em; height: 0.45em; border-radius: 50%;
  background: var(--lime);
  display: inline-block;
  box-shadow: 0 0 8px var(--lime);
  animation: liveDot 1.6s ease-in-out infinite;
}
@keyframes liveDot {
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ────────────────────────────────────────────────────────────
   HUD — top row: round + score; below: timer bar (artist stage)
   ──────────────────────────────────────────────────────────── */
.pieza-wrap {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.95rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.pieza {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.pieza__timeline {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.pieza__no {
  padding: 0.32rem 0.55rem;
  color: var(--ink);
  font-weight: 600;
  background: var(--stage);
  border: 1.5px solid var(--cyan);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.18), inset 0 0 12px rgba(0, 229, 255, 0.08);
  font-size: 0.62rem;
  white-space: nowrap;
}
.pieza__no em {
  font-style: normal;
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.6);
}

.pieza__score {
  padding: 0.32rem 0.6rem;
  color: var(--ink);
  background: var(--stage);
  border: 1.5px solid var(--pink);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 45, 149, 0.18), inset 0 0 12px rgba(255, 45, 149, 0.1);
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4ch;
  font-size: 0.62rem;
}
.pieza__score em {
  font-style: normal;
  font-family: var(--serif);
  font-weight: 800;
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: 1.15rem;
  color: var(--pink);
  text-shadow: 0 0 10px rgba(255, 45, 149, 0.7);
  letter-spacing: -0.02em;
  line-height: 0.7;
}

/* Timer — visual bar that drains; color drifts from cyan → yellow → red */
.pieza__timer {
  position: relative;
  height: 14px;
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(0, 229, 255, 0.10), rgba(255, 45, 149, 0.10));
  border: 1.5px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
}
.pieza__timer__fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background:
    linear-gradient(90deg,
      var(--lime)   0%,
      var(--cyan)   25%,
      var(--yellow) 60%,
      var(--pink)   85%,
      var(--red)    100%);
  background-size: var(--bg-size, 100%) 100%;
  background-position: left center;
  background-repeat: no-repeat;
  width: 100%;
  /* Width is driven by CSS animation; ticker fine-tunes via custom prop. */
  animation: timerDrain var(--turn-ms, 8000ms) linear forwards;
  animation-delay: calc(var(--elapsed, 0) * -1ms);
  box-shadow: 0 0 14px rgba(255, 214, 10, 0.4);
}
.pieza__timer__fill.is-paused {
  animation: none;
  width: 100%;
}
@keyframes timerDrain {
  to { width: 0%; }
}

/* Seconds badge — rides next to the bar */
.pieza__clock {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.4ch;
  white-space: nowrap;
  padding: 0.32rem 0.55rem;
  border: 1.5px solid var(--yellow);
  background: var(--stage);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 214, 10, 0.18);
  transition: color 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease);
}
.pieza__clock::before {
  content: "⏱";
  color: var(--yellow);
  font-size: 0.85em;
  text-shadow: 0 0 6px rgba(255, 214, 10, 0.7);
}
.pieza__clock--urgent {
  color: var(--red);
  border-color: var(--red);
  background: rgba(255, 56, 72, 0.14);
  animation: clockPulse 0.4s steps(2, end) infinite;
  text-shadow: 0 0 8px rgba(255, 56, 72, 0.6);
}
.pieza__clock--urgent::before {
  color: var(--red);
  text-shadow: 0 0 8px rgba(255, 56, 72, 0.8);
}
@keyframes clockPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Whole HUD shakes in the last two seconds */
.pieza-wrap.is-urgent {
  animation: hudShake 0.18s linear infinite;
}
@keyframes hudShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}

/* ────────────────────────────────────────────────────────────
   The Lyric — stage marquee. Big italic on neon backdrop.
   Words pop in one-by-one.
   ──────────────────────────────────────────────────────────── */
.epigraph {
  position: relative;
  padding: 1.4rem 1rem 1.5rem;
  margin: 0 -0.25rem 1.1rem;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(0, 229, 255, 0.14), transparent 70%),
    radial-gradient(120% 100% at 50% 100%, rgba(255, 45, 149, 0.18), transparent 70%),
    var(--stage);
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px var(--rule-soft),
    0 0 28px rgba(155, 92, 255, 0.18),
    inset 0 0 40px rgba(0, 0, 0, 0.3);
  isolation: isolate;
  overflow: hidden;
}

/* Marquee strip — scrolling neon dashes top + bottom */
.epigraph::before,
.epigraph::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background:
    repeating-linear-gradient(90deg,
      var(--pink) 0 14px,
      transparent 14px 28px,
      var(--cyan) 28px 42px,
      transparent 42px 56px);
  opacity: 0.65;
  z-index: 0;
}
.epigraph::before { top: 0; }
.epigraph::after  { bottom: 0; }

.epigraph__corner {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-thin);
  z-index: 2;
}
.epigraph__corner--tl { top: 0.55rem; left: 0.7rem; }
.epigraph__corner--tr { top: 0.55rem; right: 0.7rem; color: var(--cyan); }
.epigraph__corner--br { bottom: 0.55rem; right: 0.7rem; color: var(--yellow); font-weight: 700; }

.epigraph__quote {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-variation-settings: "opsz" 144, "SOFT" 70;
  font-size: clamp(1.5rem, 6.2vw, 2.15rem);
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
  margin: 0.7rem 0 0;
  padding: 0;
  position: relative;
  z-index: 2;
  text-shadow: 0 0 18px rgba(255, 248, 240, 0.18);
}

/* Quote-mark badges */
.epigraph__quote::before {
  content: "“";
  position: absolute;
  left: -0.05em;
  top: -0.55em;
  font-size: 3em;
  line-height: 1;
  color: var(--pink);
  opacity: 0.5;
  font-weight: 800;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  pointer-events: none;
  z-index: -1;
  text-shadow: 0 0 24px rgba(255, 45, 149, 0.4);
}

/* Word-by-word reveal. Each word is a span with --i (running index).
   Gated by .is-animate so re-renders don't replay. */
.epigraph__line { display: inline; }
.word {
  display: inline-block;
  white-space: pre;
}
.word.is-animate {
  opacity: 0;
  transform: translateY(10px) scale(0.86);
  animation: wordPop 280ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 55ms + 80ms);
}
@keyframes wordPop {
  60%  { opacity: 1; transform: translateY(-2px) scale(1.04); }
  100% { opacity: 1; transform: none; }
}

/* ────────────────────────────────────────────────────────────
   Stage prompt + question
   ──────────────────────────────────────────────────────────── */
.stage { margin-top: 0.4rem; }

.prompt {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0.4rem 0 0.55rem;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border: 1.5px solid var(--cyan);
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.06);
}

/* ────────────────────────────────────────────────────────────
   Artist choices — chunky neon buttons
   ──────────────────────────────────────────────────────────── */
.choices {
  display: grid;
  gap: 0.5rem;
  counter-reset: choice;
  margin: 0.4rem 0 1.1rem;
}

.choice {
  appearance: none;
  -webkit-appearance: none;
  background:
    linear-gradient(135deg, var(--stage) 0%, var(--stage-2) 100%);
  border: 2px solid var(--rule);
  counter-increment: choice;
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.95rem 2.6rem 0.95rem 3rem;
  min-height: 56px;
  cursor: pointer;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-variation-settings: "opsz" 144, "SOFT" 70;
  font-size: 1.1rem;
  letter-spacing: -0.005em;
  color: var(--ink);
  border-radius: 10px;
  transition:
    transform 140ms var(--ease),
    border-color 160ms var(--ease),
    background 160ms var(--ease),
    color 160ms var(--ease),
    box-shadow 160ms var(--ease);
  box-shadow:
    0 0 0 1px var(--rule-soft),
    0 2px 0 var(--bg-deep),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.choice::before {
  content: counter(choice, decimal-leading-zero);
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-style: normal;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  border: 1.5px solid rgba(0, 229, 255, 0.35);
  border-radius: 4px;
  padding: 0.2rem 0.35rem;
  line-height: 1;
  transition: color 160ms var(--ease), border-color 160ms var(--ease), background 160ms var(--ease);
}

.choice::after {
  content: "▸";
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%) translateX(-3px);
  font-family: var(--mono);
  font-style: normal;
  color: var(--pink);
  opacity: 0;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  font-size: 1rem;
  text-shadow: 0 0 8px rgba(255, 45, 149, 0.7);
}

.choice:hover,
.choice:focus-visible {
  border-color: var(--pink);
  color: var(--ink);
  outline: none;
  box-shadow:
    0 0 0 1px var(--pink),
    0 0 28px rgba(255, 45, 149, 0.45),
    0 2px 0 var(--bg-deep),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 45, 149, 0.14) 0%, var(--stage-2) 100%);
}
.choice:hover::before,
.choice:focus-visible::before {
  color: var(--pink);
  border-color: var(--pink);
  background: rgba(255, 45, 149, 0.12);
}
.choice:hover::after,
.choice:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.choice:active {
  transform: translateY(2px);
  box-shadow:
    0 0 0 1px var(--pink),
    0 0 18px rgba(255, 45, 149, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.choice.is-animate {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  animation: choiceIn 380ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 42ms + 120ms);
}
@keyframes choiceIn {
  to { opacity: 1; transform: none; }
}

/* ────────────────────────────────────────────────────────────
   Bonus stage — confirmed artist + text input
   ──────────────────────────────────────────────────────────── */
.stage--bonus.is-animate {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  animation: bonusIn 400ms var(--ease-out) forwards;
}
@keyframes bonusIn {
  to { opacity: 1; transform: none; }
}

.confirmed {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
  margin: 0.4rem 0 1rem;
  border: 2px solid var(--lime);
  background:
    linear-gradient(135deg, rgba(124, 255, 107, 0.10) 0%, var(--stage) 100%);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(124, 255, 107, 0.2),
    0 0 28px rgba(124, 255, 107, 0.18);
}
.confirmed__tick {
  font-family: var(--mono);
  font-style: normal;
  font-weight: 700;
  color: var(--lime);
  font-size: 1.3rem;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 12px rgba(124, 255, 107, 0.8);
}
.confirmed__name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-variation-settings: "opsz" 144, "SOFT" 80;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.confirmed__pts {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lime);
  font-weight: 700;
  padding: 0.3rem 0.5rem;
  border: 1.5px solid var(--lime);
  border-radius: 4px;
  background: rgba(124, 255, 107, 0.1);
}

.bonus__field {
  display: grid;
  gap: 0.35rem;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  background: var(--stage);
  margin-bottom: 0.9rem;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.bonus__field:focus-within {
  border-color: var(--pink);
  box-shadow:
    0 0 0 1px var(--pink),
    0 0 24px rgba(255, 45, 149, 0.32);
}
.bonus__field:focus-within .bonus__label {
  color: var(--pink);
}

.bonus__label {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-thin);
  font-weight: 600;
  transition: color 160ms var(--ease);
}

.bonus__input {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-variation-settings: "opsz" 144, "SOFT" 60;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--ink);
  padding: 0;
  min-height: 36px;
  width: 100%;
  outline: none;
  caret-color: var(--pink);
}
.bonus__input::placeholder {
  color: var(--ink-thin);
  font-style: italic;
}

/* ────────────────────────────────────────────────────────────
   Buttons
   ──────────────────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
  margin-top: 0.5rem;
}
.actions--right {
  justify-content: flex-end;
  margin-top: 0.9rem;
}

.btn {
  appearance: none;
  border: 2px solid var(--ink-thin);
  background: var(--stage);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 0.95rem 1.1rem;
  min-height: 48px;
  cursor: pointer;
  position: relative;
  font-weight: 700;
  border-radius: 8px;
  transition:
    transform 120ms var(--ease),
    background 160ms var(--ease),
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    box-shadow 160ms var(--ease);
  box-shadow: 0 2px 0 var(--bg-deep);
}
.btn:hover {
  background: var(--stage-2);
  color: var(--ink);
  border-color: var(--ink);
}
.btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--bg-deep);
}

.btn--primary {
  flex: 1 1 auto;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  color: var(--ink);
  border-color: var(--pink);
  box-shadow:
    0 0 0 1px var(--pink),
    0 0 24px rgba(255, 45, 149, 0.4),
    0 3px 0 var(--bg-deep);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #ff4ea8 0%, var(--pink) 100%);
  border-color: var(--pink);
  color: var(--ink);
  box-shadow:
    0 0 0 1px var(--pink),
    0 0 36px rgba(255, 45, 149, 0.6),
    0 3px 0 var(--bg-deep);
}

.btn--ghost {
  background: transparent;
  border-color: var(--rule);
  color: var(--ink-soft);
  letter-spacing: 0.14em;
  flex: 0 0 auto;
  padding: 0.95rem 0.9rem;
  box-shadow: none;
}
.btn--ghost:hover {
  background: transparent;
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.3);
}

.btn--end {
  background: transparent;
  border: 2px dashed var(--ink-thin);
  color: var(--ink-thin);
  letter-spacing: 0.14em;
  box-shadow: none;
}
.btn--end:hover {
  background: transparent;
  border-color: var(--yellow);
  color: var(--yellow);
  border-style: dashed;
  box-shadow: 0 0 16px rgba(255, 214, 10, 0.3);
}

/* ────────────────────────────────────────────────────────────
   Round outcome
   ──────────────────────────────────────────────────────────── */
.stage--revealed {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1.5px solid var(--rule);
  display: grid;
  gap: 0.7rem;
}

.outcome__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.outcome__points {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 800;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: 1.9rem;
  color: var(--lime);
  line-height: 1;
  letter-spacing: -0.03em;
  text-shadow: 0 0 16px rgba(124, 255, 107, 0.6);
}
.outcome__points span {
  color: var(--ink-thin);
  font-weight: 500;
  font-size: 0.7em;
  text-shadow: none;
}

.stamp {
  position: relative;
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.5rem 0.8rem;
  border: 2.5px solid var(--lime);
  color: var(--lime);
  transform: rotate(-4deg);
  font-weight: 800;
  background: rgba(124, 255, 107, 0.06);
  border-radius: 6px;
  text-shadow: 0 0 10px rgba(124, 255, 107, 0.6);
  box-shadow: 0 0 24px rgba(124, 255, 107, 0.25);
}
.stamp.is-animate { animation: stampIn 520ms var(--bounce) both; }
.stamp--null {
  border-color: var(--red);
  color: var(--red);
  transform: rotate(3deg);
  background: rgba(255, 56, 72, 0.08);
  text-shadow: 0 0 10px rgba(255, 56, 72, 0.6);
  box-shadow: 0 0 24px rgba(255, 56, 72, 0.25);
}
.stamp::before,
.stamp::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px solid currentColor;
  opacity: 0.4;
  pointer-events: none;
  border-radius: 4px;
}
@keyframes stampIn {
  0%   { opacity: 0; transform: rotate(-18deg) scale(1.8); }
  50%  { opacity: 1; transform: rotate(-1deg) scale(0.92); }
  100% { opacity: 1; transform: rotate(-4deg) scale(1); }
}

.attribution {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-thin);
  border: 1.5px solid var(--rule);
  background: var(--stage);
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  display: grid;
  gap: 0.28rem;
  margin: 0;
}
.attribution__row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.18rem 0;
}
.attribution__row + .attribution__row--info {
  border-top: 1px dashed var(--rule);
  padding-top: 0.4rem;
  margin-top: 0.18rem;
}
.attribution__row dt {
  color: var(--ink-thin);
  display: inline-flex;
  align-items: baseline;
  gap: 0.4ch;
  font-weight: 600;
}
.attribution__row dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  text-align: right;
  max-width: 65%;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.attribution__row--ok dt   { color: var(--lime); }
.attribution__row--bad dt  { color: var(--red); }
.attribution__row--bad dd  {
  color: var(--ink-thin);
  text-decoration: line-through;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
}
.attribution__row--info dt { color: var(--ink-thin); }
.attribution__row .mark {
  font-family: var(--mono);
  font-style: normal;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ────────────────────────────────────────────────────────────
   Intro / start screen
   ──────────────────────────────────────────────────────────── */
.intro {
  padding-top: 1.2rem;
  display: grid;
  gap: 1.1rem;
}

.intro__mark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 900;
  font-variation-settings: "opsz" 144, "SOFT" 80;
  font-size: clamp(3.4rem, 17vw, 5rem);
  line-height: 0.84;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-wrap: balance;
  text-shadow:
    0 0 28px rgba(255, 45, 149, 0.45),
    0 0 56px rgba(155, 92, 255, 0.3);
}
.intro__mark em {
  display: block;
  color: var(--cyan);
  font-style: italic;
  font-weight: 900;
  font-size: 0.62em;
  line-height: 1;
  margin-top: 0.18em;
  text-shadow:
    0 0 28px rgba(0, 229, 255, 0.55),
    0 0 56px rgba(0, 229, 255, 0.3);
}

.intro__rule {
  height: 2px;
  background: linear-gradient(90deg, var(--pink) 0%, var(--cyan) 50%, var(--yellow) 100%);
  border-radius: 1px;
  margin: 0.2rem 0;
  box-shadow: 0 0 10px rgba(255, 45, 149, 0.4);
}

.intro__deck {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink-soft);
  font-style: italic;
  font-weight: 500;
  max-width: 28ch;
}

.intro__rules {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: none;
  list-style: none;
  padding: 0.75rem 0.95rem;
  margin: 0;
  display: grid;
  gap: 0.5rem;
  border: 1.5px solid var(--rule);
  background: var(--stage);
  border-radius: 10px;
  font-weight: 500;
}
.intro__rules li {
  padding-left: 1.6rem;
  position: relative;
  line-height: 1.4;
}
.intro__rules li::before {
  content: "▸";
  position: absolute;
  left: 0.1rem;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.6);
}
.intro__rules b {
  font-family: var(--serif);
  font-weight: 800;
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: 1.25em;
  color: var(--pink);
  margin-right: 0.25ch;
  text-shadow: 0 0 8px rgba(255, 45, 149, 0.6);
}

.intro__btn {
  margin-top: 0.4rem;
  align-self: stretch;
  padding: 1.15rem 1.6rem;
  font-size: 0.9rem;
  letter-spacing: 0.24em;
  position: relative;
  isolation: isolate;
}
/* Pulsing glow layer — only opacity animates, so the GPU doesn't repaint
   the button's box-shadow on every frame (mobile-paint-perf Trap 1). */
.intro__btn::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 11px;
  pointer-events: none;
  box-shadow: 0 0 36px 4px rgba(255, 45, 149, 0.55);
  z-index: -1;
  opacity: 0.45;
  animation: introPulse 2.4s ease-in-out infinite;
}
@keyframes introPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}

.intro__foot {
  margin-top: auto;
  padding-top: 1rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-thin);
  text-align: center;
}

/* ────────────────────────────────────────────────────────────
   End / final score screen — animated win / lose / mid
   ──────────────────────────────────────────────────────────── */
.final {
  padding-top: 0.8rem;
  display: grid;
  gap: 1.1rem;
  text-align: left;
  position: relative;
}

.final__banner {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1.1rem 1rem 1rem;
  border-radius: 12px;
  border: 2.5px solid var(--lime);
  background:
    radial-gradient(60% 100% at 50% 0%, rgba(124, 255, 107, 0.25), transparent 70%),
    var(--stage);
  box-shadow: 0 0 36px rgba(124, 255, 107, 0.3);
  overflow: hidden;
  isolation: isolate;
  min-height: 88px;
}
.final--mid .final__banner {
  border-color: var(--yellow);
  background:
    radial-gradient(60% 100% at 50% 0%, rgba(255, 214, 10, 0.22), transparent 70%),
    var(--stage);
  box-shadow: 0 0 36px rgba(255, 214, 10, 0.28);
}
.final--lose .final__banner {
  border-color: var(--red);
  background:
    radial-gradient(60% 100% at 50% 0%, rgba(255, 56, 72, 0.25), transparent 70%),
    var(--stage);
  box-shadow: 0 0 36px rgba(255, 56, 72, 0.3);
}

/* Banner title — slams down */
.final__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 900;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  line-height: 0.85;
  letter-spacing: -0.035em;
  color: var(--lime);
  margin: 0;
  text-align: center;
  text-shadow:
    0 0 22px rgba(124, 255, 107, 0.6),
    0 0 48px rgba(124, 255, 107, 0.3);
  position: relative;
  z-index: 2;
  animation: titleSlam 720ms var(--bounce) both;
}
.final--mid .final__title {
  color: var(--yellow);
  text-shadow:
    0 0 22px rgba(255, 214, 10, 0.6),
    0 0 48px rgba(255, 214, 10, 0.3);
}
.final--lose .final__title {
  color: var(--red);
  text-shadow:
    0 0 22px rgba(255, 56, 72, 0.6),
    0 0 48px rgba(255, 56, 72, 0.3);
  animation: titleSlam 720ms var(--bounce) both, titleGlitch 0.18s steps(2, end) 6;
  animation-delay: 0s, 0.7s;
}
@keyframes titleSlam {
  0%   { opacity: 0; transform: scale(2.4) rotate(-6deg); }
  55%  { opacity: 1; transform: scale(0.9) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-1deg); }
}
@keyframes titleGlitch {
  0%, 100% { transform: translate(0); }
  25%      { transform: translate(-2px, 1px); }
  75%      { transform: translate(2px, -1px); }
}

.final__sub {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-thin);
  text-align: center;
  margin-top: 0.5rem;
  position: relative;
  z-index: 2;
}

/* Confetti — pure CSS dots that fall from the top */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.confetti span {
  position: absolute;
  top: -22px;
  left: calc(var(--x, 50) * 1%);
  width: 8px;
  height: 14px;
  background: var(--c, var(--pink));
  border-radius: 1.5px;
  animation: confettiFall var(--dur, 1800ms) var(--ease-out) var(--d, 0ms) forwards;
  transform-origin: center;
  opacity: 0;
}
@keyframes confettiFall {
  0%   { opacity: 0; transform: translateY(0) rotate(0); }
  8%   { opacity: 1; }
  100% { opacity: 0; transform: translateY(220px) rotate(720deg); }
}

/* Big score — counts up via @property animation. The custom property
   --count is registered so keyframes can interpolate it; the final value
   comes from --target on the element. */
@property --count {
  syntax: '<integer>';
  inherits: false;
  initial-value: 0;
}
.final__big {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 900;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: clamp(7rem, 32vw, 11rem);
  line-height: 0.82;
  color: var(--pink);
  letter-spacing: -0.055em;
  text-align: left;
  text-shadow:
    0 0 28px rgba(255, 45, 149, 0.6),
    0 0 56px rgba(255, 45, 149, 0.35);
  position: relative;
  display: grid;
  gap: 0.45rem;
}
.final__big__num {
  display: block;
  counter-reset: n var(--count);
  line-height: 0.82;
}
.final__big__num.is-animate {
  animation: countUp 1400ms var(--ease-out) 0.35s both;
}
@keyframes countUp {
  from { --count: 0; }
  to   { --count: var(--target); }
}
.final__big__num::after {
  content: counter(n);
}
.final--lose .final__big { color: var(--red); text-shadow: 0 0 28px rgba(255, 56, 72, 0.55); }
.final--mid  .final__big { color: var(--yellow); text-shadow: 0 0 28px rgba(255, 214, 10, 0.55); }

.final__big small {
  display: block;
  font-family: var(--mono);
  font-size: 0.12em;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: none;
  margin-top: 0.4rem;
}

.final__head {
  /* legacy — kept hidden if not used */
  display: none;
}

.final__quip {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
  border-left: 3px solid var(--cyan);
  padding: 0.4rem 0.9rem;
  margin: 0;
  background: var(--stage);
  border-radius: 0 8px 8px 0;
  line-height: 1.4;
}
.final__quip cite {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 0.4rem;
  font-weight: 700;
}

/* Lose container shakes once on enter */
.final--lose {
  animation: pageShake 0.35s ease-in-out 0.7s 2;
}
@keyframes pageShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-2px); }
  80%      { transform: translateX(2px); }
}

/* Tally — list of all rounds */
.tally {
  border-top: 1.5px solid var(--rule);
  border-bottom: 1.5px solid var(--rule);
  padding: 0.5rem 0.6rem;
  background: var(--stage);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  display: grid;
  gap: 0.18rem;
}
.tally__row {
  display: grid;
  grid-template-columns: 2.2rem 1fr 2.6rem;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.22rem 0;
  border-bottom: 1px dotted var(--rule);
}
.tally__row:last-child { border-bottom: 0; }
.tally__row b {
  color: var(--ink);
  font-weight: 600;
}
.tally__row .pts {
  text-align: right;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 800;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: 1.1rem;
  color: var(--lime);
  text-shadow: 0 0 8px rgba(124, 255, 107, 0.5);
}
.tally__row.skipped .pts { color: var(--ink-thin); text-shadow: none; }
.tally__row.skipped b   { color: var(--ink-thin); text-decoration: line-through; }

/* ────────────────────────────────────────────────────────────
   Record panel
   ──────────────────────────────────────────────────────────── */
.record {
  margin: 0.3rem 0 0.4rem;
  padding: 0.75rem 0.85rem 0.85rem;
  border: 1.5px solid var(--rule);
  background:
    linear-gradient(180deg, rgba(155, 92, 255, 0.06), transparent),
    var(--stage);
  border-radius: 10px;
  display: grid;
  gap: 0.6rem;
}

.record__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.record__title {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}

.record__badge {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(135deg, var(--pink), var(--violet));
  padding: 0.28rem 0.6rem;
  border: 2px solid var(--pink);
  border-radius: 4px;
  transform: rotate(-3deg);
  font-weight: 800;
  position: relative;
  box-shadow: 0 0 20px rgba(255, 45, 149, 0.5);
  animation: badgeWobble 1.6s ease-in-out infinite;
}
@keyframes badgeWobble {
  0%, 100% { transform: rotate(-3deg) scale(1); }
  50%      { transform: rotate(-1deg) scale(1.04); }
}

.record__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.record__stat {
  display: grid;
  gap: 0.15rem;
  padding: 0.1rem 0 0.1rem 0.5rem;
  border-left: 1.5px solid var(--rule);
}
.record__stat:first-child {
  border-left: 0;
  padding-left: 0;
}

.record__stat-label {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-thin);
  font-weight: 600;
}

.record__stat-value {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 800;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
  text-shadow: 0 0 12px rgba(255, 248, 240, 0.2);
}

.record--empty {
  padding: 0.75rem 0.85rem 0.85rem;
}
.record__placeholder {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

@media (max-width: 360px) {
  .record__grid { gap: 0.3rem; }
  .record__stat { padding-left: 0.35rem; }
  .record__stat-value { font-size: 1.3rem; }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.btn:focus-visible { outline-offset: 4px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .word.is-animate              { animation: none; opacity: 1; transform: none; }
  .stamp.is-animate             { animation: none; }
  .choice.is-animate            { animation: none; opacity: 1; transform: none; }
  .stage--bonus.is-animate      { animation: none; opacity: 1; transform: none; }
  .pieza__clock--urgent         { animation: none; }
  .pieza-wrap.is-urgent         { animation: none; }
  .intro__btn::before           { animation: none; }
  .record__badge                { animation: none; }
  .final__title                 { animation: none; opacity: 1; transform: none; }
  .final--lose                  { animation: none; }
  .confetti span                { display: none; }
  .final__big__num.is-animate   { animation: none; --count: var(--target); }
  .pieza__timer__fill           { animation: none; width: 100%; }
  .masthead__meta .dot          { animation: none; }
}
