* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #121212;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center; /* Alinear verticalmente */
    padding: 10px;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

#gameCanvas {
    background-color: #000;
    border: 2px solid #444;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    max-width: 100%;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10;
    text-align: center;
    padding: 20px;
}

.game-overlay h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #ff00ff;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.7);
}

.game-overlay p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    max-width: 80%;
}

button {
    background-color: #ff00ff;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #cc00cc;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.7);
}

.hidden {
    display: none !important;
}

.word-challenge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #ff00ff;
    z-index: 5;
    text-align: center;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.word-challenge h2 {
    margin-bottom: 20px;
    color: #00ffff;
    font-size: 1.8rem;
}

.formed-word-container {
    margin: 20px 0;
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.formed-word {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    transform-style: preserve-3d;
}

.word-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.word-option {
    background-color: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2em;
    min-width: 120px;
    text-align: center;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.word-option:hover {
    background-color: #555;
    transform: perspective(500px) rotateX(0deg) scale(1.05) !important;
}

/* Animación de éxito */
.success-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.5s ease;
}

.success-message {
    background: linear-gradient(135deg, #00cc66, #009933);
    padding: 20px 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 204, 102, 0.6);
    transform: perspective(1000px) rotateX(10deg);
    animation: popIn 0.5s ease-out;
}

.success-message h2 {
    color: white;
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.success-message p {
    color: white;
    margin-bottom: 15px;
}

.points-animation {
    font-size: 2.5em;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.7);
    animation: scaleUp 1s ease infinite alternate;
}

/* Animación de error */
.error-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

.error-cross {
    font-size: 10rem;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    animation: popIn 0.3s ease-out, fadeOut 0.3s ease-in 1.2s forwards;
    transform-origin: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes popIn {
    0% { transform: perspective(1000px) rotateX(30deg) scale(0.5); opacity: 0; }
    100% { transform: perspective(1000px) rotateX(10deg) scale(1); opacity: 1; }
}

@keyframes scaleUp {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

/* Estilos para la barra de progreso */
.level-progress-container {
    text-align: center;
}

.level-progress-bar-text {
    margin-bottom: 5px;
    font-size: 1rem;
    color: #00ffff;
}

#level-progress-bar-background {
    width: 200px;
    height: 15px;
    background-color: #333;
    border-radius: 10px;
    border: 1px solid #555;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

#level-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #00aaff);
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
}

/* Estilos para la puntuación */
.score-container {
    font-size: 1.8rem; /* Aumentado */
    font-weight: bold;
}

#score {
    color: #ffff00; /* Amarillo brillante */
    text-shadow: 0 0 8px rgba(255, 255, 0, 0.8); /* Resplandor */
    animation: pulse-score 1.5s infinite alternate;
    display: inline-block;
    transform-origin: center;
}

@keyframes pulse-score {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
        text-shadow: 0 0 15px rgba(255, 255, 0, 1);
    }
}

/* Estilos para dispositivos móviles */
@media (max-width: 768px) {
    .game-header {
        font-size: 1rem;
        flex-direction: column; /* Apilar elementos en móvil */
        gap: 10px;
    }

    #level-progress-bar-background {
        width: 150px; /* Más corto para móviles */
    }

    .score-container {
        font-size: 1.5rem; /* Ligeramente más pequeño */
        order: -1; /* Poner la puntuación arriba */
    }
    
    .game-overlay h1 {
        font-size: 2rem;
    }
    
    .game-overlay p {
        font-size: 1rem;
        max-width: 90%;
    }
    
    button {
        padding: 12px 22px; /* Ligeramente más grande */
        font-size: 1.1rem;
    }
    
    .word-challenge {
        width: 95%; /* Más responsivo */
        padding: 15px;
    }

    .word-challenge h2 {
        font-size: 1.5rem;
    }
    
    .word-options {
        gap: 10px;
    }

    .word-option {
        padding: 12px 18px;
        font-size: 1rem;
        min-width: 100px;
    }
    
    .success-message {
        padding: 20px;
        max-width: 90%;
    }
    
    .success-message h2 {
        font-size: 1.8em;
    }
    
    .points-animation {
        font-size: 2.2em;
    }
}