:root {
    --cell-size: clamp(120px, 20vmin, 175px);
    --gap: 1rem;
    --primary: #589de3;
    --bg-light: #f6f6f6;
    --bg-lighter: #fbfbfb;
    --muted: #f0f0f0;
    --muted-hover: #e8e8e8;
    --border-white: #ffffff;
    --font-size-base: clamp(12px, 1.2vw, 14px);
    --container-width: min(700px, 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--gap);
    padding: calc(var(--gap) * 2);
}

#bingo-container > table {
    border-collapse: collapse;
    margin: 0 auto;
}

#bingo-container td {
    width: var(--cell-size);
    height: var(--cell-size);
    padding: var(--gap);
    border: 8px solid var(--border-white);
    text-align: center;
    vertical-align: middle;
    font-size: var(--font-size-base);
    position: relative;
    transition: background-color 0.1s, color 0.1s;
    user-select: none;
}

#bingo-container td.header-cell {
    font-weight: bold;
    background: var(--bg-lighter);
    color: var(--primary);
}

#bingo-container td.bingo-cell {
    background: var(--bg-light);
    cursor: pointer;
}

#bingo-container td.bingo-cell:hover {
    background: var(--muted-hover);
}

#bingo-container td.bingo-cell.bingo-cell-selected {
    background: var(--primary);
    color: white;
}

#bingo-container .cell-possible-countries-badge,
.cell-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--primary);
    color: white;
    padding: 0.25em 1em;
    border-radius: 12px;
    font-size: 12px;
    user-select: none;
}

/* Controls */
:is(input, button) {
    font-size: 14px;
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

.bingo-footer {
    display: flex;
    gap: var(--gap);
    justify-content: center;
    margin-top: var(--gap);
    width: var(--container-width);
    flex-wrap: wrap;
}

#bingo-submit-btn {
    width: var(--cell-size);
    cursor: pointer;
}

#bingo-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#bingo-suggestions {
    margin-top: 1em;
    width: var(--container-width);
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

#bingo-suggestions li {
    background: var(--muted);
    padding: 0.5em;
    border-radius: 4px;
}

#bingo-suggestions li:hover {
    background: #e0e0e0;
    cursor: pointer;
}

@media (max-width: 420px) {
    :root {
        --cell-size: 100px;
    }

    #bingo-container td {
        padding: 0.5rem;
        font-size: 12px;
    }

    .bingo-footer {
        gap: 0.5rem;
    }
}
