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

.musicBtn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid white;
    background-color: #fc6885;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(252, 104, 133, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background-color 0.2s;
    animation: pulseMusic 1.8s ease-in-out infinite;
}

.musicHint {
    position: fixed;
    right: 90px;
    bottom: 40px;
    z-index: 9999;
    font-family: "Protest Revolution", sans-serif;
    font-size: 16px;
    color: #ff7fab;
    text-shadow: 0 0 8px rgba(255, 127, 171, 0.9);
    animation: hintBlink 1.8s ease-in-out infinite;
}

.musicBtn:hover {
    transform: scale(1.15);
    background-color: #f35553;
}

.musicBtn.paused {
    animation: none;
    opacity: 0.75;
}

@keyframes pulseMusic {
    0%   { box-shadow: 0 0 8px rgba(252, 104, 133, 0.6); }
    50%  { box-shadow: 0 0 22px rgba(252, 104, 133, 1); }
    100% { box-shadow: 0 0 8px rgba(252, 104, 133, 0.6); }
}

@keyframes hintBlink {
    0%, 100% {
        opacity: 0.75;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-1px);
    }
}

html, body {
    height: 100%;
    width: 100%;
}

.container {
    position: relative;
    height: 100%;
    width: 100%;
    background-color: #fc6885;
    overflow: hidden;
}

.paperHeart {
    position: absolute;
    height: 100px;
    top: 80%;
    opacity: 0;
    filter: drop-shadow(0 0 20px white);
    animation: hiddenHeart 3.1s linear forwards,flyHeart 4s ease-in-out calc(var(--time) + 3.1s) infinite;
}

.paperHeart1 {
    left: 50px;
}

.paperHeart2 {
    left: 250px;
}

.paperHeart3 {
    left: 500px;
}

.paperHeart4 {
    left: 800px;
}

.paperHeart5 {
    left: 1100px;
}

.paperHeart6 {
    left: 1400px;
}

.boxCloud {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 300px;
    width: 100%;
    background-color: transparent;
}

.container .cloud {
    position: absolute;
    top: 120%;
    left: -50px;
}

.container .cloud1 {
    position: absolute;
    top: 120%;
    left: -50px;
}

.container .cloud2 {
    position: absolute;
    top: 120%;
    left: -50px;
}

.container.active.close {
    .btnBox {
        animation: disappearBtn 1s ease-in-out forwards;
    }

    .boxTitle {
        animation: disappearBoxTitle 1s ease-in-out forwards;
    }
}

@keyframes disappearBtn {
    from {
        top: 50%;
    }

    to {
        top: 150%;
    }
}

@keyframes disappearBoxTitle {
    from {
        top: 10%;
    }

    to {
        top: -50%;
    }
}

.container.active .cloud {
    position: absolute;
    top: 0;
    left: -50px;
    height: 200px;
    width: 200px;
    background-color: #ffb3c1;
    border-radius: 50%;
    box-shadow: 120px -20px #ffb3c1, 240px -40px #ffb3c1, 360px -20px #ffb3c1,
    480px 0px #ffb3c1, 600px -10px #ffb3c1, 720px 10px #ffb3c1, 840px 20px #ffb3c1, 
    960px 0px #ffb3c1, 1080px 40px #ffb3c1, 1200px 20px #ffb3c1, 1320px 0px #ffb3c1,
    1440px -20px #ffb3c1;
    transition: .8s;
    transition-delay: 2.2s;
    animation: animateCloud 3s ease-in-out 1s infinite;
}

@keyframes animateCloud {
    0% {
        top: 0;
    }

    25% {
        top:  10px;
    }

    50% {
        top: -10px;
    }

    75% {
        top: 10px;
    }

    100% {
        top: 0;
    }

}

@keyframes animateCloud1 {
    0% {
        top: 75;
    }

    25% {
        top:  85;
    }

    50% {
        top: 65;
    }

    75% {
        top: 85;
    }

    100% {
        top: 75;
    }

}

@keyframes animateCloud2 {
    0% {
        top: 150;
    }

    25% {
        top:  160px;
    }

    50% {
        top: 140px;
    }

    75% {
        top: 160px;
    }

    100% {
        top: 150;
    }

}

.container.active .cloud1 {
    position: absolute;
    top: 75px;
    left: -50px;
    content: "";
    height: 200px;
    width: 200px;
    background-color: #ffccd5;
    border-radius: 50%;
    box-shadow: 120px -20px #ffccd5, 240px -40px #ffccd5, 360px -20px #ffccd5,
    480px 0px #ffccd5, 600px -10px #ffccd5, 720px 10px #ffccd5, 840px 20px #ffccd5, 
    960px 0px #ffccd5, 1080px 40px #ffccd5, 1200px 20px #ffccd5, 1320px 0px #ffccd5,
    1440px -20px #ffccd5, 1560px 0px #ffccd5;
    transition: .8s;
    transition-delay: 1.3s;
    animation: animateClou1 3s ease-in-out 1.5s infinite;
}

.container.active .cloud2 {
    position: absolute;
    top: 150px;
    left: -50px;
    content: "";
    height: 200px;
    width: 200px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 120px -20px white, 240px -20px white, 360px -20px white,
    480px 0px white, 600px -10px white, 720px 10px white, 840px 20px white, 
    960px 0px white, 1080px 40px white, 1200px 20px white, 1320px 0px white,
    1440px -20px white, 1560px 0px white;
    transition: .8s;
    transition-delay: .5s;
    animation: animateCloud2 3s ease-in-out 2s infinite;
}

.boxTitle {
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Rubik Glitch Pop", system-ui;
    font-weight: 400;
    font-style: normal;
    font-size: 120px;
    color: pink;
    height: fit-content;
    width: fit-content;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    text-shadow: 0 0 20px white;
    animation: appearTitle 2s linear 3.1s forwards, floatingWords 4s ease-in-out infinite;
    
}

.container .btnBox {
    position: absolute;
    top: 150%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 160px;
    width: 400px;
    opacity: 1;
}

.container.active .btnBox {
    opacity: 1;
    transition: 1s;
    transition-delay: 5s;
    animation: appearBtnBox 2s ease-in-out 5s forwards,animateOpenBtn 2s ease-in-out 5s infinite;
}

@keyframes appearBtnBox {
    from {
        top: 150%;
    }

    to {
        top: 50%;
    }
}

.cloudBtn {
    position: relative;
    height: 100px;
    width: 100px;
    background-color: #fc6885;
    border-radius: 50%;
    box-shadow: 60px 0 #fc6885, 120px 0 #fc6885, 180px 0 #fc6885, 240px 0 #fc6885,
    300px 0 #fc6885, 300px 60px #fc6885, 240px 60px #fc6885, 180px 60px #fc6885,
    120px 60px #fc6885, 60px 60px #fc6885, 0 60px #fc6885;
}

.cloudBtn::before {
    position: absolute;
    content: "";
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 80px;
    width: 80px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 60px 0 white, 120px 0 white, 180px 0 white, 240px 0 white,
    300px 0 white, 300px 60px white, 240px 60px white, 180px 60px white,
    120px 60px white, 60px 60px white, 0 60px white;
}

.openBtn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    font-family: "Rubik Glitch Pop", system-ui;
    font-weight: 400;
    font-style: normal;
    font-size: 40px;
    color: #fc6885;
    background-color: transparent;
    border: none;
    text-shadow: 0 0 10px pink;
}

.openBtn:hover {
    cursor: grab;
}

/* OPEN */
.container.active.open {
    .boxTitle {
        animation: none;
        top: -40%;
    }

    .btnBox {
        animation: none;
        top: 140%;
    }
    
}

.cardValentine {
    position: absolute;
    top: 200%;
    left: 50%;
    opacity: 0;
    transform: translate(-50%, -50%);
    height: 600px;
    width: 800px;
    background-color: transparent;
    transition: .5;
}

.cardValentine.active {
    position: absolute;
    top: 50%;
    left: 50%;
    opacity: 1;
    transform: translate(-50%, -50%);
    height: 600px;
    width: 800px;
    background-color: transparent;
    transition: .5;
    animation: animateCard 2s ease-in-out forwards;
}

@keyframes animateCard {
    from {
        top: 200%;
    }

    to {
        top: 50%;
    }
}

.cardValentine .left {
    z-index: 2;
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    width: 50%;
    border-radius: 10px;
    transition: .5s;
    padding: 20px;
}

.cardValentine .left .leftFront {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: #f35553;
    border-radius: inherit;
    transition: .5s;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px lightgray;
    border-left: 10px solid #c9413f;
}

.boxShadow {
    filter: drop-shadow(0 0 10px white);
    height: fit-content;
    width: fit-content;
}

.boxTitleCard {
    position: relative;
    height: 300px;
    width: 300px;
    display: flex;
    justify-content: center;
    background-color: white;
    clip-path: polygon(10% 0, 35% 0, 50% 23%, 65% 0, 90% 0, 100% 30%, 50% 100%, 0 30%);
}

.boxTitleCard::before {
    position: absolute;
    content: "";
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 280px;
    width: 280px;
    background-color: #f35553;
    clip-path: polygon(10% 0, 35% 0, 50% 23%, 65% 0, 90% 0, 100% 30%, 50% 100%, 0 30%);
}

.boxTitleCard::after {
    position: absolute;
    content: "";
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 250px;
    width: 250px;
    background-color: white;
    clip-path: polygon(10% 0, 35% 0, 50% 23%, 65% 0, 90% 0, 100% 30%, 50% 100%, 0 30%);
}


.titleCard {
    font-family: "Protest Revolution", sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 60px;
    color: #f35553;
    margin-top: 80px;
}

.cardValentine .left .leftBack {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
    backface-visibility: hidden;
    background-color: #f35553;
    height: 100%;
    width: 100%;
    border-radius: inherit;
    border-right: 10px solid #c9413f;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: .5s;
}

.artHeart {
    width: 90%;
    height: auto;
    filter: drop-shadow(0 0 5px white);
}

.des {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Protest Revolution", sans-serif;
    font-weight: 400;
    font-size: 24px;
    font-style: normal;
    width: 100%;
    text-align: center;
}

.cardValentine .right {
    z-index: 1;
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    width: 50%;
    background-color: #f35553;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-left: 10px solid #c9413f;
    transition: .5s;
}

.rightContent {
    position: relative;
    font-size: 20px;
    height: 95%;
    width: 90%;
    background-color: wheat;
    border-radius: 5px;
    padding: 20px 15px;
    overflow: auto;
}

.rightContent::-webkit-scrollbar {
    background-color: white;
    width: 6px;
}

.rightContent::-webkit-scrollbar-thumb {
    background-color: #d34745;
}

.letterContent {
    font-family: "Pacifico", cursive;
    font-weight: 400;
    font-style: normal;
    padding-bottom: 84px;
}

.roseGarden {
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: 92%;
    height: 120px;
    transform: translateX(-50%) translateY(18px);
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.45s ease;
    pointer-events: none;
}

.roseGarden.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.flower {
    position: absolute;
    bottom: 0;
    width: 38px;
    height: 0;
    transform-origin: bottom center;
    opacity: 0;
}

.flower::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 6px;
    height: 100%;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(to top, #1f9d56 0%, #40c77b 65%, #72dd9e 100%);
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.14);
}

.flower::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 26px;
    width: 15px;
    height: 9px;
    background: #2fba68;
    border-radius: 0 12px 12px 12px;
    transform: translateX(-12px) rotate(-32deg);
    box-shadow: 16px -13px 0 0 #2aa65e;
}

.bloom {
    position: absolute;
    left: 50%;
    top: -16px;
    width: 22px;
    height: 18px;
    border-radius: 50% 50% 40% 40%;
    transform: translateX(-50%);
    background: radial-gradient(circle at 50% 72%, #ffe5a0 0%, #ffe5a0 34%, #f6c8d8 35%, #f8b7cf 100%);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.bloom::before,
.bloom::after {
    content: "";
    position: absolute;
    top: -6px;
    width: 16px;
    height: 14px;
    border-radius: 60% 60% 55% 55%;
    background: #f6bcd1;
}

.bloom::before {
    left: -9px;
    transform: rotate(-26deg);
}

.bloom::after {
    right: -9px;
    transform: rotate(26deg);
}

.roseGarden.show .flower {
    animation: growStem 0.95s ease-out forwards, swayWind 3.2s ease-in-out 0.95s infinite;
}

.f1 {
    left: 10%;
    transform: rotate(-9deg);
}

.f2 {
    left: 33%;
    transform: rotate(4deg);
}

.f3 {
    left: 56%;
    transform: rotate(-2deg);
}

.f4 {
    left: 79%;
    transform: rotate(8deg);
}

.f1,
.f3 {
    animation-delay: 0.05s, 1.0s;
}

.f2,
.f4 {
    animation-delay: 0.2s, 1.15s;
}

@keyframes growStem {
    0% {
        height: 0;
        opacity: 0;
    }

    100% {
        height: 88px;
        opacity: 1;
    }
}

@keyframes swayWind {
    0%,
    100% {
        transform: rotate(-7deg);
    }

    50% {
        transform: rotate(7deg);
    }
}

@keyframes bloomPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.06);
    }
}

.roseGarden.show .bloom {
    animation: bloomPulse 2.4s ease-in-out 1.1s infinite;
}

.cardValentine.active.open {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: .5s;

    .left {
        transform-style: preserve-3d;
        transform: rotateY(-180deg);
        transform-origin: left;
        background-color: red;
        transition: .5s;
    }

    .leftFront {
        backface-visibility: hidden;
    }

}

@keyframes appearTitle {
    to {
        top: 10%;
    }
}

@keyframes floatingWords {
    0% {
        transform: translateX(-50%);
    }

    25% {
        transform: translateX(-50%) translateY(-50px);
    }

    50% {
        transform: translateX(-50%) translateY(50px);
    }

    75% {
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes flyHeart {
    to {
        top: -20%;
    }
}

@keyframes hiddenHeart {
    0% {
        opacity: 0;
    }

    95% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes animateOpenBtn {
    25% {
        top: 50%;
    }

    50% {
        top: calc(50% + 2px);
    }

    75% {
        top: calc(50% - 2px);
    }

    100% {
        top: 50%;
    }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {

    /* Tiêu đề co theo màn hình */
    .boxTitle {
        font-size: min(13vw, 80px);
        white-space: nowrap;
    }

    /* Tim bay trải đều theo viewport */
    .paperHeart { height: 48px; }
    .paperHeart1 { left: 2vw; }
    .paperHeart2 { left: 18vw; }
    .paperHeart3 { left: 34vw; }
    .paperHeart4 { left: 50vw; }
    .paperHeart5 { left: 66vw; }
    .paperHeart6 { left: 82vw; }

    /* Nút bấm */
    .container .btnBox {
        width: min(86vw, 400px);
        height: 116px;
    }

    .cloudBtn {
        height: 70px;
        width: 70px;
        box-shadow:
            42px 0 #fc6885, 84px 0 #fc6885, 126px 0 #fc6885,
            168px 0 #fc6885, 210px 0 #fc6885, 252px 0 #fc6885,
            252px 42px #fc6885, 210px 42px #fc6885, 168px 42px #fc6885,
            126px 42px #fc6885, 84px 42px #fc6885, 42px 42px #fc6885, 0 42px #fc6885;
    }

    .cloudBtn::before {
        height: 56px;
        width: 56px;
        box-shadow:
            42px 0 white, 84px 0 white, 126px 0 white,
            168px 0 white, 210px 0 white, 252px 0 white,
            252px 42px white, 210px 42px white, 168px 42px white,
            126px 42px white, 84px 42px white, 42px 42px white, 0 42px white;
    }

    .openBtn {
        font-size: 18px;
    }

    /* ---- CARD: layout dọc trên mobile ---- */
    .cardValentine,
    .cardValentine.active {
        width: 92vw;
        height: 84vh;
        perspective: 1300px;
    }

    /* Nắp thư che full card trước khi mở */
    .cardValentine .left {
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        padding: 8px;
        z-index: 3;
        transform-style: preserve-3d;
    }

    .cardValentine .left .leftFront {
        z-index: 4;
        border-left: none;
        border-bottom: none;
    }

    /* leftBack đổi trục flip sang X */
    .cardValentine .left .leftBack {
        transform: rotateX(180deg);
        backface-visibility: hidden;
        border-right: none;
        border-bottom: none;
    }

    /* Nội dung thư nằm dưới nắp thư */
    .cardValentine .right {
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-left: none;
        border-top: none;
        border-radius: 10px;
        z-index: 1;
    }

    /* Trái tim icon */
    .boxTitleCard {
        height: 110px;
        width: 110px;
    }

    .boxTitleCard::before {
        height: 100px;
        width: 100px;
    }

    .boxTitleCard::after {
        height: 86px;
        width: 86px;
    }

    .des {
        font-size: 11px;
        bottom: 6px;
        white-space: nowrap;
    }

    .artHeart {
        width: 58%;
    }

    .rightContent {
        width: 92%;
        height: 88%;
        font-size: 13px;
        padding: 8px 10px;
    }

    .letterContent {
        font-size: 13px;
        line-height: 1.65;
        padding-bottom: 72px;
    }

    .roseGarden {
        bottom: 6px;
        height: 100px;
    }

    .flower {
        width: 32px;
    }

    .roseGarden.show .flower {
        animation: growStemMobile 0.95s ease-out forwards, swayWind 3.2s ease-in-out 0.95s infinite;
    }

    .bloom {
        width: 18px;
        height: 15px;
        top: -13px;
    }

    .bloom::before,
    .bloom::after {
        width: 13px;
        height: 11px;
    }

    .bloom::before {
        left: -7px;
    }

    .bloom::after {
        right: -7px;
    }

    /* Flip dọc (từ trên xuống) trên mobile */
    .cardValentine.active.open {
        .left {
            transform-origin: top;
            transform: rotateX(-180deg);
            background-color: transparent;
        }

        .leftFront {
            backface-visibility: hidden;
        }
    }

    /* Nút nhạc */
    .musicBtn {
        bottom: 14px;
        right: 14px;
        width: 46px;
        height: 46px;
        font-size: 20px;
    }

    .musicHint {
        right: 68px;
        bottom: 28px;
        font-size: 13px;
    }
}

@keyframes growStemMobile {
    0% {
        height: 0;
        opacity: 0;
    }

    100% {
        height: 68px;
        opacity: 1;
    }
}