
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #274c77;
  --accent-soft: #eaf1f8;
  --good: #1f7a4d;
  --good-soft: #e9f6ef;
  --bad: #9f2f2f;
  --bad-soft: #faecec;
  --warning: #8b5e13;
  --warning-soft: #fff6df;
  --shadow: 0 10px 30px rgba(21, 34, 50, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button, select { font: inherit; }

button { cursor: pointer; }

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 20px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.1;
}

h2 { line-height: 1.25; }

.eyebrow {
  margin-bottom: 6px;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
}

main {
  width: min(880px, calc(100% - 28px));
  margin: 36px auto 64px;
}

.site-footer {
  width: min(880px, calc(100% - 28px));
  margin: -36px auto 42px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 42px);
}

.hidden { display: none !important; }

.intro {
  max-width: 720px;
  margin-bottom: 30px;
}

.intro h2 { font-size: clamp(1.45rem, 3vw, 2rem); }

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.material-picker {
  margin: 0 0 18px;
  padding: 6px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.material-picker legend {
  padding: 0 6px;
  font-size: .88rem;
  font-weight: 700;
}

/* Wide enough for "Section 1.10" without wrapping, and auto-fill rather than a
   fixed count: the same rule gives five columns on a desktop and two on a phone,
   which keeps a nine-section bank from becoming a long scroll on mobile. */
.section-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 2px 14px;
}

.section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: .95rem;
  cursor: pointer;
}

.section-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.all-toggle {
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-empty-note {
  margin: 12px 0 0;
  color: var(--bad);
  font-size: .88rem;
}

.primary-button:disabled {
  cursor: default;
  opacity: .5;
}

label span {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  margin-bottom: 7px;
}

select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.setup-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.primary-button, .secondary-button, .answer-button {
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 11px 18px;
  font-weight: 750;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: white;
  border-color: var(--line);
  color: var(--text);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 4px 2px;
  font-weight: 700;
}

.privacy-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.weakness-note {
  margin-top: 22px;
  border-radius: 11px;
  padding: 12px 14px;
  background: var(--accent-soft);
  color: #28445f;
  font-size: .92rem;
}

.quiz-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  margin-right: 5px;
  font-size: .8rem;
  font-weight: 750;
}

.badge.muted {
  background: #f0f2f5;
  color: #5b6472;
}

.progress-text {
  color: var(--muted);
  font-size: .9rem;
  white-space: nowrap;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: #eef1f4;
  overflow: hidden;
  margin-bottom: 28px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s ease;
}

.question-card { min-height: 420px; }

#statement {
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  margin: 18px 0 30px;
  max-width: 760px;
}

.math-warning {
  max-width: 900px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--warning-soft);
  border: 1px solid #e6d08a;
  color: #6b5310;
  font-size: .92rem;
}

.app-warning {
  max-width: 900px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bad-soft);
  border: 1px solid #e0b4b4;
  color: #7a2626;
  font-size: .92rem;
}

.app-warning kbd {
  font: inherit;
  font-weight: 700;
  padding: 1px 6px;
  border: 1px solid #e0b4b4;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
}

.key-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.key-hint kbd {
  font: inherit;
  font-weight: 700;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
}

.why-key {
  display: inline-block;
  min-width: 1.4em;
  margin-right: 8px;
  color: var(--muted);
  font-weight: 700;
}

.scope-note {
  margin-top: 22px;
  color: var(--muted);
  font-size: .92rem;
}

#aboutDialog h3 {
  margin: 22px 0 4px;
  font-size: 1rem;
}

#aboutDialog h3:first-of-type {
  margin-top: 16px;
}

#aboutDialog p {
  margin: 0;
}

.tf-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 520px;
}

.answer-button {
  min-height: 58px;
  background: white;
  border-color: var(--line);
  font-size: 1.05rem;
}

.answer-button:hover:not(:disabled),
.why-choice:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.answer-button:disabled { cursor: default; opacity: .72; }

.answer-button.selected.correct {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}

.answer-button.selected.incorrect {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.verdict {
  margin-top: 20px;
  border-radius: 11px;
  padding: 12px 14px;
  font-weight: 750;
}

.verdict.good { background: var(--good-soft); color: var(--good); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
/* Right truth value, wrong reason: neither a pass nor a fail, and worth its own
   colour so the distinction registers. */
.verdict.mixed { background: var(--warning-soft); color: var(--warning); }

.why-area, .explanation {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.why-area h3, .explanation h3 { margin-bottom: 14px; }

.why-choices {
  display: grid;
  gap: 10px;
}

.why-choice {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: white;
  text-align: left;
}

.why-choice.correct {
  border-color: var(--good);
  background: var(--good-soft);
}

.why-choice.incorrect {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.explanation {
  font-size: 1rem;
}

.counterexample {
  margin-top: 15px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: #67450d;
}

.counterexample::before {
  content: "Example / counterexample: ";
  font-weight: 800;
}

.action-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

.text-button.subtle {
  opacity: .72;
  font-size: .92rem;
}

.text-button.subtle:hover {
  opacity: 1;
}

.report-context {
  font-size: .92rem;
  margin-bottom: 16px;
}

.report-context code {
  font-size: .85em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--warning-soft);
}

.report-statement {
  display: block;
  margin-top: 6px;
  padding-left: 12px;
  border-left: 3px solid var(--line);
}

.report-next {
  font-size: .95rem;
  margin-bottom: 14px;
}

.report-status {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warning-soft);
  font-size: .9rem;
  white-space: pre-wrap;
}

.question-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 30px;
}

.score-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 28px;
}

.score-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.score-box strong {
  display: block;
  font-size: 1.7rem;
}

.score-box span {
  color: var(--muted);
  font-size: .9rem;
}

.concept-summary {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.concept-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 2fr auto;
  gap: 12px;
  align-items: center;
  margin: 11px 0;
}

.concept-bar {
  height: 8px;
  border-radius: 999px;
  background: #eef1f4;
  overflow: hidden;
}

.concept-fill {
  height: 100%;
  background: var(--accent);
}

.concept-stat {
  color: var(--muted);
  font-size: .86rem;
}

dialog {
  width: min(680px, calc(100% - 30px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(20, 29, 40, .45); }

.dialog-close {
  float: right;
  border: 0;
  background: transparent;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--muted);
}

@media (max-width: 720px) {
  .header-inner { align-items: flex-start; }
  .setup-grid { grid-template-columns: 1fr; }
  .tf-controls { grid-template-columns: 1fr; }
  .question-card { min-height: unset; }
  .concept-row { grid-template-columns: 1fr; gap: 5px; }
  .score-summary { grid-template-columns: 1fr; }
}
