body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    overflow: hidden;
    background: #fdf0f5;
}

.container {
    position: relative;
}

.valentines {
    position: relative;
    top: 50px;
    cursor: pointer;
    animation: up 3s linear infinite;
    transition: transform 1s ease; /* Add transition for click effect */
}

.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    background: #f08080;
    display: grid;
    place-items: center;
}

.envelope::before {
    content: '';
    position: absolute;
    width: 212px;
    height: 212px;
    background: #f08080;
    transform: rotate(45deg);
    top: -105px;
    left: 44px;
    border-radius: 30px 0 0 0;
}

.front {
    position: absolute;
    border-right: 180px solid #f4978e;
    border-top: 95px solid transparent;
    border-bottom: 100px solid transparent;
    left: 120px;
    top: 5px;
    width: 0;
    height: 0;
    z-index: 10;
}

.front::before {
    position: absolute;
    content: '';
    border-left: 300px solid #fda996;
    border-top: 195px solid transparent;
    left: -120px;
    top: -95px;
}

.card {
    position: relative;
    width: 250px;
    height: 180px;
    background: #fff;
    border-radius: 2px;
    display: grid;
    place-items: center;
    transition: transform 1s;
}

.card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px solid #003049;
    border-style: dashed;
}

.valentines:hover .card {
    transform: translateY(-100px);
}

.valentines:active {
    transform: scale(0.9); /* Simulate the envelope being pressed */
}

.card .text {
    font-family: 'Brush Script MT', cursive;
    font-size: 28px;
    text-align: center;
    line-height: 25px;
    color: #003049;
}

.card .heart {
    position: relative;
    width: 35px;
    height: 35px;
    background: red;
    bottom: 20px;
    transform: rotate(45deg);
    border-radius: 50% 0 0 50%;
}

.card .heart::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: red;
    border-radius: 0 50% 50% 0;
    right: 0;
    transform: rotate(-90deg);
    transform-origin: top;
}

.card .heart::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: red;
    right: -18px;
}

@keyframes up {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-30px);
    }
}

.valentines::before {
    content: '';
    position: absolute;
    width: 330px;
    height: 25px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .3);
    top: 265px;
    left: -15px;
    animation: scale 3s linear infinite;
}

@keyframes scale {
    0%, 100% {
        transform: scaleX(1);
    }
    50% {
        transform: scaleX(.85);
    }
}

/* Media query for mobile view */
@media (max-width: 600px) {
    .envelope {
        width: 240px;
        height: 160px;
    }

    .envelope::before {
        width: 170px;
        height: 170px;
        top: -85px;
        left: 35px;
    }

    .front {
        border-right: 144px solid #f4978e;
        border-top: 76px solid transparent;
        border-bottom: 80px solid transparent;
        left: 96px;
        top: -205px;
    }

    .front::before {
        border-left: 240px solid #fda996;
        border-top: 156px solid transparent;
        left: -96px;
        top: -76px;
    }

    .card {
        width: 200px;
        height: 144px;
        transition: transform 1s; /* Smooth transition for the movement */
        transform: translateY(0); /* Ensure the card starts at its original position */
    }

    .card.moved-up {
        transform: translateY(-100px); /* Move the card up */
    }

    .card .text {
        font-size: 22px;
    }

    .card .heart {
        width: 20px;
        height: 20px;
    }

    .card .heart::after {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        background: red;
        right: -10px;
    }

    .valentines::before {
        width: 270px;
        height: 20px;
        top: 215px;
        left: -12px;
    }
}