@import url('https://fonts.flameapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Golos+Text:wght@400;500;600;700;800&family=Noto+Serif+SC:wght@500;600;700;900&family=Noto+Sans+SC:wght@300;400;500;700;900&family=Noto+Serif+TC:wght@500;600;700;900&family=Noto+Sans+TC:wght@300;400;500;700;900&family=Zen+Old+Mincho:wght@400;500;600;700;900&family=Zen+Kaku+Gothic+New:wght@300;400;500;700;900&family=Nanum+Myeongjo:wght@400;700;800&family=Noto+Sans+KR:wght@300;400;500;700;900&family=JetBrains+Mono:wght@400;500;700&family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0,0&display=swap');

:root {
    --font-display: 'Playfair Display', 'Noto Serif SC', 'Noto Serif TC', serif;
    --font-sans: 'Plus Jakarta Sans', 'Noto Sans SC', 'Noto Sans TC', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition-smooth: cubic-bezier(0.2, 0, 0, 1);

    --bg-base: #0A0A0C;
    --bg-glass: rgba(20, 18, 24, 0.75);
    --text-primary: #F5F0FF;
    --text-secondary: #A7A5B4;
    --border-base: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(var(--tint-iris-rgb), 0.3);

    --pill-bg: rgba(30, 28, 36, 0.85);
    --pill-border: rgba(255, 255, 255, 0.05);

    --accent-flame: #FF7E67;
    --accent-iris: #A78BFA;
    --tint-iris-rgb: 167, 139, 250;

    --shadow-expressive: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);

    --radius-pill: 999px;
    --radius-card: 40px;
    --radius-input: 24px;
}

body[data-lang="ru"] {
    --font-sans: 'Golos Text', 'Plus Jakarta Sans', system-ui, sans-serif;
}

body[data-lang="zh_hans"] {
    --font-display: 'Noto Serif SC', serif;
    --font-sans: 'Noto Sans SC', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Noto Sans SC', monospace;
}

body[data-lang="zh_hant"] {
    --font-display: 'Noto Serif TC', serif;
    --font-sans: 'Noto Sans TC', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Noto Sans TC', monospace;
}

body[data-lang="ja"] {
    --font-display: 'Zen Old Mincho', serif;
    --font-sans: 'Zen Kaku Gothic New', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Zen Kaku Gothic New', monospace;
}

body[data-lang="ko"] {
    --font-display: 'Nanum Myeongjo', serif;
    --font-sans: 'Noto Sans KR', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Noto Sans KR', monospace;
}

body.light-mode {
    --bg-base: #FDFBFF;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --text-primary: #1A1820;
    --text-secondary: #6B6875;
    --border-base: rgba(var(--tint-iris-rgb), 0.15);
    --border-hover: rgba(var(--tint-iris-rgb), 0.4);

    --pill-bg: rgba(255, 255, 255, 0.95);
    --pill-border: rgba(var(--tint-iris-rgb), 0.15);

    --accent-flame: #FF4800;
    --accent-iris: #9A1FFF;
    --tint-iris-rgb: 154, 31, 255;

    --shadow-expressive: 0 16px 40px rgba(var(--tint-iris-rgb), 0.08), 0 0 0 1px rgba(255, 255, 255, 0.5);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    min-height: 100vh;
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.6s var(--transition-smooth), color 0.6s var(--transition-smooth), opacity 0.28s ease;
    -webkit-font-smoothing: antialiased;
}

body.page-fade-out {
    opacity: 0;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-flame);
    outline-offset: 3px;
    border-radius: 6px;
}

::selection {
    background: var(--accent-flame);
    color: #fff;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 99px;
    border: 3px solid var(--bg-base);
}

a,
button {
    touch-action: manipulation;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
}

.heading-massive {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 6vw, 4.8rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.heading-large {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.label-micro {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.text-body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

#ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    filter: blur(140px) saturate(140%);
    transform: scale(1.2);
    opacity: 0.85;
}

body.light-mode #ambient-canvas {
    opacity: 0.65;
}

.header {
    position: fixed;
    top: 2rem;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 96%;
    max-width: 1600px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.header>* {
    pointer-events: auto;
}

.header-brand-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-pill,
.control-pill {
    background: var(--pill-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--pill-border);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s var(--transition-smooth);
    box-shadow: var(--shadow-expressive);
    white-space: nowrap;
    flex-shrink: 0;
}

.logo-pill {
    padding: 0.8rem 1.8rem;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    gap: 0.7rem;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: block;
}

.control-pill {
    padding: 0.8rem 1.4rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    gap: 0.5rem;
    cursor: pointer;
}

.theme-toggle-btn {
    width: 48px;
    height: 48px;
    padding: 0;
}

.logo-pill:hover,
.control-pill:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px) scale(1.02);
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.material-symbols-rounded {
    font-size: 1.3rem !important;
    line-height: 1;
    display: inline-block;
    user-select: none;
    flex-shrink: 0;
    font-variation-settings: 'opsz' 24, 'wght' 400, 'FILL' 0, 'GRAD' 0;
}

body.dark-mode .icon-sun {
    display: none !important;
}

body.dark-mode .icon-moon {
    display: inline-block !important;
}

body.light-mode .icon-sun {
    display: inline-block !important;
}

body.light-mode .icon-moon {
    display: none !important;
}

.custom-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--border-base);
    border-radius: 24px;
    min-width: 180px;
    list-style: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px) scale(0.95);
    transition: all 0.4s var(--transition-smooth);
    z-index: 200;
    overflow: hidden;
    box-shadow: var(--shadow-expressive);
    padding: 0.5rem;
}

.custom-dropdown.active .dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.dropdown-menu li {
    padding: 0.9rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 16px;
    transition: background 0.2s;
    white-space: nowrap;
}

.dropdown-menu li:hover {
    background: var(--text-primary);
    color: var(--bg-base);
}

body[data-lang="en"] #lang-menu li[data-lang="en"],
body[data-lang="zh_hans"] #lang-menu li[data-lang="zh_hans"],
body[data-lang="zh_hant"] #lang-menu li[data-lang="zh_hant"],
body[data-lang="ja"] #lang-menu li[data-lang="ja"],
body[data-lang="ko"] #lang-menu li[data-lang="ko"],
body[data-lang="ru"] #lang-menu li[data-lang="ru"],
body[data-lang="es"] #lang-menu li[data-lang="es"] {
    background: rgba(var(--tint-iris-rgb), 0.18);
    color: var(--text-primary);
}

.user-avatar-disc {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar-initial {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.78rem;
    color: #fff;
}

.auth-user-pill {
    padding: 0.35rem 0.6rem 0.35rem 0.4rem;
}

.dropdown-triangle {
    font-size: 1.1rem !important;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.account-dropdown-wrapper.active .dropdown-triangle {
    transform: rotate(180deg);
}

.account-dropdown-menu {
    min-width: 280px;
    border-radius: 24px;
}

.account-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1rem 1.1rem;
}

.avatar-disc-medium {
    width: 44px;
    height: 44px;
}

.avatar-disc-medium .user-avatar-initial {
    font-size: 1rem;
}

.avatar-disc-small {
    width: 34px;
    height: 34px;
}

.account-item-name {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
}

.account-item-email {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.account-dropdown-divider {
    height: 1px;
    margin: 0.4rem 0.6rem;
    background: var(--border-base);
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.2s ease, color 0.2s ease;
}

.account-menu-item .material-symbols-rounded {
    font-size: 1.1rem !important;
    color: var(--text-secondary);
}

.account-menu-item:hover {
    background: var(--text-primary);
    color: var(--bg-base);
}

.account-menu-item:hover .material-symbols-rounded {
    color: var(--bg-base);
}

.signout-menu-item:hover {
    background: rgba(189, 30, 30, 0.85) !important;
    color: #fff !important;
}

.signout-menu-item:hover .material-symbols-rounded {
    color: #fff !important;
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s var(--transition-smooth) forwards;
}

.fade-in.fade-done {
    animation: none;
    opacity: 1;
    transform: none;
}

@keyframes fadeInOpacity {
    from { opacity: 0; }
    to { opacity: 1; }
}

.docs-shell.fade-in {
    opacity: 1;
    animation-name: fadeInOpacity;
    animation-fill-mode: backwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

html.js .scroll-reveal {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(6px);
    transition: opacity 1s var(--transition-smooth), transform 1s var(--transition-smooth), filter 1s var(--transition-smooth);
    transition-delay: var(--rd, 0s);
}

html.js .scroll-reveal.revealed {
    opacity: 1;
    transform: none;
    filter: blur(0);
}

.split-title .wd {
    display: inline-block;
}

.split-title .wd.nowrap {
    white-space: nowrap;
}

.split-title .ch {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.32em) rotate(2deg);
    filter: blur(10px);
    transition: opacity 0.8s var(--transition-smooth), transform 0.8s var(--transition-smooth), filter 0.8s var(--transition-smooth);
    transition-delay: var(--cd, 0s);
    will-change: opacity, transform, filter;
}

.split-title.split-in .ch {
    opacity: 1;
    transform: none;
    filter: blur(0);
}

.docs-hero {
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(2rem + 96px + 3rem) 4% 2.5rem;
    text-align: center;
    position: relative;
    z-index: 10;
}

.docs-title {
    font-family: var(--font-display);
}

.docs-lead {
    margin-top: 1.2rem;
    max-width: 56ch;
    margin-inline: auto;
}

.docs-shell {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    padding: 0 4% 5rem;
    width: 100%;
    position: relative;
    z-index: 10;
}

.doc-sidebar {
    position: sticky;
    top: 7.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-base);
    border-radius: 32px;
    padding: 1.8rem 1.5rem;
    box-shadow: var(--shadow-expressive);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-scroll {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-progress {
    position: absolute;
    left: 0;
    top: 1.6rem;
    bottom: 1.6rem;
    width: 3px;
    border-radius: 99px;
    background: var(--border-base);
    overflow: hidden;
}

.sidebar-progress i {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--accent-flame), var(--accent-iris));
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.18s linear;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding: 0 0.6rem;
    text-align: left;
}

.sidebar-fab {
    position: absolute;
    top: 1.2rem;
    left: 100%;
    margin-left: 10px;
    z-index: 5;
    display: none;
    align-items: center;
    gap: 7px;
    padding: 11px 16px;
    border: 1px solid var(--border-base);
    border-radius: 999px;
    background: var(--pill-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-expressive);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.sidebar-fab:active {
    transform: scale(0.96);
}

.sidebar-fab .material-symbols-rounded {
    font-size: 1.1rem !important;
    color: var(--accent-flame);
}

.sidebar-fab.open .material-symbols-rounded {
    color: var(--accent-iris);
}

.sidebar-fab .material-symbols-rounded {
    font-size: 1.25rem !important;
}

.sidebar-fab .icon-close {
    display: none;
}

.sidebar-fab.open .icon-open {
    display: none;
}

.sidebar-fab.open .icon-close {
    display: inline-block;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 140;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--transition-smooth);
}

.sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-group-heading {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin: 1.2rem 0 0.6rem;
    padding: 0 0.6rem;
}

.doc-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background 0.25s var(--transition-smooth), color 0.25s var(--transition-smooth);
}

.doc-nav-item:hover {
    background: rgba(var(--tint-iris-rgb), 0.12);
    color: var(--text-primary);
}

.doc-nav-item.active {
    background: rgba(var(--tint-iris-rgb), 0.2);
    color: var(--text-primary);
}

.doc-link-num {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.doc-nav-item.active .doc-link-num {
    color: var(--accent-flame);
}

.doc-content {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
    min-width: 0;
}

.doc-chapter-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 620px;
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-base);
    border-radius: 32px;
    padding: 2.4rem 2.6rem;
    box-shadow: var(--shadow-expressive);
    scroll-margin-top: 8rem;
    transition: border-color 0.3s var(--transition-smooth);
}

.doc-chapter-section:hover {
    border-color: var(--border-hover);
}

.doc-chapter-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.doc-chapter-header h2 {
    flex: 1;
    min-width: 0;
}

.chapter-open {
    margin-left: auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-base);
    background: rgba(var(--tint-iris-rgb), 0.08);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.35s var(--transition-smooth);
}

.chapter-open .material-symbols-rounded {
    font-size: 1.1rem !important;
}

.chapter-open:hover {
    background: var(--accent-iris);
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px) scale(1.04);
}

.anchor-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.anchor-btn .material-symbols-rounded {
    font-size: 1rem !important;
}

.doc-chapter-header:hover .anchor-btn,
.anchor-btn:focus-visible,
.anchor-btn.copied {
    opacity: 1;
}

.anchor-btn:hover {
    background: rgba(var(--tint-iris-rgb), 0.15);
    color: var(--text-primary);
}

.anchor-btn.copied {
    color: var(--accent-flame);
}

.status-lock {
    margin-left: auto;
    font-size: 1.05rem !important;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.chapter-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: var(--accent-flame);
}

.portal-icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--tint-iris-rgb), 0.12);
    color: var(--accent-iris);
    flex-shrink: 0;
}

.doc-chapter-header .heading-large {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.doc-body-text {
    margin: 0;
    max-width: 64ch;
}

.doc-body-text + .doc-body-text {
    margin-top: 0.8rem;
}

.doc-spec-list {
    list-style: none;
    margin: 1.6rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.8rem;
}

.doc-spec-list li {
    padding: 1.2rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-base);
    background: rgba(var(--tint-iris-rgb), 0.04);
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    transition: border-color 0.3s var(--transition-smooth), background 0.3s var(--transition-smooth);
}

.doc-spec-list li:hover {
    border-color: var(--border-hover);
    background: rgba(var(--tint-iris-rgb), 0.08);
}

.doc-spec-list strong {
    color: var(--text-primary);
    font-weight: 700;
}

.doc-spec-list code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    padding: 0.15em 0.5em;
    border-radius: 8px;
    background: rgba(var(--tint-iris-rgb), 0.15);
    color: var(--text-primary);
}

.doc-action-strip {
    margin-top: 1.8rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--text-primary);
    color: var(--bg-base);
    border: none;
    border-radius: var(--radius-pill);
    padding: 1rem 2.2rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.4s var(--transition-smooth);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    text-align: center;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.btn-primary[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.icon-github {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

body.light-mode .btn-primary .icon-github {
    filter: invert(1);
}

.back-to-top-btn {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    z-index: 90;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--pill-border);
    background: var(--pill-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-expressive);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s var(--transition-smooth), border-color 0.25s ease;
}

.back-to-top-btn.show {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.back-to-top-btn:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
}

.page-footer {
    width: 100%;
    padding: 2.5rem 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-base);
    margin-top: auto;
    position: relative;
    z-index: 10;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.legal-links {
    display: flex;
    gap: 1.5rem;
}

.legal-link {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

.legal-link:hover {
    color: var(--accent-flame);
}

.error-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
    z-index: 10;
    min-height: calc(100vh - 200px);
}

.error-content {
    text-align: center;
    max-width: 600px;
}

.error-code {
    font-family: var(--font-display);
    font-size: clamp(7rem, 15vw, 12rem);
    line-height: 1;
    letter-spacing: -0.05em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-content .heading-large {
    font-weight: 500;
    color: var(--text-secondary);
}

.error-actions {
    margin-top: 2.5rem;
}

.error-actions .btn-primary {
    display: inline-block;
}

@media (max-width: 900px) {
    .header {
        top: 1.2rem;
        width: 92%;
    }

    .logo-pill {
        padding: 0.6rem 1.2rem;
        font-size: 1.1rem;
    }

    .brand-mark {
        width: 24px;
        height: 24px;
    }

    .controls {
        gap: 0.5rem;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .header .control-pill {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    .auth-user-pill {
        width: auto !important;
        height: 44px !important;
        padding: 0 0.6rem 0 0.4rem !important;
        border-radius: var(--radius-pill) !important;
    }

    .docs-hero {
        padding-top: calc(1.2rem + 76px + 2.5rem);
    }

    .docs-shell {
        grid-template-columns: 1fr;
    }

    .sidebar-fab {
        display: flex;
    }

    .anchor-btn {
        opacity: 1;
    }

    .doc-chapter-header {
        flex-wrap: wrap;
    }

    .doc-chapter-header h2 {
        flex: 1 1 100%;
        order: 3;
        margin-top: 4px;
    }

    .chapter-open {
        order: 2;
    }

    .docs-shell.fade-in {
        position: static;
        z-index: auto;
        animation: none;
        opacity: 1;
    }

    .doc-content {
        position: relative;
        z-index: 2;
    }

    .sidebar-backdrop {
        z-index: 50;
    }

    .doc-sidebar {
        position: fixed;
        left: 10px;
        top: 5.5rem;
        bottom: 14px;
        width: min(72vw, 296px);
        border-radius: 28px;
        border: 1px solid var(--border-base);
        background: var(--bg-base);
        transform: translateX(-100%);
        transition: transform 0.35s var(--transition-smooth);
        overflow: visible;
        z-index: 160;
        padding: 0;
    }

    .doc-sidebar.open {
        transform: none;
    }

    .sidebar-scroll {
        height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 2rem 1.5rem;
    }

    .anchor-btn {
        width: 40px;
        height: 40px;
    }

    .doc-chapter-section {
        padding: 1.8rem 1.5rem;
        border-radius: 28px;
    }

    .page-footer {
        flex-direction: column;
        text-align: center;
    }

    .footer-left {
        justify-content: center;
    }

    .legal-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .back-to-top-btn {
        right: 1.2rem;
        bottom: 1.2rem;
    }
}

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

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

    html.js .scroll-reveal {
        opacity: 1;
        transform: none;
        filter: none;
    }
}
