#pantallaCrearQuizz {
  display: block;
}

#preguntas {
  display: block;
}

#ranking {
  display: none;
}

#ganadores {
  display: block;
}

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

/* Body con fondo suave y centrado del contenido */
body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
}

/* Contenedores login y registro (solo uno visible a la vez) */
#pantallaInicioSesion,
#pantallaRegistro {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 40px 50px;
  width: 360px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Solo mostrar uno (suponiendo que alternas con JS) */
#pantallaRegistro {
  display: none; /* por defecto oculto */
}

/* Títulos */
h1 {
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  margin-bottom: 20px;
  margin-top: 30px;
  text-align: center;
  letter-spacing: 2px;
}

h2 {
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 30px;
  text-align: center;
  color: #e0e0e0;
}

/* Formularios */
.campoFormulario {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campoFormulario p {
  font-weight: 600;
  font-size: 0.9rem;
  color: #ddd;
}

/* Inputs */
input[type="text"],
input[type="password"] {
  padding: 12px 15px;
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 1rem;
  transition: box-shadow 0.2s ease;
  color: #333;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: #aaa;
}

input[type="text"]:focus,
input[type="password"]:focus {
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.7);
}

input.contenedorPregunta {
  width: 48%;
}

input.respuestaCorrecta:focus {
  box-shadow: 0 0 8px 5px rgba(145, 215, 118, 0.7);
}

input.respuestas {
  margin-top: 10px;
  margin-right: 10px;
}

input.explicacion {
  width: 100%;
  margin-top: 10px;
}

/* Mensajes de error */
.mensajeError {
  color: #ff6b6b;
  font-weight: 700;
  min-height: 20px; /* para evitar que salte el contenido */
  font-size: 0.9rem;
}

/* Botones */
button {
  cursor: pointer;
  background: #fff;
  color: #5a2ea6;
  font-weight: 700;
  font-size: 1.1rem;
  border: none;
  padding: 14px 30px; /* Más padding horizontal y vertical */
  border-radius: 25px;
  margin: 20px 10px 0px 0px;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.5);
  user-select: none;
  display: inline-block;
  text-align: center;
  min-width: 150px;
}

button:hover {
  background-color: #5a2ea6;
  color: #fff;
  box-shadow: 0 6px 16px rgba(90, 46, 166, 0.8);
}

button:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(90, 46, 166, 0.7);
}

/* Contenedor de botones + texto */
#botonesInicioSesion,
#botonesRegistro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

#botonesInicioSesion p,
#botonesRegistro p {
  font-size: 0.9rem;
  color: #ccc;
  margin-top: 10px;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 400px) {
  #pantallaInicioSesion,
  #pantallaRegistro {
    width: 90vw;
    padding: 30px 20px;
  }

  button {
    min-width: 100%;
    padding: 14px 0;
  }
}

.cajaPuntuacion {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  color: white;
  font-weight: 600;
  transition: transform 0.5s ease;
  flex-shrink: 0;
}

.cajaPuntuacion div{
  display: flex;
  align-items: center;
}

.cajaPuntuacion div span{
  margin-left: 5px;
}

.card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 30px 25px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 30px;
  margin-bottom: 100px;
}

/* Efecto hover sutil (opcional) */
.card:hover, .cajaPuntuacion:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

/* Título dentro de la card */
.card h3, .cajaPuntuacion h3 {
  font-size: 1.4rem;
  margin-bottom: 12px;
  font-weight: 700;
  font-family: "Poppins", sans-serif;
  color: #fff;
}

/* Texto o contenido dentro de la card */
.card p, .cajaPuntuacion p {
  font-size: 1rem;
  color: #e0e0e0;
  line-height: 1.6;
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #ffffff88, transparent);
  margin: 30px 0;
}

ul#checks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

ul#checks li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 18px;
  border-radius: 10px;
  color: #eee;
  font-weight: 500;
  font-size: 0.95rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease;
}

ul#checks li:hover {
  background: rgba(255, 255, 255, 0.15);
}

ul#checks li div {
  display: flex;
}

ul#checks li div label {
  margin-left: 5px;
}

ul#checks li select {
  margin-top: 0px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5a2ea6; /* color del checkbox */
  cursor: pointer;
  transition: transform 0.2s ease;
}

input[type="checkbox"]:hover {
  transform: scale(1.1);
}

select {
  background-color: #ffffff;
  color: #5a2ea6;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 15px;
  border-radius: 10px;
  border: none;
  box-shadow: 0 4px 12px rgba(90, 46, 166, 0.3);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
  outline: none;
  appearance: none;
  cursor: pointer;
  min-width: 180px;
  margin: 15px 0px 0px 0px;
}

/* Opciones internas */
select option {
  color: #5a2ea6;
  background-color: #f0eaff;
}

.botones{
  display: flex;
  justify-content: center;
}

#preguntas .card {
  width: 800px;
  aspect-ratio: 16 / 9;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin: 30px auto;
}

#preguntas .card button {
  background: #fff;
  color: #5a2ea6;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 12px;

  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  text-align: center;

  display: flex;
  align-items: center;
  justify-content: center;

  line-height: 1.3;
  min-height: 40px;
  max-height: 200px;
  height: auto;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  text-wrap: balance;
}

#preguntas .card button:hover {
  background-color: #5a2ea6;
  color: #fff;
  transform: scale(1.02);
}

#preguntas .card button:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(90, 46, 166, 0.7);
}

#preguntas .card button.respuestaCorrectaQuizz {
  background-color: #4ade80;
  color: #064e3b;
}

#preguntas .card button.respuestaCorrectaQuizz:hover {
  background-color: #4ade80;
  color: #064e3b;
  transform: scale(1);
}

#preguntas .card button.respuestaCorrectaQuizz:active {
  transform: scale(1);
}

#preguntas .card button.respuestaIncorrectaQuizz {
  background-color: #f87171;
  color: #7f1d1d;
}

#preguntas .card button.respuestaIncorrectaQuizz:hover {
  background-color: #f87171;
  color: #7f1d1d;
  transform: scale(1);
}

#preguntas .card button.respuestaIncorrectaQuizz:active {
  transform: scale(1);
}

#preguntas .card button.comodin5050 {
  background-color: #facc15; /* amarillo brillante */
  color: #78350f; /* marrón oscuro para buen contraste */
}

#preguntas .card button.comodin5050:hover {
  background-color: #facc15;
  color: #78350f;
  transform: scale(1);
}

#preguntas .card button.comodin5050:active {
  transform: scale(1);
}

.puntuacion {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.Ranking {
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Oculta lo que se salga */
  max-height: 31em; /* 80px aprox. por jugador */
}


/* 🥇 Top 1 */
.top1 {
  background: linear-gradient(135deg, #e0b100, #c19400); /* Dorado más oscuro */
  color: #fff; /* Texto blanco puro */
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
  border: 2px solid #fff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7); /* Sombra negra más fuerte */
}

/* 🥈 Top 2 */
.top2 {
  background: linear-gradient(135deg, #c0c0c0, #b0b0b0);
  color: #333;
  box-shadow: 0 0 20px rgba(192, 192, 192, 0.4);
  border: 2px solid #fff;
}

/* 🥉 Top 3 */
.top3 {
  background: linear-gradient(135deg, #cd7f32, #b87333);
  color: #fff;
  box-shadow: 0 0 20px rgba(205, 127, 50, 0.4);
  border: 2px solid #fff;
}

#ganadores.card {
  background: rgba(30, 30, 40, 0.5); /* Gris oscuro con transparencia */
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(120, 90, 250, 0.6);
  text-align: center;
}

/* Ajuste de espaciado dentro del li */
#podio li,
#ganadores ul li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  margin: 0.5rem 0;
  border-radius: 12px;
  font-weight: bold;
  transition: transform 0.2s, box-shadow 0.2s;
  max-width: 500px;
  min-width: 300px;
  gap: 0.6rem; /* Añade espacio entre los elementos dentro del li */
}

/* Para nombres y emoji */
#podio li strong,
#ganadores ul li strong {
  margin-left: 0.3rem; /* Pequeño espacio tras el emoji */
  text-overflow: ellipsis; /* Si es muy largo, recorta */
  overflow: hidden;
  white-space: nowrap;
}

/* Si quieres que la puntuación también se vea mejor en móvil */
@media (max-width: 480px) {
  #podio li,
  #ganadores ul li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    max-width: 90%;
  }

  .puntuacion {
    justify-content: flex-start;
  }
}

#ganadores ul li:not(.top1):not(.top2):not(.top3) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Resto del ranking */
.restoRanking {
  margin-top: 1rem;
  font-size: 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 0.5rem;
}

/* Botón volver */
#ganadores .botones {
  margin-top: 1.5rem;
}

#ganadores button#volverInicio {
  background: linear-gradient(135deg, #ff6a00, #ee0979);
  border: none;
  color: #fff;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#ganadores button#volverInicio:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Títulos */
#ganadores h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

#ganadores h2 {
  font-size: 1.5rem;
  margin: 1rem 0 0.5rem;
}

#podio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.eliminar {
  background: linear-gradient(135deg, #ff6b6b, #ff4e50); /* Rojo degradado moderno */
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
  cursor: pointer;
  margin: 15px 0px 0px 0px;
}

.eliminar:hover {
  background: linear-gradient(135deg, #e04646, #d83c3c);
  transform: scale(1.03);
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.6);
}

.eliminar:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(200, 50, 50, 0.5);
}

.contenedorMensajes {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px; /* separación automática entre mensajes */
  z-index: 999;
  width: 80%;
  max-width: 500px;
  pointer-events: none; /* permite clics a través si quieres */
}

.mensajeError, .mensajeAdvertencia, .mensajeCorrecto {
  transform: translateY(-200px);
  font-weight: 600;
  padding: 16px 24px;
  width: 100%;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-size: 1rem;
  top: 0;
  transition: all 0.5s ease;
  position: relative;
}

.mensajeError {
  background-color: #ff4d4d; /* rojo suave */
  color: #fff;
}

.mensajeAdvertencia {
  background-color: #fbbf24;
  color: #333;
}

.mensajeCorrecto {
  background-color: #4ade80; /* verde suave moderno */
  color: #064e3b; /* texto verde oscuro para buen contraste */
}

.explicacion, .dificultad {
  display: none;
}

#pantallaEspera {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px;
  color: #fff;
  min-height: 100vh;
}

.titulo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 30px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}

.contenedorSala {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 30px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.codigoSala p {
  font-size: 1rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 8px;
}

.codigoSala .codigo {
  font-size: 1.8rem;
  font-weight: 900;
  background: #fff;
  color: #5a2ea6;
  padding: 10px 20px;
  border-radius: 12px;
  display: inline-block;
  letter-spacing: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  margin-bottom: 20px;
}

#jugadores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0px;
}

.jugador {
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 12px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0px 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}

#jugadores .jugador p {
  margin: 0px;
  text-align: center;
}

.jugador:hover {
  transform: scale(1.05);
  background-color: rgba(255, 255, 255, 0.15);
}

.loader {
  margin: 30px auto 10px;
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top: 6px solid #fff;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.mensajeEsperando {
  font-size: 0.95rem;
  color: #ddd;
  margin-top: 10px;
}

#explicacion {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 40px 30px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  text-align: center;
  margin: 50px auto;
  animation: fadeIn 0.5s ease-in-out;
  display: none;
}

#explicacion h1 {
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: 2rem;
  margin-bottom: 30px;
  color: #ffffff;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
}

#explicacion .card:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dificultad-indicador {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 12px;
  margin-bottom: -12px;
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.dificultad-indicador .icono {
  font-size: 1.2rem;
}

/* Colores según dificultad */
.dificultad-Facil {
  color: #a5e075;
  border: 2px solid #a5e075;
}

.dificultad-Medio {
  color: #fbbf24;
  border: 2px solid #fbbf24;
}

.dificultad-Dificil {
  color: #f87171;
  border: 2px solid #f87171;
}

.dificultad-Extremo {
  color: #1f2937;
  border: 2px solid #1f2937;
}

#siguiente1, #siguiente2, #siguiente3 {
  display: none;
}

#comenzar {
  display: none;
  margin: 0px auto;
}

.cronometro-container {
  text-align: center;
  font-size: 1.1rem;
  margin-top: 10px;
  color: #e0e0e0;
}

.indicador-pregunta {
  position: fixed;
  bottom: 20px;
  right: 30px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffffcc;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.comodin-container {
  display: flex;
  justify-content: center;
  margin: 10px 0 20px;
}

.comodin {
  background: #ffbf00;
  color: #333;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(255, 191, 0, 0.4);
  transition: background-color 0.3s ease, transform 0.2s ease;
  border: none;
  cursor: pointer;
}

.comodin:hover {
  background-color: #e0a800;
  transform: scale(1.05);
}

.comodin:active {
  transform: scale(0.97);
}

.comodinUsado {
  background: #999; /* gris apagado */
  color: #fff; 
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: not-allowed; /* indica que no se puede usar */
  opacity: 0.7;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

/* desactivo hover y active para que no cambie */
.comodinUsado:hover {
  background: #999;
  transform: none;
}

.comodinUsado:active {
  transform: none;
}

.comodinEsperando {
  background: linear-gradient(135deg, #ffbf00 0%, #ffd84d 100%);
  color: #444;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1rem;
  border: none;
  cursor: not-allowed;
  opacity: 0.8;
  box-shadow: 0 0 12px rgba(255, 191, 0, 0.3), inset 0 0 6px rgba(255, 191, 0, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Animación tipo “pulso” suave */
.comodinEsperando::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

#pantallaEspera {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: white;
  font-family: "Inter", sans-serif;
  text-align: center;
  padding: 20px;
}

#pantallaEspera h2 {
  font-weight: 800;
  font-size: 2rem;
  margin-bottom: 30px;
}

#pantallaEspera p {
  font-size: 1.1rem;
  margin-top: 20px;
  color: #ddd;
}

.aciertos {
  font-weight: 300;
  font-size: 12px;
}

/* Contador dentro de cada respuesta */
.respuestasTotal {
  background: rgba(0, 0, 0, 0.25); /* fondo semitransparente */
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 12px;
  margin-left: 8px; /* separación del texto */
  min-width: 24px;
  text-align: center;
  display: inline-block;
}