:root {
    color-scheme: light dark;
    --bg: #f5f6fb;
    --panel: #ffffff;
    --panel-border: #e2e4f0;
    --text: #14162a;
    --muted: #5b5f7a;
    --accent-1: #6d5bff;
    --accent-2: #17c3e6;
    --accent-fg: #ffffff;
    --code-bg: #eef0fa;
    --shadow: 0 16px 40px -24px rgba(20, 22, 42, 0.35);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0c16;
        --panel: #14162a;
        --panel-border: #262a45;
        --text: #f1f2fb;
        --muted: #9a9ec2;
        --accent-1: #8c7bff;
        --accent-2: #3fd8f5;
        --accent-fg: #0b0c16;
        --code-bg: #1c1f38;
        --shadow: 0 16px 50px -18px rgba(0, 0, 0, 0.6);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); }

.wrap {
    width: min(1080px, calc(100vw - 40px));
    margin: 0 auto;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 0;
}

.nav .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
}

.nav .brand .mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}

.nav .links {
    display: flex;
    align-items: center;
    gap: 26px;
    font-size: .92rem;
    font-weight: 550;
}

.nav .links a {
    color: var(--muted);
    text-decoration: none;
}

.nav .links a:hover { color: var(--text); }

.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 40px;
    padding: 20px 0 60px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section {
    margin: 18px 0 4px;
    padding: 0 12px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    opacity: .7;
}

.sidebar-section:first-child { margin-top: 0; }

.sidebar a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: .92rem;
    font-weight: 550;
}

.sidebar a:hover { color: var(--text); background: var(--code-bg); }

.sidebar a.active {
    color: var(--accent-fg);
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}

article.doc {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 44px 52px;
    max-width: 720px;
}

article.doc h1 {
    margin: 0 0 24px;
    font-size: 2rem;
    letter-spacing: -.01em;
}

article.doc h2 {
    margin: 36px 0 14px;
    font-size: 1.25rem;
    letter-spacing: -.01em;
}

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

article.doc p, article.doc li { color: var(--text); }
article.doc p { margin: 0 0 14px; }
article.doc ul, article.doc ol { margin: 0 0 14px; padding-left: 1.3rem; }
article.doc li { margin-bottom: 6px; }

article.doc code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: .9em;
}

article.doc pre {
    background: var(--code-bg);
    padding: 16px;
    border-radius: 10px;
    overflow-x: auto;
}

article.doc pre code {
    background: none;
    padding: 0;
}

article.doc strong { font-weight: 700; }

.page-nav {
    display: flex;
    justify-content: space-between;
    max-width: 720px;
    margin-top: 24px;
    font-size: .9rem;
}

.page-nav a {
    text-decoration: none;
    color: var(--muted);
}

.page-nav a:hover { color: var(--text); }

footer {
    padding: 20px 0 60px;
    color: var(--muted);
    font-size: .85rem;
    border-top: 1px solid var(--panel-border);
}

footer a { color: var(--muted); }

@media (max-width: 780px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
    article.doc { padding: 28px; }
}
