:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #edf2ed;
  --sidebar: #e7ece6;
  --text: #252a2d;
  --muted: #65706f;
  --line: #d5ddd6;
  --code: #eef3f1;
  --blue: #246a8f;
  --green: #52745d;
  --gold: #a36d2f;
  --red: #a34b40;
  --shadow: 0 18px 50px rgba(27, 41, 39, 0.12);
}

html[data-theme="dark"] {
  --bg: #171b1d;
  --surface: #202629;
  --surface-soft: #222d2c;
  --sidebar: #14191b;
  --text: #e3e7e2;
  --muted: #a0aaa7;
  --line: #344044;
  --code: #111719;
  --blue: #86bed8;
  --green: #91b99b;
  --gold: #d5a05e;
  --red: #d07a70;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.86;
}

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}

#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 22px 16px;
}

.site-head {
  border-bottom: 1px solid var(--line);
  padding: 0 8px 16px;
}
.site-title {
  color: var(--green);
  display: block;
  font-size: 20px;
  font-weight: 780;
  line-height: 1.3;
  text-decoration: none;
}
.site-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}
.nav-part { display: grid; gap: 3px; }
.nav-part-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  padding: 5px 8px;
}
.nav-part a {
  border-radius: 7px;
  color: var(--text);
  display: block;
  font-size: 14px;
  line-height: 1.45;
  padding: 6px 8px;
  text-decoration: none;
}
.nav-part a:hover { background: var(--surface-soft); }
.nav-part a.current-page {
  background: var(--surface-soft);
  color: var(--green);
  font-weight: 760;
}
.course-switcher {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.sidebar-foot {
  border-top: 1px solid var(--line);
  margin-top: auto;
  padding: 14px 8px 0;
}
#theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  padding: 5px 12px;
}
.build-time {
  color: var(--muted);
  font-size: 12px;
  margin-top: 9px;
}
#sidebar-toggle { display: none; }

#content {
  margin-left: 292px;
  padding: 48px 48px 84px;
}
article {
  margin: 0 auto;
  max-width: 880px;
}
.lesson-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
  padding-bottom: 24px;
}
.eyebrow,
.section-label {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
  text-transform: uppercase;
}
h1 {
  font-size: 38px;
  letter-spacing: 0;
  line-height: 1.24;
  margin: 0;
}
h2 {
  border-left: 4px solid var(--green);
  font-size: 26px;
  line-height: 1.35;
  margin: 0 0 14px;
  padding-left: 13px;
}
h3 {
  font-size: 18px;
  line-height: 1.45;
  margin: 0 0 10px;
}
.lead {
  color: var(--muted);
  font-size: 19px;
  margin: 18px 0 0;
}
section {
  margin: 52px 0;
}

.flow-board {
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr;
  gap: 10px;
  margin: 24px 0 30px;
  padding: 18px;
}
.flow-node {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 132px;
  padding: 14px;
}
.flow-node strong {
  display: block;
  font-size: 18px;
  margin-top: 8px;
}
.flow-node p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 8px 0 0;
}
.node-kicker {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.08em;
  padding: 1px 8px;
}
.human .node-kicker { background: rgba(36, 106, 143, .16); color: var(--blue); }
.prompt .node-kicker { background: rgba(163, 109, 47, .18); color: var(--gold); }
.model .node-kicker { background: rgba(82, 116, 93, .18); color: var(--green); }
.tool .node-kicker { background: rgba(163, 75, 64, .14); color: var(--red); }
.history .node-kicker { background: rgba(36, 106, 143, .16); color: var(--blue); }
.flow-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 24px;
  font-weight: 700;
}
.flow-arrow.return { color: var(--green); }

.summary-grid,
.split,
.compare,
.command-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-grid > *,
.split > *,
.compare > *,
.command-grid > *,
.piece-grid > *,
.code-ref > * {
  min-width: 0;
}
.info-panel,
.role-card,
.code-ref,
.note,
.guardrail,
.tab-panel,
.lesson-end {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px;
}
.info-panel h2 {
  border: 0;
  font-size: 18px;
  margin: 0 0 8px;
  padding: 0;
}
.info-panel p,
.role-card p,
.note p {
  margin-bottom: 0;
}
.role-card {
  min-height: 220px;
}
.role-card ul,
.tool-list,
.read-list {
  margin: 0;
  padding-left: 22px;
}
.model-card { border-top: 4px solid var(--green); }
.runtime-card { border-top: 4px solid var(--blue); }
.note {
  border-left: 4px solid var(--gold);
  color: var(--muted);
  margin-top: 18px;
}

.timeline {
  counter-reset: step;
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}
.timeline li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0;
  min-height: 82px;
  padding: 13px 18px 13px 64px;
  position: relative;
}
.timeline li::before {
  align-items: center;
  background: var(--green);
  border-radius: 999px;
  color: var(--surface);
  content: counter(step);
  counter-increment: step;
  display: flex;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  left: 18px;
  position: absolute;
  top: 18px;
  width: 34px;
}
.timeline span {
  display: block;
  font-weight: 760;
}
.timeline p {
  color: var(--muted);
  margin: 4px 0 0;
}

.piece-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.piece {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  min-height: 160px;
  padding: 16px;
  text-decoration: none;
}
.piece:hover { border-color: var(--green); }
.piece span {
  color: var(--gold);
  display: block;
  font-size: 26px;
  font-weight: 820;
}
.piece strong {
  display: block;
  font-size: 18px;
  margin-top: 8px;
}
.piece em {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-style: normal;
  line-height: 1.55;
  margin-top: 8px;
}

.code-ref {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin: 18px 0;
}
.code-ref strong {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}
.highlight {
  margin: 18px 0;
  position: relative;
}
pre {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 10px;
  line-height: 1.55;
  margin: 0;
  overflow-x: auto;
  padding: 16px;
}
pre code {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--text);
  display: block;
  font-size: 13.5px;
  padding: 0;
}
.copy-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  padding: 2px 10px;
  position: absolute;
  right: 9px;
  top: 9px;
  transition: opacity .15s;
}
.highlight:hover .copy-btn { opacity: 1; }

table {
  border-collapse: collapse;
  display: block;
  font-size: 15px;
  margin: 18px 0;
  overflow-x: auto;
  width: 100%;
}
th,
td {
  border: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
th { background: var(--surface-soft); }

.prompt-stack,
.tool-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}
.prompt-stack div,
.tool-list div,
.read-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 13px 16px;
}
.prompt-stack span,
.tool-list span,
.read-list span {
  color: var(--muted);
}

.guardrail {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
.provider-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0 12px;
}
.tab {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  padding: 7px 12px;
}
.tab.active {
  background: var(--green);
  border-color: var(--green);
  color: var(--surface);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel p { color: var(--muted); margin-bottom: 0; }

.read-list {
  counter-reset: read;
  list-style: none;
  padding: 0;
}
.read-list li {
  grid-template-columns: 190px 1fr;
  margin: 10px 0;
}
.lesson-end {
  border-left: 4px solid var(--green);
  margin-top: 70px;
}
.lesson-end h2 {
  border: 0;
  padding: 0;
}
.lesson-link {
  display: inline-block;
  font-weight: 720;
  margin-top: 8px;
}
.course-upgrade {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  display: grid;
  gap: 6px 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 22px 0 30px;
  padding: 14px 16px;
}
.course-upgrade strong,
.course-upgrade span {
  display: block;
  grid-column: 1;
}
.course-upgrade span {
  color: var(--muted);
  font-size: 14px;
}
.course-upgrade a {
  align-self: center;
  font-weight: 720;
  grid-column: 2;
  grid-row: 1 / 3;
}

.evolution-board {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr);
  margin: 24px 0 30px;
  padding: 18px;
}
.evolution-stage {
  min-width: 0;
  padding: 10px 4px;
}
.evolution-stage span {
  color: var(--gold);
  display: block;
  font-size: 12px;
  font-weight: 800;
}
.evolution-stage strong {
  display: block;
  font-size: 16px;
  margin-top: 5px;
}
.evolution-stage p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 5px 0 0;
}
.evolution-stage.active {
  border-bottom: 3px solid var(--green);
}
.evolution-connector {
  background: var(--line);
  height: 2px;
  position: relative;
}
.evolution-connector::after {
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--line);
  border-top: 4px solid transparent;
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
}

.formula-strip {
  align-items: center;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 22px 0;
  padding: 15px 10px;
}
.formula-strip span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 720;
  padding: 4px 9px;
}
.formula-strip b {
  color: var(--muted);
  font-weight: 600;
}
.anatomy-list {
  border-top: 1px solid var(--line);
  margin-top: 18px;
}
.anatomy-list > div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: 145px minmax(0, 1fr);
  padding: 11px 4px;
}
.anatomy-list strong { color: var(--green); }
.anatomy-list span { color: var(--muted); }

.insertion-lab {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-top: 20px;
  padding: 18px;
}
.insertion-flow {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.insertion-node {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  min-height: 118px;
  min-width: 0;
  padding: 10px;
  text-align: left;
}
.insertion-node:hover { background: var(--surface-soft); }
.insertion-node.active,
.insertion-node[aria-pressed="true"] {
  background: var(--surface-soft);
  border-color: var(--green);
  box-shadow: inset 0 -3px 0 var(--green);
}
.insertion-node span {
  color: var(--gold);
  display: block;
  font-size: 12px;
  font-weight: 800;
}
.insertion-node strong {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  margin-top: 6px;
}
.insertion-node small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 5px;
}
.insertion-arrow { display: none; }
.insertion-detail {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  min-height: 125px;
  padding: 16px 2px 2px;
}
.insertion-detail strong {
  color: var(--green);
  display: block;
}
.insertion-detail p { margin: 7px 0; }
.insertion-detail span {
  color: var(--muted);
  display: block;
  font-size: 14px;
}

.direction-matrix {
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
.direction-row {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 34px 150px minmax(0, 1fr) 190px;
  padding: 13px 4px;
}
.direction-index {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}
.direction-row strong { color: var(--green); }
.direction-row p,
.direction-row em {
  margin: 0;
}
.direction-row em {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.feature-lab {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-top: 20px;
  padding: 18px;
}
.lab-toolbar {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-bottom: 16px;
}
.lab-toolbar label,
.lab-name span,
.lab-field-grid label > span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 720;
}
.lab-toolbar select,
.lab-toolbar button,
.lab-name input,
.lab-field-grid textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}
.lab-toolbar select,
.lab-toolbar button {
  font-size: 14px;
  min-height: 38px;
  padding: 6px 10px;
}
.lab-toolbar button { cursor: pointer; }
.lab-toolbar button:hover { border-color: var(--green); }
.lab-name {
  display: block;
  margin-top: 16px;
}
.lab-name input {
  margin-top: 5px;
  padding: 8px 10px;
  width: 100%;
}
.lab-field-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}
.lab-field-grid label { min-width: 0; }
.lab-field-grid textarea {
  display: block;
  line-height: 1.55;
  margin-top: 5px;
  min-height: 92px;
  padding: 9px 10px;
  resize: vertical;
  width: 100%;
}
.lab-toolbar select:focus,
.lab-toolbar button:focus,
.lab-name input:focus,
.lab-field-grid textarea:focus,
.insertion-node:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(36, 106, 143, .22);
  outline-offset: 2px;
}
.lab-preview {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 16px;
}
.lab-preview-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
}
.lab-preview-head span {
  color: var(--muted);
  font-size: 13px;
}
.lab-preview dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  margin: 12px 0 0;
}
.lab-preview dt,
.lab-preview dd {
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 8px 4px;
}
.lab-preview dt {
  color: var(--green);
  font-weight: 720;
}
.lab-preview dd { white-space: pre-wrap; }
.lab-status {
  color: var(--green);
  font-size: 13px;
  min-height: 24px;
  margin: 10px 0 0;
}

.verification-loop {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  margin: 22px 0;
}
.verification-loop > div {
  background: var(--surface);
  border-top: 3px solid var(--green);
  padding: 12px;
}
.verification-loop span {
  display: block;
  font-weight: 760;
}
.verification-loop p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 5px 0 0;
}
.verification-loop > b {
  align-self: center;
  color: var(--muted);
}
.verification-loop .loop-back {
  color: var(--gold);
  grid-column: 1 / -1;
  justify-self: end;
}

.memory-pipeline {
  align-items: center;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  margin: 22px 0;
}
.memory-pipeline > div {
  background: var(--surface);
  border-bottom: 3px solid var(--blue);
  min-height: 105px;
  padding: 12px;
}
.memory-pipeline strong,
.memory-pipeline span { display: block; }
.memory-pipeline span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 5px;
}
.memory-pipeline i {
  color: var(--muted);
  font-style: normal;
}
.memory-types {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.memory-types > div {
  border-bottom: 1px solid var(--line);
  min-width: 0;
  padding: 12px 10px;
}
.memory-types > div:nth-child(odd) { border-right: 1px solid var(--line); }
.memory-types p {
  color: var(--muted);
  margin: 4px 0 0;
}

.security-layers {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 22px;
}
.security-layer {
  background: var(--surface);
  min-height: 190px;
  padding: 16px;
}
.security-layer > span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 760;
}
.security-layer strong {
  display: block;
  margin-top: 8px;
}
.security-layer p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.policy-layer { border-top: 4px solid var(--gold); }
.sandbox-layer { border-top: 4px solid var(--red); }
.audit-layer { border-top: 4px solid var(--blue); }

.agent-team { margin-top: 22px; }
.lead-agent {
  background: var(--green);
  color: var(--surface);
  margin: 0 auto 26px;
  max-width: 360px;
  padding: 14px 18px;
  position: relative;
  text-align: center;
}
.lead-agent::after {
  background: var(--line);
  bottom: -27px;
  content: "";
  height: 27px;
  left: 50%;
  position: absolute;
  width: 1px;
}
.lead-agent span,
.lead-agent strong { display: block; }
.lead-agent span { font-size: 12px; opacity: .85; }
.team-branches {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-top: 18px;
}
.team-branches > div {
  background: var(--surface);
  border-bottom: 3px solid var(--blue);
  min-height: 160px;
  padding: 14px;
}
.team-branches span { font-weight: 760; }
.team-branches p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 6px 0 0;
}
.decision-pair {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
  padding-top: 14px;
}
.decision-pair p {
  color: var(--muted);
  margin: 4px 0 0;
}

.extension-table td:first-child { font-weight: 760; }
.mechanism-chain {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  margin-top: 22px;
}
.mechanism-chain > div {
  background: var(--surface);
  border-top: 3px solid var(--gold);
  padding: 12px;
}
.mechanism-chain strong,
.mechanism-chain span { display: block; }
.mechanism-chain span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 5px;
}
.mechanism-chain > b {
  align-self: center;
  color: var(--muted);
}

.roadmap-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}
.roadmap-list li { border-bottom: 1px solid var(--line); }
.roadmap-list li:first-child { border-top: 1px solid var(--line); }
.roadmap-list label {
  align-items: start;
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 13px 4px;
}
.roadmap-list input {
  accent-color: var(--green);
  height: 18px;
  margin-top: 5px;
  width: 18px;
}
.roadmap-list strong {
  display: block;
  margin-bottom: 2px;
}
.roadmap-list input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

@media (max-width: 1360px) {
  .flow-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .flow-arrow {
    display: none;
  }
  .flow-node.history {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1120px) {
  .piece-grid {
    grid-template-columns: 1fr;
  }
  .summary-grid { grid-template-columns: 1fr; }
  .piece { min-height: auto; }
  .evolution-board {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .evolution-connector { display: none; }
  .team-branches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  article,
  section {
    scroll-margin-top: 58px;
  }
  .flow-board {
    grid-template-columns: 1fr;
  }
  .flow-node.history {
    grid-column: auto;
  }
  #sidebar {
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform .2s;
    z-index: 20;
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-toggle {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: block;
    font-size: 18px;
    left: 14px;
    padding: 4px 10px;
    position: fixed;
    top: 12px;
    z-index: 30;
  }
  #content {
    margin-left: 0;
    padding: 58px 20px 64px;
  }
  h1 { font-size: 30px; }
  h2 { font-size: 23px; }
  .split,
  .compare,
  .command-grid,
  .code-ref {
    grid-template-columns: 1fr;
  }
  .read-list li {
    grid-template-columns: 1fr;
  }
  .evolution-board,
  .security-layers {
    grid-template-columns: 1fr;
  }
  .evolution-stage {
    border-bottom: 1px solid var(--line);
    padding: 10px 4px 14px;
  }
  .evolution-stage.active { border-bottom: 3px solid var(--green); }
  .insertion-flow,
  .lab-field-grid,
  .memory-types,
  .team-branches,
  .decision-pair {
    grid-template-columns: 1fr;
  }
  .insertion-node { min-height: auto; }
  .direction-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }
  .direction-row p,
  .direction-row em {
    grid-column: 2;
  }
  .verification-loop,
  .memory-pipeline,
  .mechanism-chain {
    grid-template-columns: 1fr;
  }
  .verification-loop > b,
  .memory-pipeline i,
  .mechanism-chain > b {
    display: none;
  }
  .verification-loop .loop-back {
    display: block;
    grid-column: auto;
    justify-self: start;
  }
  .memory-pipeline > div { min-height: auto; }
  .memory-types > div:nth-child(odd) { border-right: 0; }
  .team-branches { border-top: 0; }
  .lab-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .lab-toolbar select,
  .lab-toolbar button { width: 100%; }
  .lab-preview dl { grid-template-columns: 1fr; }
  .lab-preview dt { padding-bottom: 2px; }
  .lab-preview dd {
    border-top: 0;
    padding-top: 2px;
  }
  .anatomy-list > div { grid-template-columns: 1fr; gap: 2px; }
  .course-upgrade { grid-template-columns: 1fr; }
  .course-upgrade a { grid-column: 1; grid-row: auto; }
}
