:root {
  color-scheme: light;
  --bg: oklch(1.000 0.000 0);
  --surface: oklch(0.972 0.004 165);
  --surface-strong: oklch(0.935 0.010 165);
  --ink: oklch(0.185 0.025 210);
  --muted: oklch(0.430 0.030 210);
  --faint: oklch(0.720 0.022 205);
  --primary: oklch(0.505 0.145 150);
  --primary-deep: oklch(0.340 0.105 153);
  --accent: oklch(0.515 0.128 245);
  --accent-soft: oklch(0.940 0.030 245);
  --copper: oklch(0.610 0.135 55);
  --copper-soft: oklch(0.950 0.040 65);
  --warn: oklch(0.590 0.150 35);
  --line: oklch(0.880 0.010 190);
  --line-strong: oklch(0.740 0.025 190);
  --code-bg: oklch(0.185 0.025 210);
  --code-ink: oklch(0.950 0.012 165);
  --radius: 8px;
  --max: 1180px;
  --shadow-tight: 0 6px 8px oklch(0.185 0.025 210 / 0.08);
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans CJK SC",
    "Noto Sans SC",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  overflow-x: clip;
  background:
    linear-gradient(180deg, oklch(0.980 0.008 165), var(--bg) 420px),
    var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

button,
input {
  font: inherit;
}

code,
pre {
  font-family:
    ui-monospace,
    "SFMono-Regular",
    "Cascadia Code",
    "Liberation Mono",
    Menlo,
    monospace;
}

:not(pre) > code {
  display: inline;
  padding: 0.08em 0.32em 0.14em;
  border: 1px solid oklch(0.800 0.018 190);
  border-radius: 5px;
  background: oklch(0.965 0.010 165);
  color: var(--ink);
  font-size: 0.88em;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: normal;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 20;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: var(--radius);
}

.skip-link:focus {
  transform: translateY(0);
}

.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 4px;
  z-index: 30;
  background: transparent;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.hero {
  border-bottom: 1px solid var(--line);
}

.hero__inner {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: clamp(32px, 5vw, 72px);
  padding: clamp(64px, 8vw, 112px) 0 clamp(44px, 7vw, 84px);
  align-items: center;
}

.kicker,
.section-label {
  margin: 0 0 12px;
  color: var(--primary-deep);
  font-size: 0.86rem;
  font-weight: 760;
}

h1,
h2,
h3 {
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  margin: 0;
  max-width: none;
}

h1 span,
h1 small {
  display: block;
}

h1 span {
  font-size: clamp(2.55rem, 4.45vw, 4.35rem);
  line-height: 1;
  letter-spacing: -0.022em;
}

h1 small {
  margin-top: 14px;
  max-width: 24ch;
  color: var(--primary-deep);
  font-size: clamp(1.18rem, 2.5vw, 2.15rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 3.6vw, 3.55rem);
  line-height: 1.04;
  letter-spacing: -0.018em;
}

.section__head h2 code {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--primary-deep);
  font: inherit;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.32;
}

.hero__lead {
  max-width: 68ch;
  margin: 28px 0 0;
  font-size: clamp(1.04rem, 1.2vw, 1.22rem);
  color: var(--muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  font-weight: 720;
}

.button--primary {
  background: var(--primary-deep);
  color: var(--bg);
  border-color: var(--primary-deep);
}

.trace-visual {
  margin: 0;
}

.trace-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.trace-visual figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.94rem;
}

.viz-panel {
  fill: var(--bg);
  stroke: var(--line);
}

.viz-node rect {
  fill: var(--surface);
  stroke: var(--line-strong);
}

.viz-node--green rect {
  fill: oklch(0.925 0.035 150);
  stroke: var(--primary);
}

.viz-node--blue rect {
  fill: var(--accent-soft);
  stroke: var(--accent);
}

.viz-node--copper rect {
  fill: var(--copper-soft);
  stroke: var(--copper);
}

.viz-node text {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 760;
}

.viz-node text + text {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 560;
}

.viz-arrow {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  marker-end: url(#arrow);
}

marker path {
  fill: var(--ink);
}

.shell {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
}

.toc {
  position: relative;
}

.toc__box {
  position: sticky;
  top: 28px;
  margin-top: 44px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.toc__title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 760;
}

.toc nav {
  display: grid;
  gap: 4px;
}

.toc a {
  display: block;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
}

.toc a.is-active,
.toc a:hover {
  background: var(--surface);
  color: var(--ink);
}

.content {
  min-width: 0;
}

.section {
  padding: clamp(48px, 8vw, 92px) 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 18px;
}

.section--opening {
  padding-top: 54px;
}

.section__head {
  max-width: 78ch;
  margin-bottom: clamp(24px, 4vw, 42px);
}

.section__head p:not(.section-label) {
  margin: 18px 0 0;
  color: var(--muted);
}

.prose {
  max-width: 76ch;
}

.prose p {
  margin: 0 0 18px;
  text-wrap: pretty;
}

.section p,
.section li,
.section h3,
.tool-table span,
.trace-row p {
  overflow-wrap: anywhere;
}

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

.answer-block,
.evidence-record,
.compare article,
.json-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.answer-block {
  padding: 20px;
}

.answer-block p,
.evidence-record p,
.compare p {
  margin: 0 0 12px;
  color: var(--muted);
}

.model-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.model-map div {
  padding: 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.model-map div:last-child {
  border-right: none;
}

.model-map span {
  display: block;
  color: var(--primary-deep);
  font-size: 0.86rem;
  font-weight: 760;
}

.model-map strong {
  display: block;
  margin-top: 5px;
  font-size: 0.96rem;
}

.model-map p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toolbar label {
  font-weight: 760;
}

.toolbar input {
  flex: 1 1 260px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--ink);
  background: var(--bg);
}

.evidence-list {
  display: grid;
  gap: 14px;
}

.evidence-record {
  padding: 18px;
}

.evidence-record.is-hidden {
  display: none;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.record-meta strong,
.record-meta span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.record-meta strong {
  background: var(--primary-deep);
  color: var(--bg);
}

.record-meta span {
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.code {
  position: relative;
  min-width: 0;
  max-width: 100%;
  margin: 14px 0 0;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid oklch(0.300 0.020 210);
}

.code code {
  display: block;
  min-width: 100%;
  width: max-content;
  max-width: none;
  padding: 18px 92px 18px 18px;
  white-space: pre;
  font-size: 0.84rem;
  line-height: 1.58;
}

.code--wide code {
  width: max-content;
  max-width: none;
}

.code button {
  position: sticky;
  left: calc(100% - 70px);
  top: 8px;
  z-index: 2;
  margin: 8px 8px 0 auto;
  display: block;
  border: 1px solid oklch(0.720 0.030 165);
  border-radius: 6px;
  background: oklch(0.270 0.030 210);
  color: var(--code-ink);
  padding: 5px 8px;
  font-size: 0.78rem;
  cursor: pointer;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 26px;
  align-items: start;
}

.field-stack {
  display: grid;
  gap: 10px;
}

.field-stack div,
.steer-layers div,
.chain-diagram div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}

.field-stack strong,
.steer-layers strong,
.chain-diagram b {
  display: block;
  color: var(--ink);
}

.field-stack span,
.steer-layers span,
.chain-diagram span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

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

.flow__step {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.flow__step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--primary-deep);
  color: var(--bg);
  font-weight: 800;
}

.flow__step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

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

.compare article {
  padding: 18px;
  min-width: 0;
}

.callout {
  margin-top: 24px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.callout--blue {
  background: var(--accent-soft);
  border-color: oklch(0.765 0.055 245);
}

.compact-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.timeline {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.timeline__item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.timeline__item time {
  color: var(--primary-deep);
  font-weight: 800;
}

.timeline__item p {
  margin: 0;
  color: var(--muted);
}

.tabs {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.tab {
  min-height: 44px;
  padding: 9px 14px;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 760;
  cursor: pointer;
}

.tab.is-active {
  color: var(--bg);
  background: var(--primary-deep);
}

.tab-panel {
  display: none;
  padding: 18px;
}

.tab-panel.is-active {
  display: block;
}

.panel-intro {
  margin: 0 0 16px;
  color: var(--muted);
}

.tool-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.tool-table div {
  min-width: 0;
  padding: 12px;
  background: var(--bg);
}

.tool-table strong {
  display: block;
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.tool-table span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

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

.chain-diagram {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.steer-principle {
  display: grid;
  gap: 14px;
  max-width: 86ch;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, oklch(0.950 0.035 150), oklch(0.965 0.020 245)),
    var(--surface);
}

.steer-principle p {
  margin: 0;
  color: var(--ink);
}

.steer-case {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.case-header {
  display: grid;
  gap: 4px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.case-header span {
  color: var(--primary-deep);
  font-size: 0.84rem;
  font-weight: 800;
}

.case-header strong {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.25;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.case-grid article {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.case-grid article:last-child {
  border-right: none;
}

.case-grid h3,
.steer-evidence h3 {
  margin-top: 0;
}

.case-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.steer-evidence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.steer-evidence--second {
  margin-top: 14px;
}

.evidence-column {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.evidence-column--green {
  border-color: oklch(0.760 0.060 150);
  background: oklch(0.955 0.028 150);
}

.evidence-column--blue {
  border-color: oklch(0.765 0.055 245);
  background: var(--accent-soft);
}

.evidence-column dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.evidence-column dl div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.evidence-column dl div:first-child {
  padding-top: 0;
  border-top: none;
}

.evidence-column dt {
  color: var(--primary-deep);
  font-weight: 800;
}

.evidence-column dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
}

.evidence-column p {
  margin: 0 0 12px;
  color: var(--muted);
}

.evidence-column p:last-child {
  margin-bottom: 0;
}

.trace-table--steer {
  margin-top: 18px;
}

.trace-table {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.trace-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.trace-row:last-child {
  border-bottom: none;
}

.trace-row time {
  color: var(--muted);
  font-weight: 800;
}

.trace-row p {
  margin: 0;
}

.trace-row--strong {
  background: oklch(0.955 0.028 150);
}

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

.json-grid article {
  padding: 18px;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.source-links a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
}

.footer {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 56px;
  display: flex;
  justify-content: space-between;
  gap: 22px;
  color: var(--muted);
}

.footer p {
  max-width: 82ch;
  margin: 0;
}

@media (max-width: 1080px) {
  .hero__inner,
  .shell {
    grid-template-columns: 1fr;
  }

  h1,
  h1 small {
    max-width: none;
  }

  .toc__box {
    position: static;
    margin-top: 22px;
  }

  .toc nav {
    display: flex;
    flex-wrap: wrap;
  }

  .model-map,
  .flow,
  .case-grid,
  .steer-evidence {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-grid article:nth-child(2n) {
    border-right: none;
  }

  .case-grid article:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .hero__inner,
  .shell,
  .footer {
    width: min(100% - 28px, var(--max));
  }

  h1 span {
    font-size: clamp(2.35rem, 11vw, 3.4rem);
  }

  h1 small {
    font-size: clamp(1.05rem, 5.5vw, 1.45rem);
    max-width: 20ch;
  }

  .answer-grid,
  .compare,
  .json-grid,
  .split,
  .tool-table,
  .tool-table--compact,
  .chain-diagram {
    grid-template-columns: 1fr;
  }

  .model-map,
  .flow,
  .case-grid,
  .steer-evidence {
    grid-template-columns: 1fr;
  }

  .case-grid article {
    border-right: none;
    border-top: 1px solid var(--line);
  }

  .case-grid article:first-child {
    border-top: none;
  }

  .evidence-column dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .model-map div {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .model-map div:last-child {
    border-bottom: none;
  }

  .timeline__item,
  .trace-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .code code {
    font-size: 0.78rem;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
