body {
  font-family: 'Comic Neue', cursive;
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  margin: 0;
  overflow-x: hidden;
  text-align: center;
}

.game-container {
  background: #7bbdfa;
  border-radius: 30px;
  padding: 40px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 900px;
  margin: 40px auto;
}

h2 {
  font-size: 2em;
  margin-bottom: 30px;
}

.words-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
}

.word {
  background-color: #fff;
  border: 3px solid #ffcc00;
  border-radius: 15px;
  padding: 12px 20px;
  font-weight: bold;
  font-size: 1.3em;
  cursor: grab;
  transition: transform 0.2s, background 0.2s, font-size 0.3s;
}

.word:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.word.placed {
  font-size: 0.7em;
  background-color: #ffffffcc;
  border: none;
  margin: 5px auto;
  cursor: default;
  display: inline-block;
}
.word.dragging {
  opacity: 0.7;
  transform: scale(1.1);
  transition: transform 0.1s;
}


/* ===== CATEGORÍAS ===== */
.categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 columnas */
  gap: 20px;
  max-width: 600px;
  margin: 40px auto;
  justify-items: center;
}

.category {
  background: white;
  border: 3px solid #ffcc00;
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  height: 180px;
  font-size: 1.5em;
  font-weight: bold;
  color: #333;
  display: flex;
  flex-direction: column; /* 🔹 Para que el texto quede arriba y las palabras debajo */
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, background 0.2s ease;
}

/* 🔹 Contenedor de palabras dentro de la categoría */
.category .word-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
  z-index: 2;
}

.category.correct {
  background-color: #a2f5a2;
  border-color: #3cb043;
}

.category.incorrect {
  background-color: #f8a5a5;
  border-color: #d33;
}

/* El GIF ocupa todo el cuadro */
.category img.feedback-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* rellena sin deformar */
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 20px;
}

.category.show-gif img.feedback-gif {
  opacity: 1;
}

/* texto visible por encima del gif */
.category span {
  position: relative;
  z-index: 2;
}

/* Responsivo */
@media (max-width: 768px) {
  .categories {
    grid-template-columns: 1fr; /* en móvil, una por fila */
  }
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

.buttons {
  margin-top: 25px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

button {
  border: none;
  border-radius: 15px;
  padding: 12px 25px;
  font-size: 1.2em;
  cursor: pointer;
  transition: transform 0.2s;
  font-weight: bold;
}

#resetBtn {
  background-color: #ffd166;
  color: #333;
}

#changeBtn {
  background-color: #ff6666;
  color: white;
}

button:hover {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .categories {
    grid-template-columns: 1fr; /* en móvil, una por fila */
  }
}
