* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 信封样式 */
.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 10;
}

.envelope:hover {
    transform: scale(1.05);
}

.envelope-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.envelope-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff9ff3, #feca57);
    border-radius: 8px;
    z-index: 2;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(45deg, #ff6b6b, #ff9ff3);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 3;
}

.envelope.opened .envelope-flap {
    transform: rotateX(180deg);
}

.heart-seal {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    animation: heartbeat 2s infinite;
}

.envelope-label {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    text-align: center;
    opacity: 0.8;
    animation: glow 2s ease-in-out infinite alternate;
}

/* 生日贺卡样式 */
.birthday-card {
    position: absolute;
    width: 600px;
    height: 480px;
    perspective: 1000px;
    opacity: 0;
    transform: scale(0.5) translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 5;
}

.birthday-card.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.card-front, .card-inside {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.card-front {
    background: linear-gradient(135deg, #ff9a9e, #fecfef, #fecfef);
    transform: rotateY(0deg);
    transition: transform 0.8s;
}

.card-inside {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    transform: rotateY(180deg);
    transition: transform 0.8s;
}

.birthday-card.flipped .card-front {
    transform: rotateY(-180deg);
}

.birthday-card.flipped .card-inside {
    transform: rotateY(0deg);
}

.card-cover {
    padding: 60px 40px;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-title {
    font-size: 36px;
    color: #ff6b6b;
    margin-bottom: 50px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: rainbow 3s ease-in-out infinite;
}

.decorative-elements {
    position: relative;
    width: 100%;
    height: 220px;
}

.balloon {
    position: absolute;
    font-size: 30px;
    animation: float 3s ease-in-out infinite;
}

.balloon-1 {
    top: 20px;
    left: 20px;
    animation-delay: 0s;
}

.balloon-2 {
    top: 10px;
    right: 20px;
    animation-delay: 1s;
}

.balloon-3 {
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 2s;
}

.cake {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    animation: bounce 2s ease-in-out infinite;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
}

.star {
    position: absolute;
    font-size: 20px;
    animation: twinkle 2s ease-in-out infinite;
}

.star:nth-child(1) { top: 30px; left: 10%; animation-delay: 0s; }
.star:nth-child(2) { top: 60px; right: 10%; animation-delay: 0.5s; }
.star:nth-child(3) { bottom: 30px; left: 20%; animation-delay: 1s; }
.star:nth-child(4) { bottom: 60px; right: 20%; animation-delay: 1.5s; }

/* 贺卡内容 */
.message-content {
    padding: 50px;
    height: 100%;
    overflow-y: auto;
    text-align: center;
}

.message-content h2 {
    color: #ff6b6b;
    font-size: 32px;
    margin-bottom: 30px;
    animation: slideInDown 1s ease-out;
}

.birthday-message {
    color: #666;
    line-height: 2.0;
    font-size: 20px;
    margin-bottom: 30px;
    animation: slideInUp 1s ease-out 0.3s both;
}

.signature {
    margin-top: 30px;
}

.signature p {
    color: #ff6b6b;
    font-style: italic;
    font-size: 22px;
    animation: slideInUp 1s ease-out 0.6s both;
}

.cute-animals {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

.animal {
    font-size: 35px;
    animation: bounce 1.5s ease-in-out infinite;
}

.animal:nth-child(1) { animation-delay: 0s; }
.animal:nth-child(2) { animation-delay: 0.2s; }
.animal:nth-child(3) { animation-delay: 0.4s; }
.animal:nth-child(4) { animation-delay: 0.6s; }

/* 音频按钮 */
.audio-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.audio-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

/* 背景音乐按钮 */
.music-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.music-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

.music-btn.playing {
    background: linear-gradient(45deg, #48dbfb, #0abde3);
    animation: musicPulse 1s ease-in-out infinite;
}

/* 背景装饰 */
.background-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-hearts {
    position: absolute;
    width: 100%;
    height: 100%;
}

.heart {
    position: absolute;
    font-size: 20px;
    opacity: 0.6;
    animation: floatHearts 8s ease-in-out infinite;
}

.heart:nth-child(1) { left: 10%; animation-delay: 0s; }
.heart:nth-child(2) { left: 30%; animation-delay: 2s; }
.heart:nth-child(3) { left: 50%; animation-delay: 4s; }
.heart:nth-child(4) { left: 70%; animation-delay: 6s; }
.heart:nth-child(5) { left: 90%; animation-delay: 8s; }

.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, #ff6b6b 2px, transparent 2px),
        radial-gradient(circle at 80% 20%, #feca57 2px, transparent 2px),
        radial-gradient(circle at 40% 40%, #ff9ff3 2px, transparent 2px);
    background-size: 50px 50px, 60px 60px, 40px 40px;
    animation: confettiRain 10s linear infinite;
    opacity: 0;
}

.birthday-card.show ~ .background-decoration .confetti {
    opacity: 0.3;
}

/* 小动物祝贺动画 */
.celebrating-animals {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.celebrating-animals.active {
    opacity: 1;
}

.animal-celebration {
    position: absolute;
    font-size: 40px;
    pointer-events: none;
    animation-duration: 8s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.animal-celebration:nth-child(1) {
    left: 5%;
    animation-name: celebrateLeft;
    animation-delay: 0s;
}

.animal-celebration:nth-child(2) {
    left: 15%;
    animation-name: celebrateRight;
    animation-delay: 1s;
}

.animal-celebration:nth-child(3) {
    left: 25%;
    animation-name: celebrateLeft;
    animation-delay: 2s;
}

.animal-celebration:nth-child(4) {
    left: 35%;
    animation-name: celebrateRight;
    animation-delay: 3s;
}

.animal-celebration:nth-child(5) {
    left: 45%;
    animation-name: celebrateLeft;
    animation-delay: 4s;
}

.animal-celebration:nth-child(6) {
    left: 55%;
    animation-name: celebrateRight;
    animation-delay: 5s;
}

.animal-celebration:nth-child(7) {
    left: 65%;
    animation-name: celebrateLeft;
    animation-delay: 6s;
}

.animal-celebration:nth-child(8) {
    left: 75%;
    animation-name: celebrateRight;
    animation-delay: 7s;
}

.animal-celebration:nth-child(9) {
    left: 85%;
    animation-name: celebrateLeft;
    animation-delay: 0.5s;
}

.animal-celebration:nth-child(10) {
    left: 95%;
    animation-name: celebrateRight;
    animation-delay: 1.5s;
}

/* 动画定义 */
@keyframes heartbeat {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.2); }
}

@keyframes glow {
    from { text-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
    to { text-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
}

@keyframes rainbow {
    0% { color: #ff6b6b; }
    16% { color: #feca57; }
    32% { color: #48dbfb; }
    48% { color: #ff9ff3; }
    64% { color: #54a0ff; }
    80% { color: #5f27cd; }
    100% { color: #ff6b6b; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatHearts {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes confettiRain {
    0% { transform: translateY(-100vh); }
    100% { transform: translateY(100vh); }
}

@keyframes celebrateLeft {
    0% {
        transform: translateY(100vh) rotate(0deg) scale(1);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: translateY(80vh) rotate(180deg) scale(1.2);
    }
    50% {
        transform: translateY(50vh) rotate(360deg) scale(1);
    }
    80% {
        opacity: 1;
        transform: translateY(20vh) rotate(540deg) scale(1.2);
    }
    100% {
        transform: translateY(-20vh) rotate(720deg) scale(1);
        opacity: 0;
    }
}

@keyframes celebrateRight {
    0% {
        transform: translateY(100vh) rotate(0deg) scale(1);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: translateY(80vh) rotate(-180deg) scale(1.2);
    }
    50% {
        transform: translateY(50vh) rotate(-360deg) scale(1);
    }
    80% {
        opacity: 1;
        transform: translateY(20vh) rotate(-540deg) scale(1.2);
    }
    100% {
        transform: translateY(-20vh) rotate(-720deg) scale(1);
        opacity: 0;
    }
}

@keyframes musicPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 30px rgba(72, 219, 251, 0.4);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .envelope {
        width: 320px;
        height: 200px;
    }
    
    .birthday-card {
        width: 450px;
        height: 360px;
    }
    
    .card-title {
        font-size: 28px;
    }
    
    .card-cover {
        padding: 40px 30px;
    }
    
    .message-content {
        padding: 35px;
    }
    
    .message-content h2 {
        font-size: 26px;
    }
    
    .birthday-message {
        font-size: 18px;
    }
    
    .signature p {
        font-size: 20px;
    }
    
    .audio-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .music-btn {
        bottom: 20px;
        left: 20px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .animal-celebration {
        font-size: 30px;
    }
}

/* 小屏幕设备进一步优化 */
@media (max-width: 480px) {
    .birthday-card {
        width: 400px;
        height: 320px;
    }
    
    .card-cover {
        padding: 35px 25px;
    }
    
    .message-content {
        padding: 30px;
    }
    
    .decorative-elements {
        height: 140px;
    }
    
    .card-title {
        font-size: 24px;
    }
    
    .message-content h2 {
        font-size: 22px;
    }
    
    .birthday-message {
        font-size: 16px;
    }
    
    .animal-celebration {
        font-size: 25px;
    }
} 