:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #657086;
  --paper: #f4f6f9;
  --card: #ffffff;
  --line: #dfe4eb;
  --blue: #285bd4;
  --blue-dark: #1845b2;
  --green: #18794e;
  --green-bg: #e9f7ef;
  --amber: #8a5600;
  --amber-bg: #fff3cf;
  --red: #a23434;
  --red-bg: #fdecec;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.55; }
.site-header { height: 64px; padding: 0 max(24px, calc((100vw - 980px) / 2)); background: #10172a; color: white; display: flex; align-items: center; justify-content: space-between; }
.brand { color: white; text-decoration: none; font-weight: 800; letter-spacing: .03em; }
.user-menu { display: flex; gap: 16px; align-items: center; font-size: .9rem; }
.user-menu form { margin: 0; }
.link-button { color: white; background: transparent; border: 0; text-decoration: underline; cursor: pointer; }
.page { width: min(940px, calc(100% - 32px)); margin: 46px auto 80px; }
.hero { margin-bottom: 24px; }
.hero h1, .question-card h1 { margin: 5px 0 10px; line-height: 1.2; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.eyebrow { color: var(--blue); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 4vw, 38px); box-shadow: 0 10px 30px rgba(27, 39, 70, .05); }
.narrow { max-width: 480px; margin: 80px auto; }
.stack { display: grid; gap: 18px; }
.start-form fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.start-form legend { font-weight: 800; margin-bottom: 10px; }
.choice-grid ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice-grid label { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; background: #fbfcfe; }
.field-grid { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 14px; align-items: end; }
label { font-weight: 650; }
.field-grid > label { display: block; }
select, input[type=text], input[type=password], input[type=number], textarea { width: 100%; padding: 12px 14px; margin-top: 6px; border: 1px solid #bfc8d7; border-radius: 10px; background: white; color: var(--ink); font: inherit; }
textarea { resize: vertical; }
.primary { display: inline-flex; justify-content: center; align-items: center; width: fit-content; padding: 12px 20px; border: 0; border-radius: 10px; background: var(--blue); color: white; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.primary:hover { background: var(--blue-dark); }
.button { margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 22px; }
.stats div { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stats strong, .stats span { display: block; }
.stats strong { font-size: 1.35rem; }
.stats span { color: var(--muted); font-size: .78rem; }
.stats-pair { grid-template-columns: repeat(2, 1fr); max-width: 620px; }
.result-summary h2 { margin: 0 0 12px; font-size: 1.05rem; }
.result-summary h2 + .stats { margin-bottom: 26px; }
.mode-help { color: var(--muted); font-size: .9rem; margin: 18px 0; }
.mode-help p { margin: 4px 0; }
.quality-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.badge { display: inline-block; padding: 5px 9px; background: #edf0f5; border-radius: 999px; color: #46516a; font-size: .76rem; font-weight: 700; }
.confidence-confirmed { color: var(--green); background: var(--green-bg); }
.confidence-probable, .confidence-unconfirmed { color: var(--amber); background: var(--amber-bg); }
.confidence-legacy, .confidence-conflict { color: var(--red); background: var(--red-bg); }
.options { display: grid; gap: 10px; }
.options label { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 15px; cursor: pointer; }
.options input { margin-top: 5px; }
sub { font-size: .72em; line-height: 0; vertical-align: sub; }
.progress { height: 7px; border-radius: 8px; background: #dce2ec; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--blue); }
.notice, .basis { border-left: 4px solid #e0a100; background: #fff8df; padding: 12px 14px; }
.verdict { border-radius: 12px; padding: 14px; font-weight: 800; margin: 18px 0; }
.verdict.correct { color: var(--green); background: var(--green-bg); }
.verdict.wrong { color: var(--red); background: var(--red-bg); }
.self-assessment #id_self_assessment { display: grid; gap: 8px; }
.self-assessment #id_self_assessment > div > label { display: block; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.self-assessment label:has(input[value="knew"]) { color: var(--green); background: var(--green-bg); border-color: #b8dfc9 !important; }
.self-assessment label:has(input[value="partial"]) { color: var(--amber); background: var(--amber-bg); border-color: #efd88e !important; }
.self-assessment label:has(input[value="did_not_know"]) { color: var(--red); background: var(--red-bg); border-color: #efc2c2 !important; }
.self-assessment input[value="knew"] { accent-color: var(--green); }
.self-assessment input[value="partial"] { accent-color: var(--amber); }
.self-assessment input[value="did_not_know"] { accent-color: var(--red); }
.self-assessment label:has(input:checked) { outline: 2px solid currentColor; outline-offset: 1px; }
.your-answer, .answer-box { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.answer-box h2 { font-size: 1rem; margin: 20px 0 5px; }
.learning-text p { margin: 7px 0; }
.learning-text ul, .learning-text ol { margin: 8px 0 14px; padding-left: 25px; }
.learning-text li { margin: 5px 0; }
.eli12 { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 16px; }
.eli12 summary { cursor: pointer; font-weight: 700; color: var(--blue); }
.eli12[open] summary { margin-bottom: 14px; }
.eli12-label { margin: 0 0 10px; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.summary-list { padding-left: 22px; }
.summary-list li { margin: 0 0 14px; padding-left: 5px; }
.summary-list small { display: block; color: var(--muted); }
.correct-text::marker { color: var(--green); }
.wrong-text::marker { color: var(--red); }
.message { margin-bottom: 16px; padding: 12px; border-radius: 10px; background: var(--amber-bg); }
.errorlist { color: var(--red); }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .choice-grid ul, .field-grid { grid-template-columns: 1fr; }
  .page { margin-top: 24px; }
}
