:root { --header: 3.5rem; --sidebar: 17rem; --content: 46rem; --toc: 14rem; --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 1rem); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: hsl(var(--background)); color: hsl(var(--foreground)); font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; text-rendering: optimizeLegibility; }
a { color: inherit; }
.skip { position: absolute; left: .5rem; top: -4rem; z-index: 100; padding: .5rem 1rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--background)); }
.skip:focus { top: .5rem; }
.muted { color: hsl(var(--muted-foreground)); }
.only-mobile { display: none; }

.site-header { position: sticky; top: 0; z-index: 40; height: var(--header); border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--background) / .85); backdrop-filter: blur(10px); }
.header-inner { display: flex; align-items: center; gap: .75rem; height: 100%; max-width: 90rem; margin: 0 auto; padding: 0 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 650; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: .45rem; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); font-size: .9rem; font-weight: 700; }
.header-nav { display: flex; gap: .25rem; margin-left: .5rem; }
.header-actions { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.search-button { gap: .5rem; min-width: 11rem; justify-content: space-between; color: hsl(var(--muted-foreground)); }

.body { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); max-width: 90rem; margin: 0 auto; }
.sidebar { position: sticky; top: var(--header); align-self: start; height: calc(100vh - var(--header)); overflow-y: auto; padding: 1.5rem 1rem 2rem; border-right: 1px solid hsl(var(--border)); }
.nav-script + .nav-script { margin-top: 1rem; }
.nav-script-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem .5rem; border-radius: calc(var(--radius) - 2px); font-weight: 600; text-decoration: none; }
.nav-group h2 { margin: 1rem .5rem .35rem; color: hsl(var(--muted-foreground)); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.nav-group ul { margin: 0; padding: 0; list-style: none; }
.nav-link { display: block; padding: .3rem .5rem; border-radius: calc(var(--radius) - 2px); color: hsl(var(--muted-foreground)); font-size: .9rem; text-decoration: none; }
.nav-link:hover, .nav-script-title:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
[aria-current='page'] { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); font-weight: 600; }

.main { min-width: 0; padding: 2rem 1.5rem 4rem; }
.doc-layout { display: grid; grid-template-columns: minmax(0, var(--content)) var(--toc); gap: 3rem; justify-content: center; }
.doc-header h1, .home h1, .not-found h1 { margin: 1rem 0 .5rem; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.15; letter-spacing: -.03em; }
.lead { color: hsl(var(--muted-foreground)); font-size: 1.15rem; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1rem 0; color: hsl(var(--muted-foreground)); font-size: .9rem; }
.install-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1rem 0 1.5rem; }
.doc-heading { position: relative; scroll-margin-top: calc(var(--header) + 1rem); }
.doc h2 { margin-top: 2.5rem; padding-bottom: .4rem; border-bottom: 1px solid hsl(var(--border)); }
.anchor { margin-left: .4rem; color: hsl(var(--muted-foreground)); text-decoration: none; opacity: 0; }
.doc-heading:hover .anchor, .anchor:focus { opacity: 1; }
.doc a:not(.anchor):not([class*='gb-']):not(.pager-card):not(.edit-link) { text-decoration-color: hsl(var(--muted-foreground) / .5); text-underline-offset: 3px; }
.doc-list { padding-left: 1.4rem; }
.doc-list li { margin: .3rem 0; }
.doc-list li.task { margin-left: -1.2rem; list-style: none; }
.doc-quote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); }
.doc-alert { margin: 1.25rem 0; }
.doc-img { max-width: 100%; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }

.table-wrap { margin: 1.25rem 0; overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.doc-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.doc-table th, .doc-table td { padding: .6rem .85rem; border-bottom: 1px solid hsl(var(--border)); text-align: left; vertical-align: top; }
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table th { background: hsl(var(--muted) / .5); font-weight: 600; }
.prompt-body { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: hsl(var(--muted-foreground)); font-size: .88rem; }

.code-card { margin: 1.25rem 0; overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); }
.code-head { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem .35rem .85rem; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--muted) / .4); font: 500 .8rem var(--mono); }
.code-title { margin-right: auto; color: hsl(var(--muted-foreground)); }
.code-body { margin: 0; padding: 1rem; overflow-x: auto; font: .86rem/1.65 var(--mono); tab-size: 2; }
.code-body code { font: inherit; }
.tok-comment { color: hsl(var(--muted-foreground)); font-style: italic; }
.tok-string { color: hsl(28 80% 38%); }
.tok-number { color: hsl(160 60% 30%); }
.tok-keyword { color: hsl(285 55% 42%); }
.tok-fn { color: hsl(215 75% 42%); }
.tok-type { color: hsl(185 65% 28%); }
.tok-tag { color: hsl(350 65% 42%); }
.tok-attr { color: hsl(35 80% 34%); }
.tok-key { color: hsl(215 65% 40%); }
:root[data-theme='dark'] .tok-string { color: hsl(28 85% 68%); }
:root[data-theme='dark'] .tok-number { color: hsl(160 55% 62%); }
:root[data-theme='dark'] .tok-keyword { color: hsl(285 70% 76%); }
:root[data-theme='dark'] .tok-fn { color: hsl(212 85% 72%); }
:root[data-theme='dark'] .tok-type { color: hsl(185 60% 62%); }
:root[data-theme='dark'] .tok-tag { color: hsl(350 80% 72%); }
:root[data-theme='dark'] .tok-attr { color: hsl(40 85% 66%); }
:root[data-theme='dark'] .tok-key { color: hsl(212 80% 72%); }

.toc { position: sticky; top: calc(var(--header) + 1.5rem); align-self: start; max-height: calc(100vh - var(--header) - 3rem); overflow-y: auto; font-size: .85rem; }
.toc h2 { margin: 0 0 .5rem; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.toc ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid hsl(var(--border)); }
.toc a { display: block; padding: .25rem .75rem; margin-left: -1px; border-left: 1px solid transparent; color: hsl(var(--muted-foreground)); text-decoration: none; }
.toc .depth-3 a { padding-left: 1.5rem; }
.toc a:hover { color: hsl(var(--foreground)); }
.toc a[aria-current='true'] { border-left-color: hsl(var(--foreground)); color: hsl(var(--foreground)); font-weight: 600; }

.edit-link { display: inline-flex; align-items: center; gap: .35rem; margin-top: 2.5rem; color: hsl(var(--muted-foreground)); font-size: .9rem; text-decoration: none; }
.edit-link:hover { color: hsl(var(--foreground)); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid hsl(var(--border)); }
.pager-card { display: block; padding: .85rem 1rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); font-weight: 600; text-decoration: none; transition: background 120ms; }
.pager-card:hover { background: hsl(var(--accent)); }
.pager-card small { display: block; color: hsl(var(--muted-foreground)); font-weight: 400; }
.pager-card.next { grid-column: 2; text-align: right; }

.home { max-width: 62rem; margin: 0 auto; }
.hero { padding: 3rem 0 2.5rem; }
.hero h1 { max-width: 16ch; font-size: clamp(2.4rem, 6vw, 4rem); }
.hero .lead { max-width: 38rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 2rem; margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid hsl(var(--border)); }
.features h2 { margin: .6rem 0 .25rem; font-size: 1.05rem; }
.features p { margin: 0; color: hsl(var(--muted-foreground)); font-size: .95rem; }
.not-found { max-width: 32rem; margin: 4rem auto; text-align: center; }

.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; max-width: 90rem; margin: 0 auto; padding: 1.5rem 1rem; border-top: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); font-size: .88rem; }
.site-footer a { display: inline-flex; align-items: center; gap: .35rem; }

@media (max-width: 1100px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 900px) {
  .body { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .only-mobile { display: inline-flex; }
  .only-desktop, .header-nav { display: none; }
  .search-button { min-width: 0; }
  .main { padding: 1.5rem 1rem 3rem; }
}
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } .pager-card.next { grid-column: 1; } .hero { padding-top: 1.5rem; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }