:root {
  color-scheme: dark;
  --background: #000000;
  --surface: #08080a;
  --surface-muted: #0d0d10;
  --surface-raised: #121216;
  --surface-hover: #17171c;
  --foreground: #f2f2f3;
  --card-foreground: #e5e5e7;
  --muted-foreground: #8f8f96;
  --subtle-foreground: #626269;
  --border: #1d1d22;
  --border-strong: #313139;
  --primary: #eeeef0;
  --primary-hover: #ffffff;
  --secondary-accent: #8d6ad8;
  --success: #73c993;
  --warning: #d6b66a;
  --destructive: #e27d7d;
  --code-background: #0b0b0e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --font-sans:
    Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI",
    sans-serif;
  --font-mono:
    "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--background);
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

::selection {
  color: #111114;
  background: #e5e5e7;
}

a {
  color: inherit;
}

main a:not(.button):not(.card) {
  color: #b7a1e8;
  text-decoration: none;
  text-underline-offset: 3px;
}

main a:not(.button):not(.card):hover {
  color: #d1c2f5;
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--secondary-accent);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  max-width: 1000px;
  margin: 12px auto 0;
  border: 1px solid #1a1a1f;
  border-radius: 16px;
  background: rgba(5, 5, 7, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 14px 0 16px;
}

.brand {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: max-content;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: contain;
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title strong {
  color: var(--card-foreground);
  font-size: 13px;
  font-weight: 650;
}

.brand-title span {
  margin-top: 3px;
  color: var(--subtle-foreground);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  gap: 2px;
  align-items: center;
}

.topnav a,
.button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.topnav a:hover,
.button:hover {
  border-color: var(--border);
  color: var(--foreground);
  background: var(--surface-hover);
}

.topnav a:active,
.button:active {
  transform: translateY(1px);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--foreground);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.menu-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.menu-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 10px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.menu-icon::after {
  position: absolute;
  top: 4px;
  left: 0;
  width: 14px;
  border-top: 1px solid currentColor;
  content: "";
}

.drawer-backdrop,
.drawer-close {
  display: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  white-space: nowrap;
  cursor: pointer;
}

.button.primary {
  border-color: var(--primary);
  color: #101014;
  background: var(--primary);
  box-shadow: none;
}

.button.primary:hover {
  border-color: var(--primary-hover);
  color: #101014;
  background: var(--primary-hover);
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 42px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 16px 96px;
}

.sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  padding: 5px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--subtle-foreground);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-title::before {
  display: block;
  width: 11px;
  height: 11px;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.8;
  content: "";
}

.sidebar a {
  display: block;
  margin: 1px 0;
  border-left: 1px solid transparent;
  padding: 5px 10px;
  color: #6d6d74;
  font-size: 12px;
  line-height: 1.45;
  text-decoration: none;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.sidebar a:hover,
.sidebar a.active {
  border-left-color: #9474d4;
  color: var(--card-foreground);
  background: rgba(141, 106, 216, 0.07);
}

main {
  min-width: 0;
  max-width: 738px;
}

.hero {
  position: relative;
  padding: 20px 0 18px;
}

.hero::after {
  display: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--subtle-foreground);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.25;
}

h1 {
  max-width: 720px;
  margin: 0 0 16px;
  color: var(--foreground);
  font-size: 38px;
  font-weight: 650;
}

h2 {
  margin: 0 0 13px;
  color: var(--card-foreground);
  font-size: 24px;
  font-weight: 650;
}

h3 {
  margin: 24px 0 10px;
  color: var(--card-foreground);
  font-size: 18px;
  font-weight: 600;
}

p {
  margin: 0 0 15px;
}

.lead {
  max-width: 680px;
  margin: 0;
  color: var(--muted-foreground);
  font-size: 15px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

main {
  counter-reset: docs-section;
}

section {
  scroll-margin-top: 88px;
  margin-top: 52px;
  border-bottom: 1px solid #151519;
  padding-bottom: 44px;
}

section:not(.hero) {
  counter-increment: docs-section;
}

section:not(.hero) > h2::before {
  display: block;
  margin-bottom: 9px;
  color: var(--subtle-foreground);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  content: counter(docs-section, decimal-leading-zero) "  ·";
}

section:last-child {
  border-bottom: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  display: block;
  position: relative;
  min-height: 106px;
  overflow: hidden;
  scroll-margin-top: 88px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  transform: translateY(-1px);
}

.card strong {
  display: block;
  margin-bottom: 7px;
  color: var(--card-foreground);
  font-size: 14px;
  line-height: 1.35;
}

.muted {
  color: var(--muted-foreground);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--muted-foreground);
  background: var(--surface);
  font-size: 11px;
}

.pill:hover {
  border-color: #5d477f;
  color: var(--foreground);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #19191e;
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--subtle-foreground);
  background: var(--surface-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td {
  color: var(--muted-foreground);
  font-size: 13px;
}

tbody tr {
  transition: background-color 140ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

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

code,
pre {
  font-family: var(--font-mono);
}

code {
  border: 1px solid #292930;
  border-radius: 4px;
  padding: 2px 5px;
  background: #111116;
  color: #c9b9ed;
  font-size: 0.88em;
}

.code-block {
  position: relative;
  margin: 15px 0 21px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-background);
  box-shadow: none;
}

.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #19191e;
  padding: 9px 12px;
  color: var(--subtle-foreground);
  font-family: var(--font-mono);
  font-size: 10px;
}

pre {
  margin: 0;
  overflow-x: auto;
  padding: 16px 18px;
  color: #d7d7dc;
  font-size: 12px;
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

pre code {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.copy {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 7px;
  color: var(--muted-foreground);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-family: var(--font-sans);
  font-size: 10px;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.copy:hover {
  border-color: var(--border-strong);
  color: var(--foreground);
  background: var(--surface-hover);
}

.callout {
  border: 1px solid #2a2534;
  border-radius: 6px;
  padding: 14px 15px;
  background: #0d0b12;
  color: #bcb1d0;
}

.doc-article {
  min-width: 0;
}

.doc-header {
  border-bottom: 1px solid #151519;
  padding: 20px 0 32px;
}

.doc-header h1 {
  margin-bottom: 13px;
}

.doc-status {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 13px 15px;
  background: var(--surface);
  color: var(--muted-foreground);
}

.doc-content {
  padding-top: 9px;
}

.doc-content p {
  color: var(--muted-foreground);
}

.doc-content h2 {
  margin-top: 34px;
}

.doc-content h3 {
  margin-top: 26px;
}

.doc-content h4 {
  margin: 21px 0 9px;
  color: var(--card-foreground);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.doc-content .table-wrap {
  margin: 15px 0 21px;
}

.doc-content ul {
  margin: 0 0 15px;
  padding-left: 21px;
  color: var(--muted-foreground);
}

.doc-content a {
  color: #b7a1e8;
  text-decoration: none;
}

.doc-content a:hover {
  color: #d1c2f5;
  text-decoration: underline;
}

ol {
  margin: 0;
  padding-left: 21px;
  color: var(--muted-foreground);
}

li {
  padding-left: 4px;
}

li + li {
  margin-top: 6px;
}

.ok {
  color: var(--success);
}

.warn {
  color: var(--warning);
}

.bad {
  color: var(--destructive);
}

.footer {
  max-width: 1000px;
  margin: 0 auto;
  border-top: 1px solid #151519;
  padding: 22px 16px 28px;
  color: var(--subtle-foreground);
  font-size: 11px;
}

@media (max-width: 1000px) {
  .topbar {
    margin-right: 16px;
    margin-left: 16px;
  }

  .topnav {
    display: none;
  }

  .layout {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 32px;
  }

  h1 {
    font-size: 34px;
  }
}

@media (max-width: 760px) {
  .topbar {
    top: 8px;
    margin-top: 8px;
    border-radius: 12px;
  }

  .topbar-inner {
    padding: 0 10px 0 12px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .layout {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 28px 16px 64px;
  }

  main {
    order: 2;
  }

  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: block;
    width: 100%;
    height: min(72dvh, 560px);
    max-height: 72dvh;
    margin: 0;
    border-top: 1px solid var(--border-strong);
    padding: 66px 16px calc(24px + env(safe-area-inset-bottom));
    background: #09090b;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.46);
    transform: translateY(105%);
    transition: transform 180ms ease;
  }

  body.drawer-open {
    overflow: hidden;
  }

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

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.drawer-open .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .drawer-close {
    position: absolute;
    top: 13px;
    right: 14px;
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--muted-foreground);
    background: var(--surface);
    cursor: pointer;
    font: inherit;
    font-size: 20px;
    line-height: 1;
  }

  .drawer-close:hover {
    border-color: var(--border-strong);
    color: var(--foreground);
    background: var(--surface-hover);
  }

  .sidebar-title {
    padding-right: 42px;
  }

  .sidebar a {
    display: block;
    width: auto;
    margin: 2px 0;
  }

  .hero {
    padding: 16px 0 8px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 22px;
  }

  .lead {
    font-size: 14px;
  }

  .hero-actions {
    gap: 7px;
  }

  .button {
    width: 100%;
  }

  section {
    margin-top: 42px;
    padding-bottom: 36px;
  }

  .grid,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .footer {
    padding: 20px 16px 24px;
  }
}

@media (max-width: 420px) {
  .brand-title span {
    display: none;
  }

  h1 {
    font-size: 29px;
  }

  h2 {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
