@media (max-width: 960px) {
    html,
    body {
        overflow: hidden;
    }

    .container {
        display: block;
        height: 100dvh;
    }

    .content {
        height: 100dvh;
        padding: 0 18px 80px;
    }

    .markdown-body {
        max-width: none;
        padding-top: 24px;
    }

    .nav-sidebar,
    .toc-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 900;
        width: min(86vw, 320px);
        height: 100dvh;
        background: var(--color-panel);
        box-shadow: var(--shadow-md);
        transition: transform 180ms ease;
    }

    .nav-sidebar {
        left: 0;
        transform: translateX(-100%);
        border-right: 1px solid var(--color-border);
    }

    .nav-sidebar.show {
        transform: translateX(0);
    }

    .toc-sidebar {
        right: 0;
        transform: translateX(100%);
        border-left: 1px solid var(--color-border);
    }

    .toc-sidebar.show {
        transform: translateX(0);
    }

    .mobile-nav-toggle,
    .mobile-toc-toggle {
        position: fixed;
        z-index: 950;
        bottom: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        color: var(--color-text);
        background: var(--color-panel);
        border: 1px solid var(--color-border);
        border-radius: 999px;
        box-shadow: var(--shadow-md);
        cursor: pointer;
    }

    .mobile-nav-toggle {
        left: 16px;
    }

    .mobile-toc-toggle {
        right: 16px;
    }

    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 850;
        display: none;
        background: rgba(15, 23, 42, 0.36);
    }

    .mobile-nav-backdrop.show {
        display: block;
    }

    .search-results {
        max-height: 48vh;
    }

    .scroll-progress {
        left: 0;
        right: 0;
    }

    .back-to-top {
        right: 16px;
        bottom: 72px;
    }
}

@media (max-width: 640px) {
    .content {
        padding-inline: 14px;
    }

    .markdown-body {
        padding-top: 18px;
        font-size: 0.98rem;
    }

    .markdown-body h1 {
        font-size: 1.85rem;
    }

    .markdown-body h2 {
        font-size: 1.42rem;
    }

    .markdown-body h3 {
        font-size: 1.18rem;
    }

    .breadcrumbs {
        gap: 6px;
        margin-bottom: 18px;
        padding-bottom: 14px;
    }

    .copy-code-button {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
