:root {
  color-scheme: light;
  --bg: #faf8ef;
  --paper: #fffdf7;
  --ink: #181c2f;
  --muted: #535364;
  --line: #d8d4c6;
  --accent: #3034c9;
  --accent-dark: #24279f;
  --highlight: #eeeecf;
  --accent-soft: #eae9ff;
  --green: #165b41;
  --green-soft: #e2efde;
  --red: #852e32;
  --red-soft: #f9e6de;
  --radius: 8px;
  --heading: Georgia, "Times New Roman", serif;
  font-family: "Inter", "Aptos", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -.042em; }
h1 { font: 500 clamp(2.7rem, 5.2vw, 4.6rem)/.99 var(--heading); letter-spacing: -.057em; }
h2 { font-size: clamp(1.42rem, 2.7vw, 2rem); font-weight: 740; }
h3 { font-size: 1.26rem; font-weight: 760; }
p + p { margin-top: .75rem; }
a { color: var(--accent-dark); text-underline-offset: .21em; }
a, button { touch-action: manipulation; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
.skip { position: fixed; top: 12px; left: 12px; z-index: 20; transform: translateY(-160%); background: white; padding: 12px; }
.skip:focus { transform: none; }
.shell { width: min(100% - 64px, 1280px); min-height: 100dvh; margin-inline: auto; }
.topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: clamp(16px, 3vw, 48px); align-items: center; min-height: 72px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .56rem; width: fit-content; color: var(--ink); text-decoration: none; font-size: 1.42rem; font-weight: 780; letter-spacing: -.055em; white-space: nowrap; }
.logo { display: inline-block; width: .9em; height: 1.05em; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%); border-radius: 2px 2px 0 0; }
.topbar nav { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; column-gap: clamp(8px, 2.2vw, 31px); }
.nav-link { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; white-space: nowrap; font-weight: 690; min-height: 44px; padding: 5px 2px; position: relative; }
.nav-link:hover { color: var(--accent-dark); }
.nav-link[aria-current] { color: var(--accent-dark); }
.nav-link[aria-current]::after { position: absolute; content: ""; height: 3px; border-radius: 1px; background: var(--accent); inset: auto 2px 1px; }
.nav-link .icon, .nav-short { display: none; }
.icon { width: 1.16em; height: 1.16em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
main { width: min(100%, 1120px); min-width: 0; margin-inline: auto; padding: 40px 0 80px; }
main:focus, #question-title:focus, #answer-feedback:focus { outline: none; }
.page { animation: enter .23s ease-out both; }
@keyframes enter { from { opacity: .7; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.page-head { margin: 0 0 32px; }
.page-head h1 { margin-top: 6px; }
.page-head p { margin-top: .8rem; max-width: 72ch; }
.kicker, .meta { color: var(--muted); font-size: .94rem; }
.kicker { font-weight: 700; }
[data-view="home"] main { padding-top: 6px; }
.section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-head a { font-weight: 660; }
.subject-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px clamp(36px, 7vw, 108px); }
.subject-group h3 { margin-bottom: 12px; font-size: 1.04rem; letter-spacing: 0; color: var(--accent-dark); }
.course-list { padding: 0; margin: 0; list-style: none; border-bottom: 1px solid var(--line); }
.course-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) max-content 16px; gap: .62rem; align-items: center; min-height: 62px; padding: 5px 2px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.course-row:hover strong { color: var(--accent-dark); text-decoration: underline; text-underline-offset: .22em; }
.course-row strong { font-weight: 690; line-height: 1.24; letter-spacing: -.015em; }
.course-icon, .course-arrow { color: var(--accent-dark); }
.course-icon { display: flex; }
.course-date { color: var(--muted); line-height: 1.2; text-align: right; white-space: nowrap; font-size: .94rem; }
.course-completed { display: block; font-size: .84rem; font-variant-numeric: tabular-nums; margin-top: 3px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card { display: grid; align-content: start; gap: 10px; min-width: 0; padding: 16px 0 12px; border-top: 1px solid var(--line); }
.card .actions { margin-top: 2px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: .48em; min-height: 46px; border: 1px solid transparent; border-radius: 7px; padding: .63rem .95rem; background: var(--accent); color: white; font-weight: 690; text-align: center; line-height: 1.18; text-decoration: none; transition: background .15s; }
.button:not(:disabled):hover { background: var(--accent-dark); }
.button:disabled { opacity: .54; }
.button.primary-action { padding-inline: 1.12rem; }
.button.secondary { border-color: #9c9fb1; color: var(--ink); background: transparent; }
.button.quiet { color: var(--accent-dark); background: transparent; }
.button.secondary:not(:disabled):hover, .button.quiet:not(:disabled):hover { background: var(--accent-soft); }
.button.small { min-height: 42px; padding-block: .45rem; font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.badge { display: inline-flex; width: fit-content; color: var(--muted); font-size: .92rem; font-weight: 680; }
.badge.annale { color: var(--green); }
.badge.generated { color: var(--accent-dark); }
.badge.check { color: #74420c; }
.badge.excluded { color: var(--red); }
.panel { padding: 20px 0 24px; min-width: 0; border-top: 1px solid var(--line); }
.panel + .panel { margin-top: 18px; }
.panel > h2, .panel > h3 { margin-bottom: 12px; }
.note { padding: .6rem 1rem; border-left: 3px solid #aeb77e; background: var(--highlight); }
.list { display: grid; padding: 0; margin: 0; list-style: none; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: .75rem 0; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item p { color: var(--muted); margin-top: .25rem; }
.list-item strong { display: block; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(230px, .75fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.filter-bar { padding: 0 0 20px; margin: 0 0 14px; display: grid; gap: 16px; }
.practice-exam { margin: 0 0 24px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.exam-level { max-width: 340px; }
label.field { display: grid; gap: 6px; font-weight: 680; min-width: 0; }
select, input[type="number"], textarea { width: 100%; min-height: 46px; padding: .62rem .72rem; border: 1px solid #8e93a0; border-radius: 8px; background: var(--paper); color: var(--ink); font-weight: 480; }
textarea { min-height: 234px; resize: vertical; line-height: 1.65; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #535f73 50%), linear-gradient(135deg, #535f73 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 11px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 29px; text-overflow: ellipsis; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; margin-bottom: 8px; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button { padding: .45rem .72rem; background: transparent; border: 1px solid var(--line); border-radius: 8px; font-weight: 620; color: var(--ink); min-height: 42px; }
.segmented button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.check-line { display: inline-flex; gap: .5rem; align-items: center; }
.check-line input { width: 19px; height: 19px; accent-color: var(--accent); }
.training-routes { display: grid; max-width: 720px; }
.training-route { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 24px 0; }
.settings-route { display: grid; align-items: start; justify-content: stretch; gap: 15px; }
.feedback-setting { display: flex; width: fit-content; max-width: 100%; align-items: center; gap: .9rem; min-height: 46px; font-weight: 650; line-height: 1.27; cursor: pointer; }
.panel > .feedback-setting { margin-top: 12px; }
.feedback-setting input { appearance: none; position: relative; flex: none; width: 43px; height: 24px; margin: 0; padding: 0; border: 1px solid #767486; border-radius: 999px; background: var(--paper); cursor: pointer; transition: background .16s, border-color .16s; }
.feedback-setting input::after { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3.5px; border-radius: 50%; background: #646279; transition: transform .16s; }
.feedback-setting input:checked { background: var(--accent); border-color: var(--accent); }
.feedback-setting input:checked::after { transform: translateX(19px); background: #fff; }
@media (forced-colors: active) {
  .feedback-setting input { appearance: auto; width: 21px; height: 21px; }
  .feedback-setting input::after { display: none; }
}
[data-view="session"] main { padding-top: 24px; }
.session-wrap { max-width: 840px; margin-inline: auto; }
.session-wrap.quiz-exam { max-width: 1050px; }
.quiz-exam .question-layout { display: grid; grid-template-columns: minmax(0, 1fr) 188px; align-items: start; gap: clamp(24px, 5vw, 54px); }
.question-index { position: sticky; top: 24px; display: block; border-left: 1px solid var(--line); padding-left: 16px; }
.question-index h3 { font-size: 1rem; letter-spacing: 0; margin-bottom: 10px; }
.index-numbers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.index-number { display: grid; place-items: center; min-height: 30px; border: 0; border-radius: 4px; padding: 1px; color: var(--muted); background: transparent; font-size: .9rem; font-variant-numeric: tabular-nums; }
.index-number:hover, .index-number[data-answered] { color: var(--accent-dark); background: var(--accent-soft); }
.index-number[aria-current] { color: #fff; background: var(--accent); font-weight: 740; }
.session-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.session-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .55rem 1rem; font-weight: 670; }
.session-top { margin-bottom: 32px; }
.timer { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 58px; color: var(--accent-dark); }
.progress { display: block; width: 100%; height: 6px; overflow: hidden; }
.line-progress { background: #e2e4d8; border-radius: 9px; }
.line-progress::-webkit-progress-bar { background: var(--line); }
.line-progress::-webkit-progress-value { background: var(--accent); }
.line-progress::-moz-progress-bar { background: var(--accent); }
.step-progress { display: flex; gap: 4px; }
.step-progress span { flex: 1; border-radius: 4px; background: #e1e2d7; }
.step-progress .now { background: var(--accent); }
.step-progress .done { background: #67a579; }
.step-progress .seen { background: #a5a9bd; }
.step-progress .missed { background: #d98b71; }
.question h2 { font-size: clamp(1.48rem, 2.45vw, 2.13rem); margin: .7rem 0 1rem; line-height: 1.2; letter-spacing: -.028em; }
.question-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 14px; }
.question-subject { font-weight: 740; }
.question-context { margin: 0 0 20px; padding-left: 15px; border-left: 2px solid #a09ccc; max-width: 76ch; font-size: 1.04rem; line-height: 1.62; }
.choice-list { display: grid; margin-top: 18px; border-bottom: 1px solid var(--line); }
.answer-row { display: flex; align-items: stretch; gap: 3px; border-top: 1px solid var(--line); }
.choice { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 14px; padding: 13px 10px; min-height: 54px; text-align: left; background: transparent; border: 0; color: var(--ink); line-height: 1.48; transition: background .14s; }
.choice:not(:disabled):hover { background: var(--paper); }
.choice[aria-pressed="true"], .choice[aria-pressed="true"]:not(:disabled):hover { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.choice .letter { flex: none; min-width: 1.25rem; text-align: center; color: var(--accent-dark); font-weight: 760; }
.choice:disabled { cursor: default; }
.choice.good { background: var(--green-soft); color: var(--green); box-shadow: inset 3px 0 #447f5b; }
.choice.bad { background: var(--red-soft); color: var(--red); box-shadow: inset 3px 0 #9c453d; }
.choice.good .letter, .choice.bad .letter { color: inherit; }
.strike-choice { display: grid; min-width: 42px; place-items: center; color: var(--muted); border: 0; padding: .15rem; background: transparent; }
.strike-choice:hover, .strike-choice[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.eliminated .choice { background: transparent; color: var(--muted); }
.eliminated .choice span:last-child { text-decoration: line-through; text-decoration-color: #7d827e; }
.answer-saved { margin-top: 15px; color: var(--muted); }
.question-actions { justify-content: space-between; margin-top: 20px; }
.answered-actions { justify-content: end; }
.feedback { margin-top: 20px; padding: 16px 20px; border-left: 4px solid var(--accent); background: var(--accent-soft); animation: enter .2s ease-out both; }
.feedback.good { background: var(--green-soft); border-color: #5a956d; }
.feedback.bad { background: var(--red-soft); border-color: #b36151; }
details summary { cursor: pointer; font-weight: 700; }
.hint, .figure-hint, .comparison { margin-top: 12px; }
.hint summary, .figure-hint summary, .comparison summary { color: var(--accent-dark); }
.hint p, .figure-hint p { padding: .35rem .66rem; margin-top: 4px; border-left: 2px solid #8991cd; }
.comparison dl { display: grid; gap: 10px; margin: 12px 0; }
.comparison dl > div { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; gap: 8px; }
.comparison dt { font-weight: 760; }
.comparison dd { margin: 0; }
.course-evidence { margin: 18px 0 12px; padding-top: 14px; border-top: 1px solid #bcbdb0; }
.course-evidence h3 { margin-bottom: 10px; }
.course-passage + .course-passage { margin-top: 12px; }
.course-passage blockquote { margin: .4rem 0 0; border-left: 2px solid #8a9379; padding-left: 12px; white-space: pre-line; overflow-wrap: anywhere; }
.course-passage .button { padding-inline: 0; min-height: 38px; }
.selected-passage { background: var(--highlight); border-left: 4px solid var(--accent); padding: 8px 12px; scroll-margin-block: 12px; }
.right-label { color: var(--green); }
.figure { margin: 12px 0 0; }
.figure-image { display: grid; place-items: center; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
.figure-image img { display: block; max-width: 100%; max-height: 365px; object-fit: contain; }
.figure-media { position: relative; display: block; max-width: 100%; overflow: hidden; }
.figure figcaption, .source-line { color: var(--muted); font-size: .91rem; margin-top: 8px; }
.source-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .65rem; }
.source-line .button { padding-inline: 6px; }
.sources { margin-top: 14px; }
.writing-work { display: grid; gap: 14px; }
.writing-work h2 { margin: 0; }
.writing-work .actions { justify-content: space-between; }
.rubric { padding-inline-start: 1.25rem; margin: .55rem 0 0; }
.rubric li + li { margin-top: .5rem; }
.exam-writes { display: grid; gap: 28px; }
.exam-writes .question { padding-top: 16px; border-top: 1px solid var(--line); }
.exam-writes textarea { min-height: 152px; }
.question-review { border-bottom: 1px solid var(--line); padding: 12px 0; }
.question-review summary > span:first-child { margin-right: 10px; }
.question-review p { margin-top: .55rem; }
.result-status { color: var(--muted); font-weight: 570; }
.empty { padding-block: 20px; }
.empty > p { margin-top: 12px; }
.error { color: var(--red); padding: .4rem 0; }
.loading, .subtle { color: var(--muted); }
dialog { width: min(900px, calc(100vw - 24px)); max-height: 91dvh; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #131d31a0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.5rem; }
.dialog-content { padding: 18px 20px; }
.dialog-content img { display: block; max-width: 100%; max-height: 72dvh; margin: auto; }
.note-content { max-height: 69dvh; overflow: auto; overflow-wrap: anywhere; }
.note-content h3 { margin: 1rem 0 .45rem; }
.note-content p { margin: .4rem 0; white-space: pre-line; }
.note-content .raw { color: var(--muted); }
@media (max-width: 1000px) {
  .shell { width: calc(100% - 48px); }
  .topbar { gap: 16px; }
  .topbar nav { column-gap: 12px; }
  .nav-link { font-size: .94rem; }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .topbar { grid-template-columns: 1fr auto; gap: 0 12px; padding-top: 10px; }
  .brand { order: 0; }
  .progress-link { order: 1; }
  .topbar nav { order: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px 4px; padding: 5px 0; }
  .nav-link { min-height: 44px; justify-content: center; padding-inline: 0; }
  .nav-link[aria-current]::after { inset-inline: max(0px, calc((100% - 58px)/2)); }
  .split, .quiz-exam .question-layout { grid-template-columns: 1fr; }
  .quiz-exam .question-layout { gap: 24px; }
  .question-index { position: static; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
  .index-numbers { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
  .index-number { min-height: 38px; }
}
@media (max-width: 560px) {
  .shell { width: calc(100% - 32px); }
  main { padding: 28px 0 56px; }
  .nav-link { flex-direction: column; gap: 1px; font-size: .82rem; }
  .nav-link .icon, .nav-short { display: inline; }
  .nav-link .icon { width: 18px; height: 18px; }
  .nav-long { display: none; }
  .section { margin-top: 28px; }
  .section-head { align-items: start; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.four { grid-template-columns: 1fr 1fr; gap: 10px; }
  .training-route { align-items: start; }
  .session-head { align-items: flex-start; }
  .session-head .button { padding-inline: 3px; }
  .session-summary { gap: .28rem .7rem; font-size: .94rem; }
  .answer-row { gap: 2px; }
  .choice { padding: 10px; align-items: start; gap: 8px; }
  .strike-choice { min-width: 40px; }
  .feedback { padding: 12px 14px; }
  .list-item { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
.home-header { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); align-items: center; gap: 10px; padding: clamp(24px, 3vw, 40px) 0 clamp(32px, 3.8vw, 47px); border-bottom: 1px solid var(--ink); }
.home-header h1 { font-size: clamp(3.35rem, 7.4vw, 6.7rem); margin: 12px 0 clamp(18px, 3vw, 32px); }
.home-header .kicker { color: var(--accent-dark); }
.home-art { display: block; width: min(100%, 415px); height: auto; justify-self: end; }
.progress-link { justify-self: end; color: var(--ink); font-weight: 690; text-decoration: none; }
.progress-link:hover, .progress-link[aria-current] { color: var(--accent-dark); text-decoration: underline; }
.result-header { padding: 14px 0 32px; }
.result-header .actions { margin-top: 20px; }
.result-score { margin-top: 14px; font-size: clamp(1.3rem, 3vw, 1.75rem); font-variant-numeric: tabular-nums; }
.study-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 24px; margin: 0 0 35px; }
.study-stats > div { border-top: 1px solid var(--line); padding-block: 12px; }
.study-stats dt { font-weight: 620; }
.study-stats dd { margin: 4px 0 0; color: var(--accent-dark); font-size: 2rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.data-section { max-width: 45rem; border-top: 1px solid var(--line); padding: 24px 0; }
.data-section h2 { font-size: 1.55rem; margin-bottom: 10px; }
.data-section .actions, .data-section > .button { margin-top: 12px; }
.data-section textarea { min-height: 6rem; }
.data-status { margin-top: 10px; }
.data-status:empty, .storage-alert:empty { display: none; }
.storage-alert { padding-block: 8px; color: var(--red); }
.file-label { position: relative; cursor: pointer; }
.file-label:focus-within { outline: 3px solid var(--accent); outline-offset: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.button.danger { background: transparent; color: var(--red); border-color: var(--red); }
.button.danger:not(:disabled):hover { background: var(--red-soft); }
@media (max-width: 780px) {
  .study-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 580px) {
  .home-header { grid-template-columns: minmax(0, 1fr) minmax(90px, .48fr); gap: 0; padding-top: 28px; }
  .home-intro { display: contents; }
  .home-header .kicker { grid-column: 1 / -1; }
  .home-header h1 { grid-column: 1; grid-row: 2; font-size: clamp(2.38rem, 8.3vw, 3.5rem); margin-block: 10px 20px; }
  .home-art { grid-column: 2; grid-row: 2; }
  .home-header .actions { grid-column: 1 / -1; grid-row: 3; gap: 4px 8px; }
  .subject-index { grid-template-columns: 1fr; }
}
