/* Gomoku Game Styles */
.gomoku-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.game-info {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.rule-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.player-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Restored High Visibility Active States - With Oval */
#playerBlack.active {
    background: #2d3436;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#playerWhite.active {
    background: #f1f2f6;
    color: #2d3436;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #dfe6e9;
}

#playerBlack.active .player-info,
#playerBlack.active .player-timer {
    color: #ffffff;
}

#playerWhite.active .player-info,
#playerWhite.active .player-timer {
    color: #2d3436;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    color: var(--text-color);
    /* Default color */
}

.player-timer {
    font-size: 0.85rem;
    opacity: 0.9;
    font-family: 'Courier New', monospace;
    margin-top: 2px;
    color: inherit;
    /* Inherit from parent */
}

.piece-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.piece-preview.black {
    background: radial-gradient(circle at 30% 30%, #666, #000);
}

.piece-preview.white {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
    border: 1px solid #ccc;
}

/* Missing Gomoku Board Styles - Restored */
.gomoku-board {
    position: relative;
    background-color: #DEB887;
    /* Burlywood */
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    user-select: none;
    touch-action: none;
    /* Prevent zooming on mobile tap */
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Dark theme adjustment for board */
[data-theme="dark"] .gomoku-board {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    /* Grid lines through center of cells */
    background-image:
        linear-gradient(to bottom, transparent calc(50% - 0.5px), #000 calc(50% - 0.5px), #000 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
        linear-gradient(to right, transparent calc(50% - 0.5px), #000 calc(50% - 0.5px), #000 calc(50% + 0.5px), transparent calc(50% + 0.5px));
    background-size: calc(100% / 15) calc(100% / 15);
    border: 1px solid #000;
    width: 100%;
    height: 100%;
}

/* Specific sizing for grid lines to align with cells */
.grid-cell {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Crosshair cursor for precision */
.grid-cell:hover {
    cursor: crosshair;
}

/* Ghost piece on hover */
.grid-cell:hover::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.grid-cell.has-piece {
    cursor: default;
}

.grid-cell.has-piece:hover::after {
    display: none;
}

.piece {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 85%;
    height: 85%;
    border-radius: 50%;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: placePiece 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.piece.black {
    background: radial-gradient(circle at 35% 35%, #666, #000);
}

.piece.white {
    background: radial-gradient(circle at 35% 35%, #fff, #e0e0e0);
}

.piece.last-move::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.6);
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.8);
}

@keyframes placePiece {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

.win-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.win-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.win-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.win-modal.show .win-content {
    transform: translateY(0);
}

.win-title {
    font-size: 2rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .gomoku-board {
        padding: 5px;
    }

    .game-info {
        flex-direction: row;
        /* Changed to row to allow wrapping but keep orientation mostly */
        flex-wrap: wrap;
        gap: 15px;
    }

    .player-indicator {
        flex: 1;
        /* Distribute space */
        min-width: 120px;
        /* Minimum width for readability */
        justify-content: center;
    }

    .control-group {
        order: 3;
        width: 100%;
        justify-content: center;
        display: flex;
        gap: 10px;
    }
}