:root {
  color-scheme: dark;
  --sx-page: #000000;
  --sx-surface: #040404;
  --sx-surface-raised: #080808;
  --sx-surface-hover: #0e0e0e;
  --sx-surface-active: #141414;
  --sx-line: #181818;
  --sx-line-strong: #2c2c2c;
  --sx-text: #f5f5f5;
  --sx-text-soft: #c8c8c8;
  --sx-text-muted: #888888;
  --sx-text-faint: #555555;
  --sx-accent: #8b5cf6;
  --sx-accent-glow: rgba(139, 92, 246, 0.15);
  --sx-font: "Onest", "Segoe UI", sans-serif;
  --sx-mono: "JetBrains Mono", "Cascadia Mono", monospace;
  --sx-radius-sm: 8px;
  --sx-radius-md: 10px;
  --sx-radius-lg: 12px;
  --sx-sidebar-w: 270px;
  --sx-toc-w: 210px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--sx-page);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--sx-page);
  color: var(--sx-text-soft);
  font: 13.5px/1.7 var(--sx-font);
  -webkit-font-smoothing: antialiased;
}

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

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--sx-line);
}

.docs-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.docs-brand img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.docs-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: var(--sx-surface-raised);
  border: 1px solid var(--sx-line-strong);
  border-radius: var(--sx-radius-sm);
  color: #e0e0e0;
  font: 10px var(--sx-mono);
  letter-spacing: 0.04em;
}

.docs-topbar-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.docs-nav-link {
  color: var(--sx-text-muted);
  font-size: 12px;
  transition: color 140ms ease;
}

.docs-nav-link:hover {
  color: #ffffff;
}

.docs-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--sx-surface-raised);
  border: 1px solid var(--sx-line-strong);
  border-radius: var(--sx-radius-sm);
  color: var(--sx-text-soft);
  font: 11px var(--sx-mono);
  transition: all 130ms ease;
}

.docs-download-btn:hover {
  background: var(--sx-surface-hover);
  border-color: var(--sx-accent);
  color: #ffffff;
}

.docs-mobile-link.is-accent {
  border-color: rgba(139, 92, 246, 0.4);
  color: #ffffff;
}

.docs-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: var(--sx-surface-raised);
  border: 1px solid var(--sx-line-strong);
  border-radius: var(--sx-radius-sm);
  color: var(--sx-text);
  font: 11px var(--sx-mono);
  cursor: pointer;
}

.docs-layout {
  display: grid;
  grid-template-columns: var(--sx-sidebar-w) minmax(0, 800px) var(--sx-toc-w);
  justify-content: center;
  gap: 40px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 24px 80px;
}

.docs-sidebar {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #222 transparent;
}

.docs-search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.docs-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--sx-surface);
  border: 1px solid var(--sx-line);
  border-radius: var(--sx-radius-sm);
  color: var(--sx-text);
  font: 12px var(--sx-font);
  outline: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.docs-search-input:focus {
  background: var(--sx-surface-raised);
  border-color: var(--sx-accent);
}

.docs-search-input::placeholder {
  color: var(--sx-text-faint);
}

.docs-nav-group-title {
  margin: 12px 6px 6px;
  color: var(--sx-text-faint);
  font: 10px var(--sx-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.docs-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--sx-radius-sm);
  border-left: 2px solid transparent;
  color: var(--sx-text-muted);
  font-size: 12px;
  transition: all 130ms ease;
  user-select: none;
}

.docs-nav-item:hover {
  background: var(--sx-surface-hover);
  color: #e5e5e5;
}

.docs-nav-item.is-active {
  background: var(--sx-surface-raised);
  border-left-color: var(--sx-accent);
  color: #ffffff;
}

.docs-nav-num {
  font: 10px var(--sx-mono);
  color: var(--sx-text-faint);
}

.docs-nav-item.is-active .docs-nav-num {
  color: var(--sx-accent);
}

.docs-main {
  min-width: 0;
}

.doc-article-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--sx-line);
}

.doc-kicker {
  color: var(--sx-text-muted);
  font: 10px var(--sx-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.doc-h1 {
  margin: 10px 0 6px;
  color: #ffffff;
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.doc-h2 {
  position: relative;
  margin: 40px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--sx-line);
  color: #f0f0f0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.doc-h3 {
  position: relative;
  margin: 26px 0 10px;
  color: #e0e0e0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.doc-h4 {
  margin: 18px 0 8px;
  color: #cccccc;
  font-size: 13px;
  font-weight: 600;
}

.anchor-link {
  position: absolute;
  left: -18px;
  color: var(--sx-text-faint);
  font-weight: 400;
  opacity: 0;
  transition: opacity 120ms ease;
}

.doc-h2:hover .anchor-link,
.doc-h3:hover .anchor-link {
  opacity: 1;
}

.anchor-link:hover {
  color: var(--sx-accent);
}

.doc-p {
  margin: 0 0 16px;
  line-height: 1.75;
}

.doc-list {
  margin: 0 0 18px;
  padding-left: 20px;
}

.doc-list li {
  margin: 5px 0;
}

strong {
  color: #ffffff;
  font-weight: 600;
}

code {
  padding: 2px 5px;
  background: var(--sx-surface-raised);
  border: 1px solid var(--sx-line-strong);
  border-radius: 4px;
  color: #dedede;
  font: 11.5px var(--sx-mono);
}

.code-block {
  margin: 20px 0 24px;
  background: #030303;
  border: 1px solid var(--sx-line);
  border-radius: var(--sx-radius-md);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 12px;
  background: #060606;
  border-bottom: 1px solid var(--sx-line);
}

.code-badge {
  color: var(--sx-text-faint);
  font: 10px var(--sx-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-button {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--sx-line);
  border-radius: 4px;
  color: var(--sx-text-muted);
  font: 10.5px var(--sx-mono);
  cursor: pointer;
  transition: all 120ms ease;
}

.copy-button:hover {
  background: var(--sx-surface-hover);
  border-color: var(--sx-line-strong);
  color: #ffffff;
}

.copy-button.is-copied {
  border-color: var(--sx-accent);
  color: var(--sx-accent);
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font: 12px/1.65 var(--sx-mono);
  scrollbar-width: thin;
  scrollbar-color: #222 transparent;
}

.code-block code {
  padding: 0;
  background: transparent;
  border: 0;
  color: #d1d1d1;
}

.table-wrap {
  width: 100%;
  margin: 20px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--sx-line);
  border-radius: var(--sx-radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

th {
  padding: 10px 14px;
  background: #060606;
  border-bottom: 1px solid var(--sx-line);
  color: var(--sx-text-muted);
  font: 10px var(--sx-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--sx-line);
  vertical-align: top;
}

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

.doc-alert {
  margin: 20px 0 24px;
  padding: 14px 16px;
  border-radius: var(--sx-radius-sm);
  border-left: 2px solid #555555;
  background: #050505;
}

.doc-alert-title {
  margin-bottom: 4px;
  color: var(--sx-text-muted);
  font: 9.5px var(--sx-mono);
  letter-spacing: 0.12em;
}

.doc-alert-content {
  font-size: 12.5px;
  line-height: 1.6;
}

.doc-alert-note {
  border-left-color: var(--sx-accent);
}

.doc-alert-note .doc-alert-title {
  color: var(--sx-accent);
}

.doc-alert-warning {
  border-left-color: #b08d57;
}

.doc-alert-warning .doc-alert-title {
  color: #b08d57;
}

.doc-alert-important {
  border-left-color: #c45b5b;
}

.doc-alert-important .doc-alert-title {
  color: #c45b5b;
}

.doc-divider {
  margin: 36px 0;
  border: 0;
  border-top: 1px solid var(--sx-line);
}

.doc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 50px;
  padding-top: 24px;
  border-top: 1px solid var(--sx-line);
}

.doc-page-link {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  background: var(--sx-surface);
  border: 1px solid var(--sx-line);
  border-radius: var(--sx-radius-md);
  transition: all 130ms ease;
  min-width: 170px;
}

.doc-page-link.is-next {
  text-align: right;
  margin-left: auto;
}

.doc-page-link:hover {
  background: var(--sx-surface-raised);
  border-color: var(--sx-line-strong);
}

.doc-page-link span {
  color: var(--sx-text-faint);
  font: 10px var(--sx-mono);
}

.doc-page-link strong {
  margin-top: 3px;
  color: #e5e5e5;
  font-size: 13px;
}

.docs-toc {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.docs-toc-title {
  margin-bottom: 10px;
  color: var(--sx-text-faint);
  font: 10px var(--sx-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.docs-toc-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-toc-link {
  display: block;
  padding: 4px 0 4px 10px;
  border-left: 1px solid var(--sx-line);
  color: var(--sx-text-muted);
  font-size: 11.5px;
  line-height: 1.4;
  transition: all 130ms ease;
}

.docs-toc-link:hover {
  color: #ffffff;
  border-left-color: var(--sx-line-strong);
}

.docs-toc-link.is-active {
  color: #ffffff;
  border-left-color: var(--sx-accent);
}

.docs-toc-item.level-3 .docs-toc-link {
  padding-left: 18px;
  font-size: 11px;
}

.search-matches-wrap {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-match-item {
  display: block;
  padding: 8px 10px;
  background: var(--sx-surface);
  border: 1px solid var(--sx-line);
  border-radius: var(--sx-radius-sm);
  color: var(--sx-text);
  font-size: 11.5px;
  transition: all 120ms ease;
}

.search-match-item:hover {
  background: var(--sx-surface-raised);
  border-color: var(--sx-accent);
}

.search-match-item span {
  display: block;
  color: var(--sx-accent);
  font: 9.5px var(--sx-mono);
}

.docs-mobile-nav {
  display: none;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sx-line);
}

.docs-mobile-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--sx-surface-raised);
  border: 1px solid var(--sx-line);
  border-radius: var(--sx-radius-sm);
  color: var(--sx-text-muted);
  font: 11.5px var(--sx-mono);
  transition: all 130ms ease;
}

.docs-mobile-link:hover {
  color: #ffffff;
  border-color: var(--sx-line-strong);
}

@media (max-width: 1200px) {
  .docs-layout {
    grid-template-columns: var(--sx-sidebar-w) minmax(0, 1fr);
  }
  .docs-toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .docs-layout {
    display: block;
    padding: 16px 14px 60px;
    max-width: 100%;
  }

  .docs-main {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

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

  .docs-mobile-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .docs-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    max-height: none;
    padding: 16px;
    background: #000000;
    border-bottom: 1px solid var(--sx-line);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 200ms ease, opacity 200ms ease;
  }

  .docs-sidebar.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .code-block {
    margin: 16px 0;
    max-width: 100%;
    border-radius: var(--sx-radius-sm);
  }

  .code-block pre {
    padding: 12px 14px;
    font-size: 11px;
    line-height: 1.6;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap {
    margin: 16px 0;
    max-width: 100%;
    overflow-x: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 460px;
  }

  .doc-h1 {
    font-size: clamp(22px, 5.5vw, 28px);
    letter-spacing: -0.03em;
  }

  .doc-h2 {
    font-size: 16.5px;
    margin: 32px 0 12px;
    padding-top: 12px;
  }

  .anchor-link {
    position: static;
    display: inline-block;
    opacity: 0.4;
    margin-right: 6px;
  }

  .doc-pagination {
    flex-direction: column;
    gap: 10px;
  }

  .doc-page-link {
    width: 100%;
    min-width: 0;
  }

  .doc-page-link.is-next {
    text-align: left;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .docs-topbar {
    padding: 0 16px;
  }

  .docs-badge {
    display: none;
  }

  .docs-topbar-nav .docs-nav-link {
    display: none;
  }
}

.docs-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--sx-surface-raised);
  border: 1px solid var(--sx-line-strong);
  border-radius: var(--sx-radius-md);
  padding: 10px 18px;
  font: 13px/1.4 var(--sx-font);
  color: var(--sx-text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease;
  opacity: 0;
  z-index: 1000;
  white-space: nowrap;
  pointer-events: none;
}

.docs-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.docs-toast.err {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.docs-toast.ok {
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

@media (max-width: 640px) {
  .docs-toast {
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
  }
}
