:root {
    --bg: #fbfbfc;
    --surface: #ffffff;
    --surface-2: #f5f6f7;
    --surface-3: #eef0f2;
    --text: #17191d;
    --muted: #676c75;
    --faint: #9298a2;
    --line: #e4e7eb;
    --line-strong: #d8dce2;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #edf4ff;
    --accent-line: #cbdcff;
    --code: #f6f7f9;
    --header: rgba(251, 251, 252, 0.9);
    --shadow: 0 18px 50px rgba(17, 24, 39, 0.11);
    --sidebar: 304px;
    --top: 66px;
    --radius: 12px;
}

html[data-theme='dark'] {
    --bg: #101114;
    --surface: #16181c;
    --surface-2: #1c1f24;
    --surface-3: #242830;
    --text: #f1f3f5;
    --muted: #a4aab4;
    --faint: #747b86;
    --line: #292d34;
    --line-strong: #353a43;
    --accent: #73a7ff;
    --accent-hover: #9bc0ff;
    --accent-soft: #172744;
    --accent-line: #274675;
    --code: #15171b;
    --header: rgba(16, 17, 20, 0.9);
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 92px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.72 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
select,
input {
    font: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.lucide {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    height: var(--top);
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(0, auto) minmax(260px, 1fr);
    align-items: center;
    gap: 18px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    background: var(--header);
    backdrop-filter: saturate(150%) blur(14px);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-right {
    justify-content: flex-end;
}

.topbar-center {
    min-width: 0;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 5px;
    color: var(--text);
    text-decoration: none;
    font-size: 17px;
    font-weight: 780;
    letter-spacing: -0.025em;
}

.brand span {
    color: var(--muted);
    font-weight: 560;
}

.version-wrap select {
    max-width: 130px;
    appearance: none;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    padding: 6px 24px 6px 8px;
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 11px) 51%,
        calc(100% - 7px) 51%;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}

.version-wrap select:hover {
    border-color: var(--line);
    background-color: var(--surface);
}

.search-button,
.icon-button {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.search-button:hover,
.icon-button:hover {
    border-color: var(--line-strong);
    color: var(--text);
    background: var(--surface-2);
}

.search-button {
    height: 36px;
    min-width: 232px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 10px;
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
    font-size: 12.5px;
}

.search-label {
    flex: 1;
}

.search-button kbd,
.search-input-wrap kbd {
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--faint);
    font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.icon-button {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border-radius: 9px;
    cursor: pointer;
}

.bookmark-button.active {
    color: var(--accent);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}

.bookmarks {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.bookmark-chip {
    max-width: 160px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
    font-size: 11.5px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-chip:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
    padding-top: var(--top);
}

.sidebar {
    position: fixed;
    top: var(--top);
    bottom: 0;
    left: 0;
    z-index: 30;
    width: var(--sidebar);
    border-right: 1px solid var(--line);
    background: var(--bg);
}

.sidebar-scroll {
    height: 100%;
    overflow: auto;
    padding: 20px 14px 34px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

.nav-section {
    margin: 0 0 15px;
}

.nav-section-title {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface-2) 74%, transparent);
    color: var(--muted);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 720;
    line-height: 1.3;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    text-align: left;
}

.nav-section-title:hover {
    border-color: var(--line-strong);
    color: var(--text);
    background: var(--surface-2);
}

.nav-section.has-active > .nav-section-title {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-section-root .nav-section-title {
    border-color: transparent;
    background: transparent;
    color: var(--faint);
    cursor: default;
    padding-left: 8px;
}

.nav-section-title .lucide {
    width: 14px;
    height: 14px;
    transition: transform 140ms ease;
}

.nav-section.collapsed .nav-section-title .lucide {
    transform: rotate(-90deg);
}

.nav-items {
    display: grid;
    gap: 2px;
    margin-top: 6px;
}

.nav-section.collapsed .nav-items {
    display: none;
}

.nav-link {
    position: relative;
    display: block;
    padding: 7px 9px;
    border-radius: 7px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.nav-link.active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 650;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 2px;
    border-radius: 999px;
    background: var(--accent);
}

.nav-link.level-2 {
    padding-left: 20px;
}

.main {
    grid-column: 2;
    min-width: 0;
}

.main-inner {
    max-width: 1220px;
    margin: 0 auto;
    padding: 38px 52px 90px;
}

.breadcrumbs {
    min-height: 28px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--faint);
    font-size: 12px;
}

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

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

.content-layout {
    display: grid;
    grid-template-columns: minmax(0, 790px) 190px;
    gap: 70px;
    align-items: start;
}

.document {
    min-width: 0;
    font-size: 16.5px;
}

.document > .doc-title:first-child,
.document h1 {
    margin: 0 0 28px;
    color: var(--text);
    font-size: clamp(35px, 4vw, 43px);
    font-weight: 780;
    line-height: 1.1;
    letter-spacing: -0.042em;
}

.document h2 {
    margin: 52px 0 16px;
    padding-top: 8px;
    font-size: 25px;
    line-height: 1.24;
    letter-spacing: -0.026em;
}

.document h3 {
    margin: 34px 0 12px;
    font-size: 19px;
    line-height: 1.35;
}

.document h4 {
    margin: 26px 0 9px;
    font-size: 16px;
}

.document p {
    margin: 0 0 18px;
    color: color-mix(in srgb, var(--text) 89%, var(--muted));
}

.document a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.document a:hover {
    color: var(--accent-hover);
}

.document strong {
    color: var(--text);
}

.document ul,
.document ol {
    margin: 0 0 20px;
    padding-left: 24px;
}

.document li {
    margin: 5px 0;
}

.document blockquote {
    margin: 22px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--accent);
    border-radius: 0 9px 9px 0;
    background: var(--surface-2);
    color: var(--muted);
}

.document hr {
    margin: 38px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.document code {
    padding: 2px 5px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--code);
    font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.document pre {
    position: relative;
    overflow: auto;
    margin: 21px 0 26px;
    padding: 38px 19px 19px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--code);
}

.document pre code {
    display: block;
    min-width: max-content;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    tab-size: 2;
}

.code-language {
    position: absolute;
    top: 11px;
    left: 14px;
    color: var(--faint);
    font: 650 9.5px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    user-select: none;
}

.code-copy {
    position: absolute;
    top: 7px;
    right: 7px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 10.5px;
    opacity: 0.8;
}

.code-copy:hover,
.code-copy:focus-visible {
    opacity: 1;
    color: var(--text);
}

.code-copy .lucide {
    width: 13px;
    height: 13px;
}

.document table {
    display: block;
    width: 100%;
    overflow: auto;
    margin: 22px 0;
    border-collapse: collapse;
    font-size: 13.5px;
}

.document th,
.document td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

.document th {
    background: var(--surface-2);
    color: var(--text);
    font-weight: 680;
}

.document img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 24px 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.heading-link {
    margin-left: 7px;
    color: var(--faint) !important;
    text-decoration: none !important;
    font-weight: 400;
    opacity: 0;
}

.document h2:hover .heading-link,
.document h3:hover .heading-link,
.heading-link:focus-visible {
    opacity: 1;
}

.page-toc {
    position: sticky;
    top: 94px;
    padding-left: 16px;
    border-left: 1px solid var(--line);
}

.toc-label {
    margin-bottom: 9px;
    color: var(--faint);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.toc-link {
    display: block;
    padding: 4px 0;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    line-height: 1.45;
}

.toc-link.level-3 {
    padding-left: 11px;
}

.toc-link:hover,
.toc-link.active {
    color: var(--accent);
}

.loading,
.empty-state {
    padding: 44px 0;
    color: var(--muted);
}

.overlay {
    position: fixed;
    inset: var(--top) 0 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.3);
}

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(3px);
}

.search-panel {
    width: min(680px, calc(100% - 28px));
    max-height: min(700px, calc(100vh - 90px));
    margin: 72px auto 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.search-input-wrap {
    height: 58px;
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
}

.search-input-wrap input {
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 15px;
}

.search-results {
    max-height: 590px;
    overflow: auto;
    padding: 7px;
}

.search-hint {
    padding: 28px;
    color: var(--faint);
    text-align: center;
    font-size: 12.5px;
}

.search-result {
    display: block;
    padding: 11px 12px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}

.search-result:hover,
.search-result.selected {
    background: var(--surface-2);
}

.search-result-title {
    font-size: 13.5px;
    font-weight: 680;
}

.search-result-snippet {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.tok-comment {
    color: #708090;
    font-style: italic;
}

.tok-string {
    color: #2f7d4a;
}

.tok-number {
    color: #9a5d00;
}

.tok-keyword {
    color: #5b55c7;
    font-weight: 650;
}

.tok-variable {
    color: #a04373;
}

.tok-tag {
    color: #a33a3a;
}

.tok-property {
    color: #1d6f8a;
}

html[data-theme='dark'] .tok-comment {
    color: #7f8c98;
}

html[data-theme='dark'] .tok-string {
    color: #8bcf9f;
}

html[data-theme='dark'] .tok-number {
    color: #e6b76d;
}

html[data-theme='dark'] .tok-keyword {
    color: #b8b3ff;
}

html[data-theme='dark'] .tok-variable {
    color: #e39ac1;
}

html[data-theme='dark'] .tok-tag {
    color: #ff9c9c;
}

html[data-theme='dark'] .tok-property {
    color: #8dcddd;
}

.mobile-only {
    display: none;
}

@media (max-width: 1120px) {
    .topbar {
        grid-template-columns: auto 1fr auto;
    }

    .bookmarks {
        justify-content: flex-start;
    }

    .content-layout {
        grid-template-columns: minmax(0, 790px);
    }

    .page-toc {
        display: none;
    }

    .main-inner {
        max-width: 900px;
    }
}

@media (max-width: 860px) {
    .topbar-center {
        display: none;
    }

    .topbar {
        grid-template-columns: 1fr auto;
    }
}

@media (max-width: 760px) {
    :root {
        --sidebar: 294px;
    }

    .mobile-only {
        display: inline-grid;
    }

    .search-button {
        min-width: 36px;
        width: 36px;
        padding: 0;
        place-content: center;
    }

    .search-label,
    .search-button kbd {
        display: none;
    }

    .shell {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 180ms ease;
        box-shadow: var(--shadow);
    }

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

    .main {
        width: 100%;
    }

    .main-inner {
        padding: 28px 22px 64px;
    }

    .document {
        font-size: 16px;
    }

    .document pre {
        margin-right: -6px;
        margin-left: -6px;
        border-radius: 8px;
    }

    .brand {
        font-size: 16px;
    }

    .version-wrap select {
        max-width: 96px;
    }
}

@media (max-width: 460px) {
    .topbar {
        padding: 0 12px;
    }
}

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