/* Civilization Waves — academic ink-on-aged-paper */
:root {
  --bg: #f5efe2;
  --bg-deep: #ebe2ce;
  --bg-elev: #fbf6e8;
  --surface: #fffdf6;
  --surface-2: #f0e9d6;
  --paper: #fffdf6;
  --ink: #1a1814;
  --ink-soft: #4a443c;
  --ink-mute: #847a6a;
  --hairline: #1a18140e;
  --hairline-strong: #1a181422;
  --rule: #1a18143a;
  --cinnabar: #c8313b;
  --cinnabar-deep: #9c2229;
  --tea: #5d7a4c;
  --tea-deep: #3f5934;
  --bronze: #9c7a3a;
  --indigo: #2d3a6a;
  --plum: #7a3a5a;
  --shadow: 0 1px 0 #fff inset, 0 2px 10px #1a18140a;
  --max: 1320px;
  --font-display: "DM Serif Display", "Source Han Serif SC", Georgia, serif;
  --font-body: "Source Serif 4", "Source Serif Pro", "PingFang SC", "Hiragino Sans GB", system-ui, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

html[data-theme="dark"] {
  --bg: #14110d;
  --bg-deep: #0a0908;
  --bg-elev: #1c1814;
  --surface: #221d18;
  --surface-2: #2a241f;
  --paper: #f5efe2;
  --ink: #f5efe2;
  --ink-soft: #c5beb1;
  --ink-mute: #807a72;
  --hairline: #ffffff0e;
  --hairline-strong: #ffffff1f;
  --rule: #ffffff34;
  --cinnabar: #e35563;
  --cinnabar-deep: #c8313b;
  --tea: #92b08a;
  --tea-deep: #5d7a4c;
  --bronze: #d4a85e;
  --indigo: #8090c8;
  --plum: #b08aa8;
  --shadow: 0 1px 0 #ffffff05 inset, 0 8px 28px #0007;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga", "kern";
  transition: background .25s, color .25s;
}

a { color: var(--cinnabar); text-decoration: none; border-bottom: 1px solid var(--rule); transition: color .15s, border-color .15s; }
a:hover { color: var(--tea); border-bottom-color: var(--tea); }

.container { max-width: var(--max); margin: 0 auto; padding: 0 36px; }

/* ----- Topbar ----- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--hairline-strong);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 36px; max-width: var(--max); margin: 0 auto;
  gap: 16px;
}
.brand {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--font-display); font-weight: 400;
  font-size: 26px; letter-spacing: -.005em; line-height: 1;
  color: var(--ink); border: 0;
}
.brand em { font-style: italic; color: var(--cinnabar); }
.brand .seal {
  display: inline-block; width: 22px; height: 22px;
  background: var(--cinnabar); color: var(--paper);
  font-family: var(--font-display); font-size: 14px; line-height: 22px;
  text-align: center; font-style: italic;
}
.nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nav a {
  font-size: 12px; color: var(--ink-soft); border: 0;
  font-weight: 500; font-family: var(--font-mono);
  letter-spacing: .02em;
}
.nav a:hover { color: var(--cinnabar); }

.toolbar { display: flex; gap: 10px; align-items: center; }
.lang-toggle, .theme-toggle {
  display: inline-flex; border: 1px solid var(--hairline-strong);
  overflow: hidden; background: var(--surface);
}
.lang-toggle button, .theme-toggle button {
  background: transparent; border: 0; color: var(--ink-soft);
  padding: 6px 12px; cursor: pointer; font: inherit;
  letter-spacing: .04em;
  font-family: var(--font-mono); font-size: 11px;
}
.lang-toggle button.active, .theme-toggle button.active {
  background: var(--ink); color: var(--bg);
}

/* ----- Hero ----- */
.hero {
  padding: 90px 0 70px;
  position: relative; overflow: hidden;
  border-bottom: 2px solid var(--ink);
}
.hero-marker {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em;
  color: var(--cinnabar); text-transform: uppercase; margin-bottom: 28px;
  display: flex; align-items: center; gap: 12px;
}
.hero-marker::before { content: ""; width: 24px; height: 1px; background: var(--cinnabar); }
.hero-marker::after  { content: ""; flex: 1; height: 1px; background: var(--hairline-strong); max-width: 320px; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 7vw, 100px);
  line-height: 0.96;
  letter-spacing: -.02em;
  margin: 0 0 36px;
}
.hero h1 em { font-style: italic; color: var(--cinnabar); }
.hero h1 .alt { font-style: italic; color: var(--tea); }

.hero-thesis {
  display: grid; grid-template-columns: 1fr 1fr; gap: 60px;
  margin: 48px 0 56px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 30px 0;
}
.hero-thesis .label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  color: var(--ink-mute); text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-thesis .formula {
  font-family: var(--font-display); font-style: italic; font-size: 22px;
  line-height: 1.4; color: var(--ink); letter-spacing: -.005em;
}
.hero-thesis .formula em { font-style: normal; color: var(--cinnabar); }
.hero-thesis .formula b { color: var(--tea); font-weight: 400; font-style: italic; }
.hero-thesis blockquote {
  margin: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 24px; line-height: 1.4; color: var(--ink);
  letter-spacing: -.005em;
}

.hero-lede {
  font-size: 19px; line-height: 1.65; color: var(--ink-soft);
  max-width: 760px; margin: 0 0 36px;
}

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 56px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px;
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s;
  font-family: var(--font-mono); letter-spacing: .06em;
  text-transform: uppercase; border: 1px solid var(--ink);
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--cinnabar); color: var(--bg); border-color: var(--cinnabar); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
a.btn { border-style: solid; }

/* Hero schematic — 7 waves + China continuity */
.schematic-wrap {
  border: 1px solid var(--rule); padding: 32px;
  background: var(--surface);
}
.schematic-head {
  display: flex; justify-content: space-between; align-items: end;
  border-bottom: 1px solid var(--hairline-strong); padding-bottom: 14px; margin-bottom: 24px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase;
}
.schematic-head .id { color: var(--cinnabar); }
.schematic-head .ttl { color: var(--ink); font-weight: 500; font-family: var(--font-display); font-style: italic; font-size: 18px; letter-spacing: -.005em; text-transform: none; }
.schematic-head .rev { color: var(--ink-mute); }
.schematic-svg { width: 100%; aspect-ratio: 2.4; max-height: 420px; }

/* ----- Section ----- */
.section { padding: 110px 0; border-bottom: 1px solid var(--rule); position: relative; }
.section.alt { background: var(--bg-elev); }

.section-head {
  display: grid; grid-template-columns: 260px 1fr; gap: 60px;
  margin-bottom: 56px; align-items: start;
}
.section-num {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-mute);
  letter-spacing: .14em; font-weight: 500;
  border-top: 1px solid var(--ink); padding-top: 16px;
}
.section-num .big {
  font-family: var(--font-display); font-style: italic; font-size: 56px;
  font-weight: 400; color: var(--cinnabar); line-height: 1;
  display: block; margin-top: 12px; letter-spacing: -.02em;
}
.section-num .desc {
  display: block; color: var(--ink-mute); margin-top: 14px;
  font-weight: 400; letter-spacing: .04em; line-height: 1.55;
  font-family: var(--font-body); font-size: 13.5px;
}
.section-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(36px, 5vw, 68px); line-height: 1.0;
  letter-spacing: -.02em; margin: 0 0 18px;
}
.section-title em { font-style: italic; color: var(--cinnabar); }
.section-title .alt { font-style: italic; color: var(--tea); }
.section-lede {
  font-size: 18px; color: var(--ink-soft); max-width: 720px; line-height: 1.65;
}
.section-lede em { color: var(--ink); font-style: italic; }

/* ----- Module 1 — Wave Timeline ----- */
.timeline-wrap {
  border: 1px solid var(--rule); background: var(--surface);
  padding: 36px;
}
.tl-head {
  display: flex; justify-content: space-between; align-items: end;
  margin-bottom: 24px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline-strong);
}
.tl-head h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0; letter-spacing: -.01em; }
.tl-head .meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .04em; }
.tl-svg { width: 100%; aspect-ratio: 3.6; max-height: 280px; }

.waves-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); margin-top: 28px;
}
.wave {
  background: var(--surface); padding: 30px;
  position: relative;
}
.wave .num {
  position: absolute; top: 24px; right: 26px;
  font-family: var(--font-display); font-style: italic; font-size: 44px;
  color: var(--cinnabar); line-height: 1; opacity: .85;
}
.wave .id {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--cinnabar); text-transform: uppercase; font-weight: 500;
  margin-bottom: 8px;
}
.wave h4 {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; line-height: 1.1;
  max-width: 88%;
}
.wave .span {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute);
  letter-spacing: .04em; margin-bottom: 18px;
}
.wave > p { margin: 0 0 16px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.65; }
.wave > p em { color: var(--ink); font-style: italic; }

.wave-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 0; }
.wave-tags .tag {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em;
  padding: 3px 10px; background: var(--bg-elev); color: var(--ink-soft);
  border: 1px solid var(--hairline-strong);
}

.wave-actors {
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--hairline-strong);
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.6;
}
.wave-actors b { color: var(--ink); font-weight: 600; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; display: block; margin-bottom: 6px; }

/* ----- Module 2 — Internal vs External ----- */
.dyn-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--rule); }
.dyn-cell {
  background: var(--surface); padding: 36px;
  border-right: 1px solid var(--rule);
}
.dyn-cell:last-child { border-right: 0; }
.dyn-cell .badge {
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .12em; padding: 3px 10px; text-transform: uppercase; font-weight: 600;
  margin-bottom: 14px;
}
.dyn-cell.internal .badge { color: var(--tea); border: 1px solid var(--tea); }
.dyn-cell.external .badge { color: var(--cinnabar); border: 1px solid var(--cinnabar); }
.dyn-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 28px; margin: 0 0 10px; letter-spacing: -.01em; }
.dyn-cell > p { color: var(--ink-soft); font-size: 15px; margin: 0 0 18px; line-height: 1.65; }
.dyn-list { list-style: none; padding: 0; margin: 0; }
.dyn-list li {
  padding: 12px 0; border-top: 1px dashed var(--hairline-strong);
  display: grid; grid-template-columns: 70px 1fr; gap: 14px; font-size: 14.5px; line-height: 1.55;
}
.dyn-list li:first-child { border-top: 0; padding-top: 4px; }
.dyn-list .k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); padding-top: 3px; font-weight: 600; }
.dyn-list .v { color: var(--ink-soft); }
.dyn-list .v b { color: var(--ink); font-weight: 600; }

/* ----- Module 3 — Assimilation ----- */
.assim-wrap { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.assim-wrap h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.assim-wrap .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 28px; text-transform: uppercase; }
.assim-stages {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid var(--rule);
}
.stage-cell {
  background: var(--bg-elev); padding: 26px;
  border-right: 1px solid var(--rule);
  position: relative;
}
.stage-cell:last-child { border-right: 0; }
.stage-cell::after {
  content: "→"; position: absolute; right: -12px; top: 24px;
  font-family: var(--font-display); font-style: italic; font-size: 22px;
  color: var(--cinnabar); background: var(--surface); padding: 0 4px;
  z-index: 2;
}
.stage-cell:last-child::after { display: none; }
.stage-cell .n {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--cinnabar);
  letter-spacing: .12em; margin-bottom: 14px; text-transform: uppercase;
}
.stage-cell h5 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 22px; margin: 0 0 10px; letter-spacing: -.01em; line-height: 1.15; }
.stage-cell p { color: var(--ink-soft); font-size: 13.5px; margin: 0; line-height: 1.6; }
.stage-cell .ex {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--hairline-strong);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .02em; line-height: 1.5;
}

/* ----- Module 4 — Cultural Transformation Matrix ----- */
.matrix-wrap { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.matrix-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline-strong); }
.matrix-head h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0; letter-spacing: -.01em; }
.matrix-head .meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .04em; }

.matrix {
  display: grid;
  grid-template-columns: 80px repeat(5, 1fr);
  border: 1px solid var(--rule);
  font-size: 12.5px;
  overflow-x: auto;
}
.matrix > div {
  padding: 14px 12px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.matrix > div:nth-child(6n) { border-right: 0; }
.matrix .head {
  background: var(--ink); color: var(--bg);
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  text-align: center; padding: 12px 8px;
}
.matrix .row-head {
  background: var(--bg-elev); color: var(--ink);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
  text-align: center;
}
.matrix .cell {
  background: var(--surface);
  font-family: var(--font-body);
  color: var(--ink-soft);
  line-height: 1.5;
  font-size: 12.5px;
}
.matrix .cell b { color: var(--ink); font-weight: 600; display: block; margin-bottom: 3px; font-size: 13px; font-family: var(--font-display); font-style: italic; font-weight: 400; }
.matrix .cell.faint { background: var(--bg-elev); color: var(--ink-mute); font-style: italic; font-size: 11.5px; }
.matrix > div:last-child { border-bottom: 0; }
.matrix > div:nth-last-child(-n+6) { border-bottom: 0; }

/* ----- Module 5 — Feedback Loops ----- */
.loops-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.loops-svg-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.loops-svg-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.loops-svg-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.loops-svg { width: 100%; aspect-ratio: 1.05; }

.cycles-side h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 30px; margin: 0 0 6px; letter-spacing: -.01em; }
.cycles-side .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.phase {
  display: grid; grid-template-columns: 90px 1fr; gap: 16px;
  padding: 16px 0; border-top: 1px solid var(--hairline-strong);
}
.phase:first-of-type { border-top: 0; padding-top: 4px; }
.phase .marker {
  font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar);
  letter-spacing: .04em; padding-top: 5px; font-weight: 500;
  text-transform: uppercase;
}
.phase h5 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 21px; margin: 0 0 4px; letter-spacing: -.005em; }
.phase p { color: var(--ink-soft); font-size: 14.5px; margin: 0; line-height: 1.6; }

/* ----- Module 6 — Comparative ----- */
.compare-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid var(--rule);
}
.compare-cell {
  background: var(--surface); padding: 28px;
  border-right: 1px solid var(--rule);
}
.compare-cell:last-child { border-right: 0; }
.compare-cell .flag {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--cinnabar); text-transform: uppercase; font-weight: 600;
  margin-bottom: 12px;
}
.compare-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0 0 14px; letter-spacing: -.01em; line-height: 1.1; }
.compare-cell .pattern {
  font-family: var(--font-display); font-style: italic; font-size: 17px;
  color: var(--ink); padding: 10px 0 10px 14px; border-left: 2px solid var(--cinnabar);
  margin: 14px 0; line-height: 1.4;
}
.compare-cell p { color: var(--ink-soft); font-size: 14px; margin: 0 0 12px; line-height: 1.6; }
.compare-cell .signal {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em;
  color: var(--tea); text-transform: uppercase; font-weight: 600; margin-top: 14px;
}

/* ----- Module 7 — Guardrails ----- */
.guardrails {
  border: 1px solid var(--cinnabar); background: var(--surface);
  padding: 40px;
}
.guardrails-head {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--cinnabar);
}
.guardrails-head .seal {
  display: inline-block; width: 48px; height: 48px;
  background: var(--cinnabar); color: var(--paper);
  font-family: var(--font-display); font-style: italic; font-size: 28px;
  display: grid; place-items: center; line-height: 1;
}
.guardrails-head h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 30px; margin: 0; letter-spacing: -.01em; }
.guardrails-head .sub { font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.guardrails-list { list-style: none; padding: 0; margin: 0; counter-reset: gr; }
.guardrails-list li {
  padding: 16px 0 16px 60px; position: relative;
  border-top: 1px dashed var(--hairline-strong);
  counter-increment: gr;
}
.guardrails-list li:first-child { border-top: 0; padding-top: 4px; }
.guardrails-list li::before {
  content: "§ " counter(gr, decimal);
  position: absolute; left: 0; top: 18px;
  font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar);
  letter-spacing: .04em; font-weight: 600;
}
.guardrails-list li:first-child::before { top: 6px; }
.guardrails-list h5 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 22px; margin: 0 0 6px; letter-spacing: -.005em; }
.guardrails-list p { color: var(--ink-soft); font-size: 15px; margin: 0; line-height: 1.65; }
.guardrails-list p em { color: var(--ink); font-style: italic; }

/* ----- Module 8 — AI Historian ----- */
.historian {
  border: 1px solid var(--rule); background: var(--surface);
  display: grid; grid-template-columns: 320px 1fr; min-height: 580px;
  box-shadow: var(--shadow);
}
.historian-side {
  background: var(--bg-elev); border-right: 1px solid var(--rule);
  padding: 28px;
}
.historian-side h4 {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-mute); margin: 0 0 16px; font-weight: 600;
}
.historian-pill {
  background: transparent; border: 1px solid var(--hairline-strong);
  padding: 11px 14px; font: inherit; font-size: 13.5px;
  cursor: pointer; width: 100%; text-align: left; margin-bottom: 8px;
  color: var(--ink-soft); transition: all .15s; line-height: 1.4;
  font-family: var(--font-body);
}
.historian-pill:hover { background: var(--surface); color: var(--ink); border-color: var(--cinnabar); }
.historian-main { display: flex; flex-direction: column; }
.historian-stream { flex: 1; padding: 32px; overflow-y: auto; max-height: 580px; }
.msg { margin-bottom: 24px; max-width: 90%; }
.msg.user { margin-left: auto; }
.msg .role {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; font-weight: 600;
}
.msg .bubble {
  background: var(--bg-elev); border: 1px solid var(--hairline-strong);
  padding: 16px 20px; font-size: 15.5px; line-height: 1.65; font-family: var(--font-body);
}
.msg.user .bubble { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.msg .bubble p { margin: 0 0 10px; }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble strong { color: var(--cinnabar); font-weight: 600; }
.msg.user .bubble strong { color: var(--bronze); }
.msg .bubble .quoted {
  margin: 8px 0 6px; padding: 6px 0 6px 14px;
  border-left: 2px solid var(--cinnabar);
  font-family: var(--font-display); font-style: italic;
  font-size: 17px; line-height: 1.45; color: var(--ink-soft);
}
.historian-input {
  border-top: 1px solid var(--hairline-strong); padding: 18px;
  display: flex; gap: 10px; background: var(--bg-elev);
}
.historian-input input {
  flex: 1; border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--ink);
  padding: 12px 18px; font: inherit; font-size: 15px; font-family: var(--font-body);
}
.historian-input input:focus { outline: 2px solid var(--cinnabar); outline-offset: -1px; }
.historian-input input::placeholder { color: var(--ink-mute); font-style: italic; }

/* ----- Footer ----- */
.footer {
  background: var(--ink); color: #c5beb1;
  padding: 80px 0 40px;
}
html[data-theme="dark"] .footer { background: var(--bg-deep); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 56px; }
.footer h5 {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .12em; color: var(--cinnabar); margin: 0 0 18px; font-weight: 600;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; font-size: 14.5px; font-family: var(--font-body); }
.footer a { color: #c5beb1; border: 0; }
.footer a:hover { color: var(--cinnabar); }
.footer-brand {
  font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 38px;
  color: var(--bg); letter-spacing: -.01em; margin-bottom: 14px; line-height: 1;
}
.footer-brand em { font-style: normal; color: var(--cinnabar); }
html[data-theme="dark"] .footer-brand { color: var(--ink); }
.footer-tag { color: #968d80; font-size: 14.5px; max-width: 380px; line-height: 1.65; font-style: italic; }
.footer-bottom {
  border-top: 1px solid #ffffff14; padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #968d80; font-family: var(--font-mono);
  letter-spacing: .04em;
}
.footer-bottom a { color: #968d80; border: 0; }
.footer-bottom a:hover { color: var(--cinnabar); }

/* ----- i18n ----- */
html[data-lang="en"] [lang="zh"] { display: none !important; }
html[data-lang="zh"] [lang="en"] { display: none !important; }
html[data-lang="en"][lang="zh"], html[data-lang="zh"][lang="en"] { display: block !important; }

/* ----- Responsive ----- */
@media (max-width: 1000px) {
  .nav { display: none; }
  .hero { padding: 50px 0 50px; }
  .hero-thesis { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; }
  .section { padding: 70px 0; }
  .section-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 36px; }
  .waves-grid { grid-template-columns: 1fr; }
  .dyn-shell { grid-template-columns: 1fr; }
  .dyn-cell:not(:last-child) { border-right: 0; border-bottom: 1px solid var(--rule); }
  .assim-stages { grid-template-columns: 1fr; }
  .stage-cell { border-right: 0; border-bottom: 1px solid var(--rule); }
  .stage-cell::after { display: none; }
  .stage-cell:last-child { border-bottom: 0; }
  .matrix { grid-template-columns: 70px repeat(5, minmax(140px, 1fr)); font-size: 11.5px; }
  .loops-shell { grid-template-columns: 1fr; gap: 24px; }
  .compare-grid { grid-template-columns: 1fr 1fr; }
  .compare-cell { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .compare-cell:nth-child(2n) { border-right: 0; }
  .compare-cell:nth-last-child(-n+2) { border-bottom: 0; }
  .historian { grid-template-columns: 1fr; min-height: 0; }
  .historian-side { border-right: 0; border-bottom: 1px solid var(--rule); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .toolbar { gap: 6px; }
  .lang-toggle button, .theme-toggle button { padding: 5px 8px; font-size: 10px; }
}
@media (max-width: 600px) {
  .compare-grid { grid-template-columns: 1fr; }
  .compare-cell { border-right: 0 !important; }
  .compare-cell:not(:last-child) { border-bottom: 1px solid var(--rule) !important; }
}

/* ----- utility ----- */
.fade-in { opacity: 0; transform: translateY(8px); transition: opacity .5s, transform .5s; }
.fade-in.in { opacity: 1; transform: none; }
