:root {
  --bg: #f7f6f2; --surface: #ffffff; --surface-2: #f1efe9; --text: #1d1f23; --muted: #62666e;
  --line: #e4e1d8; --accent: #c2410c; --accent-soft: #fdebdd; --link: #9a3412;
  --hl: rgba(250, 204, 21, .38); --hl-hover: rgba(250, 204, 21, .7); --hl-line: #ca8a04;
  --shadow: 0 1px 2px rgba(20,20,20,.04), 0 6px 24px rgba(20,20,20,.06);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
          "Source Han Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a; --surface: #1c1f24; --surface-2: #23272e; --text: #e8e6e1; --muted: #a0a4ab;
    --line: #2e333b; --accent: #fb923c; --accent-soft: #3a2416; --link: #fdba74;
    --hl: rgba(234, 179, 8, .28); --hl-hover: rgba(234, 179, 8, .5); --hl-line: #eab308;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.85 var(--font);
  letter-spacing: .01em; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: .08em .4em; word-break: break-all; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 50; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

/* hero */
.hero { padding: 48px 20px 36px; border-bottom: 1px solid var(--line);
  background: radial-gradient(1200px 400px at 10% -10%, var(--accent-soft), transparent 70%); }
.hero-inner { max-width: 1120px; margin: 0 auto; }
.eyebrow { margin: 0 0 10px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.hero h1 { margin: 0 0 16px; font-size: clamp(32px, 5vw, 52px); line-height: 1.2; letter-spacing: -.01em; font-weight: 800; }
.lead { margin: 0; max-width: 46em; font-size: 18px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 22px 0 0; padding: 0; }
.chips li { font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }

/* layout */
.layout { max-width: 1120px; margin: 0 auto; padding: 32px 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.toc { display: none; }
@media (min-width: 1080px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: block; position: sticky; top: 28px; align-self: start; max-height: calc(100vh - 56px); overflow: auto; font-size: 14px; }
}
.toc-title { margin: 0 0 8px; font-size: 12px; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li a { display: flex; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--muted); text-decoration: none; line-height: 1.5; }
.toc li a:hover { background: var(--surface); color: var(--text); }
.toc li a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.toc-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); margin-top: 1px; }
.toc li a.active .toc-n { background: var(--accent); color: #fff; }
.toc-comments { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 10px; border-top: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }

/* cards */
.doc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 30px 24px; }
@media (max-width: 640px) { .card { padding: 22px 18px 18px; border-radius: 14px; } body { font-size: 16px; } .hero { padding-top: 32px; } }
.card h2 { display: flex; align-items: flex-start; gap: 14px; margin: 0 0 18px; font-size: clamp(20px, 2.6vw, 25px); line-height: 1.4; font-weight: 750; }
.badge { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 18px; font-weight: 800; margin-top: -2px; }
.h-num { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card p { margin: 0 0 14px; }
.card blockquote { margin: 0 0 14px; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 12px 12px 0; }
.card blockquote p { margin: 0; }
.card blockquote + blockquote { margin-top: -4px; }
.card p.meta { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--muted); }

/* tables */
.table-wrap { margin: 18px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.65; }
.table-wrap.wide table { min-width: 620px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-size: 13px; letter-spacing: .04em; color: var(--muted); font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
td.k { font-weight: 600; }
.wide td.k { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 800; border-top: 2px solid var(--line); }

/* highlights */
mark.hl { background: var(--hl); color: inherit; border-bottom: 2px solid var(--hl-line); border-radius: 2px; cursor: pointer; padding: 0 1px; transition: background .15s; }
mark.hl:hover, mark.hl:focus, mark.hl.active { background: var(--hl-hover); outline: none; }
mark.hl.flash { animation: flash 1.2s ease 2; }
@keyframes flash { 50% { background: var(--accent); color: #fff; } }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.sel-btn { position: absolute; z-index: 40; transform: translate(-50%, 8px); border: 0; border-radius: 999px; padding: 6px 14px; font: 600 14px/1.4 var(--font);
  background: var(--text); color: var(--bg); box-shadow: 0 6px 20px rgba(0,0,0,.25); cursor: pointer; }
.sel-btn::before { content: "💬 "; }

/* comments list */
.comments { margin-top: 40px; padding-top: 8px; }
.comments h2 { display: flex; align-items: center; gap: 10px; font-size: 24px; margin: 0 0 8px; }
.hint { margin: 0; color: var(--muted); font-size: 15px; }
.empty { color: var(--muted); font-size: 15px; }
.thread-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 14px; }
.thread-item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; cursor: pointer; }
.thread-item:hover { border-color: var(--accent); }
.ti-where { font-size: 12px; color: var(--accent); font-weight: 700; letter-spacing: .04em; margin-bottom: 6px; }
.ti-quote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--hl-line); color: var(--muted); font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ti-orphan { font-size: 12px; color: var(--muted); }

/* buttons */
.btn { border: 0; border-radius: 10px; padding: 9px 18px; font: 600 15px/1.4 var(--font); background: var(--accent); color: #fff; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); margin-top: 14px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* panel */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 60; }
.panel { position: fixed; z-index: 61; background: var(--surface); color: var(--text); box-shadow: 0 10px 50px rgba(0,0,0,.3); display: flex; flex-direction: column;
  right: 0; top: 0; bottom: 0; width: min(440px, 100vw); border-left: 1px solid var(--line); }
@media (max-width: 640px) { .panel { top: auto; left: 0; width: 100%; max-height: 86vh; border-radius: 18px 18px 0 0; border-left: 0; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 18px; }
.panel-body { padding: 16px 18px 22px; overflow: auto; }
.panel-quote { margin: 0 0 16px; padding: 10px 14px; border-left: 4px solid var(--hl-line); background: var(--hl); border-radius: 0 10px 10px 0; font-size: 15px; white-space: pre-wrap; max-height: 9em; overflow: auto; }
.thread { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.thread:empty { display: none; }
.cmt { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.cmt.reply { margin-left: 18px; }
.cmt-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; }
.cmt-nick { font-weight: 700; color: var(--text); }
.cmt-body { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.7; }
.composer { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field textarea { font: 15px/1.6 var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 100%; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
.form-foot { display: flex; align-items: center; justify-content: space-between; }
.counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.form-msg { margin: 0; font-size: 14px; color: var(--muted); min-height: 1em; }
.form-msg.err { color: #dc2626; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: 14px; z-index: 70; box-shadow: var(--shadow); }

.foot { max-width: 1120px; margin: 0 auto; padding: 24px 20px 56px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.foot p { margin: 0 0 4px; }

@media print { .topnav, .more, .toc, .sel-btn, .comments, .panel, .progress, .scrim { display: none !important; } .card { box-shadow: none; break-inside: avoid; } }

/* ---------- v2: CJK typography ---------- */
body { line-break: strict; overflow-wrap: break-word; text-autospace: normal; text-spacing-trim: normal; hanging-punctuation: allow-end; }
strong { font-weight: 750; }
.card strong { color: var(--text); background: linear-gradient(transparent 62%, var(--accent-soft) 62%); }
.unpub { border-bottom: 1px dotted var(--muted); cursor: help; }

/* ---------- top nav ---------- */
.topnav { position: sticky; top: 0; z-index: 45; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topnav-inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 52px; display: flex; align-items: center; gap: 18px; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: .02em; color: var(--text); text-decoration: none; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.topnav-links { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a { white-space: nowrap; padding: 6px 12px; border-radius: 999px; font-size: 14px; color: var(--muted); text-decoration: none; }
.topnav-links a:hover { color: var(--text); background: var(--surface); }
.topnav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
html { scroll-padding-top: 72px; }
@media (min-width: 1080px) { .toc { top: 80px; max-height: calc(100vh - 108px); } }
.progress { z-index: 46; }

/* ---------- ordered lists ---------- */
.card ol.steps { margin: 0 0 14px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.card ol.steps[start="4"] { counter-reset: step 3; }
.card ol.steps > li { counter-increment: step; position: relative; padding: 12px 16px 12px 52px; background: var(--surface-2); border-radius: 12px; }
.card ol.steps > li::before { content: counter(step); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; line-height: 1; }
.card ol.steps > li strong { background: none; color: var(--accent); }

/* ---------- figures ---------- */
.fig { margin: 18px 0; }
.fig a { display: block; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.fig img { display: block; width: 100%; height: auto; }
.fig figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- tables v2 ---------- */
.table-wrap { background: var(--surface); }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
td { overflow-wrap: break-word; }
td.num { white-space: nowrap; }
.table-wrap.xwide table { min-width: 760px; }
.table-wrap.stack td.k { white-space: normal; min-width: 7em; }
@media (max-width: 720px) {
  /* 4+ columns: one card per row, header shown as a label */
  .table-wrap.stack { border: 0; background: transparent; overflow: visible; }
  .table-wrap.stack table, .table-wrap.stack tbody, .table-wrap.stack tr, .table-wrap.stack td { display: block; min-width: 0 !important; width: 100%; }
  .table-wrap.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap.stack tbody { display: grid; gap: 10px; }
  .table-wrap.stack tr { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
  .table-wrap.stack tbody tr:nth-child(even) td { background: transparent; }
  .table-wrap.stack td { display: grid; grid-template-columns: minmax(5.5em, 34%) 1fr; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: normal; }
  .table-wrap.stack td:last-child { border-bottom: 0; }
  .table-wrap.stack td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; line-height: 1.9; }
  .table-wrap.stack td.k { background: var(--surface-2) !important; font-size: 15px; }
  .table-wrap.stack td.num { font-variant-numeric: tabular-nums; }
  .table-wrap:not(.stack) th, .table-wrap:not(.stack) td { padding: 8px 10px; }
  table { font-size: 14px; }
}

/* ---------- more pages ---------- */
.more { margin-top: 28px; }
.more ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.more-card { display: grid; gap: 4px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.more-card:hover { border-color: var(--accent); color: var(--text); }
.more-k { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .06em; }
.more-t { font-weight: 700; line-height: 1.5; }

/* ---------- index page ---------- */
.idx { max-width: 1120px; margin: 0 auto; padding: 32px 20px 48px; }
.idx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.idx-card { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 26px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.idx-card:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .idx-card:hover { transform: none; } }
.idx-k { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--accent); }
.idx-t { font-size: clamp(21px, 2.6vw, 26px); font-weight: 800; line-height: 1.35; }
.idx-lead { color: var(--muted); font-size: 15px; line-height: 1.75; }
.idx-lead a { pointer-events: none; color: inherit; text-decoration: none; }
.idx-secs { margin: 4px 0 0; padding-left: 1.4em; font-size: 14px; color: var(--muted); line-height: 1.8; }
.idx-go { margin-top: auto; padding-top: 8px; font-weight: 700; color: var(--accent); }
@media (max-width: 640px) { .idx-card { padding: 20px 18px; } }

/* ---------- v3: components (::: directives) ---------- */
.card ul { margin: 0 0 14px; padding-left: 1.4em; }
.card h3 { font-size: 18px; margin: 18px 0 8px; line-height: 1.5; }
.card .fig figcaption p { margin: 0; }
sup.cite { font-size: .72em; line-height: 0; margin: 0 1px; }
sup.cite a { text-decoration: none; font-weight: 700; }
.references { margin: 0; padding-left: 1.6em; font-size: 15px; }
.references li { margin-bottom: 6px; }
.references li:target { background: var(--accent-soft); border-radius: 6px; }

/* callouts */
.callout { margin: 0 0 14px; padding: 12px 16px 12px 18px; border-radius: 12px; border: 1px solid var(--line); border-left-width: 4px; background: var(--surface-2); }
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title { margin: 0 0 4px; font-size: 13px; font-weight: 800; letter-spacing: .06em; }
.callout-note { border-left-color: #2563eb; } .callout-note .callout-title { color: #2563eb; }
.callout-tip { border-left-color: #16a34a; } .callout-tip .callout-title { color: #16a34a; }
.callout-warning { border-left-color: #d97706; background: color-mix(in srgb, #f59e0b 10%, var(--surface)); } .callout-warning .callout-title { color: #b45309; }
@media (prefers-color-scheme: dark) {
  .callout-note .callout-title { color: #60a5fa; } .callout-tip .callout-title { color: #4ade80; } .callout-warning .callout-title { color: #fbbf24; }
}

/* side notes: inline [text]{.aside} and block ::: aside */
.aside, .sidenote { font-size: 14px; line-height: 1.7; color: var(--muted); }
.aside { display: block; margin: 6px 0; padding: 6px 12px; border-left: 2px solid var(--line); }
.sidenote { margin: 0 0 14px; padding: 8px 14px; border-left: 2px solid var(--line); }
.sidenote > :last-child { margin-bottom: 0; }
@media (min-width: 1240px) {
  .aside { float: right; clear: right; width: 34%; margin: 2px 0 10px 18px; }
}

/* compare / columns */
.compare, .columns { display: grid; gap: 14px; margin: 0 0 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.compare .col, .columns .col { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.compare .col > h3, .columns .col > h3 { margin: 0 0 6px; font-size: 16px; }
.compare .col > :last-child, .columns .col > :last-child { margin-bottom: 0; }
.compare.n2 .col:first-child { border-top: 3px solid var(--muted); }
.compare.n2 .col:last-child { border-top: 3px solid var(--accent); }
.columns .col { background: transparent; }

/* tabs (no JS: all panels shown with their titles) */
.tabs { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tab-list { display: none; }
.tab-panel { padding: 14px 16px; }
.tab-panel + .tab-panel { border-top: 1px solid var(--line); }
.tab-panel > :last-child { margin-bottom: 0; }
.tabs.js .tab-list { display: flex; gap: 2px; overflow-x: auto; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 4px 4px 0; }
.tabs.js .tab-list button { border: 0; background: transparent; padding: 8px 14px; font: 600 14px/1.4 var(--font); color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap; }
.tabs.js .tab-list button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs.js .tab-panel + .tab-panel { border-top: 0; }
.tabs.js .tab-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tab-h { margin-top: 0; }

/* details */
.details { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; background: var(--surface); }
.details summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.details[open] summary { margin-bottom: 8px; }
.details > :last-child { margin-bottom: 0; }

/* video + viz */
.fig.video video { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; background: #000; }
.fig.viz x-viz { display: block; min-height: 160px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.viz-fallback { color: var(--muted); font-size: 14px; }
x-viz svg { display: block; width: 100%; height: auto; overflow: visible; }
x-viz .bar { fill: var(--accent); opacity: .85; }
x-viz .line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
x-viz .dot { fill: var(--accent); }
x-viz text { fill: var(--muted); font: 12px var(--font); }
x-viz .val { fill: var(--text); font-weight: 700; }
x-viz .axis { stroke: var(--line); }

/* ---------- v5: open comments (badges, actions) ---------- */
.role { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .03em; line-height: 18px; }
.role-agent { background: color-mix(in srgb, #2563eb 16%, transparent); color: #2563eb; }
@media (prefers-color-scheme: dark) { .role-agent { color: #93c5fd; } }
.cmt-meta { flex-wrap: wrap; align-items: center; }
.cmt-edited, .cmt-resolved { font-size: 11px; color: var(--muted); }
.cmt-resolved { color: #16a34a; font-weight: 700; }
.cmt-actions { display: flex; gap: 12px; margin-top: 6px; }
.link-btn { border: 0; background: none; padding: 0; font: 600 13px/1.6 var(--font); color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent); }
.link-btn.danger { color: #dc2626; }
.cmt-edit { display: grid; gap: 8px; margin-top: 6px; grid-template-columns: auto auto 1fr; align-items: center; }
.cmt-edit textarea { grid-column: 1 / -1; font: 15px/1.6 var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 100%; resize: vertical; }
.cmt-edit .form-msg { grid-column: 1 / -1; }
mark.hl.resolved { background: color-mix(in srgb, var(--hl) 35%, transparent); border-bottom-style: dashed; }
.thread-item.resolved { opacity: .72; }
.cmt-nick.anon { color: var(--muted); font-weight: 600; }
