:root {
  color-scheme: light;
  --sans: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --bg: #f6f8fc; --panel: #fff; --ink: #101b2d; --muted: #5c6a86; --line: #e3e8f1;
  --blue: #315efb; --blue-dark: #244de0; --green: #14865d;
  --dark: #0b1220; --dark-line: #1f2d48; --dark-muted: #9aa9c6;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 15.5px; line-height: 1.75;
}
:focus-visible { outline: 3px solid #315efb80; outline-offset: 2px; }
.doc-shell { width: min(1240px, 100% - 44px); margin-inline: auto; }
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 30; padding: 10px 14px; border-radius: 8px;
  background: var(--blue); color: #fff; font-weight: 650; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* ---------- 顶部导航 ---------- */
.doc-nav {
  position: sticky; top: 0; z-index: 20; background: #0b1220ee; color: #e7eefb;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--dark-line);
}
.doc-nav-inner { display: flex; align-items: center; gap: 22px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #e7eefb; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--blue); color: #fff; font-weight: 800; }
.logo-word { font-weight: 800; letter-spacing: 1.4px; font-size: 14px; }
.logo-word em { font-style: normal; font-weight: 600; letter-spacing: .4px; font-size: 11px; color: var(--dark-muted); margin-left: 7px; }
.doc-nav-links { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.doc-nav-links a { padding: 8px 11px; border-radius: 8px; color: #bdcbe6; font-size: 14px; font-weight: 600; text-decoration: none; }
.doc-nav-links a:hover { color: #fff; background: #18263f; }

/* ---------- 布局：左侧目录 + 右侧正文 ---------- */
.doc-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 34px; padding: 34px 0 64px; align-items: start; }
.doc-toc { position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow: auto; padding-right: 6px; }
.doc-toc-list ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.doc-toc-list li a {
  display: block; padding: 6px 12px; border-left: 2px solid transparent; margin-left: -1px;
  color: #55637f; font-size: 13.5px; text-decoration: none; line-height: 1.45;
}
.doc-toc-list li a:hover { color: var(--blue-dark); border-left-color: #b9c8ff; }
.doc-toc-list .toc-l2 > a { font-weight: 680; color: #26344f; }
.doc-toc-list .toc-l3 > a { padding-left: 26px; }
.doc-toc-list .toc-l4 > a { padding-left: 38px; font-size: 13px; }
.doc-toc-empty { color: var(--muted); font-size: 13px; }

.doc-article {
  padding: clamp(26px, 3.4vw, 46px); border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); box-shadow: 0 12px 40px #1c2a4610; overflow-wrap: break-word;
}

/* ---------- 正文排版 ---------- */
.doc-article h1 { margin: 0 0 18px; font-size: clamp(26px, 3.2vw, 36px); letter-spacing: -.8px; line-height: 1.25; }
.doc-article h2 {
  margin: 40px 0 14px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: 22px; letter-spacing: -.4px; scroll-margin-top: 84px;
}
.doc-article h1 + h2 { margin-top: 8px; padding-top: 0; border-top: 0; }
.doc-article h3 { margin: 28px 0 10px; font-size: 17.5px; scroll-margin-top: 84px; }
.doc-article h4 { margin: 22px 0 8px; font-size: 15.5px; color: #2a3752; scroll-margin-top: 84px; }
.doc-article p { margin: 0 0 15px; color: #2b3854; }
.doc-article a { color: var(--blue-dark); text-decoration: underline; text-underline-offset: 2px; }
.doc-article a:hover { color: var(--blue); }
.doc-article strong { color: #0e1a30; }
.doc-article code {
  padding: .12em .4em; border: 1px solid #e0e7f3; border-radius: 5px;
  background: #f7f9fd; color: #26395f; font-family: var(--mono); font-size: .88em;
}
.doc-article ul, .doc-article ol { margin: 0 0 16px; padding-left: 24px; color: #2b3854; }
.doc-article li { margin: 5px 0; }
.doc-article li > ul, .doc-article li > ol { margin: 5px 0 0; }
.doc-article blockquote {
  margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0; background: #f2f5fd; color: #334163;
}

/* ---------- 代码块 ---------- */
.doc-article pre.doc-code {
  position: relative; margin: 0 0 20px; padding: 18px; overflow-x: auto;
  border-radius: 12px; background: #0b1220; color: #cddcf7;
  font-family: var(--mono); font-size: 12.8px; line-height: 1.75;
}
.doc-article pre.doc-code code {
  padding: 0; border: 0; background: none; color: inherit; font-size: inherit; white-space: pre;
}
.doc-article pre.doc-code[data-lang]::before {
  content: attr(data-lang); position: absolute; top: 0; right: 0; padding: 3px 10px;
  border-radius: 0 12px 0 10px; background: #16233b; color: #8fa4c8;
  font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase;
}

/* ---------- 表格 ---------- */
.doc-table-wrap { margin: 0 0 22px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.doc-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
.doc-table th, .doc-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-table thead th { background: #f2f5fb; color: #43526f; font-size: 12px; letter-spacing: .8px; text-transform: uppercase; }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table tbody tr:nth-child(even) { background: #fafbfe; }
.doc-table code { font-size: 12.6px; }

/* ---------- 页脚 ---------- */
.doc-foot { padding: 26px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.doc-foot-inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.doc-foot p { margin: 0; }
.doc-foot code { font-family: var(--mono); font-size: 12.5px; }
.doc-foot a { color: var(--blue-dark); }

/* ---------- 响应式与打印 ---------- */
@media (max-width: 980px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-toc { position: static; max-height: none; overflow: visible; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
  .doc-toc-list ul { display: flex; flex-wrap: wrap; gap: 4px; border-left: 0; }
  .doc-toc-list li a { border-left: 0; border-radius: 8px; padding: 6px 10px; }
  .doc-toc-list .toc-l3 > a, .doc-toc-list .toc-l4 > a { padding-left: 10px; }
}
@media (max-width: 640px) {
  .doc-shell { width: min(1240px, 100% - 28px); }
  .doc-nav-inner { flex-wrap: wrap; gap: 10px; padding: 8px 0; }
  .doc-article { padding: 22px 18px; border-radius: 14px; }
}
@media print {
  .doc-nav, .doc-toc, .doc-foot, .skip-link { display: none; }
  body { background: #fff; }
  .doc-article { border: 0; box-shadow: none; padding: 0; }
}
