*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --panel: #15181d;
  --panel-2: #1b2027;
  --panel-3: #202733;
  --border: #2d3541;
  --border-soft: #222a34;
  --text: #edf1f7;
  --muted: #a4afbf;
  --quiet: #717d8f;
  --blue: #62a8ff;
  --green: #5fd18d;
  --orange: #ffb454;
  --purple: #c792ea;
  --red: #ff6b6b;
  --shadow: rgba(0, 0, 0, 0.22);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sidebar-w: 264px;
  --topbar-h: 60px;
  --radius: 8px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

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

a:hover {
  text-decoration: underline;
}

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

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

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: rgba(13, 15, 18, 0.94);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.version {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.topbar-space {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions a,
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.86rem;
}

.topbar-actions a:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.button-link {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text) !important;
  font-weight: 600;
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.menu-toggle span {
  width: 15px;
  height: 2px;
  background: currentColor;
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  z-index: 90;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 22px 12px 42px;
  border-right: 1px solid var(--border-soft);
  background: #101319;
}

.sidebar-group + .sidebar-group {
  margin-top: 22px;
}

.sidebar-label {
  padding: 0 10px 8px;
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
}

.sidebar-link:hover {
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: #1f2a38;
  color: var(--blue);
  font-weight: 600;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.58);
}

.sidebar-overlay.show {
  display: block;
}

.main {
  width: min(100%, 1040px);
  margin-left: var(--sidebar-w);
  padding: 88px 48px 96px;
}

.hero {
  padding-bottom: 42px;
  border-bottom: 1px solid var(--border-soft);
}

.hero-kicker {
  margin-bottom: 14px;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
}

h1 {
  max-width: 850px;
  margin-bottom: 18px;
  color: var(--text);
  font-size: clamp(2.15rem, 5vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 780px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-install {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 48px;
  padding: 0 10px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 40px var(--shadow);
  font-family: var(--font-mono);
  overflow-x: auto;
}

.hero-install .shell {
  color: var(--quiet);
}

.hero-install code {
  color: var(--text);
  white-space: nowrap;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.status-grid div,
.method-card,
.type-list > div,
.note {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.status-grid div {
  padding: 16px;
}

.status-grid strong,
.status-grid span {
  display: block;
}

.status-grid strong {
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.status-grid span {
  color: var(--muted);
  font-size: 0.84rem;
}

.doc-section {
  padding-top: 48px;
  margin-top: 8px;
}

.doc-section + .doc-section {
  border-top: 1px solid var(--border-soft);
}

h2 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 1.9rem;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.98rem;
}

p {
  max-width: 760px;
  margin-bottom: 16px;
  color: var(--muted);
}

ul {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--muted);
}

li {
  margin-bottom: 7px;
}

code:not([class]) {
  padding: 2px 5px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: #111820;
  color: var(--orange);
  font-size: 0.88em;
}

.api-grid,
.logic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

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

.method-card {
  padding: 16px;
}

.method-card h3 {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  color: var(--blue);
}

.method-card p {
  margin: 0;
  font-size: 0.86rem;
}

.feature-stack {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.feature-detail {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.feature-meta {
  margin-bottom: 7px;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
}

.feature-detail h3 {
  margin-bottom: 8px;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 1rem;
}

.feature-detail p {
  margin-bottom: 12px;
}

.feature-detail ul {
  margin-bottom: 0;
}

.feature-detail li {
  margin-bottom: 8px;
  color: var(--muted);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 28px;
  align-items: start;
}

.clean-list {
  list-style: none;
  padding-left: 0;
}

.clean-list li {
  position: relative;
  padding-left: 18px;
}

.clean-list li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.note {
  max-width: 760px;
  margin: 18px 0;
  padding: 14px 16px;
  color: var(--muted);
}

.note-warning {
  border-color: rgba(255, 180, 84, 0.42);
  background: #1f1a12;
}

.code-wrap {
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #101319;
}

.code-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.copy-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--quiet);
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--border);
  background: var(--panel-3);
  color: var(--text);
}

.copy-btn.copied {
  color: var(--green);
}

pre[class*="language-"] {
  margin: 0 !important;
  padding: 16px !important;
  border-radius: 0 !important;
  background: #0f1217 !important;
  font-size: 0.86rem !important;
  line-height: 1.65 !important;
  overflow-x: auto;
}

.compare pre + pre {
  border-top: 1px solid var(--border-soft);
}

.type-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.type-list > div {
  padding: 16px;
}

.type-list p {
  margin: 0;
  font-size: 0.88rem;
}

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

.flow span {
  display: grid;
  place-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
}

.flow span:nth-child(2) {
  color: var(--blue);
}

.flow span:nth-child(3) {
  color: var(--green);
}

.flow span:nth-child(4) {
  color: var(--purple);
}

.module-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 0.88rem;
}

.module-table th,
.module-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.module-table th {
  color: var(--quiet);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.module-table td {
  color: var(--muted);
}

.module-table tr:last-child td {
  border-bottom: none;
}

.scrolltop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, color 0.2s;
}

.scrolltop.show {
  opacity: 1;
  transform: translateY(0);
}

.scrolltop:hover {
  color: var(--text);
}

@media (max-width: 980px) {
  .main {
    padding-right: 28px;
    padding-left: 28px;
  }

  .status-grid,
  .api-grid,
  .logic-grid,
  .flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 740px) {
  :root {
    --sidebar-w: 280px;
  }

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

  .version {
    display: none;
  }

  .topbar-actions a:not(.button-link) {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

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

  .main {
    margin-left: 0;
    padding: 82px 18px 84px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .status-grid,
  .api-grid,
  .logic-grid,
  .type-list,
  .flow {
    grid-template-columns: 1fr;
  }

  .hero-install {
    display: flex;
  }
}
