/* 通用样式和布局 */
* {
    box-sizing: border-box; /* 全局设置box-sizing */
}

body {
    margin: 0;
    font-family: 'Arial', sans-serif;
    color: #333;
    line-height: 1.6;
    background-color: #f8f8f8;
}

.full-screen-section {
    min-height: 100vh; /* 将height改为min-height */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

.section {
    padding: 80px 20px;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

h2 {
    font-size: 2.5em;
    margin-bottom: 60px;
    color: #e91e63; /* 粉色 */
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    display: block;
    width: 50%;
    height: 3px;
    background-color: #e91e63;
    margin: 10px auto 0;
}

/* 模块一：开屏欢迎区域 */
#welcome-screen {
    background: linear-gradient(135deg, #fce4ec, #f8bbd0); /* 柔和的粉色渐变背景 */
    color: #fff;
    flex-direction: column;
}

/* 移除旧的 .heart-container 样式 */
.heart-container {
    position: fixed; /* 固定定位 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 999; /* 调整 z-index 为 999，确保在最上层 */
}

/* 新增 .petal-container 样式 */
.petal-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0; /* 将 z-index 调整为 0，确保花瓣可见 */
}

/* 新增 .petal 样式 */
.petal {
    position: absolute;
    border-radius: 50%; /* 圆形花瓣 */
    background-color: #e91e63; /* 将默认花瓣颜色改为更深的粉色 */
}

/* 移除旧的 .heart 样式 */
.heart {
    position: absolute;
    background-color: #ff69b4; /* 粉色爱心 */
    transform: rotate(-45deg);
    /* 移除初始 opacity: 0，让GSAP控制 */
}

.heart::before,
.heart::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #ff69b4;
    border-radius: 50%;
}

.heart::before {
    top: -50%;
    left: 0;
}

.heart::after {
    top: 0;
    left: 50%;
}

.loading-text {
    font-size: 1.5em;
    margin-bottom: 20px;
    opacity: 0;
}

.welcome-content {
    opacity: 0; /* 初始隐藏 */
    transform: translateY(20px) scale(0.8); /* 初始缩小 */
    z-index: 1; /* 确保欢迎内容在花瓣之上 */
}

.welcome-content .date {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.welcome-content .main-title {
    font-size: 4em;
    margin: 10px 0;
    letter-spacing: 5px;
}

.welcome-content .sub-title {
    font-size: 2em;
    margin: 10px 0;
    color: #fff; /* 副标题改为白色，与背景形成对比 */
}

/* 模块二：我们的时光轴 */
#timeline-section {
    background-color: #fffaf0; /* 柔和的米白色 */
}

.timeline-container {
    position: relative;
    padding: 20px 0;
}

.timeline-container::before {
    content: '';
    position: absolute;
    width: 4px;
    background-color: #e91e63;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.timeline-node {
    display: flex;
    justify-content: center;
    margin-bottom: 100px;
    position: relative;
}

.timeline-node:nth-child(even) {
    justify-content: flex-end;
}

.timeline-node:nth-child(odd) {
    justify-content: flex-start;
}

.node-content {
    width: 45%;
    padding: 30px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    opacity: 0;
    transform: translateX(100px);
}

.node-content.left {
    transform: translateX(-100px);
}

.timeline-node:nth-child(even) .node-content {
    margin-left: 5%;
}

.timeline-node:nth-child(odd) .node-content {
    margin-right: 5%;
}

.node-content::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #e91e63;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.node-content.left::after {
    right: -40px;
}

.node-content.right::after {
    left: -40px;
}

.node-date {
    font-size: 0.9em;
    color: #999;
    margin-bottom: 10px;
}

.node-title {
    font-size: 1.8em;
    color: #e91e63;
    margin-bottom: 15px;
}

.node-description {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
}

.node-image-placeholder {
    width: 100%;
    height: 200px;
    background-color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #999;
    border-radius: 5px;
    font-style: italic;
}

.node-image {
    width: 100%;
    height: auto; /* 自动调整高度以完整显示图片 */
    /* object-fit: cover; 移除此属性，确保图片不被裁剪 */
    border-radius: 5px;
    display: block;
    margin-top: 10px;
}

/* 模块三：照片回忆墙 */
#photo-wall-section {
    background-color: #f8f8f8;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.photo-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.photo-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 10px;
    font-size: 0.9em;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-item:hover span {
    transform: translateY(0);
}

/* 模块四：我的心里话 */
#letter-section {
    background: linear-gradient(135deg, #fce4ec, #f8bbd0);
    padding: 80px 20px;
}

.letter-container {
    background-color: #fff;
    padding: 50px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    line-height: 2;
    position: relative;
}

.letter-container h2 {
    color: #e91e63;
    margin-bottom: 40px;
    text-align: center;
}

.letter-content p {
    font-size: 1.1em;
    margin-bottom: 1em;
    opacity: 0; /* 用于打字机效果 */
}

.letter-content .signature {
    text-align: right;
    font-style: italic;
    margin-top: 30px;
    color: #e91e63;
}

/* 模块五：背景音乐播放器 */
#music-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background-color: rgba(233, 30, 99, 0.8);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

#play-pause-button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1em;
    cursor: pointer;
    outline: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .welcome-content .main-title {
        font-size: 3em;
    }

    .welcome-content .sub-title {
        font-size: 1.5em;
    }

    .timeline-container::before {
        left: 20px;
        transform: translateX(0);
    }

    .timeline-node {
        justify-content: flex-start;
    }

    .node-content {
        width: calc(100% - 60px);
        margin-left: 60px !important;
        transform: translateX(0) !important;
    }

    .node-content.left::after,
    .node-content.right::after {
        left: -40px;
        right: auto;
    }

    .node-content.left {
        transform: translateX(0) !important;
    }

    .letter-container {
        padding: 30px;
        max-width: 100%; /* 确保在小屏幕上容器宽度最大化 */
        box-sizing: border-box; /* 显式设置box-sizing */
    }

    .letter-container h2 {
        font-size: 2em; /* 调整标题字体大小 */
    }

    .letter-content p {
        font-size: 1em; /* 调整段落字体大小 */
        white-space: normal; /* 确保文本正常换行 */
    }

    .full-screen-section {
        flex-direction: column; /* 确保内容垂直堆叠 */
    }

    #welcome-screen {
        align-items: center; /* 确保欢迎屏幕内容居中 */
        padding-top: 0; /* 移除顶部内边距，以便居中 */
    }
}

@media (max-width: 480px) {
    h2 {
        font-size: 2em;
    }

    .welcome-content .main-title {
        font-size: 2.5em;
    }

    .welcome-content .sub-title {
        font-size: 1.2em;
    }

    .section {
        padding: 60px 5px; /* 进一步减小左右内边距 */
    }

    /* 应用于 #letter-section */
    .full-screen-section {
        flex-direction: column; /* 确保内容垂直堆叠 */
    }

    #welcome-screen {
        align-items: center; /* 确保欢迎屏幕内容居中 */
        padding-top: 0; /* 移除顶部内边距，以便居中 */
    }

    .letter-container {
        padding: 10px; /* 调整内边距 */
        max-width: 100%; /* 确保在小屏幕上容器宽度最大化 */
        box-sizing: border-box; /* 显式设置box-sizing */
    }

    .letter-container h2 {
        font-size: 1.6em; /* 进一步调整标题字体大小 */
        margin-bottom: 20px; /* 减小标题下边距 */
    }

    .letter-content p {
        font-size: 0.8em; /* 进一步调整段落字体大小 */
        line-height: 1.6; /* 调整行高 */
        word-break: break-word; /* 强制长单词换行 */
        white-space: normal; /* 确保文本正常换行 */
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
