/* ================================
   Floating TOC Button
   ================================ */

#toc-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
    background: linear-gradient(to bottom, #2f3136, #23272A);
    color: #FFD700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: grab;
    z-index: 9999;
    user-select: none;
    border: 1.5px solid #333;
    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 215, 0, 0.08);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

#toc-button:hover {
    box-shadow:
        0 6px 22px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 215, 0, 0.25);
}

#toc-button:active {
    cursor: grabbing;
    transform: scale(0.9);
}

/* ================================
   TOC Pulse Animation (Variant B)
   ================================ */

@keyframes toc-pulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(255, 215, 0, 0.35),
            0 4px 18px rgba(0, 0, 0, 0.4);
    }

    70% {
        box-shadow:
            0 0 0 14px rgba(255, 215, 0, 0),
            0 4px 18px rgba(0, 0, 0, 0.4);
    }

    100% {
        box-shadow:
            0 0 0 0 rgba(255, 215, 0, 0),
            0 4px 18px rgba(0, 0, 0, 0.4);
    }
}

/* Pulse aktiv */
#toc-button {
    animation: toc-pulse 3.8s ease-out infinite;
}

/* Pulse pausieren bei Interaktion */
#toc-button:hover,
#toc-button:active {
    animation-play-state: paused;
}


/* ================================
   TOC Panel
   ================================ */

#toc-panel {
    position: fixed;
    width: 280px;
    max-height: 60vh;
    background: rgba(40, 40, 45, 0.96);
    color: #F5F5F5;
    border-radius: 18px;
    border: 1.5px solid #333;
    box-shadow:
        0 6px 26px rgba(0, 0, 0, 0.55),
        0 1.5px 6px rgba(255, 215, 0, 0.08);
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
    z-index: 9998;
    overflow: hidden;
}

/* Visible state */
#toc-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ================================
   TOC Header
   ================================ */

#toc-header {
    padding: 14px 16px;
    font-weight: bold;
    text-align: center;
    background: linear-gradient(to bottom, #2f3136, #23272A);
    color: #FFD700;
    border-bottom: 1px solid #333;
    letter-spacing: 0.5px;
}

/* ================================
   TOC List
   ================================ */

#toc-list {
    list-style: none;
    margin: 0;
    padding: 10px 12px;
    overflow-y: auto;
    max-height: calc(60vh - 52px);
}

/* H1 entries */
#toc-list li.h1 {
    padding: 8px 10px;
    margin: 2px 0;
    border-radius: 10px;
    font-weight: 600;
    color: #FFD700;
    cursor: pointer;
    transition: background 0.2s ease;
}

#toc-list li.h1:hover {
    background: rgba(255, 215, 0, 0.12);
}

/* H2 entries */
#toc-list li.h2 {
    padding: 6px 10px 6px 26px;
    font-size: 0.9em;
    opacity: 0.9;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#toc-list li.h2::before {
    content: "•";
    margin-right: 8px;
    color: rgba(255, 215, 0, 0.55);
    font-size: 0.9em;
}


#toc-list li.h2:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ================================
   Mobile tweaks
   ================================ */

@media (max-width: 600px) {
    #toc-panel {
        width: 92vw;
        max-width: 92vw;
    }

    #toc-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}