.docs-page {
    background:
        radial-gradient(circle at top left, rgba(79, 209, 197, 0.08), transparent 24%),
        linear-gradient(180deg, #07111a 0%, #050b10 100%);
}

.docs-shell {
    width: min(calc(100% - 24px), 1320px);
}

.docs-header {
    margin-bottom: 24px;
}

.docs-header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    font-weight: 700;
}

.header-link:hover,
.header-link:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

.docs-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.docs-sidebar,
.docs-content {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.docs-sidebar {
    position: sticky;
    top: 18px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 36px);
    padding: 20px 18px;
}

.sidebar-label {
    margin: 0 0 14px;
    color: var(--accent-cool);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.tree-nav ul {
    padding-left: 0;
    margin: 0;
    list-style: none;
}

.tree-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding-right: 4px;
}

.tree-node > a,
.tree-node ul a,
.tree-group-toggle {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text);
}

.tree-node > a,
.tree-group-toggle {
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
}

.tree-group-toggle {
    position: relative;
    list-style: none;
    text-align: left;
    cursor: pointer;
}

.tree-group-toggle::-webkit-details-marker {
    display: none;
}

.tree-group-toggle::after {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--muted);
    content: "+";
}

.tree-group[open] > .tree-group-toggle::after {
    content: "-";
}

.tree-node ul {
    margin-top: 10px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.tree-node ul a {
    margin-top: 4px;
    color: var(--muted);
}

.tree-nav a:hover,
.tree-nav a:focus-visible,
.tree-nav a.active,
.tree-group-toggle:hover,
.tree-group-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.tree-node ul a.active {
    color: var(--text);
    background: rgba(255, 159, 67, 0.12);
}

.docs-content {
    padding: 28px;
}

.doc-hero {
    margin-bottom: 28px;
}

.doc-hero h1 {
    margin: 0 0 18px;
    font-size: clamp(2.6rem, 5vw, 4.4rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
}

.doc-hero p,
.doc-section p {
    max-width: 72ch;
    color: var(--muted);
    line-height: 1.78;
}

.doc-section ul,
.doc-section ol {
    max-width: 72ch;
    margin: 16px 0;
    padding-left: 22px;
    color: var(--muted);
    line-height: 1.78;
}

.doc-section li + li {
    margin-top: 8px;
}

.doc-section + .doc-section {
    margin-top: 34px;
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.doc-section h2 {
    margin: 0 0 14px;
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.doc-section h3 {
    margin: 22px 0 12px;
    font-size: 1.15rem;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.doc-grid.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.doc-card,
.doc-callout,
.mode-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
}

.doc-card {
    padding: 18px;
}

.doc-card h3 {
    margin-top: 0;
}

.doc-card p {
    margin-bottom: 0;
}

.doc-link {
    text-decoration: underline;
    text-decoration-color: rgba(255, 159, 67, 0.45);
    text-underline-offset: 0.18em;
}

.doc-subsection + .doc-subsection {
    margin-top: 28px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0 6px;
}

.mode-card {
    padding: 18px;
}

.mode-card h4 {
    margin: 0 0 10px;
    font-size: 1.1rem;
}

.mode-card p:last-child {
    margin-bottom: 0;
}

.docs-content pre {
    margin: 0;
    padding: 20px;
    overflow: auto;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    color: #dff8f4;
    line-height: 1.8;
}

.doc-callout {
    margin-top: 18px;
    padding: 18px;
    background:
        linear-gradient(135deg, rgba(255, 159, 67, 0.12), rgba(79, 209, 197, 0.08)),
        rgba(255, 255, 255, 0.03);
}

.doc-callout p {
    margin: 0;
    max-width: none;
}

.doc-pagination {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    align-items: stretch;
}

.pager-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(100%, 320px);
    min-height: 96px;
    padding: 16px 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        linear-gradient(135deg, rgba(255, 159, 67, 0.12), rgba(79, 209, 197, 0.07));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.pager-link span {
    display: block;
    margin-bottom: 8px;
    color: var(--accent-cool);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.pager-link strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.5;
}

.doc-pagination .pager-link:first-child {
    justify-self: start;
    text-align: left;
    align-items: flex-start;
}

.doc-pagination .pager-link:last-child {
    justify-self: end;
    text-align: right;
    align-items: flex-end;
}

.doc-pagination .pager-link:first-child span::before {
    content: "< ";
}

.doc-pagination .pager-link:last-child span::after {
    content: " >";
}

.pager-link:hover,
.pager-link:focus-visible {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
        linear-gradient(135deg, rgba(255, 159, 67, 0.18), rgba(79, 209, 197, 0.1));
    border-color: rgba(255, 159, 67, 0.35);
    box-shadow:
        0 22px 48px rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(255, 159, 67, 0.08);
    transform: translateY(-1px);
}

.pager-link:focus-visible {
    outline: 2px solid rgba(79, 209, 197, 0.42);
    outline-offset: 2px;
}

@media (max-width: 1080px) {
    .docs-layout,
    .doc-grid,
    .doc-grid.two-up,
    .mode-grid,
    .doc-pagination {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
        display: block;
        height: auto;
    }

    .tree-nav {
        overflow-y: visible;
        padding-right: 0;
    }

    .doc-pagination .pager-link:first-child,
    .doc-pagination .pager-link:last-child {
        justify-self: stretch;
        width: 100%;
        text-align: left;
        align-items: flex-start;
    }

    .doc-pagination .pager-link:last-child span::after {
        content: "";
    }

    .doc-pagination .pager-link:last-child span::before {
        content: "> ";
    }
}

@media (max-width: 720px) {
    .docs-header {
        align-items: stretch;
    }

    .docs-header-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .docs-content {
        padding: 20px;
    }

    .doc-hero h1 {
        font-size: clamp(2.2rem, 10vw, 3rem);
    }
}
