
html { scroll-padding-top: 100px; }
.brand-logo { display: block; width: 132px; height: 32px; object-fit: contain; }
.doc-actions { display: flex; gap: 20px; align-items: center; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; background: white; padding: 12px; }
.skip-link:focus { top: 8px; }
a:focus-visible, button:focus-visible { outline: 3px solid #37b4aa; outline-offset: 3px; }
main p, main li, td { overflow-wrap: anywhere; }
th, td:first-child > code { white-space: nowrap; }
table:has(th:nth-child(3)) td:nth-child(2) { overflow-wrap: normal; }
.table-scroll { overflow-x: auto; margin: 14px 0 22px; }
.table-scroll table { margin: 0; min-width: 540px; }
.code-block pre { padding-top: 44px; }
.copy-btn.failed { color: #ffb4b4; }

:root {
  color-scheme: light;
  --ink: #12203a; --muted: #62708a; --line: #e0e6ef;
  --surface: #ffffff; --canvas: #f4f7fb; --nav: #101b31;
  --brand: #2447c4; --brand-strong: #17379f; --danger: #bd3030;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: var(--canvas); line-height: 1.7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}
a { color: var(--brand); }
.topbar {
  position: sticky; top: 0; z-index: 20; color: #fff;
  background: var(--nav); border-bottom: 1px solid rgba(255,255,255,.09);
}
.topbar-inner {
  width: min(1320px, calc(100% - 48px)); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px; flex-wrap: wrap; padding: 8px 0;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 15px; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; background: linear-gradient(145deg, #4f72eb, #2447c4);
}
.topbar-link { color: #bfc9da; font-size: 13px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.topbar-link:hover { color: #fff; }
.page {
  width: min(1320px, calc(100% - 48px));
  margin: 32px auto 64px; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px;
}
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; }
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.toc-toggle { display: none; }
.toc nav { display: grid; gap: 2px; border-left: 2px solid var(--line); }
.toc a {
  padding: 4px 12px; color: var(--muted); text-decoration: none;
  font-size: 13px; border-left: 2px solid transparent; margin-left: -2px; border-radius: 0;
}
.toc a:hover { color: var(--brand); }
.toc a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 600; }
.toc .lvl3 { padding-left: 24px; font-size: 12px; }
main {
  min-width: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 3px 12px rgba(26,42,72,.035); padding: 40px 48px;
}
.doc-meta { color: var(--muted); font-size: 13px; margin: -8px 0 24px; }
h1, h2, h3, h4 { line-height: 1.35; letter-spacing: -.01em; }
h1 { font-size: 30px; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 40px 0 12px; padding-top: 24px; border-top: 1px solid var(--line); }
h3 { font-size: 17px; margin: 28px 0 10px; }
h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 24px; }
table { width: 100%; border-collapse: collapse; margin: 14px 0 22px; font-size: 13.5px; }
th, td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
th { background: #f6f8fc; font-size: 12.5px; }
code {
  padding: 1px 6px; border-radius: 6px; background: #eef1f8;
  font: 12.5px ui-monospace, SFMono-Regular, Consolas, monospace;
}
pre { margin: 14px 0 22px; padding: 16px; overflow-x: auto; border-radius: 10px; background: #111c30; }
pre code { padding: 0; background: none; color: #dce7fb; font-size: 12.5px; line-height: 1.65; }
.code-block { position: relative; margin: 14px 0 22px; }
.code-block pre { margin: 0; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 30px; height: 30px;
  padding: 0; border: 1px solid rgba(220,231,251,.25); border-radius: 7px;
  color: #a8b8d8; background: rgba(17,28,48,.85); cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.copy-btn:hover { color: #fff; border-color: rgba(220,231,251,.55); }
.copy-btn.copied { color: #7ce38b; border-color: rgba(124,227,139,.6); }
blockquote { margin: 14px 0; padding: 10px 16px; border-left: 4px solid var(--brand); background: #f6f8fc; border-radius: 0 10px 10px 0; color: var(--muted); font-size: 14px; }
ul, ol { padding-left: 24px; margin: 10px 0 18px; }
li { margin: 4px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
code.hljs { background: none; padding: 0; }
@media (min-width: 1024px) {
  .topbar-inner, .page { width: min(1200px, calc(100% - 48px)); }
  .doc-actions { gap: 8px; }
  .topbar-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 14px; line-height: 1.5; }
  .page { grid-template-columns: 224px minmax(0, 1fr); gap: 20px; margin: 24px auto 40px; }
  .toc { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .toc-title { margin-bottom: 12px; }
  main { padding: 28px 32px; }
  h1 { font-size: 28px; }
  h2 { margin-top: 32px; padding-top: 20px; }
  h3 { margin-top: 24px; }
  .copy-btn { width: 44px; height: 44px; border-radius: 10px; }
  .code-block pre { padding-top: 60px; }
}
@media (max-width: 960px) {
  .page { grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
  .toc { position: static; max-height: none; }
  .toc nav { display: flex; flex-wrap: wrap; gap: 4px; border-left: 0; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; margin-left: 0; padding: 3px 10px; }
  .toc a.active { border-color: var(--brand); }
  .toc .lvl3 { padding-left: 10px; }
  main { padding: 20px 16px; }
  .topbar-inner, .page { width: calc(100% - 32px); }
  .toc-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
  .toc-toggle svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform 160ms ease; }
  .toc-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .toc.is-collapsible .toc-title { display: none; }
  .toc.is-collapsible nav { display: none; }
  .toc.is-collapsible.is-open nav { display: grid; gap: 4px; max-height: 60dvh; overflow-y: auto; margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  .toc a, .toc .lvl3 { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 6px; font-size: 13px; line-height: 1.6; }
  .toc .lvl3 { padding-left: 24px; }
  .toc a.active { background: #edf1ff; }
}

@media (max-width: 640px) {
  html { scroll-padding-top: 144px; }
  .topbar-inner { gap: 4px; min-height: 64px; padding: 8px 0; }
  .brand { min-height: 40px; gap: 8px; font-size: 13px; }
  .brand-logo { width: 116px; height: auto; }
  .doc-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .topbar-link { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px; border-radius: 8px; background: rgba(255,255,255,.06); font-size: 12px; line-height: 1.5; text-align: center; white-space: normal; }
  .page { gap: 12px; margin-bottom: calc(32px + env(safe-area-inset-bottom)); }
  main { padding: 20px 16px; font-size: 14px; line-height: 1.8; }
  h1 { font-size: 24px; line-height: 1.4; overflow-wrap: anywhere; }
  h2 { font-size: 20px; margin-top: 28px; padding-top: 20px; }
  h3 { font-size: 16px; }
  .copy-btn { width: 44px; height: 44px; }
  .code-block pre { padding-top: 60px; }
  .table-scroll, .code-block { min-width: 0; max-width: 100%; }
  blockquote { padding: 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
