:root {
  --bg: oklch(1 0 0);
  --surface: oklch(0.97 0.006 28);
  --surface-strong: oklch(0.925 0.018 28);
  --ink: oklch(0.205 0.018 28);
  --muted: oklch(0.45 0.022 28);
  --primary: oklch(0.49 0.19 28);
  --primary-hover: oklch(0.41 0.17 28);
  --primary-dark: oklch(0.235 0.025 28);
  --accent: oklch(0.61 0.13 146);
  --accent-dark: oklch(0.36 0.095 146);
  --accent-soft: oklch(0.95 0.032 146);
  --signal: oklch(0.79 0.115 80);
  --signal-soft: oklch(0.955 0.045 80);
  --danger: oklch(0.58 0.18 29);
  --line: oklch(0.885 0.014 28);
  --white: oklch(1 0 0);
  --content: 1180px;
  --text: 72ch;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Public Sans", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--primary);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--primary-hover);
}

a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 4px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.65rem 0.9rem;
  background: var(--signal);
  color: var(--ink);
  transform: translateY(-180%);
}

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

.site-header {
  width: min(calc(100% - 2rem), var(--content));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--primary);
  background: transparent;
  box-shadow: none;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 50% 15% auto;
  height: 2px;
  background: var(--primary);
  transform: translateY(-50%);
}

.brand-mark::after {
  inset: 15% auto 15% 50%;
  width: 2px;
  height: auto;
  transform: translateX(-50%);
}

nav {
  display: flex;
  gap: 1.4rem;
  align-items: center;
}

nav a {
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 620;
  text-decoration: none;
}

main {
  overflow: clip;
}

.hero,
.demo,
.result-strip,
.evidence,
.method,
.boundary,
.reproduce,
footer {
  width: min(calc(100% - 2rem), var(--content));
  margin-inline: auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(3.5rem, 7vw, 6.5rem) clamp(3rem, 6vw, 4.5rem);
  align-items: end;
  animation: page-in 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.kicker {
  margin: 0 0 1.25rem;
  padding-left: 0.7rem;
  border-left: 3px solid var(--primary);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: 0.04em;
}

.hero h1 {
  max-width: 14ch;
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  font-weight: 830;
  color: var(--primary-dark);
}

.hero-lede {
  max-width: 62ch;
  margin: 1.7rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1.05rem;
  border-radius: 3px;
  font-weight: 720;
  text-decoration: none;
}

.button-primary {
  background: var(--primary);
  color: var(--white);
}

.button-primary:hover {
  background: var(--primary-hover);
  color: var(--white);
}

.button-secondary {
  box-shadow: inset 0 0 0 1px var(--primary);
  color: var(--primary-dark);
}

.hero-note {
  border-top: 4px solid var(--primary);
  padding-top: 1.2rem;
}

.hero-note h2 {
  font-size: 1.05rem;
}

.hero-note dl {
  margin: 1rem 0 0;
}

.hero-note dl div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.hero-note dt {
  color: var(--muted);
}

.hero-note dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

.demo {
  padding-block: clamp(3.5rem, 7vw, 6rem) clamp(5rem, 9vw, 8rem);
}

.demo-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 2rem;
  align-items: end;
  margin-bottom: 2rem;
}

.demo-label {
  margin: 0 0 0.75rem;
  color: var(--primary);
  font-weight: 760;
}

.demo-heading h2 {
  max-width: 23ch;
  color: var(--primary-dark);
  font-size: clamp(2.1rem, 4vw, 3.35rem);
}

.runtime-note {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  justify-self: end;
  max-width: 330px;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.runtime-note div {
  display: flex;
  flex-direction: column;
}

.runtime-note strong {
  color: var(--accent-dark);
}

.runtime-note span:not(.runtime-dot) {
  color: var(--muted);
  font-size: 0.9rem;
}

.runtime-dot {
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.42rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.demo-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.62fr) minmax(0, 1.38fr);
  border: 1px solid var(--primary-dark);
  border-radius: 2px;
  overflow: clip;
  background: var(--primary-dark);
}

.demo-controls {
  position: sticky;
  top: 1rem;
  align-self: start;
  padding: clamp(1.5rem, 3vw, 2.35rem);
  background: var(--primary-dark);
  color: var(--white);
}

.demo-controls fieldset {
  min-width: 0;
  margin: 0;
  padding: 0 0 1.5rem;
  border: 0;
}

.demo-controls legend {
  margin-bottom: 0.75rem;
  color: var(--signal);
  font-weight: 740;
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid oklch(1 0 0 / 0.3);
}

.preset-list button {
  min-height: 40px;
  padding: 0.55rem 0.45rem;
  border: 0;
  border-right: 1px solid oklch(1 0 0 / 0.3);
  border-radius: 0;
  background: transparent;
  color: var(--white);
  transition: background-color 160ms ease, color 160ms ease;
}

.preset-list button:last-child {
  border-right: 0;
}

.preset-list button:hover {
  background: oklch(1 0 0 / 0.08);
}

.preset-list button[aria-pressed="true"] {
  background: var(--signal);
  color: var(--ink);
  font-weight: 740;
}

.control-grid {
  display: grid;
  gap: 1rem;
}

.control-grid label {
  display: grid;
  gap: 0.38rem;
}

.control-grid label > span {
  color: oklch(1 0 0 / 0.78);
  font-size: 0.9rem;
}

.control-grid select {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 2.3rem 0.7rem 0.8rem;
  border: 1px solid oklch(1 0 0 / 0.28);
  border-radius: 2px;
  background: oklch(0.315 0.028 28);
  color: var(--white);
}

.control-grid select:hover {
  border-color: oklch(1 0 0 / 0.58);
}

.run-button {
  width: 100%;
  min-height: 52px;
  margin-top: 1.35rem;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 2px;
  background: var(--signal);
  color: var(--ink);
  font-weight: 780;
  transition: background-color 160ms ease;
}

.run-button:hover {
  background: oklch(0.86 0.15 87);
}

.control-note {
  margin: 1rem 0 0;
  color: oklch(1 0 0 / 0.69);
  font-size: 0.83rem;
  line-height: 1.65;
}

.decision-result {
  min-width: 0;
  background: var(--white);
}

.decision-result.is-updated {
  animation: decision-in 240ms ease-out;
}

.decision-header,
.decision-stage,
.decision-footer {
  padding: clamp(1.4rem, 3vw, 2.4rem);
}

.decision-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.decision-header p {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.decision-header h3 {
  color: var(--primary-dark);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
}

.decision-status {
  flex: 0 0 auto;
  padding: 0.25rem 0 0.25rem 0.65rem;
  border-left: 3px solid var(--accent);
  background: transparent;
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 760;
}

.decision-stage + .decision-stage {
  border-top: 1px solid var(--line);
}

.stage-heading {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 1.4rem;
}

.stage-number {
  display: inline-block;
  width: 2.2rem;
  flex: 0 0 auto;
  padding-top: 0.05rem;
  color: var(--primary);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.stage-heading div {
  display: flex;
  flex-direction: column;
}

.stage-heading strong {
  color: var(--primary-dark);
  font-size: 1.08rem;
}

.stage-heading div span {
  color: var(--muted);
  font-size: 0.86rem;
}

.trend-summary {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 1.4rem;
  align-items: stretch;
}

.score-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  padding: 1rem;
  border-top: 3px solid var(--signal);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary-dark);
}

.score-block > span {
  font-weight: 700;
}

.score-block > strong {
  font-size: clamp(3rem, 6vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.score-block small {
  margin-left: 0.18rem;
  font-size: 0.9rem;
  letter-spacing: 0;
}

.trend-stats {
  margin: 0;
}

.trend-stats div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.trend-stats dt {
  color: var(--muted);
}

.trend-stats dd {
  margin: 0;
  font-weight: 700;
}

.signal-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.35rem;
}

.signal-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.signal-track {
  height: 6px;
  margin-top: 0.35rem;
  overflow: hidden;
  border-radius: 0;
  background: var(--surface-strong);
}

.signal-track span {
  display: block;
  height: 100%;
  border-radius: 0;
  background: var(--accent);
  transition: width 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.topic-summary {
  margin: 1.2rem 0 0;
  color: var(--muted);
}

.snippet-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.snippet-list li {
  padding: 0.25rem 0 0.25rem 0.65rem;
  border-left: 2px solid var(--line);
  background: transparent;
  color: var(--primary-dark);
  font-size: 0.84rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.formula-stage table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.formula-stage th,
.formula-stage td {
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.formula-stage thead th {
  color: var(--muted);
  font-weight: 620;
}

.formula-stage tbody th {
  color: var(--primary-dark);
}

.formula-stage tbody th span {
  display: block;
}

.formula-stage tbody th small {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0;
  border-bottom: 2px solid var(--signal);
  color: var(--primary);
}

.recommended-formula {
  background: var(--accent-soft);
}

.table-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.pilot-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 1rem;
  border-block: 1px solid var(--line);
}

.pilot-scale span {
  padding: 0.55rem 0.8rem;
  background: transparent;
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 700;
}

.pilot-scale span + span {
  border-left: 1px solid var(--line);
}

.gate-list {
  margin: 0;
}

.gate-list div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.gate-list dt {
  color: var(--muted);
}

.gate-list dd {
  margin: 0;
  font-weight: 650;
}

.decision-footer {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  background: var(--primary-dark);
  color: var(--white);
  border-top: 4px solid var(--primary);
}

.decision-footer > div {
  max-width: 60ch;
}

.decision-footer span {
  color: var(--signal);
  font-size: 0.85rem;
  font-weight: 740;
}

.decision-footer p {
  margin: 0.35rem 0 0;
}

.copy-button {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0.65rem 0.85rem;
  border: 1px solid oklch(1 0 0 / 0.45);
  border-radius: 2px;
  background: transparent;
  color: var(--white);
  font-weight: 700;
}

.copy-button:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.sr-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.copy-source:not([hidden]) {
  margin: 1rem;
  white-space: pre-wrap;
}

.demo-disclosure {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.overview-figure {
  width: min(100%, 1500px);
  margin: 0 auto;
  background: var(--surface);
}

.overview-figure img {
  width: 100%;
}

.overview-figure figcaption {
  padding: 0.8rem 1rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-intro {
  display: grid;
  grid-template-columns: minmax(250px, 0.75fr) minmax(0, 1.25fr);
  gap: 2rem;
  align-items: start;
  padding-bottom: 2rem;
}

.section-intro h2,
.boundary h2,
.reproduce h2 {
  font-size: clamp(2.1rem, 4vw, 3.5rem);
  color: var(--primary-dark);
}

.section-intro p {
  max-width: var(--text);
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.result-strip {
  padding-block: clamp(5rem, 9vw, 8rem);
}

.result-strip article {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
  padding-block: 1.65rem;
  border-top: 1px solid var(--line);
}

.result-strip article:last-child {
  border-bottom: 1px solid var(--line);
}

.result-index,
.step-label {
  color: var(--primary);
  font-weight: 760;
}

.result-strip h3 {
  font-size: clamp(1.5rem, 3vw, 2.3rem);
}

.result-strip article p {
  max-width: 62ch;
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.result-strip article > a {
  font-weight: 700;
}

.evidence {
  padding-block: clamp(4rem, 8vw, 7rem);
}

.evidence-row {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.65fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  margin-top: clamp(4rem, 9vw, 8rem);
}

.evidence-row-reverse figure {
  order: 2;
}

.evidence-row figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.evidence-copy h3 {
  margin-top: 0.75rem;
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.evidence-copy p:not(.step-label) {
  color: var(--muted);
}

.evidence-copy a {
  font-weight: 720;
}

.method {
  padding-block: clamp(5rem, 9vw, 8rem);
}

.role-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--primary-dark);
  color: var(--white);
}

.role-table > div {
  padding: clamp(1rem, 2.5vw, 1.8rem);
  border-bottom: 1px solid oklch(1 0 0 / 0.18);
}

.role-table > div:nth-child(odd) {
  border-right: 1px solid oklch(1 0 0 / 0.18);
}

.role-heading {
  color: var(--signal);
  font-size: 1.1rem;
  font-weight: 780;
}

.boundary {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.65fr);
  gap: clamp(2rem, 7vw, 7rem);
  padding: clamp(2rem, 5vw, 4rem);
  background: var(--surface);
}

.boundary p {
  max-width: var(--text);
  color: var(--muted);
}

.boundary-links {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.boundary-links a {
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--line);
  font-weight: 720;
}

.reproduce {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 2rem 4rem;
  align-items: center;
  padding-block: clamp(5rem, 9vw, 8rem);
}

.reproduce p {
  max-width: 60ch;
  color: var(--muted);
}

pre {
  margin: 0;
  padding: 1.4rem;
  overflow-x: auto;
  border-radius: 2px;
  background: var(--ink);
  color: var(--white);
  font: 0.9rem/1.75 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.reproduce .button {
  justify-self: start;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes decision-in {
  from {
    opacity: 0.88;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 1rem;
  }

  nav {
    width: 100%;
    gap: 0.9rem 1.2rem;
    flex-wrap: wrap;
  }

  .hero,
  .demo-heading,
  .demo-shell,
  .section-intro,
  .evidence-row,
  .boundary,
  .reproduce {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: clamp(2.65rem, 12vw, 4rem);
  }

  .runtime-note {
    justify-self: start;
  }

  .demo-shell {
    grid-template-columns: 1fr;
  }

  .demo-controls {
    position: static;
  }

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

  .result-strip article {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .result-strip article > a {
    grid-column: 2;
  }

  .evidence-row-reverse figure {
    order: 0;
  }
}

@media (max-width: 540px) {
  .hero,
  .demo,
  .result-strip,
  .evidence,
  .method,
  .boundary,
  .reproduce,
  footer,
  .site-header {
    width: min(calc(100% - 1.25rem), var(--content));
  }

  .result-strip article {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .demo-heading h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .control-grid,
  .trend-summary,
  .signal-list {
    grid-template-columns: 1fr;
  }

  .snippet-list {
    grid-template-columns: 1fr;
  }

  .decision-header,
  .decision-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-block {
    min-height: 120px;
  }

  .trend-stats div,
  .gate-list div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .copy-button {
    width: 100%;
  }

  .result-strip article > a {
    grid-column: 1;
  }

  .role-table {
    grid-template-columns: 1fr;
  }

  .role-table > div:nth-child(odd) {
    border-right: 0;
  }

  footer {
    flex-direction: column;
  }
}

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

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