:root {
    --board-bg: #bdc3c7;
}

/* Контейнер доски */
#board-container {
    position: relative;
    width: 100%;
    max-width: 85vh; 
    aspect-ratio: 1 / 1;
}

/* На мобильном растягиваем на всю ширину */
@media (max-width: 900px) {
    #board-container { max-width: 100%; }
}

#board {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 4px;
    background-color: var(--board-bg);
    padding: 4px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cell {
    background-color: var(--cell-bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.cell:hover:not(.taken) { background-color: var(--cell-hover); }

.cell svg {
    width: 66.6%;
    height: 66.6%;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: block;
}

@keyframes popIn { 
    from { transform: scale(0); opacity: 0; } 
    to { transform: scale(1); opacity: 1; } 
}

.cell.x { color: var(--primary-color); }
.cell.o { color: var(--accent-color); }
.cell.taken { cursor: default; }

/* Приглушение невыигрышных клеток */
.board-finished .cell:not(.winner-cell) { opacity: 0.5; }

/* Линия победы */
.winning-line {
    position: absolute;
    background-color: #2c3e50;
    height: 6px;
    border-radius: 3px;
    transform-origin: left center;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    width: 0;
    transition: width 0.4s ease-out;
}