*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --ink: #171a1f;
  --muted: #5c6573;
  --muted-2: #7a8494;
  --line: #d9dee7;
  --line-2: #c2cad7;
  --accent: #255edb;
  --accent-soft: #eaf0ff;
  --teal: #0f766e;
  --teal-soft: #e6f4f1;
  --amber: #9a5a00;
  --amber-soft: #fff4d8;
  --red: #b42318;
  --red-soft: #ffebe7;
  --code-bg: #101828;
  --code-ink: #e6edf7;
  --shadow: 0 12px 28px rgba(23, 26, 31, 0.08);
  --radius: 8px;
  --max: 1280px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f131a;
    --surface: #171d26;
    --surface-2: #202734;
    --ink: #edf2f7;
    --muted: #a7b0bf;
    --muted-2: #7f8a9c;
    --line: #2c3544;
    --line-2: #3a4658;
    --accent: #80a7ff;
    --accent-soft: rgba(128, 167, 255, 0.14);
    --teal: #5eead4;
    --teal-soft: rgba(94, 234, 212, 0.12);
    --amber: #f6c768;
    --amber-soft: rgba(246, 199, 104, 0.12);
    --red: #ff9b8d;
    --red-soft: rgba(255, 155, 141, 0.12);
    --code-bg: #0a0f17;
    --code-ink: #eef4ff;
    --shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  }
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

code,
pre,
kbd {
  font-family: var(--mono);
}

code {
  padding: 0.12rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.9em;
  overflow-wrap: anywhere;
  white-space: normal;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 18px 20px;
  border: 1px solid #233044;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.88rem;
  line-height: 1.7;
}

pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 24px;
  font-size: 0.94rem;
}

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

th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 650;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: var(--max);
  min-width: 0;
  min-height: 58px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: 0;
  white-space: nowrap;
}

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

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}

.brand span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  min-width: 0;
}

.site-nav a,
.lang-toggle a,
.lang-toggle button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 560;
  background: transparent;
}

.site-nav a:hover,
.lang-toggle a:hover,
.lang-toggle button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.site-nav a.active,
.lang-toggle a.active,
.lang-toggle button.active {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  min-width: 0;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 42px 28px 82px;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 84px;
  min-width: 0;
  padding: 10px 18px 24px 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
}

.sidebar h2 {
  margin: 22px 0 10px;
  color: var(--muted-2);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar h2:first-child {
  margin-top: 0;
}

.sidebar a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.sidebar a:hover,
.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.toc {
  display: none;
}

section[id],
header[id] {
  scroll-margin-top: 86px;
}

.content {
  min-width: 0;
  width: 100%;
}

.content,
.section,
.doc-hero,
.diagram-scroll {
  max-width: 100%;
  min-width: 0;
}

.content p,
.content li,
.lead,
.doc-hero h1,
.section h2,
.section h3,
.update-entry h2 {
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.14rem;
}

.masthead {
  margin-bottom: 38px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.masthead h1,
.doc-hero h1 {
  max-width: 760px;
  margin: 0 0 16px;
  color: var(--ink);
  font-size: clamp(2rem, 3vw, 2.7rem);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: 0;
}

.doc-hero h1 {
  font-size: clamp(2rem, 2.8vw, 2.55rem);
}

.masthead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.masthead-visual {
  max-width: 560px;
  margin: 24px 0 0;
}

.doc-illustration {
  max-width: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 650;
}

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

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  color: #ffffff;
}

.terminal {
  border: 1px solid #273448;
  border-radius: var(--radius);
  background: var(--code-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.terminal-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px 0 70px;
  border-bottom: 1px solid #233044;
  color: #9fb0c7;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.terminal-title::before {
  content: "";
  position: absolute;
  left: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 16px 0 #ffbd2e, 32px 0 #27c93f;
}

.terminal pre {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.section {
  margin: 48px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.masthead + .section,
.doc-hero + .section {
  padding-top: 0;
  border-top: 0;
}

.section h2,
.content h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.section h3,
.content h3 {
  margin: 28px 0 10px;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.3;
}

.content p,
.content li {
  color: var(--muted);
}

.content ul,
.content ol {
  padding-left: 22px;
}

.content li {
  margin: 6px 0;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.link-card,
.status-card,
.update-entry {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.link-card {
  padding: 18px;
  color: inherit;
}

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

.link-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 1rem;
}

.link-card span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.status-card {
  padding: 18px;
}

.status-card h3 {
  margin-top: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 740;
}

.tag.stable {
  background: var(--teal-soft);
  color: var(--teal);
}

.tag.experimental {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.planned,
.tag.pending {
  background: var(--surface-2);
  color: var(--muted);
}

.tag.breaking,
.tag.warn {
  background: var(--red-soft);
  color: var(--red);
}

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

.callout.warning {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout strong {
  color: var(--ink);
}

.doc-hero {
  margin-bottom: 34px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.steps {
  counter-reset: step;
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.step {
  position: relative;
  padding: 16px 18px 16px 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 760;
}

.step h3 {
  margin: 0 0 4px;
}

.update-entry {
  padding: 22px;
  margin: 18px 0;
}

.update-entry h2 {
  margin: 0 0 4px;
}

.update-date {
  color: var(--muted-2);
  font-size: 0.9rem;
}

.update-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

body.lang-en [data-lang="zh"] {
  display: none;
}

body.lang-zh [data-lang="en"] {
  display: none;
}

.diagram-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
  margin-bottom: 24px;
}

.diagram-scroll {
  overflow-x: auto;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.arch-map {
  display: block;
  width: 100%;
  min-width: 1080px;
  height: auto;
  color: var(--ink);
}

.arch-map text {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
}

.arch-map .map-muted {
  fill: var(--muted-2);
  font-size: 11px;
}

.arch-map .map-label {
  fill: var(--muted-2);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.arch-map .map-group {
  fill: var(--accent-soft);
  stroke: color-mix(in srgb, var(--accent) 34%, var(--line));
}

.arch-map .map-group.infra {
  fill: var(--surface-2);
  stroke: var(--line-2);
}

.arch-map .map-node {
  fill: var(--surface);
  stroke: var(--line-2);
  stroke-width: 1.5;
}

.arch-map .map-node.sleep {
  fill: var(--surface-2);
  stroke-dasharray: 7 5;
}

.arch-map .map-checker {
  fill: var(--amber-soft);
  stroke: color-mix(in srgb, var(--amber) 58%, var(--line));
  stroke-dasharray: 8 6;
  stroke-width: 2;
}

.arch-map .map-arrow {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1.8;
}

.arch-map .map-arrow.dashed,
.arch-map .map-arrow.offline,
.arch-map .map-arrow.fail {
  stroke-dasharray: 7 5;
}

.arch-map .map-arrow.fail {
  stroke: var(--red);
}

.arch-map .map-badge {
  fill: var(--accent-soft);
  stroke: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.arch-map .map-badge-text {
  fill: var(--accent);
  font-size: 9px;
  font-weight: 760;
  text-transform: uppercase;
}

.diagram {
  position: relative;
}

.diagram svg.conns {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.diagram svg.conns path {
  pointer-events: stroke;
  cursor: pointer;
}

.group {
  position: absolute;
  border: 1.5px solid;
  border-radius: var(--radius);
}

.group-label {
  position: absolute;
  top: -10px;
  left: 16px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
}

.group.core {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
}

.group.infra {
  border-color: var(--line-2);
  background: var(--surface-2);
}

.checker-zone {
  position: absolute;
  z-index: 1;
  border: 2px dashed color-mix(in srgb, var(--amber) 55%, var(--line));
  border-radius: var(--radius);
  background: var(--amber-soft);
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.16s ease, box-shadow 0.16s ease;
}

.checker-zone:hover,
.checker-zone.highlighted {
  opacity: 1;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 16%, transparent);
}

.checker-zone.dimmed {
  opacity: 0.18;
}

.checker-zone .cz-label,
.checker-zone .cz-sub {
  position: absolute;
  font-family: var(--mono);
  color: var(--amber);
}

.checker-zone .cz-label {
  top: -10px;
  left: 16px;
  padding: 0 8px;
  background: var(--surface);
  font-size: 10px;
}

.checker-zone .cz-sub {
  right: 0;
  bottom: 8px;
  left: 0;
  text-align: center;
  font-size: 9px;
}

.node {
  position: absolute;
  z-index: 2;
  padding: 12px 15px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(23, 26, 31, 0.06);
  cursor: pointer;
  user-select: none;
  transition: transform 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.node:hover,
.node.highlighted {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.node.dimmed {
  opacity: 0.22;
}

.node-title {
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 760;
}

.node-sub {
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin: 0 4px 4px 0;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 760;
  text-transform: uppercase;
}

.badge.planner,
.badge.exec,
.badge.consumer {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.store,
.badge.result {
  border-color: color-mix(in srgb, var(--teal) 28%, var(--line));
  background: var(--teal-soft);
  color: var(--teal);
}

.badge.guard {
  border-color: color-mix(in srgb, var(--amber) 30%, var(--line));
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.offline {
  border-color: color-mix(in srgb, var(--muted-2) 34%, var(--line));
  background: var(--surface-2);
  color: var(--muted);
}

.sleep-node {
  border-style: dashed;
  background: var(--surface-2);
}

.conn {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1.5;
  transition: opacity 0.16s ease, stroke 0.16s ease;
}

.conn.dashed,
.conn.offline-line,
.conn.fail-line {
  stroke-dasharray: 6 4;
}

.conn.fail-line {
  stroke: var(--red);
}

.conn.highlighted {
  stroke: var(--accent);
  stroke-width: 2.4;
}

.conn.dimmed {
  opacity: 0.1;
}

.conn-label,
.anno {
  position: absolute;
  z-index: 3;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  pointer-events: none;
}

.conn-label {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface);
  white-space: nowrap;
}

.conn-label.dimmed {
  opacity: 0.1;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted-2);
  font-size: 0.82rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-line {
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--line-2);
}

.legend-line.dashed,
.legend-line.fail-l {
  background: repeating-linear-gradient(90deg, var(--line-2) 0, var(--line-2) 5px, transparent 5px, transparent 9px);
}

.legend-line.fail-l {
  background: repeating-linear-gradient(90deg, var(--red) 0, var(--red) 5px, transparent 5px, transparent 9px);
}

.legend-box {
  width: 20px;
  height: 14px;
  border: 1.5px dashed var(--amber);
  border-radius: 3px;
  background: var(--amber-soft);
}

.subdiagram {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.subdiagram-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 18px;
}

.subdiagram-heading h3 {
  margin: 0;
  font-size: 1.25rem;
}

.subdiagram-heading p {
  margin: 0;
}

.runtime-flow,
.memory-flow {
  display: grid;
  gap: 14px;
  min-width: 980px;
}

.runtime-flow {
  grid-template-columns: 150px 26px 150px 26px 190px minmax(230px, 1fr);
  align-items: center;
}

.flow-arrow {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 1.15rem;
  text-align: center;
}

.flow-branch {
  display: grid;
  gap: 12px;
}

.flow-branch.support-branch {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 4px;
}

.flow-node,
.store-node {
  min-height: 92px;
  padding: 14px 16px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(23, 26, 31, 0.05);
}

.flow-node.source {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

.flow-node.active {
  border-color: color-mix(in srgb, var(--teal) 32%, var(--line));
  background: var(--teal-soft);
}

.flow-node.router {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--accent-soft);
}

.checker-card {
  border-color: color-mix(in srgb, var(--amber) 58%, var(--line));
  border-style: dashed;
  background: var(--amber-soft);
}

.flow-node strong,
.store-node strong {
  display: block;
  margin: 2px 0 4px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.25;
}

.flow-node span:not(.badge),
.store-node span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.memory-flow {
  grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
}

.memory-lane {
  position: relative;
  padding: 28px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.memory-lane.online {
  background: color-mix(in srgb, var(--accent-soft) 42%, var(--surface));
}

.memory-lane.durable {
  background: color-mix(in srgb, var(--surface-2) 52%, var(--surface));
}

.lane-label {
  position: absolute;
  top: -10px;
  left: 14px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.flow-split {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
}

.flow-split::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 70%;
  height: 18px;
  border-top: 2px solid var(--line-2);
  border-right: 2px solid var(--line-2);
  border-left: 2px solid var(--line-2);
  border-radius: 8px 8px 0 0;
  transform: translateX(-50%);
}

.promotion-gate {
  margin: 12px 4px 0;
  padding: 8px 10px;
  border: 1px dashed color-mix(in srgb, var(--amber) 58%, var(--line));
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
}

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

.store-node {
  min-height: 116px;
}

.history-node {
  border-style: dashed;
  background: var(--surface-2);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.detail-grid article {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.detail-grid h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.95rem;
}

.detail-grid p {
  margin: 0;
  font-size: 0.9rem;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: rgba(15, 19, 26, 0.2);
}

.detail-overlay.open {
  display: block;
}

.detail-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: min(520px, calc(100vw - 44px));
  max-height: min(680px, calc(100vh - 44px));
  padding: 22px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.detail-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.detail-panel h2 {
  margin: 0 32px 4px 0;
  font-size: 1.2rem;
}

.detail-role {
  margin: 0 0 12px;
  color: var(--muted);
}

.detail-tags,
.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-tag {
  display: inline-flex;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px 24px;
  color: var(--muted-2);
  font-size: 0.88rem;
}

@media (max-width: 920px) {
  .masthead,
  .layout,
  .diagram-intro,
  .subdiagram-heading,
  .status-grid,
  .detail-grid,
  .link-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: visible;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toc {
    display: none;
  }

  .sidebar h2 {
    display: none;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .sidebar a.active {
    color: var(--accent);
  }
}

@media (max-width: 700px) {
  html,
  body {
    overflow-x: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 100vw;
    padding: 10px 16px;
    overflow: hidden;
  }

  .site-nav {
    flex: 1 1 100%;
    flex-wrap: wrap;
    width: auto;
    max-width: calc(100vw - 32px);
    margin-left: 0;
    overflow-x: visible;
  }

  .lang-toggle {
    flex-wrap: wrap;
    max-width: calc(100vw - 32px);
    margin-left: 0;
  }

  .page {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    padding: 34px 16px 64px;
  }

  .layout {
    display: block;
  }

  .sidebar {
    width: 100%;
    max-width: calc(100vw - 32px);
    margin-bottom: 28px;
  }

  .content,
  .section,
  .doc-hero,
  .diagram-intro,
  .subdiagram,
  .update-entry,
  .callout {
    width: 100%;
    max-width: calc(100vw - 32px);
  }

  .masthead h1,
  .doc-hero h1 {
    font-size: 2.15rem;
  }

  .diagram-scroll {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    padding: 12px;
  }

  .runtime-flow,
  .memory-flow {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .flow-split,
  .store-grid {
    grid-template-columns: 1fr;
  }

  .flow-split::before {
    display: none;
  }

  .memory-lane,
  .flow-node,
  .store-node {
    min-width: 0;
  }

  .detail-panel {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 24px);
    padding: 18px;
  }

  .content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .content table thead,
  .content table tbody {
    display: table;
    width: 640px;
    min-width: 100%;
  }

  .content table tr {
    display: table-row;
  }

  .content table th,
  .content table td {
    display: table-cell;
  }

  .content table code {
    overflow-wrap: normal;
    white-space: nowrap;
  }

  .footer-inner {
    flex-direction: column;
    padding: 22px 16px;
  }
}
