/* 文档站外壳：三级侧边栏 / 面包屑 / 本页目录 / 双主题 */
:root {
  --docs-top: 56px;
  --docs-side: 280px;
  --docs-toc: 220px;
}
html[data-theme="dark"] {
  --paper: #1A1D21;
  --paper-2: #22262B;
  --surface: #2A2E33;
  --ink: #f7f4ed;
  --ink-2: #0d1830;
  --slate-2: #b9c6da;
  --slate: #8592a3;
  --line: #3A3F45;
  --line-dark: #3A3F45;
  --verm: #6AA6FF;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] body::after { mix-blend-mode: overlay; opacity: 0.04; }

body.docs { background: var(--paper); color: var(--ink); }
.docs-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900; height: var(--docs-top);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--ink-2); border-bottom: 1px solid var(--line-dark); color: #f7f4ed;
}
html[data-theme="dark"] .docs-top { background: #202428; }
.docs-top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #f7f4ed; font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; white-space: nowrap; }
.docs-top .brand img { height: 26px; }
.docs-top .brand .sub { font-family: var(--font-mono); font-weight: 400; font-size: 0.66rem; letter-spacing: 0.16em; color: #8592a3; }
.docs-search { flex: 1; max-width: 520px; position: relative; }
.docs-search input {
  width: 100%; background: #142440; border: 1px solid #2a3c5e; border-radius: 3px;
  color: #f7f4ed; padding: 8px 12px 8px 34px; font-size: 0.88rem; font-family: var(--font-body);
}
html[data-theme="dark"] .docs-search input { background: #22262B; }
.docs-search input:focus { outline: none; border-color: var(--verm); }
.docs-search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #8592a3; font-size: 0.85rem; }
.docs-search .drop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-1); max-height: 340px; overflow-y: auto; display: none; z-index: 950; }
.docs-search .drop.open { display: block; }
.docs-search .drop a { display: block; padding: 10px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.docs-search .drop a:last-child { border-bottom: 0; }
.docs-search .drop a:hover { background: var(--paper-2); }
.docs-search .drop .k { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em; color: var(--verm); display: block; }
.docs-search .drop .s { font-size: 0.78rem; color: var(--slate-2); }
.docs-top .spacer { flex: 1; }
.docs-top .tbtn { background: none; border: 1px solid #2a3c5e; color: #f7f4ed; border-radius: 3px; width: 34px; height: 34px; cursor: pointer; display: grid; place-items: center; font-size: 0.9rem; }
.docs-top .tbtn:hover { border-color: var(--verm); color: var(--verm); }
.docs-top .home-link { color: #b9c6da; text-decoration: none; font-size: 0.85rem; white-space: nowrap; }
.docs-top .home-link:hover { color: #f2724f; }
.docs-side-toggle { display: none; }

.docs-layout { display: grid; grid-template-columns: var(--docs-side) minmax(0, 1fr) var(--docs-toc); padding-top: var(--docs-top); min-height: 100vh; }
.docs-side {
  border-right: 1px solid var(--line); padding: 24px 14px 60px; position: sticky; top: var(--docs-top);
  height: calc(100vh - var(--docs-top)); overflow-y: auto; background: var(--paper);
}
.docs-side .side-home {
  display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 3px; color: var(--ink);
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; text-decoration: none;
}
.docs-side .side-home:hover { color: var(--verm); border-color: var(--verm); background: var(--paper-2); }
.docs-side .group { margin-bottom: 6px; }
.docs-side .group > summary {
  cursor: pointer; list-style: none; font-family: var(--font-display); font-weight: 700; font-size: 0.9rem;
  padding: 8px 10px; border-radius: 3px; display: flex; justify-content: space-between; align-items: center; color: var(--ink);
}
.docs-side .group > summary::-webkit-details-marker { display: none; }
.docs-side .group > summary::after { content: "▸"; color: var(--slate); font-size: 0.7rem; transition: transform 0.2s; }
.docs-side .group[open] > summary::after { transform: rotate(90deg); }
.docs-side .group > summary:hover { background: var(--paper-2); }
.docs-side ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 10px; border-left: 1px solid var(--line); margin-left: 12px; }
.docs-side li a { display: block; padding: 6px 10px; font-size: 0.86rem; color: var(--slate-2); text-decoration: none; border-radius: 3px; }
.docs-side li a:hover { color: var(--verm); background: var(--paper-2); }
.docs-side li a[aria-current="page"] { color: var(--verm); font-weight: 600; background: rgba(224, 75, 47, 0.08); }
.docs-side .side-note { margin: 18px 10px 0; padding: 12px; border: 1px dashed var(--line); border-radius: 4px; font-size: 0.76rem; color: var(--slate); }

.docs-main { padding: 36px 48px 80px; max-width: 860px; }
.crumbs { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--slate); margin-bottom: 22px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--slate); text-decoration: none; }
.crumbs a:hover { color: var(--verm); }
.crumbs .sep { color: var(--verm); }
.docs-main h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin-bottom: 14px; }
.docs-main .doc-lead { font-size: 1.05rem; color: var(--slate-2); margin-bottom: 28px; }
.docs-main h2 { font-size: 1.45rem; margin: 44px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--docs-top) + 20px); }
.docs-main h3 { font-size: 1.1rem; margin: 26px 0 10px; scroll-margin-top: calc(var(--docs-top) + 20px); }
.docs-main p { margin: 0 0 14px; }
.docs-main ul, .docs-main ol { padding-left: 22px; margin: 0 0 16px; }
.docs-main li { margin-bottom: 7px; }
.docs-main a { color: var(--verm); text-decoration: none; border-bottom: 1px solid rgba(224, 75, 47, 0.35); }
.docs-main a:hover { border-bottom-color: var(--verm); }
.docs-main strong { color: var(--ink); }
.docs-main .shot { margin: 22px 0; }
.docs-main .callout { border-left: 3px solid var(--verm); background: var(--paper-2); padding: 14px 18px; border-radius: 0 4px 4px 0; margin: 20px 0; font-size: 0.94rem; }
.docs-main .callout.warn { border-left-color: var(--warn); }
.docs-main .callout.ok { border-left-color: var(--ok); }
.docs-main .callout .t { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em; color: var(--verm); display: block; margin-bottom: 6px; }
.docs-main .callout.warn .t { color: var(--warn); }
.docs-main .callout.ok .t { color: var(--ok); }
.docs-main .steps { counter-reset: step; list-style: none; padding: 0; }
.docs-main .steps li { counter-increment: step; position: relative; padding: 0 0 18px 46px; }
.docs-main .steps li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 2px;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--verm); border: 1px solid var(--line);
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 3px; background: var(--surface);
}
.docs-main .steps li::after { content: ""; position: absolute; left: 15px; top: 36px; bottom: 2px; width: 1px; background: var(--line); }
.docs-main .steps li:last-child::after { display: none; }
.doc-meta { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--slate); margin: 34px 0 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; }
.pager a { border: 1px solid var(--line); border-radius: 4px; padding: 16px 18px; text-decoration: none; color: var(--ink); background: var(--surface); transition: border-color 0.2s, transform 0.2s; }
.pager a:hover { border-color: var(--verm); transform: translateY(-2px); }
.pager .dir { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.14em; color: var(--slate); display: block; margin-bottom: 6px; }
.pager .tt { font-weight: 700; font-family: var(--font-display); }
.pager a.next { text-align: right; }
.pager a.placeholder { visibility: hidden; }

.docs-toc { padding: 36px 20px 60px 0; position: sticky; top: var(--docs-top); height: calc(100vh - var(--docs-top)); overflow-y: auto; }
.docs-toc .t { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.16em; color: var(--slate); margin-bottom: 12px; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.docs-toc a { display: block; padding: 5px 0 5px 14px; font-size: 0.82rem; color: var(--slate-2); text-decoration: none; border-left: 2px solid transparent; margin-left: -1px; }
.docs-toc a:hover { color: var(--verm); }
.docs-toc a.active { color: var(--verm); border-left-color: var(--verm); font-weight: 600; }

.docs-home-hero { padding: 56px 0 40px; border-bottom: 1px solid var(--line); }
.docs-home-hero h1 { font-size: clamp(2rem, 4vw, 3rem); }
.docs-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 32px 0; }
.docs-cards a { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 20px; text-decoration: none; color: var(--ink); transition: border-color 0.2s, transform 0.2s; }
.docs-cards a:hover { border-color: var(--verm); transform: translateY(-3px); }
.docs-cards .k { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.14em; color: var(--verm); }
.docs-cards h3 { margin: 8px 0 6px; font-size: 1.05rem; }
.docs-cards p { margin: 0; font-size: 0.85rem; color: var(--slate-2); }

@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: var(--docs-side) minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-side { position: fixed; left: 0; top: var(--docs-top); bottom: 0; z-index: 890; width: min(320px, 86vw); transform: translateX(-102%); transition: transform 0.25s ease; box-shadow: var(--shadow-2); }
  .docs-side.open { transform: none; }
  .docs-side-toggle { display: grid; }
  .docs-main { padding: 28px 20px 64px; }
  .docs-cards { grid-template-columns: 1fr; }
  .docs-top .home-link { display: none; }
  .pager { grid-template-columns: 1fr; }
}