:root {
    --board-size: min(90vw, 450px); /* Responsive board size */
    --cell-size: calc(var(--board-size) / 3);
    --primary-color: #f0f0f0;
    --secondary-color: #333;
    --accent-color: #007bff;
    --win-color: #28a745;
    --x-color: #dc3545;
    --o-color: #007bff;
    --gap-size: 8px; /* Duidelijkere lijndikte */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
}

.game-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative; /* Nodig voor de overlay-context */
}

.game-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.score-board {
    font-size: clamp(1rem, 4vw, 1.2rem);
    font-weight: bold;
    margin-bottom: 1rem;
}

.game-status {
    font-size: clamp(1rem, 4vw, 1.2rem);
    margin-bottom: 1rem;
    min-height: 1.5em;
    transition: transform 0.2s ease;
}

/* Animatie voor status-update */
.status-update {
    animation: status-flash 0.5s ease;
}

@keyframes status-flash {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, var(--cell-size));
    grid-template-rows: repeat(3, var(--cell-size));
    gap: var(--gap-size);
    background-color: var(--secondary-color);
    /* De border is nu de buitenste rand van de 'gap' */
    padding: var(--gap-size);
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.cell {
    background-color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(2rem, 20vw, 5rem);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    border-radius: 4px; /* Afgeronde hoeken voor cellen */
}

.cell:hover:not(.x):not(.o) {
    background-color: #e0e0e0;
}

.cell.x { color: var(--x-color); }
.cell.o { color: var(--o-color); }

.cell.x, .cell.o {
    animation: place-marker 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes place-marker {
    from { transform: scale(0.5); opacity: 0.5; }
    to { transform: scale(1); opacity: 1; }
}

.reset-button {
    margin-top: 1.5rem;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background-color: var(--accent-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reset-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}


/* --- Winnaar Overlay --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content {
    background-color: white;
    padding: 2rem 3rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.overlay.visible .overlay-content {
    transform: scale(1);
}

#winner-text {
    font-size: 2rem;
    color: var(--win-color);
    margin-bottom: 1.5rem;
}
