/* ═══════════════════════════════════════════════
   PIRÁMIDE — Estilos del juego
   Estructura: 1-2-3-4 (10 canciones)
═══════════════════════════════════════════════ */

/* ── Wrapper principal ──────────────────────── */
.piramide-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Estado de carga ────────────────────────── */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tarjeta del artista ────────────────────── */
.artista-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.artista-foto {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-hi);
}
.artista-foto-placeholder {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}
.artista-info h2 {
  font-family: var(--font-d);
  font-size: 24px;
  letter-spacing: 0.5px;
  line-height: 1.1;
}
.artista-info p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Pirámide ───────────────────────────────── */
.piramide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.piramide-fila {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Slot base */
.piramide-slot {
  width: 130px;
  min-height: 64px;
  border: 2px dashed rgba(41, 120, 181, 0.35);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px 8px;
  text-align: center;
  position: relative;
  background: var(--surface);
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
  user-select: none;
}

/* Número de posición */
.slot-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  position: absolute;
  top: 5px;
  left: 8px;
  letter-spacing: 0.3px;
}

/* Nombre de la canción dentro del slot */
.slot-cancion {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  padding-top: 4px;
  word-break: break-word;
}

/* Popularidad (tras confirmar) */
.slot-pop {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 600;
}

/* Slot con canción colocada */
.piramide-slot.filled {
  border-style: solid;
  border-color: rgba(41, 120, 181, 0.55);
  background: var(--surface-2);
}

/* Slot vacío parpadeando cuando hay canción seleccionada */
.piramide-slot.target-active {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(41, 120, 181, 0.1);
  animation: pulse-slot 1s ease-in-out infinite;
}
@keyframes pulse-slot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(41, 120, 181, 0.35); }
  50%       { box-shadow: 0 0 0 7px rgba(41, 120, 181, 0); }
}

/* Slot correcto (verde) */
.piramide-slot.correcto {
  border-style: solid;
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.1);
}
.piramide-slot.correcto .slot-num { color: var(--green); }
.piramide-slot.correcto .slot-pop { color: var(--green); }

/* Slot incorrecto (rojo) */
.piramide-slot.incorrecto {
  border-style: solid;
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.08);
}
.piramide-slot.incorrecto .slot-num { color: var(--red); }
.piramide-slot.incorrecto .slot-pop { color: var(--muted); }

/* Nombre correcto mostrado bajo el incorrecto */
.slot-correcto-nombre {
  font-size: 10px;
  color: var(--green);
  margin-top: 3px;
  font-style: italic;
  line-height: 1.2;
}

/* ── Pool de canciones ──────────────────────── */
.pool-header {
  text-align: center;
}
.pool-titulo {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.song-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  min-height: 44px;
  transition: opacity var(--t);
}

.song-card {
  padding: 10px 16px;
  background: var(--surface-2);
  border-radius: var(--r);
  border: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--t), background var(--t), transform var(--t), opacity var(--t);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  text-align: center;
}
.song-card:hover {
  border-color: rgba(41, 120, 181, 0.55);
  transform: translateY(-1px);
}
.song-card.selected {
  border-color: var(--accent);
  background: rgba(41, 120, 181, 0.18);
  color: var(--accent-h);
  transform: translateY(-2px);
  box-shadow: var(--shadow-a);
}
.song-card.placed {
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
}

/* ── Acciones ───────────────────────────────── */
.piramide-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-piramide {
  padding: 12px 28px;
  border-radius: var(--r);
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t), transform var(--t), opacity var(--t);
}
.btn-piramide:active { transform: scale(0.97); }

.btn-confirmar {
  background: var(--accent);
  color: #fff;
  min-width: 160px;
}
.btn-confirmar:hover:not(:disabled) { background: var(--accent-h); }
.btn-confirmar:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-reiniciar {
  background: var(--surface-3);
  color: var(--text);
}
.btn-reiniciar:hover:not(:disabled) { background: var(--surface-2); }
.btn-reiniciar:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Resultado ──────────────────────────────── */
.resultado-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px 20px;
  text-align: center;
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.resultado-score {
  font-family: var(--font-d);
  font-size: 56px;
  line-height: 1;
  color: var(--accent);
}
.resultado-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.resultado-emoji {
  font-size: 28px;
  margin-top: 10px;
  display: block;
}
.resultado-compartir {
  margin-top: 14px;
  font-size: 12px;
  font-family: monospace;
  letter-spacing: 2px;
  color: var(--text);
  word-break: break-word;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 560px) {
  .piramide-slot {
    width: 82px;
    min-height: 58px;
    padding: 4px 5px;
  }
  .slot-num    { font-size: 9px; }
  .slot-cancion { font-size: 10px; }
  .slot-pop    { font-size: 9px; }
  .slot-correcto-nombre { font-size: 9px; }

  .song-card {
    font-size: 12px;
    padding: 8px 12px;
  }

  .artista-card {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .piramide-slot {
    width: 70px;
    min-height: 52px;
  }
  .piramide-fila { gap: 5px; }
  .piramide      { gap: 5px; }
}
