:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f8f9fb;
  --bg-muted: #f2f4f8;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-soft: #4f5565;
  --text-muted: #7b8494;
  --border: #e5e7eb;
  --brand: #5b7cfa;
  --brand-strong: #4165e8;
  --brand-soft: #edf1ff;
  --code-bg: #f6f8fa;
  --shadow: 0 8px 24px rgba(30, 41, 59, 0.08);
  --sidebar-width: 280px;
  --content-width: 860px;
  --radius: 8px;
}

html.dark {
  color-scheme: dark;
  --bg: #171923;
  --bg-soft: #11131c;
  --bg-muted: #202433;
  --surface: #1c2030;
  --text: #f3f5f9;
  --text-soft: #c8cedb;
  --text-muted: #929aad;
  --border: #2c3347;
  --brand: #8ea2ff;
  --brand-strong: #a7b6ff;
  --brand-soft: rgba(115, 135, 255, 0.18);
  --code-bg: #131722;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
}

button,
input {
  font: inherit;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-strong);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

html.dark ::-webkit-scrollbar-thumb {
  background: #5b6478;
  border: 3px solid transparent;
  background-clip: content-box;
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px 0;
  background: var(--text);
  border-radius: 999px;
}

.overlay {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: transform 0.22s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 70px;
  padding: 0 16px 0 22px;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.2;
}

.logo-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6d7df, #dce6ff);
  color: #4057c9;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.theme-toggle {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-wrap {
  position: relative;
  padding: 12px 16px 18px;
}

.search-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 0 13px;
  font-size: 14px;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.02);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.search-results {
  display: none;
  position: absolute;
  top: 52px;
  right: 16px;
  left: 16px;
  z-index: 80;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 6px;
}

.search-results.open {
  display: block;
}

.search-result {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 8px 9px;
}

.search-result:hover,
.search-result:focus {
  background: var(--brand-soft);
  outline: none;
}

.search-result strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

.search-result span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.sidebar-nav {
  padding-bottom: 28px;
}

.nav-group {
  margin-top: 6px;
}

.nav-title {
  padding: 16px 24px 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 24px 6px 31px;
  border-left: 3px solid transparent;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}

.nav-link:hover {
  background: rgba(91, 124, 250, 0.06);
  color: var(--brand);
}

.nav-link.active {
  border-left-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.nav-link.external-link {
  justify-content: space-between;
  padding-right: 22px;
}

.nav-link.external-link span {
  color: var(--text-muted);
  font-size: 14px;
}

.content {
  width: min(var(--content-width), calc(100vw - var(--sidebar-width) - 64px));
  margin-left: calc(var(--sidebar-width) + max(32px, (100vw - var(--sidebar-width) - var(--content-width)) / 2));
  padding: 48px 0 82px;
  outline: none;
}

.doc-page {
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-page h1 {
  margin: 0 0 11px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.doc-lead {
  margin: 18px 0 28px;
  color: var(--text-soft);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.85;
}

.doc-page h2 {
  margin: 42px 0 14px;
  color: var(--text);
  font-size: 26px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0;
}

.doc-page h3 {
  margin: 22px 0 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: 0;
}

.doc-page p {
  margin: 10px 0 16px;
  color: var(--text-soft);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 26px 0 36px;
}

.feature-card {
  min-height: 170px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 21px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.feature-card:hover {
  border-color: rgba(91, 124, 250, 0.34);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  transition: 0.16s ease;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 22px;
  font-weight: 650;
}

.feature-card h3 {
  margin: 0 0 9px;
  font-size: 17px;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
}

.table-wrap {
  overflow: auto;
  margin: 13px 0 28px;
  border: 1px solid var(--border);
  border-radius: 0;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 11px 13px;
  color: var(--text-soft);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--bg-muted);
  color: var(--text);
  font-weight: 600;
}

.link-table td:first-child,
.compact-table td:first-child {
  width: 30%;
  color: var(--text-soft);
  font-weight: 500;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 2px 4px 2px 0;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.callout {
  margin: 18px 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: var(--surface);
  padding: 15px 17px;
}

.callout.warning {
  border-left-color: #f0b429;
}

.callout strong {
  color: var(--text);
}

.code-block {
  position: relative;
  margin: 16px 0 26px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code-bg);
}

.code-title {
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
}

pre {
  margin: 0;
  padding: 15px 16px;
  overflow: auto;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.steps {
  display: grid;
  gap: 14px;
  margin: 18px 0 30px;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
}

.step-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  font-weight: 650;
}

.step h3 {
  margin-top: 1px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 15px 0 24px;
}

.empty-state {
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: 58px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 1040px) {
  .content {
    width: calc(100vw - var(--sidebar-width) - 64px);
    margin-left: calc(var(--sidebar-width) + 32px);
  }
}

@media (max-width: 780px) {
  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(15, 23, 42, 0.34);
  }

  .content {
    width: min(100% - 36px, 760px);
    margin: 0 auto;
    padding-top: 78px;
  }

  .doc-page h1 {
    font-size: 30px;
  }

  .doc-lead {
    font-size: 16px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .sidebar {
    width: min(86vw, var(--sidebar-width));
  }

  .content {
    width: calc(100% - 28px);
    padding-bottom: 56px;
  }

  .doc-page h1 {
    font-size: 28px;
  }

  .doc-page h2 {
    font-size: 23px;
  }

  th,
  td {
    padding: 10px 11px;
  }
}
