:root {
    color-scheme: light dark;
    --background: #f9fafb;
    --background-dark: #111827;
    --sidebar-bg: #1f2937;
    --sidebar-text: #f9fafb;
    --accent: #2563eb;
    --accent-muted: #93c5fd;
    --text: #1f2937;
    --text-muted: #4b5563;
    --border: #e5e7eb;
    --code-bg: #111827;
    --code-text: #f9fafb;
}

html,
body {
    height: 100%;
}

* {
    box-sizing: border-box;
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox, Safari 18.2+, Chromium 121+ */
}

*::-webkit-scrollbar {
    display: none;  /* Older Safari and Chromium */
}


body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 14px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.25);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    z-index: 1200;
}

.menu-toggle:hover {
    transform: translateY(-1px);
}

.menu-toggle:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.menu-toggle.is-active {
    background: var(--accent);
    color: #fff;
}

.menu-toggle-box {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 24px;
}

.menu-toggle-bar {
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

.sidebar-backdrop {
    display: none;
}

.layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

.side-header {
    width: 100%;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1rem 1.5rem;
    flex: 0 0 auto;
}

.sidebar {
    width: 380px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex: 0 0 380px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.sidebar-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.sidebar-subtitle {
    margin: 0.5rem 0 0;
    color: rgba(249, 250, 251, 0.7);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.75rem;
    margin-right: -0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.6) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}

.sidebar-subject {
    margin-bottom: 2rem;
}

.sidebar-subject:last-of-type {
    margin-bottom: 0;
}

.sidebar-subject-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(249, 250, 251, 0.6);
}

.sidebar-chapter {
    margin: 0 0 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    transition: background 0.2s ease;
    overflow: hidden;
}

.sidebar-chapter:last-child {
    margin-bottom: 0;
}

.sidebar-chapter[open] {
    background: rgba(37, 99, 235, 0.25);
}

.sidebar-chapter-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(249, 250, 251, 0.75);
    cursor: pointer;
    border-radius: 0.75rem;
    list-style: none;
}

.sidebar-chapter-title:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text);
}

.sidebar-chapter-title::-webkit-details-marker {
    display: none;
}

.sidebar-chapter-title::after {
    content: '';
    margin-left: auto;
    width: 0.65rem;
    height: 0.65rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

.sidebar-chapter[open] > .sidebar-chapter-title {
    color: var(--sidebar-text);
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-chapter[open] > .sidebar-chapter-title::after {
    transform: rotate(45deg);
}

.sidebar-chapter-title:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.chapter-entries {
    list-style: none;
    margin: 0;
    padding: 0.6rem 0.85rem 0.85rem;
    display: grid;
    gap: 0.4rem;
}

.chapter-entry a,
.chapter-entry span {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
}

.chapter-entry a {
    color: var(--sidebar-text);
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease, transform 0.2s ease;
}

.chapter-entry a:hover,
.chapter-entry.is-active a {
    background: rgba(37, 99, 235, 0.4);
    transform: translateX(4px);
}

.chapter-entry.is-active a {
    font-weight: 600;
}

.chapter-entry.is-locked span {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(249, 250, 251, 0.5);
    cursor: not-allowed;
}

.content {
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    min-height: 0;
}

.content-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
}

.content-chapter {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.content-body {
    display: grid;
    gap: 1.25rem;
    line-height: 1.7;
    font-size: 1.05rem;
}

.content-body h3 {
    margin-top: 2rem;
}

.content-body ul,
.content-body ol {
    padding-left: 1.5rem;
}

.content-pagination {
    margin-top: 3rem;
    display: block;
}

.pagination-link {
    padding: 0.8rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.pagination-link[rel="prev"] {
    float: left;
}

.pagination-link[rel="next"] {
    float: right;
}

.pagination-link:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: #0b1f52;
}

.pagination-link.disabled {
    background: #f3f4f6;
    color: var(--text-muted);
    border-color: var(--border);
    cursor: not-allowed;
}

.content-image {
    margin: 1.5rem auto;
    display: flex;
    justify-content: center;
}

.content-image img {
    max-width: 100%;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.callout {
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--accent);
    background: rgba(37, 99, 235, 0.08);
    border-radius: 0.75rem;
}

.callout-info {
    border-color: var(--accent);
}

.callout-warn {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.callout-error {
    border-color: #f5240b;
    background: #f5240b1c;
    color: #f5240b;
    font-weight: bold;
}

.callout-success {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}

.code-block {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1.25rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    font-family: 'Fira Code', 'Source Code Pro', Menlo, Monaco, Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
}

.code-block code {
    display: block;
    white-space: pre;
}

article > h1
{
    margin: 0;
}

article ::marker {
    font-weight: bold;
    font-size: 24px;
}

#command code
{
    margin-left: 0.5rem;
    font-size: 18px;
}

@media (max-width: 960px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        gap: 1.5rem;
        flex: 0 0 auto;
        height: auto;
    }

    .sidebar-nav {
        max-height: 260px;
        margin-right: 0;
    }

    .content {
        padding: 2rem 2.5rem 3rem;
        margin-bottom: 60px;
    }

    body.js .layout {
        flex-direction: column;
    }

    body.js .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(85vw, 360px);
        max-width: 360px;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        padding: 4.5rem 1.75rem 2.5rem;
        gap: 2rem;
        overflow-y: auto;
        z-index: 1000;
    }

    body.js .sidebar-header {
        flex-shrink: 0;
    }

    body.js .sidebar-nav {
        max-height: unset;
        flex: 1;
    }

    body.js.has-open-sidebar .sidebar {
        transform: translateX(0);
        box-shadow: -20px 0 40px rgba(15, 23, 42, 0.45)
    }

    body.js .menu-toggle {
        display: flex;
    }

    body.js .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(17, 24, 39, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 900;
    }

    body.js.has-open-sidebar .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.js.has-open-sidebar {
        overflow: hidden;
    }

    body.js .content {
        padding: 2.5rem 1.5rem 3rem;
    }


    .pagination-link {
        font-size: 14px;
        padding: 0;
        background: none;
        border: none;
    }

    .content-header {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .content-body {
        line-height: 1.5;
        font-size: 0.75rem;
    }

    .content-image {
        width: 100%;
        max-width: 100vw;
        margin: 1.5rem 0;
    }


    .content-body ul, .content-body ol
    {
        list-style-type: none;
        padding: 0;
        margin-right: 1.5rem;
        max-width: 90vw;
    }

    article ::marker {
        display: none;
    }

    .code-block
    {
        font-size: 0.5rem;
        padding: 0.5rem;
        overflow-x: scroll;
    }


}
