@import url('https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Mono&display=swap');
:root{
    --bgColor: #333;
    --textPrimary: #fff;
    --textSecondary: #666;
    --primaryColor: #fd4;
}
body{
    font-family: 'Roboto', sans-serif;
    background-color:var(--bgColor);
    color: var(--textPrimary);
    font-size: 1.4rem;
}
main{
    width: 600px;
    margin: 30px auto 70px; /* Mantiene 30px arriba pero agrega 70px abajo */
}
h1{
    color: var(--primaryColor);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
h1 svg{
    width: 40px;
    fill: var(--primaryColor);
}

/* Ajustar el contenedor de controles */
#controls{
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Línea divisoria sutil */
}

#buttons{
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
#info{
    color: var(--primaryColor);
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.2rem;
}
button{
    background: rgba(255,255,255,.1);
    border: none;
    color: var(--textPrimary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: 'Roboto', sans-serif;
}
button:hover {
    background: rgba(255,255,255,.2);
    transform: translateY(-1px);
}
button:active {
    transform: translateY(0px);
}
#newGameBtn {
    background: var(--primaryColor);
    color: var(--bgColor);
    font-weight: 500;
    margin-right: 8px;
}
#newGameBtn:hover {
    background: #fee15d;
    box-shadow: 0 2px 8px rgba(253, 221, 68, 0.3);
}
#languageBtn {
    background: rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    padding: 6px 10px;
    margin-right: 8px;
}

/* Estilos para el menú de modos de juego */
#gameModes {
    margin-top: 15px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.time-section {
    display: flex;
    gap: 5px;
    justify-content: center;
}
.mode-button {
    background: rgba(255,255,255,.08);
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.mode-button.active {
    background: var(--primaryColor);
    color: var(--bgColor);
    font-weight: 500;
}
.mode-button:hover {
    background: rgba(255,255,255,.15);
}
.mode-button.active:hover {
    background: #fee15d;
}

/* Ajustar el contenedor del juego */
#game-container {
    margin-top: 60px; /* Espacio significativo después del menú */
    padding-top: 20px; /* Espacio interno adicional */
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 20px;
}

/* Título opcional para la sección del juego */
#game-container::before {
    content: "Typing Area";
    display: block;
    color: var(--primaryColor);
    font-size: 1rem;
    margin-bottom: 15px;
    text-align: center;
}

/* Versión en español del título */
html[data-lang="es"] #game-container::before {
    content: "Área de Escritura";
}

/* Estilos mejorados para el área del juego y el cursor */
div#game {
    line-height: 35px;
    height: 200px; /* Aumentado para dar más espacio vertical */
    overflow: hidden;
    position: relative;
    margin-top: 20px; /* Aumentado de 10px a 20px */
    padding: 15px; /* Aumentado de 10px a 15px para dar más espacio interno */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

div#game:focus {
    outline: 1px solid var(--primaryColor);
}

#words {
    filter: blur(5px);
    color: var(--textSecondary);
    position: relative; /* Asegura posicionamiento correcto */
}

#game:focus #words {
    filter: blur(0);
}

#focus-error {
    position: absolute;
    inset: 0;
    text-align: center;
    padding-top: 75px; /* Aumentado para centrar mejor verticalmente */
}

#game:focus #focus-error {
    display: none;
}

#cursor {
    display: none;
    width: 2px;
    height: 1.6rem;
    background: var(--primaryColor);
    position: absolute;
    z-index: 10; /* Mayor z-index para asegurar visibilidad */
    transition: left 0.05s, top 0.05s;
    margin-top: -2px; /* Ajuste fino de posición vertical */
}

#game:focus #cursor {
    display: block;
}

div.word {
    display: inline-block;
    font-family: 'Roboto Mono', monospace;
    margin: 0 5px;
    position: relative; /* Asegura que las letras estén bien posicionadas */
}

.letter {
    position: relative; /* Mejor posicionamiento */
}

.letter.correct {
    color: #fff;
}

.letter.incorrect {
    color: #f55;
}

@keyframes blink {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

#game.over #words {
    opacity: .5;
    filter: blur(0px);
}

#game.over:focus #cursor {
    display: none;
}

#game.over #focus-error {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    main {
        width: 95%;
        margin: 20px auto;
    }
    
    .time-section {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #buttons {
        justify-content: center;
    }
}