/* Basic reset to remove default browser spacing */
body {
    margin: 0;
    padding: 0;
    background-color: #111; /* Dark background */
    overflow: hidden; /* Prevents scrollbars */
    font-family: 'Press Start 2P', cursive; /* 8-bit style font from Google Fonts */
}

/* The main container for our grid of squares */
#grid-container {
    display: grid;
    /* This creates a responsive grid of squares that are between 25px and 1fr wide */
    grid-template-columns: repeat(auto-fill, minmax(25px, 1fr));
    grid-template-rows: repeat(auto-fill, minmax(25px, 1fr));
    width: 100vw; /* Full viewport width */
    height: 100vh; /* Full viewport height */
}

/* Styling for each individual square in the grid */
.grid-square {
    width: 100%;
    height: 100%;
    /* The color will be set by JavaScript */
}

/* The box in the middle of the page */
.center-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* The classic centering trick */
    background-color: rgba(0, 0, 0, 0.75); /* Semi-transparent black */
    border: 4px solid #fff;
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: 0 0 15px #fff;
    z-index: 10; /* Ensures it's on top of the grid */
}

.center-box h1 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem; /* Adjust size as needed */
    letter-spacing: 2px;
}

/* --- The Heartbeat Animation --- */

/* 1. Define the animation keyframes */
@keyframes beat-animation {
    0% {
        transform: scale(1);
        z-index: 5; /* Bring to front during animation */
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: scale(1.8); /* Grow larger */
        box-shadow: 0 0 25px rgba(255, 255, 255, 1);
    }
    100% {
        transform: scale(1); /* Return to normal size */
        z-index: 1;
        box-shadow: none;
    }
}

/* 2. Create a class that applies this animation */
.grid-square.beat {
    animation-name: beat-animation;
    animation-duration: 0.5s; /* How long the beat takes */
    animation-timing-function: ease-in-out;
}