:root {
    --bg-color: #f5f7fa;
    --text-color: #2c3e50;
    --primary-color: #3498db;
    --accent-color: #e74c3c;
    --cell-bg: #ffffff;
    --cell-hover: #ecf0f1;
    --cell-selected: #ffeaa7;
    --font-main: 'Roboto', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

header {
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.highlight {
    color: var(--accent-color);
    font-weight: 900;
}

p {
    opacity: 0.7;
}

/* Accessibility Helpers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Bingo Grid */
.bingo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 2rem;
    background: #bdc3c7;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cell {
    background: var(--cell-bg);
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    user-select: none;
    word-break: break-word;
    hyphens: auto;
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background: var(--cell-hover);
    transform: scale(1.02);
}

.cell:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
    z-index: 10;
}

.cell.selected {
    background: var(--cell-selected);
    color: #d35400;
    transform: scale(0.95);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.cell.selected::after {
    content: 'X';
    position: absolute;
    font-size: 4rem;
    color: rgba(231, 76, 60, 0.2);
    pointer-events: none;
}

.cell.free-space {
    background: var(--primary-color);
    color: white;
    font-weight: 900;
}

/* Controls */
button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 0 #2980b9;
    transition: transform 0.1s, box-shadow 0.1s;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #2980b9;
}

button:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Win Overlay */
#win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.3s;
}

.hidden {
    display: none !important;
}

.win-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.win-content h2 {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        transform: scale(0.8);
    }

    to {
        transform: scale(1);
    }
}

/* Mobile */
@media (max-width: 500px) {
    .bingo-grid {
        gap: 5px;
        padding: 5px;
    }

    .cell {
        font-size: 0.6rem;
        padding: 2px;
    }

    h1 {
        font-size: 1.8rem;
    }
}

/* Configuration Section */
.config-section {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.config-group h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chip-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.chip {
    background: white;
    color: var(--text-color);
    border: 2px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chip.selected {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3);
}

.chip:active {
    transform: translateY(0);
}

.instructions {
    margin-bottom: 1rem;
    opacity: 0.8;
    letter-spacing: 1px;
}