/* Tic-Tac-Toe Game Styles */
.game-container {
    padding: 40px 20px;
    max-width: 1400px;
}

.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.game-header h1 {
    color: #4361ee;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.game-header .subtitle {
    color: #666;
    font-size: 1.1rem;
}

.game-content {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

.game-sidebar {
    flex: 1;
    min-width: 300px;
}

.game-main {
    flex: 2;
    min-width: 300px;
}

/* Game Stats */
.game-stats {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
}

.stat:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.stat-label {
    font-weight: 600;
    color: #555;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

#current-player {
    color: #4361ee;
}

#x-wins {
    color: #e63946;
}

#o-wins {
    color: #4cc9f0;
}

#draws {
    color: #8a8a8a;
}

/* Game Settings */
.game-settings {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.game-settings h3, .game-settings h4 {
    margin-bottom: 15px;
    color: #333;
}

.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid #ddd;
    background-color: white;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    border-color: #4361ee;
    background-color: #4361ee;
    color: white;
}

.mode-btn:hover:not(.active) {
    border-color: #4361ee;
    color: #4361ee;
}

.difficulty-selector {
    margin-top: 20px;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
}

.difficulty-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    background-color: white;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-btn.active {
    border-color: #4361ee;
    background-color: #4361ee;
    color: white;
}

.difficulty-btn:hover:not(.active) {
    border-color: #4361ee;
    color: #4361ee;
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.game-controls .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    font-size: 1.1rem;
}

/* Game Instructions */
.game-instructions {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.game-instructions h3 {
    margin-bottom: 15px;
    color: #333;
}

.game-instructions ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.game-instructions li {
    margin-bottom: 8px;
    color: #555;
}

/* Game Board */
.game-board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    width: 400px;
    height: 400px;
    background-color: #333;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.cell {
    background-color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.cell:hover:not(.occupied) {
    background-color: #f0f0f0;
    transform: scale(1.02);
}

.cell.x {
    color: #e63946;
}

.cell.o {
    color: #4cc9f0;
}

.cell.winning {
    background-color: #ffeb3b;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Turn Indicator */
.turn-indicator {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 25px;
    width: 400px;
}

.turn-x, .turn-o {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.2rem;
    background-color: #f8f9fa;
    transition: all 0.3s;
}

.turn-x.active {
    background-color: #e63946;
    color: white;
}

.turn-o.active {
    background-color: #4cc9f0;
    color: white;
}

.turn-x i {
    color: #e63946;
    font-size: 1.5rem;
}

.turn-o i {
    color: #4cc9f0;
    font-size: 1.5rem;
}

.turn-x.active i, .turn-o.active i {
    color: white;
}

/* Game Result */
.game-result {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    color: white;
    text-align: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 10;
}

.game-result.active {
    opacity: 1;
    pointer-events: all;
}

.game-result h2 {
    color: white;
    font-size: 3rem;
    margin-bottom: 20px;
}

#result-text {
    font-size: 2.5rem;
}

/* Game History */
.game-history {
    width: 100%;
    max-width: 400px;
}

.history-list {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eaeaea;
    font-weight: 500;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item.win-x {
    background-color: rgba(230, 57, 70, 0.1);
    color: #e63946;
}

.history-item.win-o {
    background-color: rgba(76, 201, 240, 0.1);
    color: #4cc9f0;
}

.history-item.draw {
    background-color: rgba(138, 138, 138, 0.1);
    color: #8a8a8a;
}

.history-move {
    font-weight: 700;
}

.history-result {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 1100px) {
    .game-content {
        flex-direction: column;
    }
    
    .game-sidebar, .game-main {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .game-board {
        width: 350px;
        height: 350px;
    }
    
    .turn-indicator {
        width: 350px;
    }
    
    .game-history {
        max-width: 350px;
    }
    
    .mode-selector {
        flex-direction: row;
    }
    
    .mode-btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .game-board {
        width: 300px;
        height: 300px;
    }
    
    .turn-indicator {
        width: 300px;
        flex-direction: column;
        gap: 10px;
    }
    
    .game-history {
        max-width: 300px;
    }
    
    .cell {
        font-size: 3rem;
    }
    
    .game-stats, .game-settings, .game-instructions {
        padding: 20px;
    }
    
    #result-text {
        font-size: 2rem;
    }
}