:root {
  --bg: #f5f5f0;
  --paper: #fffefa;
  --ink: #152728;
  --muted: #60706e;
  --line: #dce2db;
  --accent: #167364;
  --accent-soft: #e1eee6;
  --orange: #bd633a;
  --orange-soft: #f7e9dc;
  --nav: #132529;
  --nav-muted: #9eb1b0;
  --shadow: 0 12px 40px #13252908;
  --radius: 14px;
  --mono:
    ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
summary,
textarea {
  -webkit-tap-highlight-color: transparent;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.4;
}
button,
input,
select,
textarea {
  border-radius: 7px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible {
  outline: 3px solid #41a393;
  outline-offset: 3px;
}
button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.16s,
    border-color 0.16s;
}
button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
button.primary,
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover {
  background: #125d52;
}
button.ghost {
  background: transparent;
}
button.icon-btn {
  width: 36px;
  height: 36px;
  padding: 6px;
  display: grid;
  place-items: center;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  padding: 10px 17px;
  font-weight: 600;
  font-size: 14px;
}
.button:hover {
  text-decoration: none;
  border-color: var(--accent);
}
.button svg,
button svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
svg {
  max-width: 100%;
  height: auto;
  display: block;
}
svg text {
  font-family: var(--sans);
}
.mono,
code,
pre {
  font-family: var(--mono);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
  white-space: nowrap;
}
.badge.green {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c3dcce;
}
.badge.orange {
  background: var(--orange-soft);
  color: var(--orange);
  border-color: #ebcfb9;
}
.skip {
  position: fixed;
  top: -100px;
  left: 20px;
  background: white;
  padding: 12px;
  z-index: 1000;
}
.skip:focus {
  top: 10px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.hidden {
  display: none !important;
}
/* application frame */
.sidebar {
  width: 256px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--nav);
  color: white;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.brand {
  padding: 28px 24px 20px;
  display: flex;
  gap: 13px;
  align-items: center;
  color: white;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
}
.brand strong {
  display: block;
  letter-spacing: 2.2px;
  font-size: 13px;
  line-height: 1.5;
}
.brand span {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--nav-muted);
}
.search-launch {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #ffffff08 !important;
  border-color: #ffffff1b !important;
  color: #cbd7d2;
  margin: 0 18px 17px;
  padding: 9px 11px;
  font-weight: 400;
  text-align: left;
  font-size: 12px;
}
.search-launch kbd {
  margin-left: auto;
  border: 1px solid #ffffff24;
  border-radius: 3px;
  font: 10px var(--mono);
  padding: 2px 4px;
}
.sidebar-nav {
  overflow: auto;
  padding: 0 14px 16px;
  scrollbar-width: thin;
  scrollbar-color: #52615d transparent;
  flex: 1;
}
.nav-group {
  margin: 15px 10px 5px;
  font-size: 10px;
  letter-spacing: 1.2px;
  color: #90a8a5;
}
.nav-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  color: #b9cac6;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.65;
  position: relative;
}
.nav-item:hover {
  color: white;
  background: #ffffff08;
  text-decoration: none;
}
.nav-item.active {
  background: #2a4845;
  color: #e7fbef;
}
.nav-num {
  font: 10px var(--mono);
  min-width: 17px;
  color: #6d8985;
}
.nav-item.active .nav-num {
  color: #9ccfba;
}
.nav-check {
  margin-left: auto;
  color: #80bb9b;
  font-size: 10px;
}
.side-bottom {
  border-top: 1px solid #ffffff14;
  padding: 17px 24px 20px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  color: #a9c1b8;
  font-size: 11px;
}
.progress-track {
  height: 3px;
  background: #ffffff14;
  margin: 8px 0 10px;
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  background: #8bd0ad;
  height: 100%;
  transition: width 0.3s;
}
.local-label {
  font-size: 10px;
  color: #738e88;
}
.shell {
  margin-left: 256px;
}
.topbar {
  height: 72px;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: #f5f5f0ed;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.top-links {
  display: flex;
  gap: 27px;
  align-items: center;
}
.top-link {
  font-size: 13px;
  color: var(--muted);
  height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.top-link.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 650;
}
.top-link:hover {
  text-decoration: none;
}
.top-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}
.version {
  font: 10px var(--mono);
  color: var(--muted);
  letter-spacing: 0.5px;
}
.menu-toggle {
  display: none !important;
}
.main {
  max-width: 1440px;
  padding: 38px 42px 72px;
  margin: auto;
  min-height: calc(100vh - 72px);
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 10px;
}
.breadcrumb {
  font-size: 11px;
  color: var(--muted);
}
.breadcrumb span {
  padding: 0 9px;
  color: #a1aaa2;
}
.page-title {
  font-size: 32px;
  line-height: 1.4;
  letter-spacing: -1px;
  margin: 8px 0 12px;
}
.page-intro {
  max-width: 720px;
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 30px;
}
/* homepage */
.hero {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 38px;
  align-items: center;
  padding: 16px 0 38px;
}
.hero h1 {
  font-size: clamp(34px, 3.5vw, 54px);
  line-height: 1.27;
  letter-spacing: -2px;
  margin: 15px 0 22px;
  font-weight: 720;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p {
  color: var(--muted);
  max-width: 485px;
  font-size: 14px;
  line-height: 1.95;
  margin-bottom: 26px;
}
.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-meta {
  display: flex;
  gap: 22px;
  margin-top: 27px;
  font-size: 11px;
  color: var(--muted);
}
.hero-meta b {
  display: block;
  font: 21px var(--mono);
  color: var(--ink);
  font-weight: 600;
}
.hero-diagram {
  background: #eaf0e8;
  border: 1px solid #d5ded3;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  min-height: 328px;
}
.diagram-label {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px 0;
  color: #627b71;
  font: 10px var(--mono);
  letter-spacing: 1px;
}
.hero-diagram svg {
  width: 100%;
  padding: 6px 12px 10px;
}
.legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  margin: 10px 0;
}
.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 31px 0 15px;
  gap: 15px;
}
.section-heading h2 {
  font-size: 19px;
  margin: 0;
  letter-spacing: -0.4px;
}
.section-heading span,
.section-heading a {
  font-size: 11px;
  color: var(--muted);
}
.question-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
}
.question-card {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition:
    transform 0.18s,
    border-color 0.18s;
  color: var(--ink);
}
.question-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--accent);
}
.question-card .icon {
  width: 32px;
  height: 32px;
  border: 1px solid #d7e4d9;
  border-radius: 8px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  color: var(--accent);
  background: var(--accent-soft);
}
.question-card h3 {
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 9px;
}
.question-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.8;
}
.question-card footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--accent);
  margin-top: 22px;
}
.path-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.path-card {
  border-top: 2px solid var(--line);
  padding: 17px 4px;
}
.path-card b {
  font: 11px var(--mono);
  color: var(--orange);
}
.path-card h3 {
  font-size: 14px;
  margin: 8px 0;
}
.path-card p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0;
}
.home-notice {
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  padding: 23px 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef1e9;
}
.home-notice h3 {
  font-size: 14px;
  margin: 0 0 7px;
}
.home-notice p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.home-notice aside {
  padding-left: 22px;
  border-left: 1px solid #d4ded2;
}
.footer {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 44px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
/* lessons */
.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 174px;
  gap: 38px;
}
.lesson {
  max-width: 900px;
  min-width: 0;
}
.lesson h1 {
  font-size: 37px;
  line-height: 1.35;
  letter-spacing: -1.2px;
  margin: 13px 0 10px;
}
.lesson-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 15px;
}
.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.question-block {
  background: var(--nav);
  color: #f2f6ef;
  border-radius: 12px;
  padding: 23px 25px;
  margin: 24px 0;
}
.question-block .eyebrow {
  color: #9dccb5;
  font-size: 10px;
}
.question-block p {
  font-size: 18px;
  line-height: 1.8;
  margin: 9px 0 0;
  font-weight: 500;
}
.takeaway {
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin-bottom: 27px;
}
.prose {
  font-size: 14px;
  line-height: 1.95;
}
.prose h2 {
  font-size: 21px;
  line-height: 1.6;
  letter-spacing: -0.4px;
  margin: 32px 0 14px;
  scroll-margin-top: 90px;
}
.prose h3 {
  font-size: 17px;
  margin: 24px 0 10px;
}
.prose p {
  margin: 13px 0;
}
.prose strong {
  font-weight: 650;
  color: var(--ink);
}
.prose code {
  font-size: 0.88em;
  background: #eaf0e9;
  color: #225d52;
  padding: 2px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.prose pre {
  font-size: 12px;
  line-height: 1.85;
  overflow-x: auto;
  padding: 18px 20px;
  background: #16292d;
  color: #d6e4dc;
  border-radius: 9px;
  white-space: pre;
  position: relative;
}
.prose pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.copy-code {
  font-size: 10px;
  padding: 2px 7px;
  position: absolute;
  right: 9px;
  top: 8px;
  background: #ffffff11;
  color: #aac2ba;
  border-color: #ffffff22;
}
.formula {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 2.1;
  background: #edf1e9;
  border: 1px solid #dce5d7;
  border-radius: 9px;
  padding: 19px 21px;
  margin: 20px 0;
  overflow-x: auto;
  white-space: normal;
  color: #235c4e;
}
.formula sub,
.formula sup {
  font-size: 0.7em;
}
.prose table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  line-height: 1.75;
  margin: 19px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.prose th {
  background: #e9eee6;
  text-align: left;
  font-size: 11px;
  font-weight: 650;
}
.prose td,
.prose th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose tr:last-child td {
  border-bottom: 0;
}
.prose tr:nth-child(2n) td {
  background: #fffefa;
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 15px 0;
  padding-left: 15px;
  color: var(--muted);
}
.toc {
  position: sticky;
  top: 103px;
  align-self: start;
  font-size: 11px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 18px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}
.toc > strong {
  display: block;
  letter-spacing: 1px;
  font-size: 10px;
  margin-bottom: 11px;
  color: var(--ink);
}
.toc a {
  display: block;
  color: var(--muted);
  line-height: 1.8;
  padding: 6px 0;
}
.toc a:hover {
  color: var(--accent);
}
.toc .toc-divider {
  height: 1px;
  background: var(--line);
  margin: 13px 0;
}
.toc .tag {
  display: block;
  background: #e8ede6;
  border-radius: 5px;
  padding: 8px;
  margin: 12px 0;
  font-size: 10px;
}
.chapter-sources {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.chapter-sources h3 {
  font-size: 13px;
  margin: 0 0 10px;
}
.source-inline {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 11px;
  padding: 6px 0;
  color: var(--muted);
}
.source-inline .ref-id {
  font: 10px var(--mono);
  color: var(--orange);
  flex: none;
}
.source-inline a {
  color: var(--muted);
}
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}
.chapter-nav a {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 15px;
  display: block;
  color: var(--ink);
  font-size: 12px;
}
.chapter-nav a:last-child {
  text-align: right;
}
.chapter-nav small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 5px;
}
.checkpoint {
  border: 1px solid #d5e1d3;
  border-radius: 12px;
  background: #edf3e9;
  padding: 22px;
  margin-top: 27px;
}
.checkpoint h3 {
  margin: 0 0 13px;
  font-size: 15px;
}
.checkpoint details {
  border-top: 1px solid #d5e1d3;
  padding: 11px 0;
  font-size: 12px;
}
.checkpoint summary {
  font-weight: 600;
  cursor: pointer;
  line-height: 1.8;
}
.checkpoint details p {
  color: var(--muted);
  line-height: 1.9;
  margin-bottom: 2px;
}
.complete-row {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}
.complete-row small {
  font-size: 10px;
  color: var(--muted);
}
.note-box {
  margin-top: 20px;
}
.note-box label {
  font-size: 12px;
  display: block;
  margin-bottom: 8px;
}
.note-box textarea {
  width: 100%;
  min-height: 90px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 12px;
  font-size: 12px;
  line-height: 1.8;
  resize: vertical;
}
.note-box small {
  color: var(--muted);
  font-size: 10px;
}
/* laboratories */
.lab-shell {
  border: 1px solid #ceded2;
  background: var(--paper);
  border-radius: 13px;
  overflow: hidden;
  margin: 30px 0;
  scroll-margin-top: 90px;
  box-shadow: var(--shadow);
}
.lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 21px;
  background: #e8efe5;
  border-bottom: 1px solid #d4e0d1;
  gap: 10px;
}
.lab-header h3 {
  font-size: 14px;
  margin: 3px 0 0;
  line-height: 1.6;
}
.lab-header .eyebrow {
  font-size: 9px;
}
.lab-body {
  padding: 20px 21px;
}
.lab-description {
  font-size: 12px;
  line-height: 1.85;
  color: var(--muted);
  margin: 0 0 16px;
}
.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px;
  margin-bottom: 20px;
}
.controls.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.control {
  min-width: 0;
}
.control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.8;
}
.control output {
  font: 11px var(--mono);
  color: var(--ink);
  font-weight: 600;
}
.control input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: #dbe4d6;
  border-radius: 8px;
  margin: 12px 0;
  cursor: pointer;
  padding: 0;
}
.control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--accent);
}
.control input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
}
.control select,
.control input[type="text"],
.control input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 7px 9px;
  font-size: 12px;
  color: var(--ink);
  min-width: 0;
}
.control input[type="checkbox"] {
  accent-color: var(--accent);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 17px 0;
}
.stat {
  background: #f1f4ee;
  border: 1px solid #e2e8df;
  border-radius: 8px;
  padding: 13px 12px;
  min-width: 0;
}
.stat-label {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 5px;
}
.stat-value {
  font: 20px var(--mono);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.stat small {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-top: 3px;
}
.stat.warn {
  background: var(--orange-soft);
  border-color: #efd5c0;
}
.stat.good {
  background: var(--accent-soft);
  border-color: #cce1d3;
}
.viz {
  background: #f8faf5;
  border: 1px solid #e1e7dd;
  border-radius: 9px;
  padding: 14px;
  margin: 14px 0;
  overflow: auto;
}
.viz svg {
  width: 100%;
  min-width: 340px;
}
.lab-note {
  font-size: 10px;
  line-height: 1.9;
  color: var(--muted);
  background: #f2f3ed;
  border-top: 1px solid var(--line);
  padding: 12px 21px;
}
.lab-note b {
  color: var(--ink);
}
.lab-message {
  font-size: 12px;
  line-height: 1.85;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 11px 14px;
  border-radius: 7px;
  margin: 13px 0;
}
.lab-message.warn {
  color: #915028;
  background: var(--orange-soft);
}
.lab-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.lab-buttons button {
  font-size: 11px;
  padding: 6px 11px;
}
.lab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.8;
}
.lab-table td,
.lab-table th {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.lab-table th {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}
.lab-table tr.selected {
  background: var(--accent-soft);
}
.token-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.token {
  font: 11px var(--mono);
  padding: 8px 10px;
  background: #e2eee6;
  border: 1px solid #c7dfce;
  border-radius: 5px;
}
.token.old {
  background: #e6ebe4;
  color: #7d8d84;
  border-color: #d5dfd2;
}
.token.pending {
  background: #fbefdf;
  color: var(--orange);
  border-color: #e8ccac;
}
.token.rejected {
  background: #f7e8e2;
  border-color: #ddbcae;
  color: #a14e32;
  text-decoration: line-through;
}
.token.future {
  border-style: dashed;
  background: transparent;
  color: #94a49b;
}
.matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid #c6dccb;
  border-radius: 7px;
  overflow: hidden;
  width: 180px;
  margin: 12px auto;
}
.matrix div {
  padding: 14px;
  text-align: center;
  font: 18px var(--mono);
  background: #e6f0e5;
  border: 1px solid #d4e3d1;
}
.expert-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  margin: 12px 0;
}
.expert-cell {
  background: #e7ebe3;
  color: #929f93;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 3px;
  font: 9px var(--mono);
}
.expert-cell.on {
  background: #217b65;
  color: #effbf0;
}
.layer-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 5px;
}
.layer-cell {
  padding: 6px 1px;
  aspect-ratio: 1;
  font: 10px var(--mono);
  border-radius: 4px;
  background: #e0ecdf;
  border-color: #c7d9c5;
  color: #4f765d;
  min-width: 0;
}
.layer-cell.full {
  background: #f5e5d6;
  border-color: #e5c7ac;
  color: #a15a34;
}
.layer-cell.chosen {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.flow-label {
  font: 10px var(--mono);
  color: var(--muted);
  margin: 13px 0 5px;
}
.command {
  background: var(--nav);
  color: #d8e7da;
  border-radius: 8px;
  padding: 17px;
  font: 11px/1.9 var(--mono);
  overflow-x: auto;
  white-space: pre;
  margin: 15px 0;
}
.file-input {
  display: none;
}
.empty-state {
  border: 1px dashed #bfd1c0;
  border-radius: 9px;
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0;
}
.lab-index {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.lab-index-card {
  padding: 21px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
}
.lab-index-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.lab-index-card h3 {
  font-size: 16px;
  line-height: 1.6;
  margin: 8px 0;
}
.lab-index-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.lab-index-card .link {
  display: block;
  font-size: 11px;
  color: var(--accent);
  margin-top: 16px;
}
/* reference pages and utility */
.filter-input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
  outline: none;
  margin-bottom: 20px;
}
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.glossary-card {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 10px;
  padding: 19px;
}
.glossary-card h3 {
  font: 13px var(--mono);
  margin: 0 0 7px;
  color: var(--accent);
  line-height: 1.5;
}
.glossary-card b {
  font-size: 13px;
  font-weight: 600;
}
.glossary-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 7px 0;
}
.glossary-card a {
  font-size: 10px;
}
.source-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
}
.source-number {
  font: 12px var(--mono);
  color: var(--orange);
  padding-top: 3px;
}
.source-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}
.source-card .author {
  font-size: 11px;
  color: var(--muted);
  margin: 5px 0 8px;
}
.source-card p {
  font-size: 12px;
  margin: 0;
  color: var(--muted);
}
.source-card a {
  font-size: 12px;
}
.resource-note {
  padding: 17px 20px;
  background: #eaf0e6;
  border-left: 3px solid var(--accent);
  font-size: 12px;
  color: var(--muted);
  margin: 22px 0;
}
.roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.roadmap-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 15px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}
.roadmap-row .n {
  font: 19px var(--mono);
  color: var(--accent);
}
.roadmap-row h3 {
  margin: 0;
  font-size: 15px;
}
.roadmap-row p {
  font-size: 11px;
  color: var(--muted);
  margin: 5px 0 0;
}
.roadmap-row a {
  font-size: 11px;
}
.about-content {
  max-width: 780px;
}
.toast {
  position: fixed;
  bottom: 25px;
  left: calc(50% + 100px);
  transform: translateX(-50%);
  background: var(--nav);
  color: #eff8ee;
  padding: 10px 20px;
  border-radius: 9px;
  box-shadow: 0 8px 30px #0002;
  z-index: 90;
  font-size: 12px;
  max-width: 90vw;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.toast.show {
  opacity: 1;
}
.search-modal {
  width: min(690px, 92vw);
  border: 1px solid #dce5d7;
  border-radius: 15px;
  padding: 0;
  background: var(--paper);
  box-shadow: 0 20px 120px #0004;
  color: var(--ink);
  max-height: 80vh;
}
.search-modal::backdrop {
  background: #0e262780;
  backdrop-filter: blur(4px);
}
.search-modal-head {
  display: flex;
  align-items: center;
  padding: 14px 19px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.search-modal input {
  border: 0;
  outline: none;
  flex: 1;
  min-width: 0;
  background: none;
  font-size: 15px;
  padding: 6px 0;
}
.search-modal input:focus-visible {
  outline: none;
}
.search-results {
  padding: 10px;
  max-height: 60vh;
  overflow: auto;
}
.search-result {
  display: block;
  padding: 12px 14px;
  border-radius: 7px;
  color: var(--ink);
}
.search-result:hover {
  background: var(--accent-soft);
  text-decoration: none;
}
.search-result small {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-top: 3px;
}
.search-result strong {
  font-size: 13px;
}
.search-hint {
  padding: 25px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.overlay {
  display: none;
}
.mobile-toc {
  display: none;
}
.reset-panel {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.reset-panel h3 {
  font-size: 14px;
  margin: 0 0 8px;
}
.reset-panel p {
  font-size: 12px;
  color: var(--muted);
}
.print-only {
  display: none;
}
@media (min-width: 1600px) {
  .main {
    padding: 48px 65px 80px;
  }
  .topbar {
    padding: 0 65px;
  }
  .lesson-layout {
    gap: 55px;
  }
  .hero {
    gap: 60px;
  }
  .hero-diagram {
    min-height: 360px;
  }
}
@media (max-width: 1200px) {
  .sidebar {
    width: 230px;
  }
  .shell {
    margin-left: 230px;
  }
  .main {
    padding: 28px;
  }
  .topbar {
    padding: 0 28px;
  }
  .lesson-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .toc {
    display: none;
  }
  .hero {
    gap: 25px;
  }
  .hero h1 {
    font-size: 38px;
  }
  .hero-diagram {
    min-height: auto;
  }
  .hero-meta {
    gap: 16px;
  }
  .question-card {
    padding: 18px;
  }
  .top-links {
    gap: 22px;
  }
  .version {
    display: none;
  }
}
@media (max-width: 900px) {
  .sidebar {
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .shell {
    margin-left: 0;
  }
  .menu-open .sidebar {
    transform: translateX(0);
  }
  .menu-open .overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: #12262c88;
    z-index: 35;
  }
  .menu-toggle {
    display: grid !important;
  }
  .topbar {
    padding: 0 22px;
    height: 62px;
  }
  .top-link {
    height: 62px;
  }
  .top-links {
    gap: 22px;
  }
  .main {
    padding: 24px;
  }
  .hero h1 {
    font-size: 42px;
  }
  .hero {
    padding-top: 10px;
    gap: 28px;
  }
  .hero-meta {
    font-size: 10px;
  }
  .hero-meta b {
    font-size: 18px;
  }
  .toast {
    left: 50%;
  }
  .lesson h1 {
    font-size: 34px;
  }
  .page-title {
    font-size: 29px;
  }
}
@media (max-width: 650px) {
  .topbar {
    padding: 0 15px;
  }
  .top-links {
    gap: 19px;
  }
  .top-link {
    font-size: 12px;
  }
  .top-tools {
    gap: 6px;
  }
  .top-tools .print-toggle {
    display: none;
  }
  .main {
    padding: 23px 17px 50px;
  }
  .hero {
    grid-template-columns: 1fr;
    padding: 2px 0 15px;
    gap: 25px;
  }
  .hero h1 {
    font-size: 40px;
    letter-spacing: -1.5px;
  }
  .hero p {
    font-size: 14px;
    max-width: none;
  }
  .hero-meta {
    margin-top: 20px;
    gap: 30px;
  }
  .hero-diagram {
    max-width: 500px;
    width: 100%;
  }
  .diagram-label {
    padding-top: 13px;
  }
  .question-grid {
    grid-template-columns: 1fr;
  }
  .question-card {
    padding: 21px;
  }
  .question-card .icon {
    float: right;
    margin-left: 15px;
  }
  .question-card h3 {
    font-size: 17px;
  }
  .question-card footer {
    margin-top: 16px;
  }
  .path-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .home-notice {
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 15px;
  }
  .home-notice aside {
    border-left: 0;
    border-top: 1px solid #d4ded2;
    padding: 15px 0 0;
  }
  .section-heading {
    align-items: start;
    margin-top: 26px;
  }
  .section-heading span {
    max-width: 140px;
    text-align: right;
    font-size: 10px;
  }
  .footer {
    display: block;
    font-size: 10px;
  }
  .footer > div {
    margin-top: 7px;
  }
  .lesson h1 {
    font-size: 29px;
    letter-spacing: -0.7px;
  }
  .question-block {
    padding: 20px;
  }
  .question-block p {
    font-size: 17px;
  }
  .prose {
    font-size: 14px;
  }
  .prose h2 {
    font-size: 20px;
  }
  .prose table {
    font-size: 11px;
    display: block;
    overflow-x: auto;
  }
  .prose td,
  .prose th {
    padding: 9px;
    min-width: 95px;
  }
  .formula {
    font-size: 12px;
    padding: 16px;
    overflow-wrap: anywhere;
  }
  .lab-header {
    padding: 13px 15px;
  }
  .lab-header h3 {
    font-size: 13px;
  }
  .lab-header .badge {
    font-size: 9px;
  }
  .lab-body {
    padding: 17px 14px;
  }
  .lab-note {
    padding: 11px 14px;
  }
  .controls {
    gap: 12px;
  }
  .controls.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-grid .stat:last-child:nth-child(odd) {
    grid-column: span 2;
  }
  .stat-value {
    font-size: 19px;
  }
  .viz {
    padding: 10px;
  }
  .viz svg {
    min-width: 330px;
  }
  .lab-index,
  .glossary-grid {
    grid-template-columns: 1fr;
  }
  .layer-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .expert-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .checkpoint {
    padding: 18px;
  }
  .complete-row {
    flex-direction: column;
    align-items: start;
  }
  .source-card {
    grid-template-columns: 31px 1fr;
    padding: 17px 14px;
  }
  .source-card h3 {
    font-size: 14px;
  }
  .roadmap-row {
    grid-template-columns: 28px 1fr;
    gap: 12px;
  }
  .roadmap-row > a {
    grid-column: 2;
  }
  .page-head {
    margin-bottom: 18px;
  }
  .breadcrumb {
    font-size: 10px;
  }
  .page-intro {
    font-size: 13px;
  }
  .command {
    font-size: 10px;
  }
  .chapter-nav a {
    font-size: 11px;
    padding: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  body {
    background: white;
    font-size: 11pt;
  }
  .sidebar,
  .topbar,
  .toc,
  .footer,
  .chapter-nav,
  .complete-row,
  .note-box,
  .lab-buttons,
  .controls,
  .search-modal,
  .toast,
  .page-head {
    display: none !important;
  }
  .shell {
    margin: 0;
  }
  .main {
    padding: 0;
    max-width: none;
  }
  .lesson-layout {
    display: block;
  }
  .lesson {
    max-width: none;
  }
  .prose {
    font-size: 10pt;
    line-height: 1.65;
  }
  .prose h2 {
    font-size: 14pt;
  }
  .lesson h1 {
    font-size: 24pt;
  }
  .question-block {
    background: #eee;
    color: #111;
    break-inside: avoid;
  }
  .lab-shell,
  .checkpoint,
  .formula {
    break-inside: avoid;
    box-shadow: none;
  }
  .prose table {
    display: table;
  }
  .print-only {
    display: block;
  }
  .print-only h1 {
    break-before: page;
  }
  .hero {
    display: block;
  }
  .hero-diagram {
    display: none;
  }
  a {
    color: #111;
  }
  .chapter-sources a::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    overflow-wrap: anywhere;
  }
  .print-document .prose h2 {
    break-after: avoid;
  }
  .print-document section {
    break-before: page;
  }
}
