:root {
  --navy: #0B1C33;
  --navy-mid: #163254;
  --cyan: #00A3E0;
  --cyan-soft: #D6F1FA;
  --orange: #E86A3A;
  --orange-hover: #D45A2C;
  /* The whole app runs on one dark theme now — see quiz-dark.css for the quiz's own
     component overrides (cards, options, results). --navy stays a dark accent tone
     (buttons, badges) since it's used as a fill in as many places as it once was used
     as text; --ink is the new default reading color, introduced instead of repointing
     --navy itself, which would have inverted every one of those fills too. */
  --bg: #040A15;
  --white: #F7FAFC;
  --panel: #0D1F38;
  --border: rgba(125, 205, 255, 0.18);
  --text: #E7F4FC;
  --ink: #E7F4FC;
  --muted: #92A7BE;
  --ok: #3EE0A1;
  --ok-bg: rgba(62, 224, 161, 0.14);
  --bad: #FF6B6B;
  --bad-bg: rgba(255, 107, 107, 0.14);
  /* On dark surfaces the bright --ok/--bad themselves already clear 4.5:1 for small
     text, so the "deep" variants (once needed for white-on-pale-fill contrast) are
     just the bright colors again — kept as tokens so nothing that references them
     goes undefined. */
  --ok-deep: var(--ok);
  --bad-deep: var(--bad);
  --radius: 12px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shell: 1200px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(125, 205, 255, 0.07);
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  /* Dims to the dark stage rather than cutting instantly — the light quiz and the
     dark home/Tanya views share the same header and footer, so this one transition
     is what makes stepping between them read as one site instead of two. */
  transition: background-color 0.4s ease, color 0.4s ease;
  /* Sticky footer: keeps the footer at the bottom of short pages instead
     of floating mid-screen with dead space under it. Fixed-position
     children (backdrop, modal, canvas) sit outside this flow. */
  display: flex;
  flex-direction: column;
}

body > main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* The hero's decorative bloom bleeds -8% sideways and, whenever the
     viewport is narrower than the shell + that bleed, dragged the document
     wider than the screen and produced a horizontal scrollbar. `clip`
     rather than `hidden`: it contains the bleed without creating a scroll
     container, so the sticky header and the options' vertical hover lift
     both still work. */
  overflow-x: clip;
}

/* Trivia keeps its natural height; Tanya stretches to fill whatever is
   left between header and footer so the chat input and the footer are
   both on screen without scrolling. */
#view-trivia {
  flex: 0 0 auto;
}

#view-tanya {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* On the chat view only, give main a zero flex-basis so it takes exactly
   the space left over rather than growing with the message list — that
   keeps long conversations scrolling inside .chat-log instead of
   scrolling the whole page. Trivia keeps content-based sizing so it can
   still grow and scroll normally. */
body:has(#view-tanya.is-active) > main {
  flex: 1 1 0;
  min-height: 0;
}

body > .site-footer {
  margin-top: auto;
}

.tech-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(0, 163, 224, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(232, 106, 58, 0.08), transparent 50%),
    linear-gradient(180deg, #040A15 0%, #07203a 130%);
}

#three-celebrate-container {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.tech-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(125, 205, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 205, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, black, transparent 85%);
  transition: opacity 0.3s ease;
}

.interactive-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  /* Keeps the brand's particle field but well behind the content — the
     quiz should be the focus, not the backdrop. */
  opacity: 0.28;
}

.cursor-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  left: var(--mx, 50%);
  top: var(--my, 40%);
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(0, 163, 224, 0.09) 0%,
    rgba(232, 106, 58, 0.04) 35%,
    transparent 68%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  filter: blur(8px);
  will-change: left, top;
}

body.cursor-active .cursor-glow {
  opacity: 1;
}

.hud-card,
.btn,
.option-btn,
.chip {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.hidden { display: none !important; }
.view[hidden] { display: none !important; }
/* Nav stays hidden behind the sign-in gate (js/main.js setNavVisible). */
.site-nav[hidden],
.nav-toggle[hidden] { display: none !important; }

.view.is-active {
  animation: fade-up 0.35s ease both;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(233, 238, 245, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

/* The MRC logo is the home link — the convention users already know, so
   no separate "Home" nav item is needed. */
.brand {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.brand img {
  display: block;
  height: 26px;
  width: auto;
}

.brand:hover {
  background: rgba(0, 163, 224, 0.1);
}

.brand:focus-visible {
  outline: none;
  border-color: rgba(0, 163, 224, 0.45);
  background: rgba(0, 163, 224, 0.1);
}

.site-nav {
  display: flex;
  gap: 0.2rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--ink);
  background: rgba(0, 163, 224, 0.12);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.65rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--navy);
  margin: 4px 0;
  transition: background-color 0.4s ease;
}

.panel {
  padding: 1.75rem 0 2rem;
}

.home {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.home-copy {
  max-width: 40rem;
}

h1 {
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  line-height: 1.12;
  margin: 0 0 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

h2 {
  margin: 0 0 1.25rem;
  font-size: 1.3rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--ink);
}

.subtitle {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 40ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  appearance: none;
  border: none;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 1.35rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, color 0.15s, border-color 0.15s;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  /* A deeper brand orange: white text on #bf4a1c is 5:1 contrast (WCAG AA); the lighter
     --orange gave only 3.2:1 on the sign-in button. */
  background: #bf4a1c;
  color: white;
  box-shadow: 0 6px 18px rgba(232, 106, 58, 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: #a63f17;
}

.btn-secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.card {
  /* Same two-glow device as the result modal, dimmer — ties the question
     card to the same visual language instead of a flat panel colour. */
  background:
    radial-gradient(ellipse 55% 45% at 8% -8%, rgba(0, 163, 224, 0.12), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 108%, rgba(232, 106, 58, 0.09), transparent 65%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.hud-card {
  position: relative;
  overflow: hidden;
}

.card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), #4DD0FF, var(--orange), var(--cyan));
  background-size: 200% 100%;
  animation: result-bar-shimmer 4.5s linear infinite;
}

/* Quiz play — compact hero → progress → card flow */
#quiz-play.panel {
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

.quiz-header {
  margin-bottom: 1.1rem;
}

.trivia-hero {
  position: relative;
  text-align: center;
  padding: 1.15rem 0.75rem 1.05rem;
  /* No overflow:hidden — that clipped the wash into a hard rectangle. */
}

/* Soft colour bloom that fades to transparent on every edge — no box. */
.trivia-hero::before {
  content: "";
  position: absolute;
  inset: -1.5rem -8% -0.5rem;
  z-index: -1;
  pointer-events: none;
  background:
    /* Darker centre wash for subtitle contrast — fades out, no hard border */
    radial-gradient(ellipse 58% 55% at 50% 42%, rgba(11, 28, 51, 0.1), rgba(11, 28, 51, 0.04) 45%, transparent 72%),
    radial-gradient(ellipse 55% 70% at 20% 35%, rgba(0, 163, 224, 0.24), transparent 70%),
    radial-gradient(ellipse 50% 65% at 82% 25%, rgba(232, 106, 58, 0.2), transparent 68%),
    radial-gradient(ellipse 45% 55% at 50% 85%, rgba(255, 214, 100, 0.14), transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 72% 78% at 50% 45%, #000 18%, transparent 78%);
  mask-image: radial-gradient(ellipse 72% 78% at 50% 45%, #000 18%, transparent 78%);
}

.trivia-hero-brand {
  margin: 0 0 0.55rem;
  font-size: clamp(1.55rem, 3.6vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  background: linear-gradient(105deg, #4DD0FF 12%, #00A3E0 48%, var(--orange) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hero-rise 0.55s ease both;
}

.trivia-hero-title {
  margin: 0 auto 0.4rem;
  max-width: 22ch;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink);
  opacity: 0.88;
  animation: hero-rise 0.55s ease 0.08s both;
}

.trivia-hero-title em {
  font-style: normal;
  font-weight: 800;
  color: var(--orange);
}

.trivia-hero-sub {
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 42ch;
  line-height: 1.45;
  font-weight: 500;
  animation: hero-rise 0.55s ease 0.14s both;
}

/* Mini “route” under the copy — cyan start → orange finish. */
.trivia-hero-route {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: min(220px, 55%);
  margin: 0.85rem auto 0;
  animation: hero-rise 0.55s ease 0.2s both;
}

.trivia-hero-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.22);
}

.trivia-hero-dot--end {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(232, 106, 58, 0.22);
}

.trivia-hero-line {
  position: relative;
  flex: 1;
  height: 3px;
  margin: 0 0.15rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), #4DC3F0, var(--orange));
  overflow: hidden;
}

.trivia-hero-line::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 28%;
  background: rgba(255, 255, 255, 0.65);
  border-radius: inherit;
  animation: route-pulse 1.8s ease-in-out infinite;
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes route-pulse {
  0% { transform: translateX(-40%); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateX(380%); opacity: 0; }
}

.quiz-progress {
  width: 100%;
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem 0.9rem;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.quiz-progress-kicker {
  display: block;
  margin: 0 0 0.2rem;
  color: #4DD0FF;
  font-weight: 700;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.quiz-progress-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.quiz-progress-left {
  min-width: 0;
}

.progress-label {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.progress-num {
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.quiz-progress-right {
  flex-shrink: 0;
  text-align: right;
}

.quiz-score-pill {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.quiz-score-pill .quiz-progress-kicker {
  color: var(--orange);
}

.quiz-score-line {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.quiz-score-line #quiz-score {
  font-variant-numeric: tabular-nums;
  color: var(--orange);
  font-size: 1.1em;
}

.quiz-progress-right.is-bump {
  transform: scale(1.04);
  transition: transform 0.2s ease;
}

.quiz-progress-right.is-bump #quiz-score {
  color: #FF8A5B;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.progress-fill {
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, var(--cyan), #4DC3F0, var(--orange));
  border-radius: 999px;
  transition: width 0.35s ease;
  box-shadow: 0 0 12px rgba(0, 163, 224, 0.35);
}

#question-card.is-swap {
  animation: fade-up 0.3s ease;
}

#question-card.card {
  max-width: 100%;
  padding: 1.75rem 2rem;
}

/* Topic label — orients the learner before they read the question. */
.question-category {
  display: inline-block;
  margin: 0 0 0.65rem;
  padding: 0;
  color: #4DD0FF;
  background: none;
  border: none;
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#quiz-question {
  margin: 0 0 1.15rem;
  /* Match option text size so question and answers read as one set (Quizlet-like). */
  font-size: 1.125rem;
  max-width: 48ch;
  line-height: 1.4;
  font-weight: 700;
  color: var(--ink);
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  background: rgba(0, 163, 224, 0.1);
  border: 2px solid rgba(0, 163, 224, 0.22);
  border-radius: 14px;
  padding: 0.95rem 1.15rem;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  min-height: 72px;
  line-height: 1.35;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s, filter 0.15s;
}

/* Distinct tinted tiles — avoid default green/red (reserved for correct/wrong) */
.options .option-btn:nth-child(1) {
  background: rgba(0, 163, 224, 0.14);
  border-color: rgba(0, 163, 224, 0.32);
}

.options .option-btn:nth-child(2) {
  background: rgba(242, 163, 58, 0.14);
  border-color: rgba(242, 163, 58, 0.35);
}

.options .option-btn:nth-child(3) {
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.35);
}

.options .option-btn:nth-child(4) {
  background: rgba(232, 106, 58, 0.14);
  border-color: rgba(232, 106, 58, 0.35);
}

.option-btn:hover:not(:disabled) {
  filter: brightness(1.25);
  box-shadow: 0 8px 20px rgba(0, 163, 224, 0.18);
  transform: translateY(-2px);
}

.option-btn.is-selected {
  filter: brightness(1.15);
  box-shadow: 0 0 0 3px rgba(77, 208, 255, 0.3);
  border-color: #4DD0FF;
}

.option-btn.is-selected .option-key {
  background: #4DD0FF;
  color: #06182C;
  border-color: transparent;
}

.option-btn:hover:not(:disabled) .option-key {
  background: #4DD0FF;
  color: #06182C;
  border-color: transparent;
}

.option-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.4);
}

.option-btn:disabled { cursor: default; }

.option-key {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
}

/* After answer: mute options that are neither correct nor wrong */
.options.is-revealed .option-btn:not(.is-correct):not(.is-wrong) {
  opacity: 0.45;
  filter: grayscale(0.35);
  transform: none;
  box-shadow: none;
}

/* Correct / wrong must beat nth-child pastel colours */
.options .option-btn.is-correct,
.option-btn.is-correct {
  background: #1FA971 !important;
  border-color: #0F5C3A !important;
  box-shadow: 0 0 0 3px rgba(31, 169, 113, 0.35) !important;
  color: #fff !important;
  filter: none !important;
  opacity: 1 !important;
  position: relative;
  padding-right: 5.5rem;
}

.options .option-btn.is-correct .option-key,
.option-btn.is-correct .option-key {
  background: #fff !important;
  color: #0F5C3A !important;
  border-color: transparent !important;
}

.options .option-btn.is-correct::after,
.option-btn.is-correct::after {
  content: "Correct";
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.options .option-btn.is-wrong,
.option-btn.is-wrong {
  background: #E23D3D !important;
  border-color: #8B1E1E !important;
  box-shadow: 0 0 0 3px rgba(226, 61, 61, 0.35) !important;
  color: #fff !important;
  filter: none !important;
  opacity: 1 !important;
  position: relative;
  padding-right: 6.5rem;
}

.options .option-btn.is-wrong .option-key,
.option-btn.is-wrong .option-key {
  background: #fff !important;
  color: #8B1E1E !important;
  border-color: transparent !important;
}

.options .option-btn.is-wrong::after,
.option-btn.is-wrong::after {
  content: "Your answer";
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.feedback {
  margin-top: 0.75rem;
  padding: 0.8rem 1.1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  border-left: 3px solid;
}

/* Verdict first, reasoning second — scannable at a glance. */
.feedback-status {
  margin: 0 0 0.2rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.feedback-detail {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 70ch;
}

.feedback.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok);
}

.feedback.bad {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad);
}

/* Transient "Checking your answer…" state while the LLM explanation is
   fetched — neutral so it doesn't imply a right/wrong result yet. */
.feedback.is-pending {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border-color: var(--border);
}

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.8rem;
}

.actions.center {
  justify-content: center;
  margin-top: 1.5rem;
}

/* The 5-question journey below the card — recaps state the progress bar already
   owns (see setRouteTotal/setRouteCurrent/setRouteResult in quiz.js), and doubles
   as content for the open road behind it instead of leaving it empty. */
.quiz-route {
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  margin: 1.4rem auto 0;
  padding: 0;
  width: min(100%, 420px);
}

.quiz-route-stop {
  flex: 1 1 0;
  display: flex;
  align-items: center;
}

.quiz-route-stop::before {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  background: rgba(125, 205, 255, 0.22);
  margin-right: -1px;
}

.quiz-route-stop:first-child::before {
  content: none;
}

.quiz-route-dot {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(13, 31, 56, 0.75);
  border: 1.5px solid rgba(125, 205, 255, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.quiz-route-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.3s ease;
}

/* The line segment leading INTO a stop is coloured once that stop is reached —
   travelled road behind you, open road ahead. */
.quiz-route-stop.is-current::before,
.quiz-route-stop.is-correct::before,
.quiz-route-stop.is-wrong::before {
  background: linear-gradient(90deg, var(--cyan), #4DD0FF);
}

.quiz-route-stop.is-current .quiz-route-dot {
  background: rgba(0, 163, 224, 0.22);
  border-color: #4DD0FF;
  box-shadow: 0 0 0 4px rgba(0, 163, 224, 0.16), 0 0 12px rgba(0, 163, 224, 0.4);
  transform: scale(1.12);
}

.quiz-route-stop.is-current .quiz-route-num {
  color: #fff;
}

.quiz-route-stop.is-correct .quiz-route-dot {
  background: var(--ok);
  border-color: var(--ok);
}

.quiz-route-stop.is-correct .quiz-route-num {
  color: #06301f;
}

.quiz-route-stop.is-wrong .quiz-route-dot {
  background: var(--bad);
  border-color: var(--bad);
}

.quiz-route-stop.is-wrong .quiz-route-num {
  color: #3a0a0a;
}

@media (max-width: 480px) {
  .quiz-route-dot {
    width: 26px;
    height: 26px;
  }
}

.result-card {
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
  padding: 2.25rem 1.5rem;
}

/* End-of-quiz result popup — performance achievement experience */
.lb-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(1.25rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
}

.lb-modal.hidden,
.lb-modal[hidden] {
  display: none !important;
}

.lb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 14, 0.7);
  backdrop-filter: blur(5px);
}

.lb-modal-panel.result-panel,
.result-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-height: min(88vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  padding: 1.35rem 1.2rem 1rem;
  /* Two soft brand-colour glows sit under the solid panel gradient — the same
     device used behind the trivia hero, so the modal doesn't read as a plain box. */
  background:
    radial-gradient(ellipse 60% 40% at 10% -5%, rgba(0, 163, 224, 0.22), transparent 60%),
    radial-gradient(ellipse 55% 45% at 105% 105%, rgba(232, 106, 58, 0.18), transparent 65%),
    linear-gradient(180deg, #0d1f38 0%, #0a1830 45%, #081328 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(125, 205, 255, 0.05) inset;
  animation: fade-up 0.35s ease both;
}

.lb-modal-panel.result-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--cyan), #4DC3F0, var(--orange), var(--cyan));
  background-size: 200% 100%;
  border-radius: 14px 14px 0 0;
  animation: result-bar-shimmer 3.5s linear infinite;
}

@keyframes result-bar-shimmer {
  to { background-position: -200% 0; }
}

.lb-modal-close {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  z-index: 2;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
}

.lb-modal-close:hover {
  color: var(--ink);
  background: rgba(0, 163, 224, 0.1);
}

body.lb-modal-open {
  overflow: hidden;
}

.result-step {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-step-board {
  gap: 0.65rem;
}

.result-step.hidden {
  display: none !important;
}

.result-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.result-header {
  padding-bottom: 0.5rem;
}

.result-score-label {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.result-score {
  margin: 0 0 0.35rem;
  font-family: var(--mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.result-score .score-den {
  font-size: 0.42em;
  font-weight: 600;
  color: var(--muted);
}

.result-message {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font);
  line-height: 1.4;
}

.result-loading-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.result-loading-note.is-error {
  color: var(--bad);
  background: var(--bad-bg);
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
}

.btn-text {
  background: transparent;
  color: var(--muted);
  border: none;
  box-shadow: none;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

.btn-text:hover:not(:disabled) {
  color: var(--cyan);
  background: transparent;
}

.result-footer {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  border-top: 1px solid rgba(0, 163, 224, 0.14);
  margin-top: 0;
  padding-top: 0.85rem;
}

.result-footer-compact .btn {
  min-height: 48px;
  padding: 0.78rem 1.35rem;
  font-size: 1rem;
}

/* Primary CTA — warm, inviting, rounded pill */
#btn-play-again-board,
#btn-play-again {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.72rem 1.8rem;
  background: linear-gradient(135deg, #FF6B3D 0%, var(--orange) 50%, #D45A2C 100%);
  background-color: transparent; /* kill .btn-secondary panel fill behind pill */
  box-shadow:
    0 6px 16px rgba(232, 106, 58, 0.3),
    0 2px 4px rgba(11, 28, 51, 0.1);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#btn-play-again-board:hover:not(:disabled),
#btn-play-again:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 10px 22px rgba(232, 106, 58, 0.36),
    0 3px 6px rgba(11, 28, 51, 0.12);
}

#btn-play-again-board:focus-visible,
#btn-play-again:focus-visible {
  outline: 3px solid rgba(232, 106, 58, 0.35);
  outline-offset: 2px;
}

/* Secondary — subtle pill, no heavy border */
.result-footer .btn-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  border: none;
  border-radius: 999px;
  background: transparent;
  padding: 0.72rem 1.4rem;
  transition: color 0.15s ease, background 0.15s ease;
}

.result-footer .btn-text:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(11, 28, 51, 0.06);
}

/* ── Result modal: bold celebratory layout ── */
.result-step-board {
  gap: 0.65rem;
}

/* Score hero — transparent, compact, eye-catching */
.result-hero {
  padding: 0.6rem 0 0.5rem;
  text-align: center;
  background: transparent;
  position: relative;
}

.result-hero::before {
  content: "";
  position: absolute;
  inset: -1rem -2rem;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 65% at 50% 40%, rgba(232, 106, 58, 0.12), transparent 70%);
}

.result-hero::after {
  display: none;
}

.result-hero-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

/* A donut of the score's own colour fills in around the number — the score
   isn't just printed, it's visibly "how much of the ring" too. */
.result-hero-ring-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0.15rem auto 0.15rem;
  display: grid;
  place-items: center;
}

.result-hero-ring {
  --score-pct: 0;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    #4DD0FF calc(var(--score-pct) * 1%),
    rgba(255, 255, 255, 0.07) 0
  );
  -webkit-mask: radial-gradient(closest-side, transparent 74%, #000 75%);
  mask: radial-gradient(closest-side, transparent 74%, #000 75%);
  transition: background 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 10px rgba(0, 163, 224, 0.35));
}

.result-hero-score {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.05rem;
  line-height: 1;
}

.result-hero-num {
  font-family: var(--mono);
  font-size: 3.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(150deg, var(--orange) 20%, #FF6B3D 60%, #D44A1A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 6px rgba(232, 106, 58, 0.3));
  animation: lb-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.result-hero-den {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  padding-bottom: 0.32rem;
  opacity: 0.4;
}

.result-hero-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: transparent;
  background: linear-gradient(90deg, var(--cyan), var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
}

/* Rank + insight row */
.result-rank-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(232, 106, 58, 0.14), rgba(232, 106, 58, 0.04));
  border: 1px solid rgba(232, 106, 58, 0.28);
  box-shadow: 0 4px 14px rgba(232, 106, 58, 0.1);
}

.result-rank-badge {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.75rem 0.35rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 106, 58, 0.35);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.result-rank-badge-icon {
  color: var(--orange);
  margin-bottom: 0.05rem;
}

.result-rank-badge-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #FFB088;
}

.result-rank-badge-value {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4DD0FF, #00A3E0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result-rank-badge.tier-gold {
  background: linear-gradient(135deg, rgba(255, 209, 77, 0.2), rgba(255, 209, 77, 0.05));
  border-color: rgba(255, 209, 77, 0.5);
}
.result-rank-badge.tier-gold .result-rank-badge-icon,
.result-rank-badge.tier-gold .result-rank-badge-label { color: #FFD966; }
.result-rank-badge.tier-gold .result-rank-badge-value { color: #FFED8A; background: none; -webkit-background-clip: unset; background-clip: unset; }

.result-rank-badge.tier-silver {
  background: linear-gradient(135deg, rgba(200, 212, 224, 0.18), rgba(200, 212, 224, 0.05));
  border-color: rgba(200, 212, 224, 0.4);
}
.result-rank-badge.tier-silver .result-rank-badge-icon,
.result-rank-badge.tier-silver .result-rank-badge-label { color: #C7D2DC; }
.result-rank-badge.tier-silver .result-rank-badge-value { color: #E4EAF0; background: none; -webkit-background-clip: unset; background-clip: unset; }

.result-rank-badge.tier-bronze {
  background: linear-gradient(135deg, rgba(224, 164, 106, 0.2), rgba(224, 164, 106, 0.05));
  border-color: rgba(224, 164, 106, 0.45);
}
.result-rank-badge.tier-bronze .result-rank-badge-icon,
.result-rank-badge.tier-bronze .result-rank-badge-label { color: #E0A46A; }
.result-rank-badge.tier-bronze .result-rank-badge-value { color: #F0C79A; background: none; -webkit-background-clip: unset; background-clip: unset; }

.result-rank-insight {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
  text-align: left;
}

.result-rank-insight .insight-pct {
  font-weight: 800;
  font-size: 1.02em;
  color: var(--orange);
}

.result-rank-insight .insight-count {
  font-weight: 800;
  font-size: 1.02em;
  color: var(--cyan);
}

/* Keep old class names working in case JS references them */
.result-overall-kicker { display: none; }
.result-quick-title, .result-quick-sub,
.result-quick-stats, .result-quick-chip { display: none; }

.result-quick-chart {
  margin-top: 0.15rem;
}

.result-quick-chart .lb-board-heading {
  margin-bottom: 0.3rem;
}

.result-quick-chart .perf-chart {
  max-height: 7.4rem;
}

.perf-chart-card {
  margin: 0;
  text-align: left;
  padding: 0.55rem 0.65rem 0.35rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 163, 224, 0.16);
  background: linear-gradient(180deg, rgba(0, 163, 224, 0.05), rgba(13, 31, 56, 0.22));
}

.lb-board-heading {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4DD0FF;
}

.perf-chart-wrap {
  border: 1px solid rgba(0, 163, 224, 0.18);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 163, 224, 0.06) 0%, rgba(4, 10, 21, 0.45) 58%);
  padding: 0.2rem 0.15rem 0;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.perf-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 9.25rem;
}

.perf-grid {
  stroke: rgba(125, 205, 255, 0.14);
  stroke-width: 1;
}

.perf-axis-line {
  stroke: rgba(125, 205, 255, 0.28);
  stroke-width: 1.25;
}

.perf-axis,
.perf-axis-caption {
  fill: var(--muted);
  font-size: 8px;
  font-family: var(--mono);
}

.perf-area {
  fill: url(#perfAreaGrad);
  opacity: 0.9;
}

.perf-line {
  stroke: url(#perfLineGrad);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(0, 163, 224, 0.55));
}

.perf-dot {
  fill: #7EB8D4;
  stroke: #fff;
  stroke-width: 1.25;
}

.perf-you-guide {
  stroke: rgba(232, 106, 58, 0.35);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}

.perf-you-ring {
  fill: rgba(232, 106, 58, 0.12);
  stroke: var(--orange);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: perf-you-pulse 2.2s ease-in-out infinite;
}

@keyframes perf-you-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.18); }
}

.perf-you-dot {
  fill: var(--orange);
  stroke: #fff;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 5px rgba(232, 106, 58, 0.7));
}

.perf-you-label {
  fill: var(--orange);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font);
}

@keyframes lb-pop {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

/* JomTanya styles live in css/tanya.css. */

/* Sits in normal flow rather than fixed — a pinned footer permanently ate
   ~50px of every screen, which is what pushed the quiz's Next button out
   of view and forced the tagline to be hidden on phones. */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 0.95rem 0 1.15rem;
  margin-top: auto;
  transition: background-color 0.4s ease, border-color 0.4s ease, padding-block 0.4s ease;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
  transition: color 0.4s ease;
}

.footer-tagline {
  margin: 0;
  max-width: 62ch;
  line-height: 1.5;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  margin: -0.4rem -0.7rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--cyan);
  background: rgba(0, 163, 224, 0.1);
  outline: none;
}

.ext-icon {
  flex-shrink: 0;
  opacity: 0.75;
}

/* Desktop — 1440px target, 1200px content */
@media (min-width: 1025px) {
  .shell {
    width: min(100% - 3rem, var(--shell));
  }

  .site-nav {
    gap: 0.35rem;
  }

  .site-nav a {
    font-size: 0.92rem;
    padding: 0.45rem 0.9rem;
  }

  .home {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  /* Content-sized — do not force full-viewport empty space */
  #quiz-play.panel {
    padding-top: 0.4rem;
    padding-bottom: 0.65rem;
  }

  .quiz-header {
    margin-bottom: 0.55rem;
  }

  .trivia-hero {
    padding: 0.05rem 0 0.35rem;
  }

  .trivia-hero-brand {
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    margin-bottom: 0.35rem;
  }

  .trivia-hero-title {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
  }

  .trivia-hero-sub {
    font-size: 0.8rem;
  }

  .trivia-hero-route {
    margin-top: 0.45rem;
    width: min(200px, 48%);
  }

  .quiz-progress {
    margin-top: 0.4rem;
    padding: 0.55rem 0.85rem 0.6rem;
  }

  .quiz-progress-row {
    margin-bottom: 0.4rem;
  }

  .progress-label,
  .quiz-score-line {
    font-size: 0.95rem;
  }

  .progress-track {
    height: 8px;
  }

  #question-card.card {
    padding: 1.05rem 1.25rem 0.9rem;
  }

  #quiz-question {
    font-size: 1.02rem;
    margin-bottom: 0.75rem;
  }

  .question-category {
    margin-bottom: 0.4rem;
  }

  .options {
    gap: 0.55rem;
  }

  .option-btn {
    min-height: 54px;
    padding: 0.55rem 0.85rem;
    font-size: 1rem;
  }

  .option-key {
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
  }

  .feedback {
    padding: 0.55rem 0.7rem;
    margin-top: 0.55rem;
  }

  .actions {
    margin-top: 0.65rem;
    justify-content: stretch;
  }

  .actions .btn {
    width: 100%;
    padding-top: 0.68rem;
    padding-bottom: 0.68rem;
    font-size: 0.95rem;
  }

  .home-copy {
    max-width: 38rem;
  }

  h1 {
    font-size: clamp(2.2rem, 3vw, 2.85rem);
    max-width: 16ch;
  }

  .subtitle {
    font-size: 1.08rem;
    max-width: 42ch;
    margin-bottom: 1.75rem;
  }
}

/* Short laptop heights: trim vertical spacing further so key UI stays visible. */
@media (min-width: 1025px) and (max-height: 900px) {
  .trivia-hero {
    padding-bottom: 0.28rem;
  }

  .trivia-hero-brand {
    font-size: clamp(1.25rem, 2.2vw, 1.55rem);
    margin-bottom: 0.28rem;
  }

  .trivia-hero-title {
    font-size: 1.05rem;
  }

  .trivia-hero-route {
    margin-top: 0.32rem;
  }

  .quiz-header {
    margin-bottom: 0.4rem;
  }

  .quiz-progress {
    margin-top: 0.32rem;
    padding-top: 0.45rem;
    padding-bottom: 0.5rem;
  }

  #question-card.card {
    padding-top: 0.85rem;
    padding-bottom: 0.7rem;
  }

  #quiz-question {
    margin-bottom: 0.6rem;
  }

  .option-btn {
    min-height: 48px;
    padding: 0.45rem 0.75rem;
  }

  .feedback {
    margin-top: 0.45rem;
    padding: 0.45rem 0.65rem;
  }

  .actions {
    margin-top: 0.5rem;
  }
}

/* Tablet — tighten spacing */
@media (max-width: 1024px) and (min-width: 769px) {
  .shell {
    width: min(100% - 2rem, 960px);
  }

  #quiz-play.panel {
    padding-top: 0.75rem;
  }

  .trivia-hero {
    padding-bottom: 0.65rem;
  }

  #question-card.card {
    padding: 1.5rem 1.75rem;
  }

  #quiz-question {
    font-size: 1.125rem;
  }

  .option-btn {
    min-height: 64px;
    font-size: 1.125rem;
  }
}

/* Narrow tablet / large phone — single column answers */
@media (max-width: 768px) {
  .options {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .option-btn {
    min-height: 56px;
  }

  .quiz-progress-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  /* Stacked, so right-alignment would orphan the value from its label. */
  .quiz-progress-right {
    text-align: left;
  }

  #question-card.card {
    padding: 1.25rem 1.15rem;
  }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }


  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 52px;
    background: #071427;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem;
    box-shadow: var(--shadow);
  }

  .site-nav.open { display: flex; }

  .site-nav a {
    padding: 0.85rem 1rem;
    min-height: 44px;
  }

  .header-inner { position: relative; }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn,
  .actions .btn {
    width: 100%;
  }

  .actions { justify-content: stretch; }

  .result-footer,
  .result-footer-compact {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.6rem;
    justify-content: center;
    align-items: center;
  }

  .result-footer .btn,
  .result-footer-compact .btn {
    width: auto;
  }

  #btn-play-again,
  #btn-play-again-board {
    width: auto;
    min-height: 48px;
    box-shadow:
      0 4px 12px rgba(232, 106, 58, 0.26),
      0 1px 3px rgba(11, 28, 51, 0.08);
  }

  .result-footer .btn-text {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
  }

  .result-hero-num {
    font-size: 2.8rem;
  }

  .perf-chart {
    max-height: 6rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
}

/* ── Pre-quiz briefing ────────────────────────────────────────────────
   Brand first, then interactive MRC highlights, then CTA. */
.quiz-intro {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 190px);
  padding-top: 1.5rem;
  padding-bottom: 1.75rem;
}

.quiz-intro-inner {
  position: relative;
  width: min(100%, 540px);
  text-align: center;
  padding: 1.25rem 0.5rem 1rem;
}

.quiz-intro-inner::before {
  content: "";
  position: absolute;
  inset: -1.25rem -8% auto;
  height: 55%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 58% 55% at 50% 40%, rgba(11, 28, 51, 0.1), rgba(11, 28, 51, 0.04) 45%, transparent 72%),
    radial-gradient(ellipse 55% 80% at 20% 30%, rgba(0, 163, 224, 0.22), transparent 70%),
    radial-gradient(ellipse 50% 70% at 82% 20%, rgba(232, 106, 58, 0.18), transparent 68%);
  -webkit-mask-image: radial-gradient(ellipse 72% 80% at 50% 40%, #000 15%, transparent 78%);
  mask-image: radial-gradient(ellipse 72% 80% at 50% 40%, #000 15%, transparent 78%);
}

.quiz-intro-hero {
  animation: rise-in 0.45s ease both;
}

.quiz-intro-hero .trivia-hero-brand {
  margin-bottom: 0.55rem;
  font-size: clamp(1.65rem, 3.8vw, 2.2rem);
}

.quiz-intro-hero .trivia-hero-title {
  margin: 0 auto 0.45rem;
  max-width: 18ch;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
}

.quiz-intro-sub {
  margin: 0 auto;
  max-width: 34ch;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 500;
}

.quiz-intro-hero .trivia-hero-route {
  margin: 0.95rem auto 1.25rem;
}

.quiz-intro-brief {
  text-align: left;
  margin: 0 0 1.4rem;
  padding-top: 1.05rem;
  border-top: 1px solid rgba(11, 28, 51, 0.1);
  animation: rise-in 0.45s ease 0.08s both;
}

.quiz-intro-brief-copy {
  margin: 0 0 0.9rem;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--ink);
  opacity: 0.85;
}

.quiz-intro-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.quiz-intro-point {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid transparent;
  /* Solid enough that the ambient city behind it (quiz runs on the same 3D
     backdrop as home/Tanya now) doesn't compete with the text on top. */
  background: rgba(13, 31, 56, 0.6);
  cursor: default;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
  animation: rise-in 0.4s ease both;
}

.quiz-intro-point:nth-child(1) {
  animation-delay: 0.14s;
  border-color: rgba(0, 163, 224, 0.22);
}

.quiz-intro-point:nth-child(2) {
  animation-delay: 0.2s;
  border-color: rgba(232, 106, 58, 0.22);
}

.quiz-intro-point:nth-child(3) {
  animation-delay: 0.26s;
  border-color: rgba(31, 169, 113, 0.22);
}

.quiz-intro-point:hover,
.quiz-intro-point:focus-visible {
  transform: translateY(-2px);
  outline: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.quiz-intro-point:nth-child(1):hover,
.quiz-intro-point:nth-child(1):focus-visible {
  background: rgba(0, 163, 224, 0.12);
  border-color: rgba(0, 163, 224, 0.45);
}

.quiz-intro-point:nth-child(2):hover,
.quiz-intro-point:nth-child(2):focus-visible {
  background: rgba(232, 106, 58, 0.12);
  border-color: rgba(232, 106, 58, 0.45);
}

.quiz-intro-point:nth-child(3):hover,
.quiz-intro-point:nth-child(3):focus-visible {
  background: rgba(62, 224, 161, 0.12);
  border-color: rgba(62, 224, 161, 0.45);
}

.quiz-intro-point-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 2rem;
  color: var(--ink);
  opacity: 0.55;
}

.quiz-intro-point:nth-child(1) .quiz-intro-point-num { color: #4DD0FF; opacity: 1; }
.quiz-intro-point:nth-child(2) .quiz-intro-point-num { color: var(--orange); opacity: 1; }
.quiz-intro-point:nth-child(3) .quiz-intro-point-num { color: var(--ok-deep); opacity: 1; }

.quiz-intro-point-body {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.quiz-intro-point-body strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.quiz-intro-point-body span {
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--muted);
}

.quiz-intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  animation: rise-in 0.45s ease 0.28s both;
}

.quiz-intro-actions .btn-primary {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.85rem;
  font-weight: 700;
  background: linear-gradient(135deg, #FF6B3D 0%, var(--orange) 50%, #D45A2C 100%);
  box-shadow: 0 6px 16px rgba(232, 106, 58, 0.28);
  animation: intro-cta-pulse 2.4s ease-in-out 0.8s infinite;
}

.quiz-intro-actions .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(232, 106, 58, 0.34);
  animation: none;
}

.quiz-intro-actions .btn-text {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 0.7rem 1rem;
}

.quiz-intro-actions .btn-text:hover:not(:disabled) {
  color: var(--ink);
  background: transparent;
}

@keyframes intro-cta-pulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(232, 106, 58, 0.28); }
  50% { box-shadow: 0 8px 22px rgba(232, 106, 58, 0.4); }
}

@media (max-height: 500px) {
  .lb-modal-panel.result-panel,
  .result-panel {
    max-height: 92vh;
    padding: 1rem 1rem 0.85rem;
  }

  .result-hero-num {
    font-size: 2.4rem;
  }

  .perf-chart-card {
    padding-top: 0.45rem;
    padding-bottom: 0.35rem;
  }
}

@media (max-width: 720px) {
  .quiz-intro {
    min-height: calc(100vh - 210px);
    align-items: flex-start;
  }

  .quiz-intro-actions .btn-primary {
    width: 100%;
  }
}

/* ── Quiz motion ───────────────────────────────────────────────────────
   Every animation below moves only transform/opacity, so nothing reflows
   and the card keeps its 0px-shift behaviour when an answer is revealed.
   Entrance animations use fill-mode `backwards` (not `forwards`) — a
   filled-forwards animation would keep owning `transform` after it ends
   and silently kill the hover lift. */

@keyframes option-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Activates the per-option animation-delay quiz.js already sets. */
.option-btn {
  animation: option-enter 0.34s ease backwards;
}

@keyframes answer-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes answer-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  45%      { transform: translateX(4px); }
  70%      { transform: translateX(-2px); }
}

.option-btn.is-correct {
  animation: answer-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.option-btn.is-wrong {
  animation: answer-shake 0.42s ease;
}

/* Dim the un-picked options so the result reads instantly. */
.options.is-revealed .option-btn:not(.is-correct):not(.is-wrong) {
  transition: opacity 0.3s ease, filter 0.3s ease;
}

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

.feedback.ok,
.feedback.bad {
  animation: rise-in 0.34s ease backwards;
}

.feedback-status {
  animation: rise-in 0.3s ease 0.04s backwards;
}

.feedback-detail {
  animation: rise-in 0.3s ease 0.1s backwards;
}

#btn-next:not(.hidden) {
  animation: rise-in 0.32s ease 0.12s backwards;
}

/* Question swap — inner stagger under the card's existing fade. */
#question-card.is-swap .question-category {
  animation: rise-in 0.32s ease 0.02s backwards;
}

#question-card.is-swap #quiz-question {
  animation: rise-in 0.34s ease 0.06s backwards;
}

/* One-shot sheen when the progress bar advances (class toggled in JS). */
.progress-fill {
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: translateX(-100%);
}

.progress-fill.is-advancing::after {
  animation: progress-sheen 0.75s ease;
}

@keyframes progress-sheen {
  to { transform: translateX(100%); }
}

/* Score reacts when a point lands. */
.quiz-progress-right.is-bump #quiz-score {
  animation: answer-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
}

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

  .interactive-canvas,
  .cursor-glow {
    display: none !important;
  }
}

/* Signed-in account and sign-out in the header (main.js fills them once the sign-in gate opens). */
.site-nav .nav-account[hidden], .site-nav .nav-signout[hidden] { display: none; }
.site-nav .nav-account { align-self: center; line-height: 1.2; font-size: 0.8rem; color: rgba(207, 223, 240, 0.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26ch; }
.site-nav .nav-account strong { color: rgba(234, 244, 255, 0.95); font-weight: 600; }
.site-nav .nav-signout { font: inherit; font-size: 0.8rem; font-weight: 600; color: rgba(234, 244, 255, 0.9); background: transparent; border: 1px solid rgba(160, 190, 225, 0.35); border-radius: 999px; padding: 0.35rem 0.85rem; cursor: pointer; }
.site-nav .nav-signout:hover { border-color: rgba(160, 190, 225, 0.7); }
.site-nav .nav-signout:focus-visible { outline: 2px solid #4dd0ff; outline-offset: 2px; }

/* ─── Guest pass (exhibition visitors: email → one-time code → one-hour session) ───── */
.login-guest { margin-top: 1.5rem; font-size: 0.95rem; }
.login-guest[hidden] { display: none; }
.login-guest a, .guest-fineprint a { color: var(--cyan); font-weight: 600; }
.guest-form { display: grid; gap: 0.75rem; max-width: 26rem; margin-top: 0.5rem; }
.guest-form[hidden] { display: none; }
.guest-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.guest-input {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.guest-input::placeholder { color: rgba(146, 167, 190, 0.55); }
.guest-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.2); }
.guest-code-input {
  font-family: var(--mono);
  font-size: 1.9rem;
  letter-spacing: 0.45em;
  text-align: center;
  padding: 0.65rem 0.5rem 0.65rem 0.95em;
}
.guest-error { margin: 0; color: var(--bad); font-size: 0.92rem; }
.guest-error[hidden], .guest-notice[hidden], .guest-fineprint[hidden], .guest-note[hidden] { display: none; }
.guest-notice {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  background: rgba(0, 163, 224, 0.14);
  color: var(--ink);
  max-width: 26rem;
}
.guest-notice[data-tone="error"] { background: var(--bad-bg); color: var(--bad); }
.guest-sent { margin: 0; color: var(--muted); font-size: 0.98rem; }
.guest-sent strong { color: var(--ink); word-break: break-all; }
.guest-fineprint { margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--muted); }
.guest-fineprint .btn-text { font-size: inherit; padding: 0; }
.site-nav .nav-account.is-guest { max-width: 44ch; }
.site-nav .nav-guest-time { margin-left: 0.45rem; color: var(--ok); font-variant-numeric: tabular-nums; }
.site-nav .nav-guest-time[hidden] { display: none; }

/* ─── Printable QR sign (guest-qr.html) ─────────────────────────────────────────── */
body.qr-page { display: block; background: #e9eef4; color: #0B1C33; min-height: 100vh; padding: 1.5rem 1rem; }
.qr-sheet {
  display: block; /* <main> is a flex column elsewhere; here its children must not stretch */
  max-width: 560px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(11, 28, 51, 0.15);
  text-align: center;
}
.qr-band { background: var(--navy); padding: 1.25rem; }
.qr-band img { display: inline-block; height: 39px; width: auto; }
.qr-sheet h1 { color: #0B1C33; margin: 1.5rem 1.5rem 0.4rem; }
.qr-sheet h1 em { color: #bf4a1c; font-style: normal; }
.qr-lede { margin: 0 2rem 1.25rem; color: #3b4b61; font-size: 1.1rem; }
.qr-frame { display: inline-block; padding: 0.5rem; border: 2px solid #0B1C33; border-radius: 12px; }
.qr-frame[hidden] { display: none; }
.qr-frame img { display: block; width: 320px; max-width: 72vw; height: auto; }
.qr-url { font-family: var(--mono); font-size: 0.85rem; color: #3b4b61; word-break: break-all; margin: 1rem 2rem 0; }
.qr-note { margin: 1rem 2rem; color: #bf4a1c; font-weight: 600; }
.qr-note[hidden] { display: none; }
.qr-steps { text-align: left; display: inline-block; margin: 1.25rem auto 1.5rem; padding-left: 1.25rem; color: #0B1C33; font-size: 1.05rem; }
.qr-steps li { margin: 0.25rem 0; }
.qr-print { display: block; margin: 0 auto 1.75rem; }
.qr-print[hidden] { display: none; }
@media print {
  body.qr-page { background: #ffffff; padding: 0; }
  .qr-sheet { box-shadow: none; border-radius: 0; max-width: none; }
  .qr-band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qr-print { display: none; }
}
