:root {
  --bg: #121217;
  --card: #17171e;
  --card-2: #1d1d26;
  --border: rgba(120, 120, 150, .18);
  --text: #ebebf0;
  --muted: #9a9aac;
  --dim: #6c6c7e;
  --accent: #8e94f2;
  --accent-rgb: 142, 148, 242;
  --sidebar-w: 280px;
  --toc-w: 240px;
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { background: var(--bg); color: var(--text); font-family: "Plus Jakarta Sans", system-ui, sans-serif; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.i { width: 18px; height: 18px; flex: none; }
kbd { font-family: inherit; font-size: .72rem; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--card-2); color: var(--muted); }

/* Sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); display: flex; flex-direction: column; background: var(--card); border-right: 1px solid var(--border); z-index: 30; }
.sidebar-head { padding: 18px 18px 10px; }
.docs-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.05rem; }
.docs-brand img { object-fit: contain; }
.search-trigger { margin: 6px 14px 10px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--card-2); color: var(--muted); font: inherit; font-size: .88rem; cursor: pointer; transition: border-color .2s; }
.search-trigger:hover { border-color: rgba(var(--accent-rgb), .45); }
.search-trigger span { flex: 1; text-align: left; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.nav-group summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: .9rem; font-weight: 600; color: #d4d4de; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-group summary span { flex: 1; }
.nav-icon { color: var(--accent); }
.nav-thumb { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; flex: none; }
.chevron { width: 15px; height: 15px; color: var(--dim); transition: transform .2s; }
.nav-group[open] .chevron { transform: rotate(90deg); }
.nav-group ul { list-style: none; margin: 2px 0 8px 21px; padding-left: 12px; border-left: 1px solid var(--border); }
.nav-group li a { display: block; padding: 5px 10px; margin-left: -13px; border-left: 1px solid transparent; font-size: .86rem; color: var(--muted); line-height: 1.45; transition: color .15s; }
.nav-group li a:hover { color: var(--text); }
.nav-group li a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; display: grid; gap: 2px; }
.sidebar-foot a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-size: .88rem; color: var(--muted); }
.sidebar-foot a:hover { background: rgba(255,255,255,.04); color: var(--text); }

/* Main layout */
.docs-main { margin-left: var(--sidebar-w); display: flex; justify-content: center; gap: 40px; padding: 0 40px; min-height: 100vh; }
.doc { width: 100%; max-width: 860px; padding: 44px 0 64px; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumb span { color: var(--text); }
.crumb-sep { width: 14px; height: 14px; color: var(--dim); }
.doc h1 { font-size: clamp(1.9rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; margin-bottom: 18px; }

/* Article content */
.doc-content { font-size: .97rem; color: #d6d6e0; }
.doc-content > * + * { margin-top: 16px; }
.doc-content h2, .doc-content h3, .doc-content h4 { color: var(--text); letter-spacing: -0.015em; line-height: 1.3; scroll-margin-top: 24px; }
.doc-content h2 { font-size: 1.5rem; font-weight: 800; margin-top: 44px; }
.doc-content h3 { font-size: 1.15rem; font-weight: 700; margin-top: 32px; }
.doc-content h4 { font-size: 1rem; font-weight: 700; margin-top: 24px; }
.doc-content > h2:first-child, .doc-content > h3:first-child { margin-top: 8px; }
.anchor { position: relative; }
.anchor:hover::after { content: "#"; position: absolute; right: -1.1em; color: var(--dim); font-weight: 500; }
.doc-content a:not(.anchor) { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(var(--accent-rgb), .35); text-underline-offset: 3px; }
.doc-content a:not(.anchor):hover { text-decoration-color: var(--accent); }
.doc-content strong { color: var(--text); }
.doc-content ul, .doc-content ol { padding-left: 1.4em; }
.doc-content li + li { margin-top: 6px; }
.doc-content li > ul, .doc-content li > ol { margin-top: 6px; }
.doc-content :not(pre) > code { font-family: var(--mono); font-size: .84em; padding: 2px 6px; border-radius: 6px; background: var(--card-2); border: 1px solid var(--border); color: #e2e2ff; word-break: break-word; }
.doc-content hr { border: 0; border-top: 1px solid var(--border); }

/* Numbered steps: top-level ordered lists */
.doc-content > ol { list-style: none; padding-left: 0; counter-reset: step; }
.doc-content > ol > li { position: relative; counter-increment: step; padding: 0 0 18px 46px; margin: 0; }
.doc-content > ol > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--card-2); border: 1px solid var(--border); font-size: .82rem; font-weight: 700; color: var(--text); }
.doc-content > ol > li::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 1px; background: var(--border); }
.doc-content > ol > li:last-child::after { display: none; }

/* Code blocks */
.code { position: relative; border-radius: var(--radius); border: 1px solid var(--border); background: #18181f; overflow: hidden; }
.code pre { overflow-x: auto; padding: 16px 18px; font-family: var(--mono); font-size: .84rem; line-height: 1.65; color: #e6e6f0; }
.code-lang { position: absolute; top: 8px; right: 46px; font-size: .7rem; color: var(--dim); font-family: var(--mono); }
.code-copy { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--dim); cursor: pointer; opacity: 0; transition: opacity .15s, color .15s; }
.code:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--text); border-color: var(--border); background: var(--card-2); }
.code-copy.is-copied { color: #4ade80; opacity: 1; }
.code-copy .i { width: 16px; height: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table-wrap th { text-align: left; font-weight: 700; color: var(--text); background: var(--card); }
.table-wrap th, .table-wrap td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td code { white-space: nowrap; }

/* Callouts */
.callout { position: relative; padding: 14px 16px 14px 18px; border-radius: var(--radius); background: rgba(var(--accent-rgb), .07); border: 1px solid rgba(var(--accent-rgb), .22); color: #dadaf0; }
.callout::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--accent); }
.callout > * + * { margin-top: 10px; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pager-link { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); transition: border-color .2s, background .2s; }
.pager-link:hover { border-color: rgba(var(--accent-rgb), .45); background: rgba(var(--accent-rgb), .04); }
.pager-link span { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.pager-link .i { width: 14px; height: 14px; }
.pager-link strong { font-size: .95rem; }
.pager-next { text-align: right; align-items: flex-end; }

/* TOC */
.toc { position: sticky; top: 0; width: var(--toc-w); flex: none; max-height: 100vh; overflow-y: auto; padding: 48px 0 32px; }
.toc-title { font-size: .82rem; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.toc ul { list-style: none; border-left: 1px solid var(--border); }
.toc a { display: block; margin-left: -1px; padding: 4px 0 4px 14px; border-left: 1px solid transparent; font-size: .82rem; color: var(--muted); line-height: 1.45; transition: color .15s; }
.toc .toc-l3 a { padding-left: 26px; }
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); }

/* Home */
.docs-home { position: relative; flex-direction: column; justify-content: flex-start; align-items: center; padding-bottom: 80px; overflow: hidden; }
.home-glow { position: absolute; top: -260px; left: 50%; translate: -50% 0; width: 900px; height: 520px; background: radial-gradient(closest-side, rgba(110, 100, 230, .32), transparent); pointer-events: none; }
.home-hero { position: relative; text-align: center; max-width: 720px; padding: 92px 0 48px; }
.home-hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; }
.home-hero p { color: var(--muted); margin: 14px auto 28px; max-width: 520px; }
.home-search { display: flex; align-items: center; gap: 10px; width: min(460px, 100%); margin: 0 auto; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font: inherit; font-size: .92rem; cursor: pointer; transition: border-color .2s; }
.home-search:hover { border-color: rgba(var(--accent-rgb), .5); }
.home-search span { flex: 1; text-align: left; }
.home-section { position: relative; width: 100%; max-width: 1000px; margin-top: 36px; }
.home-section h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }
.solution-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.solution-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); transition: border-color .2s, transform .2s; }
.solution-card:hover { border-color: rgba(var(--accent-rgb), .45); transform: translateY(-2px); }
.solution-card strong { font-size: .92rem; }
.solution-card span:last-child { font-size: .8rem; color: var(--muted); }
.solution-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; margin-bottom: 6px; color: var(--accent); background: rgba(var(--accent-rgb), .12); }
.solution-icon .i { width: 17px; height: 17px; }
.script-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.script-card { border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--border); transition: border-color .2s, transform .2s; }
.script-card:hover { border-color: rgba(var(--accent-rgb), .45); transform: translateY(-3px); }
.script-banner { aspect-ratio: 16 / 9; display: grid; place-items: center; background: linear-gradient(135deg, #2e2a66, #6d5ce8); font-weight: 800; }
.script-banner img { width: 100%; height: 100%; object-fit: cover; }
.script-card-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-size: .92rem; }
.script-card-foot .i { width: 16px; height: 16px; color: var(--muted); }

/* Search */
.search-modal { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-modal[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 10, .6); backdrop-filter: blur(3px); }
.search-panel { position: relative; width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; border-radius: 14px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(0,0,0,.55); overflow: hidden; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.search-field input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 1rem; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; overflow-y: auto; padding: 8px; }
.search-results a { display: block; padding: 10px 12px; border-radius: 9px; }
.search-results a.is-selected, .search-results a:hover { background: rgba(var(--accent-rgb), .1); }
.search-results strong { display: block; font-size: .92rem; }
.search-results small { display: block; font-size: .78rem; color: var(--muted); }
.search-empty { padding: 22px; text-align: center; color: var(--muted); font-size: .9rem; }

/* Mobile */
.mobile-bar { display: none; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; }
.sidebar-backdrop { display: none; }

@media (max-width: 1280px) {
  .toc { display: none; }
}
@media (max-width: 900px) {
  .mobile-bar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0 16px; background: rgba(18, 18, 23, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0,0,0,.5); }
  .docs-main { margin-left: 0; padding: 0 16px; }
  .doc { padding-top: 24px; }
  .home-hero { padding-top: 48px; }
  .pager { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* READMEs written for GitHub center their intro with align="center"; keep docs left-aligned. */
.doc-content [align] { text-align: left; }
