* { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #222; overflow: hidden; }

#card-container { width: 100vw; height: 100vh; position: relative; overflow: hidden; background: #fff5e6; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; transition: all 1s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1; display: flex; flex-direction: column; align-items: center; }

/* === MÀN HÌNH 1 === */
#card-closed { 
    /* Thay url thành đường dẫn ảnh nền đã xóa nến của bạn */
    background-image: url('assets/birthday_room.png'); 
    background-size: cover; 
    background-position: center bottom; 
    background-repeat: no-repeat;
}

/* Ngọn lửa chân thực bằng CSS */
#candle-flame-container { 
    position: absolute; 
    /* BẠN CẦN CHỈNH THÔNG SỐ TOP/LEFT NÀY ĐỂ KHỚP VỚI TIM NẾN TRÊN ẢNH CỦA BẠN */
    top: 36%; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 30px; 
    height: 45px; 
    z-index: 10; 
    cursor: pointer; 
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.flame {
    width: 20px;
    height: 35px;
    background: radial-gradient(ellipse at center 80%, #ffffff 10%, #fff782 30%, #ff8c00 70%, transparent 100%);
    border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
    box-shadow: 0 -5px 15px rgba(255, 140, 0, 0.8), 0 -10px 25px rgba(255, 100, 0, 0.5);
    animation: flicker 0.15s infinite alternate, glow 1.5s infinite alternate;
    transform-origin: bottom center;
}

/* Hiệu ứng lửa cháy */
@keyframes flicker {
    0% { transform: scaleX(0.95) scaleY(1.05) rotate(-1deg); }
    100% { transform: scaleX(1.05) scaleY(0.95) rotate(1deg); }
}
@keyframes glow {
    0% { box-shadow: 0 -5px 15px rgba(255, 140, 0, 0.8), 0 -10px 25px rgba(255, 100, 0, 0.5); }
    100% { box-shadow: 0 -5px 25px rgba(255, 140, 0, 1), 0 -15px 40px rgba(255, 100, 0, 0.7); }
}

/* Hiệu ứng Khói khi tắt nến */
.smoke {
    width: 12px; height: 12px;
    background: rgba(150, 150, 150, 0.8);
    border-radius: 50%;
    filter: blur(4px);
    position: absolute;
    bottom: 0;
    opacity: 0;
}
.smoke-anim { animation: riseSmoke 1.5s ease-out forwards; }
@keyframes riseSmoke {
    0% { transform: translateY(0) scale(1); opacity: 0.8; }
    100% { transform: translateY(-80px) scale(4); opacity: 0; }
}

/* Dòng chữ nhắc nhở (Đã chuyển xuống dưới) */
#instruction { 
    position: absolute; 
    bottom: 12%; /* Nằm ở phần dưới cùng của màn hình/bánh */
    left: 50%; 
    transform: translateX(-50%); 
    font-weight: bold; 
    font-size: 1.1rem;
    color: #fff;
    background: #ff6699; /* Màu hồng hợp với tone màu sinh nhật */
    padding: 12px 24px; 
    border-radius: 30px; 
    z-index: 5; 
    box-shadow: 0 4px 10px rgba(255, 102, 153, 0.4);
    animation: bounce 2s infinite;
    white-space: nowrap;
}

/* Hiệu ứng nhún nhảy cho chữ */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-15px); }
    60% { transform: translateX(-50%) translateY(-7px); }
}

/* Lớp ẩn chung */
.hidden { display: none !important; }

/* === MÀN HÌNH 2 (MỞ THIỆP) === */
#card-open { 
    background: #fff5e6; /* Màu nền ấm áp */
    z-index: 2; 
    transform: translateY(100%); /* Ẩn phía dưới màn hình */
    opacity: 0; 
    justify-content: center;
}
#card-open.active { transform: translateY(0); opacity: 1; }

#open-content { padding: 30px; text-align: center; max-width: 500px; background: rgba(255,255,255,0.8); border-radius: 20px; margin: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
h1 { color: #ff6699; font-size: 2rem; margin-top: 0;}
p { font-size: 1.1rem; color: #555; line-height: 1.6;}

.photo-gallery { display: flex; justify-content: center; gap: 15px; margin-top: 20px; }
.photo-placeholder { width: 120px; height: 120px; background: #ffd1dc; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: bold;}

#restart-btn { margin-top: 25px; padding: 12px 24px; background-color: #ffb347; border: none; color: white; border-radius: 25px; cursor: pointer; font-size: 1rem; font-weight: bold; transition: transform 0.2s; }
#restart-btn:hover { transform: scale(1.05); }

#confetti-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 15; pointer-events: none; }
