
/* ===== GLOBAL ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---- BODY ---- */
body {
    background-color: #fff5f7;
    background-image: url(BG.png);
    background-size: cover;      /* 👈 shows FULL image, no zoom/crop */
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    font-family: sans-serif;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
@font-face {
    font-family: "Vividly-Regular";
    src: url('vividly.woff2') format('woff2'),
         url('Vividly-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ===== CONTAINER ===== */

.container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* ===== HEART BOX ===== */

#heart-box {
    position: relative;
    width: 320px;
    height: 280px;
    z-index: 10;
}

.door {
    position: absolute;
    top: 0;
    width: 50.5%;
    height: 100%;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    z-index: 20;
    cursor: pointer;
}

.door img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

.left-door {
    left: 0;
    transform-origin: left center;
    margin-right: -1px;
}

.right-door {
    right: 0;
    transform-origin: right center;
    margin-left: -1px;
}

#heart-box.open .left-door {
    transform: perspective(800px) rotateY(-175deg);
}

#heart-box.open .right-door {
    transform: perspective(800px) rotateY(175deg);
}

/* ===== INNER BOX ===== */

#inner-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out 0.4s;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#heart-box.open #inner-box {
    opacity: 1;
    pointer-events: auto;
}

.box-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    object-fit: fill;
}

/* ===== ITEMS ===== */

.item {
    position: absolute;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.5s ease;
    z-index: 30;
}

.item:hover {
    transform: scale(1.12) !important;
    z-index: 40;
}

.item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* ===== FLY OUT ===== */

.item.unboxed {
    animation: flyOut 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    pointer-events: none;
}

@keyframes flyOut {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    40% {
        transform: scale(1.4) translateY(-30px) rotate(8deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.2) translateY(-120px) rotate(-15deg);
        opacity: 0;
    }
}

/* ===== 17 ITEM POSITIONS ===== */

.item-1  { top: 15%; left: 14%; width: 52px; height: 60px; transform: rotate(-8deg); }
.item-2  { top: 14%; right: 12%; width: 55px; height: 62px; transform: rotate(10deg); }
.item-3  { top: 26%; left: 34%; width: 62px; height: 72px; transform: rotate(2deg); }
.item-4  { top: 22%; left: 44%; width: 55px; height: 58px; transform: rotate(-4deg); }
.item-5  { bottom: 30%; left: 32%; width: 60px; height: 60px; transform: rotate(-12deg); }
.item-6  { bottom: 23%; left: 38%; width: 58px; height: 62px; transform: rotate(5deg); }
.item-7  { bottom: 42%; left: 22%; width: 52px; height: 52px; transform: rotate(8deg); }
.item-8  { top: 40%; left: 16%; width: 50px; height: 55px; transform: rotate(-6deg); }
.item-9  { top: 44%; left: 50%; width: 60px; height: 60px; transform: rotate(6deg); }
.item-10 { top: 36%; right: 12%; width: 52px; height: 58px; transform: rotate(-10deg); }
.item-11 { bottom: 44%; right: 18%; width: 55px; height: 58px; transform: rotate(4deg); }
.item-12 { bottom: 39%; right: 23%; width: 62px; height: 65px; transform: rotate(-8deg); }
.item-13 { bottom: 32%; right: 22%; width: 55px; height: 60px; transform: rotate(9deg); }
.item-14 { bottom: 29%; left: 44%; width: 58px; height: 62px; transform: rotate(-3deg); }
.item-15 { bottom: 19%; right: 40%; width: 50px; height: 55px; transform: rotate(7deg); }
.item-16 { top: 20%; left: 31%; width: 48px; height: 52px; transform: rotate(-5deg); }
.item-17 { top: 22%; right: 30%; width: 50px; height: 54px; transform: rotate(11deg); }

/* ===== SPARKLES ===== */

#sparkle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.soft-sparkle {
    position: absolute;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 182, 193, 0.3);
    animation: snowFall 2.5s ease-in forwards;
}

@keyframes snowFall {
    0% {
        transform: translateY(-50px) scale(0.5) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(400px) scale(1.2) rotate(360deg);
        opacity: 0;
    }
}

/* ===== FLOATING PREVIEW ===== */

#floating-preview {
    position: fixed;
    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%) scale(0);

    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);

    padding: 20px;
    border-radius: 20px;

    box-shadow: 0 10px 30px rgba(255, 182, 193, 0.2);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;

    width: max-content;
    max-width: calc(100vw - 30px);
    max-height: calc(100dvh - 30px);

    z-index: 50;

    transition:
        transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.5s;

    opacity: 0;
    pointer-events: none;

    border: 1px solid #ff71ae;
    cursor: grab;
    touch-action: none;
}

#floating-preview.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

#floating-preview:active {
    cursor: grabbing;
}

/* ===== PREVIEW IMAGE ===== */

#preview-wrapper {
    width: 150px;
    height: 200px;
    max-width: calc(100vw - 80px);

    display: flex;
    justify-content: center;
    align-items: center;

    overflow: hidden;
}

#preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease-out;

    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

/* ===== DOWNLOAD BUTTON ===== */

.mini-download-btn {
    display: block;
    visibility: visible;
    opacity: 1;

    background: rgba(255, 153, 170, 0.2);
    color: hsl(334, 100%, 81%);

    border: 1px solid #ff71ae;
    padding: 6px 15px;
    border-radius: 30px;

    font-size: 12px;
    font-weight: bold;
    font-family: "Vividly-Regular";

    cursor: pointer;
    transition: all 0.3s;
}

.mini-download-btn:hover {
    background: #ffbadc;
    color: #ffffff;
}

/* ===== CLOSE PREVIEW ===== */

.close-preview {
    position: absolute;
    top: 10px;
    right: 15px;

    font-size: 14px;
    color: #ffc5de;

    font-family: "Vividly-Regular";
    cursor: pointer;
    transition: transform 0.2s;
}

.close-preview:hover {
    transform: rotate(90deg);
}

/* ===== STORE POPUP ===== */

#store-popup {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100vh;
    height: 100dvh;

    background: rgba(255, 200, 220, 0.35);
    backdrop-filter: blur(6px);

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 15px;
    overflow-y: auto;

    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#store-popup.hidden {
    opacity: 0;
    pointer-events: none;
}

.store-popup-card {
    display: block;
    visibility: visible;

    background: linear-gradient(160deg, #fff0f6, #ffe4ef);

    border: 2px dashed #ff71ae;
    border-radius: 28px;

    padding: 19px 39px;

    text-align: center;

    max-width: 296px;
    width: 100%;

    margin: auto;
    flex-shrink: 0;

    box-shadow: 0 12px 40px rgba(255, 150, 190, 0.4);

    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    position: relative;
}

@keyframes popIn {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.store-popup-card h2 {
    font-family: "Vividly-Regular", 'Comic Sans MS', cursive;
    color: #ff6fa5;
    margin: 6px 0 10px;
    font-size: 1.25rem;
}

.store-popup-card p {
    color: #b86b8a;
    font-size: 0.9rem;
    font-family: "Vividly-Regular";
    margin-bottom: 18px;
    line-height: 1.5;
}

.store-popup-sparkles {
    color: #ff9ec4;
    font-size: 1.1rem;
    letter-spacing: 6px;
}

/* ===== PADDLE / WHOP / LAVA TOP LINKS ===== */

.store-btn {
    display: block;
    visibility: visible;
    opacity: 1;

    margin: 10px auto;

    font-family: "Vividly-Regular";

    padding: 12px 18px;

    background: #fff;
    color: #ff6fa5;

    text-decoration: none;
    border-radius: 50px;
    border: 2px solid #ffc2dc;

    font-weight: bold;
    font-size: 0.95rem;

    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;

    box-shadow: 0 4px 12px rgba(255, 180, 210, 0.5);
}

.store-btn:hover {
    transform: translateY(-3px) scale(1.03);
    background: #ffe4ef;
    box-shadow: 0 8px 20px rgba(255, 150, 190, 0.6);
}

/* ===== CLOSE STORE POPUP ===== */

.close-store-popup {
    display: block;
    margin-top: 14px;

    color: #d68aa8;
    font-size: 0.8rem;

    cursor: pointer;
    letter-spacing: 1px;
}

.close-store-popup:hover {
    color: #ff6fa5;
}

/* ===== MOBILE ===== */

@media screen and (max-width: 390px) {

    #heart-box {
        transform: scale(.75);
    }

    #floating-preview {
        max-width: calc(100vw - 24px);
    }

    #preview-wrapper {
        width: 150px;
        height: 200px;
    }

    #store-popup {
        padding: 12px;
    }

    .store-popup-card {
        max-width: 296px;
        padding: 19px 25px;
    }
}
/* ===== 390px MOBILE CENTERING FIX ===== */

@media screen and (max-width: 390px) {

    /* Center preview */
    #floating-preview {
        left: 50%;
        margin-left: -20px;
    }

    /* Center store popup */
    #store-popup {
        left: -20px;
        width: 100%;
    }

    .store-popup-card {
        margin-left: auto;
        margin-right: auto;
    }

}