:root {
  color-scheme: light;
  --ink: #181818;
  --muted: #595959;
  --line: #dedede;
  --bg: #fff;
  --paper: #fff;
  --accent: #202020;
  --tint: #f3f3f3;
  --green: #171717;
  --green-bg: #eee;
  --red: #222;
  --red-bg: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 16px/1.7 system-ui, "Microsoft JhengHei", "PingFang TC", sans-serif; }
button, select, input, textarea { font: inherit; color: inherit; }
button, select { min-height: 42px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #222; outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: .18em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 2.55rem); line-height: 1.22; letter-spacing: -.04em; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.28; }
h3 { font-size: 1.08rem; line-height: 1.45; }
small, .muted, .note, .progress { color: var(--muted); }
small, .note, .progress { font-size: .88rem; }
.wrap { max-width: 1190px; margin: auto; padding-inline: 36px; }
.mast { background: var(--paper); border-bottom: 1px solid var(--line); }
.mast .wrap { display: flex; justify-content: space-between; align-items: baseline; padding-block: 21px 16px; gap: 12px; }
.mast h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
.exam-window { font-size: .87rem; color: var(--muted); white-space: nowrap; }
.toolbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.tabs, .subject-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding-block: 8px; }
.tab, .secondary, .primary, .option, select {
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper); padding: 6px 13px;
}
.tab { border-color: transparent; font-weight: 650; }
.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 650; }
.primary:hover { background: #383838; }
.secondary:hover, .tab:hover, .option:hover, .tab[aria-current="page"], .secondary[aria-pressed="true"], .option[aria-pressed="true"] { background: var(--tint); border-color: #bdbdbd; color: var(--accent); }
.secondary[aria-pressed="true"] { font-weight: 700; }
select { max-width: 100%; padding-inline-end: 27px; }
main.wrap { padding-block: 24px 46px; min-height: 65vh; }
footer { border-top: 1px solid var(--line); padding-block: 18px; color: var(--muted); font-size: .87rem; }
.skip { position: absolute; top: -100px; }
.skip:focus { top: 10px; left: 10px; background: white; padding: 8px; z-index: 2; }
.subject-bar, .section-title, .day-head, .question-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 7px 14px; }
.subject-bar { margin-bottom: 18px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.study-layout { display: grid; grid-template-columns: minmax(205px, .64fr) minmax(0, 1.85fr); gap: 25px; align-items: start; }
.lesson-nav { padding: 0; }
.lesson-nav h3 { margin: 0 0 5px 8px; color: var(--muted); font-size: .9rem; }
.lesson-nav button { background: transparent; border: 1px solid transparent; border-radius: 7px; width: 100%; display: block; text-align: left; padding: 8px; }
.lesson-nav button:hover, .lesson-nav button[aria-current="page"] { color: var(--accent); background: var(--tint); border-color: #d4d4d4; }
.lesson-nav button[aria-current="page"] { font-weight: 650; }
.study-layout .lesson-mobile { display: none; }
.panel, .reader, .day { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 22px; }
.reader { padding: clamp(18px, 3.4vw, 38px); min-width: 0; }
.reader-header { padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.reader-header .note, .note { margin-top: 8px; }
.lesson-section { margin: 22px 0; }
.lesson-section p { margin-top: 5px; max-width: 72ch; white-space: pre-line; overflow-wrap: anywhere; }
.lesson-formula { padding: 10px; margin-top: 10px; border-radius: 7px; background: var(--tint); font-size: 1.28rem; font-family: "Cambria Math", math; overflow-x: auto; }
.lesson-divider { border: 0; border-top: 1px solid var(--line); margin: 25px 0 18px; }
.reader details, .sources { margin-top: 12px; }
summary { color: var(--accent); cursor: pointer; font-weight: 650; }
.summary-list, .sources ul { margin: 7px 0 0; padding-inline-start: 1.35em; }
.lesson-next { border-top: 1px solid var(--line); margin-top: 23px; padding-top: 15px; }
.scope-fold { padding: 12px 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 12px; }
.section-title { margin-bottom: 12px; }
.today { border-color: #aaa; }
.task-list { margin-top: 8px; }
.task { display: flex; align-items: flex-start; gap: 9px; border-top: 1px solid var(--line); padding: 8px 0; font-size: .93rem; }
.task input { flex: none; accent-color: var(--accent); width: 17px; height: 17px; margin: 5px 0 0; }
.task label { flex: 1; }
.task button, .exam-row button { min-height: 32px; padding: 2px 8px; font-size: .84rem; white-space: nowrap; }
.exam-row { display: grid; grid-template-columns: 65px 1fr auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.exam-row button { justify-self: start; }
.plan-extra { margin-top: 12px; }
.controls, .actions, .topic-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.controls, .topic-picker { margin: 10px 0; }
.controls label { font-weight: 600; }
.actions .next { margin-left: auto; }
.notice, .feedback { background: var(--tint); padding: 11px 13px; border-radius: 7px; }
.storage-error { margin-bottom: 13px; }
.prompt { margin: 8px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.options { display: grid; gap: 7px; margin-bottom: 12px; }
.option { text-align: left; }
.option:disabled { opacity: 1; }
.option.correct, .feedback.correct, .essay-status.complete { background: var(--green-bg); color: var(--green); border-color: #9c9c9c; }
.option.wrong, .feedback.wrong { background: var(--red-bg); color: var(--red); border-color: #444; }
.feedback { margin: 9px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.choice-letter { min-width: 1.6em; display: inline-block; font-weight: 700; }
.original-choices { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin: 12px 0; }
.original-choices button { text-align: center; }
.original-page img { display: block; width: 100%; border: 1px solid var(--line); border-radius: 6px; }
.original-page { margin: 10px 0; }
.source-link { display: inline-block; margin: 0 10px 5px 0; }
.word-list { margin: 10px 0; }
.word-list div { padding: 7px 0; border-bottom: 1px solid var(--line); }
.word-list dt { font-weight: 650; }
.word-list dd { margin: 0; }
.recall-card { border: 1px solid var(--line); border-radius: 9px; padding: 15px; margin-top: 12px; }
.recall-card h3 { margin: 8px 0; }
.essay-fields { display: grid; gap: 12px; margin-top: 12px; }
.essay-fields label { display: grid; gap: 4px; font-weight: 650; }
.essay-fields textarea { min-height: 84px; width: 100%; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-weight: 400; }
.essay-status { margin-top: 12px; }
.review-button { display: block; width: 100%; text-align: left; }
.review-button small { display: block; }
#study-graph { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 7px; }
.notes-layout { display: grid; grid-template-columns: minmax(110px,175px) minmax(0,790px); gap: clamp(24px,5vw,68px); align-items: start; }
.note-index { position: sticky; top: 18px; padding: 4px 0 4px 13px; border-left: 1px solid var(--line); display: grid; gap: 9px; }
.note-index a { color: var(--muted); text-decoration: none; font-size: .91rem; }
.note-index a:hover { color: var(--ink); text-decoration: underline; }
.notes-document { min-width: 0; }
.notes-intro h2, .tool-document > h2 { font-size: clamp(1.75rem, 5vw, 2.4rem); margin-bottom: 10px; }
.notes-intro > p { max-width: 66ch; }
.exam-parts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-block: 1px solid var(--line); margin: 12px 0 14px; }
.exam-parts a { color: var(--ink); text-decoration: none; padding: 8px 9px; }
.exam-parts a:hover { background: var(--tint); }
.exam-parts a + a { border-left: 1px solid var(--line); }
.exam-parts strong, .exam-parts span { display: block; }
.exam-parts span { font-size: .83rem; }
.notes-chapter { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 21px; }
.notes-chapter h2 { font-size: clamp(1.35rem, 3vw, 1.68rem); margin-bottom: 12px; scroll-margin-top: 18px; }
.notes-chapter h3 { margin: 14px 0 6px; }
.notes-chapter > p { margin-bottom: 10px; }
.notes-chapter .secondary { margin-block: 4px 8px; }
.notes-subsection + .notes-subsection { margin-top: 20px; }
.note-points { margin: 7px 0 10px; }
.note-points > div { padding: 7px 0; }
.note-points dt { font-weight: 700; }
.note-points dd { margin: 2px 0 0; max-width: 72ch; }
.note-source { color: var(--muted); font-size: .84rem; margin: 7px 0 10px; }
.note-table-wrap { max-width: 100%; overflow-x: auto; margin: 10px 0 14px; }
.note-table { width: 100%; text-align: left; border-collapse: collapse; line-height: 1.55; font-size: .94rem; }
.note-table :is(td,th) { border-bottom: 1px solid var(--line); padding: 8px 9px; vertical-align: top; }
.note-table thead { background: var(--tint); }
.note-table tbody th { min-width: 78px; }
.note-table th:nth-child(2), .note-table td:nth-child(2) { min-width: 120px; }
.notes-chapter blockquote { margin: 9px 0 12px; border-left: 2px solid #aaa; padding: 4px 0 4px 13px; }
.teacher-links { padding-inline-start: 1.3em; margin: 8px 0 0; }
.essay-notes { margin: 12px 0 0; padding-inline-start: 1.45em; }
.essay-notes > li + li { border-top: 1px solid var(--line); padding-top: 5px; }
.text-button { display: block; min-height: 38px; color: var(--ink); background: transparent; border: 0; padding: 0; margin-bottom: 8px; text-decoration: underline; text-underline-offset: .2em; }
.tool-document { max-width: 790px; margin-inline: auto; }
@media (max-width: 760px) {
  .wrap { padding-inline: 16px; }
  .mast .wrap { padding-block: 18px; align-items: flex-start; flex-direction: column; gap: 5px; }
  .study-layout, .grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .lesson-nav { display: none; }
  .study-layout .lesson-mobile { display: flex; margin-block: 0 4px; }
  .lesson-mobile select { flex: 1; min-width: 0; }
  .subject-bar { gap: 2px; margin-bottom: 12px; }
  .subject-tabs { width: 100%; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px; }
  .subject-tabs button { padding-inline: 3px; white-space: nowrap; }
  .tabs button { padding-inline: 9px; }
  .panel, .day { padding: 15px; }
  .notes-layout { display: block; }
  .note-index { position: static; display: flex; flex-wrap: wrap; gap: 4px 15px; border: 0; padding: 0 0 12px; margin-bottom: 13px; border-bottom: 1px solid var(--line); }
  .note-index a { padding-block: 3px; text-decoration: underline; text-underline-offset: .2em; }
  .exam-parts { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .exam-parts a:nth-child(3) { border-left: 0; }
  .exam-parts a:nth-child(n+3) { border-top: 1px solid var(--line); }
  .note-table :is(td,th) { padding: 6px; }
}
