/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #fdf4f5, #ffeef0, #f0f7ff, #fff0f5);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: #5a3e36;
    line-height: 1.6;
    overflow-x: hidden;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* 淡入效果 */
.fade-in {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.fade-in.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* 封面样式 */
.cover {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background: radial-gradient(circle, rgba(255,240,245,0.9) 0%, rgba(255,255,255,0.9) 70%);
    overflow: hidden;
}

.cover::before {
    content: "";
    position: absolute;
    top: 10%;
    left: 10%;
    width: 30px;
    height: 30px;
    background: rgba(255, 182, 193, 0.3);
    border-radius: 50%;
    animation: float-element 8s infinite ease-in-out;
}

.cover::after {
    content: "";
    position: absolute;
    bottom: 15%;
    right: 15%;
    width: 40px;
    height: 40px;
    background: rgba(255, 105, 180, 0.2);
    border-radius: 50%;
    animation: float-element 10s infinite ease-in-out;
    animation-delay: 1s;
}

@keyframes float-element {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, 20px) rotate(10deg); }
    50% { transform: translate(0, 40px) rotate(0deg); }
    75% { transform: translate(-20px, 20px) rotate(-10deg); }
}

/* 新年装饰元素 */
.new-year-element {
    position: fixed;
    z-index: 0;
    font-size: 1.5em;
    animation: fall linear forwards;
    pointer-events: none;
    left: 0;
    right: 0;
    text-align: center;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.snowflake {
    color: #e6f7ff;
    font-size: 1.2em;
}

.firework {
    color: #ff6b6b;
    font-size: 1.3em;
}

.confetti {
    color: #ffd166;
    font-size: 1.1em;
}

.cover h1 {
    font-size: 2.8em;
    margin-bottom: 20px;
    color: #ff6b9d;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 2;
    font-weight: bold;
}

.cover h1::after {
    content: "";
    display: block;
    width: 100px;
    height: 4px;
    background: linear-gradient(to right, transparent, #ff6b9d, transparent);
    margin: 15px auto;
    border-radius: 2px;
}

.cover p {
    font-size: 1.3em;
    color: #a87466;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

.heart {
    width: 60px;
    height: 60px;
    background-color: #ff6b9d;
    position: relative;
    transform: rotate(-45deg);
    animation: heartbeat 1.5s infinite;
}

.heart:before,
.heart:after {
    content: "";
    width: 60px;
    height: 60px;
    background-color: #ff6b9d;
    border-radius: 50%;
    position: absolute;
}

.heart:before {
    top: -30px;
    left: 0;
}

.heart:after {
    top: 0;
    left: 30px;
}

@keyframes heartbeat {
    0% { transform: rotate(-45deg) scale(1); }
    5% { transform: rotate(-45deg) scale(1.2); }
    10% { transform: rotate(-45deg) scale(1); }
    15% { transform: rotate(-45deg) scale(1.2); }
    50% { transform: rotate(-45deg) scale(1); }
    100% { transform: rotate(-45deg) scale(1); }
}

/* 照片展示区 */
.photos {
    padding: 80px 20px;
    text-align: center;
    background: linear-gradient(to bottom, rgba(255, 250, 250, 0.95), rgba(255, 245, 245, 0.95));
    position: relative;
}

.photos::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    width: 80%;
    height: 10px;
    background: linear-gradient(to right, transparent, #ffb6c1, #ff69b4, transparent);
    opacity: 0.5;
}

.photos h2 {
    font-size: 2.2em;
    margin-bottom: 50px;
    color: #ff6b9d;
    position: relative;
    display: inline-block;
}

.photos h2::after {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, transparent, #ff6b9d, transparent);
    border-radius: 2px;
}

.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    padding: 0 10px; /* 添加内边距以防止边缘溢出 */
}

.photo-item {
    flex: 0 0 auto;
    width: 300px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(255, 182, 193, 0.2);
}

.photo-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,182,193,0.1), rgba(255,105,180,0.1));
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-item:hover {
    transform: translateY(-15px) scale(1.03);
    box-shadow: 0 25px 50px rgba(255, 105, 180, 0.3);
}

.photo-item:hover::before {
    opacity: 1;
}

.photo-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 12px;
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

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

.photo-item p {
    margin-top: 20px;
    font-size: 1.2em;
    color: #a87466;
    font-weight: 500;
    position: relative;
    z-index: 2;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

/* 情书正文 */
.letter {
    padding: 80px 20px;
    max-width: 900px;
    margin: 0 auto;
    background: linear-gradient(145deg, rgba(255, 250, 250, 0.9), rgba(255, 245, 245, 0.9));
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(255, 182, 193, 0.3);
    position: relative;
    overflow: hidden;
}

.letter::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,182,193,0.1) 0%, transparent 70%);
    z-index: 0;
}

.letter h2 {
    font-size: 2.3em;
    margin-bottom: 40px;
    text-align: center;
    color: #ff6b9d;
    position: relative;
    z-index: 1;
}

.letter h2::after {
    content: "";
    display: block;
    width: 100px;
    height: 4px;
    background: linear-gradient(to right, transparent, #ff6b9d, transparent);
    margin: 15px auto;
    border-radius: 2px;
}

.letter-content {
    padding: 40px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    box-shadow: inset 0 0 30px rgba(255, 182, 193, 0.2);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 182, 193, 0.3);
}

.letter-content::before {
    content: "💕";
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5em;
    opacity: 0.3;
    z-index: -1;
}

.letter-content p {
    margin-bottom: 25px;
    font-size: 1.2em;
    text-align: justify;
    line-height: 2;
    color: #6b5b55;
    position: relative;
    padding-left: 15px;
}

.letter-content p:first-of-type {
    font-size: 1.3em;
    font-weight: bold;
    color: #ff6b9d;
}

.letter-content p::before {
    content: "❧";
    position: absolute;
    left: -15px;
    color: #ffb6c1;
    font-size: 1.5em;
    line-height: 1;
}

.signature {
    font-style: italic;
    font-weight: bold;
    color: #ff6b9d;
    font-size: 1.3em;
    text-align: right;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #ffb6c1;
    display: inline-block;
}

/* 结尾部分 */
.ending {
    padding: 100px 20px;
    text-align: center;
    background: linear-gradient(160deg, #ffebf0, #f0f7ff, #fdf4f5);
    position: relative;
    overflow: hidden;
    border-top: 2px solid rgba(255, 182, 193, 0.3);
}

.ending::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 20%, rgba(255,182,193,0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255,105,180,0.1) 0%, transparent 20%);
    z-index: 0;
}

.ending h2 {
    font-size: 2.2em;
    margin-bottom: 25px;
    color: #ff6b9d;
    position: relative;
    z-index: 2;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}

.ending p {
    font-size: 1.4em;
    color: #ff6b9d;
    position: relative;
    z-index: 2;
    font-weight: bold;
}

.ending::after {
    content: "💖";
    position: absolute;
    top: 20px;
    left: 15%;
    font-size: 2em;
    opacity: 0.5;
    animation: float-icon 6s infinite ease-in-out;
    z-index: 1;
}

@keyframes float-icon {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10px, -10px); }
}

/* 飘动的心形 */
.hearts-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.floating-heart {
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: #ff6b9d;
    transform: rotate(-45deg);
    animation: float 8s linear infinite;
    opacity: 0.7;
    z-index: 1;
}

.floating-heart:before,
.floating-heart:after {
    content: "";
    width: 18px;
    height: 18px;
    background-color: #ff6b9d;
    border-radius: 50%;
    position: absolute;
}

.floating-heart:before {
    top: -9px;
    left: 0;
}

.floating-heart:after {
    top: 0;
    left: 9px;
}

.floating-heart.delay-1 {
    animation-delay: 2s;
    left: 20%;
}

.floating-heart.delay-2 {
    animation-delay: 4s;
    left: 80%;
}

@keyframes float {
    0% {
        transform: rotate(-45deg) translate(0, 0) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: rotate(-45deg) translate(var(--move-x, 50px), -100vh) scale(1.2);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .cover h1 {
        font-size: 2em;
    }
    
    .photos {
        padding: 40px 15px;
    }
    
    .photo-gallery {
        flex-direction: column;
        align-items: center;
    }
    
    .photo-item {
        width: 100%;
        max-width: 350px;
    }
    
    .letter {
        padding: 40px 15px;
        margin: 0 10px;
    }
    
    .letter-content {
        padding: 20px;
    }
    
    .ending {
        padding: 60px 15px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ffccdd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff99bb;
}