/* 时间树样式 - 时间长河 */
.timeline-container {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 360px;
    background: linear-gradient(to bottom, #f5f0d8 0%, #e8e2c1 100%);
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    overflow-y: auto;
}

body.dark-mode .timeline-container {
    background: linear-gradient(to bottom, #2b2b3b 0%, #1a1a2e 100%);
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.3);
}

.timeline-container.active {
    transform: translateX(0);
}

.timeline {
    padding: 30px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #9c6a3b, #d4c9a3);
    transform: translateX(-50%);
}

body.dark-mode .timeline::before {
    background: linear-gradient(to bottom, #d4d4d4, #4a4a6b);
}

.timeline h2 {
    font-size: 1.8em;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    color: #6b4527;
    background: rgba(255, 251, 230, 0.8);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.dark-mode .timeline h2 {
    color: #d4d4d4;
    background: rgba(60, 60, 90, 0.8);
}

.timeline p {
    font-size: 1em;
    color: #4a2f1a;
    text-align: center;
}

body.dark-mode .timeline p {
    color: #e0e0e0;
}

.timeline-event {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 253, 231, 0.9);
    border-radius: 15px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    position: relative;
    width: 70%;
    margin-left: 15%;
    transform: translateY(80px); /* 初始向下偏移80px，幅度更大点 */
    transition: all 1.2s cubic-bezier(0.2, 0.46, 0.45, 0.8); /* 模仿时间长河的优雅曲线 */
    will-change: transform, opacity; /* 优化性能 */
}




body.dark-mode .timeline-event {
    background: rgba(74, 74, 106, 0.9);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.timeline-event:nth-child(odd) {
    margin-left: 15%;
    transform: translateX(-10%);
}

.timeline-event:nth-child(even) {
    margin-left: 15%;
    transform: translateX(10%);
}

.timeline-event:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

body.dark-mode .timeline-event:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.timeline-event.collapsed .description, .timeline-event.collapsed .event-link {
    display: none;
}

.timeline-event h3 {
    font-size: 1.3em;
    color: #6b4527;
    margin: 0 0 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .timeline-event h3 {
    color: #d4d4d4;
}

.timeline-event h3::after {
    content: '▼';
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.timeline-event.collapsed h3::after {
    transform: rotate(180deg);
}

.timeline-event h4 {
    font-size: 1.1em;
    color: #4a2f1a;
    margin: 0 0 8px;
}

body.dark-mode .timeline-event h4 {
    color: #e0e0e0;
}

.timeline-event p {
    font-size: 1em;
    color: #4a2f1a;
    margin: 0 0 8px;
    line-height: 1.6;
    text-align: left;
}

body.dark-mode .timeline-event p {
    color: #e0e0e0;
}

.timeline-event .event-link {
    display: inline-block;
    font-size: 0.9em;
    color: #8b5a2b;
    text-decoration: none;
    border: 1px solid #8b5a2b;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

body.dark-mode .timeline-event .event-link {
    color: #c7c7e0;
    border: 1px solid #c7c7e0;
}

.timeline-event .event-link:hover {
    background: #8b5a2b;
    color: #fff;
}

body.dark-mode .timeline-event .event-link:hover {
    background: #c7c7e0;
    color: #1a1a2e;
}

/* 时间树按钮 */
#timeline-toggle-btn {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    padding: 15px 10px;
    background: #9c6a3b;
    color: #fff;
    border: none;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    z-index: 1001;
    writing-mode: vertical-rl;
    text-orientation: upright;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}

body.dark-mode #timeline-toggle-btn {
    background: #d4d4d4;
    color: #2b2b2b;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.2);
}

#timeline-toggle-btn:hover {
    background: #6b4527;
}

body.dark-mode #timeline-toggle-btn:hover {
    background: #ffffff;
}