/*
 * quiz.css — styles for the daily quiz (see /quiz.js). Loaded on every edition page at
 * all widths; it only styles elements that quiz.js creates, so pages without quiz data
 * are unaffected. Colours come from the page's own tokens, so light/dark just work.
 */
.quiz .lane-tag { background: var(--brand-soft); color: var(--brand); }
.quiz .lane-head h2 { border-left: 4px solid var(--brand); padding-left: 13px; }
.quiz [hidden] { display: none !important; }

.quiz-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  max-width: 640px;
  scroll-margin-top: 72px;   /* clears the sticky nav when quiz.js scrolls a new question or the result into view */
}
.quiz-actions .quiz-btn { scroll-margin-bottom: calc(var(--hb-tab-h, 0px) + 20px); }   /* keep "Next question" above the bottom tab bar */
.quiz-friend {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.45;
}
.quiz-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.quiz-dots { display: flex; gap: 6px; }
.quiz-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.quiz-dot.now { background: var(--brand); }
.quiz-dot.ok { background: var(--up); }
.quiz-dot.no { background: var(--down); }

.quiz-q {
  margin: 0 0 14px;
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.quiz-opt:hover:not([aria-disabled="true"]) { border-color: var(--brand); }
.quiz-opt:focus-visible, .quiz-btn:focus-visible, .quiz-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.quiz-opt[aria-disabled="true"] { cursor: default; }
.quiz-key {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--paper-2);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}
.quiz-mark { margin-left: auto; padding-left: 8px; font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.quiz-opt.is-correct { border-color: var(--up); background: color-mix(in srgb, var(--up) 13%, var(--paper)); }
.quiz-opt.is-correct .quiz-mark { color: var(--up); }
.quiz-opt.is-wrong { border-color: var(--down); background: color-mix(in srgb, var(--down) 11%, var(--paper)); }
.quiz-opt.is-wrong .quiz-mark { color: var(--down); }

.quiz-why {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 0 6px 6px 0;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.5;
}
.quiz-from {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.quiz-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.quiz-btn {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.quiz-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--bg); }
.quiz-btn:hover { opacity: 0.92; }

.quiz-result { text-align: left; }
.quiz-score { display: flex; align-items: baseline; gap: 8px; margin: 0 0 4px; }
.quiz-score b { font-size: 2.8rem; line-height: 1; font-weight: 800; color: var(--ink); }
.quiz-score span { font-size: 1.1rem; color: var(--ink-soft); }
.quiz-squares { margin: 0 0 6px; font-size: 1.4rem; letter-spacing: 3px; line-height: 1.3; }
.quiz-msg { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; color: var(--ink); }
.quiz-streak, .quiz-versus, .quiz-compare { margin: 6px 0 0; font-size: 0.92rem; color: var(--ink-soft); line-height: 1.45; }
.quiz-streak b { color: var(--ink); }
.quiz-dist { display: flex; align-items: flex-end; gap: 8px; height: 70px; margin-top: 12px; }
.quiz-dist > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; font-size: 0.7rem; color: var(--ink-faint); }
.quiz-dist i { display: block; width: 100%; min-height: 3px; border-radius: 3px 3px 0 0; background: var(--line); }
.quiz-dist .mine i { background: var(--brand); }
.quiz-dist .mine { color: var(--ink); font-weight: 700; }
.quiz-review { margin: 14px 0 0; padding: 0; list-style: none; }
.quiz-review li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 0.9rem; line-height: 1.45; color: var(--ink-soft); }
.quiz-review b { color: var(--ink); }
.quiz-review .yes { color: var(--up); font-weight: 700; }
.quiz-review .no { color: var(--down); font-weight: 700; }

.quiz-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 22px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}
.quiz-chip span:last-child { margin-left: auto; color: var(--brand); white-space: nowrap; }
/* the chip's inner structure (icon disc, title, sub-line, action); phones restyle it in /app.css */
.quiz-chip .qc-disc { flex: none; font-size: 1rem; }
.quiz-chip .qc-disc.done { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--up); color: #fff; font-size: 0.8rem; font-weight: 700; }
.quiz-chip .qc-text { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; }
.quiz-chip .qc-text span:last-child { margin-left: 0; color: var(--ink-soft); font-weight: 500; white-space: normal; }
.quiz-chip .qc-sub::before { content: '\00B7'; margin-right: 8px; color: var(--ink-faint); }
/* new pieces that only the phone/app skin (/app.css) shows */
.qz-streak, .qz-past-box { display: none; }
.quiz-where { display: inline-flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.quiz-topic { color: var(--brand); }
.quiz-why-label { display: block; margin-bottom: 2px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.quiz-why-text { display: block; }

.item.deeplinked { animation: hb-flash 1.8s ease-out 1; }
@keyframes hb-flash { from { background: color-mix(in srgb, var(--brand) 14%, transparent); } to { background: transparent; } }
.quiz-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 9991;
  padding: 10px 16px;
  border-radius: 10px;
  background: #17191c;
  color: #f2f3ee;
  font-size: 0.85rem;
}
@media (prefers-reduced-motion: reduce) {
  .quiz-opt { transition: none; }
  .item.deeplinked { animation: none; }
}
@media (max-width: 640px) {
  .quiz-card { padding: 14px; }
  .quiz-btn { flex: 1 1 auto; }
  .quiz-chip { margin-top: -12px; }
}

/* ---- Badges ---- */
.quiz-fresh { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--brand); border-radius: 10px; background: var(--brand-soft); }
.quiz-fresh-title { margin: 0 0 4px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }
.quiz-fresh-row { margin: 2px 0 0; font-size: 0.92rem; line-height: 1.4; color: var(--ink); }

.qz-sheet-bg { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.45); }
.qz-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 16px 16px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.25);
  font: 15px/1.5 -apple-system, system-ui, sans-serif;
}
@media (min-width: 641px) { .qz-sheet-bg { align-items: center; } .qz-sheet { border-radius: 16px; max-height: 76vh; } }
.qz-sheet h2 { margin: 0 0 6px; font-size: 1.15rem; }
.qz-sheet p { margin: 0 0 12px; color: var(--ink-soft); }
.qz-close { width: 100%; margin-top: 8px; }
.qz-badges { margin: 0 0 8px; padding: 0; list-style: none; }
.qz-badges li { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.qz-badges li:first-child { border-top: 0; }
.qz-badge-icon { flex: 0 0 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); font-size: 1.4rem; line-height: 44px; text-align: center; }
.qz-badges li.qz-locked { opacity: 0.55; }
.qz-badges li.qz-locked .qz-badge-icon { filter: grayscale(1); }
.qz-badges b { display: block; }
.qz-badge-desc, .qz-badge-state { display: block; font-size: 0.85rem; color: var(--ink-soft); }
.qz-badge-state { color: var(--ink-faint); }
.qz-badges li.qz-earned .qz-badge-state { color: var(--up); font-weight: 600; }

/* ---- Friends leagues ---- */
.qz-leagues { max-width: 640px; margin-top: 22px; }
.qz-join { max-width: 640px; }
.qz-join-t { margin: 0 0 8px; font-weight: 600; }
.qz-lg-title { margin: 0 0 6px; font-size: 1.15rem; }
.qz-lg-intro, .qz-lg-note, .qz-lg-priv { margin: 0 0 10px; font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); }
.qz-lg-priv { margin-top: 14px; font-size: 0.78rem; color: var(--ink-faint); }
.qz-lg-priv a { color: inherit; }
.qz-lg-msg { margin: 10px 0 0; font-size: 0.9rem; color: var(--ink); font-weight: 600; }
.qz-league { margin: 0 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.qz-lg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.qz-lg-head b { font-size: 1.05rem; }
.qz-code { font-size: 0.78rem; letter-spacing: 0.06em; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qz-tabs { display: flex; gap: 8px; margin: 6px 0 4px; }
.qz-tab { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-soft); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.qz-tab.on { background: var(--brand); border-color: var(--brand); color: var(--bg); }
.qz-tab:focus-visible, .qz-input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.qz-board { margin: 6px 0 0; padding: 0; list-style: none; }
.qz-board li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.95rem; }
.qz-board li:first-child { border-top: 0; }
.qz-board li.qz-empty { display: block; color: var(--ink-faint); font-size: 0.88rem; }
.qz-board li.me { font-weight: 700; }
.qz-board li.me .qz-who { color: var(--brand); }
.qz-rank { width: 26px; height: 26px; border-radius: 50%; background: var(--paper-2); font-size: 0.8rem; font-weight: 700; line-height: 26px; text-align: center; }
.qz-pts { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 600; }
.qz-joinrow { display: flex; gap: 10px; margin-top: 12px; }
.qz-input { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; letter-spacing: 0.1em; text-transform: uppercase; }
.qz-input::placeholder { letter-spacing: 0; text-transform: none; }
