* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c2c2c, #4a4a4a);
    color: #fff;
    font-family: 'Arial', sans-serif;
    overflow: hidden;
}

h1 {
    margin-bottom: 20px;
    font-size: 3em;
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.7);
}

#game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    justify-content: center;
    max-width: 400px;
    width: 100%;
}

.box {
    height: 100px;
    background: linear-gradient(145deg, #555, #777);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    cursor: pointer;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
    transition: background 0.4s, transform 0.3s, box-shadow 0.3s;
    position: relative; /* For after pseudo-element */
    overflow: hidden; /* Hide the overflow for the box */
}

.box:hover {
    transform: scale(1.05);
    background: linear-gradient(145deg, #666, #888);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.8);
}

.box.clicked {
    background: linear-gradient(145deg, #444, #666);
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.popup {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.7);
    color: black;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    text-align: center;
    font-size: 1.5em;
    max-width: 90%;
    animation: fadeIn 0.5s ease;
    border: 2px solid #4caf50;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.popup h2 {
    margin: 0 0 10px 0;
    color: #4caf50;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
}

.popup button {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.popup button:hover {
    background-color: #388e3c;
    transform: scale(1.05);
}

.overlay {
    background: rgba(0, 0, 0, 0.7);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.score {
    font-size: 2.5em;
    margin-top: 20px;
    color: #FFD700;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    position: relative;
    text-align: center;
    width: 100%;
    padding: 10px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
    animation: glow 1.5s infinite alternate; /* Added glowing effect */
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    to {
        box-shadow: 0 0 20px rgba(255, 215, 0, 1);
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.5em;
    }

    #game-board {
        grid-template-columns: repeat(3, 1fr);
        max-width: 90%;
    }

    .box {
        height: 80px;
        font-size: 30px;
    }

    .popup {
        font-size: 1em;
    }

    .score {
        font-size: 1.8em;
    }
}