/* Juego de ordenar tarjetas en huecos numerados (ver assets/js/juego-ordenar.js) */
.instrucciones { text-align: center; color: var(--suave); }

.ordenar { display: grid; gap: clamp(14px, 3vw, 28px); user-select: none; }

#banco, #huecos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2vw, 20px);
}
#banco {
  padding: 12px;
  min-height: 120px;
  background: #fff;
  border: 3px solid var(--borde);
  border-radius: 20px;
}

/* Flecha entre un hueco y el siguiente */
.hueco {
  position: relative;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border: 4px dashed var(--acento);
  border-radius: 18px;
  background: #f6fbf8;
}
.hueco + .hueco::before {
  content: "➜";
  position: absolute;
  left: calc(-1 * clamp(8px, 2vw, 20px) / 2);
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--acento);
  font-size: clamp(1rem, 3vw, 1.8rem);
  z-index: 1;
}
.hueco .numero {
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: bold;
  color: var(--acento);
  opacity: .35;
}
.hueco.lleno { border-style: solid; background: #ecf8f1; }
.hueco.lleno .numero {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 1.6em;
  height: 1.6em;
  display: grid;
  place-items: center;
  font-size: clamp(.8rem, 2vw, 1.1rem);
  color: #fff;
  background: var(--acento);
  border-radius: 50%;
  opacity: 1;
  z-index: 1;
}
.hueco.error { border-color: #d9443b; background: #fde2df; animation: temblar .35s; }

.paso {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 3px solid var(--acento);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .15);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.paso img {
  width: 100%;
  aspect-ratio: 6 / 5;
  padding: 6px;
  display: block;
  pointer-events: none;
}
.nombre-paso {
  padding: 4px 2px 8px;
  text-align: center;
  font-weight: bold;
  font-size: clamp(.8rem, 2.4vw, 1.4rem);
  overflow-wrap: anywhere;
}
.paso.usada { visibility: hidden; }
.paso.colocada { width: 100%; height: 100%; justify-content: center; border: 0; box-shadow: none; background: none; cursor: default; }
.paso.fantasma {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  cursor: grabbing;
  transform: scale(1.08) rotate(-2deg);
}
.paso.volviendo { transition: left .25s, top .25s, transform .25s; transform: none; }

.final { text-align: center; font-size: 1.4rem; }
.creditos { text-align: center; color: var(--suave); font-size: .8rem; margin-top: 32px; }

/* En móvil, los huecos van de dos en dos y sin flechas */
@media (max-width: 520px) {
  #banco, #huecos { grid-template-columns: repeat(2, 1fr); }
  .hueco + .hueco::before { display: none; }
}

@keyframes temblar {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
