/* Bible Quiz — spec-lite v1
   Mobile-first, vertical-safe (9:16 filmable) layout.
   Big streak numeral, visible lives, distinct green/red states. */

:root {
  /* Expressive green: #4AAE67 bright, #57A16C muted, #346148 deep.
     The page itself carries a full mid green. Depth comes from moving in
     both directions off it: the question card recedes darker, the answer
     options lift brighter. */
  --bg: #256042;
  --bg-card: #0e1f16;
  --bg-option: #183024;
  --bg-option-hover: #224032;
  --text: #ffffff;
  --text-dim: #9bb8a8;

  /* Mint accents for timer ring and UI chrome — not used for "correct". */
  --accent: #6fe295;
  --accent-soft: #8fdcaa;
  --accent-deep: #346148;

  /* Success green: vivid emerald, borrowed from how trivia games signal
     "right" (Wordle #6aaa64 family, Duolingo lime). Kept separate from
     the page greens so it reads instantly against dark options. */
  --success: #4ade80;
  --success-bright: #86efac;
  --success-ink: #052e16;
  --success-glow: rgba(74, 222, 128, 0.55);

  /* Legacy aliases used by reveal strip and killer answer */
  --green: var(--success);
  --green-bright: var(--success-bright);
  --green-ink: var(--success-ink);
  --green-deep: #166534;

  /* The timer's warning state cannot be green, or it would be
     indistinguishable from the ring's normal state. */
  --warn: #d9a03f;

  /* Gold has two jobs: rich amber for CTAs (Play, Restart, logo) and a
     lighter glow for reward numbers (streak, final score). */
  --gold: #e5b847;
  --gold-bright: #f0cc5c;
  --gold-deep: #c99a2e;
  --gold-glow: #f6e7a6;
  --gold-ink: #1a1408;

  --red: #e0574a;
  --red-deep: #8f2f26;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  /* Mobile: no pull-to-refresh/bounce, no double-tap zoom, no text inflation */
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* Game UI shouldn't be selectable or pop long-press menus on touch */
button, .hud, .timer, .question-card, .reveal-strip {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 16px 24px;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.08s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gold);
  color: var(--gold-ink);
  box-shadow: 0 4px 20px rgba(229, 184, 71, 0.35);
}
.btn-primary:hover { background: var(--gold-bright); }
.btn-primary:active {
  background: var(--gold-deep);
  box-shadow: 0 2px 10px rgba(229, 184, 71, 0.25);
}
.btn-big {
  font-size: 20px;
  padding: 18px 56px;
}
.btn-secondary {
  background: var(--bg-option);
  width: 100%;
}

/* ---------- Start / error screens ---------- */

.screen-start, .screen-error { justify-content: center; align-items: center; text-align: center; }

.start-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 0; }

.logo {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1px;
}
.logo span { color: var(--gold); }

.tagline { color: var(--text-dim); font-size: 17px; }

.start-best {
  color: var(--text-dim);
  font-size: 15px;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 999px;
}
.start-best strong { color: var(--gold); }

.start-rules { color: var(--text-dim); font-size: 13px; max-width: 280px; line-height: 1.5; }

.challenge-banner {
  /* Lifted above the page green so it reads as a chip, not a hole. */
  background: #348a5c;
  border: 1px solid rgba(229, 184, 71, 0.55);
  border-radius: var(--radius);
  padding: 14px 18px;
  max-width: 320px;
  text-align: center;
}
.challenge-text {
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
}
.challenge-text strong { color: var(--gold); }

.challenge-result {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  max-width: 300px;
  line-height: 1.4;
}
.challenge-result.beat { color: var(--green); }

.rank-line {
  margin-top: 10px;
  font-size: 15px;
  color: var(--text-dim);
  text-align: center;
}
.rank-line strong { color: var(--text); font-weight: 700; }

.btn-crown {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  padding: 8px 18px;
}
.btn-crown:hover { color: var(--gold-bright); }

.crown-icon {
  width: 17px;
  height: 17px;
  flex: none;
  display: block;
}

.over-secondary {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}
.over-secondary .btn { flex: 1; padding: 14px 12px; font-size: 16px; }
.over-secondary .btn-crown {
  font-size: 15px;
  padding: 14px 10px;
  gap: 6px;
}
.over-secondary .btn-crown .crown-icon { width: 15px; height: 15px; }

.over-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
}

.btn-share {
  width: 100%;
  max-width: 280px;
}

.share-toast {
  font-size: 14px;
  color: var(--green);
  font-weight: 600;
  animation: stripIn 0.25s ease;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none !important; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 12, 0.82);
  animation: fadeIn 0.2s ease;
}

.modal-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 4px solid var(--accent);
  animation: modalIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { transform: translateY(16px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}
.modal-sub {
  font-size: 15px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.45;
}
.modal-input {
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-option);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
}
.modal-input:focus {
  border-color: var(--accent);
}
.modal-input::placeholder { color: var(--text-dim); }

.modal-error {
  font-size: 14px;
  line-height: 1.45;
  color: var(--red);
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.modal-actions .btn { flex: 1; }

/* Invite link row — name modal and friends leaderboard tab */
.invite-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 4px;
}
.invite-hint {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.35;
  margin-bottom: 10px;
}
.invite-ready {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.invite-link-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  background: #0a1812;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0 10px 0 12px;
  color: var(--text-dim);
}
.invite-link-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 10px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-link-input:focus { outline: none; }
.btn-icon-label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  padding: 10px 12px;
  font-size: 14px;
  white-space: nowrap;
}
.btn-glyph {
  width: 15px;
  height: 15px;
  flex: none;
}

.lb-invite {
  margin: 10px 0 8px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(229, 184, 71, 0.35);
  border-radius: var(--radius);
  min-width: 0;
}
.lb-invite #btn-lb-create { width: 100%; }

.modal-toast {
  margin-top: 12px;
  font-size: 14px;
  color: var(--success);
  text-align: center;
}

body.modal-open { overflow: hidden; }

.error-text { font-size: 18px; }
.error-hint { color: var(--text-dim); font-size: 14px; line-height: 1.7; }
.error-hint code {
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--accent);
}

/* ---------- HUD: streak numeral + lives ---------- */

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  gap: 6px;
}

/* Oversized numeral, top of screen, uncrowded — thumbnail-readable in 400ms */
.streak-wrap { text-align: center; }

.streak-roller {
  height: 88px;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.streak-num {
  font-size: 80px;
  font-weight: 800;
  line-height: 88px;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  color: var(--gold);
  text-shadow: 0 0 28px rgba(229, 184, 71, 0.45);
}

/* Counter roll: real animated transition, not a re-render. The overshoot
   and the brief flash to white are what make a gained streak feel earned. */
.streak-num.rolling {
  animation: rollUp 0.55s cubic-bezier(0.22, 1.5, 0.36, 1);
}
@keyframes rollUp {
  0%   { transform: translateY(70%) scale(0.75); opacity: 0; color: var(--gold-bright); }
  60%  { transform: translateY(0) scale(1.18);   opacity: 1; color: var(--gold-bright); }
  100% { transform: translateY(0) scale(1);      opacity: 1; color: var(--gold); }
}

.streak-label {
  color: var(--text-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

/* ---------- Tier pill + timer row ---------- */

.game-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 10px;
}

/* Countdown ring: conveys pressure with no text, legible in a 9:16 crop */
.timer {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
}

.timer-svg {
  width: 48px;
  height: 48px;
  transform: rotate(-90deg); /* start the sweep at 12 o'clock */
}

.timer-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 4;
}

.timer-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 125.66; /* 2 * pi * r, r = 20 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
}

.timer.warning .timer-ring { stroke: var(--warn); }
.timer.critical .timer-ring { stroke: var(--red); }
.timer.critical .timer-num { color: var(--red); }

.timer.critical { animation: timerPulse 0.5s ease infinite; }
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- Question + options ---------- */

.question-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 26px 22px;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.question-card.enter { animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.question-text {
  font-size: 21px;
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
  padding-bottom: 24px;
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--bg-option);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  animation: optionIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}
/* Hover only where a real pointer exists — avoids sticky hover on touch */
@media (hover: hover) {
  .option:not(:disabled):hover { background: var(--bg-option-hover); }
}
.option:not(:disabled):active { transform: scale(0.98); background: var(--bg-option-hover); }
.option:disabled { cursor: default; }

/* Options deal in one at a time, like cards, instead of appearing as a block */
.option:nth-child(1) { animation-delay: 0.02s; }
.option:nth-child(2) { animation-delay: 0.07s; }
.option:nth-child(3) { animation-delay: 0.12s; }
.option:nth-child(4) { animation-delay: 0.17s; }
@keyframes optionIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Feedback must fire immediately, not inherit the deal-in delay above */
.option.correct, .option.wrong { animation-delay: 0s; }

.option-letter {
  flex: 0 0 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-dim);
}

/* Green flash — distinct, fast, satisfying */
.option.correct {
  background: var(--success);
  border-color: var(--success-bright);
  color: var(--success-ink);
  box-shadow: 0 0 0 2px var(--success-glow), 0 4px 24px var(--success-glow);
  animation: correctPop 0.55s cubic-bezier(0.22, 1.5, 0.36, 1);
}
.option.correct .option-letter {
  background: var(--success-ink);
  color: var(--success);
}

@keyframes correctPop {
  0%   { background: var(--success-bright); transform: scale(1); }
  45%  { background: var(--success-bright); transform: scale(1.05); }
  100% { background: var(--success);        transform: scale(1); }
}

.option.wrong {
  background: var(--red-deep);
  border-color: var(--red);
  box-shadow: 0 0 26px rgba(224, 87, 74, 0.4);
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.option.wrong .option-letter { background: var(--red); color: #fff; }

/* More oscillations at decaying amplitude reads as a real physical
   rejection; the old two-step read as a glitch. */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-10px); }
  25% { transform: translateX(9px); }
  40% { transform: translateX(-7px); }
  55% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
  85% { transform: translateX(2px); }
}

.option.dimmed { opacity: 0.35; }

/* ---------- Inline reveal strip (correct answers) ---------- */

.reveal-strip {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 440px;
  width: calc(100% - 40px);
  background: var(--bg-card);
  border: 1px solid var(--success);
  color: #eafff2;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: stripIn 0.25s ease;
}
@keyframes stripIn {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.reveal-check { font-weight: 800; color: var(--green); font-size: 16px; }
.reveal-strip-text { line-height: 1.4; }
.reveal-strip-text .cite { color: var(--green-bright); font-weight: 600; }

/* ---------- One-shot helpers ---------- */

.helpers {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding: 14px 0 calc(10px + env(safe-area-inset-bottom));
  transition: opacity 0.2s ease;
}
/* The reveal strip owns the bottom edge while it is up */
.helpers.is-tucked { opacity: 0; pointer-events: none; }

.helper {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--bg-option);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 9px 6px;
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease,
    transform 0.08s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .helper:not(:disabled):hover { background: var(--bg-option-hover); }
}
.helper:not(:disabled):active { transform: scale(0.94); }
.helper:disabled { cursor: default; }
.helper.is-used { opacity: 0.35; }

.helper-emoji { line-height: 0; }
.helper-icon { width: 40px; height: 40px; display: block; }
.helper-icon-time { color: var(--gold); filter: drop-shadow(0 0 6px rgba(229, 184, 71, 0.45)); }
.helper-icon-fifty { color: var(--accent); filter: drop-shadow(0 0 6px rgba(111, 226, 149, 0.4)); }
.helper-icon-heart { color: var(--red); filter: drop-shadow(0 0 6px rgba(224, 87, 74, 0.45)); }
/* The crack splits the heart when Second Chance is spent; it is carved in
   the button's own background colour so the heart reads as broken apart. */
.helper-heart-crack { display: none; stroke: var(--bg-option); }
.helper.heartbreak .helper-heart-crack { display: block; }
.helper.heartbreak .helper-icon-heart { filter: none; opacity: 0.8; }
.helper-label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

/* +5s: a chip floats from the button toward the timer while the ring
   flashes gold, tying the tap to the clock */
.time-chip {
  position: absolute;
  top: -4px;
  left: 50%;
  color: var(--gold-bright);
  font-size: 17px;
  font-weight: 800;
  text-shadow: 0 0 12px var(--gold-glow);
  pointer-events: none;
  animation: chipUp 0.9s ease-out forwards;
}
@keyframes chipUp {
  from { transform: translate(-50%, 0) scale(0.8); opacity: 0; }
  20%  { transform: translate(-50%, -14px) scale(1.15); opacity: 1; }
  to   { transform: translate(-50%, -72px) scale(1); opacity: 0; }
}
.timer.boosted { animation: timerPop 0.45s cubic-bezier(0.22, 1.5, 0.36, 1); }
.timer.boosted .timer-ring { animation: ringFlash 0.7s ease; }
@keyframes timerPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}
@keyframes ringFlash {
  0%   { stroke: var(--gold-bright); filter: drop-shadow(0 0 8px var(--gold-glow)); }
  100% { }
}

/* Snip-out: shared by 50/50 and a forgiven wrong pick. Visibility fades
   but the layout slot stays, so surviving answers never jump. */
.option.snipped {
  animation: snipOut 0.4s cubic-bezier(0.55, 0, 0.55, 0.2) forwards;
  pointer-events: none;
}
@keyframes snipOut {
  0%   { opacity: 1; transform: translateX(0) rotate(0deg); }
  30%  { transform: translateX(-10px) rotate(-2deg); }
  100% { opacity: 0; transform: translateX(56px) rotate(3deg); }
}

/* Second Chance: heartbeat while armed, heartbreak shake when spent */
.helper.is-armed {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(229, 184, 71, 0.35);
  opacity: 1;
}
.helper.is-armed .helper-emoji { animation: heartbeat 1.1s ease-in-out infinite; }
@keyframes heartbeat {
  0%, 56%, 100% { transform: scale(1); }
  14% { transform: scale(1.28); }
  28% { transform: scale(1); }
  42% { transform: scale(1.18); }
}
.helper.heartbreak .helper-emoji { animation: heartbreakShake 0.5s ease; }
@keyframes heartbreakShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-4px) rotate(-9deg); }
  40% { transform: translateX(4px) rotate(9deg); }
  60% { transform: translateX(-3px) rotate(-5deg); }
  80% { transform: translateX(3px) rotate(4deg); }
}

/* ---------- Game over ---------- */

.screen-over { justify-content: center; align-items: center; text-align: center; }

.over-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 24px 0;
}

.over-newbest {
  color: #3a2c05;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  box-shadow: 0 0 24px rgba(229, 184, 71, 0.4);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 3px;
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 6px;
  animation: bestPop 0.5s cubic-bezier(0.22, 1.6, 0.36, 1);
}
@keyframes bestPop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.over-score-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 13px;
}

/* Film-worthy on its own: score dominates the frame */
.over-score {
  font-size: 120px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -4px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(229, 184, 71, 0.4);
  animation: scoreLand 0.6s cubic-bezier(0.22, 1.5, 0.36, 1);
}
@keyframes scoreLand {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

.over-best { color: var(--text-dim); font-size: 16px; }
.over-best span { color: var(--text); font-weight: 700; }

.killer {
  margin: 26px 0 10px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.killer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.killer-question { font-size: 17px; font-weight: 650; line-height: 1.4; }
.killer-answer { font-size: 15px; color: var(--green); font-weight: 600; }
.killer-context { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.killer-citation { font-size: 13px; color: var(--accent-soft); font-weight: 600; }

#btn-restart { margin-top: 0; }

.over-inner .over-actions { margin-top: 18px; }

/* ---------- Leaderboard ---------- */

.screen-leaderboard {
  padding-top: 16px;
  padding-bottom: 16px;
  min-height: 0;
  overflow-x: hidden;
}

.lb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
}

.lb-back {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  line-height: 1;
  padding: 8px 12px 8px 0;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.lb-back:active { transform: scale(0.92); }

.lb-title {
  font-size: 20px;
  font-weight: 700;
}

.lb-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-card);
  border-radius: 999px;
  padding: 4px;
  margin: 12px 0 16px;
}

.lb-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.lb-tab.is-active {
  background: var(--bg-option-hover);
  color: var(--text);
}

.lb-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-option);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
}
.lb-row.is-you {
  border-color: var(--accent);
  background: var(--bg-option-hover);
  box-shadow: 0 0 0 3px rgba(111, 226, 149, 0.22);
}
/* On the green theme, accent-coloured text reads dimmer than the plain white
   rows around it, so your own row keeps white text and is marked out by the
   tint, border and star instead. */
.lb-row.is-you .lb-name { font-weight: 700; }

.lb-star {
  margin-right: 7px;
  font-size: 13px;
  color: var(--accent);
  vertical-align: 1px;
}

.lb-rank {
  flex: 0 0 34px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.lb-row.is-you .lb-rank { color: var(--accent); }
.lb-row.is-top .lb-rank { color: var(--accent-soft); }

.lb-row.is-first .lb-rank,
.lb-row.is-first .lb-score {
  color: var(--gold);
  text-shadow: 0 0 14px rgba(229, 184, 71, 0.5);
}
.lb-row.is-first .lb-rank .crown-icon { width: 20px; height: 20px; }
.lb-row.is-first {
  border-color: rgba(229, 184, 71, 0.5);
  box-shadow: 0 0 22px rgba(229, 184, 71, 0.18);
}

.lb-name {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.lb-message {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
  padding: 32px 16px;
}

.lb-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
}
.lb-actions .btn { width: 100%; max-width: 320px; }

/* Your own row doubles as the name editor. */
.lb-row.is-editable { cursor: pointer; }
.lb-row.is-editable:active { transform: scale(0.99); }

.lb-edit {
  display: inline-flex;
  margin-left: 8px;
  color: var(--accent);
  opacity: 0.8;
  vertical-align: -1px;
}

.lb-edit-glyph {
  width: 13px;
  height: 13px;
}

/* Quiet identity line under the list — the edit entry point that still works
   when your row is outside the visible top 100. */
.lb-identity {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
}
.lb-identity:hover { color: var(--text); }
.lb-identity .lb-edit-glyph { opacity: 0.75; }

/* ---------- Small phones ---------- */

/* Short viewports (iPhone SE class): tighten vertical rhythm so the
   question and all four options fit without scrolling */
@media (max-height: 700px) {
  .hud { padding-top: 10px; }
  .streak-roller { height: 60px; }
  .streak-num { font-size: 54px; line-height: 60px; }
  .game-meta { margin: 10px 0 8px; }
  .question-card { padding: 18px 16px; min-height: 88px; }
  .question-text { font-size: 18px; }
  .options { gap: 10px; margin-top: 12px; }
  .option { padding: 12px 14px; font-size: 16px; }
  .helpers { padding-top: 10px; }
  .helper { padding: 7px 6px; }
  .helper-icon { width: 36px; height: 36px; }
  .over-score { font-size: 92px; }
}

/* Narrow screens: keep side padding from eating option width */
@media (max-width: 380px) {
  .app { padding-left: 14px; padding-right: 14px; }
  .option { font-size: 15px; }
}

/* Motion here is decorative. Colour and layout carry every state on their
   own, so honouring the OS setting costs the player nothing. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
    transition-duration: 0.001s !important;
  }
}
