:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-strong: #f4f4f5;
  --text: #27272a;
  --heading: #09090b;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #e4e4e7;
  --border-soft: #f0f0f2;
  --accent: #6d4aff;
  --accent-soft: #f1edff;
  --accent-border: #ddd5ff;
  --code-bg: #111116;
  --code-text: #e4e4e7;
  --topbar: rgba(255, 255, 255, 0.9);
  --shadow: 0 24px 70px rgba(24, 24, 27, 0.14);
  --sidebar-width: 256px;
  --toc-width: 218px;
  --topbar-height: 64px;
}

html.dark {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111113;
  --surface-strong: #18181b;
  --text: #d4d4d8;
  --heading: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --border: #27272a;
  --border-soft: #1f1f22;
  --accent: #a78bfa;
  --accent-soft: #211a38;
  --accent-border: #413269;
  --code-bg: #050506;
  --code-text: #e4e4e7;
  --topbar: rgba(9, 9, 11, 0.9);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--heading); }

.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(280px, 1fr) auto;
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar);
  backdrop-filter: blur(18px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.025em;
}
.brand:hover { color: var(--heading); }
.brand img { width: 29px; height: 29px; }
.brand span { font-size: 17px; }
.brand em {
  margin-left: -3px;
  padding: 1px 7px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.topnav { display: flex; justify-content: center; gap: 26px; height: 100%; }
.topnav a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.topnav a:hover, .topnav a.active { color: var(--heading); }
.topnav a.active::after {
  position: absolute;
  content: "";
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 210px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.search-trigger:hover { border-color: var(--faint); color: var(--heading); }
.search-trigger b { flex: 1; overflow: hidden; font-size: 13px; font-weight: 400; white-space: nowrap; }
kbd {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--faint);
  background: var(--bg);
  font-family: inherit;
  font-size: 10px;
  line-height: 18px;
}
.icon-button, .language-button, .menu-button {
  display: grid;
  place-items: center;
  height: 36px;
  min-width: 36px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.icon-button:hover, .language-button:hover, .menu-button:hover { color: var(--heading); background: var(--surface-strong); }
.language-button { font-size: 12px; font-weight: 700; }
.console-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 13px;
  border-radius: 8px;
  color: #fff;
  background: var(--heading);
  font-size: 13px;
  font-weight: 600;
}
html.dark .console-button { color: #0a0a0b; background: #fafafa; }
.console-button:hover { color: #fff; opacity: .86; }
html.dark .console-button:hover { color: #0a0a0b; }
.menu-button { display: none; font-size: 19px; }

.page-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 760px) var(--toc-width);
  justify-content: center;
  min-height: 100vh;
  padding-top: var(--topbar-height);
}
.sidebar {
  position: fixed;
  z-index: 30;
  top: var(--topbar-height);
  bottom: 0;
  left: max(0px, calc((100vw - 1234px) / 2));
  width: var(--sidebar-width);
  overflow-y: auto;
  padding: 31px 25px 48px 22px;
  border-right: 1px solid var(--border-soft);
  background: var(--bg);
}
.sidebar-group { margin-bottom: 26px; }
.sidebar-group h3 {
  margin: 0 0 7px;
  color: var(--heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.sidebar-group a {
  position: relative;
  display: block;
  margin: 1px 0;
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.sidebar-group a:hover { color: var(--heading); background: var(--surface); }
.sidebar-group a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sidebar-group a.active::before {
  position: absolute;
  content: "";
  top: 8px;
  bottom: 8px;
  left: -10px;
  width: 2px;
  border-radius: 3px;
  background: var(--accent);
}
.content { grid-column: 2; min-width: 0; padding: 66px 62px 110px; }
article { max-width: 680px; margin: 0 auto; }
.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1, h2, h3 { color: var(--heading); letter-spacing: -0.035em; line-height: 1.25; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 44px); font-weight: 700; }
h2 { margin: 48px 0 13px; padding-top: 4px; font-size: 23px; font-weight: 650; }
h3 { margin: 30px 0 9px; font-size: 17px; font-weight: 650; }
.lead { margin: 15px 0 27px; color: var(--muted); font-size: 18px; line-height: 1.65; }
p { margin: 12px 0; }
strong { color: var(--heading); }
code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--heading);
  background: var(--surface);
  font-family: "JetBrains Mono", monospace;
  font-size: .86em;
}
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0 25px; }
.doc-card {
  display: flex;
  min-height: 116px;
  flex-direction: column;
  gap: 8px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: linear-gradient(145deg, var(--bg), var(--surface));
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.doc-card:hover { transform: translateY(-2px); border-color: var(--accent-border); color: var(--text); box-shadow: 0 12px 28px rgba(109, 74, 255, .08); }
.doc-card strong { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.doc-card strong span { color: var(--accent); }
.doc-card > span { color: var(--muted); font-size: 13px; line-height: 1.55; }
.callout {
  margin: 24px 0;
  padding: 15px 17px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent-soft);
}
.callout strong { display: block; margin-bottom: 3px; font-size: 13px; }
.callout p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.callout.warning { border-color: #fed7aa; background: #fff7ed; }
html.dark .callout.warning { border-color: #7c421d; background: #2b190f; }
.steps { margin: 22px 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; min-height: 66px; margin-left: 18px; padding: 0 0 28px 38px; border-left: 1px solid var(--border); counter-increment: step; }
.steps li:last-child { border-left-color: transparent; }
.steps li::before {
  position: absolute;
  top: -2px;
  left: -14px;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  color: var(--accent);
  background: var(--bg);
  content: counter(step);
  font-size: 12px;
  font-weight: 700;
}
.steps li strong { display: block; margin-bottom: 5px; }
.feature-list { padding-left: 21px; }
.feature-list li { margin: 8px 0; padding-left: 4px; }
.code-block { position: relative; margin: 20px 0; overflow: hidden; border: 1px solid #29292f; border-radius: 10px; background: var(--code-bg); }
.code-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  border-bottom: 1px solid #29292f;
  color: #a1a1aa;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
}
.code-language-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px #8b5cf6; }
.copy-code {
  position: absolute;
  top: 6px;
  right: 7px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  color: #a1a1aa;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}
.copy-code:hover { color: #fff; background: #24242a; }
pre { margin: 0; overflow-x: auto; padding: 17px; }
pre code {
  padding: 0;
  border: 0;
  color: var(--code-text);
  background: transparent;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre;
  tab-size: 2;
}
.token-comment { color: #71717a; }
.token-string { color: #a7f3d0; }
.token-number { color: #fdba74; }
.token-keyword { color: #c4b5fd; }
.token-property, .token-function { color: #93c5fd; }
.code-tabs { margin: 20px 0; }
.code-tab-list { display: flex; gap: 4px; margin-bottom: -1px; padding-left: 8px; }
.code-tab { padding: 7px 12px; border: 1px solid transparent; border-radius: 7px 7px 0 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.code-tab.active { z-index: 1; border-color: #29292f; border-bottom-color: var(--code-bg); color: #fff; background: var(--code-bg); }
.code-tab-panel { display: none; }
.code-tab-panel.active { display: block; }
.code-tab-panel .code-block { margin-top: 0; border-radius: 0 10px 10px 10px; }
.table-wrap { margin: 20px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--heading); background: var(--surface); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.api-routes-table th:first-child,
.api-routes-table td:first-child { width: 44px; text-align: center; white-space: nowrap; }
.mcp-tools-table { overflow-x: visible; }
.mcp-tools-table table { table-layout: fixed; }
.mcp-tools-table th,
.mcp-tools-table td { padding: 9px 11px; vertical-align: top; line-height: 1.45; }
.mcp-tools-table th:first-child,
.mcp-tools-table td:first-child { width: 44px; text-align: center; white-space: nowrap; }
.mcp-tools-table th:nth-child(2),
.mcp-tools-table td:nth-child(2) { width: 118px; white-space: normal; overflow-wrap: anywhere; font-weight: 500; }
.mcp-tools-table th:nth-child(3),
.mcp-tools-table td:nth-child(3) { width: 43%; padding-left: 18px; border-left: 1px solid var(--border); }
.mcp-tools-table th:nth-child(4),
.mcp-tools-table td:nth-child(4) { padding-left: 18px; border-left: 1px solid var(--border); }
.mcp-tool-name { display: block; padding: 0; border: 0; background: transparent; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.mcp-tool-route { display: block; margin-top: 5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.mcp-tool-purpose { display: block; }
.mcp-kind { display: inline-flex; margin-top: 7px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.mcp-kind-write { border-color: rgba(167, 139, 250, .45); color: var(--accent); }
.mcp-kind-destructive { border-color: rgba(248, 113, 113, .5); color: #ef4444; }
.mcp-tools-table tbody tr:hover { background: color-mix(in srgb, var(--surface) 68%, transparent); }
.support { margin-top: 55px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.toc { grid-column: 3; padding: 66px 18px 80px 20px; }
.toc > div { position: sticky; top: calc(var(--topbar-height) + 35px); }
.toc strong { display: block; margin-bottom: 10px; font-size: 11px; }
.toc a { display: block; margin: 4px 0; padding: 3px 0 3px 11px; border-left: 1px solid var(--border); color: var(--muted); font-size: 11px; line-height: 1.45; }
.toc a:hover { color: var(--heading); border-left-color: var(--accent); }

.search-modal { position: fixed; z-index: 100; inset: 0; display: none; }
.search-modal.open { display: block; }
.search-backdrop { position: absolute; inset: 0; background: rgba(9, 9, 11, .56); backdrop-filter: blur(4px); }
.search-panel {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  margin: 12vh auto 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--shadow);
}
.search-input-wrap { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.search-input-wrap input { flex: 1; border: 0; outline: 0; color: var(--heading); background: transparent; font-size: 15px; }
.search-input-wrap input::placeholder { color: var(--faint); }
.search-results { max-height: 390px; overflow-y: auto; padding: 8px; }
.search-result { display: block; padding: 11px 12px; border-radius: 8px; color: var(--text); }
.search-result:hover, .search-result.active { color: var(--text); background: var(--accent-soft); }
.search-result strong { display: block; font-size: 13px; }
.search-result span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.search-empty { padding: 40px 15px; color: var(--muted); text-align: center; }
.search-panel footer { display: flex; gap: 18px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--faint); background: var(--surface); font-size: 10px; }

@media (max-width: 1080px) {
  :root { --toc-width: 0px; }
  .page-shell { grid-template-columns: var(--sidebar-width) minmax(0, 760px); }
  .toc { display: none; }
  .topbar { grid-template-columns: var(--sidebar-width) 1fr auto; }
  .topnav { gap: 17px; }
  .topnav a:nth-child(5) { display: none; }
}

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 14px; }
  .topnav, .search-trigger, .console-button { display: none; }
  .menu-button { display: grid; }
  .page-shell { display: block; }
  .sidebar {
    left: 0;
    width: min(310px, 84vw);
    transform: translateX(-105%);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 48px 24px 90px; }
}

@media (max-width: 560px) {
  .brand em { display: none; }
  .content { padding: 40px 18px 80px; }
  .doc-grid { grid-template-columns: 1fr; }
  .doc-card { min-height: auto; }
  h2 { margin-top: 39px; }
}
