/* --- 1. 核心變數定義 --- */
:root {
    --parchment: #fffcf5;
    --ink: #2c1e1a;
    --accent: #8b4513;
    --border: #d2b48c;
    --highlight: #fdf1e0;
}

/* --- 2. 基礎佈局 --- */
body {
    background-color: #f4ece0;
    color: var(--ink);
    font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden; /* 讓整個視窗固定，只有右側內容區可捲動 */
}

/* --- 3. 側邊欄 (Sidebar) --- */
.sidebar {
    width: 250px;
    background: var(--parchment);
    border-right: 2px solid var(--accent);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid var(--accent);
    background: var(--highlight);
}

.sidebar-header h3 {
    margin: 0;
    color: var(--accent);
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto; /* 如果索引太長，選單內部可以捲動 */
    flex-grow: 1;
}

.sidebar li a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    transition: 0.2s;
    font-size: 0.9rem;
}

/* 啟動狀態的標籤 */
.sidebar li a.active-tab {
    background: var(--accent);
    color: white !important;
    font-weight: bold;
}

.sidebar li a:hover:not(.active-tab) {
    background: var(--highlight);
    padding-left: 25px;
}

/* --- 4. 側邊欄底部導航按鈕 --- */
.sidebar-nav-group {
    margin-top: auto; /* 將按鈕推至底部 */
    padding: 15px;
    background: var(--highlight);
    border-top: 1px solid var(--accent);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-divider {
    height: 1px;
    background: var(--accent);
    margin-bottom: 5px;
    opacity: 0.3;
}

.side-nav-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--parchment);
    border: 1px solid var(--accent);
    color: var(--accent) !important;
    text-decoration: none;
    text-align: center;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: 0.3s;
    border-radius: 4px;
    box-sizing: border-box;
}

.side-nav-btn:hover {
    background: var(--accent);
    color: white !important;
}

/* --- 5. 內容區域 (Content Area) --- */
.content-container {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.3);
}

section {
    display: none; /* 預設隱藏 */
    animation: fadeIn 0.4s ease;
    max-width: 1000px;
    margin: 0 auto;
}

section.active-section {
    display: block; /* 啟用時顯示 */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    color: var(--accent);
    border-bottom: 3px double var(--border);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

/* --- 6. 資料格與文字區塊 --- */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px 40px;
    background: var(--parchment);
    padding: 20px;
    border-radius: 5px;
    border: 1px solid var(--border);
}

.data-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border);
    padding: 5px 0;
}

/* 標籤左對齊，內容左對齊 (符合你目前的喜好) */
.label { 
    font-weight: bold; 
    color: var(--accent); 
    width: 140px; 
    flex-shrink: 0;
}

.value { 
    flex: 1; 
    text-align: left; 
}

.text-area {
    background: var(--parchment);
    padding: 20px;
    border-radius: 5px;
    line-height: 1.8;
    margin-top: 15px;
    border: 1px solid var(--border);
}

/* --- 7. 時間軸 (Timeline) --- */
.timeline {
    position: relative;
    padding-left: 30px;
    border-left: 4px solid var(--accent);
    margin-left: 20px;
}

.timeline-event {
    position: relative;
    margin-bottom: 40px;
}

.timeline-event::before {
    content: '';
    position: absolute;
    left: -39px;
    top: 5px;
    width: 14px;
    height: 14px;
    background: var(--parchment);
    border: 4px solid var(--accent);
    border-radius: 50%;
}

.timeline-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 5px;
}

/* --- 8. 特殊公告 (NSFW) --- */
.nsfw-notice {
    background: #2c1e1a;
    color: #d2b48c;
    padding: 10px;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 4px;
}