/* Interactivas de cada terapia: marco común y escenas. */

.exp {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--crema);
}

.exp [hidden] {
  display: none !important;
}

/* Un solo marco: progreso y texto van dentro de la escena, sobre el cielo, como en los vídeos */
.exp__fondo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.exp__cabeza,
.exp__texto,
.exp__acciones,
.exp__lienzo {
  position: relative;
}

.exp__cabeza {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 0;
}

/* El progreso también es una pequeña constelación */
.exp__estrellas {
  list-style: none;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
}

.exp__estrellas li {
  position: relative;
  width: 22px;
  height: 22px;
}

.exp__estrellas li + li {
  margin-left: 16px;
}

.exp__estrellas li + li::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 16px;
  border-top: 1px dotted rgba(246, 220, 174, 0.6);
}

.exp__estrellas svg {
  width: 100%;
  height: 100%;
  fill: rgba(246, 220, 174, 0.28);
  transition: fill 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.exp__estrellas .hecho svg {
  fill: var(--oro-claro);
}

.exp__estrellas .actual svg {
  fill: var(--oro-brillo);
  transform: scale(1.3);
}

.exp__contador {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--oro-claro);
}

.exp__escenario {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(246, 220, 174, 0.42);
  background:
    radial-gradient(120% 75% at 50% 108%, rgba(255, 196, 150, 0.46), rgba(255, 196, 150, 0.1) 55%, rgba(255, 196, 150, 0) 76%),
    linear-gradient(180deg, #241526, #3d2333 62%, #573245);
  box-shadow: 0 18px 44px rgba(20, 8, 20, 0.5), inset 0 0 50px rgba(20, 8, 20, 0.28);
}

.exp__lienzo svg {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}

.exp__texto {
  padding: 8px clamp(14px, 3.4vw, 30px) 0;
  text-align: center;
  text-shadow: 0 1px 10px rgba(20, 8, 20, 0.8);
}

.exp__titulo {
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  margin-bottom: 3px;
}

/* El texto visible y los invisibles se apilan en la misma celda: la altura es la del más largo */
.exp__medidor {
  display: grid;
}

.exp__medidor > * {
  grid-area: 1 / 1;
  margin: 0;
  font-size: clamp(0.95rem, 1.55vw, 1.03rem);
  line-height: 1.45;
}

.exp__medida {
  visibility: hidden;
}

.exp__acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  min-height: 54px;
  padding: 6px 14px 0;
}

.exp__auto {
  min-height: 40px;
  padding: 4px 16px;
  border: 1px solid rgba(246, 220, 174, 0.45);
  border-radius: 999px;
  background: rgba(255, 246, 238, 0.08);
  color: var(--oro-claro);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.25s ease;
}

.exp__auto:hover {
  background: rgba(255, 246, 238, 0.18);
}

/* Línea que anuncia que la escena va a seguir sola */
.exp__avance {
  display: block;
  width: min(200px, 50%);
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(246, 220, 174, 0.22);
}

.exp__avance span {
  display: block;
  height: 100%;
  background: var(--oro-brillo);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.exp__reservar {
  min-height: 42px;
  padding: 8px 22px;
  font-size: 0.95rem;
}

.boton.pulsa {
  animation: pulso-boton 1.9s ease-in-out infinite;
}

@keyframes pulso-boton {
  0%,
  100% {
    box-shadow: 0 6px 22px rgba(238, 191, 99, 0.32);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(255, 233, 189, 0.22), 0 8px 34px rgba(255, 214, 140, 0.68);
  }
}

.exp__otra-vez {
  background: none;
  border: 0;
  min-height: 42px;
  padding: 0 8px;
  color: var(--oro-claro);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.exp__nota {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--oro-claro);
}

/* ---------- Piezas que se pueden tocar o arrastrar ---------- */

/* Solo capta toques lo que se puede tocar ahora: una figura quieta o en camino no tapa a otra */
.fig,
.iman,
.punto,
.c-carga {
  pointer-events: none;
}

.tocable {
  pointer-events: auto;
  cursor: pointer;
}

.tocable.arrastra {
  cursor: grab;
  touch-action: none;
}

.arrastrando {
  cursor: grabbing;
}

.tocable:focus-visible {
  outline: none;
}

.tocable:focus-visible .anillo {
  animation: none;
  opacity: 1;
  stroke-width: 3;
}

.anillo {
  fill: none;
  stroke: #ffe9bd;
  stroke-width: 2;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.llama .anillo {
  animation: anillo-llama 1.9s ease-out infinite;
}

@keyframes anillo-llama {
  from {
    opacity: 0.95;
    transform: scale(0.72);
  }
  to {
    opacity: 0;
    transform: scale(1.6);
  }
}

/* ---------- Efectos ---------- */

.chispa {
  fill: #fff0c8;
  pointer-events: none;
  animation: chispa 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes chispa {
  from {
    transform: translate(var(--x), var(--y)) scale(0.5);
    opacity: 1;
  }
  to {
    transform: translate(var(--xf), var(--yf)) scale(0) rotate(100deg);
    opacity: 0;
  }
}

.onda {
  fill: none;
  stroke: #ffe9bd;
  stroke-width: 2;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: onda 1.3s ease-out forwards;
}

@keyframes onda {
  from {
    opacity: 1;
    transform: scale(0.4);
  }
  to {
    opacity: 0;
    transform: scale(2.6);
  }
}

.hilo-oro {
  fill: none;
  stroke: #ffd98e;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.2s ease-in-out;
}

.hilo-oro.visible {
  stroke-dashoffset: 0;
}

/* ---------- Constelaciones ---------- */

.fig {
  transform-origin: 0 0;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.fig.arrastrando,
.fig.al-instante {
  transition: none;
}

.fig__mece {
  transform-origin: 0 0;
  animation: mecer var(--t, 5s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

@keyframes mecer {
  0%,
  100% {
    transform: rotate(-1.4deg);
  }
  50% {
    transform: rotate(1.4deg);
  }
}

.fig__halo {
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}

.fig__nombre,
.lugar__nombre,
.exp-rotulo {
  font-family: var(--fuente-texto);
  font-weight: 600;
  fill: var(--crema);
  paint-order: stroke;
  stroke: rgba(36, 21, 38, 0.8);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
}

.fig__nombre {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fig.con-nombre .fig__nombre {
  opacity: 1;
}

.peg__real,
.peg__fantasma {
  transition: opacity 0.8s ease;
}

.es-fantasma .peg__real {
  opacity: 0;
}

.es-fantasma .peg__fantasma {
  opacity: 1;
}

.es-fantasma .peg__sombra {
  opacity: 0.12;
}

.fig--oculto {
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.9s ease;
}

.fig--oculto.presente {
  opacity: 1;
}

/* Tú, encogida o encogido bajo la carga, hasta soltarla */
.fig--tu .fig__mece {
  animation: none;
  transform: scale(1.04, 0.92);
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fig--tu.libre .fig__mece {
  transform: none;
}

.fig--tu.libre .fig__halo {
  opacity: 1;
}

.c-carga {
  transform-origin: 0 0;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s ease;
}

.c-carga.arrastrando {
  transition: none;
}

.c-carga.suelta {
  opacity: 0;
}

.c-enredo path {
  fill: none;
  stroke: #ffd98e;
  stroke-opacity: 0.5;
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: opacity 0.8s ease;
}

.c-enredo path.fuera {
  opacity: 0;
}

.lugar {
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.lugar.visible {
  opacity: 1;
}

.lugar.ocupado {
  opacity: 0;
}

.lugar ellipse {
  fill: rgba(255, 233, 189, 0.16);
  stroke: #ffe9bd;
  stroke-width: 1.5;
  stroke-dasharray: 4 5;
}

.c-pista {
  fill: none;
  stroke: #ffe9bd;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 3 10;
  opacity: 0;
  animation: flujo-pista 1.1s linear infinite;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.c-pista.visible {
  opacity: 0.9;
}

@keyframes flujo-pista {
  to {
    stroke-dashoffset: -13;
  }
}

.c-cielo .cielo__linea {
  stroke: #ffe9bd;
  stroke-opacity: 0.85;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.2s ease-in-out;
  transition-delay: var(--d, 0s);
}

.c-cielo .cielo__nodo {
  fill: #fff2cf;
  opacity: 0;
  transition: opacity 0.8s ease;
  transition-delay: var(--d, 0s);
}

.c-cielo.visible .cielo__linea {
  stroke-dashoffset: 0;
}

.c-cielo.visible .cielo__nodo {
  opacity: 1;
}

.c-pulsos {
  opacity: 0;
  transition: opacity 1s ease 0.6s;
}

.c-pulsos.visible {
  opacity: 1;
}

/* ---------- Biomagnetismo ---------- */

.cuerpo__linea {
  fill: rgba(255, 240, 225, 0.1);
  stroke: #fff3e6;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: dibujar-cuerpo 2.6s ease-in-out forwards;
}

@keyframes dibujar-cuerpo {
  to {
    stroke-dashoffset: 0;
  }
}

.b-aura {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0.55;
  animation: latir 6s ease-in-out infinite;
  transition: opacity 1s ease;
}

.b-escena.en-pausa .b-aura {
  animation: respirar-aura 8s ease-in-out infinite;
}

.b-escena.final .b-aura {
  opacity: 1;
}

@keyframes respirar-aura {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
  }
}

.punto__centro {
  fill: #ffe9bd;
  transition: fill 0.4s ease, r 0.4s ease;
}

.punto {
  opacity: 0;
  transition: opacity 0.7s ease;
}

.punto.visible {
  opacity: 1;
}

.punto.encontrado .punto__centro {
  fill: #fff;
}

.b-puntos {
  transition: opacity 0.7s ease;
}

.b-escena.final .b-puntos {
  opacity: 0;
}

.par__arco {
  fill: none;
  stroke: #ffe9bd;
  stroke-width: 1.8;
  stroke-dasharray: 3 7;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.par__arco.visible {
  opacity: 0.85;
}

.par__campo {
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
}

.par__campo.visible {
  opacity: 1;
}

.par__campo path {
  fill: none;
  stroke: #ffd98e;
  stroke-opacity: 0.45;
  stroke-width: 1.3;
}

.par__campo .flujo {
  stroke: #fff4d2;
  stroke-opacity: 1;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 0.08 0.92;
  animation: recorrer 2.8s linear infinite;
  animation-delay: var(--d, 0s);
}

.iman {
  transform-origin: 0 0;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
}

.iman.arrastrando,
.iman.al-instante {
  transition: none;
}

.b-bandeja {
  transition: opacity 0.7s ease;
}

.b-bandeja rect {
  fill: rgba(255, 246, 238, 0.07);
  stroke: rgba(246, 220, 174, 0.45);
}

.b-escena.en-pausa .b-bandeja,
.b-escena.final .b-bandeja {
  opacity: 0;
}

.b-escena.en-pausa .iman-libre {
  opacity: 0;
}

.respira {
  font-family: var(--fuente-titulo);
  fill: var(--oro-brillo);
  opacity: 0;
  pointer-events: none;
}

.b-escena.en-pausa .respira--dentro {
  animation: respira-dentro 8s ease-in-out infinite;
}

.b-escena.en-pausa .respira--fuera {
  animation: respira-fuera 8s ease-in-out infinite;
}

@keyframes respira-dentro {
  0%,
  45%,
  100% {
    opacity: 0;
  }
  10%,
  35% {
    opacity: 1;
  }
}

@keyframes respira-fuera {
  0%,
  50%,
  100% {
    opacity: 0;
  }
  60%,
  85% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cuerpo__linea {
    stroke-dashoffset: 0;
  }

  .llama .anillo {
    opacity: 0.8;
  }
}
