:root {
  color-scheme: light;
  --bg: #f5f7f5;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --surface-warm: #fbf5ee;
  --ink: #192226;
  --muted: #627076;
  --border: #d8dfdc;
  --border-strong: #bbc7c3;
  --teal: #0e746d;
  --teal-dark: #095852;
  --coral: #bd4b37;
  --gold: #946716;
  --green: #3d7447;
  --focus: #d14e36;
  --shadow: 0 10px 28px rgb(25 34 38 / 8%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171c1d;
  --surface: #202728;
  --surface-2: #293231;
  --surface-warm: #302923;
  --ink: #f3f6f4;
  --muted: #b6c0bd;
  --border: #3b4644;
  --border-strong: #56625f;
  --teal: #63c2b8;
  --teal-dark: #91d9d2;
  --coral: #ef8d77;
  --gold: #e0b760;
  --green: #91c896;
  --focus: #ffad98;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.72;
  letter-spacing: 0;
}
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
a { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 60%, transparent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 60;
  padding: 8px 12px;
  transform: translateY(-150%);
  background: var(--ink);
  color: var(--surface);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  min-height: 72px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand-block {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}
.brand-block > span:last-child { display: grid; }
.brand-block small { color: var(--muted); font-size: 11px; line-height: 1.25; }
.brand-block strong { font-size: 19px; line-height: 1.3; }
.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--teal-dark);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
}
.top-actions, .dialog-actions, .filters { display: flex; align-items: center; gap: 8px; }
.connection-status {
  min-width: max-content;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--border));
  border-radius: 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}
.connection-status.offline { border-color: color-mix(in srgb, var(--gold) 55%, var(--border)); color: var(--gold); }
.button, .icon-button {
  min-height: 39px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
  text-decoration: none;
}
.button { padding: 7px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.button.primary { background: var(--teal); color: #fff; }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.button.secondary:hover { background: var(--surface-2); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.icon-button {
  width: 39px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
  font-size: 19px;
}
.icon-button:hover { background: var(--surface-2); }
.file-button { cursor: pointer; }
.full { width: 100%; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 26px;
  overflow-x: auto;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tab {
  min-width: max-content;
  padding: 12px 1px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font-weight: 750;
}
.tab.active { color: var(--ink); border-bottom-color: var(--coral); }
.tab-badge {
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: var(--coral);
  color: #fff;
  font-size: 10px;
}
.micro-badge { background: var(--teal); }

main { min-height: calc(100vh - 119px); }
.view { display: none; }
.view.active { display: block; }

.learning-shell {
  max-width: 1500px;
  min-height: calc(100vh - 119px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 238px minmax(580px, 1fr) 294px;
  align-items: start;
}
.course-nav {
  position: sticky;
  top: 49px;
  max-height: calc(100vh - 49px);
  padding: 26px 18px 34px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.course-progress { padding-bottom: 19px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.progress-copy { display: flex; align-items: baseline; justify-content: space-between; }
.progress-copy span { color: var(--muted); font-size: 12px; font-weight: 750; }
.progress-copy strong { font-size: 23px; }
.progress-track { height: 7px; margin: 7px 0 8px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width .25s ease; }
.course-progress p { margin: 0; color: var(--muted); font-size: 12px; }
.field-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
select, input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}
select, input { min-height: 40px; padding: 7px 10px; }
textarea { padding: 10px 11px; resize: vertical; }
.week-goal { margin: 15px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.week-goal strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 13px; }
.day-list { margin: 0 0 22px; border-top: 1px solid var(--border); }
.day-link {
  width: 100%;
  min-height: 57px;
  padding: 8px 5px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
}
.day-link:hover { background: var(--surface-2); }
.day-link.active { background: var(--surface-2); box-shadow: inset 3px 0 var(--teal); }
.day-link-number {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.day-link.complete .day-link-number { background: var(--green); border-color: var(--green); color: #fff; }
.day-link-copy { min-width: 0; display: grid; }
.day-link-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.day-link-copy span { color: var(--muted); font-size: 10px; }

.lesson { min-width: 0; background: var(--surface); border-right: 1px solid var(--border); }
.lesson-header, .lesson-section, .lesson-nav { padding-left: 42px; padding-right: 42px; }
.lesson-header { padding-top: 38px; padding-bottom: 0; }
.lesson-path { display: flex; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
.lesson-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-top: 18px; }
.lesson-status-actions { display: flex; align-items: center; gap: 8px; }
.bookmark-button.active { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 55%, var(--border)); background: var(--surface-warm); }
.day-number { margin: 0 0 3px; color: var(--coral); font-size: 12px; font-weight: 900; }
.lesson h1 { margin: 0; font-size: 33px; line-height: 1.25; letter-spacing: 0; }
.day-status {
  min-width: 64px;
  margin-top: 23px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}
.day-status.complete { border-color: var(--green); color: var(--green); background: color-mix(in srgb, var(--green) 9%, var(--surface)); }
.lesson-lead { margin: 15px 0 21px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.lesson-facts {
  margin: 0;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.lesson-facts div { padding: 12px 14px 12px 0; }
.lesson-facts div + div { padding-left: 18px; border-left: 1px solid var(--border); }
.lesson-facts dt { color: var(--muted); font-size: 11px; font-weight: 800; }
.lesson-facts dd { margin: 2px 0 0; font-size: 13px; font-weight: 700; }
.lesson-brief {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.lesson-brief section { min-width: 0; padding: 13px 15px; }
.lesson-brief section:nth-child(2) { border-left: 1px solid var(--border); }
.lesson-brief section:last-child { grid-column: 1 / -1; border-top: 1px solid var(--border); }
.lesson-brief section > span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 850; }
.lesson-brief strong { display: block; font-size: 12px; line-height: 1.55; }
.term-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.term-chips span { padding: 2px 7px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); font-size: 10px; font-weight: 750; }
.lesson-jump { position: sticky; top: 49px; z-index: 20; display: flex; gap: 20px; margin-top: 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.lesson-jump a { padding: 10px 0 9px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 800; }
.lesson-jump a:hover { color: var(--teal-dark); }
.lesson-section { padding-top: 34px; padding-bottom: 38px; border-bottom: 1px solid var(--border); }
.section-kicker { margin: 0 0 4px; color: var(--teal-dark); font-size: 11px; font-weight: 850; }
.lesson-section h2 { margin: 0 0 16px; font-size: 23px; line-height: 1.35; }
.lesson-section h3 { margin: 26px 0 10px; font-size: 16px; }
.lesson-section > p:not(.section-kicker), .lecture p { margin: 0 0 13px; }
.lecture { padding-left: 17px; border-left: 3px solid var(--gold); }
.research-link { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--border); }
.research-link strong { color: var(--coral); font-size: 12px; }
.research-link p { margin: 4px 0 0; color: var(--muted); }
.lesson-micro { background: color-mix(in srgb, var(--surface-warm) 52%, var(--surface)); }
.lesson-micro .section-heading { align-items: flex-start; }
.lesson-micro .section-heading p { margin: 5px 0 0; color: var(--muted); }
.micro-duration { flex: 0 0 auto; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--teal-dark); font-size: 11px; font-weight: 850; }
.day-micro-list { border-top: 1px solid var(--border); }
.day-micro-item { width: 100%; min-height: 74px; padding: 12px 5px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--ink); text-align: left; }
.day-micro-item:hover { background: var(--surface); }
.day-micro-item > span:nth-child(2) { min-width: 0; display: grid; }
.day-micro-item strong { font-size: 14px; }
.day-micro-item small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.day-micro-item > span:last-child { color: var(--muted); font-size: 10px; font-weight: 800; }
.day-micro-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-size: 11px; font-weight: 900; }
.day-micro-item.complete .day-micro-icon { background: var(--green); }
.schedule { margin: 0; padding: 0; list-style: none; counter-reset: schedule; }
.schedule li {
  position: relative;
  min-height: 58px;
  padding: 0 0 19px 114px;
  counter-increment: schedule;
}
.schedule li:not(:last-child)::after { content: ""; position: absolute; left: 91px; top: 27px; bottom: 0; border-left: 1px solid var(--border-strong); }
.schedule-time { position: absolute; left: 0; top: 2px; width: 78px; color: var(--muted); font-size: 11px; text-align: right; }
.schedule li::before {
  content: counter(schedule);
  position: absolute;
  left: 82px;
  top: 0;
  z-index: 1;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}
.schedule-task { display: block; line-height: 1.65; }
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin: 7px 0; padding-left: 3px; }
.execution-list { margin-top: 25px; border-top: 1px solid var(--border); }
.execution-step { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 18px; padding: 17px 0; border-bottom: 1px solid var(--border); }
.execution-step strong { color: var(--teal-dark); font-size: 13px; }
.execution-step p { margin: 0; }
.deliverable-line { margin-top: 24px; padding: 16px 18px; display: grid; grid-template-columns: 88px 1fr; gap: 12px; background: var(--surface-warm); border-left: 4px solid var(--gold); }
.deliverable-line span { color: var(--gold); font-size: 11px; font-weight: 900; }
.deliverable-line strong { font-size: 14px; }
.self-test { counter-reset: tests; }
.test-question { position: relative; padding: 16px 0 16px 42px; border-top: 1px solid var(--border); counter-increment: tests; }
.test-question::before { content: counter(tests); position: absolute; left: 0; top: 17px; color: var(--coral); font-weight: 900; }
.test-question p { margin: 0; }
.recall-control { width: fit-content; margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.recall-control button { min-width: 76px; min-height: 32px; padding: 4px 9px; border: 0; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 750; }
.recall-control button + button { border-left: 1px solid var(--border); }
.recall-control button[data-rating="review"][aria-pressed="true"] { background: color-mix(in srgb, var(--coral) 12%, var(--surface)); color: var(--coral); }
.recall-control button[data-rating="known"][aria-pressed="true"] { background: color-mix(in srgb, var(--green) 12%, var(--surface)); color: var(--green); }
.test-summary { min-height: 21px; margin: 12px 0 0 !important; color: var(--muted); font-size: 12px; }
.answers { margin-top: 18px; padding: 18px 20px; background: var(--surface-2); border-left: 4px solid var(--teal); }
.answer-item { display: grid; grid-template-columns: 24px 1fr; gap: 8px; margin: 0 0 13px; }
.answer-item:last-child { margin-bottom: 0; }
.answer-item strong { color: var(--teal-dark); }
.acceptance { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.acceptance-item { padding: 13px 0; border-top: 1px solid var(--border); }
.acceptance-item label { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; cursor: pointer; }
.acceptance-item input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--green); }
.acceptance-item input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.completion-row { margin-top: 15px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }
.completion-row strong { color: var(--green); }
.fallback-section { border-bottom: 0; }
.fallback-section > p:not(.section-kicker) { padding-left: 16px; border-left: 3px solid var(--coral); }
.lesson-nav { padding-top: 23px; padding-bottom: 42px; display: flex; justify-content: space-between; gap: 14px; border-top: 1px solid var(--border); }

.study-tools { position: sticky; top: 49px; max-height: calc(100vh - 49px); padding: 24px 18px 36px; overflow-y: auto; }
.tool-panel { margin-bottom: 16px; padding: 19px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.tool-panel h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.timer-modes { display: grid; grid-template-columns: 1fr 1fr; margin-top: 11px; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.timer-modes button { min-height: 34px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; }
.timer-modes button + button { border-left: 1px solid var(--border); }
.timer-modes button.active { background: var(--surface-2); color: var(--teal-dark); }
.timer { display: block; margin: 16px 0; color: var(--ink); font: 750 36px/1.15 ui-monospace, "Cascadia Mono", monospace; text-align: center; }
.timer-actions { display: grid; grid-template-columns: 1fr 39px; gap: 8px; }
.study-log label, .research-form label { display: block; margin: 14px 0 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.study-log .button + .button { margin-top: 8px; }
.stepper { display: grid; grid-template-columns: 40px 1fr 40px; }
.stepper button { border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); font-size: 18px; }
.stepper button:first-child { border-radius: 5px 0 0 5px; }
.stepper button:last-child { border-radius: 0 5px 5px 0; }
.stepper input { border-radius: 0; border-inline: 0; text-align: center; }
.save-status { min-height: 20px; margin: 8px 0 0; color: var(--green); font-size: 11px; }
.week-stats dl { margin: 8px 0 0; }
.week-stats dl div { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--border); }
.week-stats dt { color: var(--muted); font-size: 12px; }
.week-stats dd { margin: 0; font-weight: 800; }

.page-heading { padding: 38px max(28px, calc((100% - 1180px) / 2)); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.page-heading h2, .section-heading h2, .section-heading h3, .dialog-heading h2 { margin: 0; line-height: 1.25; }
.page-heading h2 { font-size: 32px; }
.page-heading > p:last-child { margin: 8px 0 0; color: var(--muted); }
.microcourse-shell { max-width: 1440px; min-height: calc(100vh - 244px); margin: 0 auto; display: grid; grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.micro-catalog { position: sticky; top: 49px; max-height: calc(100vh - 49px); padding: 25px 18px 40px; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); }
.micro-progress-copy { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.micro-progress-copy span { color: var(--muted); font-size: 11px; font-weight: 800; }
.micro-progress-copy strong { font-size: 19px; }
.micro-filters { max-width: none; margin: 15px 0 11px; gap: 5px; flex-wrap: wrap; }
.micro-filters .filter-button { min-width: 0; padding: 5px 8px; font-size: 10px; }
.micro-list { border-top: 1px solid var(--border); }
.micro-list-item { width: 100%; min-height: 74px; padding: 11px 5px; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 9px; align-items: center; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--ink); text-align: left; }
.micro-list-item:hover { background: var(--surface-2); }
.micro-list-item.active { background: var(--surface-2); box-shadow: inset 3px 0 var(--teal); }
.micro-list-item > span:last-child { min-width: 0; display: grid; }
.micro-list-item strong { font-size: 12px; line-height: 1.4; }
.micro-list-item small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.micro-list-state { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--muted); font-size: 9px; font-weight: 900; }
.micro-list-item.complete .micro-list-state { border-color: var(--green); background: var(--green); color: #fff; }
.micro-player { min-width: 0; padding: 34px 42px 64px; }
.micro-player-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.micro-player-header h2 { margin: 0; font-size: 27px; line-height: 1.3; }
.micro-player-header > div > p:last-child { margin: 7px 0 0; color: var(--muted); }
.micro-complete-state { flex: 0 0 auto; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--muted); font-size: 10px; font-weight: 850; }
.micro-complete-state.complete { border-color: var(--green); background: color-mix(in srgb, var(--green) 9%, var(--surface)); color: var(--green); }
.micro-screen { min-height: 570px; display: grid; grid-template-rows: auto 290px minmax(0, 1fr); background: #172021; color: #f6faf8; border: 1px solid #344143; box-shadow: var(--shadow); }
.micro-screen-top { min-height: 43px; padding: 10px 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #344143; color: #b9c7c5; font-size: 10px; font-weight: 850; }
.micro-visual { min-width: 0; height: 290px; padding: 35px clamp(26px, 6vw, 78px); display: flex; align-items: center; justify-content: center; gap: clamp(20px, 4vw, 58px); overflow: hidden; border-bottom: 1px solid #344143; }
.visual-node { --node-color: #5ebbb1; position: relative; min-width: 120px; min-height: 74px; padding: 13px 14px; display: grid; align-content: center; justify-items: center; border: 1px solid color-mix(in srgb, var(--node-color) 72%, #344143); background: #202b2c; text-align: center; opacity: 0; transform: translateY(10px); animation: micro-node-in .42s ease forwards; animation-delay: calc(var(--node-order) * 90ms); }
.visual-node span { color: var(--node-color); font-size: 16px; font-weight: 900; }
.visual-node strong { margin-top: 3px; color: #eef4f2; font-size: 11px; font-weight: 650; }
.tone-teal { --node-color: #63c2b8; }
.tone-gold { --node-color: #e0b760; }
.tone-coral { --node-color: #ef8d77; }
.tone-green { --node-color: #91c896; }
.layout-flow .visual-node:not(:last-child)::after { content: "→"; position: absolute; left: calc(100% + clamp(7px, 1.8vw, 25px)); top: 50%; color: #859391; font-size: 19px; transform: translate(-50%, -50%); }
.layout-flow.reverse .visual-node:not(:last-child)::after { content: "←"; }
.layout-stack { flex-direction: column; gap: 8px; padding-block: 18px; }
.layout-stack .visual-node { width: min(420px, 78%); min-height: 52px; padding-block: 8px; }
.layout-stack .visual-node + .visual-node::before { content: "↓"; position: absolute; bottom: calc(100% - 2px); color: #859391; font-size: 12px; }
.layout-matrix { display: grid; grid-template-columns: repeat(2, minmax(120px, 220px)); grid-template-rows: repeat(2, minmax(72px, 1fr)); gap: 10px; }
.layout-matrix .visual-node { min-width: 0; height: 100%; }
.layout-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); align-content: center; gap: 14px; }
.layout-compare .visual-node { min-width: 0; min-height: 110px; }
.layout-plot { align-items: flex-end; gap: clamp(12px, 3vw, 34px); padding-top: 44px; }
.layout-plot .visual-node { width: min(145px, 23%); min-width: 86px; height: var(--bar-size); min-height: 64px; padding: 8px; border-top-width: 4px; }
.micro-caption { min-height: 230px; padding: 25px clamp(24px, 5vw, 58px) 30px; }
.micro-caption h3 { margin: 0 0 9px; color: #fff; font-size: 22px; line-height: 1.35; }
.micro-caption p { margin: 0; color: #c8d2d0; font-size: 14px; line-height: 1.8; }
.micro-caption code { margin: 15px 0 0; padding: 9px 12px; display: block; overflow-wrap: anywhere; border-left: 3px solid #e0b760; background: #202b2c; color: #f1d18b; font: 650 13px/1.65 ui-monospace, "Cascadia Mono", monospace; white-space: normal; }
.micro-caption > strong { margin-top: 15px; padding-top: 13px; display: block; border-top: 1px solid #344143; color: #91c896; font-size: 12px; }
.micro-timeline { height: 58px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border); border-top: 0; background: var(--surface); }
.micro-timeline button { min-width: 0; padding: 7px 7px 5px; display: grid; align-content: center; gap: 4px; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--muted); }
.micro-timeline button:last-child { border-right: 0; }
.micro-timeline button > span { width: 100%; height: 4px; border-radius: 2px; background: var(--border); }
.micro-timeline button.viewed > span { background: var(--green); }
.micro-timeline button.active > span { background: var(--coral); }
.micro-timeline small { overflow: hidden; font-size: 9px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.micro-timeline button.active small { color: var(--ink); }
.micro-controls { min-height: 62px; padding: 11px 0; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.micro-play { min-width: 108px; }
.micro-speed { margin-left: auto; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.micro-speed select { width: 78px; min-height: 39px; }
.micro-transcript { margin-top: 28px; }
.micro-transcript .section-heading { margin-bottom: 10px; }
.micro-transcript ol { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.micro-transcript li { border-bottom: 1px solid var(--border); }
.micro-transcript li.active { background: var(--surface-2); box-shadow: inset 3px 0 var(--coral); }
.micro-transcript button { width: 100%; padding: 13px 15px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; border: 0; background: transparent; color: var(--ink); text-align: left; }
.micro-transcript button > span:first-child { color: var(--coral); font-size: 10px; font-weight: 900; }
.micro-transcript button > span:last-child { min-width: 0; display: grid; }
.micro-transcript strong { font-size: 13px; }
.micro-transcript small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
@keyframes micro-node-in { to { opacity: 1; transform: translateY(0); } }
.review-summary {
  max-width: 1180px;
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  background: var(--surface);
}
.review-summary div { padding: 17px 20px; border-right: 1px solid var(--border); }
.review-summary div:last-child { border-right: 0; }
.review-summary span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.review-summary strong { margin-right: 4px; font-size: 25px; }
.review-summary small { color: var(--muted); }
.review-layout { max-width: 1180px; margin: 22px auto 64px; display: grid; grid-template-columns: 1.35fr .85fr; gap: 22px; align-items: start; }
.review-section, .portfolio-section { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.review-list { border-top: 1px solid var(--border); }
.review-item, .bookmark-item { padding: 17px 0; border-bottom: 1px solid var(--border); }
.review-item:last-child, .bookmark-item:last-child { border-bottom: 0; }
.review-item-head { display: flex; gap: 9px; align-items: baseline; }
.review-item-head span, .bookmark-item > span { color: var(--coral); font-size: 10px; font-weight: 850; }
.review-item p, .bookmark-item p { margin: 7px 0; }
.bookmark-item > strong { display: block; font-size: 15px; }
.bookmark-item p { color: var(--muted); font-size: 12px; }
.review-item details { margin-top: 9px; padding: 9px 11px; background: var(--surface-2); border-left: 3px solid var(--teal); }
.review-item summary { cursor: pointer; color: var(--teal-dark); font-size: 12px; font-weight: 800; }
.review-item details div { padding-top: 7px; font-size: 12px; }
.review-actions { margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.review-actions .button { min-height: 34px; padding: 5px 10px; font-size: 11px; }
.checkpoint-grid { max-width: 1180px; margin: 24px auto; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.checkpoint-card { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.checkpoint-card.complete { border-left: 5px solid var(--green); }
.checkpoint-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.checkpoint-card header span { color: var(--coral); font-size: 10px; font-weight: 850; }
.checkpoint-card header h3 { margin: 2px 0 0; font-size: 19px; }
.checkpoint-card header > strong { color: var(--teal-dark); font-size: 17px; }
.checkpoint-card > p { min-height: 54px; color: var(--muted); font-size: 12px; }
.checkpoint-progress { height: 7px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.checkpoint-progress span { display: block; height: 100%; background: var(--teal); }
.checkpoint-days { margin: 6px 0 14px; color: var(--muted); font-size: 10px; text-align: right; }
.checkpoint-checks label { padding: 10px 0; display: grid; grid-template-columns: 21px 1fr; gap: 9px; border-top: 1px solid var(--border); font-size: 12px; cursor: pointer; }
.checkpoint-checks input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--green); }
.checkpoint-card dl { margin: 16px 0; padding: 12px 14px; background: var(--surface-warm); border-left: 3px solid var(--gold); }
.checkpoint-card dt { color: var(--gold); font-size: 10px; font-weight: 900; }
.checkpoint-card dd { margin: 3px 0 0; font-size: 12px; font-weight: 750; }
.evidence-label { display: grid; gap: 5px; margin: 14px 0; color: var(--muted); font-size: 10px; font-weight: 850; }
.stage-evidence { color: var(--ink); font-size: 12px; font-weight: 400; }
.portfolio-section { max-width: 1180px; margin: 0 auto 64px; }
.portfolio-list { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
.portfolio-item { min-height: 75px; padding: 11px 14px; display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: transparent; color: var(--ink); text-align: left; }
.portfolio-item:nth-child(even) { border-right: 0; }
.portfolio-item:hover { background: var(--surface-2); }
.portfolio-item > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--muted); font-size: 10px; font-weight: 850; }
.portfolio-item.complete > span:first-child { background: var(--green); border-color: var(--green); color: #fff; }
.portfolio-item > span:last-child { min-width: 0; display: grid; }
.portfolio-item strong { font-size: 13px; }
.portfolio-item small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.roadmap-visual { max-width: 1180px; margin: 24px auto 8px; padding: 18px 22px; background: var(--surface); border: 1px solid var(--border); }
.roadmap-visual img { display: block; width: 100%; height: auto; max-height: 330px; object-fit: contain; }
.filters { max-width: 1180px; margin: 23px auto 8px; overflow-x: auto; }
.filter-button { min-width: max-content; padding: 7px 12px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--muted); font-weight: 750; }
.filter-button.active { border-color: var(--teal); background: var(--surface-2); color: var(--teal-dark); }
.roadmap-list { max-width: 1180px; margin: 0 auto; padding: 11px 0 64px; }
.week-card { margin-bottom: 9px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.week-card.complete { border-left: 5px solid var(--green); }
.week-summary { width: 100%; min-height: 86px; padding: 14px 18px; display: grid; grid-template-columns: 70px minmax(0, 1fr) 80px 22px; align-items: center; gap: 14px; text-align: left; border: 0; background: transparent; color: var(--ink); }
.week-summary:hover { background: var(--surface-2); }
.week-number { color: var(--teal-dark); font-size: 21px; font-weight: 900; }
.week-main { display: grid; }
.week-phase { color: var(--muted); font-size: 11px; }
.week-title { font-size: 17px; }
.week-goal { color: var(--muted); font-size: 12px; }
.week-progress { color: var(--teal-dark); font-weight: 850; text-align: right; }
.chevron { font-size: 21px; transition: transform .18s ease; }
.week-summary[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.week-details { padding: 5px 20px 22px 104px; border-top: 1px solid var(--border); }
.week-details h4 { margin: 15px 0 7px; font-size: 13px; }
.concepts { display: flex; flex-wrap: wrap; gap: 7px; }
.concepts span { padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); font-size: 11px; }
.week-tasks { margin: 0; padding-left: 22px; }
.week-tasks li { margin: 4px 0; }
.week-details dl { margin: 15px 0; }
.week-details dl div { display: grid; grid-template-columns: 86px 1fr; padding: 8px 0; border-top: 1px solid var(--border); }
.week-details dt { font-weight: 800; }
.week-details dd { margin: 0; color: var(--muted); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.section-heading.compact { margin-bottom: 15px; }
.section-heading h3 { font-size: 19px; }
.resource-section, .research-form, .evidence-board, .experiment-section { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.resource-section { max-width: 1180px; margin: -35px auto 64px; padding: 23px; }
.resource-list { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.resource-link { min-height: 118px; padding: 16px 17px; text-decoration: none; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.resource-link:nth-child(3n) { border-right: 0; }
.resource-link strong { display: block; color: var(--teal-dark); }
.resource-link span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.resource-link:hover { background: var(--surface-2); }
.research-grid { max-width: 1180px; margin: 28px auto; display: grid; grid-template-columns: 1fr 1fr; gap: 23px; }
.research-form, .evidence-board, .experiment-section { padding: 23px; }
.research-form h3 { margin: 0 0 11px; font-size: 19px; }
.evidence-row { padding: 12px 0; border-top: 1px solid var(--border); }
.evidence-row:first-child { border-top: 0; }
.evidence-row input { margin-bottom: 7px; }
.evidence-actions { display: flex; justify-content: flex-end; }
.delete-button { min-height: 34px; border: 0; background: transparent; color: var(--coral); font-weight: 750; }
.empty-state { margin: 21px 0; color: var(--muted); text-align: center; }
.experiment-section { max-width: 1180px; margin: 0 auto 64px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; }
td input, td select { min-width: 110px; }
.search-box { max-width: 1180px; margin: 23px auto 12px; display: grid; grid-template-columns: 34px 1fr; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.search-box span { color: var(--muted); font-size: 20px; text-align: center; }
.search-box input { border: 0; }
.glossary-list { max-width: 1180px; margin: 0 auto; padding: 12px 0 64px; display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--border); }
.term { padding: 18px 20px; background: var(--surface); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.term:nth-child(even) { border-right: 0; }
.term dt { color: var(--teal-dark); font-weight: 850; }
.term dd { margin: 3px 0 0; color: var(--muted); }

dialog { width: min(680px, calc(100% - 28px)); max-height: 88vh; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(25 34 38 / 58%); }
dialog form { padding: 23px; }
.search-dialog { width: min(820px, calc(100% - 28px)); }
.dialog-search { max-width: none; margin: 0; }
.search-meta { min-height: 31px; padding: 8px 1px; color: var(--muted); font-size: 11px; }
.course-search-results { max-height: 56vh; overflow-y: auto; border-top: 1px solid var(--border); }
.course-search-result { width: 100%; padding: 13px 5px; display: grid; gap: 2px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--ink); text-align: left; }
.course-search-result:hover { background: var(--surface-2); }
.course-search-result span { color: var(--coral); font-size: 10px; font-weight: 850; }
.course-search-result strong { font-size: 14px; }
.course-search-result small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.app-toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(360px, calc(100% - 30px)); padding: 11px 15px; border-radius: 5px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-size: 12px; font-weight: 750; }
.dialog-heading { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.assessment-item { padding: 12px 0; border-top: 1px solid var(--border); }
.assessment-item label { display: grid; grid-template-columns: 24px 1fr; gap: 8px; cursor: pointer; }
.assessment-item input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--teal); }
.dialog-actions { justify-content: flex-end; margin-top: 21px; }
.assessment-result { min-height: 24px; margin: 11px 0 0; color: var(--teal-dark); font-weight: 750; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1240px) {
  .learning-shell { grid-template-columns: 220px minmax(540px, 1fr); }
  .study-tools { position: static; grid-column: 2; max-height: none; padding: 24px 34px 40px; display: grid; grid-template-columns: 0.8fr 1.4fr 0.8fr; gap: 15px; border-top: 1px solid var(--border); background: var(--bg); }
  .tool-panel { margin-bottom: 0; }
}

@media (max-width: 900px) {
  .learning-shell { display: block; }
  .course-nav { position: static; max-height: none; padding: 18px; border-right: 0; border-bottom: 1px solid var(--border); }
  .course-progress { max-width: 280px; }
  .week-goal { max-width: 700px; }
  .day-list { display: grid; grid-template-columns: repeat(7, minmax(82px, 1fr)); overflow-x: auto; }
  .day-link { min-width: 90px; grid-template-columns: 1fr; gap: 3px; justify-items: center; text-align: center; border-right: 1px solid var(--border); }
  .day-link-copy strong { max-width: 78px; }
  .lesson { border-right: 0; }
  .study-tools { display: grid; grid-template-columns: 1fr 1.4fr; padding: 22px 18px 38px; }
  .week-stats { grid-column: 1 / -1; }
  .research-grid { margin-inline: 18px; grid-template-columns: 1fr; }
  .microcourse-shell { display: block; }
  .micro-catalog { position: static; max-height: none; padding: 20px 18px; border-right: 0; border-bottom: 1px solid var(--border); }
  .micro-filters { overflow-x: auto; flex-wrap: nowrap; }
  .micro-list { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 42vw); overflow-x: auto; }
  .micro-list-item { border-right: 1px solid var(--border); }
  .micro-player { padding: 28px 18px 54px; }
  .experiment-section, .resource-section, .filters, .roadmap-list, .roadmap-visual, .search-box, .glossary-list, .review-summary, .review-layout, .checkpoint-grid, .portfolio-section { margin-inline: 18px; }
  .review-layout, .checkpoint-grid { grid-template-columns: 1fr; }
  .resource-list { grid-template-columns: repeat(2, 1fr); }
  .resource-link:nth-child(3n) { border-right: 1px solid var(--border); }
  .resource-link:nth-child(2n) { border-right: 0; }
}

@media (max-width: 650px) {
  html { scroll-padding-top: 54px; }
  .topbar { padding: 10px 14px; align-items: flex-start; flex-direction: column; gap: 10px; }
  .top-actions { width: 100%; display: flex; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .top-actions > * { flex: 0 0 auto; }
  .connection-status { display: none; }
  .install-button[hidden] { display: none; }
  .top-actions .button { padding-inline: 9px; font-size: 12px; white-space: nowrap; }
  .tabs { padding-inline: 14px; gap: 20px; }
  .course-nav { padding-inline: 14px; }
  .lesson-header, .lesson-section, .lesson-nav { padding-left: 18px; padding-right: 18px; }
  .lesson-header { padding-top: 27px; }
  .lesson h1 { font-size: 27px; }
  .lesson-title-row { gap: 10px; }
  .lesson-status-actions { flex-direction: column-reverse; }
  .day-status { min-width: 56px; margin-top: 20px; }
  .lesson-lead { font-size: 15px; }
  .lesson-facts { grid-template-columns: 1fr; }
  .lesson-facts div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }
  .lesson-brief { grid-template-columns: 1fr; }
  .lesson-brief section:nth-child(2) { border-left: 0; border-top: 1px solid var(--border); }
  .lesson-brief section:last-child { grid-column: auto; }
  .lesson-jump { top: 47px; gap: 0; justify-content: space-between; }
  .lesson-jump a { padding-inline: 3px; font-size: 11px; }
  .schedule li { padding-left: 96px; }
  .schedule-time { width: 62px; }
  .schedule li::before { left: 70px; }
  .schedule li:not(:last-child)::after { left: 79px; }
  .execution-step { grid-template-columns: 1fr; gap: 4px; }
  .day-micro-item { grid-template-columns: 38px minmax(0, 1fr); }
  .day-micro-item > span:last-child { grid-column: 2; }
  .deliverable-line { grid-template-columns: 1fr; gap: 3px; }
  .completion-row { flex-direction: column; gap: 4px; }
  .lesson-nav .button { flex: 1; }
  .study-tools { display: block; }
  .tool-panel { margin-bottom: 15px; }
  .page-heading { padding: 30px 18px; }
  .page-heading h2 { font-size: 27px; }
  .week-summary { grid-template-columns: 50px minmax(0, 1fr) 40px 18px; gap: 7px; padding-inline: 11px; }
  .week-number { font-size: 16px; }
  .week-title { font-size: 15px; }
  .week-goal { display: none; }
  .week-progress { font-size: 11px; }
  .week-details { padding: 3px 15px 18px; }
  .week-details dl div { grid-template-columns: 1fr; gap: 3px; }
  .resource-list, .glossary-list { grid-template-columns: 1fr; }
  .review-summary { grid-template-columns: 1fr 1fr; }
  .review-summary div { border-bottom: 1px solid var(--border); }
  .review-summary div:nth-child(even) { border-right: 0; }
  .review-summary div:nth-child(n+3) { border-bottom: 0; }
  .portfolio-list { grid-template-columns: 1fr; }
  .portfolio-item, .portfolio-item:nth-child(even) { border-right: 0; }
  .checkpoint-card > p { min-height: 0; }
  .review-actions .button { flex: 1; }
  .micro-player { padding-inline: 14px; }
  .micro-player-header { display: grid; gap: 9px; }
  .micro-player-header h2 { font-size: 23px; }
  .micro-complete-state { width: fit-content; }
  .micro-screen { min-height: 600px; grid-template-rows: auto 270px minmax(0, 1fr); }
  .micro-visual { height: 270px; padding: 20px 13px; gap: 16px; }
  .visual-node { min-width: 78px; min-height: 68px; padding: 9px 7px; }
  .visual-node span { font-size: 13px; }
  .visual-node strong { font-size: 9px; }
  .layout-flow { gap: 19px; }
  .layout-flow .visual-node:not(:last-child)::after { left: calc(100% + 9px); font-size: 13px; }
  .layout-flow .visual-node:nth-child(n+4) { display: none; }
  .layout-stack .visual-node { width: 84%; min-height: 48px; }
  .layout-matrix { grid-template-columns: 1fr 1fr; gap: 8px; }
  .layout-compare { grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)); gap: 8px; }
  .layout-compare .visual-node { min-height: 92px; }
  .layout-plot { gap: 8px; }
  .layout-plot .visual-node { min-width: 60px; width: 23%; }
  .micro-caption { min-height: 285px; padding: 21px 17px 25px; }
  .micro-caption h3 { font-size: 19px; }
  .micro-caption p { font-size: 13px; }
  .micro-timeline { height: 52px; }
  .micro-timeline small { display: none; }
  .micro-controls { display: grid; grid-template-columns: 39px 1fr 39px; }
  .micro-controls #microSpeak { grid-column: 1 / 3; }
  .micro-speed { margin-left: 0; justify-content: flex-end; }
  .micro-list { grid-auto-columns: minmax(225px, 78vw); }
  .resource-link, .resource-link:nth-child(2n), .resource-link:nth-child(3n), .term { border-right: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
