/* ============================================================
   Page Base
   ============================================================ */

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    overflow-x: hidden;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: radial-gradient(circle at 15% 15%, rgba(255, 153, 190, 0.35), transparent 28%), radial-gradient(circle at 85% 20%, rgba(255, 218, 235, 0.9), transparent 30%), radial-gradient(circle at 50% 90%, rgba(255, 203, 222, 0.45), transparent 32%), linear-gradient(135deg, #fff7fb 0%, #fff0f6 45%, #f7fbff 100%);
}

.gift-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 48px 20px;
    text-align: center;
    overflow: hidden;
}

    .gift-page::before,
    .gift-page::after {
        content: "??";
        position: absolute;
        font-size: 12rem;
        opacity: 0.045;
        pointer-events: none;
    }

    .gift-page::before {
        top: 8%;
        left: 8%;
        transform: rotate(-18deg);
    }

    .gift-page::after {
        right: 8%;
        bottom: 6%;
        transform: rotate(16deg);
    }

.gift-hero {
    position: relative;
    z-index: 1;
    margin-bottom: 34px;
}

.gift-kicker {
    margin: 0 0 10px;
    color: #c94e7d;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.gift-hero h1 {
    margin: 0 0 12px;
    color: #201923;
    font-size: clamp(2rem, 5vw, 3.8rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.gift-hero p {
    margin: 0;
    color: #6f5d67;
    font-size: 1.05rem;
}

.gift-shell {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    padding: 42px 24px 48px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 42px;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: 0 30px 90px rgba(196, 74, 122, 0.12);
    backdrop-filter: blur(10px);
}


/* ============================================================
   Gift Grid
   ============================================================ */

.gift-grid {
    display: grid;
    grid-template-columns: repeat(3, 120px);
    gap: 20px;
    justify-content: center;
    margin: 36px auto;
}

.gift-box {
    position: relative;
    width: 120px;
    height: 120px;
    padding: 0;
    border: 0;
    border-radius: 26px;
    background: linear-gradient(145deg, #fff, #ffeaf2);
    cursor: pointer;
    box-shadow: 0 18px 35px rgba(215, 95, 140, 0.22);
    transition: box-shadow 0.22s ease, background 0.22s ease;
    animation: giftFloat 3s ease-in-out infinite;
    overflow: hidden;
}

    .gift-box.gift-pink {
        --gift-body-start: #ff6b9d;
        --gift-body-end: #ff3f85;
        --gift-lid-start: #ff8ab4;
        --gift-lid-end: #ff5a96;
        --gift-bow: #ff3f85;
        --gift-ribbon: #ffd35a;
    }

    .gift-box.gift-purple {
        --gift-body-start: #b88cff;
        --gift-body-end: #8f5cff;
        --gift-lid-start: #caa8ff;
        --gift-lid-end: #a875ff;
        --gift-bow: #8f5cff;
        --gift-ribbon: #ffe083;
    }

    .gift-box.gift-blue {
        --gift-body-start: #7bc7ff;
        --gift-body-end: #3fa7f5;
        --gift-lid-start: #9bd6ff;
        --gift-lid-end: #5db9ff;
        --gift-bow: #3fa7f5;
        --gift-ribbon: #ffd35a;
    }

    .gift-box.gift-peach {
        --gift-body-start: #ffad8a;
        --gift-body-end: #ff7b5c;
        --gift-lid-start: #ffc0a6;
        --gift-lid-end: #ff9678;
        --gift-bow: #ff7b5c;
        --gift-ribbon: #ffe083;
    }

    .gift-box.gift-mint {
        --gift-body-start: #77dfc2;
        --gift-body-end: #35bfa0;
        --gift-lid-start: #9aead6;
        --gift-lid-end: #5bd3b8;
        --gift-bow: #35bfa0;
        --gift-ribbon: #ffd35a;
    }

    .gift-box:hover:not(.opened) {
        box-shadow: 0 24px 44px rgba(215, 95, 140, 0.32);
        animation: giftHover 0.45s ease-in-out infinite alternate;
    }

    .gift-box:nth-child(2),
    .gift-box:nth-child(5),
    .gift-box:nth-child(8) {
        animation-delay: 0.45s;
    }

    .gift-box:nth-child(3),
    .gift-box:nth-child(6),
    .gift-box:nth-child(9) {
        animation-delay: 0.9s;
    }

.gift-body {
    position: absolute;
    left: 25px;
    bottom: 24px;
    width: 70px;
    height: 58px;
    border-radius: 10px 10px 14px 14px;
    background: linear-gradient(145deg, var(--gift-body-start), var(--gift-body-end));
    z-index: 1;
}

.gift-lid {
    position: absolute;
    left: 20px;
    top: 31px;
    width: 80px;
    height: 24px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--gift-lid-start), var(--gift-lid-end));
    transform-origin: bottom left;
    transition: transform 0.35s ease, opacity 0.2s ease;
    z-index: 2;
}

.gift-ribbon-vertical {
    position: absolute;
    left: 54px;
    bottom: 24px;
    width: 12px;
    height: 82px;
    background: var(--gift-ribbon);
    z-index: 3;
}

.gift-ribbon-horizontal {
    position: absolute;
    left: 25px;
    bottom: 50px;
    width: 70px;
    height: 12px;
    background: var(--gift-ribbon);
    z-index: 3;
}

.gift-bow {
    position: absolute;
    left: 43px;
    top: 20px;
    width: 34px;
    height: 22px;
    z-index: 4;
}

    .gift-bow::before,
    .gift-bow::after {
        content: "";
        position: absolute;
        width: 20px;
        height: 22px;
        border-radius: 50% 50% 45% 45%;
        background: var(--gift-bow);
    }

    .gift-bow::before {
        left: 0;
        transform: rotate(-25deg);
    }

    .gift-bow::after {
        right: 0;
        transform: rotate(25deg);
    }

.gift-box.opened {
    cursor: default;
    background: #fff;
    box-shadow: 0 12px 24px rgba(215, 95, 140, 0.14);
}

    .gift-box.opened .gift-lid,
    .gift-box.opened .gift-body,
    .gift-box.opened .gift-ribbon-vertical,
    .gift-box.opened .gift-ribbon-horizontal,
    .gift-box.opened .gift-bow {
        display: none;
    }

.gift-result {
    position: relative;
    z-index: 5;
    display: grid;
    place-items: center;
    height: 100%;
    font-size: 3rem;
    animation: result-pop 0.35s ease forwards;
}

.gift-box.winner {
    background: #ffe1ec;
    animation: winner-pop 0.7s ease forwards;
}

/* ============================================================
   Gift Modal
   ============================================================ */
.gift-modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(40, 20, 32, 0.35);
    backdrop-filter: blur(6px);
    z-index: 1000;
}

    .gift-modal.visible {
        display: grid;
    }

.gift-modal-card {
    position: relative;
    width: min(420px, 100%);
    padding: 34px 28px 30px;
    border-radius: 30px;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 28px 70px rgba(40, 20, 32, 0.28);
    animation: modal-pop 0.25s ease forwards;
}

    .gift-modal-card.winner-card {
        background: linear-gradient(145deg, #fff0f6, #ffe1ec);
        box-shadow: 0 30px 80px rgba(255, 63, 133, 0.35);
    }

.gift-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #f8dce8;
    color: #a83868;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-modal-icon {
    margin-bottom: 12px;
    font-size: 3.4rem;
}

.winner-card .gift-modal-icon {
    animation: heartPulse 1.2s ease-in-out infinite;
}

.gift-modal-title {
    margin: 0 0 10px;
    font-size: 1.7rem;
}

.gift-modal-message {
    margin: 0;
    color: #555;
    font-size: 1rem;
}

.gift-reset-button {
    display: none;
    align-items: center;
    justify-content: center;
    margin: 22px auto 0;
    padding: 12px 22px;
    border: 0;
    border-radius: 999px;
    background: #ff4f91;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(255, 79, 145, 0.28);
}

/* ============================================================
   Key Frames
   ============================================================ */
@keyframes modal-pop {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes result-pop {
    from {
        opacity: 0;
        transform: scale(0.4);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes winner-pop {
    0% {
        transform: scale(0.85) rotate(-4deg);
    }

    60% {
        transform: scale(1.15) rotate(4deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

@keyframes giftFloat {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

@keyframes giftHover {
    from {
        transform: translateY(-5px) rotate(-1deg) scale(1.03);
    }

    to {
        transform: translateY(-8px) rotate(1deg) scale(1.05);
    }
}

@keyframes heartPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}
