
/* Blurred background effect */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Dark transparent background */
    backdrop-filter: blur(5px); /* Blurs everything behind */
    z-index: 999; /* Behind the popup but above everything else */
    display: none;
}

/* Popup styling */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 30px;
    width: 300px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

/* Popup content */
.popup-content {
    text-align: center;
    font-family: 'Arial', sans-serif;
}

.popup-content label {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    display: block;
    margin-bottom: 10px;
}

.popup-content input {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.popup-content input:focus {
    border-color: #007BFF;
}

.popup-content button {
    margin-top: 15px;
    padding: 10px 15px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background: #007BFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.popup-content button:hover {
    background: #0056b3;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -55%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}



input {
    margin: 10px 0;
    padding: 5px;
}

button {
    padding: 5px 10px;
    cursor: pointer;
}


 body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

.title {
    margin-top: 3%;
    font-size: calc(2rem + 1vw);
    font-weight: bold;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
}

.game-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 80%;
    max-width: 600px;
}

.card {
    width: 100%;
    padding-top: 70%; /* Maintain aspect ratio */
    position: relative;
    background-color: #ffffff;
    border: 3px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
    overflow: hidden;
}

/* AI-generated images (hidden by default) */
.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-image: var(--card-bg, none);
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.3s ease-in-out;
    opacity: 1; /* Image is visible when the card is unflipped */
}

/* Flipped cards hide the image */
.card.flipped::before {
    opacity: 0; /* Hide image when flipped */
}

/* Card inner (number background) */
.card-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: transparent;
    background-color: #ccc;
    border-radius: 10px;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
    background-size: contain; /* Ensure the image fits within the space */
    background-position: center;
}

/* When flipped, show the number but keep image hidden */
.card.flipped .card-inner {
    background-color: #ffffff;
    /* color: #333; */
    color: transparent;
    background-image: var(--card-bg, none);
}

/* Matched cards keep the image visible */
.card.matched::before {
    opacity: 1;
}

/* Matched effect */
.card.matched .card-inner {
    background-color: hsla(208, 100%, 50%, 0.7);
    color: #000;
}

.timer {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    margin-top: 7%;
    color: #555;
}

.flips {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: #5f4c4c;
}

/* Matched and finished animation effect */
.matched, .finished {
    animation: flash 0.5s ease-in-out;
}

/* Define the flash animation */
@keyframes flash {
    0% {
        transform: scale(1);
        background-color: #fff;
    }
    50% {
        transform: scale(1.1);
        background-color: hsla(216, 83%, 45%, 0.879); /* Flashing color */
    }
    100% {
        transform: scale(1);
        background-color: hsl(203, 54%, 58%);
    }
}
