body {
    text-align: center;
    background-color: #f0f8ff;
    font-family: Arial, sans-serif;
    overflow: hidden;
    position: relative; /* Make sure body is the reference for absolute positioning */
}

.container {
    position: relative;
    padding-bottom: 20px; /* To ensure everything fits nicely */
}

h1 {
    margin-top: 20px;
    font-size: 3em;
    color: #ff69b4;
}

.cake img {
    width: 300px;
    margin: 20px 0;
}

#balloon-container {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100vh;
    pointer-events: none;
}

.balloon {
    position: absolute;
    bottom: -150px;
    width: 60px;
    height: 80px;
    background-color: red;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    pointer-events: auto;
    cursor: pointer;
    animation: float 20s infinite ease-in-out;
    box-shadow: 0 8px 6px -6px black;
    transition: transform 0.2s ease-out;
}

.balloon::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 4px;
    height: 10px;
    background-color: inherit;
    border-radius: 2px;
    transform: translateX(-50%);
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-100vh) translateX(calc(20vw - 10%));
    }
    100% {
        transform: translateY(0) translateX(calc(-20vw + 10%));
    }
}

.balloon.pop {
    animation: pop 0.2s ease-out forwards;
}

@keyframes pop {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

#envelopes-container {
    max-height: 400px; /* Adjust as needed */
    overflow-y: auto;
    padding: 10px;
    margin-top: 20px;
}

#envelopes {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px; /* Add gap between items */
}

.envelope {
    position: relative;
    width: 180px; /* Adjusted to fit the card size */
    height: 250px; /* Adjusted to fit the card size */
    cursor: pointer;
    perspective: 1000px;
    background-color: transparent; /* Ensure no background color */
    margin-bottom: 20px; /* Add bottom margin */
}

.envelope .front, .envelope .back, .envelope .quote {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 1s;
    background-size: cover;
    background-position: center; /* Ensure the image is centered */
    background-repeat: no-repeat; /* Prevent tiling of the image */
    background-color: transparent; /* Ensure no background color */
}

.envelope .front {
    background-image: url('env2.webp');
    z-index: 2;
    transform: rotateY(0deg);
}

.envelope .back {
    background-image: url('env2.webp');
    transform: rotateY(-180deg);
}

.envelope .quote {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: #333;
    background: #fffbea;
    border: 2px solid #ffcc00;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: rotateY(180deg);
    margin: 10px;
    width: 120px;
    height: 180px;
}

.envelope.open .front {
    transform: rotateY(180deg);
}

.envelope.open .back {
    transform: rotateY(0deg);
}

.envelope.open .quote {
    display: flex;
    transform: rotateY(0deg);
}

.envelope.closed .quote {
    display: none;
}

.firework {
    position: absolute;
    width: 50px; /* Increase size for visibility */
    height: 50px; /* Increase size for visibility */
    background-color: yellow;
    border-radius: 50%;
    animation: explode 1s ease-out forwards;
    box-shadow: 0 0 10px yellow, 0 0 20px yellow, 0 0 30px yellow, 0 0 40px yellow; /* Add glow effect */
}

@keyframes explode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    background-color: red;
    z-index: 9999;
    pointer-events: none;
    animation: fall linear infinite;
    opacity: 0.8; /* Slightly transparent for effect */
}

@keyframes fall {
    to {
        transform: translateY(100vh);
        opacity: 0; /* Fade out as it falls */
    }
}

@media (max-width: 768px) {
    .envelope {
        width: 150px; /* Adjust for smaller screens */
        height: 200px;
    }
}
