:root {
  --brand: #1577ff;
  --brand-strong: #075bd3;
  --brand-soft: #edf4ff;
  --ink: #111d32;
  --muted: #66758c;
  --line: #e1e8f1;
  --soft: #f6f8fc;
  --surface: #ffffff;
  --code: #111c30;
  --code-line: #283a57;
  --success: #16825e;
  --warning: #d96c2f;
  --danger: #d84a43;
  --shadow: 0 16px 50px rgba(19, 54, 109, .12);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
}

:root[data-theme="dark"] {
  --brand: #72a9ff;
  --brand-strong: #9cc2ff;
  --brand-soft: #172b4b;
  --ink: #eaf1ff;
  --muted: #a5b4cb;
  --line: #2a3b56;
  --soft: #172238;
  --surface: #0d1524;
  --code: #09111f;
  --code-line: #283a57;
  --shadow: 0 16px 50px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { outline: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.app { min-height: 100vh; }

.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: 70px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 700;
}
.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg, #ff7651, #ff4f32);
  box-shadow: 0 6px 18px rgba(255, 91, 57, .22);
  font-size: 14px;
  font-weight: 800;
}
.brand b {
  margin-left: 2px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.main-nav {
  height: 100%;
  margin-left: 62px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.main-nav a {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
}
.main-nav a:hover, .main-nav a.active { color: var(--ink); }
.main-nav a.active::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: -1px;
  height: 2px;
  background: var(--brand);
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-trigger {
  width: 220px;
  height: 38px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--soft);
  cursor: pointer;
}
.search-trigger span:nth-child(2) { flex: 1; text-align: left; }
kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
}
.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}
.icon-button:hover { color: var(--brand); border-color: var(--brand); }

.subnav {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  z-index: 35;
  height: 50px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 36px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.subnav a { color: var(--muted); font-size: 14px; }
.subnav a:hover, .subnav a.active { color: var(--brand); font-weight: 600; }

.workspace {
  min-height: 100vh;
  padding-top: 120px;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 210px;
}
.sidebar {
  position: fixed;
  top: 120px;
  bottom: 0;
  left: 0;
  z-index: 25;
  width: 270px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar-head {
  height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
}
.sidebar-head small { letter-spacing: 0; font-weight: 400; }
.side-search {
  height: 36px;
  margin: 0 14px 14px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--soft);
}
.side-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}
.nav-tree { flex: 1; padding: 0 10px 18px; overflow-y: auto; }
.nav-group { margin-bottom: 7px; }
.group-title {
  height: 40px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.group-title small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
.group-items { margin-left: 16px; padding: 2px 0 5px 17px; border-left: 1px solid var(--line); }
.group-items a {
  min-height: 38px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
}
.group-items a:hover { color: var(--ink); background: var(--soft); }
.group-items a.selected { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.method-mini {
  width: 42px;
  flex: 0 0 42px;
  font-family: Consolas, monospace;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}
.method-mini.post { color: var(--warning); }
.method-mini.guide, .method-mini.callback { color: var(--brand); }
.sidebar-foot {
  height: 48px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.status-dot {
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #3cb879;
  box-shadow: 0 0 0 3px rgba(60, 184, 121, .16);
}

.doc-main { grid-column: 2; min-width: 0; padding: 0 64px 80px; }
.doc-main article { max-width: 1020px; margin: 0 auto; }
.breadcrumbs {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.breadcrumbs .current { color: var(--ink); }
.hero-section { padding: 42px 0 30px; }
.eyebrow {
  color: var(--brand);
  font-family: Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
}
.eyebrow span {
  margin-left: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--brand-soft);
  letter-spacing: 0;
}
.hero-section h1 {
  margin: 12px 0 10px;
  font-size: 38px;
  line-height: 1.25;
  letter-spacing: -.035em;
}
.hero-section > p { margin: 0 0 26px; color: var(--muted); font-size: 16px; }
.endpoint-bar {
  min-height: 58px;
  padding: 8px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 7px rgba(18, 52, 102, .04);
}
.method-badge {
  margin-right: 11px;
  padding: 6px 9px;
  border-radius: 5px;
  font-family: Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}
.method-badge.post { color: #ce642a; background: #fff1e8; }
.method-badge.guide, .method-badge.callback { color: var(--brand); background: var(--brand-soft); }
.endpoint-bar code {
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  font-family: Consolas, monospace;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-endpoint {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}
.copy-endpoint:hover { color: var(--brand); }
.meta { margin-top: 14px; display: flex; gap: 9px; color: var(--muted); font-size: 13px; }
.meta i { width: 2px; height: 2px; align-self: center; border-radius: 50%; background: var(--muted); }

.doc-section { padding: 32px 0; scroll-margin-top: 135px; }
.doc-section + .doc-section { border-top: 1px solid var(--line); }
.doc-section h2 { margin: 0 0 18px; font-size: 26px; letter-spacing: -.02em; }
.doc-section h3 { margin: 28px 0 14px; font-size: 20px; }
.doc-section p, .doc-section li { color: var(--muted); font-size: 16px; line-height: 1.95; }
.doc-section ul, .doc-section ol { padding-left: 24px; }
.doc-section code, .toc code { color: var(--brand); font-family: Consolas, monospace; font-size: .9em; }
.note {
  margin: 20px 0;
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-left: 3px solid var(--brand);
  border-radius: 0 7px 7px 0;
  color: var(--muted);
  background: var(--brand-soft);
  font-size: 14px;
  line-height: 1.75;
}
.note b { color: var(--brand); }
.note.warning { border-left-color: #dd832d; background: #fff8ed; }
:root[data-theme="dark"] .note.warning { background: #302618; }
.note.warning b { color: #c77826; }
.flow {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.flow div { position: relative; padding: 18px 14px; border-right: 1px solid var(--line); }
.flow div:last-child { border: 0; }
.flow small { display: block; margin-bottom: 6px; color: var(--brand); font-family: Consolas, monospace; }
.flow strong { display: block; font-size: 14px; }
.flow span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.table-wrap { margin: 14px 0 26px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--soft); text-align: left; font-weight: 600; }
td { padding: 14px; border-bottom: 1px solid var(--line); color: var(--muted); line-height: 1.7; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td code { color: var(--brand); font-family: Consolas, monospace; font-size: 12px; }
.required { color: var(--danger); font-weight: 700; }

.code-card { margin: 14px 0 26px; overflow: hidden; border-radius: 8px; color: #d7e6fc; background: var(--code); box-shadow: 0 8px 24px rgba(9, 29, 65, .18); }
.code-head {
  height: 45px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--code-line);
  color: #9badc6;
  font-size: 12px;
}
.code-copy { border: 0; color: #9badc6; background: transparent; cursor: pointer; }
.code-copy:hover { color: #fff; }
pre { margin: 0; padding: 20px; overflow: auto; font-size: 13px; line-height: 1.8; }
pre code { color: #d7e6fc !important; font-family: Consolas, "IBM Plex Mono", monospace !important; white-space: pre; }

.doc-pagination { margin: 48px 0 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.doc-pagination a {
  min-height: 72px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}
.doc-pagination a:hover { border-color: var(--brand); background: var(--brand-soft); }
.doc-pagination a.next { text-align: right; }
.doc-pagination small { margin-bottom: 5px; color: var(--muted); }

footer {
  margin-top: 42px;
  padding-top: 30px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.footer-brand { font-size: 15px; }
.footer-brand .brand-mark { width: 26px; height: 26px; font-size: 12px; }

.toc {
  position: fixed;
  top: 120px;
  right: 0;
  bottom: 0;
  width: 210px;
  padding: 57px 24px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
}
.toc-label { margin-bottom: 16px; font-size: 13px; font-weight: 700; }
.toc a { display: block; padding: 7px 0 7px 14px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.55; }
.toc a:hover, .toc a.active { color: var(--brand); border-color: var(--brand); }
.toc-help { margin-top: 24px; padding-top: 18px; display: flex; gap: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.toc-help > span { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 18px; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-weight: 700; }
.toc-help p { margin: 0; }

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding-top: 12vh;
  display: flex;
  justify-content: center;
  background: rgba(9, 19, 39, .42);
  backdrop-filter: blur(2px);
}
.search-modal { width: min(620px, calc(100vw - 32px)); height: max-content; max-height: 70vh; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.modal-input { height: 60px; padding: 0 17px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); color: var(--muted); }
.modal-input input { flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 15px; }
.search-results { max-height: 55vh; padding: 8px; overflow-y: auto; }
.search-results a { padding: 11px; display: flex; align-items: center; gap: 10px; border-radius: 6px; }
.search-results a:hover { background: var(--soft); }
.search-results a > span { display: flex; flex-direction: column; gap: 3px; }
.search-results small { color: var(--muted); font-size: 11px; }
.empty-search { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.mobile-only, .drawer-mask { display: none; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr); }
  .sidebar { width: 250px; }
  .toc { display: none; }
  .doc-main { padding: 0 44px 70px; }
  .header, .subnav { padding-left: 22px; padding-right: 22px; }
  .main-nav { margin-left: 40px; gap: 22px; }
  .search-trigger { width: 180px; }
}

@media (max-width: 820px) {
  .mobile-only { display: grid; }
  .header { height: 60px; padding: 0 14px; gap: 10px; }
  .header .brand b, .main-nav, .search-trigger span:nth-child(2), .search-trigger kbd, .subnav { display: none; }
  .header .brand { font-size: 17px; }
  .header-actions { gap: 6px; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
  .workspace { display: block; padding-top: 60px; }
  .sidebar { top: 0; width: min(320px, 86vw); z-index: 80; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-head { height: 60px; }
  .drawer-mask { position: fixed; inset: 0; z-index: 70; background: rgba(8, 19, 39, .38); }
  .drawer-mask.open { display: block; }
  .doc-main { padding: 0 20px 60px; }
  .breadcrumbs { height: 56px; }
  .hero-section { padding-top: 28px; }
  .hero-section h1 { font-size: 32px; }
  .endpoint-bar { align-items: stretch; flex-wrap: wrap; }
  .endpoint-bar code { width: calc(100% - 78px); flex: none; align-self: center; }
  .copy-endpoint { margin: 4px 0 0 auto; }
  .meta { flex-wrap: wrap; }
  .doc-section { padding: 28px 0; scroll-margin-top: 75px; }
  .doc-section h2 { font-size: 25px; }
  .doc-section h3 { font-size: 19px; }
  .doc-section p, .doc-section li { font-size: 15px; line-height: 1.9; }
  .table-wrap { margin-right: -20px; border-radius: 7px 0 0 7px; }
  th, td { padding: 13px 14px; }
  .flow { grid-template-columns: 1fr; }
  .flow div { border-right: 0; border-bottom: 1px solid var(--line); }
  .doc-pagination { grid-template-columns: 1fr; }
  footer { grid-template-columns: 1fr; gap: 12px; }
  .toc { display: none; }
}
