/* Estilos básicos del body */
* {
    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;
}

/* Contenedor principal */
.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 800px;
    width: 100%;
}

/* Título */
h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.5em;
}

/* Selector de dificultad */
.difficulty-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.difficulty-selector label {
    font-weight: bold;
    color: #667eea;
}

.difficulty-selector select {
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    color: #667eea;
    font-weight: bold;
    transition: all 0.3s ease;
}

.difficulty-selector select:hover {
    background: #667eea;
    color: white;
}

/* Panel de información */
.info-panel {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.info-item {
    text-align: center;
}

.info-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

/* Área del juego */
.game-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Canvas del ahorcado */
.canvas-box {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

canvas {
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
}

/* Palabra a adivinar */
.word-area {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 2.5em;
    font-weight: bold;
    color: #333;
    min-height: 80px;
}

.letter-box {
    width: 50px;
    height: 60px;
    border-bottom: 4px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Animación para letras reveladas */
.letter-revealed {
    animation: letterReveal 0.5s ease;
}

@keyframes letterReveal {
    0% {
        transform: scale(0) rotateY(180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotateY(90deg);
    }
    100% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
}

/* Teclado virtual */
.keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 8px;
    margin-top: 30px;
}

.key-button {
    padding: 15px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.key-button:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.key-button.usado {
    background: #e0e0e0;
    color: #999;
    border-color: #ccc;
    cursor: not-allowed;
}

.key-button.correcto {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.key-button.incorrecto {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

/* Animación para teclas presionadas */
.key-press-animation {
    animation: keyPress 0.3s ease;
}

@keyframes keyPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Letras usadas */
.used-letters-box {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
}

.used-letters-title {
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
}

.used-letters-text {
    color: #999;
    font-size: 1.1em;
}

/* Botones de control */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Modal (ventana emergente) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.activo {
    display: flex;
}

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

.modal-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

.modal-content.ganar h2 {
    color: #4caf50;
}

.modal-content.perder h2 {
    color: #f44336;
}

.modal-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    color: #666;
}

/* Animación del modal */
.modal-animation {
    animation: modalAppear 0.5s ease;
}

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

/* Estilos del historial */
.historial-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.stat-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.stat-value.success {
    color: #4caf50;
}

.stat-value.error {
    color: #f44336;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .game-area {
        grid-template-columns: 1fr;
    }

    .keyboard {
        grid-template-columns: repeat(7, 1fr);
    }

    .historial-stats {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2em;
    }

    .word-area {
        font-size: 2em;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}