/* ==========================================================================
   quiz.css - shared by the website and the offline download.
   Everything the engine renders is styled here. Keep it self-contained so
   the whole file can be inlined into the downloadable question bank.
   ========================================================================== */

.quiz { margin: 2rem 0 0; max-width: 40rem; }
.quiz *:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.quiz__noscript,
.quiz__error {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-2);
  border-left: 3px solid var(--rule-strong);
  padding-left: 0.9rem;
  margin: 0;
}

/* ------------------------------------------------------------------ bar -- */
.quiz__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}
.quiz__count { font-variant-numeric: tabular-nums; }
.quiz__timer { font-family: var(--mono); letter-spacing: 0; font-size: 0.9rem; color: var(--ink-2); }
.quiz__timer.is-low { color: var(--bad); }

.quiz__track { height: 2px; background: var(--rule); margin-bottom: 1.75rem; }
.quiz__fill { height: 2px; background: var(--accent); transition: width 0.2s ease-out; }

/* --------------------------------------------------------------- prompt -- */
.quiz__module {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 0.6rem;
}

.quiz__stem {
  font-family: var(--serif);
  font-size: 1.12em;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 1.4rem;
}

/* -------------------------------------------------------------- options -- */
.quiz__options { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.5rem; }

.opt {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}
.opt:hover:not([disabled]) { border-color: var(--rule-strong); background: var(--paper-sunk); }
.opt[disabled] { cursor: default; }

.opt__letter {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--ink-3);
}
.opt__text { min-width: 0; }

/* Muted, and never the only signal: the verdict line above names the
   correct letter in words, and the correct option is marked even when the
   answer given was wrong. */
.opt.is-correct {
  border-color: var(--good);
  box-shadow: inset 3px 0 0 var(--good);
  background: var(--good-tint);
}
.opt.is-correct .opt__letter { color: var(--good); font-weight: 700; }
.opt.is-wrong {
  border-color: var(--bad);
  box-shadow: inset 3px 0 0 var(--bad);
  background: var(--bad-tint);
}
.opt.is-wrong .opt__letter { color: var(--bad); font-weight: 700; }
.opt.is-dim { opacity: 0.66; }

/* ------------------------------------------------------------- feedback -- */
.quiz__feedback { border-left: 3px solid var(--rule-strong); padding-left: 1rem; margin: 0 0 1.5rem; }
.quiz__feedback.is-correct { border-left-color: var(--good); }
.quiz__feedback.is-wrong { border-left-color: var(--bad); }

.quiz__verdict {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
}
.quiz__feedback.is-correct .quiz__verdict { color: var(--good); }
.quiz__feedback.is-wrong .quiz__verdict { color: var(--bad); }

.quiz__why { margin: 0; font-size: 0.98rem; }
.quiz__why dt {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-3);
  float: left;
  width: 2.1rem;
  line-height: 1.62;
}
.quiz__why dd { margin: 0 0 0.55rem 2.1rem; color: var(--ink-2); }
.quiz__why .is-key dt { color: var(--good); font-weight: 700; }
.quiz__why .is-key dd { color: var(--ink); }

.quiz__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* -------------------------------------------------------------- results -- */
.results__head { border-top: 1px solid var(--rule-strong); padding-top: 1.5rem; margin-bottom: 2.5rem; }
.results__verdict {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}
.results__verdict.is-pass { color: var(--good); }
.results__verdict.is-fail { color: var(--bad); }

.scores { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: 0.95rem; }
.scores caption {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 0.6rem;
}
.scores th, .scores td { text-align: left; padding: 0.6rem 0.5rem 0.6rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.scores thead th { font-size: 0.78rem; font-weight: 500; color: var(--ink-3); border-bottom-color: var(--rule-strong); }
.scores tbody th { font-family: var(--serif); font-weight: 400; color: var(--ink); }
.scores td { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.scores .num { text-align: right; width: 4.5rem; padding-right: 0; }
.scores tr.is-below td, .scores tr.is-below th { color: var(--bad); }

.flag {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bad);
  white-space: nowrap;
}
.flag.is-ok { color: var(--ink-3); }

.results__note { font-family: var(--sans); font-size: 0.95rem; line-height: 1.5; color: var(--ink-2); max-width: 34rem; margin: 0 0 1.75rem; }
.results__note strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------ watermark -- */
/* Used only by the downloadable bank. Harmless on the site. */
.watermark {
  position: fixed;
  right: 0.75rem;
  bottom: 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-3);
  opacity: 0.4;
  pointer-events: none;
  z-index: 5;
}

@media print { .watermark { opacity: 0.55; position: fixed; } }

/* --------------------------------------------------------------- review -- */
.review { border-top: 1px solid var(--rule); margin: 0 0 2rem; }
.review__toggle {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--accent-dark);
  padding: 0.9rem 0;
  cursor: pointer;
}
.review__toggle:hover { color: var(--accent); }
.review__item { border-top: 1px solid var(--rule); padding-top: 1.4rem; margin-bottom: 1.4rem; }
.review__item .quiz__stem { font-size: 1em; margin-bottom: 1rem; }

/* Exam mode: a chosen answer is marked without implying it is right. */
.opt.is-chosen {
  border-color: var(--ink-2);
  box-shadow: inset 3px 0 0 var(--ink-2);
  background: var(--paper-sunk);
}
.opt.is-chosen .opt__letter { color: var(--ink); font-weight: 700; }

/* ============================================================ quiz colour */
/* Softer fills than the accent tint, so a marked option reads as feedback
   rather than as a button. Defined here so the offline download inherits it. */
:root {
  --good-tint: #E8EFEB;
  --bad-tint:  #F6EBE7;
}

/* ============================================================= quiz motion */
/* The explanation is the only thing that animates. Everything else is a
   colour or position transition of about 150ms. */
.quiz__feedback {
  animation: quiz-reveal 0.18s ease-out both;
}
@keyframes quiz-reveal {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.opt { transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease; }
.mode-btn { transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease; }

@media (prefers-reduced-motion: reduce) {
  .quiz__feedback { animation: none; }
  .opt,
  .mode-btn,
  .quiz__fill { transition: none; }
}

/* ------------------------------------------------- explanation labelling */
/* The tag carries the meaning when colour is not available. */
.why__tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: 0.5rem;
}
.quiz__why .is-key .why__tag { color: var(--good); }
.quiz__why .is-chosen .why__tag { color: var(--bad); }
.quiz__why .is-chosen dt { color: var(--bad); font-weight: 700; }

.quiz__more { margin: 0.4rem 0 0; }
.quiz__more > summary {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--accent-dark);
  cursor: pointer;
  padding: 0.35rem 0;
}
.quiz__more > summary:hover { color: var(--accent); }
.quiz__more .quiz__why { margin-top: 0.4rem; }
