/* ===== 目录内部滚动条（桌面端侧栏目录） ===== */
.moe-toc-nav {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--moe-theme) transparent;
    padding-right: 4px;
}
.moe-toc-nav::-webkit-scrollbar { width: 4px; }
.moe-toc-nav::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--moe-theme) 50%, transparent); border-radius: 4px; }
.moe-toc-nav::-webkit-scrollbar-track { background: transparent; }
.moe-toc-nav::-webkit-scrollbar-thumb:hover { background: var(--moe-theme); }

/* ===== 父级标题（H2）加大加粗 ===== */
.moe-toc-nav .toc-h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--moe-text);
}
.moe-toc-nav .toc-h3 { font-size: 13px; opacity: 0.92; }
.moe-toc-nav .toc-h4 { font-size: 12.5px; opacity: 0.85; }

/* ===== 移动端目录浮层（仅手机端显示） ===== */
.moe-mobile-toc-btn { display: none; }

@media (max-width: 880px) {
    .moe-mobile-toc-btn {
        display: flex;
        position: fixed;
        top: calc(var(--moe-nav-h) + 12px);
        right: 0;
        z-index: 1001;
        align-items: center;
        justify-content: center;
        padding: 10px 6px;
        background: var(--moe-card);
        color: var(--moe-theme);
        border: 1px solid var(--moe-border);
        border-right: none;
        border-radius: 12px 0 0 12px;
        box-shadow: var(--moe-shadow);
        font-size: 14px;
        font-weight: 700;
        line-height: 1.2;
        writing-mode: vertical-rl;
        letter-spacing: 2px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .moe-mobile-toc-btn:active { background: var(--moe-bg-2); }

    .moe-mobile-toc-mask {
        position: fixed;
        inset: 0;
        z-index: 1200;
        background: rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s, visibility 0.25s;
    }
    .moe-mobile-toc-mask.open { opacity: 1; visibility: visible; }

    .moe-mobile-toc-drawer {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        width: min(80vw, 320px);
        z-index: 1201;
        background: var(--moe-card);
        border-left: 1px solid var(--moe-border);
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
        transform: translateX(100%);
        transition: transform 0.25s ease;
        display: flex;
        flex-direction: column;
    }
    .moe-mobile-toc-drawer.open { transform: translateX(0); }

    .moe-mobile-toc-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        border-bottom: 1px solid var(--moe-border);
    }
    .moe-mobile-toc-title { font-size: 16px; font-weight: 700; color: var(--moe-text); margin: 0; }
    .moe-mobile-toc-close {
        width: 32px; height: 32px; border: none;
        background: var(--moe-bg-2); color: var(--moe-text);
        border-radius: 8px; cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        font-size: 20px; line-height: 1;
    }

    .moe-mobile-toc-nav {
        flex: 1;
        overflow-y: auto;
        padding: 10px 12px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--moe-theme) transparent;
    }
    .moe-mobile-toc-nav::-webkit-scrollbar { width: 4px; }
    .moe-mobile-toc-nav::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--moe-theme) 50%, transparent); border-radius: 4px; }

    .moe-mobile-toc-nav a {
        display: block;
        padding: 8px 10px;
        margin-bottom: 4px;
        font-size: 14px;
        color: var(--moe-muted);
        border-radius: 8px;
        text-decoration: none;
        line-height: 1.5;
    }
    .moe-mobile-toc-nav a.toc-h2 { font-size: 15px; font-weight: 700; color: var(--moe-text); }
    .moe-mobile-toc-nav a.toc-h3 { padding-left: 18px; font-size: 13px; }
    .moe-mobile-toc-nav a.toc-h4 { padding-left: 28px; font-size: 12.5px; }
    .moe-mobile-toc-nav a:active,
    .moe-mobile-toc-nav a.active { color: var(--moe-theme); background: var(--moe-bg-2); }
}
