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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f8f9fa;
    height: 100vh;
    overflow: hidden;
    background-image: repeating-linear-gradient(
        45deg,
        #ff9999,
        #ff9999 15px,
        #ffcc99 15px,
        #ffcc99 30px
    );
    animation: bg-shift 20s linear infinite;
}

.container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    z-index: 5;
}

.gift-box {
    cursor: pointer;
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
    position: relative;
    z-index: 20;
}

/* Add a pulsating glow effect to make it more clickable */
.gift-box::after {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    z-index: -1;
    opacity: 0.7;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

.gift {
    position: relative;
    width: 180px;
    height: 180px;
    transform-style: preserve-3d;
    transition: transform 0.8s ease;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.gift-top {
    position: absolute;
    width: 180px;
    height: 40px;
    top: -40px;
    background-color: #ff6b6b;
    transform-origin: bottom;
    transform: rotateX(0deg);
    transition: transform 0.5s ease;
    z-index: 2;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
    background-image: linear-gradient(to right, #ff6b6b, #ff8585, #ff6b6b);
}

.gift-body {
    position: absolute;
    width: 180px;
    height: 180px;
    background-color: #ff8585;
    z-index: 1;
    background-image: linear-gradient(135deg, #ff8585 0%, #ff9999 100%);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.4);
}

.ribbon {
    position: absolute;
    width: 30px;
    height: 180px;
    background-color: #5c2a9d;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background-image: linear-gradient(to bottom, #7d3dce, #5c2a9d);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.ribbon-vertical {
    position: absolute;
    width: 180px;
    height: 30px;
    background-color: #5c2a9d;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background-image: linear-gradient(to right, #7d3dce, #5c2a9d, #7d3dce);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Add a bow on top of the gift */
.gift::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 30px;
    background-color: #7d3dce;
    border-radius: 50% 50% 0 0;
    z-index: 4;
    box-shadow: 0 -5px 10px rgba(0,0,0,0.1);
}

/* Add click instruction text */
.gift::after {
    content: 'Click to open!';
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background-color: #5c2a9d;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    animation: bounce-text 1.5s infinite;
    white-space: nowrap;
}

@keyframes bounce-text {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.gift.open .gift-top {
    transform: rotateX(-110deg);
}

.dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s linear 0.5s;
    z-index: 50;
}

.dialog.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0s linear;
}

.dialog-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    position: relative;
    width: 90%;
    max-width: 500px;
    transform: scale(0.7);
    transition: transform 0.5s ease;
}

.dialog.open .dialog-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #5c2a9d;
}

.image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

#giftImage {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) scale(1);
    }
    40% {
        transform: translateY(-25px) scale(1.05);
    }
    60% {
        transform: translateY(-15px) scale(1.02);
    }
}

.gift-box:hover {
    animation: bounce 1.5s ease infinite;
}

@keyframes bg-shift {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 100px 100px;
    }
}

.title {
    font-family: "Comic Sans", "Comic Sans MS", "Chalkboard", "ChalkboardSE-Regular", sans-serif;
    font-size: 2.5rem;
    color: #5c2a9d;
    text-align: center;
    text-shadow: 3px 3px 0 #ff8585;
    position: absolute;
    top: 20px;
    width: 100%;
    animation: wobble 2s ease-in-out infinite;
    z-index: 30;
}

@keyframes wobble {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px) rotate(-2deg);
    }
    75% {
        transform: translateX(5px) rotate(2deg);
    }
}

/* Add styling for the friends image */
.friends-image {
    width: 250px;
    height: auto;
    border-radius: 15px; /* Rounded corners */
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin: 20px auto;
    display: block;
    position: relative;
    z-index: 5;
    border: 4px solid white;
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.friends-image:hover {
    transform: rotate(3deg) scale(1.05);
}

/* Image collage styling */
.image-collage {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none; /* Let clicks pass through to elements beneath */
}

.collage-image {
    position: absolute;
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border: 3px solid white;
    z-index: 1;
    transform: rotate(0deg);
    transition: transform 2s ease;
}

/* Add hover effect for images */
.container:hover ~ .image-collage .collage-image {
    animation: subtle-move 3s infinite alternate ease-in-out;
}

@keyframes subtle-move {
    0% {
        transform: translateY(0) rotate(var(--rotation, 0deg));
    }
    100% {
        transform: translateY(-10px) rotate(var(--rotation, 0deg));
    }
}

/* Individual positioning and styling for each image */
.img1 {
    top: 15%;
    left: 10%;
    transform: rotate(-5deg);
    --rotation: -5deg;
    z-index: 2;
    width: 150px;
    height: 150px;
}

.img2 {
    top: 20%;
    right: 10%;
    transform: rotate(7deg);
    --rotation: 7deg;
}

.img3 {
    bottom: 25%;
    left: 15%;
    transform: rotate(-10deg);
    --rotation: -10deg;
    width: 100px;
    height: 100px;
}

.img4 {
    bottom: 30%;
    right: 15%;
    transform: rotate(3deg);
    --rotation: 3deg;
    width: 130px;
    height: 130px;
}

.img5 {
    top: 50%;
    left: 20%;
    transform: rotate(-3deg);
    --rotation: -3deg;
    width: 110px;
    height: 110px;
}

.img6 {
    top: 40%;
    right: 20%;
    transform: rotate(5deg);
    --rotation: 5deg;
    width: 125px;
    height: 125px;
}

.img7 {
    top: 70%;
    left: 50%;
    transform: translateX(-50%) rotate(-7deg);
    --rotation: -7deg;
    width: 140px;
    height: 140px;
}

.img8 {
    top: 10%;
    left: 40%;
    transform: rotate(8deg);
    --rotation: 8deg;
    width: 100px;
    height: 100px;
}

.img9 {
    bottom: 15%;
    left: 35%;
    transform: rotate(-6deg);
    --rotation: -6deg;
    width: 110px;
    height: 110px;
}

.img10 {
    top: 35%;
    left: 70%;
    transform: rotate(4deg);
    --rotation: 4deg;
    width: 120px;
    height: 120px;
}

.img11 {
    bottom: 40%;
    left: 5%;
    transform: rotate(-9deg);
    --rotation: -9deg;
    width: 105px;
    height: 105px;
}

.img12 {
    top: 60%;
    right: 5%;
    transform: rotate(2deg);
    --rotation: 2deg;
    width: 115px;
    height: 115px;
}

.img13 {
    top: 25%;
    left: 30%;
    transform: rotate(-4deg);
    --rotation: -4deg;
    width: 110px;
    height: 110px;
}

.img14 {
    bottom: 20%;
    right: 30%;
    transform: rotate(9deg);
    --rotation: 9deg;
    width: 100px;
    height: 100px;
}

.img15 {
    top: 45%;
    left: 60%;
    transform: rotate(-8deg);
    --rotation: -8deg;
    width: 130px;
    height: 130px;
}

.img16 {
    top: 5%;
    right: 50%;
    transform: rotate(6deg);
    --rotation: 6deg;
    width: 115px;
    height: 115px;
}

.img17 {
    bottom: 10%;
    right: 55%;
    transform: rotate(-2deg);
    --rotation: -2deg;
    width: 125px;
    height: 125px;
}

.img18 {
    top: 65%;
    right: 25%;
    transform: rotate(-11deg);
    --rotation: -11deg;
    width: 120px;
    height: 120px;
}

/* Add media queries for better mobile responsiveness */
@media (max-width: 480px) {
    .collage-image {
        width: 80px;
        height: 80px;
    }

    .img1 {
        width: 110px;
        height: 110px;
        top: 12%;
        left: 5%;
    }

    .img5, .img7, .img15 {
        width: 100px;
        height: 100px;
    }

    .title {
        font-size: 2rem;
    }

    /* Adjust positions for mobile */
    .img2 { right: 5%; }
    .img3 { bottom: 20%; left: 10%; }
    .img4 { bottom: 25%; right: 10%; }
    .img6 { right: 15%; }
    .img8 { left: 35%; }
    .img9 { bottom: 10%; left: 25%; }
    .img10 { left: 60%; }
    .img11 { bottom: 35%; left: 3%; }
    .img12 { right: 3%; }
    .img13 { left: 25%; }
    .img14 { right: 20%; }
    .img16 { right: 40%; }
    .img17 { right: 45%; }
    .img18 { right: 30%; top: 55%; }
}

/* Additional breakpoint for very small devices */
@media (max-width: 360px) {
    .collage-image {
        width: 50px;
        height: 50px;
    }

    .img1 {
        width: 70px;
        height: 70px;
    }

    .img7 {
        width: 65px;
        height: 65px;
    }

    .gift {
        width: 130px;
        height: 130px;
    }

    .gift-top {
        width: 130px;
        height: 30px;
        top: -30px;
    }

    .ribbon {
        width: 22px;
        height: 130px;
    }

    .ribbon-vertical {
        width: 130px;
        height: 22px;
    }
}

/* Add attention animation for gift box */
@keyframes attention {
    0% { transform: scale(1) rotate(0deg); }
    10% { transform: scale(1.1) rotate(-3deg); }
    20% { transform: scale(1.1) rotate(3deg); }
    30% { transform: scale(1.1) rotate(-3deg); }
    40% { transform: scale(1.1) rotate(3deg); }
    50% { transform: scale(1.1) rotate(0deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.gift-box.attention {
    animation: attention 1.5s ease;
    z-index: 15;
}
