:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef5f8;
  --ink: #09111f;
  --muted: #5d6878;
  --line: rgba(14, 22, 34, 0.12);
  --line-strong: rgba(14, 22, 34, 0.22);
  --primary: #008f8d;
  --primary-2: #246bfe;
  --cyan: #21b9d8;
  --green: #17a56b;
  --amber: #d69220;
  --danger: #d44c45;
  --shadow: 0 18px 46px rgba(16, 28, 50, 0.11);
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

a {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
}
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  z-index: 20;
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-weight: 850;
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 12px; }

.search-box { display: grid; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 12px; font-weight: 700; }
.search-box input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  outline: none;
  color: var(--ink);
  background: var(--surface);
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 143, 141, 0.12); }

.nav-list { display: grid; gap: 4px; }
.nav-list a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 14px;
  font-weight: 700;
}
.nav-list a:hover, .nav-list a.active { color: #0f3fbf; background: rgba(29, 78, 216, 0.09); }

.side-note {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}
.side-note strong { color: var(--ink); font-size: 14px; }
.side-note a { color: #1d4ed8; overflow-wrap: anywhere; font-weight: 750; }

.page {
  width: min(100% - 360px, 1040px);
  margin-left: 328px;
  padding: 28px 0 90px;
}

.breadcrumb, .kicker {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.doc-intro {
  margin-top: 0;
  padding: 30px 36px;
}
.doc-intro h1 {
  margin: 0;
  font-size: clamp(32px, 4.8vw, 50px);
  line-height: 1.12;
  letter-spacing: 0;
}
.lead { max-width: 860px; margin: 14px 0 0; color: var(--muted); font-size: 16px; }
.doc-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}
.doc-meta > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.doc-meta dt { color: var(--muted); font-size: 12px; font-weight: 800; }
.doc-meta dd { margin: 6px 0 0; color: var(--ink); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.doc-meta a { color: #1d4ed8; }

.source-note,
.missing-note {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.source-note strong { display: block; }
.source-note p, .missing-note { color: var(--muted); }

.number-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}
.number-list.tight { margin-top: 8px; }
.number-list li { margin: 10px 0; }
.number-list strong { color: var(--ink); }

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.image-grid.single { grid-template-columns: 1fr; }
.image-grid figure {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.image-grid img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}
.image-grid figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.doc-section {
  margin-top: 24px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: none;
  scroll-margin-top: 20px;
}

.section-head { max-width: 860px; margin-bottom: 22px; }
.section-head.compact { margin-bottom: 0; }
.section-head h2 { margin: 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.08; letter-spacing: 0; }
.section-head p:last-child { margin: 12px 0 0; color: var(--muted); }

.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.intro-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}
.intro-card strong { display: block; font-size: 14px; }
.intro-card p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.cards { display: grid; gap: 14px; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: none;
}
.card h3 { margin: 8px 0 8px; font-size: 21px; line-height: 1.2; }
.card p { color: var(--muted); margin: 8px 0 0; }
.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(0, 143, 141, 0.1);
  font-size: 12px;
  font-weight: 820;
}

.endpoint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.endpoint code { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.endpoint button, pre button.copy-code {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  color: var(--ink);
  font-weight: 760;
}
.endpoint button { padding: 6px 9px; }

.table-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); min-width: 720px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-soft); font-size: 13px; }
td { color: var(--muted); font-size: 14px; }
td:first-child { color: var(--ink); font-weight: 760; }
tr:last-child td { border-bottom: 0; }

pre {
  position: relative;
  margin: 14px 0 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: #111827;
  line-height: 1.65;
  font-size: 13px;
}
pre button.copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
}
pre code { white-space: pre; }
p code, li code, td code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
  font-size: 0.92em;
}

.callout {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(0, 143, 141, 0.24);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: rgba(0, 143, 141, 0.08);
}
.callout.warn { border-color: rgba(214, 146, 32, 0.32); border-left-color: var(--amber); background: rgba(214, 146, 32, 0.09); }
.callout strong { display: block; }
.callout p { margin: 6px 0 0; color: var(--muted); }

.steps { display: grid; gap: 14px; }
.step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.step > span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--primary-2);
  background: rgba(36, 107, 254, 0.1);
  font-weight: 860;
}
.step h3 { margin: 0; font-size: 20px; }
.step p { margin: 7px 0 0; color: var(--muted); }
.steps.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.doc-list { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }
.doc-list li { margin: 7px 0; }

.mock-screen {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(16, 28, 50, 0.08);
}
.window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.window-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.window-bar span:nth-child(2) { background: var(--amber); }
.window-bar span:nth-child(3) { background: var(--green); }
.terminal-lines { display: grid; gap: 8px; padding: 18px; background: #09111f; color: #e9f4ff; }
.terminal-lines code { color: inherit; }
.settings-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: 0; }
.settings-row b { color: var(--ink); }
.settings-row span { color: var(--muted); overflow-wrap: anywhere; }

.faq-list { display: grid; gap: 10px; }
details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
summary {
  cursor: pointer;
  padding: 15px 18px;
  color: var(--ink);
  font-weight: 800;
}
details p { margin: 0; padding: 0 18px 14px; color: var(--muted); }
details pre { margin: 0 18px 18px; }

.toc {
  position: fixed;
  top: 34px;
  right: 28px;
  width: 208px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  backdrop-filter: blur(18px);
  color: var(--muted);
}
.toc strong { display: block; margin-bottom: 10px; color: var(--ink); }
.toc a {
  display: block;
  padding: 6px 0;
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 13px;
}
.toc a.active { color: #0f3fbf; font-weight: 800; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

.mobile-menu { display: none; }

@media (max-width: 1340px) {
  .toc { display: none; }
  .page { width: calc(100% - 340px); margin-right: 24px; }
}

@media (max-width: 980px) {
  .mobile-menu {
    position: fixed;
    left: 14px;
    top: 14px;
    z-index: 40;
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-weight: 800;
  }
  .sidebar {
    transform: translateX(-105%);
    transition: transform 180ms ease;
    width: min(86vw, 320px);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .page { width: min(100% - 28px, 980px); margin: 0 auto; padding-top: 66px; }
  .doc-meta, .intro-grid, .cards.two, .cards.three, .steps.compact { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .doc-intro, .doc-section { padding: 22px; border-radius: 14px; }
  .doc-intro h1 { font-size: clamp(34px, 10vw, 48px); }
  .image-grid { grid-template-columns: 1fr; }
  .step { grid-template-columns: 1fr; }
  .settings-row { grid-template-columns: 1fr; gap: 4px; }
  .endpoint { align-items: stretch; flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
  }
  body {
    background:
      linear-gradient(90deg, rgba(8, 17, 31, 0.04) 1px, transparent 1px),
      linear-gradient(180deg, rgba(8, 17, 31, 0.035) 1px, transparent 1px),
      linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  }
  .sidebar, .toc { background: rgba(255, 255, 255, 0.86); }
  p code, li code, td code { background: rgba(9, 17, 31, 0.07); color: var(--ink); }
}
