

#game {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: auto;
    width: 100%;
    max-width: 500px; /* Ancho máximo más adecuado para el juego */
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
    /* Altura calculada para restar un espacio para header/footer. */
    /* Ajusta 180px según la altura real de tu header + footer. */
    min-height: calc(100vh - 180px); 
    box-sizing: border-box; /* Asegura que el padding no añada altura/anchura */
}

.game-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
    margin-top:15px;
}

.btn-logout {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1em;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.3s;
    margin-top: 20px;
}
.btn-logout:hover {
    background-color: #c0392b;
}

.btn-volver {
    display: inline-block;
    padding: 10px 20px;
    font-size: 18px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.3s;
    margin-top: 20px;
}
.btn-volver:hover {
    background-color: #c0392b;
}


/* Estilos para la matriz del juego */
#game-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  margin-bottom: 10px;
}

.celda {
  /* Ancho y alto fluidos con clamp(MIN, IDEAL, MAX) */
  width: clamp(45px, 15vw, 65px);
  height: clamp(45px, 15vw, 65px);
  border: 2px solid #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Tamaño de fuente fluido */
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: bold;
  text-transform: uppercase;
}

.fila-letras {
  display: flex;
  justify-content: center;
  gap: 4px; /* espacio entre letras */
}

/* Colores para los estados de las letras en la matriz */
.celda.correcto {
  background-color: #6aaa64; /* verde */
  color: white;
  border-color: #6aaa64;
}

.celda.presente {
  background-color: #c9b458; /* amarillo */
  color: white;
  border-color: #c9b458;
}

.celda.incorrecto {
  background-color: #787c7e; /* gris */
  color: white;
  border-color: #787c7e;
}

/* Estilos para el Teclado Virtual */
#keyboard-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.keyboard-row {
    display: flex;
    gap: clamp(3px, 1.5vw, 6px);
    justify-content: center;
    width: 100%;
}

.key {
    font-family: inherit;
    font-weight: bold;
    margin: 0;
    /* Altura y anchura fluidas */
    height: clamp(45px, 9vh, 58px);
    flex-grow: 1; /* Permite que las teclas crezcan para ocupar el espacio */
    max-width: 43px; /* Pero no más que el tamaño original */
    border: 0;
    border-radius: 4px;
    background-color: #d3d6da;
    cursor: pointer;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    padding: 0 2px;
}

.key:hover {
    background-color: #b9bcc0;
}

.key.special-key {
    flex-grow: 1.5; /* Da más espacio a las teclas especiales */
    max-width: 65px;
}

#keyboard-container.disabled .key {
    pointer-events: none;
    opacity: 0.6;
}



.container-explicacion {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.container-explicacion h1 {
    font-size: 2.5em;
    color: #2c3e50;
}

.container-explicacion p {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 20px;
}

.btn-jugar {
    display: inline-block;
    padding: 15px 30px;
    font-size: 18px;
    background-color: #27ae60;
    color: white !important;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-jugar:hover {
    background-color: #219150;
}

/* ESTILO PARA HISTORIAL */

#historial-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#historial-container h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

#historial-container table {
    width: 100%;
    border-collapse: collapse;
}

#historial-container thead tr {
    background-color: #f4f4f4;
}

#historial-container thead th {
    padding: 12px 10px;
    border-bottom: 2px solid #ccc;
    text-align: left;
    font-weight: 600;
    color: #34495e;
}

#historial-container tbody tr:hover {
    background-color: #f0f8ff;
}

#historial-container tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    color: #555;
}

#historial-container tbody td:nth-child(3),
#historial-container tbody td:nth-child(4),
#historial-container tbody td:nth-child(5) {
    text-align: center;
}

#historial-container tbody td strong {
    color: #27ae60;
}

/* Responsive */
@media (max-width: 600px) {
    #historial-container table,
    #historial-container thead,
    #historial-container tbody,
    #historial-container th,
    #historial-container td,
    #historial-container tr {
        display: block;
        width: 100%;
    }

    #historial-container thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    #historial-container tbody tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px;
        background: #fafafa;
    }

    #historial-container tbody td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: left;
        color: #555;
    }

    #historial-container tbody td:last-child {
        border-bottom: 0;
    }

    #historial-container tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        top: 10px;
        font-weight: 600;
        color: #34495e;
        white-space: nowrap;
    }

    #historial-container tbody td:nth-child(3),
    #historial-container tbody td:nth-child(4),
    #historial-container tbody td:nth-child(5) {
        text-align: left;
    }
}

.enter-key {
    background-color: #538d4e; /* Verde base */
    color: white;
    /* Añade una transición suave para el cambio de color */
    transition: background-color 0.2s ease-in-out;
}

.enter-key:hover {
    background-color: #6aaa64; /* Un verde más claro para el efecto hover */
    cursor: pointer; /* Cambia el cursor a una mano para indicar que es clickeable */
}


/* Estilos para los enlaces al pie del juego */
.game-footer-links {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0; /* Un separador sutil */
    display: flex;
    flex-direction: column; /* Apila los enlaces verticalmente */
    align-items: center;
    gap: 12px; /* Espacio entre los enlaces */
}

.game-footer-links a {
    color: #555; /* Un color de texto gris oscuro */
    text-decoration: underline;
    font-size: 16px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 5px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.game-footer-links a:hover {
    color: #000; /* Texto más oscuro al pasar el ratón */
    background-color: #f5f5f5; /* Un fondo muy claro para resaltar */
    text-decoration: underline;
}
