:root {
  color-scheme: light;
  --ground: #e8ecea;
  --surface: #fbfcfb;
  --surface-2: #f2f5f3;
  --ink: #14201e;
  --muted: #5c6a67;
  --faint: #74807d;
  --rule: #c8d1ce;
  --accent: #0e6152;
  --accent-strong: #09483d;
  --accent-soft: #d7e8e2;
  --amber: #855312;
  --amber-soft: #f2e5ce;
  --red: #8c3a32;
  --shadow: 0 18px 55px rgb(20 32 30 / 7%);
  --serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #101614;
    --surface: #19201e;
    --surface-2: #121917;
    --ink: #e2e9e6;
    --muted: #9aa7a3;
    --faint: #83908c;
    --rule: #2c3834;
    --accent: #67c8af;
    --accent-strong: #8bdec8;
    --accent-soft: #1b342d;
    --amber: #d8a45a;
    --amber-soft: #33291a;
    --red: #e3887f;
    --shadow: 0 18px 55px rgb(0 0 0 / 24%);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.58 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body[data-lang="zh"] { letter-spacing: .005em; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }

.skip {
  position: fixed;
  z-index: 30;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 5px;
  background: var(--accent);
  color: var(--surface);
  transform: translateY(-160%);
}
.skip:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hidden { display: none !important; }

.masthead,
main,
footer {
  width: min(1180px, calc(100% - 44px));
  margin-inline: auto;
}

.masthead {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
  font: 600 20px/1.1 var(--serif);
}
.brand small {
  margin-top: 7px;
  color: var(--faint);
  font: 500 10px/1 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav > a { display: inline-flex; align-items: center; min-height: 24px; color: var(--muted); font-size: 13px; text-decoration: none; }
.topnav > a:hover { color: var(--accent); }
.langswitch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
}
.langswitch button {
  min-width: 48px;
  min-height: 44px;
  padding: 7px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 600 12px/1 var(--mono);
}
.langswitch button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }

.hero { padding: clamp(52px, 8vw, 92px) 0 44px; }
.kicker,
.eyebrow {
  margin: 0 0 13px;
  color: var(--accent);
  font: 600 11px/1.2 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 900px;
  margin: 0;
  font: 600 clamp(38px, 6vw, 70px)/1.04 var(--serif);
  letter-spacing: -.035em;
  text-wrap: balance;
}
body[data-lang="zh"] .hero h1 { max-width: 830px; font-size: clamp(34px, 5.3vw, 62px); line-height: 1.16; }
.lede {
  max-width: 720px;
  margin: 23px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.68;
}
.hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.primary,
.secondary,
.scenario-tabs button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
}
.primary { border: 1px solid var(--accent); background: var(--accent); color: var(--surface); }
.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.secondary { border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.secondary:hover { border-color: var(--accent); color: var(--accent); }
.compact { min-height: 44px; padding: 8px 12px; font-size: 12px; }
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button:disabled { opacity: .46; cursor: not-allowed; }
.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  color: var(--faint);
  font-size: 12px;
}
.trust li::before { content: "✓"; margin-right: 7px; color: var(--accent); font-weight: 700; }

.section {
  padding: clamp(42px, 7vw, 72px) 0;
  border-top: 1px solid var(--rule);
}
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section h2 {
  max-width: 760px;
  margin: 0;
  font: 600 clamp(27px, 3.6vw, 42px)/1.12 var(--serif);
  letter-spacing: -.025em;
  text-wrap: balance;
}
.section-copy { max-width: 800px; margin: 17px 0 26px; color: var(--muted); }
.mode-badge {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--faint);
  background: var(--surface);
  font: 500 10px/1.2 var(--mono);
  letter-spacing: .04em;
}
.live-badge { border-color: color-mix(in srgb, var(--accent) 48%, var(--rule)); color: var(--accent); }

.scenario-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.scenario-tabs button {
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}
.scenario-tabs button:hover:not(:disabled),
.scenario-tabs button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.journey,
.live-journey {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.journey-card,
.live-card {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.journey-card { min-height: 250px; padding: 20px; }
.step-number { color: var(--accent); font: 600 11px/1 var(--mono); letter-spacing: .1em; }
.journey-card h3,
.principles h3,
.developer-grid h3 {
  margin: 10px 0 10px;
  font: 600 19px/1.25 var(--serif);
}
.journey-card p,
.principles p,
.developer-grid p { margin: 0; color: var(--muted); font-size: 13.5px; }
.quote {
  margin: 13px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 5px 5px 0;
  background: var(--surface-2);
  color: var(--ink);
}
.memory-mini { display: grid; gap: 8px; margin-top: 12px; }
.memory-mini div { padding: 10px 12px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 5px; }
.memory-mini .old { border-left-color: var(--amber); background: var(--amber-soft); color: var(--muted); }
.memory-mini strong { display: block; color: inherit; }
.memory-mini small { color: var(--faint); font: 500 10px/1.4 var(--mono); }
.reason { margin-top: 12px !important; color: var(--accent) !important; font: 500 11px/1.5 var(--mono) !important; }
.reveal-card:not(.revealed) { background: color-mix(in srgb, var(--surface) 68%, var(--ground)); box-shadow: none; }
.reveal-card:not(.revealed) > * { opacity: .42; }
.reveal-card.revealed { animation: reveal .5s ease both; }
@keyframes reveal { from { transform: translateY(8px); opacity: .45; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .reveal-card.revealed { animation: none; } }

.proof {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 30px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: var(--rule);
}
.proof article { min-width: 0; padding: 18px; background: var(--surface); }
.proof strong { display: block; color: var(--accent); font: 600 27px/1.1 var(--mono); letter-spacing: -.03em; }
.proof span { display: block; margin-top: 6px; font-size: 13px; }
.proof small { display: block; margin-top: 4px; color: var(--faint); font: 500 10px/1.45 var(--mono); }

.engine-status {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 9px 13px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: 500 11px/1.5 var(--mono);
}
.dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--faint); }
.dot.on { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dot.off { background: var(--red); }
.engine-meta { margin-left: auto; }
.engine-meta b { color: var(--ink); font-weight: 550; }
.live-tabs { margin-bottom: 14px; }
.live-card { overflow: hidden; min-height: 320px; }
.live-card > header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.live-card > header span { color: var(--accent); font: 600 10px/1 var(--mono); }
.live-card > header h3 { margin: 0; font-size: 13px; font-weight: 650; }
.live-pane { padding: 15px; }
.empty { color: var(--faint); font-size: 13px; }
.bubble { max-width: 92%; margin-bottom: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.bubble.assistant { margin-left: auto; background: var(--accent-soft); }
.bubble small { display: block; margin-bottom: 4px; color: var(--faint); font: 500 9px/1 var(--mono); text-transform: uppercase; }
.bubble .gloss { margin: 5px 0 0; padding-top: 5px; border-top: 1px dashed var(--rule); color: var(--faint); font-size: 12px; text-transform: none; letter-spacing: 0; }
.memory-card,
.result-card,
.reject-card { margin-bottom: 9px; padding: 10px 12px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 5px; }
.memory-card.superseded,
.reject-card { border-left-color: var(--amber); background: var(--amber-soft); }
.memory-card .key { color: var(--faint); font: 600 9px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.memory-card strong,
.reject-card strong { display: block; margin: 4px 0; }
.memory-card small,
.reject-card small { display: block; }
.memory-card small,
.result-card small,
.reject-card small { color: var(--faint); font: 500 10px/1.45 var(--mono); }
.result-card { border-left-color: var(--accent); }
.result-card .answer { margin-bottom: 6px; font-size: 15px; font-weight: 650; }

.advanced { margin-top: 18px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); }
.advanced > summary,
.trace-drawer > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 15px;
  color: var(--muted);
  cursor: pointer;
  font: 550 12px/1.4 var(--mono);
}
.advanced[open] > summary { border-bottom: 1px solid var(--rule); }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; }
fieldset { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--rule); border-radius: 6px; }
legend { padding: 0 7px; font-weight: 650; }
label { display: block; margin: 12px 0 5px; color: var(--faint); font: 600 10px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
input[type="text"], textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--ground);
  color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 9px; min-height: 44px; color: var(--muted); font: inherit; letter-spacing: 0; text-transform: none; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 2px; }
fieldset > button { margin-top: 12px; }
.button-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 12px; }
.message { min-height: 24px; margin: 0; padding: 0 16px 12px; color: var(--muted); font: 500 11px/1.5 var(--mono); }
.message.error { color: var(--red); }
.trace-drawer { margin: 0 16px 16px; border: 1px solid var(--rule); border-radius: 5px; }
.trace-drawer pre { max-height: 330px; margin: 0; padding: 13px; overflow: auto; border-top: 1px solid var(--rule); background: var(--surface-2); font: 11px/1.5 var(--mono); white-space: pre-wrap; }

.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.principles article { padding-top: 16px; border-top: 3px solid var(--accent); }
.limit-note { max-width: 880px; padding: 20px 22px; border: 1px solid var(--rule); border-left: 4px solid var(--amber); border-radius: 7px; background: var(--surface); }
.limit-note p { margin: 0; color: var(--muted); }
.evidence-links { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 14px; }
.evidence-links a,
.text-link { font-weight: 650; text-decoration: none; }
.evidence-links a:hover,
.text-link:hover { text-decoration: underline; }
.developer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 16px; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; background: var(--rule); }
.developer-grid article { padding: 17px; background: var(--surface); }

footer { padding: 24px 0 42px; border-top: 1px solid var(--rule); color: var(--faint); font-size: 12px; }
footer p { max-width: 880px; }
footer code { padding: 2px 5px; border-radius: 3px; background: var(--surface-2); font-family: var(--mono); }

.step-nav { display: none; }
.step-nav button {
  flex: 1;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.step-nav button b { color: var(--faint); font: 600 9px/1 var(--mono); letter-spacing: .08em; }
.step-nav button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.step-nav button[aria-pressed="true"] b { color: var(--accent); }

@media (max-width: 900px) {
  .journey,
  .live-journey { grid-template-columns: 1fr; }
  .journey-card,
  .live-card { min-height: auto; }
  .proof { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .principles { grid-template-columns: 1fr; gap: 16px; }
  .developer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .masthead,
  main,
  footer { width: min(100% - 30px, 1180px); }
  .masthead { min-height: 0; padding: 17px 0; align-items: flex-start; }
  .brand small { display: none; }
  .topnav { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .topnav > a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 5px; }
  .hero { padding: 42px 0 34px; }
  .hero h1 { font-size: 40px; }
  body[data-lang="zh"] .hero h1 { font-size: 36px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions > * { width: 100%; }
  .trust { display: grid; gap: 7px; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .mode-badge { align-self: flex-start; }
  .scenario-tabs { display: grid; grid-template-columns: 1fr; }
  .scenario-tabs button { width: 100%; }
  .journey-card { min-height: auto; }
  .proof { grid-template-columns: 1fr 1fr; }
  .proof article { padding: 14px; }
  .proof strong { font-size: 23px; }
  .engine-status { align-items: flex-start; flex-wrap: wrap; }
  .engine-meta { width: calc(100% - 20px); margin-left: 19px; }
  .engine-status .compact { width: 100%; }
  .advanced-grid { grid-template-columns: 1fr; padding: 11px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .button-row > * { flex: 1; }
  /* One step at a time: the three-column narrative does not survive a phone column. */
  .step-nav { display: flex; gap: 7px; margin-bottom: 14px; }
  .journey[data-step="1"] > .journey-card:not(:nth-of-type(1)),
  .journey[data-step="2"] > .journey-card:not(:nth-of-type(2)),
  .journey[data-step="3"] > .journey-card:not(:nth-of-type(3)),
  .live-journey[data-step="1"] > .live-card:not(:nth-of-type(1)),
  .live-journey[data-step="2"] > .live-card:not(:nth-of-type(2)),
  .live-journey[data-step="3"] > .live-card:not(:nth-of-type(3)) { display: none; }
  .developer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .masthead { display: block; }
  .topnav { justify-content: flex-start; margin-top: 14px; }
  .hero h1,
  body[data-lang="zh"] .hero h1 { font-size: 34px; }
  .proof { grid-template-columns: 1fr; }
}
