.my-advanced-toc-wrapper {
    position: relative;
    width: 100%;
}

.my-toc-list-container {
    width: 100%;
}

.my-toc-list {
    list-style: none !important; /* 徹底禁用原生的列表樣式 */
    padding: 0;
    margin: 0;
    display: flex; /* 預設為 Flexbox */
}

.my-toc-list li {
    list-style: none !important; /* 徹底禁用原生的列表樣式 */
    margin: 0;
    padding: 0;
    flex-shrink: 0; 
}

.my-toc-list li a {
    display: flex; /* 使用 Flexbox 確保符號和文字並排 */
    align-items: center;
    /* padding 由 Elementor 控制 */
    text-decoration: none;
    line-height: 1.3;
    
    /* 過渡動畫 */
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
}

/* 文字的樣式 */
.my-toc-list li a .my-toc-text {
    display: inline-block;
    flex-grow: 1; /* 讓文字佔據剩餘空間 */
}

/* --- 項目符號 (::before) (不變) --- */
.my-toc-list li a::before {
    content: ''; 
    display: none; 
    flex-shrink: 0;
}
.my-toc-list li a.my-toc-bullet-disc::before {
    content: '•';
    display: inline-block;
}
.my-toc-list li a.my-toc-bullet-circle::before {
    content: '○';
    display: inline-block;
}
.my-toc-list li a.my-toc-bullet-square::before {
    content: '▪';
    display: inline-block;
}

/* --- 排版 (不變) --- */
.my-toc-list.my-toc-layout-horizontal {
    flex-direction: row;
    flex-wrap: wrap; 
    justify-content: center; 
}
.my-toc-list.my-toc-layout-vertical {
    flex-direction: column;
}

/* --- RWD 漢堡選單 (【重大修改】) --- */

/* 漢堡圖示預設隱藏 */
.my-toc-hamburger {
    display: none; 
    cursor: pointer;
    padding: 10px;
}
.my-toc-hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333; 
    margin: 5px 0;
}

/* --- 【修改】將 @media 移到最外層 --- */

/* 1. 當中斷點設為 "Tablet" (< 1025px) */
@media (max-width: 1024px) {
    /* 顯示漢堡圖示 (前提是使用者有啟用 RWD 摺疊 + 選擇 Tablet) */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-tablet .my-toc-hamburger { 
        display: block; 
    }
    
    /* 隱藏選單容器 */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-tablet .my-toc-list-container {
        display: none; 
        position: absolute; 
        width: 100%;
        background-color: #fff; 
        z-index: 10;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }
    
    /* RWD 下一律改為垂直排版 */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-tablet .my-toc-list { 
        flex-direction: column; 
    }
    
    /* 【關鍵】當 .is-open class 加上時，顯示選單容器 */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-tablet.is-open .my-toc-list-container { 
        display: block; 
    }
}

/* 2. 當中斷點設為 "Mobile" (< 768px) */
@media (max-width: 767px) {
    /* 顯示漢堡圖示 (前提是使用者有啟用 RWD 摺疊 + 選擇 Mobile) */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-mobile .my-toc-hamburger { 
        display: block; 
    }
    
    /* 隱藏選單容器 */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-mobile .my-toc-list-container {
        display: none; 
        position: absolute; 
        width: 100%;
        background-color: #fff; 
        z-index: 10;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }
    
    /* RWD 下一律改為垂直排版 */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-mobile .my-toc-list { 
        flex-direction: column; 
    }
    
    /* 【關鍵】當 .is-open class 加上時，顯示選單容器 */
    .my-advanced-toc-wrapper.my-toc-rwd-collapse.my-toc-breakpoint-mobile.is-open .my-toc-list-container { 
        display: block; 
    }

    .my-toc-list.my-toc-layout-horizontal{
        width: max-content;
        padding-right: 10px;
        padding-left: 10px;
    }
}