:root {
  color-scheme: light;
  --page-bg: #f8fafc;
  --panel-bg: #ffffff;
  --panel-muted: #f1f5f9;
  --line: #e5e7eb;
  --line-strong: #d7dee8;
  --text: #1f2937;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --brand-blue: #4a6cf7;
  --brand-blue-soft: rgba(74, 108, 247, 0.1);
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.12);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --nav-height: 64px;
  --sidebar-width: 300px;
  --toc-width: 250px;
  --content-width: 860px;
  --mono: "SFMono-Regular", "SF Mono", "Cascadia Code", "Consolas", monospace;
  --sans:
    system-ui, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #0b1220;
  --panel-bg: #111827;
  --panel-muted: #0f172a;
  --line: #1f2937;
  --line-strong: #263347;
  --text: #e5edf7;
  --muted: #93a4b8;
  --muted-strong: #c7d2e3;
  --brand-blue: #7da2ff;
  --brand-blue-soft: rgba(125, 162, 255, 0.14);
  --success: #7ee3a5;
  --success-soft: rgba(126, 227, 165, 0.16);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

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

[hidden] {
  display: none;
}

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

:root[data-theme="dark"] .docs-topbar {
  background: rgba(11, 18, 32, 0.9);
}

.docs-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.docs-brand img {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
}

:root[data-theme="dark"] .docs-brand img {
  filter: brightness(0) saturate(100%) invert(93%);
}

.docs-brand-accent {
  color: var(--brand-blue);
}

.docs-topnav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
  font-size: 0.96rem;
  color: var(--muted-strong);
}

.docs-topnav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-strong);
}

.docs-topnav a:hover {
  color: var(--brand-blue);
}

.docs-topnav svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.docs-search-shell {
  position: relative;
  width: min(360px, 100%);
}

.docs-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  color: var(--muted);
}

.docs-search:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--brand-blue-soft);
}

.docs-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.docs-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
}

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

.docs-search-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
}

.docs-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.docs-search-results-list {
  display: grid;
}

.docs-search-result {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.docs-search-result:last-child {
  border-bottom: none;
}

.docs-search-result:hover {
  background: var(--brand-blue-soft);
}

.docs-search-result strong {
  color: var(--text);
  font-size: 0.94rem;
}

.docs-search-result-meta,
.docs-search-empty {
  color: var(--muted);
  font-size: 0.82rem;
}

.docs-search-empty {
  padding: 14px;
}

.docs-theme-toggle {
  border: 1px solid var(--line);
  background: var(--panel-bg);
  color: var(--muted-strong);
  border-radius: 12px;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
}

.docs-frame {
  display: grid;
  grid-template-columns: minmax(240px, var(--sidebar-width)) minmax(
      0,
      var(--content-width)
    ) minmax(190px, var(--toc-width));
  gap: 0;
  align-items: start;
  max-width: 1560px;
  margin: 0 auto;
}

.docs-sidebar,
.docs-main,
.docs-toc {
  min-height: calc(100vh - var(--nav-height));
}

.docs-sidebar {
  position: sticky;
  top: var(--nav-height);
  max-height: calc(100vh - var(--nav-height));
  overflow: auto;
  padding: 22px 18px 28px;
  background: var(--panel-muted);
  border-right: 1px solid var(--line);
}

.docs-main {
  padding: 24px 40px 56px;
  background: var(--panel-bg);
  min-width: 0;
}

.docs-toc {
  position: sticky;
  top: var(--nav-height);
  max-height: calc(100vh - var(--nav-height));
  overflow: auto;
  padding: 24px 20px 32px;
  border-left: 1px solid var(--line);
  background: var(--panel-bg);
}

.docs-nav {
  display: grid;
  gap: 18px;
}

.docs-nav-group {
  display: grid;
  gap: 4px;
}

.docs-nav-group h2,
.docs-toc-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.docs-nav-link,
.docs-toc-link {
  display: block;
  border-radius: 10px;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.docs-nav-link {
  padding: 8px 12px;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.docs-nav-link:hover,
.docs-toc-link:hover {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
}

.docs-nav-link.is-active {
  background: var(--panel-bg);
  color: var(--brand-blue);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 0 0 1px var(--line);
  font-weight: 600;
}

.docs-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.docs-page-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  margin-top: -6px;
}

.docs-page-action,
.docs-page-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-bg);
  color: var(--muted-strong);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
  white-space: nowrap;
}

.docs-page-action:hover,
.docs-page-source-link:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: var(--brand-blue-soft);
  text-decoration: none;
}

.docs-page-action.is-copied {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
}

.docs-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.docs-breadcrumb-item a:hover {
  color: var(--brand-blue);
}

.docs-breadcrumb-separator {
  margin-left: 6px;
  color: var(--line-strong);
}

.docs-article {
  max-width: 860px;
}

.docs-content h1,
.docs-content h2,
.docs-content h3,
.docs-content h4 {
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.15;
  scroll-margin-top: 88px;
}

.docs-content h1 {
  margin: 0 0 20px;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
}

.docs-content h2 {
  margin: 56px 0 18px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.docs-content h3 {
  margin: 32px 0 14px;
  font-size: 1.35rem;
}

.docs-content h4 {
  margin: 24px 0 12px;
  font-size: 1.05rem;
}

.docs-content p,
.docs-content ul,
.docs-content ol,
.docs-content pre,
.docs-content table,
.docs-content blockquote {
  margin: 0 0 18px;
}

.docs-content ul,
.docs-content ol {
  padding-left: 1.5rem;
}

.docs-content li + li {
  margin-top: 0.3rem;
}

.docs-content a {
  color: var(--brand-blue);
}

.docs-content a:hover {
  text-decoration: underline;
}

.docs-anchor-link {
  color: inherit;
}

.docs-content code {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 0.92em;
}

.docs-content pre {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.docs-content pre code {
  display: inline;
  padding: 0;
  border: none;
  background: transparent;
}

.docs-content blockquote {
  padding-left: 16px;
  border-left: 3px solid var(--brand-blue);
  color: var(--muted-strong);
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.docs-content th,
.docs-content td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.docs-content tr:last-child td {
  border-bottom: none;
}

.docs-content img {
  border-radius: 18px;
  border: 1px solid var(--line);
}

.docs-toc-links {
  display: grid;
  gap: 2px;
}

.docs-toc-link {
  padding: 6px 0;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.docs-toc-link-level-3 {
  padding-left: 16px;
}

.docs-toc-link-level-4 {
  padding-left: 32px;
}

.docs-toc-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1200px) {
  .docs-frame {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 920px) {
  .docs-topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px 16px;
  }

  .docs-topnav {
    justify-content: flex-start;
  }

  .docs-search-shell {
    width: 100%;
  }

  .docs-frame {
    display: block;
  }

  .docs-sidebar {
    position: static;
    min-height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .docs-main {
    min-height: auto;
    padding: 22px 18px 48px;
  }

  .docs-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .docs-page-actions {
    margin-top: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .docs-page-action,
  .docs-page-source-link {
    width: 100%;
  }

  .docs-page-actions {
    display: grid;
  }
}
