/* Estilos generales */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #d4f0c0;
  margin: 0;
  padding: 0px;
  text-align: center;
}

.container {
  max-width: 1000px;
  margin: auto;
}

h1, h2, h3 {
  color: #333;
}

/* Contenedor paralelo para los tableros */
.tableros-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-top: 20px;
}

/* Tablero jugador más grande */
.tablero-wrapper.jugador {
  flex: 2;
  margin-right: 20px;
  margin-bottom: 30px;
}

/* Tablero máquina más pequeño */
.tablero-wrapper.maquina {
  flex: 1;
  max-width: 220px;
  margin-bottom: 60px;
}

/* Escala el tablero de la máquina para hacerlo más compacto */
.tablero-wrapper.maquina .tablero {
  transform: scale(0.6);
  transform-origin: top left;
  gap: 10px;
}

/* Tablero general */
.tablero {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 15px;
  margin-top: 15px;
}

/* Estilo de los botones */
button {
  margin-top: 0px;
  margin-bottom: 10px;
  padding: 10px 15px;
  background-color: #F5BB27;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

/* Efecto hover de los botones */
button:hover:not(:disabled) {
  background-color: #F57311;
}

button:disabled {
  background-color: #bbb;
  cursor: default;
}

/* Botones ya usados (preguntas realizadas) */
button.usada {
  background-color: #ccc;
  color: #666;
  cursor: not-allowed;
  text-decoration: line-through;
}

.resultado {
  font-size: 1.3em;
  font-weight: bold;
  color: #2f855a;
  margin: 10px 0;
}

/* Tablero donde el jugador elige su ave */
#tablero-eleccion {
  transform: scale(0.8);
  transform-origin: top center;
  margin: 10px auto -60px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 15px;
  max-width: 900px;
  justify-items: center;
}

/* Tarjetas de aves */
.personaje {
  background: white;
  border: 2px solid #ccc;
  border-radius: 10px;
  padding: 5px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: visible;
  user-select: none;
}

/* Efecto al pasar el mouse sobre la carta */
.personaje:hover {
  transform: scale(1.05);
  border-color: #F5BB27;
}

/* Imagen de cada ave */
.personaje img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 5px;  
}

/* Estilo del nombre del ave */
.nombre-ave {
  font-weight: 600;
  font-size: 0.9em;
  color: #333;
  text-align: center;
  overflow: visible;
  text-overflow: unset;
  width: 100%;
}

/* Estilo de la tarjeta seleccionada por el jugador */
.personaje.seleccionado {
  border-color: #27ae60;
  box-shadow: 0 0 10px #27ae60;
}

/* Estilo de la pantalla de bienvenida */
#pantalla-bienvenida {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: #d4f4dc;
  border-radius: 12px;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
  background-image: url("img/pajaros.png");
  background-repeat: no-repeat;
  background-position: center;
}

/* Estilo del título principal de la pantalla de bienvenida */
#pantalla-bienvenida h1 {
  font-family: 'Chicle', cursive;
  font-size: 3.5rem;
  color: #2f5233;
  margin-bottom: 20px;
}

/* Estilo del subtítulo debajo del título principal */
#pantalla-bienvenida .subtitulo {
  font-size: 1.5rem;
  font-style: italic;
  color: #52734d;
}

#seleccion-jugador h2 {
  font-family: 'Chicle', cursive;
  font-weight: normal;
  font-size: 1.5rem;
  color: #48483d;
}

#main-container > h1 {
  font-family: 'Chicle', cursive;
  color: #2f5233;
  font-size: 2rem;
  margin-bottom: 0px;
}

/* Encabezado del área de juego */
#juego h2 {
  display: inline-block;
  background-color: #f1cb6b;
  border: 2px solid #2f5233;
  border-radius: 10px;
  padding: 6px 12px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 1.2rem;
  color: #2f5233;
  margin-bottom: 20px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

/* Botón jugar */
#btn-jugar {
  padding: 12px 24px;
  font-size: 1.2rem;
  background-color: #F5BB27;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
}

#btn-jugar:hover {
  background-color: #F57311;
}

/* Estilo del contenedor superior de las preguntas */
#preguntas-arriba-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
  max-width: 100%;
  overflow: hidden;
  flex-wrap: wrap;
  padding: 0 10px;
  box-sizing: border-box;
}

.preguntas {
  background-color: #f0f0f0;
  padding: 8px;
  border-radius: 10px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex: 1;
  min-width: 300px;
  max-width: 100%;
  box-sizing: border-box;
}

.preguntas h3 {
  margin: 0 0 6px 0;
  font-size: 16px;
}

/* Carrusel de botones de preguntas */
.preguntas-carrusel-container {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.preguntas-carrusel {
  display: flex;
  gap: 6px;
  overflow: hidden;
  flex: 1;
  scroll-behavior: smooth;
}

/* Botones dentro del carrusel */
.preguntas-carrusel button {
  padding: 6px 12px;
  font-size: 13px;
  border: none;
  border-radius: 20px;
  background-color: #27ae60;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.preguntas-carrusel button:hover {
  background-color: #d1d1d1;
  transform: scale(1.05);
}

/* Flechas para moverse entre preguntas */
.btn-flecha {
  background-color: #F5BB27;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1.2rem;
  user-select: none;
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-flecha:hover {
  background-color: #F57311;
}

/* Apariencia cuando se eliminan aves */
.personaje.eliminado {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(100%);
  cursor: default;
}

#tablero-maquina .personaje img {
  display: none;
}

#tablero-maquina .personaje {
  background-color: #eee;
  position: relative;
}

/* En el tablero de la máquina, se muestra una X en las aves eliminadas */
#tablero-maquina .personaje.eliminado::after {
  content: "✖";
  color: red;
  font-size: 2em;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.tablero-wrapper.maquina {
  position: relative;
}

.no-scroll {
  overflow: hidden;
  height: 100vh;
}

#turno-actual {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  color: #2f5233;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Tarjeta del ave elegida */
.tarjeta-ave-elegida {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin: 0;
}

.tarjeta-ave-elegida h3 {
  font-family: 'Chicle', cursive;
  font-size: 1rem;
  color: #2f5233;
  margin: 0;
}

.tarjeta-ave-elegida .personaje {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px;
  border: 2px solid #4caf50;
  border-radius: 8px;
  background-color: #ffffff;
  width: 120px;
  box-sizing: border-box;
}

.tarjeta-ave-elegida img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.tarjeta-ave-elegida .nombre-ave {
  margin-top: 4px;
  font-weight: bold;
  font-size: 0.85em;
  text-align: center;
  color: #333;
  line-height: 1.1em;
  max-width: 100%;
  overflow-wrap: break-word;
}

/* Respuesta de la máquina ("Sí" o "No") */
#respuesta-maquina {
  display: inline-block;
  padding: 10px 20px;
  font-weight: bold;
  border-radius: 8px;
  margin-top: 10px;
  transition: all 0.3s ease;
  font-size: 1.1em;
  text-align: center;
  min-width: 100px;
}

#respuesta-maquina:empty {
  display: none;
}

.respuesta-si {
  color: #1e8449;
  background-color: #e9f7ef;
  border: 2px solid #27ae60;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.respuesta-no {
  color: #a93226;
  background-color: #f9ebea;
  border: 2px solid #c0392b;
  box-shadow: 0 0 8px rgba(192, 57, 43, 0.5);
}

/* Estilo de la pregunta de la máquina */
#pregunta-maquina {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  
}

#pregunta-maquina-texto {
  background-color: #2ecc71;
  color: white;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 50px;
  text-align: center;
  min-width: 200px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  margin-bottom: 8px;
  font-size: 14px;
}

#pregunta-maquina button {
  padding: 6px 14px;
  font-size: 14px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  margin: 4px;
  font-weight: bold;
  color: white;
  transition: background-color 0.2s ease, transform 0.1s;
}

#btn-si { background-color: #27ae60; }
#btn-si:hover { background-color: #219150; transform: scale(1.05); }

#btn-no { background-color: #e74c3c; }
#btn-no:hover { background-color: #c0392b; transform: scale(1.05); }

.subtitulo-titulo {
  font-family: 'Chicle', cursive;
  color: #59c76a;
  font-size: 0.8em;
}

.respuesta {
  margin: 15px 0;
  font-size: 1.1em;
  font-weight: 600;
  color: #333;
}

#tablero-jugador {
  gap: 10px;
}

#tablero-jugador .personaje {
  padding: 4px;
  border-width: 1px;
}

#tablero-jugador .personaje img {
  width: 80px;
  height: 80px;
}

#tablero-jugador .nombre-ave {
  font-size: 0.9em;
}

#tablero-maquina {
  border-bottom: 2px solid #ccc;
  padding-bottom: 5px;
}

.tablero-wrapper.maquina h3 {
  margin-bottom: 5px;
}

/* Mensaje cuando el jugador miente */
.mensaje-mentira {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #f8d7da;
  color: #721c24;
  border: 2px solid #f5c6cb;
  padding: 20px 30px;
  border-radius: 10px;
  font-size: 18px;
  z-index: 1000;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.partida-finalizada {
  pointer-events: none;  
  opacity: 0.3;          
}

#mensaje-ganador {
  position: fixed;  
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
       
}

/* Mensaje de ganador */
.resultado.mensaje-ganador {
  display: block;             
  background-color: #fffae6;  
  border: 2px solid #f1c40f;  
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-size: 18px;
  margin-top: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  z-index: 50;                
}


/* Diseño responsive para pantallas pequeñas */
/* Pantalla de bienvenida */
@media (max-width: 600px) {
  #pantalla-bienvenida {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  text-align: center;
  background-color: #d4f4dc;
}

#pantalla-bienvenida::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("img/pajaros.png");
  background-size: contain; 
  background-position: center center;
  background-repeat: no-repeat;
  z-index: -1;
}

#pantalla-bienvenida h1 {
  font-size: 3rem;
  margin-bottom: 12px;
}

#pantalla-bienvenida .subtitulo {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

#btn-jugar {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 8px;
}
}

/* Pantalla de selección del personaje */
@media (max-width: 600px) {

  html, body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
  }

  /* Contenedor de selección */
  #seleccion-jugador {
    padding: 24px 10px 30px; 
    text-align: center;
    box-sizing: border-box;
    padding-top: 40px;
  }

  /* Título */
  #seleccion-jugador h1 {
    margin-top: 30px;  
    font-size: 1.2rem; 
  }

    #seleccion-jugador h2 {
    margin-top: 8px;
    font-size: 0.9rem;
  }  

  #main-container h1 {
    margin-top: 50px; 
  }

  #main-container h1 .subtitulo-titulo {
  display: block;       
  margin-top: 0;        
}
  
  #tablero-eleccion {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)); 
    gap: 5px; 
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 6px; 
    box-sizing: border-box;
    transform: none;
    overflow: visible;
    margin-bottom: 40px;
    transform: scale(0.9);
  }

  /* Nombre de ave más pequeño para que no se salga de la tarjeta */
  #tablero-eleccion .nombre-ave {
  font-size: 0.45rem; 
  line-height: 1;     
}

  /* Tarjetas */
  .personaje {
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 3px;
    border-radius: 6px;
    box-sizing: border-box;
  }

  .personaje img {
    width: 100%;
    height: 100%;
    object-fit: cover;  
}

  .nombre-ave {
    font-size: 0.55rem;
  }

  /* Botón confirmar */
  #btn-confirmar {
    margin-top: 40px;
    font-size: 0.8rem;
    padding: 8px 16px;
    width: 80%;
  }
}

/* Pantalla de la partida */
@media (max-width: 600px) {
  
  html, body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
  }

  .titulo-tablero {
    font-family: 'Chicle', cursive;
    font-size: 0.75rem;
    font-weight: normal;
    color: #2f5233;
    text-align: center;
    margin: 4px 0;
  }
  
  .tableros-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
  }

  .tablero-wrapper.jugador {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 360px;
    margin: 0 auto 15px;
  }

  #tablero-jugador {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    zoom: 0.4;
    margin: 0 auto;
  }
  
  .tablero-wrapper.maquina {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 0;
    row-gap: 4px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }

  #tablero-maquina {
    grid-column: 1;
  }

  .tarjeta-ave-elegida {
    grid-column: 2;
    position: static;
    transform: none;
    align-self: flex-start;
    margin-left: -190px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .tarjeta-ave-elegida .personaje {
    width: 70px;
    aspect-ratio: 1 / 1;
    padding: 3px;
    border-radius: 6px;
    background-color: #fff;
  }

  .tarjeta-ave-elegida img {
    width: 90%;
    max-height: 70%;
    object-fit: contain;
    border-radius: 6px;
  }

  .tarjeta-ave-elegida .nombre-ave {
    font-size: 0.55rem;
    line-height: 1.1;
    text-align: center;
    font-weight: bold;
  }
}

.tarjeta-ave-elegida .titulo-tablero {
  font-family: 'Chicle', cursive;
  font-size: 0.75rem;
  font-weight: normal;
  color: #2f5233;
}

.tablero-wrapper.maquina .titulo-tablero {
  grid-column: 1 / -1;
  text-align: left;
  margin-left: 2px;
}





