:root {
  color-scheme: light;
  --navy: #152744;
  --ink: #192b49;
  --blue: #264e92;
  --blue-dark: #1b396d;
  --red: #ab3048;
  --red-dark: #8f243b;
  --paper: #f8f7f4;
  --white: #fff;
  --muted: #52617a;
  --line: #dce2eb;
  --control: #8594ab;
  --wash: #edf3fd;
  --shadow: 0 8px 24px #172c4d09;
  font: 16px/1.55 system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--blue); text-underline-offset: .2em; }
p { margin: .5rem 0 0; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1, h2 { font-family: Georgia, 'Times New Roman', serif; line-height: 1.12; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.85rem); letter-spacing: -.048em; }
h2 { font-size: clamp(1.45rem, 2.45vw, 1.9rem); letter-spacing: -.032em; }
h3 { font-size: 1.1rem; line-height: 1.3; }
small, .small { font-size: .87rem; }
.muted { color: var(--muted); }

.shell { width: min(100% - 48px, 1120px); margin-inline: auto; }
.top { background: var(--white); border-bottom: 1px solid var(--line); }
.top::before {
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0 43%, #f1f3f7 43% 68%, var(--red) 68%);
  content: "";
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; }
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.1;
  text-decoration: none;
}
.brand img { border-radius: 10px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font: 650 .75rem/1.2 system-ui, sans-serif; letter-spacing: 0; }
nav { display: flex; flex-wrap: wrap; gap: 5px; }
nav a {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding-inline: 13px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 690;
  font-size: .91rem;
}
nav a:hover, nav a[aria-current] { color: var(--blue-dark); background: var(--wash); }
#install-link { color: var(--blue-dark); box-shadow: inset 0 0 0 1px var(--line); }
main { padding-block: 28px 44px; }
.narrow { max-width: 780px; margin-inline: auto; }
.narrow > h1 { margin-bottom: 12px; }

.skip { position: absolute; top: 0; left: 10px; z-index: 5; transform: translateY(-125%); padding: 10px; background: white; }
.skip:focus { transform: none; }
:focus-visible { outline: 3px solid #5175bc; outline-offset: 3px; }
button, input, select { font: inherit; }
button, .button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 9px;
  border: 1px solid var(--control);
  background: var(--white);
  color: var(--ink);
  font-weight: 690;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { border-color: var(--blue); background: var(--wash); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--blue); border-color: var(--blue); color: white; }
.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.exam-button { background: var(--red); border-color: var(--red); }
.exam-button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.quiet { border-color: transparent; background: transparent; color: var(--blue-dark); }
.quiet:hover { border-color: transparent; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, .44fr);
  align-items: center;
  gap: clamp(20px, 5vw, 58px);
  padding: clamp(27px, 4.7vw, 54px);
  border-radius: 22px;
  color: white;
  background: radial-gradient(ellipse at 100% 10%, #315384, transparent 74%), var(--navy);
}
.hero p { color: #e3eafa; max-width: 53ch; margin-top: 12px; }
.home-hero { padding-block: clamp(24px, 3vw, 38px); }
.home-hero h1 { max-width: 20ch; font-size: clamp(2.15rem, 4vw, 3.4rem); text-wrap: pretty; }
.home-hero::after {
  position: absolute;
  z-index: -1;
  width: 470px;
  height: 470px;
  right: -115px;
  bottom: -344px;
  border: 1px solid #c7dafd37;
  box-shadow: 0 0 0 25px #c7dafd14, 0 0 0 50px #c7dafd0d, 0 0 0 75px #c7dafd0a;
  border-radius: 50%;
  content: "";
}
.hero-metric {
  display: grid;
  gap: 7px;
  padding: 19px 20px;
  border: 1px solid #c0d5f05c;
  border-radius: 14px;
  background: #fff1;
  color: white;
  text-decoration: none;
}
.hero-metric:hover { background: #fff2; }
.hero-metric:focus-visible { outline-color: white; }
.metric-title { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; font-weight: 720; }
.hero-metric strong, .score { display: block; font: clamp(2.45rem, 4.4vw, 3.75rem)/1 Georgia, serif; letter-spacing: -.065em; }
.hero-metric strong span { color: #d6e2f7; font: 500 clamp(1rem, 2vw, 1.35rem)/1 system-ui, sans-serif; letter-spacing: 0; }
progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  color: var(--blue);
  background: #e5ebf4;
}
progress::-webkit-progress-bar { background: #e5ebf4; }
progress::-webkit-progress-value { border-radius: 20px; background: var(--blue); }
progress::-moz-progress-bar { border-radius: 20px; background: var(--blue); }
.hero progress, .hero progress::-webkit-progress-bar { background: #ffffff49; }
.hero progress::-webkit-progress-value { background: white; }
.hero progress::-moz-progress-bar { background: white; }

.block { margin-top: 24px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card, .edition-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  padding: clamp(17px, 2.7vw, 27px);
  box-shadow: var(--shadow);
}
.edition-panel {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: start;
  gap: 18px;
  padding-block: 14px;
}
.edition-help { margin-top: 3px; }
summary { width: fit-content; min-height: 36px; padding-block: 7px; color: var(--blue-dark); font-weight: 680; cursor: pointer; }
.edition-help .actions { align-items: end; }
.editions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.narrow > .editions { margin-top: 15px; }
.edition {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  padding: 9px 37px 10px 13px;
  text-align: left;
}
.edition::after {
  position: absolute;
  right: 13px;
  top: 13px;
  width: 14px;
  height: 14px;
  border: 1px solid var(--control);
  border-radius: 50%;
  background: var(--white);
  content: "";
}
.edition strong { display: block; font-size: 1.12rem; font-weight: 770; line-height: 1.25; letter-spacing: -.025em; }
.edition span { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; font-weight: 550; }
.edition[aria-pressed=true] { border-color: var(--blue); background: var(--wash); color: var(--blue-dark); box-shadow: inset 0 0 0 1px var(--blue); }
.edition[aria-pressed=true]::after { border-color: var(--blue); box-shadow: inset 0 0 0 3px white; background: var(--blue); }

.study-grid { gap: 18px; }
.study-card { display: flex; flex-direction: column; gap: 11px; padding-block: 20px; }
.study-card header { min-height: 62px; }
.study-subtitle { color: var(--muted); }
.exam-card { border-top: 3px solid var(--red); }
.study-card:not(.exam-card) { border-top: 3px solid var(--blue); }
.exam-card .study-subtitle { color: var(--ink); font-weight: 700; }
.exam-formats { margin: 0; border: 0; min-width: 0; padding: 0; }
label, legend { font-size: .92rem; font-weight: 700; }
label { display: block; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
.format-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.format-option { position: relative; }
.format-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.format-option span {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 6px 3px;
  border: 1px solid var(--control);
  border-radius: 9px;
  text-align: center;
}
.format-option input:hover + span, .format-option input:checked + span { border-color: var(--blue); background: var(--wash); color: var(--blue-dark); }
.format-option input:checked + span { box-shadow: inset 0 0 0 1px var(--blue); }
.format-option input:focus-visible + span { outline: 3px solid #5175bc; outline-offset: 2px; }
.session-options { display: flex; flex-wrap: wrap; gap: 3px 16px; }
.session-option { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
.session-option input { flex-shrink: 0; }
.session-option small { display: block; font-weight: 500; }

select, input[type=text], input[type=date] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 45px;
  margin-top: 5px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--control);
  background: white;
  color: var(--ink);
  font-size: 1rem;
}
input[type=checkbox] { width: 18px; height: 18px; vertical-align: middle; accent-color: var(--blue); margin: 0 5px 2px 0; }
.filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.5fr); gap: 10px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.study-actions { margin-top: auto; padding-top: 4px; }
.study-actions button { justify-content: space-between; text-align: left; width: 100%; padding-inline: 15px; min-height: 48px; }
.study-actions button span { font-size: 1.2em; line-height: 1; }
.dashboard-options { display: flex; gap: 10px 15px; align-items: start; justify-content: space-between; margin-top: 10px; }
.dashboard-links { display: flex; gap: 3px; flex-wrap: wrap; }
.special-option label { margin-top: 8px; }
.special-option summary { min-height: 44px; padding-block: 11px; }
.special-option p { max-width: 54ch; margin-top: 0; }
.resume-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--wash);
}

.quiz { margin-top: 15px; }
.quiz-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 12px; }
.quiz-meta .quiet { margin-left: -10px; }
.quiz-meta-end { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.countdown {
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--blue-dark);
  background: var(--wash);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.countdown.urgent { color: var(--red-dark); background: #fdf0f2; }
.quiz-label { color: var(--blue-dark); font-size: .88rem; font-weight: 730; }
.quiz h1 { font-size: clamp(1.8rem, 4.8vw, 2.85rem); letter-spacing: -.037em; text-wrap: pretty; }
.quiz-score { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-block: 11px 4px; font-weight: 700; }
.question-text { margin-top: 4px; }
.question-text summary { min-height: 44px; font-size: .87rem; }
.question-text p { margin-top: 0; }
#written-answer { padding-top: 16px; border-top: 1px solid var(--line); }
#written-answer input { min-height: 52px; }
.answer { border: 1px solid #c5d5ed; border-left: 4px solid var(--blue); background: var(--wash); padding: 14px 16px; border-radius: 10px; margin-top: 17px; overflow-wrap: anywhere; }
.answer p:first-child { margin-top: 0; }
.answer p + h2 { margin-top: 12px; }
.answer ul { padding-left: 1.2em; margin: .55rem 0; }
#preferred-combination label { margin-top: 8px; }
.answer-status { color: var(--blue-dark); }
.choices { display: grid; gap: 8px; margin-top: 14px; }
.choice { justify-content: flex-start; text-align: left; min-height: 50px; }
.choice:disabled { opacity: 1; }
.choice.correct { color: var(--blue-dark); background: var(--wash); border-color: var(--blue); }
.choice.incorrect { color: var(--red-dark); background: #fdf0f2; border-color: #bd6c7e; }
.bad { color: var(--red-dark); }
.result-hero { grid-template-columns: minmax(0, 1fr) auto; }
.record { padding: 10px 0; }
.record:not(:last-child) { border-bottom: 1px solid var(--line); }
.theme-card progress { margin-top: 12px; }
.update-panel button { margin-bottom: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.notice {
  position: fixed;
  z-index: 4;
  bottom: max(15px, env(safe-area-inset-bottom));
  inset-inline: 12px;
  max-width: 500px;
  margin-inline: auto;
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--navy);
  color: white;
}

@media (max-width: 730px) {
  .shell { width: calc(100% - 32px); }
  main { padding-top: 18px; }
  .bar { flex-direction: column; align-items: stretch; justify-content: center; gap: 7px; padding-block: 10px 7px; }
  .brand { align-self: flex-start; }
  .brand img { width: 36px; height: 36px; }
  nav { justify-content: space-between; }
  nav a { padding-inline: 8px; font-size: .85rem; }
  .hero, .grid, .edition-panel { grid-template-columns: minmax(0, 1fr); }
  .hero { gap: 16px; border-radius: 17px; padding: 23px; }
  .home-hero { gap: 13px; padding: 19px; }
  .home-hero h1 { max-width: none; font-size: clamp(1.85rem, 8vw, 2.35rem); }
  .home-hero p { margin-top: 7px; }
  .hero-metric { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 10px; padding: 12px 14px; }
  .metric-title { justify-content: start; }
  .hero-metric strong { font-size: 1.85rem; }
  .hero-metric progress { grid-column: 1 / -1; }
  .edition-panel { gap: 6px; }
  .edition-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 7px; }
  .edition-heading h2 { font-size: 1.25rem; }
  .edition-help { margin-top: 0; }
  .edition-help[open] { flex-basis: 100%; }
  .study-card header { min-height: 0; }
  .dashboard-options { flex-wrap: wrap; gap: 2px; }
  .dashboard-links .quiet { padding-inline: 6px; }
  .block { margin-top: 17px; }
}

@media (max-width: 350px) {
  .shell { width: calc(100% - 22px); }
  nav { gap: 1px; }
  nav a { padding-inline: 6px; font-size: .8rem; }
  .format-option span { font-size: .83rem; }
}
