  /* ── tokens ─────────────────────────────────────────────────────────── */
  :root {
    --paper:        #ECEEF3;
    --surface:      #FFFFFF;
    --surface-2:    #F5F6FA;
    --ink:          #0F1522;
    --ink-2:        #3A4356;
    --muted:        #626D82;
    --line:         #D6DAE3;
    --line-strong:  #B7BFCD;
    --accent:       #2B45D4;
    --accent-text:  #1E33B4;
    --accent-wash:  #E6EAFB;
    --code-bg:      #F2F4F9;
    --shadow:       0 1px 2px rgba(15, 21, 34, .04);

    --tone-system:    #6B4FD8;
    --tone-workspace: #1F8A5B;
    --tone-input:     #B57314;
    --tone-insight:   #BC4A45;
    --tone-warn:      #A96A0C;

    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;

    --wrap: min(1140px, calc(100% - 48px));
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --paper:       #080B11;
      --surface:     #111722;
      --surface-2:   #0D131D;
      --ink:         #E4E9F2;
      --ink-2:       #C0C8D8;
      --muted:       #8792A6;
      --line:        #212A39;
      --line-strong: #334156;
      --accent:      #8098FF;
      --accent-text: #A6B7FF;
      --accent-wash: #16203A;
      --code-bg:     #0B111A;
      --shadow:      none;

      --tone-system:    #A38DF0;
      --tone-workspace: #46B885;
      --tone-input:     #DFA84A;
      --tone-insight:   #E4817B;
      --tone-warn:      #DFA84A;
    }
  }

  :root[data-theme="dark"] {
    --paper:       #080B11;
    --surface:     #111722;
    --surface-2:   #0D131D;
    --ink:         #E4E9F2;
    --ink-2:       #C0C8D8;
    --muted:       #8792A6;
    --line:        #212A39;
    --line-strong: #334156;
    --accent:      #8098FF;
    --accent-text: #A6B7FF;
    --accent-wash: #16203A;
    --code-bg:     #0B111A;
    --shadow:      none;

    --tone-system:    #A38DF0;
    --tone-workspace: #46B885;
    --tone-input:     #DFA84A;
    --tone-insight:   #E4817B;
    --tone-warn:      #DFA84A;
  }

  /* ── base ───────────────────────────────────────────────────────────── */
  * { box-sizing: border-box; }

  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
  a:hover { border-bottom-color: var(--accent); }
  a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

  h1, h2, h3, h4 { margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
  p { margin: 0; }

  code, kbd, .mono { font-family: var(--font-mono); font-variant-ligatures: none; }

  code {
    font-size: .855em;
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: .1em .38em;
    color: var(--ink-2);
    white-space: nowrap;
  }

  pre {
    margin: 0;
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 16px 18px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.75;
    color: var(--ink-2);
    tab-size: 2;
  }
  pre code { background: none; border: 0; padding: 0; font-size: inherit; white-space: pre; }

  kbd {
    font-size: .82em; background: var(--surface-2); color: var(--ink);
    border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
    padding: .05em .4em; white-space: nowrap;
  }
  pre .c { color: var(--muted); }
  pre .k { color: var(--accent-text); }

  .wrap { width: var(--wrap); margin-inline: auto; }

  /* ── i18n: default zh, only <span> toggles ──────────────────────────── */
  .en { display: none; }
  :root[data-lang="en"] .en { display: revert; }
  :root[data-lang="en"] .zh { display: none; }

  /* ── header ─────────────────────────────────────────────────────────── */
  .topbar {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar-in { display: flex; align-items: center; gap: 28px; height: 56px; }

  .wordmark {
    display: inline-flex; align-items: center; gap: 9px;
    font-family: var(--font-mono); font-size: 14px; font-weight: 600;
    letter-spacing: -.01em; color: var(--ink); border: 0; white-space: nowrap;
  }
  .wordmark .glyph { display: grid; gap: 2px; }
  .wordmark .glyph i { display: block; width: 15px; height: 3px; border-radius: 1px; background: var(--accent); opacity: .35; }
  .wordmark .glyph i:first-child { opacity: 1; }
  .wordmark .glyph i:nth-child(2) { opacity: .62; }

  .topnav { display: flex; gap: 20px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a {
    font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em;
    color: var(--muted); border: 0; white-space: nowrap; padding-block: 4px;
  }
  .topnav a:hover { color: var(--ink); }
  /* The one item in the bar that leaves the page; coloured so it reads as an
     action rather than another section. */
  .topnav a.dlnav { color: var(--accent-text); font-weight: 500; }

  .lang {
    font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em;
    color: var(--muted); background: transparent;
    border: 1px solid var(--line-strong); border-radius: 3px;
    padding: 4px 9px; cursor: pointer; white-space: nowrap;
  }
  .lang:hover { color: var(--ink); border-color: var(--ink-2); }

  /* The way out to the account every repository on this page lives in. It sits
     beside the language button rather than inside .topnav, so it survives the
     narrow-screen collapse that hides the section links. */
  .topend { display: flex; align-items: center; gap: 14px; }
  .ghlink {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em;
    color: var(--muted); border: 0; white-space: nowrap;
  }
  .ghlink:hover { color: var(--ink); }
  .ghlink svg { display: block; width: 16px; height: 16px; fill: currentColor; }

  /* ── hero ───────────────────────────────────────────────────────────── */
  .hero { padding-block: 76px 84px; border-bottom: 1px solid var(--line); }
  .hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 64px; align-items: start; }

  .eyebrow {
    font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .13em;
    text-transform: uppercase; color: var(--muted);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  }
  .eyebrow .pin {
    color: var(--accent-text); background: var(--accent-wash);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 3px; padding: 2px 7px; letter-spacing: .04em; text-transform: none;
  }

  h1 {
    font-family: var(--font-mono);
    font-size: clamp(38px, 6.2vw, 60px);
    font-weight: 600; letter-spacing: -.045em;
    margin-top: 20px;
  }
  h1 .slash { color: var(--accent); }

  .thesis { font-size: 20px; line-height: 1.55; color: var(--ink); margin-top: 22px; max-width: 34em; letter-spacing: -.01em; }
  .lede { font-size: 15.5px; color: var(--muted); margin-top: 18px; max-width: 40em; }

  /* The page's one call to action: the installer that runs all of this. The
     filled button takes its text from `--surface`, not white, so it stays
     legible against the light accent the dark palette uses. */
  .dl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 34px; }
  .dl a { display: inline-flex; align-items: baseline; gap: 8px; padding: 11px 17px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--ink); text-decoration: none; }
  .dl a:hover { border-color: var(--accent); color: var(--accent-text); }
  .dl a.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
  .dl a.primary:hover { color: var(--surface); filter: brightness(1.08); }
  .dl .os { font-size: 14.5px; font-weight: 500; }
  .dl .meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
  .dl a.primary .meta { color: color-mix(in srgb, var(--surface) 72%, transparent); }
  .dl .dl-note { font-size: 12.5px; color: var(--muted); }
  .dl .dl-note a { all: unset; color: var(--accent-text); cursor: pointer; }
  .dl .dl-note a:hover { text-decoration: underline; }

  .stats { display: grid; grid-template-columns: repeat(4, auto); gap: 0; margin-top: 38px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--surface); width: fit-content; max-width: 100%; }
  .stat { padding: 14px 22px 13px; border-right: 1px solid var(--line); }
  .stat:last-child { border-right: 0; }
  .stat b { display: block; font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .stat span.cap { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; }

  /* ── layer stack ────────────────────────────────────────────────────── */
  .stackwrap { display: grid; grid-template-columns: 22px 1fr; gap: 14px; margin-top: 6px; }
  .rail { position: relative; border-left: 1px solid var(--line-strong); }
  .rail::before, .rail::after {
    content: ""; position: absolute; left: -1px; width: 9px; height: 1px; background: var(--line-strong);
  }
  .rail::before { top: 0; }
  .rail::after { bottom: 0; }
  .rail span {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg); transform-origin: center;
    font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em; color: var(--muted);
    background: var(--paper); padding: 4px 6px; white-space: nowrap;
  }

  .stack { display: grid; gap: 5px; }
  .layer {
    display: flex; align-items: baseline; gap: 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 3px;
    padding: 10px 14px; box-shadow: var(--shadow);
    transition: transform .18s ease, border-color .18s ease;
  }
  .layer:hover { transform: translateX(3px); border-color: var(--line-strong); }
  .layer .lname { font-family: var(--font-mono); font-size: 13px; color: var(--ink); letter-spacing: -.01em; }
  .layer .lrole { margin-left: auto; font-size: 11.5px; color: var(--muted); text-align: right; }
  .layer .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t, var(--muted)); flex: none; align-self: center; }
  .layer.harness { background: var(--surface-2); border-style: dashed; }
  .layer.harness .lname { color: var(--muted); }
  .layer.surface { border-color: var(--line-strong); }
  .stack-gap { height: 3px; }
  .stack-note { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-top: 14px; line-height: 1.7; }
  .stack-note b { color: var(--accent-text); font-weight: 500; }

  /* ── sections ───────────────────────────────────────────────────────── */
  section { border-bottom: 1px solid var(--line); padding-block: 74px; scroll-margin-top: 64px; }
  section:last-of-type { border-bottom: 0; }
  .sec-head { max-width: 66ch; }
  .sec-head h2 { font-size: clamp(25px, 3vw, 31px); margin-top: 12px; }
  .sec-head .intro { margin-top: 16px; color: var(--muted); font-size: 16px; max-width: 60ch; }

  .principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; margin-top: 44px; overflow: hidden; }
  .principle { background: var(--surface); padding: 24px 24px 26px; }
  .principle h3 { font-size: 16.5px; letter-spacing: -.015em; }
  .principle .num { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--accent-text); display: block; margin-bottom: 10px; }
  .principle p { margin-top: 10px; font-size: 14.5px; color: var(--muted); line-height: 1.68; }

  /* ── composition ────────────────────────────────────────────────────── */
  .halves { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin-top: 20px; }
  .half { background: var(--surface); padding: 20px 22px 22px; }
  .half .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .09em; color: var(--muted); text-transform: uppercase; }
  .half h4 { font-size: 15px; margin-top: 8px; }
  .half p { font-size: 14px; color: var(--muted); margin-top: 8px; }

  .figcap { font-size: 13px; color: var(--muted); margin-top: 12px; font-family: var(--font-mono); }

  .split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; margin-top: 44px; align-items: start; }
  .split h3 { font-size: 17px; }
  .split .body { margin-top: 14px; color: var(--muted); font-size: 15px; }
  .split .body p + p { margin-top: 12px; }

  .note {
    border: 1px solid var(--line); border-left: 3px solid var(--tone-insight);
    background: var(--surface); border-radius: 3px; padding: 18px 20px; margin-top: 22px;
  }
  .note .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--tone-insight); }
  .note pre { margin-top: 12px; background: var(--code-bg); }
  .note p { font-size: 14px; color: var(--muted); margin-top: 12px; }

  .deps { margin-top: 24px; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
  .dep { background: var(--surface); display: grid; grid-template-columns: minmax(210px, 260px) 1fr; gap: 20px; padding: 13px 20px; align-items: baseline; }
  .dep .who { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); }
  .dep .who .arrow { color: var(--accent); padding-inline: 5px; }
  .dep .what { font-size: 14px; color: var(--muted); }

  /* ── catalog ────────────────────────────────────────────────────────── */
  .filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 34px; }
  .filters button {
    font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .05em;
    background: var(--surface); color: var(--muted);
    border: 1px solid var(--line); border-radius: 3px; padding: 6px 12px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 7px;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
  }
  .filters button:hover { color: var(--ink); border-color: var(--line-strong); }
  .filters button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink-2); background: var(--surface); }
  .filters button .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t, var(--muted)); }
  .filters button .n { font-variant-numeric: tabular-nums; opacity: .65; }

  .lattice {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 1px; background: var(--line); border: 1px solid var(--line);
    border-radius: 4px; overflow: hidden; margin-top: 20px;
  }
  .card { background: var(--surface); padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
  .card[hidden] { display: none; }
  .card-top { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
  .card-top .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t); flex: none; }
  .card-top .ver { margin-left: auto; letter-spacing: .04em; font-variant-numeric: tabular-nums; text-transform: none; }
  .card h3 { font-size: 19px; }
  .card h3 .en-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 9px; }
  .card .pkg { font-family: var(--font-mono); font-size: 12px; color: var(--accent-text); word-break: break-all; margin-top: -6px; }
  .card .sum { font-size: 15px; color: var(--ink-2); }
  .card .detail { font-size: 14px; color: var(--muted); line-height: 1.68; }
  .card .strip { font-family: var(--font-mono); font-size: 11.5px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 3px; padding: 9px 11px; color: var(--ink-2); overflow-x: auto; white-space: pre; }
  .card-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .chip {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .03em;
    border: 1px solid var(--line); border-radius: 3px; padding: 3px 8px; color: var(--muted); background: var(--surface-2);
  }
  .chip.status { border-color: color-mix(in srgb, var(--tone-warn) 45%, transparent); color: var(--tone-warn); background: transparent; }
  .card-foot a { font-family: var(--font-mono); font-size: 11.5px; margin-left: auto; border-bottom: 0; color: var(--muted); }
  .card-foot a:hover { color: var(--accent-text); }

  /* ── apps ───────────────────────────────────────────────────────────── */
  .apps { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin-top: 40px; }
  .app { background: var(--surface); padding: 28px 26px 26px; display: flex; flex-direction: column; gap: 14px; }
  .app h3 { font-family: var(--font-mono); font-size: 19px; letter-spacing: -.03em; }
  .app .kind { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .app p { font-size: 14.5px; color: var(--muted); line-height: 1.68; }
  .app p strong { color: var(--ink-2); font-weight: 500; }
  /* A third application in a two-column grid would sit alone in half a row. */
  .app.wide { grid-column: 1 / -1; }

  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  .tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); margin-top: 22px; }
  th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
  th { font-family: var(--font-mono); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 400; background: var(--surface-2); }
  tbody tr:last-child td { border-bottom: 0; }
  td.m { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
  td.dim { color: var(--muted); }

  /* ── registry / install ─────────────────────────────────────────────── */
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 44px; align-items: start; }
  .stack-list { display: grid; gap: 18px; margin-top: 4px; }
  .stack-list li { list-style: none; }
  ul.plain { margin: 0; padding: 0; display: grid; gap: 14px; }
  ul.plain li { list-style: none; display: grid; grid-template-columns: 18px 1fr; gap: 10px; font-size: 14.5px; color: var(--muted); }
  ul.plain li::before { content: "—"; color: var(--accent); font-family: var(--font-mono); }
  ul.plain li b { color: var(--ink-2); font-weight: 600; }

  .urlbox { font-family: var(--font-mono); font-size: 12.5px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 4px; padding: 13px 15px; overflow-x: auto; white-space: nowrap; color: var(--accent-text); margin-top: 20px; }

  .rules { counter-reset: r; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin-top: 40px; }
  .rule { background: var(--surface); display: grid; grid-template-columns: 46px 1fr; gap: 4px 18px; padding: 18px 22px; align-items: baseline; }
  .rule::before {
    counter-increment: r; content: counter(r, decimal-leading-zero);
    font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: .04em;
  }
  .rule h4 { font-size: 15.5px; }
  .rule p { grid-column: 2; font-size: 14px; color: var(--muted); margin-top: 6px; }

  .paths { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin-top: 40px; }
  .path { background: var(--surface); padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; }
  .path .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .path h3 { font-size: 17px; }
  .path p { font-size: 14.5px; color: var(--muted); }
  .path ol { margin: 0; padding-left: 20px; font-size: 14.5px; color: var(--muted); display: grid; gap: 6px; }

  /* ── footer ─────────────────────────────────────────────────────────── */
  footer { border-top: 1px solid var(--line); padding-block: 40px 60px; }
  .foot-grid { display: flex; flex-wrap: wrap; gap: 26px 44px; align-items: baseline; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
  .foot-grid .k { color: var(--ink-2); }

  /* ── motion ─────────────────────────────────────────────────────────── */
  @keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  .stack .layer { animation: riseIn .5s cubic-bezier(.2, .7, .3, 1) backwards; }

  @media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
  }

  /* ── responsive ─────────────────────────────────────────────────────── */
  @media (max-width: 1000px) {
    .hero-grid, .split, .cols { grid-template-columns: 1fr; gap: 44px; }
    .apps, .paths, .halves { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); width: 100%; }
    .stat:nth-child(2) { border-right: 0; }
    .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  }
  @media (max-width: 640px) {
    :root { --wrap: calc(100% - 32px); }
    .hero { padding-block: 48px 56px; }
    section { padding-block: 52px; }
    .topnav { display: none; }
    /* .topnav carried the auto margin that pushed the right edge over. */
    .topend { margin-left: auto; }
    .dep { grid-template-columns: 1fr; gap: 6px; }
    .rule { grid-template-columns: 1fr; }
    .rule::before { grid-column: 1; }
    .rule p { grid-column: 1; }
  }
