body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image: url('../assets/images/background.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Soft overlay for readability */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 245, 250, 0.55); /* soft white-pink overlay */
    pointer-events: none;
    z-index: 0;
}

/* Make sure all main content is above the overlay */
body > * {
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 3em;
    margin: 0;
}

@media (max-width: 600px) {
    h1 {
        font-size: 2em;
    }
}

.love-btn {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #ff6a88 0%, #ff99ac 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    box-shadow: 0 4px 12px rgba(255, 105, 135, 0.2);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    z-index: 10;
}

.love-btn:hover {
    background: linear-gradient(90deg, #ff99ac 0%, #ff6a88 100%);
    transform: translateX(-50%) scale(1.05);
}

.envelope-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.envelope {
    position: relative;
    width: 360px;         /* Increased width */
    height: 210px;        /* Increased height */
    background: #d2a679;
    border-radius: 32px 32px 24px 24px;
    box-shadow: 0 8px 24px rgba(185, 122, 87, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: box-shadow 0.3s, transform 0.2s;
    perspective: 800px;
}

.envelope:hover {
    box-shadow: 0 12px 32px rgba(185, 122, 87, 0.25);
    transform: scale(1.03);
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: bottom center;
    transition: transform 0.7s cubic-bezier(.68,-0.55,.27,1.55);
    will-change: transform;
    z-index: 2;
    background: transparent;
    overflow: visible; /* Allow stamp to overflow */
}

.flap-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;         /* Increased flap SVG height */
    z-index: 1;
    pointer-events: none;
}

.stamp-heart {
    position: absolute; /* Use absolute instead of fixed */
    left: 50%;
    top: 82px; /* Place at the tip of the triangle, adjust as needed */
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    background: #ffe6f2; /* Light shade of pink */
    border-radius: 50%;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(255, 105, 135, 0.15);
    z-index: 10;
    border: 2px solid #ffe6f2;
    pointer-events: none;
}

.envelope-body {
    width: 100%;
    height: 120px;        /* Increased body height */
    background: #d2a679;
    border-radius: 0 0 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.card {
    width: 90%;
    min-height: 100px;
    background: #fff0f6;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(255, 105, 135, 0.15);
    padding: 28px 18px;
    text-align: center;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    color: #d72660;
    margin-top: 10px;
    overflow-y: auto;
    max-height: 400px;
}

.open-text {
    display: block;
    margin-top: 8px;
    font-family: 'Pacifico', 'Comic Sans MS', cursive, sans-serif;
    color: #5a3a1b;
    font-size: 1.1em;
    text-align: center;
    letter-spacing: 1px;
}

.birthday-card {
    display: none;
    background: #fffbe6;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(90,58,27,0.15);
    padding: 24px;
    margin: 20px auto;
    max-width: 260px;
    font-family: 'Pacifico', 'Comic Sans MS', cursive, sans-serif;
    color: #5a3a1b;
    font-size: 1.2em;
    text-align: center;
    transition: opacity 0.5s;
    opacity: 0;
}

.envelope.open .envelope-flap {
    transform: rotateX(-120deg);
}

.envelope.open .envelope-body,
.envelope.open .stamp-heart,
.envelope.open .open-text {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.envelope.open .card {
    transform: translate(-50%, -40px) scaleY(1);
    opacity: 1;
}

.envelope.open .birthday-card {
    display: block;
    opacity: 1;
}

/* Floating hearts animation */
@keyframes floatHearts {
    0% { transform: translateY(0) scale(1);}
    100% { transform: translateY(-100vh) scale(1.2);}
}

.heart {
    position: fixed;
    bottom: -40px;
    font-size: 2rem;
    color: #ff6a88;
    animation: floatHearts 6s linear infinite;
    z-index: 0;
    pointer-events: none;
}

/* Modal overlay for birthday card */
.birthday-card-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 182, 213, 0.25);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.5s;
}

.birthday-card-modal.show {
    display: flex;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Letter-style birthday card */
.birthday-card-letter {
    position: relative;
    background: #fffbe6;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(185, 122, 87, 0.18);
    padding: 38px 32px 32px 32px;
    min-width: 340px;
    max-width: 95vw;
    min-height: 320px;
    max-height: 80vh;
    font-family: 'Pacifico', 'Comic Sans MS', cursive, sans-serif;
    color: #5a3a1b;
    overflow-y: auto;
    position: relative;
    background-image: repeating-linear-gradient(
        to bottom,
        #ffe6f2 0px,
        #ffe6f2 32px,
        #f7e7ce 33px,
        #ffe6f2 34px
    );
    border: 1.5px solid #e7cfa3;
    animation: cardPop 0.7s cubic-bezier(.68,-0.55,.27,1.55);
}

@keyframes cardPop {
    0% { transform: scale(0.7) translateY(40px); opacity: 0; }
    80% { transform: scale(1.05) translateY(-6px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    background: #ffb6d5;
    color: #5a3a1b;
    border: none;
    border-radius: 50%;
    font-size: 1.6em;
    width: 32px;
    height: 32px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 105, 135, 0.15);
    transition: background 0.2s;
    z-index: 10;
}
.close-btn:hover {
    background: #ffe6f2;
}

/* Optional: subtle lines for letter effect */
.letter-lines {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
}

/* Card content */
.card-content {
    position: relative;
    z-index: 1;
    font-size: 1.1em;
    line-height: 1.7;
    margin-top: 10px;
}

/* Confetti */
#confetti {
    position: fixed;
    pointer-events: none;
    left: 0; top: 0; width: 100vw; height: 100vh;
    z-index: 200;
}

/* Responsive */
@media (max-width: 500px) {
    .envelope {
        width: 95vw;
        height: 140px;
    }
    .envelope-flap {
        height: 50px;
    }
    .flap-svg {
        height: 50px;
    }
    .stamp-heart {
        font-size: 1.5rem;
        padding: 7px;
    }
    .open-text {
        font-size: 1rem;
        top: 38px;
    }
    .card {
        padding: 16px 8px;
    }
    .birthday-card-letter {
        min-width: 90vw;
        padding: 18px 8px 18px 8px;
        font-size: 1em;
    }
}

.card-flex {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
}

.card-text {
    flex: 1 1 0;
    min-width: 0;
}

.card-img {
    width: 160px;
    max-width: 40vw;
    border-radius: 16px;
    margin: 20px 0 20px 0;
    margin-left: 24px;
    box-shadow: 0 2px 12px rgba(185, 122, 87, 0.12);
    object-fit: cover;
    background: #fff;
}

/* Responsive: stack image above text on small screens */
@media (max-width: 700px) {
    .card-flex {
        flex-direction: column;
        align-items: center;
    }
    .card-img {
        margin: 18px 0 0 0;
        width: 70vw;
        max-width: 95vw;
    }
    .card-text {
        width: 100%;
        text-align: center;
    }
}

/* Sparkles */
.floating-sparkles span {
    position: fixed;
    bottom: -40px;
    font-size: 1.2rem;
    color: #ffd700;
    opacity: 0.7;
    animation: sparkleFloat 7s linear infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes sparkleFloat {
    0% { transform: translateY(0) rotate(0deg) scale(1);}
    100% { transform: translateY(-100vh) rotate(360deg) scale(1.3);}
}

/* Balloons */
.floating-balloons span {
    position: fixed;
    bottom: -60px;
    font-size: 2.2rem;
    opacity: 0.8;
    animation: balloonFloat 9s linear infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes balloonFloat {
    0% { transform: translateY(0) scale(1);}
    100% { transform: translateY(-110vh) scale(1.1);}
}

/* Stars */
.floating-stars span {
    position: fixed;
    bottom: -30px;
    font-size: 1.5rem;
    color: #fff;
    opacity: 0.6;
    animation: starFloat 8s linear infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes starFloat {
    0% { transform: translateY(0) scale(1);}
    100% { transform: translateY(-105vh) scale(1.2);}
}

/* Confetti (already present, but you can add more colors/sizes) */
.confetti-piece {
    position: absolute;
    top: -20px;
    width: 12px;
    height: 18px;
    border-radius: 4px;
    opacity: 0.8;
    animation: confettiDrop 2.2s cubic-bezier(.68,-0.55,.27,1.55) forwards;
}
@keyframes confettiDrop {
    to {
        top: 100vh;
        transform: rotate(360deg) scale(1.2);
        opacity: 0.6;
    }
}

.background-emojis span {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    transition: opacity 1.5s;
    animation: emojiFloat 12s ease-in-out infinite;
    filter: blur(2.5px);
}

@keyframes emojiFloat {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0.18; }
    50%  { transform: translateY(-18px) rotate(8deg); opacity: 0.28; }
    100% { transform: translateY(0) rotate(-8deg); opacity: 0.18; }
}

/* Optional: blur for other floating elements */
.floating-sparkles span,
.floating-balloons span,
.floating-stars span {
    filter: blur(2px);
}

.floating-hearts {
    position: fixed;
    left: 0; top: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.heart-emoji {
    position: absolute;
    animation: floatUp 12s linear infinite;
    filter: blur(2.5px);
    opacity: 0;
    transition: opacity 1.5s;
    will-change: transform, opacity;
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.22;
    }
    50% {
        opacity: 0.28;
        transform: translateY(-50vh) scale(1.05) rotate(8deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-110vh) scale(1.1) rotate(-8deg);
    }
}