
/* Product tokens: one light workspace, one dark navigation surface. */
:root {
  color-scheme: light;
  --paper: #f6f7f6;
  --white: #fff;
  --ink: #202e28;
  --text: #43574c;
  --secondary: #53665b;
  --muted: #66756c;
  --green: #245b48;
  --green-hover: #184533;
  --green-soft: #edf4ed;
  --nav: #183c33;
  --nav-text: #bed0c7;
  --nav-active: #dfeddf;
  --line: #dfe5df;
  --control-line: #82968a;
  --warning-bg: #fbf4e8;
  --warning-text: #805c22;
  --danger: #9f3d30;
  --serif: 'Noto Serif SC', 'Songti SC', serif;
  --sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'SFMono-Regular', Consolas, monospace;
  --sidebar-width: 248px;
  --header-height: 76px;
  --radius: 12px;
  --shadow-sm: 0 2px 8px #21372b05;
  --shadow-float: 0 20px 70px #102a2729;
  --ease: cubic-bezier(.2, .7, .3, 1);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 100px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.65 var(--sans); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button { color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .45; cursor: default; }
:where(a,button,input,textarea,select,summary):focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
:where(button,a,input,textarea,select) { transition: color 160ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
p, h1, h2, h3, h4 { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
svg { display: block; }
::selection { background: #dcebdc; }
.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.skip { position: fixed; left: 265px; top: -100px; background: var(--green); color: white; padding: 12px 18px; z-index: 100; border-radius: 8px; }
.skip:focus { top: 12px; }

/* Shell and navigation */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); padding: 32px 20px 24px; display: flex; flex-direction: column; background: var(--nav); color: var(--nav-text); z-index: 40; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 14px; margin: 0 12px 40px; color: #f1f6ef; }
.brand-symbol { font: 700 36px var(--serif); letter-spacing: -5px; padding-right: 2px; }
.brand-symbol > span:first-child { color: #b7cda0; }
.brand-dot { color: #d9b778; }
.brand > span:last-child { font-size: 20px; font-weight: 600; letter-spacing: 2px; }
.brand small { display: block; font: 9px var(--mono); color: #c0d1c4; letter-spacing: 1.3px; margin-top: 4px; }
.sidebar-label { font-size: 11px; letter-spacing: 1px; color: #acc2b6; padding: 0 14px; margin-bottom: 12px; display: flex; justify-content: space-between; }
.sidebar-label span { font-family: var(--mono); }
.nav-item { display: flex; align-items: center; gap: 13px; min-height: 46px; margin: 4px 0; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #c0d2c7; }
.nav-item:hover { background: #244a3f; color: white; }
.nav-item.active { background: var(--nav-active); color: #173d30; box-shadow: 0 2px 6px #10271e1a; }
.nav-item svg { width: 19px; height: 19px; }
.nav-badge { margin-left: auto; font: 11px/1.8 var(--mono); padding: 0 7px; border-radius: 5px; background: #365a4b; color: #e5efdf; }
.nav-item.active .nav-badge { background: #c8dcc4; color: #264b35; }
.sidebar :focus-visible { outline-color: #d5e8bf; }
.sidebar-rule { height: 1px; flex-shrink: 0; background: #36564a; margin: 26px 14px; }
.chapter-link { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 14px; font-size: 12px; color: #bcd0c2; border-radius: 6px; }
.chapter-link span { font: 11px var(--mono); color: #aac1b2; }
.chapter-link i { margin-left: auto; width: 5px; height: 5px; background: #789b7b; border-radius: 50%; }
.chapter-link:hover, .chapter-link.active { background: #254d40; color: white; }
.chapter-link.active i { background: #d5e4a8; }
.sidebar-bottom { margin-top: auto; padding: 32px 14px 0; font-size: 11px; color: #b4c9ba; }
.sidebar-bottom a { display: inline-block; margin-top: 18px; color: #b6ceba; }
.sidebar-bottom a:hover { color: white; }
.nav-backdrop { display: none; }
.workspace { margin-left: var(--sidebar-width); }
.topbar { height: var(--header-height); padding: 0 40px; border-bottom: 1px solid var(--line); background: #ffffffed; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 20; }
.top-left, .top-actions { display: flex; align-items: center; }
.top-actions { gap: 24px; }
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb span { margin: 0 14px; color: #98a69b; }
.breadcrumb b { color: var(--ink); font-weight: 500; }
.search-trigger { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 7px 12px; border: 1px solid var(--line); background: #fafbf9; border-radius: 8px; font-size: 12px; color: var(--muted); }
.search-trigger:hover { border-color: var(--control-line); background: #f0f5ee; }
.search-trigger kbd { margin-left: 24px; font: 10px var(--mono); padding: 3px 5px; border: 1px solid #d7dfd6; border-radius: 4px; background: white; color: #627365; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; font-size: 24px; }
.icon-button:hover { background: #eaf0e6; }
.mobile-menu { display: none; }
main { max-width: 1380px; margin: auto; padding: 36px 40px 64px; min-height: calc(100vh - 156px); }
main:focus { outline: none; }
footer { display: flex; gap: 10px; max-width: 1380px; margin: auto; border-top: 1px solid var(--line); padding: 24px 40px; color: var(--muted); font-size: 11px; }
footer a { margin-left: auto; color: var(--secondary); }
footer a:hover { text-decoration: underline; }
.eyebrow { font: 11px/1.5 var(--mono); letter-spacing: 1.8px; color: var(--muted); }
.page-kicker { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-kicker .date { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.page-title { margin-bottom: 32px; }
.page-title h1 { font: 600 32px/1.45 var(--serif); letter-spacing: -.5px; margin: 10px 0 16px; }
.page-title p { color: var(--secondary); font-size: 14px; line-height: 1.9; max-width: 850px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { font: 600 21px/1.5 var(--sans); letter-spacing: -.4px; }
.section-head h2 small { font: 10px var(--mono); color: var(--muted); margin-left: 14px; letter-spacing: 1px; }
.section-head > p { font-size: 12px; color: var(--muted); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 20px; min-height: 44px; padding: 11px 20px; background: var(--green); border: 1px solid var(--green); border-radius: 8px; color: white; font-size: 13px; font-weight: 500; line-height: 1.5; }
.button:hover { background: var(--green-hover); border-color: var(--green-hover); box-shadow: 0 3px 8px #234a3620; }
.button:active { background: #143e2d; box-shadow: none; }
.button.light { background: white; border-color: #b5c4b7; color: var(--green); }
.button.light:hover { background: var(--green-soft); border-color: #557b5f; }
.text-link { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; color: var(--green); font-size: 12px; font-weight: 500; }
.text-link:hover { color: #153e28; text-decoration: underline; text-underline-offset: 4px; }

/* Overview: generous editorial lead, functional information below. */
.hero-copy { max-width: 760px; }
.tag { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; background: #eff5e8; border: 1px solid #d4e2c8; color: #47663e; font-size: 11px; border-radius: 5px; }
.tag:before { content: ''; width: 5px; height: 5px; background: #6b8e4f; border-radius: 50%; }
.hero h1 { font: 700 clamp(32px, 3vw, 43px)/1.5 var(--serif); letter-spacing: -1px; color: #214c3a; margin: 20px 0 16px; }
.hero-copy > p { font-size: 13px; color: var(--secondary); line-height: 1.9; }
.hero-actions { display: flex; align-items: center; gap: 24px; margin-top: 28px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 0; margin: 24px 0 40px; border: 1px solid var(--line); background: white; border-radius: var(--radius); }
.stat { position: relative; display: flex; gap: 14px; align-items: center; padding: 16px 24px; min-width: 0; }
.stat + .stat:before { content: ''; width: 1px; height: 40px; background: var(--line); position: absolute; left: 0; }
.stat-icon { color: #5c7c53; font-size: 19px; }
.stat strong { font: 500 32px/1.3 var(--serif); letter-spacing: -1px; color: #234c39; }
.stat strong small { font: 12px var(--sans); color: var(--secondary); letter-spacing: 0; margin-left: 7px; }
.stat p { color: var(--muted); font-size: 11px; line-height: 1.7; margin-top: 5px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; }
.chapter-list { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chapter-row { display: flex; align-items: center; gap: 16px; min-height: 94px; padding: 20px 24px; }
.chapter-row + .chapter-row { border-top: 1px solid var(--line); }
.chapter-row:hover { background: #f3f7f0; }
.chapter-number { font: 11px var(--mono); min-width: 18px; color: var(--muted); }
.chapter-mark { width: 46px; height: 46px; border-radius: 10px; background: var(--tint, #edf4ed); color: var(--chapter, var(--green)); display: grid; place-items: center; flex-shrink: 0; font: 26px var(--serif); }
.chapter-mark .icon { width: 23px; height: 23px; }
.chapter-info { flex: 1; min-width: 0; }
.chapter-info h3 { font-size: 14px; font-weight: 600; }
.chapter-info p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.chapter-progress { display: flex; gap: 10px; align-items: center; font: 11px var(--mono); color: var(--secondary); white-space: nowrap; }
.progress-track { width: 60px; height: 4px; border-radius: 4px; background: #e5ecdf; overflow: hidden; }
.progress-track i { height: 100%; background: #62874d; display: block; }
.row-arrow { color: #6b806c; font-size: 19px; }
.focus-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px; background: #edf3e9; display: flex; flex-direction: column; }
.focus-card .mini-title { display: flex; justify-content: space-between; color: #526e47; font-size: 11px; font-weight: 500; }
.focus-card h3 { font: 600 22px/1.65 var(--serif); margin: 24px 0 14px; }
.focus-card > p { font-size: 12px; line-height: 2; color: var(--secondary); }
.focus-divider { height: 1px; background: #d5e1cb; margin: 24px 0 16px; }
.check-line { display: flex; gap: 10px; color: #516c46; margin: 7px 0; font-size: 12px; }
.check-line i { font-style: normal; color: #65834b; }
.focus-card .button { margin-top: auto; width: 100%; align-self: flex-end; }
.focus-card .check-line:last-of-type { margin-bottom: 24px; }
.small-note { font-size: 11px; color: var(--muted); text-align: center; margin-top: 12px; }
.lab-strip { display: flex; align-items: center; gap: 20px; padding: 24px; margin-top: 28px; background: #f0f4eb; border: 1px solid #dae3d2; border-radius: 10px; }
.lab-strip-icon { font-size: 28px; color: #66834f; }
.lab-strip h3 { font-size: 14px; font-weight: 500; }
.lab-strip p { font-size: 12px; color: var(--secondary); margin-top: 6px; }
.lab-strip a { margin-left: auto; flex-shrink: 0; }

/* Course index: grouped rows instead of stacked individual cards. */
.course-overview { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; background: white; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 32px; }
.course-overview strong { font-size: 14px; font-weight: 500; }
.course-overview p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.course-jumps { display: flex; flex-wrap: wrap; gap: 8px; }
.course-jumps a { min-width: 36px; min-height: 36px; display: grid; place-items: center; border: 1px solid #cdd8ca; background: #f5f8f0; border-radius: 6px; color: #4a6e40; font: 12px var(--mono); }
.course-jumps a:hover { background: #e3edda; border-color: #668d53; }
.course-section { margin-bottom: 40px; }
.course-section .section-head h2 > span { font: 12px var(--mono); margin-right: 8px; }
.lesson-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: white; box-shadow: var(--shadow-sm); }
.lesson-row { display: flex; align-items: center; gap: 18px; min-height: 89px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover { background: #f3f7f0; }
.lesson-row > span:nth-child(2) { min-width: 0; }
.lesson-status { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #c8d6c2; border-radius: 50%; color: #5c7750; background: #f7faf3; font: 11px var(--mono); flex-shrink: 0; }
.lesson-status.done { background: var(--green); color: white; border-color: var(--green); }
.lesson-row h3 { font-size: 15px; font-weight: 500; line-height: 1.7; text-wrap: auto; }
.lesson-row p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.lesson-row .meta { margin-left: auto; text-align: right; font: 11px/1.8 var(--mono); color: var(--muted); white-space: nowrap; }
.lesson-kind { display: inline-block; vertical-align: middle; white-space: nowrap; font: 10px/1.7 var(--sans); color: #5c7250; padding: 1px 7px; border: 1px solid #cddac4; border-radius: 5px; background: #f0f5e9; margin-left: 10px; }
.chapter-banner { display: flex; align-items: center; gap: 24px; padding: 32px; background: white; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 32px; }
.chapter-banner .chapter-mark { width: 72px; height: 72px; font-size: 36px; }
.chapter-banner h1 { font: 600 30px/1.5 var(--serif); margin: 8px 0; }
.chapter-banner p { color: var(--secondary); font-size: 13px; }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 12px; font-size: 12px; line-height: 1.6; color: var(--secondary); background: white; border: 1px solid #bfcdc0; border-radius: 6px; }
.chip.active, .chip:hover { color: #284f30; background: #e6efdd; border-color: #8ca47c; }

/* Reading: stable line length, strong type hierarchy. */
.reading-layout { display: grid; grid-template-columns: minmax(0, 820px) 224px; justify-content: space-between; gap: 40px; }
.reading-layout > article { min-width: 0; }
.lesson-title { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.lesson-title h1 { font: 600 34px/1.5 var(--serif); letter-spacing: -.5px; margin: 14px 0; }
.lesson-title .subtitle { font-size: 15px; color: var(--secondary); }
.lesson-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 24px; color: var(--muted); font-size: 12px; }
.lesson-meta a { color: var(--green); text-decoration: underline; text-underline-offset: 4px; }
.lesson-tabs { display: flex; gap: 32px; border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.lesson-tabs button { min-height: 55px; padding: 14px 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; }
.lesson-tabs button:hover { color: var(--green); }
.lesson-tabs button.active { color: var(--green); border-color: var(--green); font-weight: 500; }
.reading-content section { margin-bottom: 36px; scroll-margin-top: 100px; }
.reading-content section h2 { font: 600 22px/1.6 var(--serif); margin-bottom: 16px; }
.section-num { font: 12px var(--mono); color: #5b7650; margin-right: 12px; }
.reading-content p { font-size: 16px; line-height: 2; color: var(--text); overflow-wrap: anywhere; }
.worked-example { background: var(--green-soft); border: 1px solid #d3e1ca; padding: 28px; border-radius: 10px; }
.worked-example .example-label { color: #506d43; font: 10px/1.8 var(--mono); letter-spacing: 1.4px; margin-bottom: 16px; }
.worked-example h3 { font-size: 16px; line-height: 1.9; font-weight: 500; margin-bottom: 20px; text-wrap: auto; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: block; position: relative; padding-left: 28px; margin: 16px 0; font-size: 14px; line-height: 2; color: #42613e; overflow-wrap: anywhere; }
.steps li:before { content: counter(step, decimal-leading-zero); position: absolute; left: 0; color: #60874e; font: 11px/2.6 var(--mono); }
.pitfall { background: var(--warning-bg); border-left: 3px solid #c5a164; border-radius: 0 8px 8px 0; padding: 20px 24px; margin: 28px 0; }
.pitfall strong { display: block; font-size: 13px; color: var(--warning-text); margin-bottom: 8px; }
.pitfall p { font-size: 14px; color: var(--warning-text); line-height: 1.9; }
.reading-side-inner { position: sticky; top: 110px; }
.side-section { padding-top: 22px; border-top: 1px solid var(--line); margin-bottom: 32px; }
.side-section h3 { font-size: 12px; font-weight: 500; color: var(--green); margin-bottom: 16px; }
.side-section p, .side-section li { font-size: 12px; line-height: 1.95; color: var(--secondary); }
.side-section ul { list-style: none; padding: 0; margin: 0; }
.side-section li { position: relative; padding-left: 15px; margin: 10px 0; }
.side-section li:before { content: '↗'; position: absolute; left: 0; color: #668a54; }
.side-section a:hover { text-decoration: underline; }
.side-section .button { width: 100%; font-size: 12px; margin-top: 16px; }
.lesson-end { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding-top: 24px; margin: 36px 0; border-top: 1px solid var(--line); }
.reading-content pre { font: 13px/1.95 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; background: #234536; color: #eff7e8; padding: 26px; border-radius: 10px; overflow: auto; }

/* Questions, writing and feedback. */
.question-card { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: white; margin-bottom: 24px; }
.question-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font: 11px/1.8 var(--mono); margin-bottom: 16px; }
.question-top span:last-child { white-space: nowrap; }
.question-card h3 { font-size: 16px; line-height: 1.9; font-weight: 500; margin-bottom: 22px; text-wrap: auto; }
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 15px; background: #fcfdfb; border: 1px solid #b9c8bb; border-radius: 8px; color: var(--secondary); font-size: 14px; line-height: 1.8; cursor: pointer; }
.option:hover { background: #f0f5eb; border-color: #7d9a70; }
.option:has(input:checked) { background: #eaf2e2; border-color: #587e44; color: #2c522f; }
.option:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 3px; }
.option input { accent-color: var(--green); width: 16px; height: 16px; flex-shrink: 0; }
.option > span { font: 12px var(--mono); color: var(--muted); }
.option > .option-copy { font: inherit; color: inherit; min-width: 0; flex: 1; }
.question-card .button { margin-top: 22px; }
.feedback { margin-top: 22px; padding: 18px 20px; background: #edf5e9; border: 1px solid #c8dcb8; border-radius: 8px; color: #365f39; font-size: 14px; line-height: 1.9; }
.feedback strong { display: block; margin-bottom: 6px; font-size: 13px; }
.feedback.wrong { background: var(--warning-bg); border-color: #e4cfaa; color: var(--warning-text); }
.task-box { border: 1px solid #ccdac2; padding: 28px; border-radius: 10px; background: #f3f7ee; margin-top: 28px; }
.task-box h3 { font: 600 22px/1.5 var(--serif); margin-bottom: 14px; }
.task-box p { font-size: 15px; line-height: 1.9; color: var(--secondary); }
.task-box textarea { width: 100%; min-height: 150px; padding: 18px; margin-top: 20px; border: 1px solid var(--control-line); border-radius: 8px; background: white; font-size: 15px; line-height: 1.9; color: var(--text); resize: vertical; }
.task-box details { margin-top: 20px; font-size: 13px; color: var(--green); }
.task-box summary { cursor: pointer; min-height: 36px; }
.task-box details p { margin-top: 12px; }
.note-help { color: var(--muted); font-size: 12px; line-height: 1.85; margin-top: 12px; }
.empty { border: 1px dashed #bacab1; background: #f1f5eb; border-radius: var(--radius); text-align: center; padding: 64px 28px; }
.empty-symbol { color: #66864d; font: 42px var(--serif); }
.empty h2 { font: 600 24px/1.6 var(--serif); margin: 14px 0; }
.empty p { color: var(--secondary); font-size: 14px; }
.empty .button { margin-top: 28px; }
.practice-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 24px 0 32px; }
.summary-tile { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; color: var(--secondary); font-size: 12px; }
.summary-tile b { display: block; font: 500 32px/1.5 var(--serif); color: #315a3b; margin-bottom: 5px; }

/* Sources. */
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.resource-card { padding: 26px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.resource-card h3 { font-size: 17px; margin: 12px 0; }
.resource-card p { color: var(--secondary); font-size: 13px; }
.resource-actions { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 18px; }
.resource-actions a { font-size: 12px; color: var(--green); min-height: 36px; display: inline-flex; align-items: center; }
.resource-actions a:hover { text-decoration: underline; }
.sources-note { padding: 24px 28px; margin: 28px 0; background: #edf3e8; border: 1px solid #d9e2d1; border-radius: 10px; font-size: 13px; line-height: 2; color: #4e6744; }
.field-input { width: 100%; padding: 12px 15px; min-height: 46px; border: 1px solid var(--control-line); background: white; color: var(--ink); font-size: 14px; border-radius: 8px; }
.reference-link { display: block; border-bottom: 1px solid var(--line); padding: 20px 0; }
.reference-link strong { font-size: 14px; font-weight: 500; }
.reference-link p { font-size: 12px; color: var(--muted); margin-top: 8px; }
.reference-link:hover strong { color: var(--green); text-decoration: underline; text-underline-offset: 4px; }

/* Labs: controls and outputs use the same panel grammar. */
.lab-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.lab-card { padding: 28px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.lab-card:hover { border-color: #91ac82; box-shadow: 0 5px 16px #243b2b09; }
.lab-glyph { font: 32px var(--serif); color: #5f8251; margin-bottom: 24px; }
.lab-glyph .icon { width: 28px; height: 28px; }
.lab-card h3 { font: 600 23px/1.6 var(--serif); margin-bottom: 14px; }
.lab-card p { font-size: 13px; line-height: 1.9; color: var(--secondary); }
.lab-card .text-link { margin-top: 24px; }
.lab-workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; gap: 24px; }
.lab-controls { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.lab-controls h2, .lab-output h2 { font: 600 21px/1.6 var(--serif); margin-bottom: 26px; }
.control { margin-bottom: 24px; }
.control:last-child { margin-bottom: 0; }
.control label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--secondary); font-size: 13px; margin-bottom: 10px; }
.control label output { color: var(--green); font: 12px var(--mono); white-space: nowrap; }
.control input[type=range] { width: 100%; min-height: 30px; accent-color: #49743a; margin: 0; }
.control input[type=number], .control select { width: 100%; min-height: 44px; padding: 9px 11px; color: var(--ink); background: #fbfcfa; border: 1px solid var(--control-line); border-radius: 7px; font-size: 14px; }
.control small { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.9; }
.lab-output { min-width: 0; padding: 32px; background: #f0f5e9; border: 1px solid #d5e0c8; border-radius: var(--radius); }
.result-label { color: #526c44; font-size: 12px; line-height: 1.9; }
.big-result { font: 500 52px/1.5 var(--serif); letter-spacing: -1px; color: #315d32; margin-top: 12px; }
.big-result small { font: 13px var(--sans); letter-spacing: 0; color: #4c6c3c; margin-left: 12px; }
.formula { font: 13px/2 var(--mono); color: #46613a; border-top: 1px solid #cbdaba; padding: 20px 0 0; margin-top: 24px; overflow-wrap: anywhere; }
.lab-output .explain { color: #4d6841; font-size: 13px; line-height: 2; margin-top: 24px; }
.duty-bar { height: 30px; display: flex; border: 1px solid #92ad7c; border-radius: 5px; overflow: hidden; margin: 28px 0 12px; }
.duty-bar div:first-child { background: #527e3e; }
.duty-bar div:last-child { background: #d2e2bd; }
.bar-legend { display: flex; justify-content: space-between; gap: 16px; color: #4f6b40; font-size: 11px; }
.weight-bars { margin: 28px 0; }
.weight-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 86px; align-items: center; gap: 12px; color: #4e6c3e; font: 12px var(--mono); margin: 16px 0; }
.weight-row i { height: 26px; border-radius: 3px; background: #9ab47d; min-width: 1px; }
.weight-row:first-child i { background: #4c7740; }
.weight-row b { font-weight: 400; text-align: right; }
.route-compare { display: grid; gap: 20px; margin: 24px 0; }
.route-path { padding: 20px; border: 1px solid #bccfad; border-radius: 8px; background: #fbfdf6; }
.route-path.winner { border: 2px solid #6e9351; background: #f5fae9; padding: 19px; }
.route-path header { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #506d3d; font-size: 12px; }
.route-path b { font: 500 22px var(--serif); color: #3e6630; }
.path-nodes { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: #577e3f; font-size: 12px; margin-top: 20px; }
.node { flex-shrink: 0; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #e5efd4; border: 1px solid #8fae74; color: #3b602e; font: 12px var(--mono); }
.gantt { overflow: auto; padding: 20px 0; }
.gantt-track { display: flex; min-width: 280px; height: 50px; margin: 12px 0 24px; }
.gantt-segment { min-width: 2px; flex-shrink: 0; display: grid; place-items: center; border-right: 2px solid #f0f5e9; background: #507444; color: white; font: 12px var(--mono); }
.gantt-segment.b { background: #88a263; color: #132c13; }
.gantt-segment.c { background: #bd9d57; color: #30220a; }
.gantt-segment.idle { background: #d1ddc3; color: #3e5830; }
.schedule-results { color: #47663a; font-size: 13px; line-height: 2; }
.bits { padding: 14px 16px; border: 1px solid #ccdbbc; border-radius: 6px; background: #e2edd5; color: #3d5e2c; font: 13px/2 var(--mono); word-break: break-all; margin: 12px 0; }
.dsss-part { padding: 20px 0; border-bottom: 1px solid #ceddc0; }
.dsss-part h3 { color: #3e6031; font: 13px var(--mono); }
.wave-svg { width: 100%; height: 85px; margin-top: 20px; }
.error-text { color: var(--danger); font-size: 14px; line-height: 1.9; }
.metric-table-wrap { overflow: auto; }
.metric-table { width: 100%; border-collapse: collapse; margin-top: 28px; color: #466438; font: 12px var(--mono); }
.metric-table th, .metric-table td { text-align: center; padding: 12px 10px; border-bottom: 1px solid #c9d9b9; }
.metric-table th { font-weight: 400; color: #4f6c3f; }

/* Modal search and transient status */
.review-section { margin-bottom: 36px; }
.review-list { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.review-row { padding: 26px 28px; }
.review-row + .review-row { border-top: 1px solid var(--line); }
.review-row header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.review-row h3 { font-size: 17px; font-weight: 500; }
.review-formula { padding: 14px 18px; background: #eff5e9; border-left: 2px solid #739359; border-radius: 0 6px 6px 0; font: 14px/1.9 var(--mono); color: #34542d; overflow-wrap: anywhere; }
.review-row > p { font-size: 13px; line-height: 1.9; color: var(--secondary); margin-top: 14px; }
.review-pitfall { display: flex; align-items: baseline; gap: 12px; color: #805c22; font-size: 13px; line-height: 1.9; margin-top: 12px; }
.review-pitfall strong { font-size: 11px; font-weight: 500; white-space: nowrap; padding: 1px 6px; border-radius: 4px; background: var(--warning-bg); }
/* KaTeX assets are local. Keep long display equations inside their panel. */
.katex { font-size: 1.08em; }
.katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 12px 3px; margin: 14px 0; text-align: left; scrollbar-width: thin; }
.katex-display > .katex { text-align: left; }
.katex .cjk_fallback { font-family: var(--sans); font-size: .9em; }
.review-formula { font-family: var(--sans); }
.review-formula .katex-display { margin: 0; padding: 10px 1px; }
.formula .katex-display { margin: 6px 0; }
.steps li > .katex-display { min-width: 0; flex: 1; }
.reading-content p > .katex-display { margin: 18px 0; }
.option-copy > .katex-display { margin: 0; padding: 8px 1px; font-size: .95em; }
.feedback > .katex-display { margin: 10px 0; }
@media (max-width: 768px) {
  .katex { font-size: 1em; }
  .review-formula { min-width: 0; }
  .review-formula .katex-display { font-size: 15px; }
  .steps li { display: block; position: relative; padding-left: 27px; }
  .steps li:before { position: absolute; left: 0; }
}
@media (max-width: 768px) { .review-row { padding: 22px 20px; } .review-row h3 { font-size: 16px; } .review-formula { padding: 14px; font-size: 14px; } .review-row > p { font-size: 14px; } .review-pitfall { font-size: 14px; gap: 8px; } }
dialog { width: 660px; max-width: calc(100vw - 32px); max-height: 78vh; padding: 0; color: var(--ink); background: white; border: 1px solid #bdcbbb; border-radius: 14px; box-shadow: var(--shadow-float); }
dialog::backdrop { background: #152f285c; }
.search-head { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.search-head > span { font-size: 26px; color: var(--green); }
.search-head input { flex: 1; min-width: 0; font-size: 15px; padding: 8px 4px; background: transparent; border: 0; color: var(--ink); border-radius: 4px; }
#search-results { max-height: 52vh; overflow: auto; padding: 10px; }
.search-result { display: block; padding: 16px; border-radius: 7px; }
.search-result:hover, .search-result:focus-visible { background: #edf4e6; }
.search-result h3 { font-size: 14px; }
.search-result p { font-size: 12px; color: var(--secondary); margin-top: 6px; }
.search-foot { font-size: 11px; color: var(--muted); padding: 16px 22px; border-top: 1px solid var(--line); }
#toast { position: fixed; right: 28px; bottom: 24px; max-width: 480px; color: white; background: #224e39; border: 1px solid #40684d; border-radius: 9px; padding: 13px 20px; box-shadow: 0 5px 24px #16372624; opacity: 0; transform: translateY(12px); transition: opacity 160ms var(--ease), transform 160ms var(--ease); font-size: 13px; pointer-events: none; z-index: 70; }
#toast.visible { opacity: 1; transform: translateY(0); }
.fade-in { animation: none; }

@media (min-width: 1500px) {
  main { padding-top: 44px; }
}
@media (max-width: 1250px) {
  :root { --sidebar-width: 224px; }
  .topbar { padding: 0 32px; }
  main { padding: 32px 32px 56px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr) 250px; gap: 20px; }
  .chapter-row { padding: 20px; gap: 12px; }
  .chapter-progress .progress-track { display: none; }
  .stat { padding: 16px; gap: 10px; }
  .stat-icon { display: none; }
  .hero h1 { font-size: 35px; }
  .reading-layout { grid-template-columns: minmax(0, 1fr) 195px; gap: 28px; }
  .lab-workspace { grid-template-columns: 270px minmax(0, 1fr); }
  .lab-output { padding: 26px; }
}
@media (max-width: 1050px) {
  :root { --sidebar-width: 204px; }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .brand { margin-left: 10px; gap: 12px; }
  .brand > span:last-child { font-size: 17px; }
  .brand small { font-size: 8px; }
  .nav-item { font-size: 12px; }
  .topbar { padding: 0 24px; }
  .search-trigger { font-size: 0; border-color: transparent; padding: 0 8px; }
  .search-trigger kbd { display: none; }
  .top-actions { gap: 14px; }
  main { padding: 28px 24px 48px; }
  .overview-grid, .reading-layout { grid-template-columns: minmax(0, 1fr); }
  .focus-card, .reading-side { display: none; }
  .hero h1 { font-size: 32px; }
  .hero-copy > p { font-size: 12px; }
  .hero-actions { gap: 14px; }
  .hero-actions .button { padding-left: 14px; padding-right: 14px; }
  .hero-actions .text-link { font-size: 11px; }
  .stat strong { font-size: 27px; }
  .stat strong small { font-size: 11px; margin-left: 5px; }
  .stat p { font-size: 10px; }
  .lab-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-workspace { grid-template-columns: 245px minmax(0, 1fr); gap: 20px; }
  .lab-controls, .lab-output { padding: 22px; }
  .big-result { font-size: 42px; }
  .route-path header { flex-wrap: wrap; }
  .path-nodes { gap: 4px; font-size: 10px; }
  .node { width: 31px; height: 31px; }
  .course-overview { flex-wrap: wrap; }
}
@media (max-width: 768px) {
  :root { --sidebar-width: 256px; --header-height: 68px; }
  .sidebar { transform: translateX(-100%); transition: transform 200ms var(--ease); box-shadow: var(--shadow-float); padding: 28px 20px max(24px, env(safe-area-inset-bottom)); }
  body.nav-open { overflow: hidden; }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .nav-backdrop { display: block; position: fixed; inset: 0; background: #17392b70; z-index: 35; cursor: default; }
  .workspace { margin-left: 0; }
  .mobile-menu { display: grid; margin-right: 8px; }
  .topbar { padding: 0 max(16px, env(safe-area-inset-left)); }
  .breadcrumb { font-size: 12px; }
  .breadcrumb span { margin: 0 8px; }
  .top-actions { gap: 8px; }
  .search-trigger { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .icon-button { width: 44px; height: 44px; }
  main { padding: 28px 20px 48px; }
  .page-kicker { margin-bottom: 20px; }
  .page-kicker .eyebrow { letter-spacing: 1px; font-size: 10px; }
  .page-kicker .date { display: none; }
  .page-title h1 { font-size: 29px; }
  .page-title p { font-size: 14px; }
  .hero h1 { font-size: 35px; }
  .hero-copy > p { font-size: 13px; }
  .hero-actions { gap: 20px; margin-top: 24px; }
  .hero-actions .button { font-size: 13px; padding: 11px 17px; }
  .hero-actions .text-link { font-size: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; margin: 20px 0 32px; }
  .stat { padding: 18px; min-height: 101px; }
  .stat:nth-child(3), .stat:nth-child(4) { border-top: 1px solid var(--line); }
  .stat:nth-child(3):before { display: none; }
  .stat strong { font-size: 30px; }
  .stat strong small { font-size: 12px; }
  .stat p { font-size: 11px; }
  .section-head { margin-bottom: 18px; gap: 12px; }
  .section-head h2 { font-size: 20px; }
  .section-head h2 small { display: none; }
  .section-head > p { font-size: 11px; }
  .chapter-row { padding: 18px 16px; gap: 12px; min-height: 94px; }
  .chapter-number { display: none; }
  .chapter-mark { width: 38px; height: 38px; border-radius: 8px; font-size: 23px; }
  .chapter-info h3 { font-size: 14px; }
  .chapter-info p { font-size: 11px; }
  .chapter-progress { font-size: 10px; }
  .row-arrow { font-size: 17px; }
  .lab-strip { padding: 20px; gap: 16px; flex-wrap: wrap; }
  .lab-strip-icon { display: none; }
  .lab-strip h3 { font-size: 14px; }
  .lab-strip p { font-size: 12px; }
  .lab-strip a { margin-left: 0; min-height: 40px; }
  .course-overview { padding: 20px; align-items: flex-start; }
  .course-overview p { font-size: 12px; }
  .course-jumps a { width: 44px; min-height: 44px; }
  .course-section { margin-bottom: 32px; }
  .lesson-row { padding: 18px 16px; gap: 12px; min-height: 96px; }
  .lesson-status { width: 29px; height: 29px; font-size: 10px; }
  .lesson-row h3 { font-size: 14px; }
  .lesson-row p { font-size: 12px; }
  .lesson-row .meta { font-size: 10px; }
  .lesson-kind { font-size: 9px; margin-left: 0; margin-top: 6px; padding: 1px 5px; display: table; }
  .lesson-row .row-arrow { display: none; }
  .chapter-banner { padding: 24px; gap: 18px; align-items: flex-start; }
  .chapter-banner .chapter-mark { width: 48px; height: 48px; font-size: 28px; }
  .chapter-banner h1 { font-size: 25px; }
  .chapter-banner p { font-size: 12px; }
  .chapter-banner .eyebrow { font-size: 10px; }
  .lesson-title h1 { font-size: 29px; }
  .lesson-title .subtitle { font-size: 14px; }
  .lesson-meta { gap: 10px 16px; font-size: 12px; }
  .lesson-tabs { gap: 26px; margin-bottom: 28px; }
  .lesson-tabs button { min-height: 54px; font-size: 14px; }
  .reading-content p { font-size: 16px; line-height: 1.95; }
  .reading-content section h2 { font-size: 22px; }
  .reading-content section { margin-bottom: 30px; }
  .worked-example { padding: 22px; }
  .worked-example h3 { font-size: 16px; }
  .worked-example .example-label { font-size: 9px; letter-spacing: 1px; }
  .steps li { font-size: 15px; }
  .pitfall { padding: 18px 20px; }
  .pitfall p { font-size: 14px; }
  .lesson-end { gap: 16px; align-items: flex-start; }
  .lesson-end .text-link { min-height: 44px; }
  .question-card { padding: 22px 20px; }
  .question-top { font-size: 10px; gap: 10px; }
  .question-card h3 { font-size: 16px; }
  .option { font-size: 15px; padding: 12px; gap: 10px; }
  .feedback { font-size: 14px; padding: 16px; }
  .task-box { padding: 22px 20px; }
  .task-box textarea { font-size: 16px; }
  .task-box p { font-size: 15px; }
  .task-box summary { min-height: 44px; }
  .practice-summary { gap: 10px; }
  .summary-tile { padding: 16px 12px; font-size: 11px; }
  .summary-tile b { font-size: 29px; }
  .chip, .text-link { min-height: 44px; }
  .filter-bar { gap: 8px; }
  .library-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .resource-card { padding: 24px; }
  .resource-actions { gap: 4px 16px; }
  .resource-actions a { min-height: 44px; }
  .sources-note { padding: 22px; font-size: 13px; }
  .field-input { font-size: 16px; }
  .lab-cards { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .lab-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 18px; padding: 24px; }
  .lab-glyph { grid-row: 1 / 4; font-size: 28px; margin-top: 2px; }
  .lab-card h3 { font-size: 21px; margin-bottom: 10px; }
  .lab-card p { font-size: 13px; }
  .lab-card .text-link { margin-top: 12px; }
  .lab-workspace { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .lab-controls { padding: 24px; }
  .lab-output { padding: 24px; }
  .control label { font-size: 14px; }
  .control input[type=number], .control select { font-size: 16px; }
  .control small { font-size: 12px; }
  .control input[type=range] { min-height: 40px; }
  .big-result { font-size: 47px; }
  .formula { font-size: 13px; }
  .route-path { padding: 16px; }
  .route-path.winner { padding: 15px; }
  .route-path header { gap: 10px; }
  .route-path b { font-size: 21px; }
  .path-nodes { font-size: 10px; }
  .node { width: 33px; height: 33px; }
  .weight-row { grid-template-columns: 42px minmax(0, 1fr) 77px; gap: 8px; font-size: 11px; }
  .metric-table { font-size: 10px; }
  .metric-table th, .metric-table td { padding: 12px 7px; }
  .search-head { padding: 14px 16px; gap: 10px; }
  .search-head input { font-size: 16px; }
  .search-foot { font-size: 10px; }
  #toast { left: 16px; right: 16px; bottom: max(20px, env(safe-area-inset-bottom)); max-width: none; font-size: 13px; }
  footer { padding: 24px 20px; flex-wrap: wrap; font-size: 11px; }
  footer a { margin-left: 0; min-height: 36px; display: inline-flex; align-items: center; }
  .skip { left: 16px; }
}
@media (max-width: 390px) {
  main { padding-left: 16px; padding-right: 16px; }
  .hero h1 { font-size: 32px; }
  .hero-actions { gap: 14px; }
  .hero-actions .text-link { font-size: 11px; }
  .chapter-row { gap: 10px; padding: 18px 14px; }
  .chapter-info p { font-size: 10px; }
  .chapter-mark { width: 34px; height: 34px; }
  .lesson-row { gap: 10px; padding: 17px 14px; }
  .lesson-row .meta { font-size: 9px; }
  .breadcrumb { font-size: 11px; }
  .topbar { padding-left: 10px; padding-right: 12px; }
}
@media (max-height: 750px) and (min-width: 769px) {
  .sidebar { padding-top: 24px; }
  .brand { margin-bottom: 28px; }
  .sidebar-rule { margin-top: 20px; margin-bottom: 20px; }
  .sidebar-bottom { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
