#preview-area {
    min-height: 200px;
    background-color: color-mix(in srgb, var(--text-color) 2%, var(--bg-color));
    border: 1px dashed var(--footer-border);
    padding: 1rem;
    color: var(--text-color);
}

.docs-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 2rem;
}

.docs-content {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    min-width: 0;
    width: 100%;
}

.docs-toc {
    width: 260px;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    border-radius: 16px;
    border: 2px solid var(--main-color);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(18px);
    transform-origin: top center;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    scrollbar-color: color-mix(in srgb, var(--main-color) 50%, transparent) transparent;
}

    .docs-toc::before,
    .docs-toc::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 16px;
        pointer-events: none;
    }

    .docs-toc::after {
        mix-blend-mode: screen;
        opacity: 0;
        transition: opacity 0.35s ease;
    }

    .docs-toc:hover {
        /* transform: translateY(-6px) scale(1.01); */
        box-shadow: 0 18px 35px rgba(0, 0, 0, 0.55);
    }

        .docs-toc:hover::after {
            opacity: 1;
        }

.docs-toc__title {
    color: var(--main-color);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.docs-toc nav {
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-toc__empty {
    font-size: 0.9rem;
    color: rgba(138, 148, 176, 0.85);
    margin: 0;
}

.docs-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-toc__item {
    position: relative;
    margin-bottom: 0.45rem;
    padding-left: 1.2rem;
    opacity: 0;
    animation: docsTocFadeUp 0.6s ease forwards;
}

    .docs-toc__item:nth-child(n + 1) {
        animation-delay: calc(0.04s * var(--toc-index, 1));
    }

    .docs-toc__item::before {
        content: "";
        position: absolute;
        left: 0.35rem;
        top: 0.6rem;
        width: 6px;
        height: 6px;
        border-radius: 999px;
        background: rgba(128, 128, 128);
        box-shadow: 0 0 10px rgba(97, 218, 251, 0.35);
        transition: transform 0.2s ease, background 0.2s ease;
    }

    .docs-toc__item:hover::before {
        background: var(--main-color);
        transform: scale(1.3);
    }

.docs-toc__item-level-2 {
    padding-left: 1.75rem;
    opacity: 0.85;
}

    .docs-toc__item-level-2::before {
        left: 0.95rem;
        width: 5px;
        height: 5px;
    }

.docs-toc__item-level-3 {
    padding-left: 2.4rem;
    font-size: 0.9rem;
    opacity: 0.7;
}

    .docs-toc__item-level-3::before {
        left: 1.65rem;
        width: 4px;
        height: 4px;
    }

.docs-toc__item-level-4 {
    padding-left: 3.2rem;
    font-size: 0.8rem;
    opacity: 0.6;
}

    .docs-toc__item-level-4::before {
        left: 2.4rem;
        width: 3px;
        height: 3px;
    }

.docs-toc a {
    position: relative;
    display: inline-flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
    text-decoration: none;
    padding: 0.35rem 0.65rem;
    border-radius: 10px;
    line-height: 1.35;
    background: rgba(255, 255, 255, 0);
    transition: color 0.25s ease, background 0.25s ease, transform 0.25s ease;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

    .docs-toc a::after {
        content: "↗";
        font-size: 0.75rem;
        opacity: 0;
        transform: translateX(-6px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .docs-toc a:hover,
    .docs-toc a:focus-visible {
        color: var(--main-deep-color);
        background: var(--focus-main-color);
        transform: translateX(4px);
    }

        .docs-toc a:hover::after,
        .docs-toc a:focus-visible::after {
            opacity: 0.8;
            transform: translateX(0);
        }

    .docs-toc a:focus-visible {
        outline: 2px solid rgba(97, 218, 251, 0.45);
        outline-offset: 3px;
    }

@media (max-width: 992px) {
    .docs-layout {
        flex-direction: column;
    }

    .docs-toc {
        position: static;
        width: 100%;
        max-height: none;
        order: -1;
        margin-bottom: 1.5rem;
        animation: none;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .docs-toc {
        animation: none;
    }

    .docs-toc__item {
        animation: none;
        opacity: 1;
    }
}

@keyframes docsTocFadeUp {
    0% {
        transform: translateY(6px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}
