* {
  box-sizing: border-box;
  font-family: 'Comic Sans MS', sans-serif;
}

body {
  margin: 0;
  background: #fef5e7;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.game-container {
  display: flex;
  gap: 20px;
}

/* Contenedor principal que mantiene el grid y los controles juntos */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 15px; /* Espacio entre el grid y los botones */
  align-items: center; /* Centrar elementos horizontalmente */
}

/* Área de botones de control */
.controls-area {
  display: flex;
  gap: 10px;
  margin-top: 20px; /* Separación extra del grid */
}

#add-pair-btn {
  background-color: #4caf50; /* Color verde para "añadir" */
  color: white;
  font-weight: bold;
}

.memory-grid {
  display: grid;
  /* Fijamos 4 filas y dejamos que las columnas crezcan hacia la derecha */
  grid-template-rows: repeat(4, 120px);
  grid-auto-columns: 120px;
  grid-auto-flow: column;
  grid-gap: 15px;
}

.card {
  width: 120px;
  height: 120px;
  background-color: #ffe0b2;
  border: 3px solid #ff9800;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 18px;
  color: #333;
  text-align: center;
  transition: transform 0.3s;
}

.card.flipped {
  background-color: #fff8e1;
  cursor: default;
  transform: scale(1.05);
}

.card img {
  max-width: 80%;
  max-height: 80%;
}

/* Estilos para el texto de las coordenadas */
.card[data-coord]::after {
  content: attr(data-coord);
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 12px;
  color: #555;
}

/* Estilos de la barra lateral */
.sidebar {
  min-width: 200px;
  background: #fff3e0;
  border-radius: 10px;
  padding: 15px;
  border: 2px solid #ffa726;
  height: fit-content; /* Se ajusta a su contenido */
}

.sidebar h2 {
  text-align: center;
  color: #e65100;
}

.player {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player input {
  width: 100px;
}

.player span {
  font-weight: bold;
  margin: 0 10px;
}

button {
  background-color: #ffb74d;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  background-color: #ffa726;
}

/* --- ESTILOS DEL EFECTO CONFETI --- */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none; /* No interfiere con clics */
  overflow: hidden;
  z-index: 1000; /* Siempre por encima de todo */
}

.dog-confetti {
  position: absolute;
  width: 50px; /* Tamaño del perro bailando */
  height: auto;
  opacity: 0;
  animation: confettiFall 4s linear forwards;
}

/* Animación de caída y giro */
@keyframes confettiFall {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}