
:root {
    color-scheme: dark;

    --bg: #0b0d11;
    --bg-elevated: #11141a;
    --bg-sunken: #080a0d;
    --surface: #14181f;
    --surface-hover: #1a1f27;
    --border: #242a34;
    --border-strong: #313945;

    --text: #e4e9f0;
    --text-muted: #98a2b3;
    --text-faint: #6b7480;

    --accent: #6ea8fe;
    --accent-hover: #9dc4ff;
    --accent-soft: rgba(110, 168, 254, 0.12);
    --accent-border: rgba(110, 168, 254, 0.35);

    --green: #4ade80;
    --green-soft: rgba(74, 222, 128, 0.12);
    --amber: #fbbf24;
    --amber-soft: rgba(251, 191, 36, 0.12);
    --violet: #c084fc;
    --violet-soft: rgba(192, 132, 252, 0.12);
    --rose: #fb7185;
    --rose-soft: rgba(251, 113, 133, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);

    --sidebar-w: 288px;
    --toc-w: 232px;
    --topbar-h: 60px;
    --content-max: 860px;

    --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
}

html[data-theme="light"] {
    color-scheme: light;

    --bg: #ffffff;
    --bg-elevated: #fbfbfc;
    --bg-sunken: #f6f7f9;
    --surface: #ffffff;
    --surface-hover: #f6f7f9;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;

    --text: #14181f;
    --text-muted: #5a6472;
    --text-faint: #869099;

    --accent: #1f6feb;
    --accent-hover: #0b52c4;
    --accent-soft: rgba(31, 111, 235, 0.08);
    --accent-border: rgba(31, 111, 235, 0.3);

    --green: #17803d;
    --green-soft: rgba(23, 128, 61, 0.09);
    --amber: #a15c07;
    --amber-soft: rgba(161, 92, 7, 0.09);
    --violet: #7e22ce;
    --violet-soft: rgba(126, 34, 206, 0.09);
    --rose: #be123c;
    --rose-soft: rgba(190, 18, 60, 0.09);

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.16);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

::selection {
    background: var(--accent-soft);
}

/* ---------- Layout ------------------------------------------------------- */

.layout {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--sidebar-w);
}

.page {
    display: flex;
    gap: 48px;
    align-items: flex-start;
    padding: 40px 48px 96px;
    max-width: calc(var(--content-max) + var(--toc-w) + 96px);
}

.content {
    flex: 1 1 auto;
    min-width: 0;
    max-width: var(--content-max);
}

/* ---------- Sidebar ----------------------------------------------------- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 60;
    transition: transform 0.25s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), var(--violet));
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex: 0 0 auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.brand-name {
    font-size: 0.9rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
}

.brand-version {
    font-size: 0.7rem;
    color: var(--text-faint);
    font-family: var(--mono);
}

.sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 12px 40px;
}

.sidebar-scroll::-webkit-scrollbar,
.palette-results::-webkit-scrollbar {
    width: 8px;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.palette-results::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 8px;
}

.nav-group {
    margin-bottom: 4px;
}

.nav-group > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    list-style: none;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    user-select: none;
}

.nav-group > summary::-webkit-details-marker {
    display: none;
}

.nav-group > summary:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-group > summary .chev {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    transition: transform 0.18s ease;
    opacity: 0.7;
}

.nav-group[open] > summary .chev {
    transform: rotate(90deg);
}

.nav-list {
    list-style: none;
    margin: 2px 0 10px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
    margin-left: 14px;
}

.nav-link {
    display: block;
    padding: 5px 10px;
    margin-left: -1px;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    color: var(--text-muted);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

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

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 550;
    box-shadow: inset 2px 0 0 var(--accent);
}

.nav-link code {
    font-family: var(--mono);
    font-size: 0.94em;
    background: none;
    padding: 0;
    color: inherit;
}

/* ---------- Topbar ------------------------------------------------------ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .topbar {
        background: var(--bg);
    }
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text);
}

.drawer-toggle {
    display: none;
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    padding: 7px 10px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-faint);
    font-family: var(--sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.search-trigger:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.search-trigger svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.search-trigger .label {
    flex: 1 1 auto;
    text-align: left;
}

kbd {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    white-space: nowrap;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.topbar-link {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

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

.topbar-sep {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
    flex: 0 0 auto;
}

.theme-toggle .sun {
    display: none;
}

html[data-theme="light"] .theme-toggle .sun {
    display: block;
}

html[data-theme="light"] .theme-toggle .moon {
    display: none;
}

/* ---------- Table of contents ------------------------------------------ */

.toc {
    position: sticky;
    top: calc(var(--topbar-h) + 40px);
    width: var(--toc-w);
    flex: 0 0 var(--toc-w);
    max-height: calc(100vh - var(--topbar-h) - 80px);
    overflow-y: auto;
    font-size: 0.82rem;
}

.toc-title {
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.toc ul {
    list-style: none;
    border-left: 1px solid var(--border);
}

.toc a {
    display: block;
    padding: 4px 12px;
    margin-left: -1px;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    line-height: 1.4;
}

.toc a:hover {
    color: var(--text);
    text-decoration: none;
}

.toc a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 550;
}

.toc a.toc-sub {
    padding-left: 24px;
    font-size: 0.78rem;
}

/* ---------- Hero -------------------------------------------------------- */

.hero {
    padding-bottom: 8px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    padding: 4px 11px;
    margin-bottom: 18px;
}

.hero h1 {
    font-size: 2.4rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
}

.hero .lede {
    font-size: 1.06rem;
    color: var(--text-muted);
    max-width: 62ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 550;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent-border);
    text-decoration: none;
    color: var(--text);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

/* ---------- Typography -------------------------------------------------- */

.content h2 {
    font-size: 1.55rem;
    font-weight: 680;
    letter-spacing: -0.02em;
    margin: 64px 0 6px;
    padding-top: 8px;
    scroll-margin-top: calc(var(--topbar-h) + 24px);
}

.content h2:first-child {
    margin-top: 0;
}

.content h3 {
    font-size: 1.06rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin: 36px 0 8px;
    scroll-margin-top: calc(var(--topbar-h) + 24px);
}

.content h4 {
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 20px 0 8px;
}

/* Group divider between families of models (Character, Weapon, Auth, ...) */
.content h3.model-group {
    font-size: 0.76rem;
    font-weight: 680;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 44px 0 16px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.content h3.model-group:first-of-type {
    margin-top: 28px;
}

.content p {
    margin-bottom: 14px;
    color: var(--text-muted);
}

.content p strong,
.content li strong {
    color: var(--text);
    font-weight: 600;
}

.section-lede {
    font-size: 1rem;
    margin-bottom: 8px !important;
}

.content ul,
.content ol {
    margin: 0 0 16px 20px;
    color: var(--text-muted);
}

.content li {
    margin-bottom: 6px;
}

.content li::marker {
    color: var(--text-faint);
}

.rule {
    height: 1px;
    background: var(--border);
    border: 0;
    margin: 0;
}

code {
    font-family: var(--mono);
    font-size: 0.86em;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.1em 0.38em;
    color: var(--text);
    white-space: nowrap;
}

/* ---------- Badges ------------------------------------------------------ */

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-async {
    color: var(--violet);
    background: var(--violet-soft);
    border-color: color-mix(in srgb, var(--violet) 30%, transparent);
}

.badge-sync {
    color: var(--text-muted);
    background: var(--bg-sunken);
    border-color: var(--border-strong);
}

.badge-token {
    color: var(--amber);
    background: var(--amber-soft);
    border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}

.badge-uid {
    color: var(--green);
    background: var(--green-soft);
    border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

.badge-offline {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.badge-new {
    color: var(--rose);
    background: var(--rose-soft);
    border-color: color-mix(in srgb, var(--rose) 32%, transparent);
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
    .badge {
        border-color: var(--border-strong);
    }
}

/* ---------- API cards --------------------------------------------------- */

.api {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: 20px 22px 22px;
    margin: 20px 0 28px;
    box-shadow: var(--shadow-sm);
}

.api > h3 {
    margin-top: 0;
    margin-bottom: 10px;
    scroll-margin-top: calc(var(--topbar-h) + 24px);
}

.api > h3 > code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 0.98em;
    color: var(--text);
    white-space: normal;
}

.api > h3 .fn {
    color: var(--accent);
    font-weight: 650;
}

.api > h3 .kw {
    color: var(--violet);
    font-weight: 500;
}

.api > h3 .ret {
    color: var(--text-faint);
    font-weight: 400;
}

.api .desc {
    color: var(--text-muted);
    margin-bottom: 4px;
}

.anchor {
    opacity: 0;
    margin-left: 8px;
    font-size: 0.8em;
    color: var(--text-faint);
    text-decoration: none;
    font-weight: 400;
}

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

/* ---------- Tables ------------------------------------------------------ */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 10px 0 18px;
    background: var(--bg-elevated);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    min-width: 460px;
}

thead th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-sunken);
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: top;
}

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

tbody tr:hover td {
    background: var(--surface-hover);
}

td:first-child {
    white-space: nowrap;
}

td code,
th code {
    background: var(--bg-sunken);
    border-color: var(--border-strong);
}

.t-name code {
    color: var(--text);
    font-weight: 600;
    background: none;
    border: 0;
    padding: 0;
}

.t-type {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent);
    white-space: nowrap;
}

.t-type a {
    color: var(--accent);
    border-bottom: 1px dotted var(--accent-border);
}

.t-type a:hover {
    text-decoration: none;
    border-bottom-style: solid;
}

.req {
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rose);
}

.opt {
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--text-faint);
}

/* Two-column key/value table (config style) */
table.kv td:first-child {
    width: 34%;
    color: var(--text);
    font-weight: 550;
}

/* ---------- Code blocks ------------------------------------------------- */

.code {
    position: relative;
    margin: 14px 0 18px;
}

.code-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-faint);
}

.code-head .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
    flex: 0 0 auto;
}

.code pre[class*="language-"] {
    margin: 0;
    padding: 16px 18px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.65;
    tab-size: 4;
}

.code-head + pre[class*="language-"] {
    border-radius: 0 0 var(--radius) var(--radius);
}

.code pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: inherit;
    white-space: pre;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 9px;
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 550;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.code:hover .copy-btn,
.copy-btn:focus-visible {
    opacity: 1;
}

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

.copy-btn.done {
    color: var(--green);
    border-color: color-mix(in srgb, var(--green) 40%, transparent);
}

.code-head + pre + .copy-btn {
    top: 40px;
}

/* Light-mode overrides for the Prism Tomorrow theme */
html[data-theme="light"] .code pre[class*="language-"],
html[data-theme="light"] .code pre[class*="language-"] code {
    color: #24292f;
    text-shadow: none;
}

html[data-theme="light"] .token.comment,
html[data-theme="light"] .token.prolog,
html[data-theme="light"] .token.doctype,
html[data-theme="light"] .token.cdata {
    color: #6a737d;
}

html[data-theme="light"] .token.punctuation {
    color: #4b5563;
}

html[data-theme="light"] .token.keyword,
html[data-theme="light"] .token.operator {
    color: #cf222e;
}

html[data-theme="light"] .token.string,
html[data-theme="light"] .token.char,
html[data-theme="light"] .token.triple-quoted-string {
    color: #0a3069;
}

html[data-theme="light"] .token.number,
html[data-theme="light"] .token.boolean {
    color: #0550ae;
}

html[data-theme="light"] .token.function,
html[data-theme="light"] .token.class-name {
    color: #8250df;
}

html[data-theme="light"] .token.builtin,
html[data-theme="light"] .token.decorator {
    color: #953800;
}

/* ---------- Callouts ---------------------------------------------------- */

.note {
    display: flex;
    gap: 12px;
    padding: 13px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    margin: 16px 0 20px;
    font-size: 0.88rem;
}

.note p {
    margin: 0;
    color: var(--text);
}

.note p + p {
    margin-top: 8px;
}

.note-icon {
    flex: 0 0 auto;
    font-size: 1rem;
    line-height: 1.5;
}

.note-warn {
    border-left-color: var(--amber);
    background: var(--amber-soft);
}

.note-danger {
    border-left-color: var(--rose);
    background: var(--rose-soft);
}

.note-tip {
    border-left-color: var(--green);
    background: var(--green-soft);
}

/* ---------- Card grid --------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
    gap: 14px;
    margin: 18px 0 24px;
}

.tile {
    display: block;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

a.tile:hover {
    border-color: var(--accent-border);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.tile-title {
    display: block;
    font-size: 0.92rem;
    font-weight: 620;
    color: var(--text);
    margin-bottom: 4px;
}

.tile-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---------- Command palette -------------------------------------------- */

.palette-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: none;
    padding: 12vh 16px 16px;
    justify-content: center;
    align-items: flex-start;
}

.palette-backdrop.open {
    display: flex;
}

.palette {
    width: 100%;
    max-width: 560px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.palette-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.palette-input-row svg {
    width: 16px;
    height: 16px;
    color: var(--text-faint);
    flex: 0 0 auto;
}

.palette input {
    flex: 1 1 auto;
    background: none;
    border: 0;
    outline: none;
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.95rem;
}

.palette input::placeholder {
    color: var(--text-faint);
}

.palette-results {
    max-height: 52vh;
    overflow-y: auto;
    padding: 6px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
}

.palette-item:hover,
.palette-item.selected {
    background: var(--accent-soft);
    text-decoration: none;
}

.palette-item .pi-kind {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    color: var(--text-muted);
    flex: 0 0 auto;
    min-width: 58px;
    text-align: center;
}

.palette-item .pi-label {
    flex: 1 1 auto;
    font-size: 0.88rem;
    font-family: var(--mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.palette-item .pi-section {
    font-size: 0.75rem;
    color: var(--text-faint);
    flex: 0 0 auto;
}

.palette-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.88rem;
}

.palette-foot {
    display: flex;
    gap: 14px;
    padding: 9px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-sunken);
    font-size: 0.72rem;
    color: var(--text-faint);
}

.palette-foot span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ---------- Footer ------------------------------------------------------ */

.doc-footer {
    margin-top: 72px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-faint);
}

.doc-footer nav {
    display: flex;
    gap: 16px;
}

/* ---------- Scrim (mobile drawer) --------------------------------------- */

.scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 55;
    display: none;
}

.scrim.open {
    display: block;
}

/* ---------- Responsive -------------------------------------------------- */

@media (max-width: 1240px) {
    .toc {
        display: none;
    }

    .page {
        padding-right: 40px;
    }
}

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

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

    .main {
        margin-left: 0;
    }

    .drawer-toggle {
        display: grid;
    }

    .topbar-link.hide-sm {
        display: none;
    }

    .page {
        padding: 28px 20px 72px;
    }

    .hero h1 {
        font-size: 1.9rem;
    }

    .search-trigger {
        max-width: none;
    }

    .search-trigger kbd {
        display: none;
    }
}

@media (max-width: 560px) {
    .api {
        padding: 16px;
    }

    .content h2 {
        font-size: 1.35rem;
        margin-top: 48px;
    }

    .hero .lede {
        font-size: 0.98rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

@media print {
    .sidebar,
    .topbar,
    .toc,
    .palette-backdrop,
    .copy-btn,
    .scrim {
        display: none !important;
    }

    .main {
        margin-left: 0;
    }
}
