:root {
  color-scheme: light;
  --ink: #1b2a4a;
  --navy: #182847;
  --blue: #2b4d8f;
  --accent: #a8324a;
  --paper: #faf9f6;
  --muted: #5a6475;
  --line: #dedfdc;
  --green: #246246;
  --white: #fff;
  font: 16px/1.55 system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
.shell { width: min(100% - 40px, 1100px); margin-inline: auto; }
.masthead { background: var(--white); border-bottom: 1px solid var(--line); }
.masthead::before { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--blue) 33.33%, #fff 33.33% 66.66%, var(--accent) 66.66%); }
.top { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 760; text-decoration: none; }
.brand img { border-radius: 9px; }
nav { display: flex; gap: 7px; flex-wrap: wrap; }
nav a { display: block; padding: 9px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: .91rem; font-weight: 650; }
nav a[aria-current] { background: #eaf0fb; color: var(--blue); }
main { padding-block: 32px 36px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1, h2 { font-family: Georgia, serif; }
h1 { font-size: clamp(2rem, 5vw, 3.45rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.35rem, 2.8vw, 1.8rem); letter-spacing: -.02em; }
h3 { font-size: 1.05rem; }
p { margin: .45em 0 0; }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button, select, .button { min-height: 44px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: .65em 1em; border-radius: 9px; border: 1px solid var(--line);
  background: var(--white); color: var(--ink); cursor: pointer; font-weight: 680; text-decoration: none;
}
button:hover, .button:hover { border-color: var(--blue); }
button:disabled { opacity: .53; cursor: default; }
:focus-visible { outline: 3px solid #5079c4; outline-offset: 4px; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.primary:hover { background: #8f2940; border-color: #8f2940; }
.quiet { background: transparent; border-color: transparent; color: var(--blue); }
.skip { position: absolute; z-index: 5; top: 0; left: 12px; padding: 10px; background: white; transform: translateY(-125%); }
.skip:focus { transform: translateY(0); }
.hero {
  padding: clamp(24px, 5vw, 50px); border-radius: 20px; background: var(--navy); color: white;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .36fr); gap: 25px; align-items: end;
  background-image: radial-gradient(ellipse at 100% 0%, #355189, transparent 67%);
}
.hero p { color: #dbe4f6; max-width: 50ch; margin-top: 14px; }
.hero-score { border-left: 1px solid #8192b566; padding-left: clamp(16px, 3vw, 30px); }
.hero-score strong { display: block; font: 2.75rem/1 Georgia, serif; letter-spacing: -.045em; margin-block: 3px 8px; }
.hero-score small { display: block; color: #dbe4f6; margin-top: 8px; }
progress { appearance: none; display: block; width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 8px; background: #e7ebf2; accent-color: var(--blue); }
progress::-webkit-progress-bar { background: #e7ebf2; }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }
.hero progress, .hero progress::-webkit-progress-bar { background: #60759c; }
.hero progress::-webkit-progress-value { background: #fff; }
.hero progress::-moz-progress-bar { background: #fff; }
.block { margin-top: 28px; }
.levels, .review, .metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 13px; }
.level { display: block; padding: 13px 16px; width: 100%; text-align: left; }
.level strong { display: block; font-size: 1rem; }
.level small { display: block; color: var(--muted); font-weight: 500; }
.level[aria-pressed=true] { background: #eef3fd; box-shadow: inset 0 0 0 1px var(--blue); border-color: var(--blue); }
.modes { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.card, .quiz-card { background: var(--white); border: 1px solid var(--line); border-radius: 15px; padding: clamp(15px, 3vw, 24px); }
.card > .button, .card > button, .card > .actions { margin-top: 14px; }
.muted, .meta { color: var(--muted); }
.meta, small { font-size: .88rem; }
.topic-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; margin-top: 16px; }
label { font-weight: 650; }
select { display: block; max-width: 100%; width: 100%; padding: 8px; background: white; border: 1px solid #a6aebd; border-radius: 8px; color: var(--ink); }
label select { margin-top: 5px; }
.review button { text-align: left; justify-content: space-between; padding: 13px 15px; }
.count { font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 6px; background: #eef2f9; color: var(--blue); }
.resume { border-left: 4px solid var(--blue); }
.narrow { width: min(100%, 760px); margin-inline: auto; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-card { margin-top: 17px; }
.quiz-card h1 { font-size: clamp(1.5rem, 4vw, 2.35rem); line-height: 1.17; margin-block: 13px 20px; }
.badge { display: inline-block; font-size: .8rem; font-weight: 730; border-radius: 6px; padding: 4px 8px; background: #eaf0fb; color: var(--blue); }
.badge.extra { background: #faf0ed; color: #853747; }
.quiz-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.answers { display: grid; gap: 9px; }
.option { min-height: 52px; justify-content: flex-start; text-align: left; font-weight: 560; }
.option span { display: grid; place-items: center; min-width: 29px; height: 29px; border-radius: 8px; background: #eef2f9; color: var(--blue); }
.option[aria-pressed=true] { background: #eef3fd; border-color: var(--blue); }
.option:disabled { opacity: 1; }
.option.correct, .feedback.good { border-color: #69a18a; background: #eaf6ef; }
.option.incorrect, .feedback.bad { border-color: #ca8490; background: #fcf0f2; }
.feedback { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quiz-card .actions { margin-top: 18px; }
.push { margin-left: auto; }
.clock { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); }
.pager { display: flex; flex-wrap: wrap; gap: 5px; margin-block: 16px; }
.pager button { min-width: 44px; padding-inline: 6px; }
.pager .done { background: #eaf0fb; }
.pager [aria-current] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.score { font: 3rem/1.2 Georgia, serif; }
.metrics .card strong { display: block; font: 2rem/1.15 Georgia, serif; }
.stat-list, .history { display: grid; gap: 10px; margin-block: 13px; }
.theme-stat { display: grid; gap: 7px; }
details summary { font-weight: 700; cursor: pointer; }
details .meta { margin-top: 7px; }
.filter { max-width: 370px; margin-top: 15px; }
.source-list { display: grid; gap: 8px; padding-left: 20px; }
.footer { display: flex; gap: 12px 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; padding-block: 17px max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
#notice { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); inset-inline: 16px; max-width: 530px; margin-inline: auto; border-radius: 10px; padding: 14px; color: white; background: var(--navy); box-shadow: 0 8px 25px #1b2a4a30; z-index: 4; }
@media (max-width: 700px) {
  .shell { width: calc(100% - 28px); }
  .top { align-items: flex-start; flex-direction: column; padding-block: 12px 9px; gap: 7px; }
  main { padding-top: 19px; }
  .hero, .modes { grid-template-columns: 1fr; gap: 12px; }
  .hero-score { border-left: 0; border-top: 1px solid #8192b566; padding: 12px 0 0; }
  .hero-score strong { font-size: 2rem; }
  .levels { gap: 6px; }
  .level { padding: 10px 7px; overflow-wrap: anywhere; }
  .review { grid-template-columns: 1fr; }
  .topic-form { grid-template-columns: 1fr; }
  .topic-form button { justify-self: start; }
  .metrics { gap: 6px; }
  .metrics .card { padding: 10px; }
}
