/* ============================================================
   Harry Potter Dictionary — magical theme
   ============================================================ */

:root {
  --ink: #f3e8c7;
  --ink-dim: #c9b88f;
  --ink-muted: #8a7a55;
  --parchment: #f3e3b6;
  --parchment-dark: #d8c085;
  --gold: #d4af37;
  --gold-bright: #f6d96a;
  --crimson: #7a0a0a;
  --emerald: #0b4a2d;
  --midnight: #0a0f1f;
  --midnight-2: #141a2e;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  --font-display: 'Cinzel', 'Cormorant Garamond', serif;
  --font-serif: 'Cormorant Garamond', 'Georgia', serif;
  --font-hand: 'IM Fell English SC', 'Cinzel', serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-serif);
  background: radial-gradient(ellipse at top, #1a2140 0%, #0a0f1f 55%, #05070f 100%);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2'><circle cx='1' cy='1' r='0.6' fill='%23ffffff' opacity='0.04'/></svg>");
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 0;
}

/* floating twinkling stars layer */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.sky .star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff6cc;
  border-radius: 50%;
  opacity: 0.8;
  box-shadow: 0 0 6px 1px #fff6cc;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.2); }
}

/* floating candles */
.candle {
  position: fixed;
  width: 6px;
  height: 22px;
  background: linear-gradient(180deg, #fff2bf 0%, #e6c97a 100%);
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 0 1px #3c2a10 inset;
  animation: float 6s ease-in-out infinite;
}

.candle::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  width: 10px;
  height: 16px;
  margin-left: -5px;
  background: radial-gradient(ellipse at center, #fff4a8 0%, #ffae33 55%, rgba(255,140,0,0) 75%);
  border-radius: 50%;
  filter: blur(1px);
  animation: flame 1.4s ease-in-out infinite alternate;
}

.candle::after {
  content: '';
  position: absolute;
  top: -22px;
  left: 50%;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  background: radial-gradient(circle, rgba(255, 200, 80, 0.28) 0%, rgba(255, 200, 80, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

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

@keyframes flame {
  0%   { transform: translateX(-50%) scale(0.95, 1);   opacity: 0.9; }
  100% { transform: translateX(-50%) scale(1.05, 1.1); opacity: 1;   }
}

/* ---------- containers ---------- */

.page {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px 16px;
}

.page.quiz-page {
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 12px 20px 14px;
  overflow: hidden;
}

.brand {
  text-align: center;
  margin-bottom: 18px;
}

.brand .crest {
  display: inline-block;
  width: 56px;
  height: 56px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  line-height: 52px;
  font-family: var(--font-display);
  color: var(--gold-bright);
  font-size: 24px;
  margin-bottom: 6px;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15), 0 0 24px rgba(212, 175, 55, 0.35);
  background: radial-gradient(circle, rgba(212,175,55,0.18) 0%, transparent 70%);
}

h1.title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: clamp(28px, 4.2vw, 46px);
  color: var(--gold-bright);
  margin: 0 0 4px;
  text-shadow: 0 2px 0 #000, 0 0 24px rgba(246, 217, 106, 0.25);
}

.subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-dim);
  font-size: clamp(16px, 2vw, 20px);
  margin: 0;
}

/* ---------- book shelf ---------- */

.shelf-label {
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.25em;
  color: var(--ink-dim);
  font-size: 14px;
  margin: 12px 0 10px;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  padding: 22px 22px 30px;
  background: linear-gradient(180deg, rgba(12, 8, 4, 0.35) 0%, rgba(30, 18, 8, 0.55) 100%);
  border-radius: 6px;
  border-top: 1px solid rgba(212, 175, 55, 0.18);
  border-bottom: 6px solid #2a1a0a;
  box-shadow: inset 0 -18px 30px rgba(0, 0, 0, 0.6), var(--shadow);
  position: relative;
}

.shelf::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -14px;
  height: 8px;
  background: linear-gradient(180deg, #1b0f06 0%, #0a0603 100%);
  border-radius: 0 0 2px 2px;
}

.book {
  position: relative;
  border-radius: 6px 8px 3px 3px;
  padding: 16px 14px 14px;
  min-height: clamp(150px, 22vh, 220px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  color: #fff3cf;
  background: linear-gradient(160deg, var(--spine-1, #6b1111) 0%, var(--spine-2, #3a0707) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 150, 0.12),
    inset 6px 0 0 rgba(0, 0, 0, 0.35),
    inset -3px 0 0 rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.4);
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), box-shadow 0.35s;
  font-family: var(--font-display);
  text-align: center;
}

.book:hover {
  transform: translateY(-10px) rotate(-0.5deg);
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 150, 0.2),
    inset 6px 0 0 rgba(0, 0, 0, 0.35),
    0 22px 34px rgba(0, 0, 0, 0.75),
    0 0 20px rgba(246, 217, 106, 0.25);
}

.book.book-1 { --spine-1: #7a0a0a; --spine-2: #2c0404; }
.book.book-2 { --spine-1: #0f3e2a; --spine-2: #051a11; }
.book.book-3 { --spine-1: #0a2a55; --spine-2: #041024; }
.book.book-4 { --spine-1: #3a1f5a; --spine-2: #140822; }
.book.book-5 { --spine-1: #5a3a06; --spine-2: #1f1402; }
.book.book-6 { --spine-1: #2a5a4f; --spine-2: #0a1f1b; }
.book.book-7 { --spine-1: #4d0a30; --spine-2: #1a030f; }

.book .book-number {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--gold-bright);
  opacity: 0.85;
}

.book .book-title {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0.08em;
  color: #fff3cf;
  padding: 18px 6px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book .book-foot {
  font-family: var(--font-serif);
  font-size: 12px;
  color: rgba(255, 243, 207, 0.7);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.book.locked {
  filter: grayscale(0.6) brightness(0.65);
  cursor: not-allowed;
}

.book.locked:hover {
  transform: none;
}

.book.locked .book-foot::after {
  content: ' 🔒';
}

.book.preview-locked {
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 150, 0.16),
    inset 6px 0 0 rgba(0, 0, 0, 0.35),
    inset -3px 0 0 rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(246, 217, 106, 0.16);
}

.book.preview-locked .book-foot::after {
  content: ' 🔐';
}

/* ---------- quiz ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  font-size: 12px;
  justify-content: space-between;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-bright) 100%);
  box-shadow: 0 0 12px rgba(246, 217, 106, 0.45);
  transition: width 0.6s cubic-bezier(.2, .8, .2, 1);
}

.scoreboard {
  font-family: var(--font-display);
  color: var(--gold-bright);
  letter-spacing: 0.15em;
}

.card {
  background:
    linear-gradient(180deg, rgba(15, 10, 4, 0.75) 0%, rgba(8, 5, 2, 0.85) 100%);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.08) inset,
    var(--shadow);
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  position: relative;
  flex: 1;
  min-height: 0;
}

@media (max-width: 860px) {
  .card { grid-template-columns: 1fr; }
}

.illo {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  width: auto;
  height: auto;
  max-height: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  align-self: center;
  justify-self: center;
  min-height: 0;
  position: relative;
}

.illo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.illo-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  font-size: 12px;
}

.quiz-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-height: 0;
}

.prompt {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-dim);
  margin: 0 0 4px;
  font-size: clamp(15px, 1.3vw, 18px);
}

.word {
  font-family: var(--font-display);
  color: var(--gold-bright);
  font-size: clamp(28px, 3.2vw, 40px);
  letter-spacing: 0.06em;
  margin: 0 0 2px;
  line-height: 1.05;
  text-shadow: 0 2px 0 #000, 0 0 20px rgba(246, 217, 106, 0.22);
}

.word-meta {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  text-align: left;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: linear-gradient(180deg, rgba(25, 16, 6, 0.85) 0%, rgba(12, 7, 2, 0.9) 100%);
  color: var(--ink);
  padding: 12px 16px 12px 48px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.35;
  position: relative;
  transition: border-color 0.2s, transform 0.15s, background 0.25s;
}

.option::before {
  content: attr(data-letter);
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.08);
}

.option:hover:not(.disabled) {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(40, 26, 10, 0.9) 0%, rgba(20, 12, 4, 0.95) 100%);
  transform: translateY(-1px);
}

.option.correct {
  border-color: #5cdc8a;
  background: linear-gradient(180deg, rgba(12, 60, 32, 0.9), rgba(6, 34, 18, 0.95));
  box-shadow: 0 0 0 1px rgba(92, 220, 138, 0.3), 0 0 18px rgba(92, 220, 138, 0.3);
}

.option.incorrect {
  border-color: #e06060;
  background: linear-gradient(180deg, rgba(80, 14, 14, 0.9), rgba(40, 6, 6, 0.95));
  box-shadow: 0 0 0 1px rgba(224, 96, 96, 0.3), 0 0 18px rgba(224, 96, 96, 0.25);
}

.option.disabled {
  cursor: default;
  opacity: 0.85;
}

.feedback {
  min-height: 28px;
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  font-size: 14px;
  color: var(--ink-dim);
  transition: color 0.3s;
}

.feedback.correct { color: #9ff0b8; }
.feedback.incorrect { color: #ff9090; }

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.btn {
  font-family: var(--font-display);
  letter-spacing: 0.15em;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: linear-gradient(180deg, #3a2508 0%, #1a0f03 100%);
  color: var(--gold-bright);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(246, 217, 106, 0.25);
  background: linear-gradient(180deg, #4a2f0c 0%, #23150a 100%);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(212, 175, 55, 0.4);
  color: var(--ink-dim);
}

/* ---------- FX layers ---------- */

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

.dust-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.dust {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff5c4 0%, rgba(255,210,120,0) 70%);
  box-shadow: 0 0 6px #f6d96a;
  opacity: 0;
}

/* ---------- illustration glow ---------- */

.illo-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 8px;
  box-shadow: 0 0 0 0 rgba(246, 217, 106, 0);
  transition: box-shadow 0.6s ease;
}

.illo-glow.correct {
  box-shadow: inset 0 0 60px rgba(92, 220, 138, 0.55), 0 0 40px rgba(92, 220, 138, 0.35);
}
.illo-glow.incorrect {
  box-shadow: inset 0 0 60px rgba(224, 96, 96, 0.55), 0 0 40px rgba(224, 96, 96, 0.35);
}

/* ---------- next/read controls ---------- */

.next-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.next-btn .next-label {
  font-family: var(--font-display);
  letter-spacing: 0.18em;
}

.next-btn.ready {
  background: linear-gradient(180deg, #6a4410 0%, #2a1a06 100%);
  box-shadow: 0 0 0 1px rgba(246, 217, 106, 0.55), 0 0 28px rgba(246, 217, 106, 0.55);
  animation: nextReady 1.6s ease-in-out infinite;
}

@keyframes nextReady {
  0%, 100% { box-shadow: 0 0 0 1px rgba(246, 217, 106, 0.55), 0 0 22px rgba(246, 217, 106, 0.4); }
  50%      { box-shadow: 0 0 0 1px rgba(246, 217, 106, 0.9),  0 0 38px rgba(246, 217, 106, 0.85); }
}

/* shimmer sweep across NEXT button when it becomes ready */
.next-btn.ready::after {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,243,180,0.55) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-20deg);
  animation: nextSheen 2.1s ease-in-out infinite;
}

@keyframes nextSheen {
  0%   { left: -60%; }
  60%  { left: 120%; }
  100% { left: 120%; }
}

/* ---------- study view (full replacement after selection) ---------- */

.study-view { display: none; }
.study-view.open {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
}

.study-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.study-illo {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 30px rgba(246, 217, 106, 0.18);
  width: auto;
  height: auto;
  max-height: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  align-self: center;
  justify-self: center;
  min-height: 0;
}

.study-illo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.study-verdict {
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  align-self: flex-start;
  background: rgba(212, 175, 55, 0.08);
  color: var(--ink-dim);
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.study-verdict.correct {
  background: rgba(92, 220, 138, 0.12);
  border-color: rgba(92, 220, 138, 0.5);
  color: #9ff0b8;
  text-shadow: 0 0 10px rgba(92, 220, 138, 0.3);
}

.study-verdict.incorrect {
  background: rgba(224, 96, 96, 0.12);
  border-color: rgba(224, 96, 96, 0.5);
  color: #ffb0b0;
}

.study-body {
  text-align: left;
  font-family: var(--font-serif);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
}

.study-pos {
  font-family: var(--font-display);
  color: var(--ink-muted);
  font-style: normal;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 13px;
  margin: 0;
}

.study-word {
  font-family: var(--font-display);
  color: var(--gold-bright);
  font-size: clamp(40px, 5vw, 64px);
  letter-spacing: 0.05em;
  margin: 2px 0 6px;
  line-height: 1.05;
  text-shadow: 0 2px 0 #000, 0 0 22px rgba(246, 217, 106, 0.28);
}

.study-section { margin-top: 0; }

.study-label {
  font-family: var(--font-display);
  color: var(--ink-muted);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 12px;
  margin: 0 0 6px;
}

.study-definition {
  font-size: clamp(18px, 1.7vw, 24px);
  color: var(--ink);
  line-height: 1.45;
  margin: 0;
}

.study-example {
  font-size: clamp(18px, 1.6vw, 23px);
  color: var(--ink);
  font-style: italic;
  line-height: 1.5;
  margin: 0;
  position: relative;
}

.study-example::before {
  content: '“'; font-size: 1.4em; line-height: 0; vertical-align: -0.3em; margin-right: 2px; color: var(--gold);
}
.study-example::after {
  content: '”'; font-size: 1.4em; line-height: 0; vertical-align: -0.3em; margin-left: 2px; color: var(--gold);
}

.study-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.18);
}

.read-gate {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.read-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.read-toggle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.55);
  background: radial-gradient(circle at 50% 35%, rgba(246, 217, 106, 0.34), rgba(43, 24, 7, 0.92));
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(246, 217, 106, 0.22);
  flex: 0 0 auto;
}

.read-toggle:hover,
.read-toggle.recording {
  box-shadow: 0 0 0 1px rgba(246, 217, 106, 0.5), 0 0 28px rgba(246, 217, 106, 0.45);
}

.read-toggle.recording {
  animation: readPulse 1.2s ease-in-out infinite;
}

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

.read-status,
.read-transcript {
  margin: 0;
  min-width: 0;
  color: var(--ink-dim);
  font-family: var(--font-serif);
}

.read-status {
  font-size: 16px;
  line-height: 1.25;
}

.read-status.ready { color: #9ff0b8; }
.read-status.error { color: #ffb0b0; }

.read-fallback {
  border: 1px solid rgba(255, 176, 176, 0.55);
  background: rgba(120, 24, 24, 0.35);
  color: #ffd6d6;
  font-family: var(--font-display);
  font-size: 10px;
  padding: 7px 10px;
  cursor: pointer;
}

.read-heard {
  color: #d6ffe4;
  background: rgba(92, 220, 138, 0.18);
  border-radius: 2px;
}

.read-meters {
  display: grid;
  gap: 6px;
}

.read-meter {
  display: grid;
  grid-template-columns: 92px minmax(70px, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.read-meter-label,
.read-score {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  color: var(--ink-muted);
}

.read-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.read-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.16);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.12);
}

.read-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d4af37, #f6d96a);
  transition: width 0.25s ease;
}

.read-transcript {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-style: italic;
  opacity: 0.85;
}

@media (max-width: 860px) {
  .study-side { overflow: visible; }
  .study-foot { flex-direction: column; gap: 10px; }
  .study-foot .btn { width: 100%; }
  .read-gate { width: 100%; }
  .read-meter { grid-template-columns: 86px minmax(64px, 1fr) 42px; }
}

/* ---------- checkpoint quiz ---------- */

.checkpoint-view {
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
}

.checkpoint-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-width: 0;
}

.checkpoint-title {
  font-size: clamp(26px, 3vw, 38px);
}

.checkpoint-question {
  font-family: var(--font-serif);
  font-size: clamp(18px, 1.7vw, 24px);
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}

.checkpoint-options {
  margin-top: 4px;
}

.checkpoint-option {
  display: block;
  white-space: normal;
}

.checkpoint-option .answer-line {
  display: block;
}

.checkpoint-option .answer-line + .answer-line {
  margin-top: 4px;
}

.checkpoint-option strong {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 0.85em;
  letter-spacing: 0.06em;
}

.checkpoint-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding-left: 22px;
  border-left: 1px solid rgba(212, 175, 55, 0.22);
}

.checkpoint-count {
  font-family: var(--font-display);
  color: var(--gold-bright);
  font-size: clamp(44px, 5vw, 64px);
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 #000, 0 0 20px rgba(246, 217, 106, 0.25);
}

.checkpoint-copy,
#checkpoint-feedback {
  font-family: var(--font-serif);
  color: var(--ink-dim);
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.35;
  letter-spacing: 0;
}

.checkpoint-next {
  align-self: flex-start;
}

@media (max-width: 860px) {
  .checkpoint-view {
    grid-template-columns: 1fr;
  }

  .checkpoint-panel {
    border-left: 0;
    border-top: 1px solid rgba(212, 175, 55, 0.22);
    padding-left: 0;
    padding-top: 16px;
  }

  .checkpoint-next {
    align-self: stretch;
  }
}

/* ---------- results ---------- */

.results {
  text-align: center;
  padding: 60px 30px;
}

.results .score {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 80px);
  color: var(--gold-bright);
  letter-spacing: 0.1em;
  margin: 10px 0 4px;
  text-shadow: 0 2px 0 #000, 0 0 24px rgba(246, 217, 106, 0.35);
}

.results .score-label {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-dim);
}

.results .house {
  margin-top: 26px;
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  color: var(--ink);
}

.results .actions {
  justify-content: center;
  margin-top: 30px;
}

.preview-lock-form {
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  margin: 24px auto 0;
}

.preview-lock-form.shake {
  animation: gateShake 0.38s ease;
}

.preview-lock-error {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .preview-lock-form {
    grid-template-columns: 1fr;
  }
}

/* ---------- password gate ---------- */
html.gated body > *:not(.gate-overlay) {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, rgba(26, 33, 64, 0.88) 0%, rgba(10, 15, 31, 0.96) 60%, rgba(5, 7, 15, 0.98) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.4s ease;
}

.gate-overlay.leaving { opacity: 0; }

.gate-card {
  width: min(420px, 92vw);
  background: linear-gradient(180deg, rgba(20, 14, 6, 0.95) 0%, rgba(8, 5, 2, 0.98) 100%);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 12px;
  padding: 32px 28px 26px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(212, 175, 55, 0.08) inset;
}

.gate-card.shake {
  animation: gateShake 0.38s ease;
}

@keyframes gateShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.gate-crest {
  display: inline-block;
  width: 54px;
  height: 54px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  line-height: 50px;
  font-family: var(--font-display);
  color: var(--gold-bright);
  font-size: 22px;
  margin-bottom: 12px;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15), 0 0 24px rgba(212, 175, 55, 0.35);
  background: radial-gradient(circle, rgba(212,175,55,0.18) 0%, transparent 70%);
}

.gate-title {
  font-family: var(--font-display);
  color: var(--gold-bright);
  letter-spacing: 0.14em;
  font-size: 22px;
  margin: 0 0 6px;
  text-shadow: 0 2px 0 #000, 0 0 20px rgba(246, 217, 106, 0.25);
}

.gate-sub {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-dim);
  font-size: 14px;
  margin: 0 0 18px;
}

.gate-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.gate-input {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(0, 0, 0, 0.5);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-input:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px rgba(246, 217, 106, 0.18);
}

.gate-btn {
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: linear-gradient(180deg, #3a2508 0%, #1a0f03 100%);
  color: var(--gold-bright);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
}

.gate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(246, 217, 106, 0.25);
}

.gate-error {
  color: #ff9090;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  margin: 10px 0 0;
  min-height: 18px;
}

/* user picker */
.user-picker-card { width: min(760px, 94vw); }

.user-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 6px;
}

.test-user-shortcut {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid #fff0b0;
  border-radius: 50%;
  background: #f6d96a;
  color: #211705;
  box-shadow: 0 0 0 3px rgba(246, 217, 106, 0.14), 0 5px 16px rgba(0, 0, 0, 0.5);
  font: 700 16px/32px var(--font-display);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.test-user-shortcut:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 4px rgba(246, 217, 106, 0.2), 0 8px 20px rgba(0, 0, 0, 0.55);
}

.test-user-shortcut:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

@media (max-width: 680px) {
  .user-picker {
    grid-template-columns: 1fr;
  }
}

.user-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 14px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: linear-gradient(180deg, rgba(25, 16, 6, 0.85) 0%, rgba(12, 7, 2, 0.95) 100%);
  color: var(--ink);
  transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s;
}

.user-btn:hover {
  transform: translateY(-2px);
}

.user-crest {
  display: inline-block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}

.user-name {
  font-size: 18px;
  letter-spacing: 0.22em;
  margin-top: 6px;
}

.user-house {
  font-family: var(--font-serif);
  font-style: italic;
  letter-spacing: 0.04em;
  font-size: 12px;
  color: var(--ink-dim);
}

.user-ravenclaw {
  background: linear-gradient(180deg, rgba(17, 48, 105, 0.96) 0%, rgba(5, 15, 42, 0.98) 100%);
  border-color: rgba(192, 138, 69, 0.65);
  color: #dce8ff;
}
.user-ravenclaw .user-name { color: #9fc3ff; text-shadow: 0 0 14px rgba(80, 132, 220, 0.4); }
.user-ravenclaw:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 24px rgba(192, 138, 69, 0.35);
  border-color: #d7a461;
}

.user-gryffindor {
  background: linear-gradient(180deg, rgba(122, 10, 10, 0.95) 0%, rgba(44, 4, 4, 0.98) 100%);
  border-color: rgba(246, 217, 106, 0.6);
  color: #ffe0a0;
}
.user-gryffindor .user-name { color: #ff9b7a; text-shadow: 0 0 14px rgba(224, 96, 96, 0.45); }
.user-gryffindor:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 24px rgba(246, 217, 106, 0.35);
  border-color: #f6d96a;
}

.user-hufflepuff {
  background: linear-gradient(180deg, rgba(134, 95, 12, 0.96) 0%, rgba(22, 17, 9, 0.98) 100%);
  border-color: rgba(246, 217, 106, 0.65);
  color: #fff2b8;
}
.user-hufflepuff .user-name { color: #f6d96a; text-shadow: 0 0 14px rgba(246, 217, 106, 0.35); }
.user-hufflepuff:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 24px rgba(246, 217, 106, 0.35);
  border-color: #fff0b0;
}

/* user chip (shown on the running app) */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.06);
  color: var(--ink-dim);
  cursor: pointer;
  text-decoration: none;
  margin-left: 6px;
  vertical-align: 1px;
}

.user-chip[data-user="kara"] {
  border-color: rgba(192, 138, 69, 0.6);
  color: #9fc3ff;
  background: rgba(17, 48, 105, 0.38);
}

.user-chip[data-user="theo"] {
  border-color: rgba(246, 217, 106, 0.55);
  color: #ff9b7a;
  background: rgba(122, 10, 10, 0.3);
}

.user-chip[data-user="testuser"] {
  border-color: rgba(246, 217, 106, 0.62);
  color: #f6d96a;
  background: rgba(134, 95, 12, 0.35);
}

.user-chip:hover { filter: brightness(1.15); }

.review-callout {
  max-width: 760px;
  margin: 0 auto 18px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-block: 1px solid rgba(212, 175, 55, 0.35);
}

.review-callout[hidden] { display: none; }
.review-callout div { display: flex; flex-direction: column; }
.review-callout strong { color: var(--gold-bright); font-family: var(--font-display); }
.review-callout span { color: var(--ink-dim); }

.gate-admin-link {
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.admin-page {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.admin-header h1 { margin: 4px 0; font-family: var(--font-display); color: var(--gold-bright); }
.admin-book-tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 20px 0 12px; }
.admin-book-tab { min-height: 42px; border: 1px solid rgba(212, 175, 55, 0.3); background: rgba(8, 5, 2, 0.6); color: var(--ink-dim); font: 11px var(--font-display); cursor: pointer; }
.admin-book-tab:hover { border-color: rgba(246, 217, 106, 0.65); color: var(--ink); }
.admin-book-tab.active { border-color: var(--gold); color: var(--gold-bright); background: rgba(106, 68, 16, 0.42); box-shadow: inset 0 -2px 0 var(--gold); }
.admin-status { color: var(--ink-dim); border-bottom: 1px solid rgba(212, 175, 55, 0.25); padding-bottom: 14px; }
.admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.admin-player { border: 1px solid rgba(212, 175, 55, 0.35); background: rgba(8, 5, 2, 0.88); padding: 18px; border-radius: 8px; }
.admin-player > header { display: flex; justify-content: space-between; gap: 12px; }
.admin-player h2 { margin: 2px 0 12px; font-family: var(--font-display); color: var(--gold-bright); }
.player-updated { color: var(--ink-muted); font-size: 12px; text-align: right; }
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-block: 1px solid rgba(212, 175, 55, 0.2); padding: 12px 0; }
.admin-stats div { display: flex; flex-direction: column; }
.admin-stats strong { font: 700 24px var(--font-display); color: var(--parchment); }
.admin-stats span { color: var(--ink-muted); font-size: 11px; }
.admin-section { margin-top: 16px; }
.admin-section h3 { margin: 0 0 7px; color: var(--ink-dim); font: 12px var(--font-display); text-transform: uppercase; }
.admin-section p, .activity-list { margin: 0; color: var(--ink); font-size: 14px; }
.activity-list { padding-left: 18px; }
.checkpoint-chips { display: flex; flex-wrap: wrap; gap: 6px; color: var(--ink-dim); }
.checkpoint-chips span { border: 1px solid rgba(212, 175, 55, 0.3); padding: 4px 7px; }
.admin-override { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(212, 175, 55, 0.2); display: flex; align-items: end; gap: 8px; }
.admin-override label { display: flex; flex-direction: column; gap: 5px; color: var(--ink-dim); font-size: 12px; }
.admin-override input { width: 82px; padding: 8px; background: #080502; border: 1px solid rgba(212, 175, 55, 0.4); color: var(--ink); }
.admin-danger { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(180, 62, 62, 0.35); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-danger div { display: flex; flex-direction: column; }
.admin-danger strong { color: #ffb0b0; font-size: 13px; }
.admin-danger span { color: var(--ink-muted); font-size: 11px; }
.btn.danger { border-color: rgba(224, 96, 96, 0.65); background: rgba(110, 24, 24, 0.45); color: #ffd6d6; }
.btn.danger:hover:not(:disabled) { background: rgba(145, 30, 30, 0.65); box-shadow: 0 0 18px rgba(224, 96, 96, 0.2); }
.btn.danger:disabled { cursor: not-allowed; opacity: 0.35; }

.admin-reset-modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px; }
.admin-reset-modal.open { display: flex; }
.admin-reset-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 15, 0.82); backdrop-filter: blur(5px); }
.admin-reset-dialog { position: relative; z-index: 1; width: min(480px, 100%); padding: 24px; border: 1px solid rgba(224, 96, 96, 0.55); border-radius: 8px; background: #0b0705; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75); }
.admin-reset-dialog h2 { margin: 5px 0 10px; font-family: var(--font-display); color: #ffd6d6; }
.admin-reset-dialog p:not(.study-label) { color: var(--ink-dim); line-height: 1.5; }
.admin-reset-dialog .actions { justify-content: flex-end; margin-top: 20px; }

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-book-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .review-callout { align-items: stretch; flex-direction: column; }
  .admin-header { align-items: flex-start; }
  .admin-stats strong { font-size: 20px; }
  .admin-override { align-items: stretch; flex-direction: column; }
  .admin-override input { width: 100%; }
  .admin-book-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-danger { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .dust-layer, .fx-canvas, .candle { display: none !important; }
}

/* accessibility helpers */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- review button + modal ---------- */

.review-trigger {
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: rgba(212, 175, 55, 0.08);
  color: var(--gold-bright);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  margin-left: 4px;
}

.review-trigger:hover {
  background: rgba(212, 175, 55, 0.18);
  box-shadow: 0 0 12px rgba(246, 217, 106, 0.3);
  transform: translateY(-1px);
}

.review-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.review-modal.open {
  display: flex;
}

.review-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 15, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.review-card {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  width: 100%;
  max-height: 90dvh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(20, 14, 6, 0.98) 0%, rgba(8, 5, 2, 0.98) 100%);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 12px;
  padding: 22px 24px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 175, 55, 0.08) inset;
}

.review-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(0, 0, 0, 0.4);
  color: var(--gold-bright);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}

.review-close:hover {
  background: rgba(212, 175, 55, 0.15);
}

.review-title {
  font-family: var(--font-display);
  color: var(--gold-bright);
  letter-spacing: 0.12em;
  font-size: 22px;
  margin: 0 0 6px;
  text-align: center;
}

.review-sub {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-dim);
  text-align: center;
  font-size: 13px;
  margin: 0 0 20px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 12px;
}

.review-square {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: linear-gradient(180deg, rgba(30, 20, 8, 0.7) 0%, rgba(14, 9, 3, 0.85) 100%);
  color: var(--ink-dim);
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  position: relative;
  transition: transform 0.15s, box-shadow 0.2s;
  word-break: break-word;
  line-height: 1.1;
}

.review-square .sq-word {
  font-size: clamp(9px, 0.85vw, 12px);
  color: inherit;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

.review-square .sq-mark {
  font-size: 18px;
  margin-top: 4px;
  opacity: 0.9;
}

.review-square.correct {
  background: linear-gradient(180deg, rgba(30, 90, 50, 0.85) 0%, rgba(12, 52, 28, 0.95) 100%);
  border-color: rgba(92, 220, 138, 0.7);
  color: #d6ffe4;
  box-shadow: 0 0 18px rgba(92, 220, 138, 0.18), 0 0 0 1px rgba(92, 220, 138, 0.15) inset;
}

.review-square.wrong {
  background: linear-gradient(180deg, rgba(110, 24, 24, 0.85) 0%, rgba(62, 10, 10, 0.95) 100%);
  border-color: rgba(224, 96, 96, 0.7);
  color: #ffd6d6;
  box-shadow: 0 0 18px rgba(224, 96, 96, 0.18), 0 0 0 1px rgba(224, 96, 96, 0.15) inset;
}

.review-square.pending {
  opacity: 0.55;
}

.review-square:hover:not(.pending) {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(246, 217, 106, 0.25);
}

.review-square {
  cursor: pointer;
}

/* review set grouping */
.review-grid { display: block; }

.review-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.review-set-header {
  font-family: var(--font-display);
  color: var(--gold-bright);
  letter-spacing: 0.14em;
  font-size: 13px;
  margin: 6px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-set-header span { flex: 1; }

.review-redo-btn {
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: rgba(212, 175, 55, 0.08);
  color: var(--gold-bright);
  cursor: pointer;
}

.review-redo-btn:hover {
  background: rgba(212, 175, 55, 0.2);
}

@media (max-width: 860px) {
  .review-row { grid-template-columns: repeat(5, 1fr); }
}

/* results actions (with multiple buttons) */
.results-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.btn.primary {
  background: linear-gradient(180deg, #6a4410 0%, #2a1a06 100%);
  border-color: rgba(246, 217, 106, 0.7);
  color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(246, 217, 106, 0.25);
}

.btn.primary:hover {
  box-shadow: 0 0 28px rgba(246, 217, 106, 0.45);
}

/* detail modal */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.detail-modal.open { display: flex; }

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 15, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.detail-card {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  width: 100%;
  max-height: 90dvh;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 14, 6, 0.98) 0%, rgba(8, 5, 2, 0.98) 100%);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75);
}

.detail-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px;
  max-height: calc(90dvh - 44px);
  overflow: hidden;
}

.detail-illo {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(212, 175, 55, 0.35);
  min-height: 0;
}

.detail-illo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  max-height: 70vh;
}

.detail-body {
  overflow: auto;
  padding-right: 4px;
}

.detail-badge {
  display: inline-block;
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.08);
  color: var(--ink-dim);
}

.detail-badge.correct {
  border-color: rgba(92, 220, 138, 0.6);
  background: rgba(92, 220, 138, 0.15);
  color: #9ff0b8;
}

.detail-badge.wrong {
  border-color: rgba(224, 96, 96, 0.6);
  background: rgba(224, 96, 96, 0.15);
  color: #ffb0b0;
}

.detail-close {
  top: 10px;
  right: 12px;
}

@media (max-width: 720px) {
  .detail-inner { grid-template-columns: 1fr; }
  .detail-illo img { max-height: 32vh; }
}
