@font-face {
  font-family: 'Exo2';
  src: url('Exo2-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --celda-size: 150px;      
  --header-height: 60px;   
  --font-size: 1.1rem;     
  --gap-size: 4px;         
  --flecha-size: 100px;     
  --flecha-color: rgba(0, 0, 0, 0.15);
}

body {
  font-family: 'Exo2', sans-serif;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px;
  background-color: #85A4C8;
}

h1 {
  text-align: center;
  margin-bottom: 24px;
}

.game-container {
  position: relative;
  width: 100%;
  max-width: calc(var(--celda-size) * 9 + var(--gap-size) * 8);
  margin: 0 auto;
}

.scroll-container {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 20px;
  padding-bottom: 16px;
}

#game-form {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  justify-content: center;
}

.input-container {
  width: 300px;
  position: relative;
  z-index: 1001;
}

#input-PERSONAJE {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.sugerencias-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sugerencia-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.sugerencia-item:last-child {
  border-bottom: none;
}

.sugerencia-item:hover {
  background-color: #f5f5f5;
}

.sugerencia-img-container {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sugerencia-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

button {
  padding: 8px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #4CAF50;
  color: white;
  font-weight: bold;
  min-width: 120px;
  height: 35px;
  z-index: 1001;
}

button:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

.categorias-header {
  display: grid;
  grid-template-columns: repeat(9, var(--celda-size));
  gap: var(--gap-size);
  margin-bottom: 16px;
  justify-content: center;
  width: calc(var(--celda-size) * 9 + var(--gap-size) * 8);
  margin-left: auto;
  margin-right: auto;
}

.categoria {
  background: #f0f0f0;
  padding: 8px;
  text-align: center;
  font-weight: bold;
  font-size: var(--font-size);
  border-radius: 4px;
  min-width: var(--celda-size);
  height: var(--header-height);
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fila {
  display: grid;
  grid-template-columns: repeat(9, var(--celda-size));
  gap: var(--gap-size);
  margin-top: 8px;
  justify-content: center;
  width: calc(var(--celda-size) * 9 + var(--gap-size) * 8);
  margin-left: auto;
  margin-right: auto;
}

.celda {
  min-width: var(--celda-size);
  min-height: var(--celda-size);
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  padding: 8px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size);
  word-break: break-word;
  opacity: 0;
  transform: rotateY(90deg);
  transition: transform 0.6s, opacity 0.3s;
  position: relative;
  overflow: hidden;
  background-clip: padding-box;
}

/* Nuevo contenedor para el texto */
.celda-content {
  position: relative;
  z-index: 10;
  background: transparent;  /* Hacemos el fondo transparente */
  color: white;
  padding: 4px 8px;
  border-radius: 2px;
}

.celda > * {
  color: white !important;
  text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.celda.revelada {
  opacity: 1;
  transform: rotateY(0deg);
}

.celda.revelada.correcto { 
  background: #6aaa64; 
}

.celda.revelada.parcial { 
  background: #DE870F; 
}

.celda.revelada.incorrecto { 
  background: #D53633; 
}

.correcto { 
  background: #6aaa64; 
  color: white; 
}

.parcial { 
  background: #c9b458; 
  color: white; 
}

.incorrecto { 
  background: #D53633; 
  color: white; 
  position: relative; 
}

.flecha-arriba::after,
.flecha-abajo::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-size: 80% 80%;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
  opacity: 0.15;
}

.flecha-arriba::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000000' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z'/%3E%3C/svg%3E");
}

.flecha-abajo::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000000' d='M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z'/%3E%3C/svg%3E");
}

.cross-icon {
  max-width: 60%;
  max-height: 60%;
  object-fit: contain;
}

.personaje-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  display: block;
  margin: auto;
}

.contador {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  position: relative;
  width: 100%;
  padding: 10px 0;
}

.mensaje-victoria {
  text-align: center;
  font-size: 2rem;
  color: #6aaa64;
  font-weight: bold;
  margin: 20px 0;
  padding: 20px;
  background-color: #f0f0f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.mensaje-victoria img {
  max-height: 100px;
  border-radius: 4px;
}

.hidden {
  display: none;
}

/* Media queries para dispositivos móviles */
@media screen and (max-width: 768px) {
  :root {
    --celda-size: 100px;      /* Volvemos al tamaño original */
    --header-height: 50px;
    --font-size: 0.9rem;
    --gap-size: 2px;
  }

  body {
    padding: 8px;
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 16px;
  }

  #game-form {
    flex-direction: row; /* Mantener en fila */
    align-items: flex-start;
    gap: 8px;
    justify-content: center;
  }

  .input-container {
    width: calc(100% - 120px); /* Ajustar ancho para dejar espacio al botón */
    max-width: none;
  }

  button {
    width: auto; /* Quitar width:100% */
    min-width: 110px; /* Asegurar un ancho mínimo */
    height: 35px;
  }

  .scroll-container {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .categoria {
    font-size: 0.8rem;
    padding: 4px;
    height: auto;
    min-height: 40px;
  }

  .celda {
    font-size: 0.8rem;
  }

  .sugerencias-container {
    max-height: 200px;
  }

  .sugerencia-item {
    padding: 6px;
  }

  .sugerencia-img-container {
    width: 30px;
    height: 30px;
  }

  .mensaje-victoria {
    font-size: 1.2rem;
    padding: 10px;
    flex-direction: column;
    text-align: center;
  }

  .mensaje-victoria img {
    max-height: 60px;
  }

  .contador {
    font-size: 1rem;
    padding: 5px 0;
  }
}

/* Media query específico para pantallas muy pequeñas */
@media screen and (max-width: 360px) {
  :root {
    --celda-size: 80px;      /* Volvemos al tamaño original */
    --font-size: 0.8rem;     /* Volvemos al tamaño original */
  }

  .categoria {
    font-size: 0.7rem;
  }
}
