:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --text: #172033;
  --muted: #5f6f86;
  --line: #d7dde8;
  --accent: #176f73;
  --accent-2: #b7462d;
  --accent-3: #61511b;
  --code: #111827;
  --code-line: #243142;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
  --radius: 8px;
  --sidebar: #fbfcfe;
  --topbar: rgba(247, 248, 251, 0.92);
  --input: #ffffff;
  --link-soft: #e7f3f3;
  --link-soft-text: #0d5558;
  --table-head: #f8fafc;
  --lead: #334155;
  --code-inline: #f8fafc;
  --callout: #eefafa;
  --warning: #fff1ec;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --panel: #151c26;
  --panel-2: #1d2633;
  --text: #e7edf5;
  --muted: #9aa9bb;
  --line: #2b3645;
  --accent: #5ac4bb;
  --accent-2: #e27b61;
  --accent-3: #dcc068;
  --code: #080b10;
  --code-line: #dce7f4;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
  --sidebar: #111820;
  --topbar: rgba(15, 20, 27, 0.9);
  --input: #111820;
  --link-soft: #173b40;
  --link-soft-text: #a4fff5;
  --table-head: #18212d;
  --lead: #c6d2e0;
  --code-inline: #101721;
  --callout: #123137;
  --warning: #341b18;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  padding: 22px 18px;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  color: var(--text);
  margin-bottom: 24px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.brand small,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.search {
  display: block;
  margin-bottom: 22px;
}

.search span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--text);
  background: white;
  background: var(--input);
  font: inherit;
}

.nav-group {
  margin: 18px 0;
}

.nav-heading {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.nav-link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.94rem;
}

.nav-link span,
.nav-link small {
  display: block;
}

.nav-link small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.nav-link:hover,
.nav-link.active {
  background: #e7f3f3;
  background: var(--link-soft);
  color: var(--link-soft-text);
  text-decoration: none;
}

.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(14px);
  padding: 14px 36px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-link,
.theme-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text);
  background: var(--input);
  font-size: 0.9rem;
}

.theme-button {
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-weight: 800;
}

.ghost-link:hover,
.theme-button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.next-top-link {
  display: grid;
  gap: 1px;
  max-width: 230px;
  min-width: 0;
  line-height: 1.15;
}

.next-top-link span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.next-top-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}

.icon-button {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  padding: 9px;
}

.icon-button span {
  display: block;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
}

.page {
  width: min(1100px, calc(100vw - 380px));
  margin: 0 auto;
  padding: 44px 36px 80px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 34px;
}

.hero h2,
.page h2 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 0.96;
  letter-spacing: 0;
  scroll-margin-top: 104px;
}

.page h3 {
  margin: 34px 0 10px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.lead {
  max-width: 760px;
  color: var(--lead);
  font-size: 1.1rem;
}

.band {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
}

.panel h3:first-child,
.panel .badge + h3 {
  margin-top: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat {
  display: grid;
  gap: 4px;
}

.stat strong {
  font-size: 2rem;
  line-height: 1;
}

.stat span,
.muted {
  color: var(--muted);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  padding: 5px 9px;
  color: var(--lead);
  font-size: 0.82rem;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status.ok {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.status.partial {
  background: color-mix(in srgb, var(--accent-3) 22%, transparent);
  color: var(--accent-3);
}

.status.spec {
  background: var(--panel-2);
  color: var(--muted);
}

.callout {
  border-left: 4px solid var(--accent);
  background: var(--callout);
  padding: 14px 16px;
  margin: 20px 0;
}

.warning {
  border-left-color: var(--accent-2);
  background: var(--warning);
}

.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--table-head);
  color: var(--lead);
  font-size: 0.86rem;
}

tr:last-child td {
  border-bottom: 0;
}

pre {
  overflow-x: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--code);
  color: #e5edf8;
  padding: 18px;
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.syntax-comment {
  color: #8da3bc;
  font-style: italic;
}

.syntax-string,
.syntax-template {
  color: #f3c969;
}

.syntax-number {
  color: #9cdcfe;
}

.syntax-type {
  color: #7dd3fc;
  font-weight: 750;
}

.syntax-keyword {
  color: #c084fc;
  font-weight: 750;
}

.syntax-literal {
  color: #f472b6;
}

.syntax-operator {
  color: #f4a261;
}

.syntax-control {
  color: #5eead4;
  font-weight: 800;
}

.syntax-directive {
  color: #a7f3d0;
  font-weight: 800;
}

.syntax-contract {
  color: #fbbf24;
  font-weight: 800;
}

.syntax-metadata {
  color: #fb7185;
  font-weight: 800;
}

.syntax-punctuation {
  color: #cbd5e1;
}

.syntax-function {
  color: #bef264;
}

.syntax-property {
  color: #fca5a5;
}

.syntax-identifier {
  color: #dce7f4;
}

:not(pre) > code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--code-inline);
  padding: 1px 5px;
  color: var(--code-line);
}

.code-block,
.dual-code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 16px 0 20px;
  background: var(--code);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  background: color-mix(in srgb, var(--panel-2) 72%, var(--code));
  color: var(--muted);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.code-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.code-tabs {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 3px;
}

.code-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 8px;
}

.code-tab.active {
  background: var(--accent);
  color: var(--bg);
}

.code-playground-button {
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--link-soft-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 8px;
}

.code-playground-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.code-pane {
  display: none;
}

.dual-code[data-code-mode="simplified"] .code-pane-simplified,
.dual-code[data-code-mode="extended"] .code-pane-extended {
  display: block;
}

.toc {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.toc a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
  color: var(--text);
}

.tree {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.tree-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.tree-group summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 800;
}

.tree-group summary span {
  color: var(--muted);
  font-weight: 700;
}

.tree-items {
  display: grid;
  border-top: 1px solid var(--line);
  padding: 8px;
}

.doc-source-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.doc-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--text);
}

.doc-source-row:last-child {
  border-bottom: 0;
}

.doc-source-row code {
  overflow-wrap: anywhere;
}

.doc-source-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.doc-source-row:hover {
  background: var(--link-soft);
  color: var(--link-soft-text);
  text-decoration: none;
}

.tree-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border-radius: var(--radius);
  padding: 10px;
  color: var(--text);
}

.tree-item:hover {
  background: var(--link-soft);
  color: var(--link-soft-text);
  text-decoration: none;
}

.tree-item small {
  color: var(--muted);
}

.module-board,
.concept-grid,
.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.definition-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-patterns,
.route-lanes {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

.doc-patterns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.route-lanes {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.route-lanes .panel {
  color: var(--text);
}

.route-lanes .panel:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.route-lanes strong {
  display: inline-block;
  margin-top: 10px;
}

.course-progress {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  padding: 16px;
  margin: 0 0 28px;
}

.course-progress strong {
  display: block;
  font-size: 1.05rem;
}

.course-progress p {
  margin: 4px 0 0;
  color: var(--lead);
}

.course-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-2);
}

.course-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.course-map {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}

.course-step {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  color: var(--text);
}

.course-step > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 900;
}

.course-step.active > span {
  background: var(--accent);
  color: var(--bg);
}

.course-step p,
.course-step small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
}

.course-step:hover,
.course-pager a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.course-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 36px 0 12px;
}

.course-pager a {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  color: var(--text);
}

.course-pager a:last-child {
  text-align: right;
}

.course-pager span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.playground-shell {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

.playground-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
}

.playground-toolbar label {
  display: grid;
  gap: 5px;
  min-width: min(100%, 380px);
}

.playground-toolbar label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.playground-toolbar select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  font: inherit;
}

.playground-toolbar select {
  padding: 9px 10px;
}

.playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.playground-editor,
.playground-output {
  display: grid;
  gap: 12px;
  align-content: start;
}

.playground-status {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.playground-status[data-tone="ok"] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
}

.playground-status[data-tone="error"] {
  border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line));
  color: var(--accent-2);
}

.playground-code-frame {
  --playground-editor-min-height: 150px;
  --playground-editor-max-height: 420px;
  position: relative;
  width: 100%;
  min-height: var(--playground-editor-min-height);
  max-height: var(--playground-editor-max-height);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code);
}

.playground-code-frame pre,
.playground-code-frame textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
}

.playground-code-frame pre {
  pointer-events: none;
  background: transparent;
  color: #dce7f4;
}

.playground-code-frame textarea {
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: #ffffff;
  outline: none;
  -webkit-text-fill-color: transparent;
}

.playground-code-frame textarea::selection {
  background: rgba(90, 196, 187, 0.28);
}

.playground-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.playground-actions button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 9px 12px;
}

.playground-actions button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.playground-actions button:hover {
  border-color: var(--accent);
}

.playground-output h3 {
  margin: 0;
}

.playground-output pre {
  min-height: 150px;
  max-height: 420px;
  overflow: auto;
  border-radius: var(--radius);
}

.ansi-bold {
  font-weight: 800;
}

.ansi-dim {
  opacity: 0.72;
}

.ansi-italic {
  font-style: italic;
}

.ansi-underline {
  text-decoration: underline;
}

.ansi-fg-black {
  color: #111827;
}

.ansi-fg-red {
  color: #ff7b72;
}

.ansi-fg-green {
  color: #7ee787;
}

.ansi-fg-yellow {
  color: #f2cc60;
}

.ansi-fg-blue {
  color: #79c0ff;
}

.ansi-fg-magenta {
  color: #d2a8ff;
}

.ansi-fg-cyan {
  color: #56d4dd;
}

.ansi-fg-white {
  color: #dce7f4;
}

.ansi-fg-bright-black {
  color: #8b949e;
}

.ansi-fg-bright-red {
  color: #ffa198;
}

.ansi-fg-bright-green {
  color: #aff5b4;
}

.ansi-fg-bright-yellow {
  color: #f8e3a1;
}

.ansi-fg-bright-blue {
  color: #a5d6ff;
}

.ansi-fg-bright-magenta {
  color: #e2c5ff;
}

.ansi-fg-bright-cyan {
  color: #a6e3e9;
}

.ansi-fg-bright-white {
  color: #ffffff;
}

.ansi-bg-black,
.ansi-bg-bright-black {
  background: #1f2937;
}

.ansi-bg-red,
.ansi-bg-bright-red {
  background: #7f1d1d;
}

.ansi-bg-green,
.ansi-bg-bright-green {
  background: #14532d;
}

.ansi-bg-yellow,
.ansi-bg-bright-yellow {
  background: #713f12;
}

.ansi-bg-blue,
.ansi-bg-bright-blue {
  background: #1e3a8a;
}

.ansi-bg-magenta,
.ansi-bg-bright-magenta {
  background: #581c87;
}

.ansi-bg-cyan,
.ansi-bg-bright-cyan {
  background: #164e63;
}

.ansi-bg-white,
.ansi-bg-bright-white {
  background: #e5edf8;
}

.playground-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.playground-meta div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 8px 10px;
}

.playground-meta dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.playground-meta dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.code-explain {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
  margin: -8px 0 24px;
}

.code-explain h4 {
  margin: 0 0 10px;
  color: var(--lead);
  font-size: 0.96rem;
}

.code-explain ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.code-explain li::marker {
  color: var(--accent);
  font-weight: 800;
}

.lesson-stack,
.status-stack {
  display: grid;
  gap: 12px;
  margin: 16px 0 24px;
}

.lesson-card,
.status-note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
}

.lesson-card h4 {
  margin: 0 0 8px;
  color: var(--lead);
  font-size: 1rem;
}

.lesson-card p,
.status-note p {
  margin: 0;
}

.lesson-card ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.lesson-card li::marker {
  color: var(--accent);
}

.status-note {
  border-left: 4px solid var(--accent);
}

.status-note strong {
  display: block;
  margin-bottom: 4px;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  margin-top: 24px;
}

.knowledge-list {
  display: grid;
  gap: 9px;
}

.user-note {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  padding: 14px 16px;
  margin-bottom: 22px;
}

.user-note p {
  margin: 6px 0 0;
  color: var(--lead);
}

.source-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}

.source-stack code {
  display: inline-flex;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.feature-list a {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  color: var(--text);
}

.feature-list a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.feature-list span {
  color: var(--muted);
}

.knowledge-link {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 86%, var(--panel-2));
}

.knowledge-link span {
  color: var(--muted);
  font-size: 0.9rem;
}

.knowledge-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.reference-rail h4 {
  margin: 22px 0 8px;
  color: var(--lead);
  font-size: 0.95rem;
}

.reference-steps {
  display: grid;
  gap: 8px;
}

.reference-step {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 12px;
  color: var(--text);
}

.reference-step.primary {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
}

.reference-step span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reference-step:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.concept-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.concept-card h3 {
  margin-top: 14px;
}

.mini-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mini-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.82rem;
}

.timeline {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.timeline-step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
}

.timeline-step > span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font-weight: 900;
}

.timeline-step h3 {
  margin-top: 0;
}

.check-list {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

.check-list li::marker {
  color: var(--accent);
}

.nav-tree {
  padding: 0 0 4px;
}

.nav-tree summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.nav-tree summary span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.nav-link-small {
  margin-left: 10px;
  font-size: 0.86rem;
}

.nav-next {
  margin-top: 8px;
}

.nav-next-card {
  display: grid;
  gap: 3px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  padding: 12px;
  color: var(--text);
}

.nav-next-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-next-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.nav-step-link {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  border-radius: var(--radius);
  padding: 7px 8px;
  color: var(--text);
  font-size: 0.84rem;
}

.nav-step-link > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 900;
  font-size: 0.74rem;
}

.nav-step-link strong {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.nav-step-link:hover,
.nav-step-link.active {
  background: var(--link-soft);
  color: var(--link-soft-text);
  text-decoration: none;
}

.nav-step-link.active > span {
  background: var(--accent);
  color: var(--bg);
}

.toc a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.search-results {
  width: min(1100px, calc(100vw - 380px));
  margin: 18px auto 0;
  padding: 0 36px;
}

.result {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
  margin-bottom: 8px;
  color: var(--text);
}

.result:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.footer-note {
  margin-top: 44px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform 160ms ease;
    box-shadow: var(--shadow);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .icon-button {
    display: block;
  }

  .topbar {
    grid-template-columns: auto 1fr;
    padding: 12px 16px;
  }

  .ghost-link {
    display: none;
  }

  .top-actions {
    justify-content: flex-end;
  }

  .page,
  .search-results {
    width: 100%;
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero,
  .grid,
  .grid.two,
    .module-board,
    .concept-grid,
    .definition-grid,
    .doc-patterns,
    .route-lanes,
    .course-pager,
    .feature-list,
    .knowledge-layout,
    .playground-grid {
    grid-template-columns: 1fr;
  }

  .course-pager a:last-child {
    text-align: left;
  }

  .doc-source-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .doc-source-row span {
    white-space: normal;
  }
}
