/* =========================================================================
   C++ 标准注疏 · 设计系统
   朱批（vermilion）为强调色：注疏传统里，批注用朱笔写在原文旁。
   颜色只通过 token 引用；暗色在两处定义（系统偏好 + 手动切换）。
   ========================================================================= */

:root {
  color-scheme: light;
  --bg:        #f7f5f0;
  --surface:   #fdfcf9;
  --surface-2: #f0ede5;
  --surface-3: #e7e3d8;
  --line:      #dcd7ca;
  --line-soft: #e9e5db;
  --ink:       #1b1a17;
  --ink-2:     #4f4c44;
  --ink-3:     #87837a;
  --accent:    #b8401f;          /* 朱 */
  --accent-2:  #8a2f16;
  --accent-bg: #f6e6df;
  --link:      #1f5fa8;
  --focus:     #1f5fa8;

  --good: #1d7a43;  --good-bg: #e3f1e7;
  --warn: #9a5b00;  --warn-bg: #f7ecd7;
  --bad:  #b42a2a;  --bad-bg:  #f8e1df;
  --info: #3f5f9a;  --info-bg: #e3e9f5;

  /* code (light) */
  --code-bg:   #fbfaf6;
  --code-head: #f2eee5;
  --code-gutter: #b9b3a6;
  --code-ink:  #2a2823;
  --tk-kw:     #b5361b;
  --tk-type:   #0b6e86;
  --tk-str:    #2b7a3b;
  --tk-num:    #b45f06;
  --tk-com:    #8f8a7e;
  --tk-pre:    #b0306d;
  --tk-name:   #2a2823;
  --tk-fn:     #6a3fc4;
  --tk-op:     #6b675e;
  --ic-bg:     #f4ebe4;
  --ic-ink:    #8a2f16;
  --ic-ring:   #ecd9cf;

  --shadow: 0 1px 2px rgba(40,30,10,.05), 0 8px 28px rgba(40,30,10,.07);
  --radius: 10px;
  --topbar-h: 56px;
  --sidebar-w: 300px;

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:        #141311;
    --surface:   #1b1a17;
    --surface-2: #23211d;
    --surface-3: #2d2a25;
    --line:      #39352e;
    --line-soft: #2b2924;
    --ink:       #ece8de;
    --ink-2:     #bdb7a9;
    --ink-3:     #8a8476;
    --accent:    #e2734f;
    --accent-2:  #f0a080;
    --accent-bg: #3a2219;
    --link:      #7fb0ec;
    --focus:     #7fb0ec;
    --good: #5cc185;  --good-bg: #183324;
    --warn: #e0a54a;  --warn-bg: #352812;
    --bad:  #ef7b72;  --bad-bg:  #3d1c1a;
    --info: #94b1e6;  --info-bg: #1c2638;
    --code-bg:   #181714;
    --code-head: #201e1a;
    --code-gutter: #565147;
    --code-ink:  #e6e1d4;
    --tk-kw:     #ff8f6b;
    --tk-type:   #6cc9dc;
    --tk-str:    #9fd68f;
    --tk-num:    #f0b96a;
    --tk-com:    #7f7a6e;
    --tk-pre:    #f08cb8;
    --tk-name:   #e6e1d4;
    --tk-fn:     #c3a8ff;
    --tk-op:     #b5ae9f;
    --ic-bg:     #2e231d;
    --ic-ink:    #f2b08f;
    --ic-ring:   #43312a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #141311;
  --surface:   #1b1a17;
  --surface-2: #23211d;
  --surface-3: #2d2a25;
  --line:      #39352e;
  --line-soft: #2b2924;
  --ink:       #ece8de;
  --ink-2:     #bdb7a9;
  --ink-3:     #8a8476;
  --accent:    #e2734f;
  --accent-2:  #f0a080;
  --accent-bg: #3a2219;
  --link:      #7fb0ec;
  --focus:     #7fb0ec;
  --good: #5cc185;  --good-bg: #183324;
  --warn: #e0a54a;  --warn-bg: #352812;
  --bad:  #ef7b72;  --bad-bg:  #3d1c1a;
  --info: #94b1e6;  --info-bg: #1c2638;
  --code-bg:   #181714;
  --code-head: #201e1a;
  --code-gutter: #565147;
  --code-ink:  #e6e1d4;
  --tk-kw:     #ff8f6b;
  --tk-type:   #6cc9dc;
  --tk-str:    #9fd68f;
  --tk-num:    #f0b96a;
  --tk-com:    #7f7a6e;
  --tk-pre:    #f08cb8;
  --tk-name:   #e6e1d4;
  --tk-fn:     #c3a8ff;
  --tk-op:     #b5ae9f;
  --ic-bg:     #2e231d;
  --ic-ink:    #f2b08f;
  --ic-ring:   #43312a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, kbd, pre { font-family: var(--font-mono); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
kbd {
  font-size: 11px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-family: var(--font-serif); font-weight: 700; font-size: 22px; color: var(--surface);
  background: var(--accent); width: 30px; height: 30px; border-radius: 7px;
  display: inline-grid; place-items: center; align-self: center; line-height: 1;
}
.brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.brand-sub { font-size: 12px; color: var(--ink-3); letter-spacing: .02em; }
.topnav { display: flex; gap: 2px; margin-left: 10px; }
.topnav a {
  color: var(--ink-2); padding: 6px 11px; border-radius: 8px; font-size: 14.5px;
}
.topnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
body[data-active="std"] .topnav a[data-nav="std"],
body[data-active="topics"] .topnav a[data-nav="topics"],
body[data-active="toolchain"] .topnav a[data-nav="toolchain"],
body[data-active="papers"] .topnav a[data-nav="papers"],
body[data-active="history"] .topnav a[data-nav="history"],
body[data-active="patterns"] .topnav a[data-nav="patterns"],
body[data-active="perf"] .topnav a[data-nav="perf"],
body[data-active="exercises"] .topnav a[data-nav="exercises"],
body[data-active="exams"] .topnav a[data-nav="exams"],
body[data-active="practice"] .topnav a[data-nav="practice"],
body[data-active="glossary"] .topnav a[data-nav="glossary"] { color: var(--accent); background: var(--accent-bg); }
.search-btn {
  margin-left: auto; display: flex; align-items: center; gap: 18px;
  padding: 6px 8px 6px 12px; min-width: 240px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  color: var(--ink-3); font-size: 13.5px; text-align: left;
}
.search-btn span { flex: 1; }
.search-btn:hover { border-color: var(--ink-3); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: none;
  display: inline-grid; place-items: center; font-size: 17px; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); }
.nav-toggle { display: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--line); background: var(--surface);
  padding: 14px 10px 40px; font-size: 13.5px; line-height: 1.45;
}
.main {
  display: grid; grid-template-columns: minmax(0, 780px) 220px; gap: 48px;
  padding: 36px 48px 80px; justify-content: center;
}
.content { min-width: 0; }
body.home .main, body[data-page$="-index"] .main, body[data-page="glossary"] .main { grid-template-columns: minmax(0, 1060px); }

/* ---------- sidebar ---------- */
.sb-tabs { display: flex; gap: 4px; padding: 0 4px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 8px; flex-wrap: wrap; }
.sb-tab {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 11px;
  font-size: 12.5px; color: var(--ink-2);
}
.sb-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.sb-filter { display: flex; align-items: center; gap: 6px; padding: 2px 6px 8px; color: var(--ink-3); font-size: 12px; }
.sb-filter input { accent-color: var(--accent); margin: 0; }
.sb-group { margin: 12px 6px 4px; font-size: 11.5px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
.sb-tree, .sb-tree ul { list-style: none; margin: 0; padding: 0; }
.sb-tree ul { padding-left: 12px; margin-left: 9px; border-left: 1px solid var(--line-soft); }
.sb-row { display: flex; align-items: flex-start; gap: 2px; border-radius: 6px; }
.sb-row:hover { background: var(--surface-2); }
.sb-caret {
  flex: none; width: 18px; height: 24px; border: 0; background: none; padding: 0;
  color: var(--ink-3); font-size: 10px; transition: transform .15s;
}
.sb-caret.spacer { visibility: hidden; }
li.open > .sb-row > .sb-caret { transform: rotate(90deg); }
li:not(.open) > ul { display: none; }
.sb-link { flex: 1; display: flex; gap: 6px; padding: 3px 6px 3px 0; color: var(--ink-2); min-width: 0; }
.sb-link:hover { text-decoration: none; color: var(--ink); }
.sb-link .n { color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; min-width: 2.2em; font-size: 12px; padding-top: 1px; }
.sb-link .l { min-width: 0; overflow-wrap: anywhere; }
.sb-link.has-page { color: var(--ink); font-weight: 560; }
.sb-link.has-page::after { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 7px 0 0 auto; }
.sb-link.has-page.st-stub::after { background: var(--ink-3); }
.sb-link.has-page.st-cov { font-weight: 450; }
.sb-link.has-page.st-cov::after { background: none; border: 1px solid var(--accent); }
.sb-link.no-page { color: var(--ink-3); }
.sb-link.current { color: var(--accent); }
.sb-row.current { background: var(--accent-bg); }
.sb-hide-empty .sb-tree li.empty { display: none; }
.sb-plain { list-style: none; padding: 0; margin: 0; }
.sb-plain a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--ink); }
.sb-plain a:hover { background: var(--surface-2); text-decoration: none; }
.sb-plain a.current { background: var(--accent-bg); color: var(--accent); }
.sb-empty { color: var(--ink-3); padding: 8px; }

/* ---------- page head ---------- */
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.page-head { margin-bottom: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.page-num { font-family: var(--font-serif); color: var(--accent); font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.page-head h1 {
  font-family: var(--font-serif); font-size: 34px; line-height: 1.3; margin: 4px 0 4px; letter-spacing: .01em; font-weight: 700;
}
.page-en { color: var(--ink-3); font-size: 15px; }
.page-summary { color: var(--ink-2); font-size: 16.5px; margin: 14px 0 0; max-width: 46em; }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.sn-chip {
  font-family: var(--font-mono); font-size: 13px; padding: 2px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.sn-chip:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.status { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.status-done  { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: var(--good-bg); }
.status-draft { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-bg); }
.status-stub  { color: var(--ink-3); border-color: var(--line); background: var(--surface-2); }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; font-size: .74em; font-weight: 650; line-height: 1.5; letter-spacing: .02em;
  padding: 0 .5em; border-radius: 5px; vertical-align: .12em; white-space: nowrap; border: 1px solid;
  font-family: var(--font-sans); cursor: help;
}
.badge.ver { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.tone-bad  { color: var(--bad);  background: var(--bad-bg);  border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.tone-warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.tone-good { color: var(--good); background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.tone-info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, transparent); }

/* ---------- progress ---------- */
.progress { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.progress .bar { width: 90px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- prose ---------- */
.prose { font-size: 16.5px; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4, .children h2, .related h2 {
  font-family: var(--font-serif); line-height: 1.4; position: relative; scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.prose h2, .children h2, .related h2 { font-size: 25px; margin: 2.2em 0 .7em; padding-bottom: .3em; border-bottom: 1px solid var(--line-soft); }
.prose h3 { font-size: 20px; margin: 1.8em 0 .6em; }
.prose h4 { font-size: 17px; margin: 1.5em 0 .5em; color: var(--ink-2); }
.prose .anchor { position: absolute; left: -1em; opacity: 0; color: var(--ink-3); font-weight: 400; padding-right: .3em; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor { opacity: 1; text-decoration: none; }
.prose p, .prose ul, .prose ol, .prose table, .prose dl { margin: 0 0 1.05em; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin: .25em 0; }
.prose li > ul, .prose li > ol { margin: .25em 0; }
.prose strong { font-weight: 680; }
.prose em { font-style: normal; color: var(--accent-2); }
.prose blockquote {
  margin: 1.2em 0; padding: .4em 1.1em; border-left: 3px solid var(--line); color: var(--ink-2);
  font-family: var(--font-serif);
}
.prose :not(pre) > code {
  font-size: .86em; padding: .1em .38em; border-radius: 5px; background: var(--code-bg);
  border: 1px solid var(--line-soft); overflow-wrap: anywhere;
}
.prose hr { border: 0; border-top: 1px dashed var(--line); margin: 2.4em 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
.prose tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.prose dt { font-weight: 650; }
.prose dd { margin: 0 0 .8em 1.4em; }
.prose details { border: 1px solid var(--line); border-radius: var(--radius); padding: .5em 1em; margin: 1em 0; background: var(--surface); }
.prose details > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.prose details[open] > summary { margin-bottom: .6em; }
.prose img { max-width: 100%; }
.prose .footnote { font-size: 14px; color: var(--ink-2); }

/* paragraph markers ¶N */
.para {
  font-family: var(--font-serif); color: var(--accent); font-weight: 700; font-size: .92em;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.para:target { background: var(--accent-bg); border-radius: 4px; padding: 0 .2em; }

/* cross references */
.xref.std { font-family: var(--font-mono); font-size: .88em; white-space: nowrap; }
.xref.std.ext { color: var(--ink-2); border-bottom: 1px dotted var(--ink-3); }
.xref.std.ext:hover { color: var(--link); text-decoration: none; }
.xref.gloss { color: inherit; border-bottom: 1px dashed var(--accent); }
.xref.gloss:hover { text-decoration: none; color: var(--accent); }
.xref.paper { font-family: var(--font-mono); font-size: .88em; }

/* ---------- admonitions ---------- */
.admonition {
  --c: var(--ink-3); --cb: var(--surface-2);
  margin: 1.4em 0; padding: .85em 1.1em .2em; border-radius: var(--radius);
  background: var(--cb); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  border-left: 4px solid var(--c);
}
.admonition > .admonition-title {
  margin: 0 0 .45em; font-weight: 700; font-size: 14px; letter-spacing: .03em; color: var(--c);
  display: flex; align-items: center; gap: .45em;
}
.admonition > .admonition-title::before { font-family: var(--font-serif); font-size: 15px; }
.admonition > p:last-child, .admonition > ul:last-child, .admonition > ol:last-child { margin-bottom: .85em; }
.admonition figure.code { margin: .6em 0 .9em; }
.admonition.std      { --c: var(--accent);  --cb: color-mix(in srgb, var(--accent-bg) 55%, var(--surface)); }
.admonition.std > .admonition-title::before { content: "§"; }
.admonition.std { font-family: var(--font-serif); }
.admonition.std code { font-family: var(--font-mono); }
.admonition.note     { --c: var(--info);   --cb: color-mix(in srgb, var(--info-bg) 55%, var(--surface)); }
.admonition.note > .admonition-title::before { content: "注"; }
.admonition.tip      { --c: var(--good);   --cb: color-mix(in srgb, var(--good-bg) 55%, var(--surface)); }
.admonition.tip > .admonition-title::before { content: "✦"; }
.admonition.warning, .admonition.pitfall { --c: var(--warn); --cb: color-mix(in srgb, var(--warn-bg) 60%, var(--surface)); }
.admonition.warning > .admonition-title::before, .admonition.pitfall > .admonition-title::before { content: "⚠"; }
.admonition.ub       { --c: var(--bad);    --cb: color-mix(in srgb, var(--bad-bg) 60%, var(--surface)); }
.admonition.ub > .admonition-title::before { content: "☠"; }
.admonition.example  { --c: var(--ink-2);  --cb: var(--surface); }
.admonition.example > .admonition-title::before { content: "例"; }
.admonition.history  { --c: #8b6f3e;       --cb: color-mix(in srgb, #8b6f3e 9%, var(--surface)); }
.admonition.history > .admonition-title::before { content: "史"; }
.admonition.impl     { --c: var(--tk-fn);  --cb: color-mix(in srgb, var(--tk-fn) 8%, var(--surface)); }
.admonition.impl > .admonition-title::before { content: "⚙"; }
.admonition.question { --c: var(--info);   --cb: var(--surface); }
.admonition.question > .admonition-title::before { content: "?"; }
.admonition.summary  { --c: var(--good);   --cb: color-mix(in srgb, var(--good-bg) 40%, var(--surface)); }
.admonition.summary > .admonition-title::before { content: "≡"; }
.admonition.lawyer   { --c: var(--accent-2); --cb: color-mix(in srgb, var(--accent-bg) 35%, var(--surface)); border-style: dashed solid dashed solid; }
.admonition.lawyer > .admonition-title::before { content: "⚖"; }

/* ---------- code ---------- */
figure.code {
  margin: 1.2em 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--code-bg); position: relative;
}
figure.code figcaption {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 6px 3px 12px;
  border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-3);
  background: color-mix(in srgb, var(--surface-2) 60%, var(--code-bg));
}
.code-title { font-family: var(--font-mono); color: var(--ink-2); }
.verdict { font-size: 11.5px; font-weight: 700; padding: 0 7px; border-radius: 5px; border: 1px solid; }
.code-tools { margin-left: auto; display: flex; gap: 4px; }
.code-btn {
  font-size: 12px; padding: 1px 8px; border-radius: 6px; border: 1px solid transparent; background: none;
  color: var(--ink-3); font-family: var(--font-sans);
}
.code-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); text-decoration: none; }
figure.code.verdict-error { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
figure.code.verdict-ub, figure.code.verdict-ifndr { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
figure.code.verdict-ok { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
figure.code pre {
  margin: 0; padding: 12px 16px; overflow-x: auto; font-size: 13.6px; line-height: 1.6; color: var(--code-ink);
  tab-size: 4;
}
figure.code code { font-size: inherit; background: none; border: 0; padding: 0; }
/* pygments token classes */
.code .k, .code .kd, .code .kn, .code .kr, .code .kc, .code .ow, .code .kp { color: var(--tk-kw); font-weight: 560; }
.code .kt, .code .nc, .code .nn { color: var(--tk-type); }
.code .s, .code .s1, .code .s2, .code .sc, .code .sa, .code .se, .code .si, .code .sb, .code .sd, .code .sx { color: var(--tk-str); }
.code .m, .code .mi, .code .mf, .code .mh, .code .mo, .code .mb, .code .il { color: var(--tk-num); }
.code .c, .code .c1, .code .cm, .code .cs { color: var(--tk-com); font-style: italic; }
.code .cp, .code .cpf { color: var(--tk-pre); }
.code .nf, .code .fm { color: var(--tk-fn); }
.code .nl, .code .na { color: var(--tk-pre); }
.code .o, .code .p { color: var(--code-ink); }
.code .err { color: inherit; border: 0; }
.code .c-err { color: var(--warn); font-style: normal; font-weight: 600; }
.code .c-ub  { color: var(--bad);  font-style: normal; font-weight: 600; }
.code .c-ok  { color: var(--good); font-style: normal; font-weight: 600; }

/* ---------- page toc ---------- */
.page-toc {
  position: sticky; top: calc(var(--topbar-h) + 28px); align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 56px); overflow-y: auto;
  font-size: 13px; line-height: 1.5; border-left: 1px solid var(--line); padding-left: 14px;
}
.page-toc-title { font-size: 11.5px; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 8px; }
.page-toc ul { list-style: none; margin: 0; padding: 0; }
.page-toc ul ul { padding-left: 12px; }
.page-toc a { display: block; padding: 3px 0; color: var(--ink-3); }
.page-toc a:hover { color: var(--ink); text-decoration: none; }
.page-toc a.active { color: var(--accent); }

/* ---------- children / related / pager ---------- */
.sec-tree ul { list-style: none; margin: 0; padding: 0; }
.sec-tree ul ul { padding-left: 22px; border-left: 1px solid var(--line-soft); margin-left: 10px; }
.sec { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--ink); }
.sec:hover { background: var(--surface-2); text-decoration: none; }
.sec .num { color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 3.2em; font-size: 14px; }
.sec .t { flex: 1; min-width: 0; }
.sec .zh { color: var(--ink-3); margin-left: 6px; font-size: 14px; }
.sec .sn { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.sec.no-page { color: var(--ink-3); }
.sec.no-page .ext-mark { font-size: 12px; }
.sec.has-page .t { font-weight: 600; }
.related ul { padding-left: 1.3em; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 56px 0 24px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager-next { text-align: right; }
.pager-label { font-size: 12.5px; color: var(--ink-3); }
.pager-title { font-weight: 600; }
.pager .sn { font-family: var(--font-mono); font-weight: 400; font-size: 12px; color: var(--ink-3); }
.page-foot { font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- index pages ---------- */
.clause-group h2 { font-family: var(--font-serif); font-size: 24px; margin: 1.6em 0 .8em; }
.clause-group h2 small { font-family: var(--font-sans); font-size: 13px; color: var(--ink-3); font-weight: 400; margin-left: 8px; }
.clause-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.clause-card {
  display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: baseline;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.clause-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.clause-card .num { grid-row: span 3; font-family: var(--font-serif); font-size: 26px; font-weight: 700; color: var(--accent); min-width: 1.4em; text-align: center; }
.clause-card .t { font-weight: 650; font-size: 16.5px; }
.clause-card .en { font-size: 13px; color: var(--ink-3); }
.clause-card .sn { font-family: var(--font-mono); font-size: 12px; }
.clause-card .progress { margin-top: 6px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.topic-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.topic-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.topic-card .t { font-family: var(--font-serif); font-weight: 700; font-size: 18.5px; }
.topic-card .s { color: var(--ink-2); font-size: 14.5px; flex: 1; }
.topic-card .m { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { color: var(--ink-3); }

/* ---------- glossary ---------- */
.gloss-filter { width: 100%; max-width: 360px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.glossary { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
.term { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.term:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.term dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.term dt .en { font-weight: 700; font-size: 16.5px; }
.term dt .zh { color: var(--accent); font-weight: 600; }
.term dt .xref { margin-left: auto; }
.term dd { margin: 0; font-size: 15px; color: var(--ink-2); }
.term dd p { margin: 0 0 .5em; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 40px 0 30px; }
.hero-mark {
  font-family: var(--font-serif); font-weight: 700; font-size: 44px; color: var(--surface); background: var(--accent);
  width: 72px; height: 72px; border-radius: 16px; display: inline-grid; place-items: center; margin-bottom: 14px;
}
.hero h1 { font-family: var(--font-serif); font-size: 46px; margin: 0; letter-spacing: .06em; }
.hero-en { color: var(--ink-3); margin: 4px 0 18px; letter-spacing: .08em; }
.hero-lede { max-width: 640px; margin: 0 auto 26px; font-size: 17.5px; color: var(--ink-2); }
.hero-search { margin: 0 auto; min-width: 0; width: min(560px, 100%); padding: 12px 14px 12px 18px; font-size: 15px; box-shadow: var(--shadow); }
.hero-search code { font-size: 13px; color: var(--accent); }
.hero-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px 40px; margin-top: 34px; }
.hero-stats div { display: flex; flex-direction: column; align-items: center; }
.hero-stats b { font-family: var(--font-serif); font-size: 30px; color: var(--ink); }
.hero-stats span { font-size: 13px; color: var(--ink-3); }
.home-intro { max-width: 820px; margin: 20px auto 0; }
.home-cov { max-width: 820px; margin: 0 auto; }
.home-cov h2 { font-family: var(--font-serif); font-size: 25px; border-bottom: 1px solid var(--line-soft); padding-bottom: .3em; }
.cov-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; }
.cov-row { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 8px; color: var(--ink); }
.cov-row:hover { background: var(--surface-2); text-decoration: none; }
.cov-row .num { font-family: var(--font-serif); color: var(--accent); font-weight: 700; min-width: 1.6em; }
.cov-row .t { flex: 1; }
.more { text-align: right; }

/* ---------- search ---------- */
.search-modal { position: fixed; inset: 0; z-index: 50; background: rgba(20,16,10,.38); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.search-panel { width: min(680px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; max-height: 75vh; }
.search-input { border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font: inherit; font-size: 17px; background: none; color: var(--ink); outline: none; }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results li a { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 9px 12px; border-radius: 9px; color: var(--ink); }
.search-results li a:hover { text-decoration: none; }
.search-results li.sel a { background: var(--accent-bg); }
.search-results .r-t { font-weight: 600; }
.search-results .r-t .r-num { color: var(--ink-3); font-weight: 400; margin-right: 6px; }
.search-results .r-k { font-size: 11.5px; color: var(--ink-3); align-self: center; grid-row: span 2; text-align: right; }
.search-results .r-x { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .r-s { font-family: var(--font-mono); font-size: 12px; color: var(--accent); margin-left: 6px; font-weight: 400; }
.search-results .ext .r-t { font-weight: 400; color: var(--ink-2); }
.search-results mark { background: none; color: var(--accent); }
.search-empty { padding: 18px; color: var(--ink-3); text-align: center; }
.search-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }

/* ---------- tooltip ---------- */
.tip {
  position: fixed; z-index: 60; max-width: 360px; padding: 8px 11px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.5; pointer-events: none;
  box-shadow: var(--shadow);
}

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .main { grid-template-columns: minmax(0, 780px); padding: 30px 36px 70px; }
  .page-toc { display: none; }
  .brand-sub { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-grid; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto; width: min(340px, 88vw); z-index: 40;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  .topnav { display: none; }
  .search-btn { min-width: 0; }
  .search-btn span { display: none; }
  .search-btn.hero-search span { display: inline; }
  .main { padding: 24px 16px 60px; }
  .page-head h1 { font-size: 27px; }
  .glossary, .cov-list { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 34px; }
  .prose .anchor { display: none; }
}
@media (max-width: 520px) {
  .pager { grid-template-columns: 1fr; }
  .clause-grid, .topic-grid { grid-template-columns: minmax(0, 1fr); }
  .search-btn kbd { display: none; }
}

/* =========================================================================
   Reading design v2: quieter text, margin ¶ numbers, cards for key points,
   standard quotes and comparisons. Overrides the rules above.
   ========================================================================= */
.main { grid-template-columns: minmax(0, 740px) 210px; gap: 64px; padding-top: 44px; }
.page-head { border-bottom: 0; margin-bottom: 36px; padding-bottom: 0; }
.page-head h1 { font-size: 38px; margin-top: 6px; }
.page-summary { font-size: 17.5px; line-height: 1.8; color: var(--ink-2); }

.prose { font-size: 17px; line-height: 1.9; letter-spacing: .01em; }
.prose p, .prose ul, .prose ol, .prose dl { margin-bottom: 1.15em; }
.prose h2, .children h2, .related h2 {
  font-size: 26px; margin: 2.6em 0 .9em; padding: 0 0 0 .7em; border: 0;
  border-left: 4px solid var(--accent); line-height: 1.35;
}
.prose h3 { font-size: 20.5px; margin: 2em 0 .7em; }
.prose h3::before { content: ""; display: inline-block; width: .45em; height: .45em; background: var(--accent); border-radius: 2px; margin-right: .55em; vertical-align: .18em; opacity: .75; }
.prose strong { font-weight: 650; color: var(--ink); }
.prose :not(pre) > code { font-size: .84em; padding: .08em .35em; border: 0; background: var(--surface-2); color: var(--ink); }

/* paragraph numbers live in the left margin (like the printed standard) */
.prose p, .prose li, .prose dd { position: relative; }
.prose > p > .para:first-child, .prose > ul > li > .para:first-child, .prose > ol > li > .para:first-child {
  position: absolute; left: -3.4em; top: .32em; width: 2.8em; text-align: right;
  font-size: 12.5px; line-height: 1.4; font-weight: 600; color: var(--ink-3); font-family: var(--font-sans);
}
.prose > ul > li > .para:first-child, .prose > ol > li > .para:first-child { left: -4.9em; }
.prose > p > .para:first-child:target, .prose li > .para:first-child:target { color: var(--accent); background: none; }
.prose .para { color: var(--ink-3); font-size: .78em; font-weight: 600; }

/* links to clauses: small pills instead of monospace runs */
.xref.std { font-family: var(--font-sans); font-size: .8em; white-space: nowrap; padding: .05em .45em; border-radius: 5px;
  background: color-mix(in srgb, var(--link) 9%, transparent); color: var(--link); border: 0; vertical-align: .05em; }
.xref.std.ext { background: var(--surface-2); color: var(--ink-2); border: 0; }
.xref.std:hover { text-decoration: none; background: color-mix(in srgb, var(--link) 18%, transparent); }
.xref.paper { font-family: var(--font-sans); font-size: .85em; }

/* key points card */
.admonition.tldr { --c: var(--accent); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-left-width: 1px; border-radius: 12px; padding: 1.1em 1.4em .4em; box-shadow: var(--shadow); margin: 0 0 2.4em; font-family: var(--font-sans); }
.admonition.tldr > .admonition-title { font-size: 13px; letter-spacing: .12em; }
.admonition.tldr > .admonition-title::before { content: "◆"; font-size: 10px; }
.admonition.tldr ul { margin-bottom: .7em; padding-left: 1.2em; }
.admonition.tldr li { margin: .35em 0; }

/* standard text: quiet quotation card */
.admonition.std { font-family: var(--font-sans); background: transparent; border: 0; border-left: 2px solid var(--line);
  border-radius: 0; padding: .1em 0 .1em 1.1em; color: var(--ink-2); font-size: .94em; }
.admonition.std > .admonition-title { font-size: 11.5px; letter-spacing: .14em; color: var(--ink-3); margin-bottom: .2em; }
.admonition.std > .admonition-title::before { content: none; }
.admonition.std em { color: var(--ink-2); }

/* all other callouts: lighter cards */
.admonition { border-left-width: 3px; border-radius: 10px; box-shadow: none; }

/* side-by-side code comparison: <div class="compare" markdown="1"> two code blocks </div> */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 1.4em 0; }
.compare > figure.code { margin: 0; }
@media (max-width: 900px) { .compare { grid-template-columns: 1fr; } }

/* fine print: <details class="fine" markdown="1"><summary>…</summary> … </details> */
.prose details.fine { background: transparent; border: 0; border-top: 1px dashed var(--line); border-radius: 0; padding: .8em 0 0; color: var(--ink-2); font-size: .95em; }
.prose details.fine > summary { font-weight: 500; color: var(--ink-3); font-size: .9em; list-style: none; }
.prose details.fine > summary::before { content: "▸ "; }
.prose details.fine[open] > summary::before { content: "▾ "; }

/* definition lists as term cards */
.prose dl { display: grid; gap: 10px; }
.prose dl > dt { font-weight: 650; margin-top: .4em; }
.prose dl > dd { margin: 0 0 0 0; padding: .6em .9em; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; }

/* tables */
.prose table { border-radius: 10px; border: 1px solid var(--line); }
.prose th, .prose td { border: 0; border-bottom: 1px solid var(--line-soft); }
.prose th { background: var(--surface-2); font-size: 13.5px; letter-spacing: .02em; }
.prose tr:nth-child(even) td { background: transparent; }

/* page toc: quieter */
.page-toc { border-left: 0; font-size: 12.5px; }
.page-toc a.active { font-weight: 600; }

@media (max-width: 1240px) {
  .main { grid-template-columns: minmax(0, 740px); }
}
@media (max-width: 900px) {
  .prose > p > .para:first-child, .prose > ul > li > .para:first-child, .prose > ol > li > .para:first-child {
    position: static; display: inline; margin-right: .3em; }
}
.main { padding-left: 96px; }
@media (max-width: 1240px) { .main { padding-left: 84px; } }
@media (max-width: 900px) { .main { padding-left: 16px; } }

/* =========================================================================
   Code design v3: web mono font, card-style blocks with a language chip,
   tinted verdict pills, line numbers and a verdict stripe; warm inline code.
   ========================================================================= */
code, kbd, pre { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; } /* `!=`, `->`, `<=>` stay literal */

.prose :not(pre) > code {
  font-size: .84em; font-weight: 500; padding: .12em .42em; border-radius: 5px;
  background: var(--ic-bg); color: var(--ic-ink); box-shadow: inset 0 0 0 1px var(--ic-ring); border: 0;
}
.prose h2 code, .prose h3 code, .prose h4 code { color: inherit; background: var(--ic-bg); font-weight: 600; }
.prose a code { color: var(--link); }
.admonition.tldr :not(pre) > code, .admonition.std :not(pre) > code { background: var(--surface-2); color: var(--ink); box-shadow: none; }

figure.code {
  --vc: transparent;
  margin: 1.4em 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--code-bg); box-shadow: 0 1px 2px rgba(40,30,10,.04), 0 4px 16px rgba(40,30,10,.05);
  position: relative;
}
figure.code::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--vc); }
figure.code.verdict-ok { --vc: var(--good); border-color: var(--line); }
figure.code.verdict-error, figure.code.verdict-eb { --vc: var(--warn); border-color: var(--line); }
figure.code.verdict-ub, figure.code.verdict-ifndr { --vc: var(--bad); border-color: var(--line); }
figure.code.verdict-unspecified, figure.code.verdict-impl { --vc: var(--info); border-color: var(--line); }

figure.code figcaption {
  min-height: 36px; padding: 4px 8px 4px 14px; gap: 10px; background: var(--code-head);
  border-bottom: 1px solid var(--line-soft); font-size: 12.5px;
}
.code-lang {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, var(--ink-3) 12%, transparent);
}
.code-title { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.verdict { font-family: var(--font-sans); font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; border: 1px solid; letter-spacing: .02em; }
.code-tools { opacity: .55; transition: opacity .15s; }
figure.code:hover .code-tools, .code-tools:focus-within { opacity: 1; }
.code-btn { font-size: 11.5px; padding: 2px 9px; border-radius: 6px; }

figure.code pre {
  padding: 14px 18px 15px 16px; font-size: 13.4px; line-height: 1.7; counter-reset: line;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
figure.code.numbered pre { padding-left: 0; }
figure.code .ln::before {
  counter-increment: line; content: counter(line);
  display: inline-block; width: 3.1em; padding-right: 1.1em; margin-right: .2em; text-align: right;
  color: var(--code-gutter); font-size: .86em; user-select: none; -webkit-user-select: none;
}
figure.code pre code { font-weight: 400; }

/* pygments tokens */
.code .k, .code .kd, .code .kn, .code .kr, .code .kc, .code .ow, .code .kp { color: var(--tk-kw); font-weight: 600; }
.code .kt, .code .nc, .code .nn, .code .nb, .code .bp { color: var(--tk-type); }
.code .nf, .code .fm, .code .nx { color: var(--tk-fn); }
.code .s, .code .s1, .code .s2, .code .sc, .code .sa, .code .se, .code .si, .code .sb, .code .sd, .code .sx { color: var(--tk-str); }
.code .m, .code .mi, .code .mf, .code .mh, .code .mo, .code .mb, .code .il { color: var(--tk-num); }
.code .cp, .code .cpf { color: var(--tk-pre); font-style: normal; }
.code .c, .code .c1, .code .cm, .code .cs { color: var(--tk-com); font-style: italic; }
.code .o, .code .p { color: var(--tk-op); }
.code .nl, .code .na, .code .nd { color: var(--tk-pre); }
.code .c-err, .code .c-ub, .code .c-ok { font-style: normal; font-weight: 650; }

.compare > figure.code { margin: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) figure.code { box-shadow: none; } }
:root[data-theme="dark"] figure.code { box-shadow: none; }
figure.code figcaption > * { white-space: nowrap; flex-shrink: 0; }
figure.code figcaption > .code-title { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.compare .code-lang { display: none; }
.compare figure.code figcaption { padding-left: 12px; gap: 8px; }

/* sidebar legend: filled dot = own page, hollow = explained on the parent clause's page */
.sb-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 0 6px 10px; font-size: 11.5px; color: var(--ink-3); }
.sb-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sb-legend .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.sb-legend .dot.hollow { background: none; border: 1px solid var(--accent); }
/* anchors placed before headings of covered subclauses */
.sec-anchor { display: block; height: 0; scroll-margin-top: calc(var(--topbar-h) + 16px); }

/* collection index groups, sidebar group headers, exercises page */
.coll-group { font-family: var(--font-serif); font-size: 22px; margin: 1.8em 0 .7em; padding-left: .6em; border-left: 4px solid var(--accent); }
.coll-group:first-of-type { margin-top: .4em; }
.sb-plain li.sb-group { margin: 12px 6px 4px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; color: var(--ink-3); }
.exercises h2 small { font-family: var(--font-sans); font-size: 13px; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.exercises .ex-page { margin: 1.2em 0 1.8em; }
.exercises .ex-page h3 { font-size: 17px; margin: 0 0 .4em; }
.exercises .ex-page h3::before { display: none; }
.topnav a { padding: 6px 8px; font-size: 14px; white-space: nowrap; }
@media (max-width: 1280px) { .brand-sub { display: none; } }

/* exams: quiz cards, answer buttons, sticky score bar */
.quiz-bar {
  position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 8px 14px; margin: 0 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); font-size: 14px; color: var(--ink-2);
}
.quiz-bar b { color: var(--ink); }
.quiz-bar .qb-final { color: var(--accent); font-weight: 650; }
.quiz-bar .qb-reset { margin-left: auto; font-size: 12.5px; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.prose .quiz { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1em 1.2em .6em; margin: 1.4em 0; background: var(--surface); scroll-margin-top: calc(var(--topbar-h) + 64px); }
.prose .quiz.right { border-left: 4px solid var(--good); }
.prose .quiz.wrong { border-left: 4px solid var(--bad); }
.quiz-num { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--accent); margin-bottom: .3em; }
.quiz-opts { display: flex; flex-wrap: wrap; gap: 8px; margin: .9em 0 .5em; }
.quiz-opt {
  font: inherit; font-size: 13.5px; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-bg); }
.quiz-opt:disabled { cursor: default; opacity: .55; }
.quiz-opt.is-answer { opacity: 1; border-color: var(--good); background: var(--good-bg); color: var(--good); font-weight: 650; }
.quiz-opt.is-wrong { opacity: 1; border-color: var(--bad); background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.quiz-self { font-size: 13px; font-weight: 650; padding: 4px 12px; border-radius: 999px; }
.quiz-self.ok { color: var(--good); background: var(--good-bg); }
.quiz-self.no { color: var(--bad); background: var(--bad-bg); }
.prose .quiz details.quiz-key { margin: .6em 0 .5em; background: var(--bg); }
.prose .quiz details.quiz-key > summary { font-size: 14px; }

/* ---------------- embedded video ---------------- */
.video { margin: 0 0 34px; }
.video-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.video-tabs button {
  font: inherit; font-size: 14px; padding: 5px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.video-tabs button:hover { background: var(--surface-2); color: var(--ink); }
.video-tabs button[aria-selected="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }

/* ---------------- bilingual: language switch, "also in English" banner, links into the Chinese edition ---------------- */
.lang-switch {
  font-size: 13px; font-weight: 600; letter-spacing: .03em; color: var(--ink-2); white-space: nowrap;
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px;
}
.lang-switch:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }
.lang-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 22px; padding: 10px 14px;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-bg); color: var(--ink); font-size: 14.5px;
}
.lang-banner[hidden] { display: none; }
.lang-banner a { font-weight: 650; color: var(--accent); }
.lang-banner-close { margin-left: auto; border: 0; background: none; font-size: 18px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.xref.zh-only::after { content: "中"; font-size: .62em; vertical-align: super; margin-left: 2px; color: var(--ink-3); }
/* English edition, after anthropic.com: a sans for headings and interface, a serif for running text.
   Instrument Sans and Source Serif 4 stand in for the proprietary Anthropic Sans / Anthropic Serif. */
html[lang="en"] {
  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  --font-serif: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;  /* headings, brand, cards */
  --font-text: "Source Serif 4", Georgia, "Source Han Serif SC", serif;                         /* running text */
}
html[lang="en"] .prose { font-family: var(--font-text); font-size: 18px; line-height: 1.6; letter-spacing: 0; }
html[lang="en"] .prose h1, html[lang="en"] .prose h2, html[lang="en"] .prose h3, html[lang="en"] .prose h4 { font-family: var(--font-serif); letter-spacing: -.01em; }
html[lang="en"] .prose table, html[lang="en"] .prose details > summary { font-family: var(--font-sans); font-size: .9em; }
html[lang="en"] .prose .admonition { font-family: var(--font-sans); font-size: .95em; line-height: 1.7; }
html[lang="en"] .prose .admonition.tldr { padding: 1.2em 1.6em .5em; }
html[lang="en"] .prose .admonition.tldr li { margin: .65em 0; }
html[lang="en"] .prose .admonition li { margin: .4em 0; }
/* the Chinese edition marks these titles with a character; use symbols in English */
html[lang="en"] .admonition.note > .admonition-title::before { content: "✎"; }
html[lang="en"] .admonition.example > .admonition-title::before { content: "▸"; }
html[lang="en"] .admonition.history > .admonition-title::before { content: "↺"; }
html[lang="en"] .prose .admonition.std { font-family: var(--font-text); }
html[lang="en"] .page-summary, html[lang="en"] .hero-lede, html[lang="en"] .glossary dd { font-family: var(--font-text); line-height: 1.55; }
html[lang="en"] .hero h1, html[lang="en"] .page-head h1 { letter-spacing: -.015em; font-weight: 650; }
html[lang="en"] .brand-name { letter-spacing: -.005em; }
