* {
    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;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 900px;
    width: 100%;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.45em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.08);
}

.game-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 0.95em;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-label {
    font-weight: bold;
    color: #495057;
    font-size: 0.9em;
}

.game-status {
    padding: 3px 10px;
    border-radius: 14px;
    font-weight: bold;
    font-size: 0.8em;
}

.game-status.waiting {
    background: #ffc107;
    color: #856404;
}

.game-status.playing {
    background: #28a745;
    color: white;
}

.game-status.finished {
    background: #dc3545;
    color: white;
}

.player-info {
    padding: 3px 10px;
    border-radius: 14px;
    font-weight: bold;
    font-size: 0.8em;
}

.player-info.red {
    background: #dc3545;
    color: white;
}

.player-info.black {
    background: #212529;
    color: white;
}

.player-info.spectator {
    background: #6c757d;
    color: white;
}

.players-section {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 10px;
}

.players-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.players-info {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 0;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 0.86em;
    white-space: nowrap;
}

.player-color {
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.72em;
}

.player-color.red {
    background: #dc3545;
    color: white;
}

.player-color.black {
    background: #212529;
    color: white;
}

.spectators-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.82em;
    color: #6c757d;
    white-space: nowrap;
}

.spectator-count {
    font-weight: bold;
    color: #495057;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 0.95em;
}

.current-player {
    font-weight: bold;
    color: #495057;
}

.current-player span {
    color: #dc3545;
    transition: color 0.3s ease;
}

.current-player span.black-turn {
    color: #212529;
}

.score {
    font-weight: bold;
    color: #495057;
}

#gameCanvas {
    border: 3px solid #333;
    border-radius: 10px;
    cursor: pointer;
    margin: 12px 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    max-width: 100%;
    height: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#gameCanvas:hover {
    transform: scale(1.02);
}

.controls {
    margin-top: 20px;
}

#newGame {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#newGame:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

#newGame:active {
    transform: translateY(0);
}

/* Modal de registro */
.registration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
}

.registration-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.registration-form input[type="text"] {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.registration-form input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.color-selection {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.color-selection label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 5px;
}

.color-selection input[type="radio"] {
    margin: 0;
}

.color-option {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.color-option.red {
    background: #dc3545;
    color: white;
}

.color-option.black {
    background: #212529;
    color: white;
}

.color-option.auto {
    background: #6c757d;
    color: white;
}

.color-selection input[type="radio"]:checked + .color-option {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

.registration-buttons button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

#registerPlayer {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

#joinAsSpectator {
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
}

.registration-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Notificaciones */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #856404;
}

.notification.info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 14px;
    }
    
    h1 {
        font-size: 1.25em;
    }
    
    .game-status-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .players-info {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .players-line {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .game-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .registration-buttons {
        flex-direction: column;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
}
