/* Shared stylesheet for every exam site. Each page sets --accent (light and dark) in <head>
   from its exam.json, so one file serves all exams. */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #1b1a18;
  --muted: #5f5b55;
  --border: rgba(0, 0, 0, 0.12);
  --right: #1d7a3e;
  --wrong: #b3261e;
  --accent: #0f6e66;
  --on-accent: #ffffff;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121413;
    --surface: #1b1e1d;
    --text: #ecebe8;
    --muted: #a7a39c;
    --border: rgba(255, 255, 255, 0.14);
    --right: #5cc489;
    --wrong: #f2857c;
    --on-accent: #0c1110;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--font);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); margin: 1.5rem 0 0.75rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 0.5rem; }
h3 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.lede { font-size: 1.1rem; color: var(--muted); }
.note { color: var(--muted); font-size: 0.95rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-head { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; text-decoration: none; color: var(--text); }
.brand span { font-weight: 500; color: var(--accent); }
.exam-chip { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.exam-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.exam-list a { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.exam-list strong { display: block; color: var(--accent); }
.exam-list span { color: var(--muted); }
.site-foot { margin-top: 4rem; border-top: 1px solid var(--border); padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: 0.875rem; }

.button {
  display: inline-block;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem/1.4 var(--font);
  text-decoration: none;
  cursor: pointer;
}
.button.secondary { background: transparent; color: var(--accent); }
.button:disabled { opacity: 0.4; cursor: default; }
.button:focus-visible, .choice:focus-within, .numeric input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Quiz */
.quiz { margin-top: 1.5rem; }
.q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.q-num { font-size: 0.95rem; color: var(--muted); margin: 0 0 0.5rem; }
.q-num:focus { outline: none; }
.q-num span { font-weight: 400; }
.q-prompt { font-size: 1.15rem; margin: 0 0 1rem; }
.q-choices { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
}
.choice-text { flex-shrink: 1; min-width: 0; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:checked) .choice-letter { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.numeric { display: grid; gap: 6px; }
.numeric-label { color: var(--muted); font-size: 0.95rem; }
.numeric-row { display: flex; align-items: center; gap: 10px; }
.numeric input {
  width: 12rem;
  max-width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 1.1rem var(--font);
}
.unit { color: var(--muted); }

.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz:not(.is-live) .quiz-nav { display: none; }
.quiz-progress { color: var(--muted); font-size: 0.9rem; text-align: center; flex-shrink: 1; }
.quiz-warn { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--wrong); color: var(--wrong); }

/* Results */
.quiz-results:focus { outline: none; }
.quiz-results h2 { margin-top: 0.5rem; }
.topic-area { margin: 1rem 0 0.25rem; font-weight: 600; color: var(--muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; }
.topic-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.topic-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.topic-name { flex-shrink: 1; min-width: 0; }
.topic-score { color: var(--muted); font-variant-numeric: tabular-nums; }
.topic-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.topic-bar span { display: block; height: 100%; background: var(--accent); }
.review { padding-left: 1.25rem; }
.review-item { margin-bottom: 12px; }
.review-item details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.review-item summary { cursor: pointer; }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; margin-right: 4px; }
.is-right .badge { color: var(--right); }
.is-wrong .badge { color: var(--wrong); }
.review-answer { margin: 0.5rem 0 0; }
.steps { margin: 0.75rem 0 0; padding-left: 1.25rem; }
.steps li { margin-bottom: 4px; }
