:root {
  --docs-ink: #111827;
  --docs-body: #374151;
  --docs-muted: #6b7280;
  --docs-line: #e5e7eb;
  --docs-soft: #f9fafb;
  --docs-brand: #6d28d9;
  --docs-brand-soft: #f3e8ff;
  --docs-top-h: 64px;
  --docs-side-w: 272px;
  --docs-toc-w: 220px;
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--docs-top-h) + 24px); }

body.docs {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--docs-body);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

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

/* Top bar */
.docs-top {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--docs-top-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--docs-line);
}

.docs-top__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-weight: 700;
  color: var(--docs-ink);
}

.docs-brand img { border-radius: 8px; }

.docs-brand em {
  padding-left: 10px;
  border-left: 1px solid var(--docs-line);
  font-style: normal;
  font-weight: 500;
  color: var(--docs-muted);
}

.docs-search {
  position: relative;
  flex: 1;
  max-width: 380px;
  margin: 0 auto;
}

.docs-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 36px;
  border: 1px solid var(--docs-line);
  border-radius: 10px;
  background: var(--docs-soft);
  font: inherit;
  font-size: 14px;
  color: var(--docs-ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.docs-search__icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 12px;
  height: 12px;
  margin-top: -7px;
  border: 2px solid var(--docs-muted);
  border-radius: 50%;
}

.docs-search__icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 6px;
  height: 2px;
  background: var(--docs-muted);
  transform: rotate(45deg);
}

.docs-top__links {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
}

.docs-top__links a:not(.docs-btn):hover { color: var(--docs-brand); }

.docs-top__menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--docs-line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.docs-top__menu span {
  display: block;
  height: 2px;
  background: var(--docs-ink);
  border-radius: 2px;
}

/* Buttons */
.docs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--docs-line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--docs-ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.docs-btn:hover { border-color: #c4b5fd; background: var(--docs-soft); }

.docs .docs-btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #8b2bb9, #3f12b3);
  color: #fff;
}

.docs .docs-btn--primary:hover { background: linear-gradient(135deg, #7a22a6, #350ea0); color: #fff; }

/* Shell */
.docs-shell {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: var(--docs-top-h);
  flex: 0 0 var(--docs-side-w);
  height: calc(100vh - var(--docs-top-h));
  padding: 28px 16px 40px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--docs-line);
}

.docs-nav__group + .docs-nav__group { margin-top: 22px; }

.docs-nav__title {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--docs-ink);
}

.docs-sidebar ul { margin: 0; padding: 0; list-style: none; }

.docs-sidebar li a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--docs-muted);
  transition: background 0.15s, color 0.15s;
}

.docs-sidebar li a:hover { background: var(--docs-soft); color: var(--docs-ink); }

.docs-sidebar li a.is-active {
  background: var(--docs-brand-soft);
  color: var(--docs-brand);
  font-weight: 600;
}

.docs-nav__empty { padding: 0 10px; font-size: 14px; color: var(--docs-muted); }

.docs-backdrop { display: none; }

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

.docs-page {
  display: flex;
  gap: 48px;
  padding: 40px 48px 64px;
}

.docs-js .docs-page { display: none; }
.docs-js .docs-page.is-active { display: flex; }
.docs-page + .docs-page { border-top: 1px solid var(--docs-line); }
.docs-js .docs-page + .docs-page { border-top: 0; }

.docs-article { flex: 1; min-width: 0; max-width: 780px; }

.docs-crumb {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--docs-brand);
}

.docs-article h1 {
  margin: 0 0 16px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--docs-ink);
}

.docs-article h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 12px;
  font-size: 21px;
  line-height: 1.35;
  color: var(--docs-ink);
}

.docs-lead { margin: 0 0 8px; font-size: 17px; color: var(--docs-muted); }
.docs-muted { color: var(--docs-muted); font-size: 14px; }

.docs-article p a,
.docs-article p strong { color: var(--docs-ink); }
.docs-article p a { text-decoration: underline; text-underline-offset: 3px; }

.docs-step { padding-top: 4px; }
.docs-step:first-of-type h2 { margin-top: 24px; }
.docs-step p { margin: 0 0 16px; }

.docs-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--docs-brand-soft);
  font-size: 14px;
  font-weight: 700;
  color: var(--docs-brand);
}

.docs-shot {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--docs-line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--docs-soft);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  cursor: zoom-in;
  transition: box-shadow 0.15s, transform 0.15s;
}

.docs-shot:hover { box-shadow: 0 12px 32px rgba(17, 24, 39, 0.12); transform: translateY(-1px); }
.docs-shot img { display: block; width: 100%; height: auto; }

/* Intro cards */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.docs-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--docs-line);
  border-radius: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-card:hover { border-color: #c4b5fd; box-shadow: 0 8px 24px rgba(109, 40, 217, 0.08); }
.docs-card strong { font-size: 16px; color: var(--docs-ink); }
.docs-card span { font-size: 14px; }
.docs-card small { font-size: 12px; color: var(--docs-muted); }

.docs-help { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 12px; }

/* Pager */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--docs-line);
}

.docs-pager__link {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border: 1px solid var(--docs-line);
  border-radius: 12px;
  transition: border-color 0.15s;
}

.docs-pager__link:hover { border-color: var(--docs-brand); }
.docs-pager__link small { font-size: 12px; color: var(--docs-muted); }
.docs-pager__link span { font-weight: 600; color: var(--docs-ink); }
.docs-pager__link--next { grid-column: 2; text-align: right; }

/* On this page */
.docs-toc {
  position: sticky;
  top: calc(var(--docs-top-h) + 40px);
  flex: 0 0 var(--docs-toc-w);
  align-self: flex-start;
  max-height: calc(100vh - var(--docs-top-h) - 80px);
  overflow-y: auto;
  font-size: 13px;
}

.docs-toc__title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--docs-ink);
}

.docs-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--docs-line);
}

.docs-toc li a {
  display: block;
  margin-left: -1px;
  padding: 5px 0 5px 14px;
  border-left: 2px solid transparent;
  color: var(--docs-muted);
}

.docs-toc li a:hover { color: var(--docs-ink); }
.docs-toc li a.is-active { border-left-color: var(--docs-brand); color: var(--docs-brand); font-weight: 600; }

.docs-toc__top {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--docs-muted);
}

.docs-toc__top:hover { color: var(--docs-brand); }

/* Footer */
.docs-footer { border-top: 1px solid var(--docs-line); background: var(--docs-soft); }

.docs-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 24px;
  font-size: 13px;
  color: var(--docs-muted);
}

.docs-footer__inner a { margin-left: 18px; }
.docs-footer__inner a:hover { color: var(--docs-brand); }

/* Lightbox */
.docs-lightbox {
  width: min(1040px, calc(100vw - 32px));
  max-width: 1040px;
  padding: 16px;
  border: 0;
  border-radius: 14px;
  background: #fff;
}

.docs-lightbox::backdrop { background: rgba(17, 24, 39, 0.7); }
.docs-lightbox:not([open]):not(.is-open) { display: none; }

.docs-lightbox img {
  display: block;
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
}

.docs-lightbox__caption { margin: 10px 0; font-size: 14px; color: var(--docs-muted); }
.docs-lightbox .docs-btn { display: flex; margin-left: auto; }

/* Responsive */
@media (max-width: 1200px) {
  .docs-toc { display: none; }
}

@media (max-width: 1024px) {
  .docs-top__menu { display: flex; }
  .docs-top__links a:not(.docs-btn) { display: none; }

  .docs-sidebar {
    position: fixed;
    top: var(--docs-top-h);
    left: 0;
    z-index: 35;
    width: 290px;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .docs-menu-open .docs-sidebar { transform: none; box-shadow: 0 16px 40px rgba(17, 24, 39, 0.18); }

  .docs-menu-open .docs-backdrop {
    display: block;
    position: fixed;
    inset: var(--docs-top-h) 0 0 0;
    z-index: 30;
    background: rgba(17, 24, 39, 0.35);
  }

  .docs-page { padding: 32px 28px 56px; }
}

@media (max-width: 640px) {
  .docs-top__inner { gap: 10px; padding: 0 14px; }
  .docs-brand em, .docs-top__links { display: none; }
  .docs-search { max-width: none; }
  .docs-page { padding: 24px 18px 48px; }
  .docs-article h1 { font-size: 27px; }
  .docs-article h2 { font-size: 18px; }
  .docs-cards { grid-template-columns: 1fr; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager__link--next { grid-column: auto; }
  .docs-footer__inner a { margin: 0 14px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
