*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    border: 10px solid #f0f0;
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: clamp(0.85rem, 1.4vw, 1.15rem);
}
.header {
    font-size: clamp(1.4rem, 4vw, 2.4rem);
}
.checked {
    background-color: #2d2;
    color: #000;
}
.flex {
    display: flex;
}
.container {
    flex-wrap: wrap;
    padding: 0 clamp(0.25rem, 1.5vw, 1rem);
}
.center {
    justify-content: center;
    align-items: center;
}
.space {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(0.25rem, 1vw, 0.75rem);
}
.full-width {
    width: 100%;
}
button {
    padding: clamp(0.25rem, 0.8vw, 0.5rem) clamp(0.5rem, 1.5vw, 1rem);
    font: inherit;
    font-size: clamp(0.7rem, 1.2vw, 1rem);
    cursor: pointer;
}

/* Bingo board: a 5x5 grid whose tiles scale fluidly with the viewport. */
.cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(0.2rem, 0.8vw, 0.75rem);
    width: 100%;
}
.card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: clamp(3.75rem, 9vw, 6.5rem);
    padding: clamp(0.15rem, 0.6vw, 0.5rem);
    border: 1px solid #aaa;
    text-align: center;
    font-size: clamp(0.55rem, 1.05vw + 0.3rem, 0.95rem);
    line-height: 1.15;
    overflow-wrap: anywhere;
    hyphens: auto;
}
.empty {
    height: clamp(0.5rem, 1.5vw, 1rem);
}

/* Completed rows/columns flash through rainbow colors. */
@keyframes rainbow {
    0% {
        background-color: #f00;
    }
    17% {
        background-color: #ffa500;
    }
    33% {
        background-color: #ff0;
    }
    50% {
        background-color: #0f0;
    }
    67% {
        background-color: #0ff;
    }
    83% {
        background-color: #00f;
    }
    100% {
        background-color: #f0f;
    }
}
.card.win {
    animation: rainbow 1.5s linear infinite;
    color: #000;
    border-color: #fff;
}

/* Very small screens: trim the outer frame so the board gets more room. */
@media (max-width: 480px) {
    body {
        border-width: 6px;
    }
}
