:root {
    --primary: #ff4d6d;
    --primary-dark: #c9184a;
    --secondary: #ff758f;
    --bg-pink: #fff0f3;
    --text-color: #590d22;
    --shadow: 0 10px 30px rgba(255, 77, 109, 0.2);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-pink);
    color: var(--text-color);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: scroll;
    position: relative;
    padding: 20px 0;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

/* Floating Hearts Background */
.heart-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    color: var(--primary);
    opacity: 0.6;
    animation: float linear infinite;
    pointer-events: none;
    will-change: transform;
    backface-visibility: hidden;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Container & Card */
.container {
    text-align: center;
    width: 90%;
    max-width: 600px;
}

.card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 30px;
    box-shadow: var(--shadow);
    border: 2px solid rgba(255, 255, 255, 0.5);
    transition: all 0.5s ease;
}

.main-title {
    font-family: 'Pacifico', cursive;
    font-size: 2.5rem;
    margin-bottom: 2.5rem;
    color: var(--primary-dark);
    line-height: 1.4;
}

/* Buttons */
.buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    position: relative;
    min-height: 60px;
}

.btn {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    will-change: transform;
    backface-visibility: hidden;
}

.btn-yes {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-yes:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 77, 109, 0.4);
}

.btn-no {
    background: #f0f0f0;
    color: var(--text-color);
}

.btn-no:hover {
    background: #e0e0e0;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Envelope */
#envelope-container {
    margin-top: 3rem;
}

.envelope {
    position: relative;
    width: 350px;
    height: 220px;
    margin: 0 auto;
}

.envelope .flap,
.envelope .front {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.envelope .flap {
    border-left: 175px solid transparent;
    border-right: 175px solid transparent;
    border-top: 110px solid var(--primary);
    transform-origin: top;
    transition: transform 0.8s;
    z-index: 3;
}

.envelope .body {
    position: absolute;
    width: 350px;
    height: 220px;
    background: var(--secondary);
    border-radius: 5px;
    z-index: 1;
}

.envelope .front {
    border-left: 175px solid transparent;
    border-right: 175px solid transparent;
    border-bottom: 110px solid var(--primary-dark);
    bottom: 0;
    z-index: 4;
}

.envelope .front::after {
    content: '';
    position: absolute;
    width: 350px;
    height: 110px;
    background: var(--primary-dark);
    bottom: -110px;
    left: -175px;
    border-radius: 0 0 5px 5px;
}

.letter {
    position: absolute;
    width: 330px;
    height: 200px;
    background: white;
    left: 10px;
    top: 10px;
    z-index: 2;
    transition: transform 0.8s 1s, height 0.8s 1.2s, width 0.8s 1.2s, left 0.8s 1.2s, padding 0.8s;
    padding: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.letter-content {
    opacity: 0;
    transition: opacity 0.5s 1.8s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
}

.letter-top {
    font-family: 'Pacifico', cursive;
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 5px;
    color: var(--primary-dark);
    text-align: center;
}

.couple-image-container {
    width: 100%;
    min-height: 150px;
    margin: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.couple-image {
    max-width: 100%;
    max-height: 250px;
    width: auto;
    height: auto;
    border-radius: 10px;
}

.letter-bottom {
    font-family: 'Pacifico', cursive;
    font-size: 1.1rem;
    line-height: 1.3;
    color: var(--primary);
    margin-top: 5px;
    text-align: center;
}

.share-btn {
    margin-top: 12px;
    padding: 8px 12px;
    background: #25d366;
    color: white;
    border: none;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 100;
    width: 90%;
    max-width: 220px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
}

.share-btn:hover {
    background: #128c7e;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* States */
.open .flap {
    transform: rotateX(180deg);
}

.open .letter {
    transform: translate(-50%, -150px);
    width: 350px;
    height: 550px;
    left: 50%;
    z-index: 10;
}

.open .letter-content {
    opacity: 1;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .main-title {
        font-size: 1.6rem;
    }

    .card {
        padding: 2.5rem 1.5rem;
    }

    .envelope {
        width: 280px;
        height: 180px;
    }

    .envelope .flap,
    .envelope .front {
        border-left-width: 140px;
        border-right-width: 140px;
    }

    .envelope .flap {
        border-top-width: 90px;
    }

    .envelope .front {
        border-bottom-width: 90px;
    }

    .envelope .front::after {
        width: 280px;
        height: 90px;
        bottom: -90px;
        left: -140px;
    }

    .envelope .body {
        width: 280px;
        height: 180px;
    }

    .letter {
        width: 260px;
        height: 170px;
        padding: 1rem;
    }

    #envelope-container {
        margin-top: 1.5rem;
    }

    .open .letter {
        width: 280px;
        height: auto;
        max-height: 75vh;
        min-height: 380px;
        transform: translate(-50%, -180px);
        left: 50%;
        z-index: 20;
        padding: 1.2rem;
    }

    .letter-top {
        font-size: 0.85rem;
    }

    .letter-bottom {
        font-size: 1.1rem;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}