/* ===== 全局变量与重置 ===== */
:root {
    --bg-color: #0a0a0a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent-color: #d4af37;
    /* 黄金色 */
    --text-main: #e0e0e0;
    --text-dim: #a0a0a0;
    --transition-speed: 0.7s;
    --card-radius: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Times New Roman", serif;
    line-height: 1.7;
    overflow-x: hidden;
}

/* 容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 30px;
}

/* ===== 头部区域 ===== */
.hero {
    text-align: center;
    margin-bottom: 70px;
    position: relative;
    animation: fadeInUp 0.9s ease forwards;
}

.hero h1 {
    font-size: 4rem;
    letter-spacing: 0.3rem;
    color: var(--accent-color);
    margin-bottom: 12px;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.2);
}

.hero p {
    color: var(--text-dim);
    font-style: italic;
    font-size: 1.1rem;
}

.header-decoration {
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    margin: 20px auto 0;
}

/* ===== 双排网格布局 (电脑端) ===== */
.chronicle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* 卡片通用样式 */
.chronicle-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-left: 3px solid var(--accent-color);
    border-radius: 0 var(--card-radius) var(--card-radius) 0;
    padding: 32px 36px;
    transition: all 0.3s ease;
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.6);
    opacity: 0;
    /* 初始隐藏，由 JS 触发可见动画 */
    transform: translateY(30px);
    will-change: transform, opacity;
}

/* 卡片动画类 */
.chronicle-card.visible {
    animation: cardReveal 0.8s cubic-bezier(0.2, 0.9, 0.4, 1.1) forwards;
}

@keyframes cardReveal {
    0% {
        opacity: 0;
        transform: translateY(40px);
        filter: blur(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* 卷三全宽卡片: 在电脑端横跨两列 */
.fullwidth-card {
    grid-column: span 2;
    border-left: 3px solid #e6b422;
    background: rgba(212, 175, 55, 0.06);
}

.fullwidth-card:hover {
    background: rgba(212, 175, 55, 0.1);
}

/* 标题样式 */
h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    font-weight: 600;
    letter-spacing: 1px;
}

h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--accent-color), transparent);
    margin-left: 20px;
}

.content {
    font-size: 1.05rem;
    text-align: justify;
    line-height: 1.75;
    color: #ececec;
}

/* 诗词板块 */
.poem {
    background: rgba(212, 175, 55, 0.12);
    padding: 14px 18px;
    border-radius: 20px;
    margin: 24px 0;
    color: #f3d572;
    text-align: center;
    font-family: "KaiTi", "楷体", "华文楷书", serif;
    font-size: 1rem;
    border-left: 2px solid var(--accent-color);
    font-style: italic;
}

/* 尊号区域 */
.honorific {
    margin-top: 28px;
    font-weight: 600;
    color: var(--accent-color);
    text-align: right;
    font-size: 1.1rem;
    border-top: 1px dashed rgba(212, 175, 55, 0.3);
    padding-top: 18px;
    letter-spacing: 0.5px;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 50px 20px 20px;
    color: var(--text-dim);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 70px;
}

.footer-motto {
    font-size: 0.8rem;
    margin-top: 8px;
    opacity: 0.7;
    font-style: italic;
}

/* ===== 响应式: 手机端自动切换为单排 ===== */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
    }

    .hero h1 {
        font-size: 2.5rem;
        letter-spacing: 0.2rem;
    }

    .chronicle-grid {
        grid-template-columns: 1fr;
        /* 手机单列 */
        gap: 32px;
    }

    /* 手机端全宽卡片不再跨列，自然占满 */
    .fullwidth-card {
        grid-column: span 1;
    }

    .chronicle-card {
        padding: 24px 22px;
    }

    h2 {
        font-size: 1.5rem;
    }

    .content {
        font-size: 1rem;
    }

    .honorific {
        font-size: 0.95rem;
    }
}

/* 小屏优化 */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }

    .chronicle-card {
        padding: 20px 18px;
    }
}

/* 滚动条优雅 */
::-webkit-scrollbar {
    width: 6px;
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}

/* 辅助动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* ===== 模态框样式（新增） ===== */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-modal-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 20px;
    padding: 40px 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.auth-modal-content h2 {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.auth-modal-content p {
    color: var(--text-dim);
    margin-bottom: 25px;
}

.auth-modal-content input {
    width: 100%;
    padding: 12px 16px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: 0.2s;
}

.auth-modal-content input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.auth-modal-content button {
    background: var(--accent-color);
    color: #0a0a0a;
    border: none;
    padding: 12px 20px;
    margin-top: 15px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
}

.auth-modal-content button:hover {
    background: #e6c345;
    transform: scale(1.02);
}

.auth-error {
    color: #ff6b6b;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* 欢迎语样式（新增） */
.welcome-message {
    text-align: center;
    margin: 20px auto 30px;
    padding: 12px;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 40px;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--accent-color);
    backdrop-filter: blur(4px);
    max-width: 400px;
    border: 1px solid rgba(212, 175, 55, 0.4);
}

/* 受保护内容提示样式 */
.protected-tip {
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-color);
    margin: 10px 0 5px;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

/* ========== 新增功能样式 ========== */

/* 功能栏 */
.function-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 40px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.search-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 2;
    min-width: 200px;
}

#searchInput {
    flex: 1;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--accent-color);
    border-radius: 30px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: 0.2s;
}

#searchInput:focus {
    border-color: #e6c345;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.search-section button,
.random-section button {
    background: var(--accent-color);
    color: #0a0a0a;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.search-section button:hover,
.random-section button:hover {
    background: #e6c345;
    transform: scale(1.02);
}

/* 时间线容器 */
.timeline-container {
    margin: 30px 0 40px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border-left: 3px solid var(--accent-color);
}

.timeline-container h3 {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.timeline-item {
    flex: 1;
    min-width: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.timeline-item:hover {
    background: rgba(212, 175, 55, 0.15);
    transform: translateY(-3px);
    border-color: var(--accent-color);
}

.timeline-year {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.timeline-title {
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--accent-color);
    color: #0a0a0a;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 99;
}

.back-to-top:hover {
    background: #e6c345;
    transform: translateY(-3px);
}

/* 搜索高亮 */
.search-highlight {
    background-color: rgba(212, 175, 55, 0.4);
    color: #fff;
    border-radius: 4px;
    padding: 0 2px;
}

/* 手机适配 */
@media (max-width: 768px) {
    .function-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .timeline {
        flex-direction: column;
        gap: 10px;
    }

    .timeline-item {
        width: 100%;
    }

    .back-to-top {
        width: 40px;
        height: 40px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }
}

/* 目录容器 */
.directory-container {
    margin: 30px 0 40px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border-left: 3px solid var(--accent-color);
}

.directory-container h3 {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.directory-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.directory-btn {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(212, 175, 55, 0.5);
    padding: 10px 24px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.directory-btn:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.directory-btn.active {
    background: var(--accent-color);
    color: #0a0a0a;
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

/* 移除旧时间线样式（如果存在） */
/* .timeline-container, .timeline, .timeline-item 等可删除，但为了安全保留不影响 */