:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1a1d24;
  --muted: #5c6570;
  --line: #e2e5ea;
  --accent: #0b6e4f;
  --accent-soft: #e6f4ef;
  --code-bg: #0f1419;
  --code-ink: #e8eef4;
  --method-post: #0b6e4f;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 10px;
  --sidebar-w: 260px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 15px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus { left: 8px; }

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 14px; line-height: 1.2; }
.brand-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-actions { margin-left: auto; }
#search {
  width: min(240px, 42vw);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font: inherit;
}
#search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
}

.shell { display: flex; min-height: calc(100vh - 57px); }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 12px 32px;
  overflow-y: auto;
  max-height: calc(100vh - 57px);
  position: sticky;
  top: 57px;
}
.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px 6px;
}
.nav-link {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
}
.nav-link:hover { background: var(--bg); }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.hidden { display: none; }

.main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 48px;
  width: 100%;
}
.content {
  width: 100%;
  max-width: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px 40px;
  box-shadow: var(--shadow);
}
.content.wide {
  max-width: none;
}
.page-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.95fr);
  gap: 24px;
  align-items: start;
}
.doc-body { min-width: 0; }
.code-panel {
  position: sticky;
  top: 12px;
  border: 1px solid #243041;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 20, 25, 0.18);
  min-height: 520px;
}
.code-panel-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 0;
  border-bottom: 1px solid #2a3648;
}
.code-panel-head > span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #9fb0c3;
}
.lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: 10px;
}
.lang-tabs button {
  border: 0;
  background: transparent;
  color: #9fb0c3;
  font: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.lang-tabs button:hover { background: #1a2433; color: #e8eef4; }
.lang-tabs button.active {
  background: #243447;
  color: #fff;
  font-weight: 600;
}
.lang-pane { display: none; }
.lang-pane.active { display: block; }
.code-panel pre.code {
  margin: 0;
  border-radius: 0;
  background: transparent;
  max-height: min(78vh, 860px);
  min-height: 420px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.55;
  padding: 16px 18px;
}
.code-panel-note {
  margin: 0;
  padding: 10px 14px 14px;
  font-size: 12px;
  color: #8a9bb0;
  border-top: 1px solid #2a3648;
}
.content h1 { margin: 0 0 16px; font-size: 1.75rem; letter-spacing: -0.02em; }
.content h2 { margin: 28px 0 12px; font-size: 1.2rem; padding-top: 8px; border-top: 1px solid var(--line); }
.content h2:first-of-type { border-top: 0; padding-top: 0; }
.content h3 { margin: 20px 0 8px; font-size: 1.05rem; }
.content h4 { margin: 16px 0 8px; font-size: 0.95rem; }
.content p { margin: 0 0 12px; color: var(--ink); }
.content .muted, .muted { color: var(--muted); }
.content ul, .content ol { margin: 0 0 14px; padding-left: 1.35em; }
.content li { margin: 4px 0; }
.content blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 0 8px 8px 0;
}
.content code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: #eef1f4;
  padding: 1px 5px;
  border-radius: 4px;
}
.content pre.code {
  margin: 12px 0 16px;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
}
.content pre.code code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.table-wrap { overflow-x: auto; margin: 12px 0 18px; }
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.content th, .content td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.content th { background: var(--bg); font-weight: 600; }

.api-card {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfcfd, #f3f5f7);
}
.api-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.api-meta code { font-size: 14px; background: transparent; }
.api-meta-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.api-meta-row span { min-width: 96px; }
.method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--method-post);
}
.method.get { background: #1d4f91; }

.backdrop {
  display: none;
  position: fixed;
  inset: 57px 0 0;
  background: rgba(16, 24, 40, 0.35);
  z-index: 30;
}

@media (max-width: 1280px) {
  .page-split {
    grid-template-columns: 1fr;
  }
  .code-panel {
    position: relative;
    top: 0;
    min-height: 0;
  }
  .code-panel pre.code {
    min-height: 280px;
    max-height: 70vh;
  }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 57px;
    bottom: 0;
    z-index: 35;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    max-height: none;
    box-shadow: 8px 0 24px rgba(16, 24, 40, 0.12);
  }
  .sidebar.open { transform: translateX(0); }
  .backdrop.show { display: block; }
  .main { padding: 18px 14px 48px; }
  .content { padding: 20px 16px 28px; }
  .brand-text span { display: none; }
}
