/* The challenge/quiz overlay — component CSS for public/js/quiz-view.js.
 *
 * Every colour here comes from a custom property defined in base.css
 * (--fg, --bg, --muted, --border, --accent, --accent-fg, --card,
 * --card-raised, --good, --bad, --warn, --radius); nothing in this file
 * hardcodes one, so the light/dark toggle keeps working without this file
 * knowing that it exists.
 *
 * Only one of the four screens (`quiz`, `waived`, `reveal`, `picker`) is ever
 * mounted at a time — quiz-view.js guarantees that — so they all share one
 * `.quiz-overlay` / `.quiz-modal` shell and differ only in their body content.
 */

.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgb(0 0 0 / 55%);
  overflow-y: auto;
}

.quiz-modal {
  width: 100%;
  max-width: 32rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--card-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 25%);
}

.quiz-title {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.quiz-lede {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.quiz-word {
  margin: 0 0 0.7rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.quiz-note {
  margin: 0.5rem 0;
}

.quiz-warning {
  margin: 0.5rem 0;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--bad);
  color: var(--bad);
  font-size: 0.85rem;
}

.quiz-status {
  margin: 0.6rem 0 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--muted);
}
.quiz-status--bad { color: var(--bad); }

/* --- the six answer options -------------------------------------------- */

.quiz-options {
  display: grid;
  gap: 0.5rem;
  margin: 0.4rem 0;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.35;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.quiz-option:hover:not(:disabled) { border-color: var(--accent); }
.quiz-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.quiz-option:disabled { opacity: 0.55; cursor: not-allowed; }
.quiz-option--chosen {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  opacity: 1;
}

.quiz-option__index {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 700;
}
.quiz-option--chosen .quiz-option__index {
  background: var(--accent);
  color: var(--accent-fg);
}

.quiz-option__text { flex: 1; min-width: 0; }

/* --- the countdown clock ------------------------------------------------ */

.quiz-clock {
  margin-top: 0.8rem;
}

.quiz-clock__text {
  display: block;
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--muted);
}

.quiz-clock__bar {
  height: 0.4rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.quiz-clock__fill {
  height: 100%;
  background: var(--accent);
  /* The width itself is set inline per tick; the transition just smooths the
     jump between one refresh and the next. */
  transition: width 150ms linear, background-color 150ms linear;
}

.quiz-clock--urgent .quiz-clock__text { color: var(--bad); }
.quiz-clock--urgent .quiz-clock__fill { background: var(--bad); }
.quiz-clock--expired .quiz-clock__fill { background: var(--muted); }

/* --- "Report error" ------------------------------------------------------ */

.quiz-report {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
}

.quiz-report__toggle {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.quiz-report__note {
  margin: 0.35rem 0 0;
}

.quiz-report__panel {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.4rem;
}

.quiz-report__label {
  font-size: 0.8rem;
  color: var(--muted);
}

.quiz-report__comment {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  resize: vertical;
}

.quiz-report__send {
  justify-self: start;
  font-size: 0.85rem;
}

.quiz-report__status {
  margin: 0.4rem 0 0;
  color: var(--good);
}

/* --- the waived notice --------------------------------------------------- */

.quiz-waived-message {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

/* --- the accept/challenge picker ----------------------------------------- */

.quiz-picker__words {
  display: grid;
  gap: 0.4rem;
  margin: 0.4rem 0 0.7rem;
}

.quiz-picker__word {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  font-size: 0.95rem;
}

.quiz-picker__check {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.quiz-picker__label {
  font-weight: 600;
  letter-spacing: 0.02em;
  word-break: break-word;
}

/* --- shared action row ---------------------------------------------------- */

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

/* --- the post-challenge summary ------------------------------------------- */

.quiz-summary {
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left-width: 4px;
  background: var(--card);
}
.quiz-summary.is-good { border-left-color: var(--good); }
.quiz-summary.is-bad { border-left-color: var(--bad); }
.quiz-summary.is-neutral { border-left-color: var(--accent); }

.quiz-summary__headline {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.quiz-summary.is-good .quiz-summary__headline { color: var(--good); }
.quiz-summary.is-bad .quiz-summary__headline { color: var(--bad); }

.quiz-summary__note {
  margin: 0.25rem 0;
  font-size: 0.92rem;
}

.quiz-summary__counts {
  margin: 0.5rem 0 0;
}

/* --- per-word reveal: the real definition and its five decoys ------------- */
/*
 * This is the learning payoff the whole game is built around (rules.md,
 * "Resolving a challenge": "this game is for learning a word, not just
 * scoring a guess on it"), so it gets full-width prose, not a collapsed
 * <details> or small print — and the real definition is visually pulled away
 * from the decoys rather than listed alongside them as one more option.
 */

.quiz-reveal {
  margin-bottom: 0.9rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.quiz-reveal__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.quiz-reveal__word {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.quiz-reveal__badge {
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.quiz-reveal.is-good .quiz-reveal__badge { color: var(--good); border-color: var(--good); }
.quiz-reveal.is-bad .quiz-reveal__badge { color: var(--bad); border-color: var(--bad); }

.quiz-reveal__explanation {
  margin: 0 0 0.3rem;
  font-size: 0.92rem;
}

.quiz-reveal__points {
  margin: 0 0 0.6rem;
}

.quiz-reveal__none {
  margin: 0;
}

.quiz-reveal__report {
  display: block;
  margin: 0 0 0.6rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.quiz-reveal__truth {
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--good);
  background: var(--card-raised);
}

.quiz-reveal__truth-label {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--good);
  font-weight: 700;
}

.quiz-reveal__truth-text {
  margin: 0;
  font-size: 1rem;
}

.quiz-reveal__picked {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--bad);
  background: var(--card-raised);
  font-size: 0.9rem;
}

.quiz-reveal__decoys {
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.quiz-reveal__decoys-label {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.quiz-reveal__decoy-list {
  margin: 0;
  padding-left: 1.2rem;
}

.quiz-reveal__decoy {
  margin: 0.2rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* --- small screens --------------------------------------------------------- */

@media (max-width: 30rem) {
  .quiz-modal {
    padding: 0.8rem 0.85rem 0.9rem;
    max-height: calc(100vh - 1.5rem);
  }
  .quiz-word { font-size: 1.3rem; }
}
