/* Xiaobei documentation only. Bain tokens mirror src/ui/styles/tokens.css.
 * Bump the ?v= value in install.html and build-docs.mjs when this file changes. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f5f4;
  --surface-3: #eeecea;
  --border: #d9d5d2;
  --text: #1f1a1a;
  --text-2: #645b5b;
  --text-3: #6f6565;
  --primary: #cb2026;
  --primary-hover: #b21b21;
  --on-primary: #ffffff;
  --accent: #cb2026;
  --accent-soft: #fbe9e9;
  --accent-ink: #9c191e;
  --link: #b21b21;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { margin: 0; color: var(--text); background: var(--bg); font: 16px/1.8 "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; overflow-wrap: anywhere; }
a { color: var(--link); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); }
:where(a, button, summary, [tabindex]):focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
img { max-width: 100%; height: auto; }
button { font: inherit; }
h1, h2, h3, h4 { line-height: 1.35; font-weight: 700; }
h2 { margin: 56px 0 20px; padding-top: 20px; border-top: 2px solid var(--primary); font-size: 26px; letter-spacing: -.5px; }
h3 { margin: 28px 0 12px; font-size: 19px; }
h4 { margin: 22px 0 8px; font-size: 16px; }
code, kbd { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 2px 5px; overflow-wrap: anywhere; }
summary { cursor: pointer; font-weight: 700; min-height: 32px; }
details { padding: 16px 0; border-bottom: 1px solid var(--border); }
details p { margin: 12px 0 0; color: var(--text-2); }
footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px; }

/* Shared masthead: an opaque, ruled editorial header, never glass or pills. */
.topnav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px; padding: 12px max(24px, calc((100% - 1240px) / 2)); background: var(--surface); border-top: 5px solid var(--primary); border-bottom: 1px solid var(--border); }
.topnav a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.topnav a:hover, .topnav a.on { color: var(--primary); border-bottom-color: var(--primary); }
.topnav .brand { justify-content: flex-start; gap: 10px; color: var(--text); font-size: 18px; font-weight: 700; margin-right: 16px; padding-left: 0; }
.topnav .brand img { flex: none; width: 32px; height: 32px; }
.topnav .spacer { flex: 1; }
.topnav .pill { background: var(--primary); color: var(--on-primary); padding-inline: 18px; border: 1px solid var(--primary); }
.topnav .pill:hover { background: var(--primary-hover); color: var(--on-primary); border-color: var(--primary-hover); }

/* Installation guide: measured columns and numbered steps, not floating cards. */
main { max-width: 1120px; margin: 0 auto; padding: 32px 32px 80px; }
main > p:first-child { margin: 0 0 28px; padding-left: 14px; border-left: 3px solid var(--primary); color: var(--text-2); font-size: 13px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; align-items: center; padding: 24px 0 40px; }
.hero h1 { margin: 24px 0 20px; font-size: clamp(30px, 3.8vw, 44px); line-height: 1.25; letter-spacing: -1px; }
.hero .lead { margin: 0 0 28px; color: var(--text-2); font-size: 17px; }
.hero .logo { width: 64px; height: 64px; }
.hero .shot { justify-self: end; width: 280px; border: 1px solid var(--border); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); font-size: 15px; font-weight: 700; text-decoration: none; }
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); }
.tags { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 22px; }
.tag { border-left: 2px solid var(--primary); padding-left: 8px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.card { padding: 24px; margin: 16px 0; border: 1px solid var(--border); border-top: 3px solid var(--text); background: var(--surface); }
.steps { counter-reset: step; padding: 0; margin: 0; list-style: none; }
.steps li { position: relative; padding-left: 44px; margin: 20px 0; }
.steps li::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 0; color: var(--primary); font-size: 19px; font-weight: 700; line-height: 1.5; font-variant-numeric: tabular-nums; }
.path { display: block; padding: 10px 12px; margin: 8px 0; }
.note { padding: 14px 18px; margin: 16px 0; border-left: 3px solid var(--primary); background: var(--surface-2); color: var(--text-2); }
.tabs { display: flex; flex-wrap: wrap; gap: 0; margin: 20px 0 0; border-bottom: 1px solid var(--border); }
.tabs button { min-height: 48px; padding: 10px 22px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--text-2); font-size: 15px; font-weight: 600; cursor: pointer; }
.tabs button:hover { background: var(--surface-2); color: var(--primary); }
.tabs button.on { border-bottom-color: var(--primary); color: var(--primary); }
.panel { display: none; }
.panel.on { display: block; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.feature { padding: 22px 0; border-top: 1px solid var(--border); }
.feature b { display: flex; align-items: center; gap: 10px; }
.feature .ic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--primary); font-size: 16px; font-weight: 700; }
.feature p { margin: 10px 0 0; color: var(--text-2); font-size: 14px; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; }
.gallery figure, .themes figure { min-width: 0; margin: 0; }
.gallery a { display: block; }
.gallery img, .themes img { display: block; width: 100%; border: 1px solid var(--border); }
.gallery a:hover img { border-color: var(--primary); }
.gallery figcaption, .themes figcaption { margin-top: 10px; color: var(--text-3); font-size: 13px; line-height: 1.6; }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 20px; }

/* Generated manual: continuous paper with a quiet, red-tracked contents rail. */
.layout { max-width: 1240px; margin: 0 auto; padding: 40px 32px 80px; display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 48px; }
.toc { position: sticky; top: 96px; align-self: start; min-width: 0; max-height: calc(100vh - 120px); overflow: auto; padding: 4px; }
.toc details { padding: 0; border: 0; }
.toc summary { padding: 10px 8px; border-bottom: 2px solid var(--primary); color: var(--text); font-size: 15px; }
.toc-list { display: flex; flex-direction: column; padding-top: 12px; }
.toc-list a { display: block; padding: 8px 10px; border-left: 2px solid transparent; color: var(--text-2); font-size: 13px; line-height: 1.6; text-decoration: none; }
.toc-list a.toc-3 { padding-left: 24px; font-size: 12px; }
.toc-list a:hover { background: var(--surface-2); color: var(--primary); }
.toc-list a.on { border-left-color: var(--primary); background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.doc { min-width: 0; width: 100%; max-width: none; padding: 0; margin: 0; }
.doc-head { padding: 0 0 20px; border-bottom: 3px solid var(--primary); }
.doc-head h1 { margin: 0 0 16px; font-size: 42px; letter-spacing: -1px; }
.doc-head .meta { margin: 0; color: var(--text-2); font-size: 13px; }
.doc h2 { position: relative; border-top-width: 1px; border-top-color: var(--border); }
.doc h3 { position: relative; }
.doc .anchor { position: absolute; left: -22px; color: var(--primary); opacity: 0; font-weight: 400; text-decoration: none; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus-visible { opacity: 1; }
.doc li { margin: 6px 0; }
.doc ul, .doc ol { padding-left: 24px; }
.doc blockquote { margin: 18px 0; padding: 14px 18px; border-left: 3px solid var(--primary); background: var(--surface-2); color: var(--text-2); }
.doc blockquote p { margin: 4px 0; }
.doc pre { padding: 16px; background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; font-size: 14px; line-height: 1.7; }
.doc pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc th, .doc td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; min-width: 96px; }
.doc tr:last-child td { border-bottom: none; }
.doc th { background: var(--surface-2); color: var(--text); font-weight: 700; border-bottom: 2px solid var(--primary); }
.doc hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }
.doc figure { margin: 24px 0; }
.doc figure img { max-width: min(100%, 380px); height: auto; border: 1px solid var(--border); }
.doc figcaption { margin-top: 10px; color: var(--text-3); font-size: 13px; }
.totop { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; text-decoration: none; }
.totop:hover { background: var(--primary-hover); color: var(--on-primary); }

@media (max-width: 900px) {
  html { scroll-padding-top: 20px; }
  .topnav { position: static; flex-wrap: wrap; gap: 4px; padding: 12px 20px; }
  .topnav .brand { flex-basis: 100%; margin: 0; }
  .topnav .spacer { display: none; }
  .topnav a { padding-inline: 10px; }
  .topnav .pill { margin-left: auto; }
  .layout { grid-template-columns: 1fr; padding: 24px 24px 72px; gap: 32px; }
  .toc { position: static; max-height: none; padding: 0 4px; }
  .toc-list { padding-bottom: 12px; }
  .hero { grid-template-columns: minmax(0, 1fr) 240px; gap: 32px; }
  .doc .anchor { position: static; display: inline-block; margin-right: 8px; opacity: 1; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  main { padding: 24px 20px 64px; }
  h2 { font-size: 23px; margin-top: 40px; }
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 8px 0 24px; }
  .hero h1 { font-size: 30px; }
  .hero .lead { font-size: 16px; }
  .hero .shot { justify-self: center; width: min(280px, 100%); }
  .cta .btn { flex: 1 1 140px; padding-inline: 12px; }
  .card { padding: 16px; }
  .steps li { padding-left: 34px; }
  .tabs button { flex: 1; padding-inline: 12px; }
  .grid { grid-template-columns: 1fr; }
  .gallery, .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .layout { padding-inline: 20px; }
  .doc-head h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  @page { margin: 16mm; }
  html { scroll-behavior: auto; }
  body { color: #000; background: #fff; font-size: 10pt; line-height: 1.6; }
  .topnav, .toc, .totop, .tabs, .doc .anchor { display: none !important; }
  main, .layout, .doc { display: block; width: 100%; max-width: none; padding: 0; margin: 0; }
  .hero { grid-template-columns: minmax(0, 1fr) 160px; gap: 24px; }
  .hero .shot { width: 160px; }
  .hero h1, .doc-head h1 { font-size: 24pt; }
  h2 { font-size: 17pt; }
  h3 { font-size: 13pt; }
  h1, h2, h3, h4, summary { break-after: avoid; }
  .panel, details, details > :not(summary) { display: block !important; }
  details::details-content { display: block; content-visibility: visible; }
  .card { border: 0; border-top: 1px solid var(--border); padding: 12px 0; }
  .feature, figure, .note, blockquote, tr { break-inside: avoid; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery, .themes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .doc pre { white-space: pre-wrap; }
  .doc pre code { overflow-wrap: anywhere; }
  .table-wrap, .doc pre { overflow: visible; }
  .doc th, .doc td { min-width: 0; padding: 6px; }
  .doc figure img { max-height: 150mm; width: auto; }
  a { color: inherit; }
  .btn, .btn.ghost, .note, .doc blockquote { background: #fff; color: #000; }
  footer { margin-top: 24px; }
}
