* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    text-align: center;
}

/* Modal de jugadores */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 350px;
}

.modal-content h2 {
    margin-bottom: 10px;
    color: #333;
    font-size: 2em;
}

.modal-content .subtitle {
    margin-bottom: 30px;
    color: #667eea;
    font-size: 0.95em;
    font-weight: 500;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    background-color: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
}

.input-group select {
    cursor: pointer;
}

#startGame {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#startGame:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Juego */
.hidden {
    display: none !important;
}

#gameContainer {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

#currentPlayer {
    font-size: 1.5em;
    color: #555;
}

.button-group {
    display: flex;
    gap: 10px;
}

.play-again-btn {
    padding: 12px 24px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.play-again-btn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

#resetGame {
    padding: 12px 24px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

#resetGame:hover {
    background-color: #ff5252;
    transform: translateY(-2px);
}

/* Tablero */
#board {
    display: inline-grid;
    grid-template-columns: repeat(3, 120px);
    grid-template-rows: repeat(3, 120px);
    gap: 10px;
    background-color: #667eea;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.cell {
    background-color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 3em;
    font-weight: bold;
    color: #333;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cell:hover:not(.filled) {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

.cell.filled {
    cursor: default;
}

.cell.x {
    color: #667eea;
    animation: fadeIn 0.3s ease-in;
}

.cell.o {
    color: #764ba2;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Celda ganadora */
.cell.winning {
    background-color: #ffd700;
    animation: winningPulse 0.6s ease-in-out;
}

@keyframes winningPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 1);
    }
}

/* Mensaje de ganador */
.message {
    margin-top: 30px;
    padding: 20px;
    background-color: #4caf50;
    color: white;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
    animation: slideIn 0.5s;
}

.message.draw {
    background-color: #ff9800;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    #board {
        grid-template-columns: repeat(3, 90px);
        grid-template-rows: repeat(3, 90px);
        gap: 8px;
    }

    .cell {
        font-size: 2.5em;
    }

    .modal-content {
        min-width: 300px;
        padding: 30px;
    }

    #gameContainer {
        padding: 30px 20px;
    }

    h1 {
        font-size: 2em;
    }
}
