:root {
    --bg-night: #1a1a2e;
    --bg-day: #fff0f5;
    --primary: #d81b60;
    --text-color: #333;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Poppins', sans-serif;
    transition: background-color 1.5s ease;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
}
body.night {
    background-color: var(--bg-night);
    color: #fff;
}
body.day {
    background-color: var(--bg-day);
}
.container {
    width: 100%;
    max-width: 800px;
    height: 100%;
    position: relative;
    text-align: center;
}

/* Scene transitions */
.scene {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 1s ease-in-out;
}
.scene.active {
    opacity: 1;
    visibility: visible;
}

/* Typography */
.welcome-text {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 30px;
    letter-spacing: 2px;
}
.title, .main-title, .gallery-title {
    font-family: 'Sacramento', cursive;
    color: var(--primary);
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.05);
}
.title { font-size: 3.5rem; }
.main-title { font-size: 4.5rem; margin-bottom: 20px;}
.gallery-title { font-size: 3.5rem; }

/* Buttons */
.btn {
    padding: 15px 35px;
    font-size: 1.2rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    background: linear-gradient(45deg, #ff4081, #d81b60);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(216, 27, 96, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    outline: none;
    z-index: 10;
}
.btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(216, 27, 96, 0.5);
}
.btn:active {
    transform: scale(0.95);
}
.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 1s ease;
}
.btn.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Decorations */
.bunting {
    position: absolute;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    transition: top 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
body.day .bunting {
    top: 0;
}

/* Cake */
.cake-container {
    position: relative;
    transform: scale(0);
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 20px;
}
.scene.active .cake-container {
    transform: scale(1.8);
}
.cake {
    position: relative;
    width: 150px;
    height: 100px;
}
.layer {
    position: absolute;
    width: 150px;
    height: 40px;
    border-radius: 20px;
}
.layer-bottom { background: #ff9a9e; bottom: 0; z-index: 1; }
.layer-middle { background: #fecfef; bottom: 30px; z-index: 2; width: 130px; left: 10px; }
.layer-top { background: #ffb199; bottom: 60px; z-index: 3; width: 110px; left: 20px; }
.candle {
    position: absolute;
    width: 10px;
    height: 35px;
    background: repeating-linear-gradient(45deg, white, white 5px, #ff4081 5px, #ff4081 10px);
    bottom: 90px;
    left: 70px;
    z-index: 4;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.flame {
    position: absolute;
    width: 16px;
    height: 22px;
    background: #ffcc00;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    bottom: 35px;
    left: -3px;
    box-shadow: 0 0 20px #ffcc00, 0 0 40px #ff9900;
    animation: flicker 0.5s infinite alternate;
}
@keyframes flicker {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 30px #ffcc00, 0 0 60px #ff9900; }
}
.instruction {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
    animation: bounce 1.5s infinite;
}

/* Wishes Typewriter */
.message-box {
    width: 90%;
    max-width: 600px;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.8);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    margin-bottom: 40px;
    backdrop-filter: blur(5px);
}
.typewriter-text {
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: justify;
    color: #444;
}

/* Gallery */
.polaroid-gallery {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}
.polaroid {
    background: #fff;
    padding: 12px 12px 25px 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    transform: rotate(-6deg);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), z-index 0.4s;
    width: 180px;
}
.polaroid:nth-child(2) { transform: rotate(4deg) translateY(-15px); }
.polaroid:nth-child(3) { transform: rotate(8deg); }
.polaroid:hover {
    transform: scale(1.15) rotate(0deg);
    z-index: 10;
}
.photo {
    height: 140px;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    margin-bottom: 12px;
    border-radius: 5px;
}
.polaroid p {
    font-family: 'Sacramento', cursive;
    font-size: 1.8rem;
    color: var(--primary);
}
.final-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #555;
    background: rgba(255,255,255,0.6);
    padding: 10px 20px;
    border-radius: 30px;
}

/* Balloons */
.balloon {
    position: absolute;
    bottom: -150px;
    width: 60px;
    height: 75px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    animation: floatUp 8s ease-in infinite;
    opacity: 0.85;
    z-index: 0;
    box-shadow: inset -5px -5px 15px rgba(0,0,0,0.1);
}
.balloon::before {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid inherit;
}
.balloon::after {
    content: "";
    position: absolute;
    bottom: -60px;
    left: 50%;
    width: 1px;
    height: 50px;
    background: rgba(0,0,0,0.2);
}

/* Keyframes */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes floatUp {
    0% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-60vh) rotate(5deg); }
    100% { transform: translateY(-120vh) rotate(-5deg); }
}
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
    .title { font-size: 2.8rem; }
    .main-title { font-size: 3.5rem; }
    .scene.active .cake-container { transform: scale(1.3); }
    .polaroid { width: 130px; }
    .photo { height: 100px; font-size: 2.5rem; }
    .polaroid p { font-size: 1.4rem; }
    .message-box { padding: 20px; }
    .typewriter-text { font-size: 1rem; }
}
