:root {
  color-scheme: light;
  --paper: #f4f7fb;
  --paper-raised: #ffffff;
  --ink: #0b1424;
  --ink-soft: #4d5b70;
  --line: #cad4e1;
  --line-strong: #97a7bb;
  --blue: #315efb;
  --blue-deep: #1738ab;
  --amber: #ffb11b;
  --mint: #22b88a;
  --dark: #101827;
  --shadow: 0 22px 80px rgba(25, 45, 76, 0.13);
  --display: "Arial Black", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --body: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --max: 1280px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c1320;
  --paper-raised: #131e30;
  --ink: #eef4ff;
  --ink-soft: #a8b6ca;
  --line: #2b3a50;
  --line-strong: #53657d;
  --blue: #7191ff;
  --blue-deep: #9aafff;
  --dark: #070c14;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.33);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(rgba(93, 118, 150, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93, 118, 150, 0.07) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button { font: inherit; }

::selection { background: var(--amber); color: #111827; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  transition: top 160ms ease;
}

.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 74px;
  padding: 0 max(24px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px);
}

.site-header.is-scrolled { box-shadow: 0 10px 35px rgba(16, 28, 48, 0.09); }

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.02rem;
  letter-spacing: -0.03em;
}

.brand svg { width: 30px; height: 30px; }
.brand svg path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.brand svg circle { fill: var(--amber); stroke: var(--ink); stroke-width: 2; }

.site-nav { display: flex; gap: 30px; }
.site-nav a {
  position: relative;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -7px;
  height: 2px;
  background: var(--blue);
  transition: right 180ms ease;
}
.site-nav a:hover::after, .site-nav a:focus-visible::after { right: 0; }

.header-actions { justify-self: end; display: flex; gap: 8px; }
.control-button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.control-button:hover { border-color: var(--blue); }
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; }
.theme-dot { width: 10px; height: 10px; border: 2px solid currentColor; border-radius: 50%; background: var(--amber); }

.hero,
.section-shell,
.site-footer {
  width: min(calc(100% - 48px), var(--max));
  margin-inline: auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(430px, 0.96fr);
  gap: clamp(48px, 7vw, 110px);
  align-items: center;
  min-height: calc(100vh - 74px);
  padding-block: 88px;
}

.kicker, .section-marker, .utility-label, .card-code {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.kicker { display: flex; align-items: center; gap: 9px; color: var(--blue-deep); }
.status-light { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px color-mix(in srgb, var(--mint) 18%, transparent); }

.hero h1 {
  max-width: 770px;
  margin: 26px 0 28px;
  font-family: var(--display);
  font-size: clamp(3.4rem, 6.5vw, 6.9rem);
  line-height: 0.97;
  letter-spacing: -0.072em;
}

.hero h1 em, .manifesto h2 em { color: var(--blue); font-style: normal; }
.hero-lede { max-width: 660px; margin: 0; color: var(--ink-soft); font-size: clamp(1.04rem, 1.5vw, 1.25rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--ink); color: var(--paper); box-shadow: 7px 7px 0 var(--amber); }
.button-secondary { background: transparent; }

.hero-facts { display: flex; flex-wrap: wrap; gap: 28px; margin: 46px 0 0; }
.hero-facts div { min-width: 110px; }
.hero-facts dt { color: var(--ink-soft); font-family: var(--mono); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-facts dd { margin: 3px 0 0; font-weight: 800; }

.protocol-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper-raised);
  box-shadow: 14px 14px 0 color-mix(in srgb, var(--blue) 15%, transparent), var(--shadow);
}
.protocol-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: linear-gradient(var(--blue), var(--mint)); }
.protocol-head { display: flex; justify-content: space-between; gap: 16px; padding: 25px 26px 20px 30px; border-bottom: 1px solid var(--line); }
.protocol-head h2 { margin: 5px 0 0; font-size: 1rem; line-height: 1.35; }
.utility-label { color: var(--ink-soft); font-size: 0.62rem; }
.live-pill { display: flex; align-items: center; gap: 7px; align-self: start; color: var(--ink-soft); font-family: var(--mono); font-size: 0.65rem; font-weight: 700; }
.live-pill > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); animation: pulse 1.8s infinite; }

.protocol-track { position: relative; padding: 18px 24px 18px 30px; }
.protocol-track::before { content: ""; position: absolute; top: 30px; bottom: 30px; left: 57px; width: 1px; background: var(--line-strong); }
.protocol-step {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 0 10px 0 0;
  border: 0;
  border-bottom: 1px dashed var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.protocol-step:last-child { border-bottom: 0; }
.step-index {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  margin-left: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-raised);
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 800;
}
.step-name { padding-left: 12px; font-weight: 850; }
.step-code { color: var(--ink-soft); font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.06em; }
.protocol-step.is-active .step-index { border-color: var(--blue); background: var(--blue); color: #fff; box-shadow: 0 0 0 5px color-mix(in srgb, var(--blue) 15%, transparent); }
.protocol-step.is-active .step-name { color: var(--blue-deep); }
.protocol-step:hover { background: color-mix(in srgb, var(--blue) 5%, transparent); }

.protocol-output { display: grid; grid-template-columns: auto 1fr; gap: 10px; min-height: 88px; padding: 20px 26px 22px 30px; border-top: 1px solid var(--line); background: var(--dark); color: #e7eef9; font-family: var(--mono); font-size: 0.76rem; line-height: 1.6; }
.protocol-output p { margin: 0; }
.output-prefix { color: var(--mint); font-weight: 900; }

.section-shell { border-top: 1px solid var(--line-strong); }
.manifesto { display: grid; grid-template-columns: minmax(130px, 0.3fr) 1.7fr; gap: 30px; padding-block: 112px; }
.section-marker { color: var(--blue-deep); }
.manifesto h2, .section-heading h2, .start h2, .boundary h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.2rem, 4.5vw, 4.7rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
}
.manifesto p:not(.section-marker) { max-width: 820px; margin: 30px 0 0; color: var(--ink-soft); font-size: 1.12rem; }

.capabilities, .modes, .decision-section { padding-block: 106px; }
.section-heading { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 42px; align-items: end; margin-bottom: 52px; }
.section-heading .section-marker { margin-bottom: 16px; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--ink-soft); }
.section-heading.compact { grid-template-columns: 1fr; margin-bottom: 38px; }

.capability-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong); }
.capability-card { min-height: 300px; padding: 26px; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: color-mix(in srgb, var(--paper-raised) 82%, transparent); }
.capability-card.card-wide { grid-column: span 2; }
.capability-card h3 { margin: 54px 0 15px; font-size: 1.38rem; }
.capability-card p { max-width: 580px; margin: 0; color: var(--ink-soft); }
.capability-card ul { display: flex; flex-wrap: wrap; gap: 7px; margin: 28px 0 0; padding: 0; list-style: none; }
.capability-card li { padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; font-family: var(--mono); font-size: 0.64rem; }
.card-code { color: var(--blue-deep); }

.mode-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.mode-card { position: relative; min-height: 410px; padding: clamp(28px, 4vw, 52px); border: 1px solid var(--line-strong); background: var(--paper-raised); }
.mode-card-dark { background: var(--dark); color: #eef4ff; }
.mode-title { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 28px; }
.mode-card-dark .mode-title { border-color: #3c4a60; }
.mode-title span { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.11em; }
.mode-title h3 { margin: 0; font-size: clamp(1.8rem, 3vw, 3rem); }
.mode-card > p { max-width: 530px; margin: 32px 0; color: var(--ink-soft); }
.mode-card-dark > p { color: #aebbd0; }
.mode-card ol { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: mode; }
.mode-card li { counter-increment: mode; padding: 12px; border: 1px solid var(--line); font-size: 0.84rem; font-weight: 750; }
.mode-card li::before { content: "0" counter(mode) " "; color: var(--blue); font-family: var(--mono); font-size: 0.65rem; }
.mode-card-dark li { border-color: #3c4a60; }

.decision-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); }
.decision-grid article { min-height: 190px; padding: 30px; border-right: 1px solid var(--line-strong); }
.decision-grid article:last-child { border-right: 0; }
.decision-grid strong { color: var(--blue-deep); font-family: var(--mono); font-size: 0.83rem; letter-spacing: 0.05em; }
.decision-grid p { margin: 52px 0 0; color: var(--ink-soft); }

.start { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(50px, 8vw, 120px); align-items: center; padding-block: 120px; }
.start .section-marker, .boundary .section-marker { margin-bottom: 17px; }
.start-copy > p:not(.section-marker) { max-width: 560px; margin: 26px 0 0; color: var(--ink-soft); }
.agent-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 30px; }
.agent-list span { padding: 6px 9px; border: 1px solid var(--line); font-family: var(--mono); font-size: 0.68rem; }
.terminal { overflow: hidden; border: 1px solid #35435a; border-radius: 5px; background: #0b111d; color: #dce7f7; box-shadow: 12px 12px 0 color-mix(in srgb, var(--amber) 80%, transparent); }
.terminal-bar { display: flex; align-items: center; gap: 7px; padding: 13px 16px; border-bottom: 1px solid #2b3a4f; }
.terminal-bar > span { width: 9px; height: 9px; border-radius: 50%; background: #405069; }
.terminal-bar > span:first-child { background: var(--amber); }
.terminal-bar small { margin-left: auto; color: #7f91aa; font-family: var(--mono); }
.terminal-body { overflow-x: auto; padding: 25px 24px; font-family: var(--mono); font-size: 0.75rem; line-height: 1.85; }
.terminal-body p { width: max-content; min-width: 100%; margin: 0; }
.prompt { color: var(--mint); }
.indent { padding-left: 20px; }
.terminal-note { margin-top: 13px !important; color: #8293ad; }
.copy-button { width: 100%; padding: 13px 18px; border: 0; border-top: 1px solid #2b3a4f; background: #111b2b; color: #dce7f7; cursor: pointer; font-family: var(--mono); font-size: 0.7rem; text-align: left; }
.copy-button:hover { background: #17253a; }

.boundary { display: grid; grid-template-columns: minmax(130px, 0.3fr) 1.7fr; gap: 30px; padding-block: 104px; }
.boundary-list { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 44px; border-top: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong); }
.boundary-list p { margin: 0; padding: 24px; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); color: var(--ink-soft); }

.site-footer { display: grid; grid-template-columns: 1fr auto auto; gap: 30px; align-items: center; padding-block: 38px; border-top: 1px solid var(--line-strong); font-size: 0.78rem; }
.site-footer > div { display: flex; gap: 12px; align-items: baseline; }
.site-footer > div span, .site-footer > p { color: var(--ink-soft); }
.site-footer nav { display: flex; gap: 18px; }
.site-footer a { text-decoration: none; font-weight: 750; }
.site-footer p { margin: 0; font-family: var(--mono); }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }

@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 184, 138, 0.5); } 50% { box-shadow: 0 0 0 7px rgba(34, 184, 138, 0); } }

@media (max-width: 980px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-nav { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding-block: 78px 100px; }
  .protocol-card { max-width: 680px; }
  .capability-grid { grid-template-columns: 1fr 1fr; }
  .start { grid-template-columns: 1fr; }
  .site-footer { grid-template-columns: 1fr auto; }
  .site-footer > p { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .site-header { min-height: 64px; padding-inline: 16px; }
  .brand span { font-size: 0.94rem; }
  .language-toggle { min-width: 69px; }
  .theme-toggle > span:last-child { display: none; }
  .hero, .section-shell, .site-footer { width: min(calc(100% - 32px), var(--max)); }
  .hero { gap: 58px; padding-block: 60px 80px; }
  .hero h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .hero-facts { gap: 18px; }
  .protocol-card { box-shadow: 8px 8px 0 color-mix(in srgb, var(--blue) 15%, transparent); }
  .protocol-head { padding: 21px 18px 17px 22px; }
  .protocol-track { padding-inline: 12px 14px; }
  .protocol-track::before { left: 39px; }
  .protocol-step { grid-template-columns: 43px 1fr; }
  .step-index { margin-left: 10px; }
  .step-code { display: none; }
  .protocol-output { padding: 18px 18px 20px 22px; }
  .manifesto, .boundary { grid-template-columns: 1fr; padding-block: 78px; }
  .section-heading { grid-template-columns: 1fr; gap: 22px; margin-bottom: 38px; }
  .capabilities, .modes, .decision-section { padding-block: 78px; }
  .capability-grid { grid-template-columns: 1fr; }
  .capability-card, .capability-card.card-wide { grid-column: auto; min-height: 270px; }
  .mode-comparison, .decision-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 0; }
  .decision-grid article { min-height: 150px; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .decision-grid article:last-child { border-bottom: 0; }
  .decision-grid p { margin-top: 30px; }
  .start { padding-block: 82px; }
  .terminal { box-shadow: 7px 7px 0 color-mix(in srgb, var(--amber) 80%, transparent); }
  .boundary-list { grid-template-columns: 1fr; }
  .site-footer { grid-template-columns: 1fr; gap: 16px; }
  .site-footer > div { flex-direction: column; gap: 2px; }
  .site-footer > p { grid-column: auto; }
}

@media (max-width: 380px) {
  .brand svg { width: 26px; height: 26px; }
  .header-actions { gap: 5px; }
  .control-button { padding-inline: 8px; }
  .language-toggle { min-width: 62px; }
  .hero h1 { font-size: 2.75rem; }
  .hero-actions .button { width: 100%; }
  .mode-card ol { grid-template-columns: 1fr; }
}

@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; }
}
