/* style.css */

/* --- 全局與背景風格 --- */
body {
    margin: 0;
    padding: 0 340px 40px 40px; /* 右側留出340px空間給導覽列表A */
    background-color: #0b0f19; /* 夢幻深邃的暗夜藍背景 */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(112, 0, 255, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 240, 255, 0.08), transparent 25%);
    color: #cbd5e0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- 自定義滾動條 --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.6);
}

/* --- 頂部大標題 --- */
header h1 {
    font-size: 3.5rem;
    text-align: center;
    background: linear-gradient(90deg, #00f0ff, #ff00cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 0, 204, 0.3);
    margin-bottom: 40px;
    cursor: default !important;
}

header h1::before {
    display: none !important;
}

/* --- 各級標題樣式 (折疊/展開指示) --- */
h1, h2, h3, h4 {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    display: inline-block;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

h1:not(header h1) {
    font-size: 2rem;
    color: #d8b4fe;
    border-bottom: 1px solid rgba(216, 180, 254, 0.2);
    padding-bottom: 5px;
    width: 100%;
}

h2 {
    font-size: 1.5rem;
    color: #00f0ff;
}

h3 {
    font-size: 1.2rem;
    color: #fca5a5;
}

h4 {
    font-size: 1.05rem;
    color: #a78bfa;
}

h1:not(header h1):hover, h2:hover, h3:hover, h4:hover {
    text-shadow: 0 0 10px currentColor;
}

/* 添加箭頭圖標 */
h1:not(header h1)::before, h2::before, h3::before, h4::before {
    content: '▹';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease;
}

h1.expanded::before, h2.expanded::before, h3.expanded::before, h4.expanded::before {
    transform: rotate(90deg);
    color: currentColor;
}

/* --- 提示詞標籤樣式 (ul & a) --- */
ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 10px 0 25px 0;
}

ul li a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

ul li a:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: rgba(0, 240, 255, 0.6);
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    transform: translateY(-2px);
}

/* --- JS隱藏控制類 --- */
.is-hidden {
    display: none !important;
}

/* --- 側邊列表A (導覽目錄) --- */
#toc-container {
    position: fixed;
    right: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    z-index: 1000;
}

.toc-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    gap: 10px;
}

.toc-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #00f0ff;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.toc-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: #00f0ff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    transform: scale(1.05);
}

#toc-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.toc-link {
    display: block;
    text-decoration: none;
    transition: color 0.3s, padding-left 0.3s;
    line-height: 1.4;
}

.toc-link:hover {
    color: #fff !important;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.toc-link.h1 {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ff00cc;
    margin-top: 20px;
    margin-bottom: 8px;
    border-left: 3px solid #ff00cc;
    padding-left: 10px;
}
.toc-link.h1:hover { padding-left: 15px; }

.toc-link.h2 {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 6px;
    padding-left: 20px;
}
.toc-link.h2:hover { padding-left: 25px; }

/* --- 複製成功提示 (Toast) --- */
#toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translate(-50%, 50px);
    background: rgba(112, 0, 255, 0.2);
    border: 1px solid #d8b4fe;
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    box-shadow: 0 0 20px rgba(112, 0, 255, 0.4);
    backdrop-filter: blur(10px);
    z-index: 2000;
}
#toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}