/* ==========================================================================
   Iniciador personalizado "Almas Gemelas" (soulmates launcher)
   --------------------------------------------------------------------------
   Traduccion al CSS del maquetado romántico (glassmorphism + Hilo Rojo del
   Destino). Todo va SCOPED: sin `html.theme-soulmates` ni dentro de
   `#soulmates-launcher` no pinta nada, asi que las demas experiencias
   conservan la tarjeta generica tal y como estaban.

   No se usa el CDN de Tailwind: su preflight resetea h1/botones/globalmente y
   romperia la UI existente (y la app es offline-first).
   ========================================================================== */

/* El bloque existe en el DOM para todas las rutas, pero esta apagado. */
#soulmates-launcher {
  display: none;
}

html.theme-soulmates #soulmates-launcher {
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   1. #start-screen deja de ser una tarjeta centrada y pasa a ser el lienzo
   completo del launcher. Se quita el backdrop-filter: crea un containing
   block y el `position: absolute` del fondo se recortaria al tarjeta.
   -------------------------------------------------------------------------- */
html.theme-soulmates #start-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  padding: 0;
  margin: 0;
  display: block;
  overflow: hidden;
  background: #0d0208;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: none;
  z-index: 30;
}

/* La tarjeta generica se apaga; solo se conserva su DOM (los tests leen
   .card-title/.card-badge y el manifiesto sigue poblandolos). */
html.theme-soulmates #start-screen > :not(#soulmates-launcher) {
  display: none !important;
}

/* La telemetria monoespaciada taparia la cabecera romantica mientras dure el
   launcher. Vuelve sola en cuanto la pantalla de inicio se oculta.
   `!important` es obligatorio: el contenedor lleva `display: flex` inline en
   el index.html, y una regla de hoja de estilos no lo gana sin eso. */
html.theme-soulmates.sl-launcher-active #debug-bar-container {
  display: none !important;
}

/* --------------------------------------------------------------------------
   2. FASE 1 — Fondo etéreo (aparece primero, con suave fundido)
   -------------------------------------------------------------------------- */
.sl-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #0d0208;
  background-image: linear-gradient(
      rgba(13, 2, 8, 0.72) 0%,
      rgba(20, 4, 13, 0.65) 50%,
      rgba(13, 2, 8, 0.85) 100%
    ),
    var(--sl-bg-image, none);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 500ms ease;
}

#soulmates-launcher.sl-bg-in .sl-bg {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   3. FASE 2 — Ambiente celeste: orbes y el Hilo Rojo del Destino
   -------------------------------------------------------------------------- */
.sl-ambient {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms ease 200ms;
}

#soulmates-launcher.sl-in .sl-ambient {
  opacity: 0.55;
}

.sl-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
}

.sl-orb-a {
  top: -6rem;
  left: -5rem;
  width: 20rem;
  height: 20rem;
  background: rgba(225, 77, 122, 0.25);
  animation: sl-pulse-glow 3.5s ease-in-out infinite;
}

.sl-orb-b {
  top: 50%;
  right: -7rem;
  width: 24rem;
  height: 24rem;
  background: rgba(219, 39, 119, 0.2);
  animation: sl-pulse-glow 3.5s ease-in-out 1.8s infinite;
}

.sl-orb-c {
  bottom: -5rem;
  left: 33%;
  width: 20rem;
  height: 20rem;
  background: rgba(185, 28, 28, 0.2);
}

@keyframes sl-pulse-glow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.08);
  }
}

.sl-thread {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.4;
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.8));
}

/* --------------------------------------------------------------------------
   4. FASE 3 — Cabecera, tarjeta y cita (entran escalonadas)
   -------------------------------------------------------------------------- */
.sl-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px
    calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.sl-stage {
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: opacity 520ms cubic-bezier(0.16, 1, 0.3, 1) var(--sl-delay, 0ms),
    transform 520ms cubic-bezier(0.16, 1, 0.3, 1) var(--sl-delay, 0ms);
}

#soulmates-launcher.sl-in .sl-stage {
  opacity: 1;
  transform: none;
}

/* La tarjeta entra más despacio y revela su contenido por etapas. */
.sl-card.sl-stage {
  transition-duration: 1100ms;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

.sl-card > :not(.sl-card-glow) {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

#soulmates-launcher.sl-in .sl-card > :not(.sl-card-glow) {
  opacity: 1;
  transform: none;
}

.sl-card > .sl-badge { transition-delay: 140ms; }
.sl-card > .sl-title { transition-delay: 240ms; }
.sl-card > .sl-sub { transition-delay: 340ms; }
.sl-card > .sl-steps { transition-delay: 440ms; }
.sl-card > .sl-cta { transition-delay: 650ms; }
.sl-card > .sl-foot { transition-delay: 780ms; }

.sl-card .sl-steps li {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 450ms ease, transform 450ms ease;
}

#soulmates-launcher.sl-in .sl-card .sl-steps li {
  opacity: 1;
  transform: none;
}

.sl-card .sl-steps li:nth-child(1) { transition-delay: 520ms; }
.sl-card .sl-steps li:nth-child(2) { transition-delay: 640ms; }
.sl-card .sl-steps li:nth-child(3) { transition-delay: 760ms; }

@media (prefers-reduced-motion: reduce) {
  .sl-card.sl-stage,
  .sl-card > :not(.sl-card-glow),
  .sl-card .sl-steps li {
    transition-duration: 0.01ms;
    transition-delay: 0ms;
  }
}

/* --------------------------------------------------------------------------
   Cabecera: pastilla de estado + música + logs
   -------------------------------------------------------------------------- */
.sl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
}

.sl-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(26, 6, 17, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(254, 205, 211, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #ffe4e6;
}

.sl-dot {
  position: relative;
  display: flex;
  width: 8px;
  height: 8px;
}

.sl-dot i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.sl-dot i:first-child {
  background: #fb7185;
  opacity: 0.75;
  animation: sl-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.sl-dot i:last-child {
  background: #f43f5e;
  box-shadow: 0 0 8px #f43f5e;
}

@keyframes sl-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.sl-status-text {
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #fecdd3;
}

.sl-status-text b {
  font-weight: 600;
  color: #fff1f2;
}

.sl-spark {
  width: 14px;
  height: 14px;
  color: #fde047;
}

.sl-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sl-icon-btn,
.sl-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 9999px;
  background: rgba(30, 8, 20, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(254, 205, 211, 0.25);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  color: #ffe4e6;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.sl-icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
}

.sl-icon-btn svg {
  width: 16px;
  height: 16px;
  color: #fda4af;
  transition: color 150ms ease;
}

.sl-icon-btn.sl-active {
  background: rgba(127, 29, 29, 0.6);
}

.sl-icon-btn.sl-active svg {
  color: #fde047;
}

.sl-pill-btn {
  padding: 6px 12px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.sl-pill-btn svg {
  width: 14px;
  height: 14px;
  color: #fda4af;
}

.sl-icon-btn:active,
.sl-pill-btn:active {
  transform: scale(0.95);
}

/* --------------------------------------------------------------------------
   Tarjeta glassmorphism
   -------------------------------------------------------------------------- */
.sl-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 24rem;
  margin: 0 auto;
}

.sl-card {
  position: relative;
  width: 100%;
  padding: 24px;
  border-radius: 24px;
  overflow: hidden;
  text-align: center;
  /* Vidrio de verdad: alfa bajo para que el cosmic de detrás se transparente,
     y el `saturate` recupera el color que el blur diluye. Con el alfa viejo
     (0.68/0.78) la tarjeta era prácticamente opaca y el hilo rojo desaparecía
     a su paso. El texto no lo nota: cae sobre zonas oscuras, y cada paso tiene
     su propio vidrio en `.sl-steps li`. */
  background: linear-gradient(135deg, rgba(34, 9, 23, 0.30) 0%, rgba(15, 3, 11, 0.38) 100%);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85),
    0 0 35px -5px rgba(244, 63, 94, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.32),
    inset 0 -1px 1px rgba(244, 63, 94, 0.2);
}

.sl-card-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(32px);
  pointer-events: none;
}

.sl-card-glow-tr {
  top: -3rem;
  right: -3rem;
  width: 8rem;
  height: 8rem;
  background: rgba(244, 63, 94, 0.15);
}

.sl-card-glow-bl {
  bottom: -2.5rem;
  left: -2.5rem;
  width: 8rem;
  height: 8rem;
  background: rgba(245, 158, 11, 0.1);
}

.sl-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 9999px;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.8), rgba(131, 24, 67, 0.7), rgba(127, 29, 29, 0.8));
  border: 1px solid rgba(251, 113, 133, 0.4);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fecdd3;
  margin-bottom: 16px;
}

.sl-badge svg {
  width: 14px;
  height: 14px;
  color: #fb7185;
}

.sl-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(2.25rem, 9vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  background: linear-gradient(180deg, #ffffff 0%, #ffe4e6 45%, #fda4af 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 15px rgba(244, 63, 94, 0.4));
}

.sl-sub {
  margin-top: 8px;
  margin-bottom: 24px;
}

.sl-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(252, 165, 183, 0.9);
}

.sl-initials i {
  font-style: normal;
  color: #f43f5e;
}

.sl-hint {
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 300;
  color: rgba(254, 205, 211, 0.7);
}

/* Pasos guiados */
.sl-steps {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.sl-steps li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(36, 8, 22, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sl-step-num {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(45deg, #be123c, #ec4899);
  box-shadow: 0 4px 10px rgba(127, 29, 29, 0.5);
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.sl-steps li:last-child .sl-step-num {
  background: linear-gradient(45deg, #d97706, #be123c, #ec4899);
}

.sl-step-text {
  padding-top: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  color: #ffe4e6;
}

.sl-step-text b {
  font-weight: 700;
  color: #fff;
}

/* CTA "Iniciar cámara mágica" con borde degradado y shimmer */
.sl-cta {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  text-align: center;
  transition: transform 200ms ease, filter 200ms ease;
}

.sl-cta:disabled {
  cursor: progress;
  filter: grayscale(0.55) brightness(0.75);
}

.sl-cta:focus-visible {
  outline: 2px solid #fb7185;
  outline-offset: 3px;
}

.sl-cta:not(:disabled):active {
  transform: scale(0.98);
}

.sl-cta-border {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(90deg, #f43f5e, #f472b6, #fcd34d);
  opacity: 0.9;
  transition: opacity 200ms ease;
}

.sl-cta:not(:disabled):hover .sl-cta-border {
  opacity: 1;
}

.sl-cta-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  border-radius: 14px;
  background: linear-gradient(90deg, #e11d48, #db2777, #be123c);
  box-shadow: 0 10px 24px -8px rgba(190, 18, 60, 0.7);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
}

.sl-cta-icon {
  width: 20px;
  height: 20px;
  transition: transform 200ms ease;
}

.sl-cta:not(:disabled):hover .sl-cta-icon {
  transform: scale(1.1);
}

.sl-cta-shimmer {
  position: absolute;
  inset: 0;
  width: 50%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transform: skewX(-12deg) translateX(-100%);
  pointer-events: none;
}

.sl-cta:not(:disabled):hover .sl-cta-shimmer {
  animation: sl-shimmer 2.8s infinite;
}

@keyframes sl-shimmer {
  100% {
    transform: skewX(-12deg) translateX(300%);
  }
}

.sl-foot {
  margin-top: 20px;
  padding: 0 4px;
}

.sl-foot .privacy-note {
  font-size: 0.6875rem;
  font-weight: 300;
  line-height: 1.55;
  text-align: center;
  color: rgba(253, 164, 175, 0.6);
}

.sl-quote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: rgba(251, 113, 133, 0.8);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8), 0 0 12px rgba(244, 63, 94, 0.4);
}

/* En pantallas bajas la tarjeta no debe desbordar: se prioriza el CTA. */
@media (max-height: 700px) {
  .sl-card {
    padding: 18px;
  }

  .sl-steps {
    gap: 8px;
    margin-bottom: 18px;
  }

  .sl-sub {
    margin-bottom: 16px;
  }

  .sl-quote {
    display: none;
  }
}
