:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #16181d; --muted: #666c78;
  --line: #dfe3e8; --accent: #1f6feb; --ok-bg: #e7f6ec; --ok-line: #1a7f37;
  --bad-bg: #fdecec; --bad-line: #cf222e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116; --panel: #171a21; --ink: #e8eaed; --muted: #9aa1ad;
    --line: #2a2f3a; --accent: #58a6ff; --ok-bg: #10251a; --ok-line: #3fb950;
    --bad-bg: #2a1618; --bad-line: #f85149;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { max-width: 820px; margin: 0 auto; padding: 24px 18px 80px; }
a { color: var(--accent); }
header.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: 12px 0; margin-bottom: 20px;
}
header.top .inner { max-width: 820px; margin: 0 auto; padding: 0 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.spacer { flex: 1; }
button {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 7px 13px;
}
button:hover { border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  display: block; padding: 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); text-decoration: none; color: var(--ink);
}
.card:hover { border-color: var(--accent); }
.card strong { display: block; font-size: 16px; }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.q h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.prompt { margin: 0 0 12px; }
.q img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin-bottom: 12px; }
audio { width: 100%; margin-bottom: 14px; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%;
  padding: 10px 12px; line-height: 1.45;
}
.opt .letter { font-weight: 700; min-width: 1.2em; }
/* .correct/.wrong reflect what the reader picked. body.reveal layers the answer key on
   top of that, so it applies to answered and unanswered questions alike and lifts
   cleanly when toggled back off. */
.opt.correct,
body.reveal .opt[data-correct="1"] { background: var(--ok-bg); border-color: var(--ok-line); }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad-line); }
.opt .mark { margin-left: auto; font-weight: 700; }
.opt.correct .mark::after,
body.reveal .opt[data-correct="1"] .mark::after { content: "✓"; color: var(--ok-line); }
.opt.wrong .mark::after { content: "✗"; color: var(--bad-line); }
button[aria-pressed="true"] {
  background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-line); font-weight: 600;
}
button[aria-pressed="true"]:hover { border-color: var(--ok-line); }
.asset-error {
  margin: 0 0 14px; padding: 9px 11px; border-radius: 8px; font-size: 14px;
  background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--ink);
}
.nav { display: flex; gap: 12px; justify-content: space-between; margin-top: 28px; }
table.legend { border-collapse: collapse; font-size: 14px; }
table.legend td { padding: 2px 10px 2px 0; }
