/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(to bottom, #0c1445, #1e3a8a, #3b82f6);
    overflow: hidden;
    height: 100vh;
    color: #fff;
}

/* 星空背景 */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #eee, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #ddd, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: twinkle 4s ease-in-out infinite alternate;
}

.twinkling {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 50px 50px, #fff, transparent),
        radial-gradient(1px 1px at 100px 100px, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 150px 50px, #eee, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: twinkle 3s ease-in-out infinite alternate-reverse;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* 卡通星星 */
.cartoon-stars .star {
    position: absolute;
    font-size: 2rem;
    animation: float 6s ease-in-out infinite;
}

.star1 { top: 10%; left: 10%; animation-delay: 0s; }
.star2 { top: 20%; right: 15%; animation-delay: 1s; }
.star3 { top: 40%; left: 20%; animation-delay: 2s; }
.star4 { top: 60%; right: 10%; animation-delay: 3s; }
.star5 { top: 80%; left: 15%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* 彗星 */
.comets .comet {
    position: absolute;
    font-size: 1.5rem;
    animation: cometMove 8s linear infinite;
}

.comet1 { top: 20%; right: -10%; animation-delay: 0s; }
.comet2 { top: 60%; right: -10%; animation-delay: 4s; }

@keyframes cometMove {
    0% { transform: translateX(0px); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateX(-120vw); opacity: 0; }
}

/* 蛋糕 */
.cake {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* 羊皮纸信笺 */
.letter-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    perspective: 1000px;
}

.letter {
    width: 800px;
    height: 600px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s;
    cursor: pointer;
}

.letter.flipped {
    transform: rotateY(180deg);
}

.letter-front,
.letter-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.letter-front {
    background: linear-gradient(135deg, #f4e4bc, #d4b08a);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.3) 0%, transparent 50%);
    border: 2px solid #8b4513;
}

.letter-back {
    background: linear-gradient(135deg, #f4e4bc, #d4b08a);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.3) 0%, transparent 50%);
    border: 2px solid #8b4513;
    transform: rotateY(180deg);
}

.letter-content {
    padding: 20px;
    color: #2c1810;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
    background-color: rgba(244, 228, 188, 0.95);
    border-radius: 5px;
    text-align: left;
}

.letter-front h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #2c1810;
}

.letter-front p {
    font-size: 1.2rem;
    color: #5d4037;
}

.poem {
    margin: 10px 0;
}

.chinese {
    font-family: 'KaiTi', serif;
    font-size: 1.2rem;
    line-height: 1.4;
}

.english {
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    line-height: 1.3;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .letter {
        width: 90vw;
        height: 80vh;
        max-width: 700px;
        max-height: 500px;
    }

    .chinese {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    .english {
        font-size: 0.9rem;
        line-height: 1.3;
    }
}

@media (max-width: 768px) {
    .letter {
        width: 95vw;
        height: 85vh;
        max-width: 600px;
        max-height: 450px;
    }

    .chinese {
        font-size: 1rem;
        line-height: 1.3;
    }

    .english {
        font-size: 0.8rem;
        line-height: 1.2;
    }

    .cake {
        font-size: 3rem;
    }

    .cartoon-stars .star {
        font-size: 1.5rem;
    }

    .comets .comet {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .letter {
        width: 98vw;
        height: 90vh;
        max-width: 450px;
        max-height: 400px;
    }

    .chinese {
        font-size: 0.9rem;
        line-height: 1.2;
    }

    .english {
        font-size: 0.7rem;
        line-height: 1.1;
    }

    .letter-content {
        padding: 15px;
    }
}