* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

body {
    overflow: hidden;
    font-family: "Poppins", sans-serif;
    background:
        radial-gradient(circle at top, rgba(255, 240, 245, 0.45), transparent 30%),
        linear-gradient(180deg, #f9dfe7 0%, #efbfd0 40%, #d98ea8 75%, #b96583 100%);
    color: #6c2c43;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* loading */
.loading {
    z-index: 30;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.35), transparent 30%),
        linear-gradient(-45deg, #f9d4df, #efb8ca, #e59cb3, #cf728f);
    background-size: 400% 400%;
    animation: gradientMove 10s ease infinite;
    text-align: center;
}

.loading-name {
    font-family: "Great Vibes", cursive;
    font-size: 3.5rem;
    color: #fff8fb;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 8px;
    animation: softPulse 2s ease-in-out infinite;
}

.loading-text {
    color: #fff8fb;
    font-size: 1rem;
    margin-bottom: 22px;
}

.loading-hearts {
    display: flex;
    gap: 10px;
    font-size: 1.2rem;
    color: #fff8fb;
}

.loading-hearts span {
    animation: bounceHeart 1.4s infinite ease-in-out;
}

.loading-hearts span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-hearts span:nth-child(3) {
    animation-delay: 0.4s;
}

/* intro */
.intro {
    text-align: center;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.35), transparent 35%),
        linear-gradient(-45deg, #f9d4df, #efb8ca, #e59cb3, #cf728f);
    background-size: 400% 400%;
    animation: gradientMove 10s ease infinite;
}

.intro-card {
    width: 100%;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    border-radius: 28px;
    padding: 30px 22px;
    box-shadow: 0 14px 35px rgba(108, 44, 67, 0.14);
}

.intro-title {
    font-family: "Great Vibes", cursive;
    font-size: 3rem;
    color: #fff8fb;
    margin-bottom: 10px;
}

.intro-subtitle {
    font-size: 1rem;
    line-height: 1.7;
    color: #fff8fb;
    margin-bottom: 24px;
}

.open-btn {
    border: none;
    border-radius: 999px;
    padding: 14px 32px;
    font-size: 1rem;
    font-family: "Poppins", sans-serif;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #dd7596, #c7587b);
    box-shadow: 0 10px 24px rgba(199, 88, 123, 0.28);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.open-btn:hover,
.open-btn:active {
    transform: scale(1.04);
}

/* main */
.main {
    overflow-y: auto;
    overflow-x: hidden;
    justify-content: flex-start;
    padding-top: 24px;
    padding-bottom: 30px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.25), transparent 28%),
        linear-gradient(180deg, #f8dce5 0%, #ebb7c8 48%, #cf7f98 100%);
}

.main::-webkit-scrollbar {
    width: 0;
}

.hearts-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.heart {
    position: absolute;
    bottom: -30px;
    color: rgba(255, 255, 255, 0.45);
    animation: rise linear infinite;
    user-select: none;
}

.heart:nth-child(1) {
    left: 8%;
    font-size: 16px;
    animation-duration: 8s;
    animation-delay: 0s;
}

.heart:nth-child(2) {
    left: 17%;
    font-size: 20px;
    animation-duration: 10s;
    animation-delay: 1.1s;
}

.heart:nth-child(3) {
    left: 29%;
    font-size: 14px;
    animation-duration: 7.5s;
    animation-delay: 2s;
}

.heart:nth-child(4) {
    left: 41%;
    font-size: 22px;
    animation-duration: 9s;
    animation-delay: 1.5s;
}

.heart:nth-child(5) {
    left: 53%;
    font-size: 16px;
    animation-duration: 11s;
    animation-delay: 0.5s;
}

.heart:nth-child(6) {
    left: 65%;
    font-size: 23px;
    animation-duration: 8.6s;
    animation-delay: 2.2s;
}

.heart:nth-child(7) {
    left: 76%;
    font-size: 18px;
    animation-duration: 10.2s;
    animation-delay: 1.2s;
}

.heart:nth-child(8) {
    left: 88%;
    font-size: 20px;
    animation-duration: 9s;
    animation-delay: 2.8s;
}

.heart:nth-child(9) {
    left: 95%;
    font-size: 15px;
    animation-duration: 7.9s;
    animation-delay: 0.9s;
}

.content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 370px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tag {
    font-size: 0.98rem;
    color: #fff8fb;
    margin-bottom: 14px;
    font-weight: 500;
}

/* envelope */
.envelope-wrapper {
    position: relative;
    width: 100%;
    max-width: 320px;
    height: 220px;
    margin-bottom: 18px;
    perspective: 1200px;
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
}

.envelope-back {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background:
        linear-gradient(180deg, #fff5f8, #f2cfda),
        repeating-linear-gradient(45deg,
            rgba(255, 255, 255, 0.08) 0px,
            rgba(255, 255, 255, 0.08) 2px,
            transparent 2px,
            transparent 8px);
    box-shadow: 0 18px 40px rgba(108, 44, 67, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.envelope-front-left,
.envelope-front-right,
.envelope-bottom {
    position: absolute;
    z-index: 4;
}

.envelope-front-left {
    left: 0;
    bottom: 0;
    width: 50%;
    height: 62%;
    background: #efc3d1;
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
    border-bottom-left-radius: 18px;
}

.envelope-front-right {
    right: 0;
    bottom: 0;
    width: 50%;
    height: 62%;
    background: #ebb4c6;
    clip-path: polygon(0 0, 100% 100%, 0 100%);
    border-bottom-right-radius: 18px;
}

.envelope-bottom {
    left: 0;
    bottom: 0;
    width: 100%;
    height: 46%;
    background: linear-gradient(180deg, #efbfd0, #e4a6bb);
    clip-path: polygon(0 100%, 50% 0, 100% 100%);
    z-index: 3;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 115px;
    background: linear-gradient(180deg, #f8dae4, #edbdcc);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top;
    transition: transform 1.3s ease;
    z-index: 6;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
}

.seal {
    position: absolute;
    left: 50%;
    top: 78px;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #e67a9c, #bf476f);
    z-index: 7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff8fb;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(191, 71, 111, 0.3);
    transition: opacity 0.5s ease;
}

.letter-preview {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%) translateY(0);
    width: 89%;
    height: 76%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 246, 249, 0.98));
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(108, 44, 67, 0.12);
    transition: transform 1.35s ease 0.3s;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 18px 16px;
}

.letter-preview-title {
    font-family: "Great Vibes", cursive;
    font-size: 2rem;
    color: #b24f71;
}

.main.show-letter .envelope-flap {
    transform: rotateX(180deg);
}

.main.show-letter .letter-preview {
    transform: translateX(-50%) translateY(-50px);
}

.main.show-letter .seal {
    opacity: 0;
}

/* real card */
.love-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 24px;
    padding: 18px 14px 16px;
    backdrop-filter: blur(6px);
    box-shadow: 0 12px 30px rgba(108, 44, 67, 0.12);
    margin-bottom: 16px;
}

.message-box {
    min-height: 125px;
    font-size: 0.98rem;
    line-height: 1.85;
    text-align: left;
    white-space: pre-wrap;
    margin-bottom: 16px;
    font-weight: 400;
    color: #713249;
}

.cursor {
    display: inline-block;
    animation: blink 0.8s infinite;
    color: #c96a8a;
}

/* carousel */
.carousel {
    margin-top: 10px;
    width: 100%;
    user-select: none;
}

.carousel-frame {
    width: 100%;
    height: 240px;
    overflow: hidden;
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 10px 24px rgba(108, 44, 67, 0.14);
    background: rgba(255, 255, 255, 0.12);
    touch-action: pan-y;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.6s ease;
}

.slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    border-radius: 14px;
}

.carousel-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

.carousel-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    color: #7c3651;
    font-size: 1.1rem;
    cursor: pointer;
}

.dots {
    display: flex;
    gap: 7px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(124, 54, 81, 0.24);
    transition: transform 0.2s ease, background 0.2s ease;
}

.dot.active {
    background: #c45b7f;
    transform: scale(1.2);
}

/* counter */
.counter {
    width: 100%;
    margin: 0 0 16px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 14px 12px;
    box-shadow: 0 12px 30px rgba(108, 44, 67, 0.12);
    backdrop-filter: blur(6px);
}

.counter-title {
    font-size: 0.92rem;
    color: #fff8fb;
    margin-bottom: 10px;
    font-weight: 500;
}

.counter-grid {
    display: grid;
    gap: 8px;
}

.counter-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.counter-item {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 10px 6px;
}

.counter-number {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.counter-label {
    font-size: 0.72rem;
    color: #fff2f6;
    font-weight: 500;
}

.big-love {
    font-family: "Great Vibes", cursive;
    font-size: 3rem;
    font-weight: normal;
    line-height: 1.1;

    background: linear-gradient(90deg,
            #ffffff,
            #ffd6e5,
            #ff7aa3,
            #ffd6e5,
            #ffffff);

    background-size: 200% auto;

    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    animation: loveGradient 4s linear infinite;
}

.tap-heart {
    position: absolute;
    font-size: 22px;
    pointer-events: none;
    z-index: 10;
    animation: popHeart 1s ease forwards;
    color: rgba(255, 255, 255, 0.88);
}

@keyframes loveGradient {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

@keyframes pulse {

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

    50% {
        transform: scale(1.04);
    }
}

@keyframes softPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.03);
        opacity: 0.95;
    }
}

@keyframes bounceHeart {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.8;
    }

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

@keyframes rise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    50% {
        transform: translateY(-50vh) translateX(8px) scale(1.08);
    }

    100% {
        transform: translateY(-110vh) translateX(-10px) scale(1.15);
        opacity: 0;
    }
}

@keyframes popHeart {
    0% {
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -90px) scale(1.2);
        opacity: 0;
    }
}

@media (max-width: 400px) {

    .loading-name,
    .intro-title {
        font-size: 2.7rem;
    }

    .loading-text,
    .intro-subtitle {
        font-size: 0.96rem;
    }

    .envelope-wrapper {
        max-width: 300px;
        height: 210px;
    }

    .carousel-frame {
        height: 220px;
    }

    .message-box {
        font-size: 0.94rem;
    }

    .big-love {
        font-size: 2.6rem;
    }

    .counter-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .counter-number {
        font-size: 0.95rem;
    }

    .counter-label {
        font-size: 0.67rem;
    }
}