/* ============================================================
   StarCore · 网络空间世界模型 — site styles
   Layout inspired by docs.bigmodel.cn + docs.typesafe.ai
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-sub: #fafafa;
  --bg-inset: #f5f5f7;
  --bg-hover: #f2f2f4;
  --fg: #111111;
  --fg-2: #52525b;
  --fg-3: #71717a;
  --fg-4: #a1a1aa;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --line-soft: #efeff1;

  --accent: #134cff;
  --accent-hover: #0f3fd8;
  --accent-soft: rgba(19, 76, 255, 0.07);
  --accent-fg: #dbe4ff;
  --star: rgba(19, 76, 255, 0.38);
  --star-strong: rgba(19, 76, 255, 0.55);

  --signal: #2e9bff;           /* figure blue — brand */
  --lav: #cdc9ea;
  --rose: #f2d7db;
  --sky: #c9d6f2;
  --ash: #e4e5e9;

  --warn-bg: #fefce8;
  --warn-line: #fef08a;
  --warn-fg: #854d0e;
  --ok-bg: #f0fdf4;
  --ok-line: #bbf7d0;
  --ok-fg: #166534;
  --info-bg: #eff6ff;
  --info-line: #bfdbfe;
  --info-fg: #1e40af;
  --danger-bg: #fef2f2;
  --danger-line: #fecaca;
  --danger-fg: #991b1b;

  --sidebar-w: 17rem;
  --header-h: 3.75rem;
  --content-max: 48rem;
  --toc-w: 14.5rem;

  --font-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", "Songti SC", "Noto Serif SC", "Source Han Serif SC",
    Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow-md: 0 6px 24px -8px rgba(17, 17, 17, 0.12);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html.dark {
  --bg: #141317;
  --bg-sub: #17161b;
  --bg-inset: #1d1c22;
  --bg-hover: #232228;
  --fg: #f3f2f4;
  --fg-2: #c0bec6;
  --fg-3: #96949e;
  --fg-4: #6d6b75;
  --line: #2a2930;
  --line-strong: #38373f;
  --line-soft: #222127;

  --accent: #7c9dff;
  --accent-hover: #a0b8ff;
  --accent-soft: rgba(124, 157, 255, 0.12);
  --star: rgba(255, 255, 255, 0.85);
  --star-strong: rgba(255, 255, 255, 0.95);

  --signal: #4aa3ff;
  --lav: #3b3752;
  --rose: #46303a;
  --sky: #27324d;
  --ash: #2c2b32;

  --warn-bg: rgba(202, 138, 4, 0.14);
  --warn-line: #713f12;
  --warn-fg: #fde047;
  --ok-bg: rgba(22, 163, 74, 0.14);
  --ok-line: #14532d;
  --ok-fg: #86efac;
  --info-bg: rgba(37, 99, 235, 0.16);
  --info-line: #1e3a8a;
  --info-fg: #93c5fd;
  --danger-bg: rgba(220, 38, 38, 0.14);
  --danger-line: #7f1d1d;
  --danger-fg: #fca5a5;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1.5rem); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 100;
}
.skip:focus { left: 1rem; top: .75rem; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: .625rem;
  font-weight: 600; letter-spacing: -0.01em; font-size: 15px;
  white-space: nowrap;
}
.brand .mark { width: 24px; height: 24px; color: var(--fg); flex: none; }
.brand > span { font-size: 15px; }
.brand .divider { width: 1px; height: 16px; background: var(--line-strong); margin: 0 .35rem; flex: none; }
/* Fixed-width brand keeps the top nav at the same x position on every page,
   regardless of how long the .sub label ("文档" / "网络空间世界模型" / …) is. */
.topbar .brand { min-width: 15.625rem; }
.brand .sub {
  color: var(--fg-3); font-weight: 400; font-size: 14px !important;
  min-width: 7.5rem; max-width: 7.5rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.topnav { display: flex; align-items: center; gap: .125rem; margin-left: .75rem; }
.topnav a {
  padding: .375rem .625rem; border-radius: 6px; font-size: 13.5px; color: var(--fg-2);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.topnav a:hover { background: var(--bg-hover); color: var(--fg); }
.topnav a[aria-current="page"] { color: var(--fg); background: var(--bg-inset); }

.topbar .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4375rem .875rem; border-radius: 7px;
  font-size: 13.5px; font-weight: 500; line-height: 1.3;
  border: 1px solid var(--line-strong); background: var(--bg);
  cursor: pointer; transition: all .15s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--fg-4); background: var(--bg-sub); }
.btn-primary {
  background: var(--fg); color: var(--bg); border-color: var(--fg);
}
html.dark .btn-primary { background: var(--fg); color: #141317; }
.btn-primary:hover { background: var(--fg-2); border-color: var(--fg-2); box-shadow: 0 6px 26px color-mix(in srgb, var(--accent) 32%, transparent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--fg); }

.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  color: var(--fg-2); cursor: pointer; transition: all .15s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }

.kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-3);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  padding: 0 .3rem; margin-left: .25rem;
}

/* Search trigger */
.search-trigger {
  display: flex; align-items: center; gap: .5rem;
  min-width: 220px; padding: .375rem .625rem;
  border: 1px solid var(--line); border-radius: 7px;
  color: var(--fg-3); font-size: 13.5px; background: var(--bg-sub);
  cursor: pointer; transition: border-color .15s var(--ease);
}
.search-trigger:hover { border-color: var(--line-strong); }
.search-trigger svg { width: 15px; height: 15px; flex: none; }
.search-trigger .kbd { margin-left: auto; }

/* ============ Shell ============ */
.shell { display: flex; align-items: flex-start; }

/* ============ Sidebar ============ */
.sidebar {
  position: sticky; top: var(--header-h);
  width: var(--sidebar-w); flex: none;
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 1.25rem 1rem 4rem 1.5rem;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.nav-group { margin-bottom: 1.5rem; }
.nav-group-header {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-3); padding: 0 .5rem .5rem; margin: 0;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav-list a {
  display: flex; align-items: center; gap: .5rem;
  padding: .3125rem .5rem; border-radius: 5px;
  font-size: 13.5px; color: var(--fg-2); line-height: 1.45;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-list a:hover { background: var(--bg-hover); color: var(--fg); }
.nav-list a[aria-current="page"] {
  background: var(--accent-soft); color: var(--accent); font-weight: 550;
}
html.dark .nav-list a[aria-current="page"] { color: var(--accent); background: var(--bg-inset); }
.nav-list a .num {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-4);
  width: 1.1rem; flex: none;
}
.nav-list a[aria-current="page"] .num { color: var(--accent); }
.tag {
  margin-left: auto; font-size: 10px; font-weight: 600; line-height: 1;
  padding: .2rem .3rem; border-radius: 3px; letter-spacing: .01em;
  background: var(--bg-inset); color: var(--fg-3); border: 1px solid var(--line);
}
.tag-new { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-line); }
.sidebar-foot {
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .375rem;
}
.sidebar-foot a {
  font-size: 13px; color: var(--fg-3); display: inline-flex; align-items: center; gap: .5rem;
  padding: .25rem .5rem; margin-left: -.5rem; border-radius: 5px;
}
.sidebar-foot a:hover { color: var(--fg); background: var(--bg-hover); }

/* ============ Main column ============ */
.main { flex: 1; min-width: 0; display: flex; justify-content: center; }
.article-wrap {
  display: flex; gap: 3rem;
  width: 100%; max-width: calc(var(--content-max) + var(--toc-w) + 3rem + 6rem);
  margin: 0 auto;
  padding: 2.5rem 3rem 5rem;
}
.content { flex: 1 1 auto; min-width: 0; max-width: var(--content-max); }
@media (max-width: 1180px) {
  .article-wrap { justify-content: center; max-width: calc(var(--content-max) + 6rem); }
}
@media (min-width: 1440px) {
  .article-wrap { padding-right: 3.5rem; padding-left: 3rem; }
}

/* breadcrumb + eyebrow */
.crumbs { display: flex; align-items: center; gap: .375rem; font-size: 12.5px; color: var(--fg-3); margin-bottom: 1rem; }
.crumbs a:hover { color: var(--fg); }
.crumbs svg { width: 12px; height: 12px; color: var(--fg-4); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .75rem;
}
.eyebrow::before { content: ""; width: 14px; height: 1px; background: currentColor; }

/* ============ Typography ============ */
.prose h1 {
  font-size: clamp(2.1rem, 4vw, 2.9rem);
  line-height: 1.12; letter-spacing: -0.035em; font-weight: 650;
  margin: 0 0 .75rem;
}
.prose h1 + .lede { font-size: 17px; color: var(--fg-2); line-height: 1.7; margin: 0 0 1.75rem; max-width: 40rem; }
.prose h2 {
  font-size: 1.4rem; line-height: 1.3; letter-spacing: -0.02em; font-weight: 620;
  margin: 3.25rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.prose h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 2.5rem; }
.prose h3 {
  font-size: 1.075rem; line-height: 1.4; letter-spacing: -0.01em; font-weight: 600;
  margin: 2rem 0 .625rem;
}
.prose h4 { font-size: .95rem; font-weight: 600; margin: 1.5rem 0 .5rem; color: var(--fg-2); }
.prose p { margin: 0 0 1rem; color: var(--fg-2); }
.prose strong { color: var(--fg); font-weight: 600; }
.prose em { color: var(--fg); font-style: italic; }
.prose a:not(.btn):not(.card):not(.step):not(.ref-card) {
  color: var(--accent); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.prose a:not(.btn):not(.card):not(.step):hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 1.1rem; padding-left: 1.25rem; color: var(--fg-2); }
.prose li { margin: .3rem 0; }
.prose li::marker { color: var(--fg-4); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.prose blockquote {
  margin: 1.25rem 0; padding: 0 0 0 1rem;
  border-left: 2px solid var(--accent); color: var(--fg-2);
  font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.65;
}
.prose code {
  font-family: var(--font-mono); font-size: .84em;
  background: var(--bg-inset); border: 1px solid var(--line);
  padding: .1em .35em; border-radius: 4px; color: var(--fg);
}
.prose .h-anchor {
  margin-left: .5rem; color: var(--fg-4); font-weight: 400; opacity: 0;
  transition: opacity .15s var(--ease); text-decoration: none !important;
}
.prose h2:hover .h-anchor, .prose h3:hover .h-anchor { opacity: 1; }

.lede-tag {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-serif); font-style: italic; font-size: 14px; color: var(--fg-3);
}

/* meta row under H1 */
.page-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  font-size: 12.5px; color: var(--fg-3); padding-bottom: 1.5rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.page-meta .dot { width: 3px; height: 3px; background: var(--fg-4); border-radius: 50%; }
.page-meta .pill {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line); border-radius: 999px; padding: .1rem .55rem;
  color: var(--fg-2); background: var(--bg-sub);
}
.page-meta .pill svg { width: 12px; height: 12px; color: var(--accent); }

/* ============ TOC ============ */
.toc {
  position: sticky; top: calc(var(--header-h) + 2rem);
  width: var(--toc-w); flex: none; align-self: flex-start;
  max-height: calc(100vh - var(--header-h) - 4rem);
  overflow-y: auto; font-size: 13px;
  scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }
.toc-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: .625rem;
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; color: var(--fg-3); padding: .2rem 0 .2rem .75rem;
  margin-left: -1px; border-left: 1px solid transparent; line-height: 1.5;
  transition: color .12s var(--ease), border-color .12s var(--ease);
}
.toc a:hover { color: var(--fg); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc li.sub a { padding-left: 1.5rem; font-size: 12.5px; }
.toc-foot { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.toc-foot .btn { width: 100%; justify-content: center; font-size: 12.5px; padding: .4rem .75rem; }

/* ============ Components ============ */
/* Cards */
.grid { display: grid; gap: 1rem; margin: 1.5rem 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  display: block; position: relative;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; background: var(--bg);
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
a.card:hover { border-color: var(--line-strong); background: var(--bg-sub); box-shadow: var(--shadow-sm); }
.card .card-icon {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 6px; margin-bottom: .75rem;
  color: var(--accent); background: var(--bg-sub);
}
.card .card-icon svg { width: 16px; height: 16px; }
.card h4 { margin: 0 0 .3rem; font-size: 14.5px; font-weight: 600; color: var(--fg); }
.card p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--fg-3); }
.card .arrow { position: absolute; top: 1rem; right: 1rem; color: var(--fg-4); transition: transform .15s var(--ease), color .15s var(--ease); }
a.card:hover .arrow { color: var(--fg); transform: translateX(2px); }
.card .kicker { font-size: 11px; color: var(--fg-4); font-family: var(--font-mono); letter-spacing: .02em; }

/* Numbered feature card */
.num-card { border-top: 2px solid var(--fg); }
.num-card .n { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); }

/* Callout */
.callout {
  display: flex; gap: .75rem; align-items: flex-start;
  margin: 1.25rem 0; padding: .85rem 1rem; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 13.5px; line-height: 1.65;
  background: var(--bg-sub); color: var(--fg-2);
}
.callout svg { width: 16px; height: 16px; flex: none; margin-top: .2rem; }
.callout p { margin: 0; color: inherit; }
.callout strong { color: var(--fg); }
.callout.note { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }
.callout.note strong { color: inherit; }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.callout.warn strong { color: inherit; }
.callout.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.callout.ok strong { color: inherit; }
.callout.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-fg); }
.callout.danger strong { color: inherit; }

/* Steps */
.steps { list-style: none; margin: 1.5rem 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 2.25rem 1fr; gap: 0 1rem;
  padding: 1rem 1.15rem 1rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  counter-increment: step;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 12px; color: var(--accent);
  grid-row: span 3; padding-top: .15rem;
}
.step .step-title { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .2rem; }
.step .step-title strong { font-size: 15px; font-weight: 600; color: var(--fg); }
.step .step-title .en { font-family: var(--font-serif); font-style: italic; font-size: 13px; color: var(--fg-3); }
.step p { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--fg-2); }
.step .step-tags { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }
.chip {
  font-size: 11px; line-height: 1.4; font-family: var(--font-mono);
  padding: .1rem .45rem; border-radius: 4px;
  border: 1px solid var(--line); color: var(--fg-3); background: var(--bg-sub);
}
.chip.accent { border-color: transparent; background: var(--accent-soft); color: var(--accent); }

/* Table */
.table-wrap { margin: 1.5rem 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--fg-3); background: var(--bg-sub);
  padding: .6rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
thead th:first-child, tbody td:first-child { padding-left: .75rem; }
thead th:last-child, tbody td:last-child { padding-right: .75rem; }
tbody td { padding: .5rem .5rem; border-bottom: 1px solid var(--line-soft); color: var(--fg-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-sub); }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
tr.hl { background: var(--accent-soft); }
tr.hl:hover { background: var(--accent-soft); }
tr.hl td { color: var(--fg); font-weight: 550; }
tr.hl td:first-child::before {
  content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin-right: .45rem; vertical-align: 2px;
}
.best { color: var(--accent); font-weight: 650; }
.table-note { font-size: 12px; color: var(--fg-3); padding: .55rem .75rem; border-top: 1px solid var(--line); background: var(--bg-sub); }
.table-cap { font-size: 12.5px; color: var(--fg-3); margin: .5rem 0 0; }

/* Definition list */
.defs { margin: 1.25rem 0; border-top: 1px solid var(--line); }
.defs > div {
  display: grid; grid-template-columns: 9rem 1fr; gap: 1rem;
  padding: .8rem 0; border-bottom: 1px solid var(--line-soft);
}
.defs dt { font-weight: 600; font-size: 13.5px; color: var(--fg); }
.defs dt .en { display: block; font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: 12.5px; color: var(--fg-3); }
.defs dd { margin: 0; font-size: 13.5px; color: var(--fg-2); line-height: 1.65; }

/* ============ Data-chain visual ============ */
.chain {
  margin: 1.5rem 0; padding: 1.25rem 1.25rem 1.1rem; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-sub);
}
.chain-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.chain-head h4 { margin: 0; padding: 0; display: flex; align-items: center; gap: .5rem; }
.chain-head code { font-size: 11.5px; }
.chain-row { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding-bottom: .25rem; -webkit-overflow-scrolling: touch; }
.state {
  flex: none; min-width: 4.6rem; padding: .5rem .4rem; text-align: center;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg);
}
.state .s-name { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg); font-weight: 600; }
.state .s-body { font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); margin-top: .1rem; white-space: nowrap; }
.state.missing { border-style: dashed; background: transparent; color: var(--fg-4); }
.state.missing .s-name { color: var(--fg-3); }
.state.future { border-color: var(--accent); background: var(--accent-soft); }
.state.future .s-name { color: var(--accent); }
.action {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 .3rem; min-width: 5.6rem; color: var(--fg-3);
}
.action .a-label { font-family: var(--font-mono); font-size: 9.5px; color: var(--fg-4); white-space: nowrap; }
.action .a-arrow { flex: 1; width: 100%; display: flex; align-items: center; gap: 2px; color: var(--fg-4); }
.action .a-arrow::before { content: ""; flex: 1; border-top: 1px dashed currentColor; }
.action .a-arrow::after { content: "›"; font-size: 14px; line-height: 1; }
.action .a-intent { font-size: 9.5px; color: var(--fg-4); white-space: nowrap; margin-top: .15rem; }
.chain-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .9rem; font-size: 11.5px; color: var(--fg-3); }
.chain-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chain-legend i { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--line-strong); display: inline-block; }
.chain-legend i.miss { border-style: dashed; background: none; }
.chain-legend i.fut { border-color: var(--accent); background: var(--accent-soft); }

/* Modal chain rows */
.mod-list { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0 0; }
.mod-row { display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; align-items: center; }
.mod-row .mod-name { font-size: 12.5px; font-weight: 600; color: var(--fg-2); }
.mod-row .mod-name small { display: block; font-family: var(--font-mono); font-size: 9.5px; color: var(--fg-4); font-weight: 400; }
.mod-row .mini { display: flex; align-items: center; gap: 4px; min-width: 0; }
.mini .box {
  font-family: var(--font-mono); font-size: 9.5px; padding: .2rem .35rem;
  border: 1px solid var(--line); border-radius: 3px; background: var(--bg);
  color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini .box.obs { border-color: var(--line-strong); color: var(--fg); }
.mini .sep { color: var(--fg-4); font-size: 10px; flex: none; }
.mini .ell { color: var(--fg-4); font-size: 10px; }

/* ============ Diagram (SFT / RL) ============ */
.diagram {
  margin: 1.5rem 0; padding: 1.25rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-sub);
}
.diagram-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 1rem; }
.flow { display: grid; gap: .5rem; }
.flow-node {
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg);
  padding: .6rem .75rem;
}
.flow-node .fn-k { font-family: var(--font-mono); font-size: 10px; color: var(--fg-4); }
.flow-node .fn-t { font-size: 13px; font-weight: 600; color: var(--fg); margin-top: .1rem; }
.flow-node .fn-d { font-size: 11.5px; color: var(--fg-3); margin-top: .1rem; }
.flow-node.hi { border-color: var(--accent); background: var(--accent-soft); }
.flow-arrow { display: grid; place-items: center; color: var(--fg-4); height: 1rem; }
.flow-arrow svg { width: 14px; height: 14px; }
.flow-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .flow-cols { grid-template-columns: 1fr; } }

.reward-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 760px) { .reward-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.reward {
  border: 1px solid var(--line); border-radius: 6px; padding: .55rem .6rem; background: var(--bg);
}
.reward .rw-id { font-family: var(--font-mono); font-size: 10.5px; color: var(--accent); }
.reward .rw-t { font-size: 12px; font-weight: 600; color: var(--fg); margin: .15rem 0 .1rem; }
.reward .rw-d { font-size: 10.5px; color: var(--fg-3); line-height: 1.45; }

/* ============ Figures ============ */
figure.fig { margin: 1.75rem 0; }
figure.fig .frame {
  border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg-sub);
}
figure.fig .frame img { display: block; padding: 1.25rem; }
figure.fig .frame img + img { border-top: 1px solid var(--line); }
figure.fig img { width: 100%; height: auto; }
figure.fig figcaption {
  margin-top: .6rem; font-size: 12px; color: var(--fg-3); line-height: 1.55;
  font-family: var(--font-serif);
}
figure.fig figcaption b { font-family: var(--font-sans); font-weight: 600; color: var(--fg-2); }

/* Video figure */
figure.fig video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #0d0b18; }

/* ============ Live demos (index only — enabled via body.live-on) ============ */
/* A light wave travels along each chain: cells light up left-to-right and stay
   lit while a matching dim wave follows, then the cycle restarts. */
@keyframes flow-cell {
  0%        { background: var(--fl-bg, transparent); border-color: var(--fl-bd, transparent); color: var(--fl-c, var(--fg-2)); box-shadow: 0 0 0 0 rgba(19, 76, 255, 0); }
  5%        { background: var(--fl-lit-bg, var(--accent-soft)); border-color: var(--fl-lit-bd, var(--accent)); color: var(--fl-lit-c, var(--accent)); box-shadow: var(--fl-lit-sh, 0 0 0 0 rgba(19, 76, 255, 0)); }
  88%       { background: var(--fl-lit-bg, var(--accent-soft)); border-color: var(--fl-lit-bd, var(--accent)); color: var(--fl-lit-c, var(--accent)); box-shadow: var(--fl-lit-sh, 0 0 0 0 rgba(19, 76, 255, 0)); }
  96%, 100% { background: var(--fl-bg, transparent); border-color: var(--fl-bd, transparent); color: var(--fl-c, var(--fg-2)); box-shadow: 0 0 0 0 rgba(19, 76, 255, 0); }
}
/* Single-cell walk (hero timeline): exactly one cell is lit at a time —
   the next lights up as the previous goes out. */
@keyframes flow-solo {
  0%        { background: var(--fl-bg, transparent); border-color: var(--fl-bd, transparent); color: var(--fl-c, var(--fg-2)); box-shadow: 0 0 0 0 rgba(19, 76, 255, 0); }
  1.5%, 3%  { background: var(--fl-lit-bg, var(--accent-soft)); border-color: var(--fl-lit-bd, var(--accent)); color: var(--fl-lit-c, var(--accent)); box-shadow: var(--fl-lit-sh, 0 0 0 0 rgba(19, 76, 255, 0)); }
  4.5%,100% { background: var(--fl-bg, transparent); border-color: var(--fl-bd, transparent); color: var(--fl-c, var(--fg-2)); box-shadow: 0 0 0 0 rgba(19, 76, 255, 0); }
}
.live-on .wp-line .seg.s {
  --fl-bg: var(--bg-inset); --fl-bd: var(--line); --fl-c: var(--fg-2);
  --fl-lit-bg: var(--accent-soft); --fl-lit-bd: color-mix(in srgb, var(--accent) 45%, transparent); --fl-lit-c: var(--accent);
  animation: flow-solo var(--flow-dur, 9s) linear infinite backwards;
  animation-delay: calc(var(--i, 0) * 420ms);
}
.live-on .wp-line .seg.s.hot {
  /* resting look is neutral grey-white; it lights up blue only on its turn */
  --fl-bg: var(--bg-inset); --fl-bd: var(--line); --fl-c: var(--fg-2);
  --fl-lit-bg: color-mix(in srgb, var(--accent) 16%, transparent); --fl-lit-bd: var(--accent);
  --fl-lit-sh: 0 0 0 3px var(--accent-soft);
}
.live-on .wp-line .seg.a {
  --fl-c: var(--fg-4); --fl-lit-c: var(--accent);
  --fl-lit-bg: transparent; --fl-lit-bd: transparent;
  animation: flow-solo var(--flow-dur, 9s) linear infinite backwards;
  animation-delay: calc(var(--i, 0) * 420ms);
}
.live-on .mini .box {
  --fl-bg: var(--bg); --fl-bd: var(--line); --fl-c: var(--fg-3);
  --fl-lit-bg: var(--accent-soft); --fl-lit-bd: var(--accent); --fl-lit-c: var(--fg);
  animation: flow-cell var(--flow-dur, 9s) linear infinite backwards;
  animation-delay: calc(var(--i, 0) * 420ms);
}
.live-on .mini .box.obs { --fl-bd: var(--line-strong); --fl-c: var(--fg); }
.live-on .mini .sep { --fl-c: var(--fg-4); --fl-lit-c: var(--accent); --fl-lit-bg: transparent; --fl-lit-bd: transparent; animation: flow-cell var(--flow-dur, 9s) linear infinite backwards; animation-delay: calc(var(--i, 0) * 420ms); }

/* State-transition chain: JS steps through S₀ → S₄; past states stay lit. */
.live-on .state, .live-on .action { transition: border-color .35s, background .35s, box-shadow .35s, color .35s; }
.live-on .state.lit { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.live-on .state.lit .s-name { color: color-mix(in srgb, var(--accent) 75%, var(--fg)); }
.live-on .state.missing.lit { background: transparent; border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.live-on .state.missing.lit .s-name { color: color-mix(in srgb, var(--accent) 60%, var(--fg-3)); }
.live-on .state.now { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.live-on .state.now .s-name { color: var(--accent); }
.live-on .state.now .s-body { color: var(--fg-2); }
.live-on .state.future.now { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.live-on .state.missing.now { animation: mask-pulse 1.05s ease-in-out infinite; }
@keyframes mask-pulse {
  0%, 100% { border-color: color-mix(in srgb, var(--accent) 30%, transparent); box-shadow: 0 0 0 0 rgba(19, 76, 255, 0); }
  50% { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); }
}
.live-on .action.fire { color: var(--accent); }
.live-on .action.fire .a-label, .live-on .action.fire .a-intent { color: var(--accent); }
.live-on .action.fire .a-arrow { color: var(--accent); }
.live-on .action.fire .a-arrow::before { border-top-style: solid; }
.live-on .action.active .a-arrow::after { animation: arrow-nudge 1.05s ease-in-out infinite; }
@keyframes arrow-nudge { 50% { transform: translateX(3px); } }
.chain-live { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.chain-step {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chain-step::before { content: "▸ "; }

/* Multimodal interaction graph: gently bobbing arrow + blinking caret. */
.live-on .flow-arrow svg { animation: arrow-bob 2.4s ease-in-out infinite; }
@keyframes arrow-bob { 50% { transform: translateY(4px); } }
.live-on .flow-node.hi .fn-k::after { content: "▍"; margin-left: 2px; animation: caret-blink 1.1s steps(1) infinite; }
@keyframes caret-blink { 50% { opacity: 0; } }

/* ============ Logo / brand kit ============ */
.logo-card {
  display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin: 1.25rem 0;
}
.logo-card .mark-lg { width: 64px; height: 64px; color: var(--fg); }
.logo-card .mark-lg.signal { color: var(--signal); }
.logo-card h4 { margin: 0 0 .1rem; }
.logo-card p { margin: 0; font-size: 12.5px; color: var(--fg-3); }

/* ============ References ============ */
.refs { counter-reset: ref; list-style: none; padding: 0; margin: 1rem 0; }
.refs li {
  position: relative; padding: .55rem 0 .55rem 3rem;
  border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--fg-3); line-height: 1.6;
  overflow-wrap: anywhere;
}
.refs li::before {
  counter-increment: ref; content: "[" counter(ref) "]";
  position: absolute; left: 0; top: .55rem;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-4);
}
.refs li em { font-style: normal; color: var(--fg-2); }

.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; margin-top: 1.25rem; }
.ref-card {
  display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.ref-card:hover { border-color: var(--line-strong); background: var(--bg-sub); }
.ref-card .rc-k { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.ref-card .rc-t { font-size: 14px; font-weight: 600; margin: .2rem 0 .15rem; }
.ref-card .rc-d { font-size: 12px; color: var(--fg-3); line-height: 1.5; }

/* ============ Home landing ============ */
.hero {
  position: relative; overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1000px 520px at 62% -12%, color-mix(in srgb, var(--lav) 15%, transparent), transparent 68%),
    radial-gradient(1200px 480px at 15% -20%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(900px 380px at 90% -10%, color-mix(in srgb, var(--signal) 7%, transparent), transparent 70%);
}

/* Starfield backdrop — dots are generated by JS as box-shadow lists; color follows the theme. */
.starfield { position: absolute; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; }
.starfield .stars {
  position: absolute; top: 0; left: 0; width: 1px; height: 1px; border-radius: 50%;
  background: transparent;
}
.starfield .s1 { animation: star-twinkle 9s ease-in-out infinite; }
.starfield .s2 { width: 2px; height: 2px; animation: star-twinkle 13s ease-in-out infinite 2.5s; }
@keyframes star-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
/* A pair of meteors — one large, one small — sweeps the full banner diagonal
   every cycle: from the top-right corner, behind the card, down to the
   bottom-left corner. rotate(156°) + positive translateX = down-left travel;
   flight time ≈ 0.5s, then the sky rests until the next pass. */
.meteor {
  position: absolute; height: 2px; border-radius: 999px;
  background: linear-gradient(270deg, var(--star-strong), transparent);
  opacity: 0; pointer-events: none;
  transform: var(--rot, rotate(156deg));
  animation: meteor-fly 7s linear infinite 0.8s;
}
.meteor.big {
  width: 260px; top: 8%; right: 0;
  --rot: rotate(156deg); --fly: 1250px;
}
.meteor.small {
  width: 130px; height: 1.5px; top: 2%; right: 0;
  --rot: rotate(157deg); --fly: 1250px;
  background: linear-gradient(270deg, var(--star), transparent);
  animation-delay: 1.35s;
}
@keyframes meteor-fly {
  0%   { opacity: 0; transform: var(--rot) translateX(0); }
  3%   { opacity: 1; }
  6.5% { opacity: 1; }
  7%   { opacity: 0; transform: var(--rot) translateX(var(--fly)); }
  100% { opacity: 0; transform: var(--rot) translateX(var(--fly)); }
}
.hero-inner {
  max-width: 72rem; margin: 0 auto; padding: 4.5rem 2rem 3.5rem;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 3.5rem; align-items: center;
  position: relative; z-index: 1;
}
.hero-inner > * { min-width: 0; }
.hero .eyebrow { margin-bottom: 1rem; }
.hero h1 {
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(2.6rem, 5.4vw, 4.1rem); line-height: 1.02; letter-spacing: -0.03em;
  margin: 0 0 .5rem;
}
.hero h1 .en {
  display: block; font-style: italic; font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  letter-spacing: -0.01em; color: var(--fg-3); margin-top: .6rem;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 {
    background: linear-gradient(120deg, var(--fg) 38%, var(--accent) 125%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .hero h1 .en { -webkit-text-fill-color: var(--fg-3); }
}
.hero .hero-lede { font-size: 16.5px; color: var(--fg-2); max-width: 34rem; margin: 1.25rem 0 1.75rem; line-height: 1.7; }
.hero .cta { display: flex; flex-wrap: wrap; gap: .625rem; }
.hero .cta .btn { padding: .55rem 1.1rem; font-size: 14px; }
.hero .micro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.hero .micro div { font-size: 12px; color: var(--fg-3); line-height: 1.5; }
.hero .micro b { display: block; font-family: var(--font-serif); font-weight: 600; font-size: 1.65rem; color: var(--fg); letter-spacing: -0.02em; line-height: 1.2; }

/* world preview visual */
.hero-visual { display: contents; }
.globe-wrap {
  position: absolute; top: 50%; right: -12rem; transform: translateY(-50%);
  width: min(42rem, 58vw); height: min(42rem, 58vw);
  z-index: -1; pointer-events: none; opacity: .85;
}
.globe-wrap::before {
  content: ""; position: absolute; inset: -14%; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 60%);
}
.globe-wrap canvas { position: relative; width: 100%; height: 100%; display: block; }
.world-preview {
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.world-preview .wp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--bg-sub);
  font-size: 11.5px; color: var(--fg-3); font-family: var(--font-mono);
}
.world-preview .wp-head .dots { display: flex; gap: 4px; }
.world-preview .wp-head .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.world-preview .wp-body { padding: 1.1rem; display: grid; gap: .55rem; }
.wp-line { display: flex; align-items: center; gap: .5rem; font-family: var(--font-mono); font-size: 11px; }
.wp-line .lab { width: 5.2rem; flex: none; color: var(--fg-4); font-size: 10px; }
.wp-line .seg { height: 18px; border-radius: 3px; flex: none; display: flex; align-items: center; padding: 0 .4rem; color: var(--fg-2); font-size: 9.5px; border: 1px solid transparent; }
.wp-line .seg.s { background: var(--bg-inset); border-color: var(--line); }
.wp-line .seg.s.hot { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); }
.wp-line .seg.a { background: none; color: var(--fg-4); padding: 0 .1rem; }
.wp-foot { border-top: 1px solid var(--line); background: var(--bg-sub); padding: .55rem .9rem; font-size: 10.5px; color: var(--fg-3); font-family: var(--font-mono); display: flex; justify-content: space-between; }
.wp-foot .live { display: inline-flex; align-items: center; gap: .4rem; color: var(--ok-fg); }
.wp-foot .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* Section blocks on landing */
.section { max-width: 72rem; margin: 0 auto; padding: 4rem 2rem; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 40rem; margin-bottom: 2rem; }
.section-head h2 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(1.6rem, 2.6vw, 2.15rem); letter-spacing: -0.025em; margin: .6rem 0 .5rem; line-height: 1.2; }
.section-head p { margin: 0; color: var(--fg-2); }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.2rem;
  background: var(--bg); position: relative; overflow: hidden;
}
.stat .v { font-family: var(--font-serif); font-size: 2.35rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; color: var(--fg); font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 1.1rem; color: var(--fg-3); font-weight: 500; }
.stat .k { font-size: 12.5px; color: var(--fg-3); margin-top: .4rem; line-height: 1.5; }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: 0; }
.stat.accent::after { opacity: 1; }
.stat.accent .v { color: var(--accent); }

/* Pipeline 3-step landing */
.pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.pipe {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; background: var(--bg);
  display: flex; flex-direction: column; gap: .6rem; position: relative;
}
.pipe .p-k { font-family: var(--font-mono); font-size: 10.5px; color: var(--accent); letter-spacing: .04em; }
.pipe h3 { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: .5rem; }
.pipe h3 .en { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: .85rem; color: var(--fg-3); }
.pipe p { margin: 0; font-size: 13px; color: var(--fg-3); line-height: 1.6; }
.pipe .p-bar { height: 3px; border-radius: 2px; background: var(--bg-inset); overflow: hidden; margin-top: auto; }
.pipe .p-bar i { display: block; height: 100%; width: 33%; background: var(--accent); border-radius: 2px; }
.pipe:nth-child(2) .p-bar i { width: 66%; }
.pipe:nth-child(3) .p-bar i { width: 100%; }

/* Leaderboard mini bars */
.lb-row { display: grid; grid-template-columns: 9rem 1fr 3.5rem; gap: .75rem; align-items: center; padding: .35rem 0; font-size: 12.5px; }
.lb-row .lb-name { color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row.hl .lb-name { color: var(--fg); font-weight: 600; }
.lb-track { height: 8px; background: var(--bg-inset); border-radius: 99px; overflow: hidden; }
.lb-fill { display: block; height: 100%; width: var(--w, 0%); background: var(--ash); border-radius: 99px; transition: width .8s var(--ease); }
.lb-track { display: block; }
.lb-fill.grow:not(.done) { width: 0%; }
.lb-row.hl .lb-fill { background: var(--accent); }
.lb-row .lb-val { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-3); text-align: right; }
.lb-row.hl .lb-val { color: var(--accent); font-weight: 600; }

/* CTA band */
.cta-band {
  max-width: 72rem; margin: 0 auto 4rem; padding: 3rem 2rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, var(--bg-sub), var(--bg));
  display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center;
}
.cta-band h2 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(1.5rem, 2.4vw, 2rem); letter-spacing: -0.02em; margin: 0 0 .4rem; }
.cta-band p { margin: 0; color: var(--fg-3); font-size: 14px; }
.cta-band .cta { display: flex; gap: .625rem; flex-wrap: wrap; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line); background: var(--bg-sub);
}
.footer-inner {
  max-width: 72rem; margin: 0 auto; padding: 3rem 2rem 2rem;
  display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem;
}
.footer-inner .f-brand { display: flex; flex-direction: column; gap: .75rem; }
.footer-inner .f-brand .mark { width: 26px; height: 26px; }
.footer-inner .f-brand p { margin: 0; font-size: 12.5px; color: var(--fg-3); max-width: 22rem; line-height: 1.6; }
.footer-inner h5 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 .75rem; }
.footer-inner ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.footer-inner ul a { font-size: 13px; color: var(--fg-2); }
.footer-inner ul a:hover { color: var(--fg); }
.footer-base {
  border-top: 1px solid var(--line); padding: 1.1rem 2rem;
  max-width: 72rem; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  font-size: 12px; color: var(--fg-4);
}
.footer-base .links { display: flex; gap: 1.25rem; }
.footer-base a:hover { color: var(--fg-2); }

/* Doc footer */
.doc-footer { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; font-size: 13px; color: var(--fg-3); }
.feedback .fb-btns { display: flex; gap: .375rem; }
.feedback .btn { padding: .3rem .7rem; font-size: 12.5px; }
.feedback .btn.done { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-fg); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.75rem; }
.pager a {
  display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.pager a:hover { border-color: var(--line-strong); background: var(--bg-sub); }
.pager a .pk { font-size: 11px; color: var(--fg-4); display: flex; align-items: center; gap: .35rem; }
.pager a .pt { font-size: 14px; font-weight: 600; color: var(--fg); }
.pager a.next { text-align: right; align-items: flex-end; }

/* ============ Search dialog ============ */
dialog.search {
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 0; width: min(38rem, calc(100vw - 2rem));
  background: var(--bg); color: var(--fg);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.35);
  margin: 12vh auto auto;
}
dialog.search::backdrop { background: rgba(10, 10, 12, 0.42); backdrop-filter: blur(2px); }
.search-box { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.search-box svg { width: 17px; height: 17px; color: var(--fg-3); flex: none; }
.search-box input {
  flex: 1; border: 0; outline: 0; background: none; color: var(--fg);
  font: inherit; font-size: 15px;
}
.search-box input::placeholder { color: var(--fg-4); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-results { max-height: 50vh; overflow-y: auto; padding: .5rem; }
.search-results a {
  display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem;
  padding: .55rem .625rem; border-radius: 6px;
}
.search-results a:hover, .search-results a.sel { background: var(--bg-hover); }
.search-results .sr-t { font-size: 13.5px; font-weight: 550; color: var(--fg); }
.search-results .sr-g { font-size: 10.5px; color: var(--fg-4); text-transform: uppercase; letter-spacing: .06em; }
.search-results .sr-d { font-size: 12px; color: var(--fg-3); grid-column: 1 / -1; line-height: 1.5; }
.search-results .sr-empty { padding: 1.5rem; text-align: center; font-size: 13px; color: var(--fg-3); }
.search-foot { display: flex; gap: 1rem; padding: .5rem 1rem; border-top: 1px solid var(--line); font-size: 11px; color: var(--fg-4); background: var(--bg-sub); }
.search-foot kbd { font-family: var(--font-mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 .25rem; margin-right: .2rem; }

/* Mobile sidebar toggle */
.menu-btn { display: none; }

/* ============ Responsive ============ */
@media (max-width: 1180px) {
  .toc { display: none; }
  .article-wrap { max-width: calc(var(--content-max) + 5rem); }
}
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 3rem; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .cta-band { grid-template-columns: 1fr; margin-left: 1.25rem; margin-right: 1.25rem; }
}
@media (max-width: 860px) {
  :root { --header-h: 3.5rem; }
  .menu-btn { display: inline-grid; }
  .topnav, .search-trigger .txt, .search-trigger .kbd, .topbar .hide-sm { display: none; }
  .search-trigger { min-width: 0; padding: .4rem; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0;
    z-index: 40; background: var(--bg);
    transform: translateX(-105%); transition: transform .22s var(--ease);
    box-shadow: var(--shadow-md);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.3); z-index: 35; }
  .article-wrap { padding: 1.5rem 1.25rem 4rem; }
  .topbar { padding: 0 1rem; }
  .brand .divider { display: none; }
  .prose h2 { font-size: 1.3rem; }
  .defs > div { grid-template-columns: 1fr; gap: .25rem; }
  .pager { grid-template-columns: 1fr; }
  .mod-row { grid-template-columns: 1fr; gap: .3rem; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .section, .hero-inner { padding-left: 1.25rem; padding-right: 1.25rem; }
  .footer-inner { grid-template-columns: 1fr; padding: 2rem 1.25rem 1.5rem; }
  .footer-base { padding: 1rem 1.25rem; }
  .stat .v { font-size: 2rem; }
  .lb-row { grid-template-columns: 6.5rem 1fr 3rem; }
  .reward-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .topbar, .sidebar, .toc, .doc-footer, .site-footer, .menu-btn { display: none !important; }
  .article-wrap { padding: 0; max-width: none; }
  body { font-size: 11pt; }
}
