:root {
  color-scheme: light;
  --paper: #f7f9fc; --surface: #fff; --ink: #1b2940; --blue: #315ed8;
  --mint: #e5f2ed; --muted: #68778d; --border: #dce3ed; --soft-blue: #edf2ff;
  --danger: #a43436; --shadow: 0 8px 30px #1b294006;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--paper);
}
:root[data-theme="dark"] {
  color-scheme: dark; --paper: #141c29; --surface: #1b2637; --ink: #e5ecf7;
  --blue: #9bb7ff; --mint: #203d37; --muted: #a7b5ca; --border: #34445b;
  --soft-blue: #263956; --danger: #ffb1b1; --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 44px; padding: .6rem 1rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 550;
  line-height: 1.35; text-align: center;
}
button:hover, .button:hover { border-color: var(--blue); background: var(--soft-blue); }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover { background: #254cb8; color: #fff; }
[data-theme="dark"] .primary { color: #142137; }
[data-theme="dark"] .primary:hover { background: #b5c9ff; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.danger { color: var(--danger); }
a { color: var(--blue); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--ink); padding: .65rem .8rem; }
textarea { resize: vertical; min-height: 150px; }
input[type="radio"], input[type="checkbox"] { width: 20px; min-height: 20px; accent-color: var(--blue); flex: 0 0 auto; }
label { display: grid; gap: .45rem; font-size: .9rem; font-weight: 550; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: .6rem; font-size: .9rem; font-weight: 550; }
h1, h2, h3, p { margin: 0; }
h1, h2, .academic { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.18; letter-spacing: -.035em; }
h2 { font-size: 1.5rem; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: 1rem; line-height: 1.45; font-weight: 600; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .73rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.stack { display: grid; gap: 1.3rem; }
.tight { gap: .65rem; }
.row { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.2rem; align-items: center; }
.grow { flex: 1; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 100; background: var(--surface); padding: .8rem; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.boot { max-width: 650px; margin: 15vh auto; padding: 1.5rem; }
.wordmark { display: flex; align-items: baseline; gap: .6rem; font: 400 1.7rem Georgia, serif; letter-spacing: -.04em; color: var(--ink); text-decoration: none; }
.wordmark small { font-size: .7rem; letter-spacing: -.04em; font-style: italic; color: var(--blue); border-bottom: 1px solid var(--blue); position: relative; top: -.35rem; }
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 2.1rem 1.1rem 1.1rem; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2rem; }
.sidebar .wordmark { padding-left: .8rem; }
.nav { display: grid; gap: .35rem; }
.nav a { display: flex; align-items: center; gap: .75rem; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-radius: 8px; padding: .75rem .8rem; min-height: 46px; font-size: .9rem; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--blue); background: var(--soft-blue); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 1rem .8rem; border-top: 1px solid var(--border); display: grid; gap: .7rem; overflow-wrap: anywhere; }
.account-name { font-size: .85rem; font-weight: 600; }
.sync-state { display: flex; align-items: flex-start; gap: .5rem; font-size: .76rem; color: var(--muted); line-height: 1.5; }
.sync-state .icon { width: 15px; height: 15px; margin-top: .2rem; }
.workspace { min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem clamp(1.25rem, 4vw, 3.5rem); border-bottom: 1px solid var(--border); min-height: 72px; }
.topbar .mobile-brand { display: none; }
.topbar .button { font-size: .8rem; padding: .45rem .7rem; min-height: 38px; }
.main { padding: 2.4rem clamp(1.25rem, 4vw, 3.5rem) 4rem; max-width: 1390px; margin: 0 auto; }
.page-head { margin-bottom: 1.9rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head p { margin-top: .65rem; color: var(--muted); max-width: 660px; }
.desk { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(250px, 1fr); gap: 1.4rem; align-items: start; }
.panel { border: 1px solid var(--border); background: var(--surface); padding: 1.5rem; border-radius: 12px; box-shadow: var(--shadow); min-width: 0; }
.panel.mint { background: var(--mint); }
.panel.soft { background: var(--soft-blue); }
.panel-title { margin-bottom: 1.15rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0; padding: 1.15rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.metric strong { display: block; font: 400 1.75rem Georgia, serif; }
.metric span { display: block; color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.tag { display: inline-flex; align-items: center; gap: .35rem; background: var(--paper); border: 1px solid var(--border); border-radius: 5px; padding: .2rem .5rem; font-size: .73rem; color: var(--muted); }
.tag.blue { color: var(--blue); background: var(--soft-blue); border-color: transparent; }
.tag.mint { background: var(--mint); color: var(--ink); }
.trajectory { list-style: none; padding: 0; margin: 0; }
.trajectory li { position: relative; padding: 0 0 1.35rem 2.1rem; }
.trajectory li::before { content: ""; position: absolute; width: 1px; background: var(--border); left: 7px; top: 17px; bottom: 0; }
.trajectory li:last-child::before { display: none; }
.topic-node { position: absolute; top: 7px; left: 0; width: 15px; height: 15px; background: var(--surface); border: 2px solid var(--border); border-radius: 50%; }
.topic-node.seen { border-color: var(--blue); background: var(--soft-blue); }
.topic-node.mastered { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 3px var(--surface); }
.topic-link { padding: 0; min-height: 32px; border: 0; background: none; justify-content: flex-start; text-align: left; font-weight: 550; }
.topic-link:hover { background: none; color: var(--blue); }
.topic-meta { font-size: .77rem; color: var(--muted); margin-top: .2rem; }
.coverage { display: grid; gap: .9rem; }
.coverage-row { display: grid; gap: .4rem; }
.coverage-row .row { font-size: .83rem; }
.coverage-row progress { height: 5px; width: 100%; accent-color: var(--blue); border: 0; background: var(--paper); }
progress::-webkit-progress-bar { background: var(--paper); border-radius: 8px; }
progress::-webkit-progress-value { background: var(--blue); border-radius: 8px; }
.calendar { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: .45rem; }
.day { padding: .7rem .3rem; background: var(--paper); border: 1px solid var(--border); border-radius: 7px; text-align: center; font-size: .73rem; }
.day strong { display: block; font-weight: 600; color: var(--blue); margin-top: .4rem; }
.list { display: grid; gap: 0; }
.list-item { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.text-button { padding: .2rem 0; min-height: 34px; border: 0; border-radius: 0; background: none; color: var(--blue); justify-content: flex-start; text-align: left; }
.text-button:hover { background: none; text-decoration: underline; }
.alert { padding: .9rem 1.1rem; border: 1px solid var(--border); border-left: 3px solid var(--blue); border-radius: 6px; background: var(--soft-blue); font-size: .87rem; overflow-wrap: anywhere; }
.alert.error { color: var(--danger); background: var(--surface); border-left-color: var(--danger); }
.global-alert { margin-bottom: 1.25rem; }
.empty { padding: 2rem 1rem; text-align: center; display: grid; justify-items: center; gap: .75rem; color: var(--muted); }
.filters { display: grid; grid-template-columns: 2fr repeat(3, minmax(110px, 1fr)); gap: .8rem; margin-bottom: 1.3rem; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.library-card { display: flex; flex-direction: column; gap: .9rem; padding: 1.3rem; }
.library-card h2 { font-size: 1.2rem; }
.library-card .actions { margin-top: auto; padding-top: .2rem; }
.library-card .button, .library-card button { font-size: .85rem; }
.study-layout { max-width: 900px; margin: 0 auto; }
.study-card { padding: clamp(1.2rem, 4vw, 2.4rem); }
.study-card > h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 1.1rem 0 1.4rem; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.03rem; line-height: 1.85; }
.strict-entry { margin-top: 1.3rem; }
.strict-entry .button { background: transparent; font-weight: 400; }
.strict-progress { width: 100%; display: grid; gap: .5rem; margin-bottom: 1rem; }
.strict-progress-bar { display: flex; width: 100%; height: 12px; overflow: hidden; border-radius: 6px; background: var(--border); }
.strict-progress-bar > span { display: block; flex: 0 0 auto; }
.strict-progress-twice, .strict-legend-twice::before { background: var(--blue); }
.strict-progress-once, .strict-legend-once::before { background: color-mix(in srgb, var(--blue) 40%, var(--surface)); }
.strict-progress-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-variant-numeric: tabular-nums; }
.strict-legend-once::before, .strict-legend-twice::before { content: ''; display: inline-block; width: .65rem; height: .65rem; border-radius: 2px; margin-inline-end: .4rem; }
@media (prefers-reduced-motion: no-preference) { .strict-progress-bar > span { transition: width 200ms ease; } }
.strict-review { max-width: 960px; min-width: 0; margin-inline: auto; }
.strict-review h2, .strict-review p, .strict-review a { overflow-wrap: anywhere; }
.strict-review .row > button { flex: 1 1 12rem; }
.strict-etalon { border-top: 1px solid var(--border); padding-top: 1.3rem; min-width: 0; }
.strict-fragment { margin: 0; min-width: 0; }
.strict-fragment > a { display: block; border: 1px solid var(--border); background: #fff; border-radius: 6px; }
.strict-fragment img { display: block; width: 100%; max-width: 100%; height: auto; color: #1b2940; }
.strict-fragment figcaption { display: grid; gap: .4rem; margin-top: .65rem; font-size: .82rem; color: var(--muted); }
.strict-fragment figcaption a { display: inline-flex; align-items: center; min-height: 44px; }
.strict-supplement { border-left: 3px solid var(--border); padding-inline-start: 1rem; }
.prose + .prose { margin-top: 1rem; }
.math { min-width: 0; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: .25rem 0; }
.katex { font-size: 1.08em; }
.answer-section { padding-top: 1.25rem; margin-top: 1.25rem; border-top: 1px solid var(--border); }
.answer-section h3 { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .7rem; }
details { border-top: 1px solid var(--border); margin-top: 1.1rem; padding-top: .85rem; }
summary { min-height: 40px; cursor: pointer; color: var(--blue); font-weight: 550; }
details[open] summary { margin-bottom: .7rem; }
.source { display: inline-flex; align-items: center; gap: .4rem; font-size: .83rem; margin-top: 1rem; }
.choices { display: grid; gap: .7rem; margin-top: 1.3rem; }
.choice { justify-content: flex-start; text-align: left; padding: .9rem 1rem; font-weight: 400; min-width: 0; }
.choice .choice-key { font: .78rem ui-monospace, monospace; color: var(--muted); align-self: start; margin-top: .25rem; }
.choice[aria-pressed="true"] { border-color: var(--blue); background: var(--soft-blue); }
.choice.correct { border-color: var(--blue); background: var(--mint); }
.choice.incorrect { border-color: var(--danger); }
.method-bar { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.method-bar button { min-height: 38px; padding: .4rem .7rem; font-size: .8rem; }
.method-bar button[aria-pressed="true"] { background: var(--soft-blue); border-color: var(--blue); color: var(--blue); }
.checks { padding-left: 1.4rem; display: grid; gap: .55rem; }
.ratings { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; margin-top: 1rem; }
.ratings button { flex-direction: column; gap: .25rem; }
.ratings button small { font-weight: 400; color: var(--muted); font-size: .73rem; }
.order-list { display: grid; gap: .5rem; padding-left: 1.6rem; }
.order-list li { padding-left: .25rem; }
.order-list button { width: 100%; text-align: left; justify-content: flex-start; font-weight: 400; }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 440px); max-width: 1020px; gap: 5rem; margin: 10vh auto; padding: 2rem; align-items: start; }
.auth-intro { padding-top: 1rem; }
.auth-intro h1 { margin: 2.5rem 0 1rem; }
.auth-intro .trajectory { margin-top: 2rem; }
.auth-intro .trajectory li { font-family: Georgia, serif; font-size: 1.15rem; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); gap: .5rem; padding-bottom: .9rem; margin-bottom: 1.5rem; }
.auth-tabs button { flex: 1; }
.budget-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.budget-option { border: 1px solid var(--border); border-radius: 8px; padding: .85rem .65rem; display: flex; flex-direction: column; gap: .45rem; align-items: flex-start; cursor: pointer; font-size: .9rem; }
.budget-option:has(input:checked) { background: var(--soft-blue); border-color: var(--blue); }
.settings { max-width: 790px; }
.today { max-width: 850px; }
.daily-card { padding: 1.25rem; gap: .75rem; background: var(--soft-blue); }
.daily-card h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); overflow-wrap: anywhere; }
.daily-start { min-height: 44px; justify-self: start; min-width: 180px; }
.course-progress { width: 100%; height: 7px; accent-color: var(--blue); }
.today { gap: 1rem; }
.today-remaining { font-size: .9rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.course-compact { display: grid; gap: .4rem; min-width: 0; padding-block: .25rem; }
.course-compact > .course-progress { height: 4px; border: 0; }
.course-compact details { margin: 0; padding: 0; border: 0; font-size: .82rem; }
.course-compact summary { display: list-item; min-height: 44px; padding-block: .6rem; }
.daily-card .eyebrow { text-transform: none; letter-spacing: .02em; font-size: .82rem; }
.today .topic-outline > p { margin-block: .85rem; }
.today > .panel { gap: .8rem; }
.day-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: .75rem; }
.day-metric { display: grid; gap: .35rem; min-width: 0; font-size: .85rem; }
.day-metric strong { font-variant-numeric: tabular-nums; font-weight: 650; }
.day-metrics .day-metric { padding: .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.day-metric progress { height: 4px; border: 0; }
.day-sequence { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 0; padding: 0; list-style: none; }
.day-sequence li { flex: 1 1 130px; padding: .5rem .65rem; border-radius: 5px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .78rem; }
.day-sequence li[aria-current] { color: var(--ink); border-color: var(--blue); font-weight: 650; }
.day-calendar { display: grid; gap: .5rem; list-style: none; margin: .5rem 0 1rem; padding: 0; }
.day-calendar li { display: flex; flex-wrap: wrap; gap: .3rem 1rem; padding: .55rem .7rem; border-radius: 6px; font-size: .82rem; }
.day-calendar time { min-width: 65px; font-weight: 600; }
.day-calendar li[aria-current] { background: var(--soft-blue); color: var(--ink); }
.day-calendar small { flex-basis: 100%; }
.level-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.topic-outline { margin: 0; }
.topic-outline .trajectory { margin: 1rem 0; }
.topic-outline .trajectory li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.topic-outline .trajectory li::before { display: none; }
.small:empty { display: none; }
.notice { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); max-width: min(90vw, 650px); border-radius: 8px; background: var(--ink); color: var(--surface); font-size: .86rem; padding: .8rem 1.2rem; box-shadow: var(--shadow); z-index: 30; }
.notice:empty { display: none; }
.session-strip { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; padding: .8rem 1rem; background: var(--mint); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 1.3rem; font-size: .85rem; }
.file-input { max-width: 100%; padding: .7rem; }
@media (prefers-reduced-motion: no-preference) { button, a { transition: background-color .14s, border-color .14s, color .14s; } .page-head { animation: arrive .18s ease-out; } @keyframes arrive { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: none; } } }
@media (max-width: 1100px) { .shell { grid-template-columns: 205px minmax(0, 1fr); } .desk { grid-template-columns: 1fr; } .desk > .stack:last-child { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .filters { grid-template-columns: repeat(3, 1fr); } .filters label:first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 0; border: 0; display: block; }
  .sidebar > .wordmark, .sidebar-foot { display: none; }
  .nav { display: flex; gap: .25rem; overflow-x: auto; padding: .5rem .8rem; border-bottom: 1px solid var(--border); }
  .nav a { white-space: nowrap; padding: .6rem .75rem; font-size: .8rem; min-height: 44px; }
  .nav a { flex: 1; justify-content: center; }
  .daily-start { width: 100%; min-width: 0; }
  .nav .icon { width: 17px; height: 17px; }
  .topbar { padding: .8rem 1.1rem; flex-wrap: wrap; gap: .5rem; min-height: 0; }
  .topbar .mobile-brand { display: flex; font-size: 1.4rem; }
  .topbar > .eyebrow { display: none; }
  .topbar > .row { width: 100%; justify-content: space-between; }
  .mobile-sync { display: flex; max-width: 70%; }
  .main { padding: 1.5rem 1rem 3rem; }
  .page-head { margin-bottom: 1.4rem; }
  .page-head p { font-size: .9rem; }
  .panel { padding: 1.2rem; border-radius: 10px; }
  .desk > .stack:last-child { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .filters label:last-child { grid-column: 1 / -1; }
  .auth { grid-template-columns: 1fr; gap: 1.5rem; margin: 1rem auto; padding: 1.2rem; max-width: 500px; }
  .auth-intro h1 { margin-top: 1.5rem; }
  .auth-intro .trajectory { display: none; }
  .budget-options { gap: .4rem; }
  .budget-option { padding: .7rem .5rem; font-size: .8rem; }
  .ratings { grid-template-columns: 1fr; }
  .ratings button { flex-direction: row; justify-content: space-between; }
  .metrics { gap: .6rem; }
  .metric strong { font-size: 1.5rem; }
  .notice { bottom: max(1rem, env(safe-area-inset-bottom)); }
}
@media (min-width: 761px) { .mobile-sync { display: none; } }
@media (forced-colors: active) { :focus-visible { outline-color: Highlight; } .topic-node { forced-color-adjust: none; } }
