/* =====================================================
   ORÁCULO WHITESUR - PROYECTO 7.41
   Fusión: Glassmorphism Apple Music Style + Misticismo
===================================================== */

@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

:root {
  /* GLASSMORPHISM - Ajustado para fondos dinámicos claros */
  --glass-surface: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-blur: 35px;
  --shadow-soft: 0 12px 42px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.15);

  /* TIPOGRAFÍA - Ajustada a oscuro para legibilidad sobre cristal claro */
  --text-primary: #1d1d1f;
  --text-secondary: #424245;
  --text-tertiary: rgba(0, 0, 0, 0.5);

  /* ANIMACIONES - Basadas en principios de Apple HIG */
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  /* Ease out suave */
  --ease-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  /* Rebote sutil */
  --ease-natural: cubic-bezier(0.4, 0, 0.2, 1);
  /* Material Design */

  /* Variables para colores dinámicos del fondo */
  --color1: #ffffff;
  --color2: #ffffff;
  --color3: #ffffff;
  --color4: #ffffff;

  /* Color de keyword - basado en la paleta de la carta */
  --keyword-color: #ffeb3b;

  /* GYROSCOPE - Variables actualizadas dinámicamente por JavaScript */
  --gyro-x: 0;
  --gyro-y: 0;
  --gyro-z: 0;
  --gyro-hue: 0deg;
}

* {
  box-sizing: border-box;
}

/* Eliminar outline azul de selección (Requerimiento del usuario) */
*,
*:focus,
*:active,
button:focus,
button:active,
a:focus,
a:active,
div:focus,
div:active,
[tabindex]:focus,
[tabindex]:active,
*:focus-visible,
.card-stage,
.card-stage:focus,
.card-stage:active,
.card-inner,
.card-inner:focus,
.card-inner:active {
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-overflow-scrolling: touch;
}

/* BLOQUEO DE SCROLL HASTA QUE LA CARTA SE REVELE */
body.no-scroll {
  overflow: hidden;
  /* Evita el scroll en el body */
  position: fixed;
  /* Previene que se mueva el contenido en iOS */
  width: 100%;
  /* Mantiene el ancho */
}

/* ==================== WALLPAPER DINÁMICO ESTILO APPLE MUSIC LÍQUIDO ==================== */
.wallpaper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  /* Inicia en blanco */
  z-index: -2;
  overflow: hidden;
  /* Contiene las manchas de color */
  transition: background-color 0.8s var(--ease-smooth);
}

.wallpaper.active {
  /* Un ligero tinte cuando está activo para mejorar el efecto */
  background: #f9f9f9;
}

/* Manchas de color (Blobs) */
.blob {
  position: absolute;
  border-radius: 50%;
  /* El blur intenso crea el efecto líquido/borroso. Ajustado para ser muy fluido. */
  filter: blur(135px);
  opacity: 0;
  /* Transición suave al aparecer */
  transition: opacity 1.5s ease-in-out;
  width: 65vmax;
  height: 65vmax;
  /* Mejora la mezcla de colores sobre fondo claro */
  mix-blend-mode: multiply;
}

.wallpaper.active .blob {
  /* Opacidad ajustada para un efecto sutil */
  opacity: 0.7;
}

/* Asignación de colores dinámicos y animaciones únicas */
.blob1 {
  background: var(--color1);
  animation: move1 28s ease-in-out infinite alternate;
}

.blob2 {
  background: var(--color2);
  animation: move2 32s ease-in-out infinite alternate;
}

.blob3 {
  background: var(--color3);
  animation: move3 38s ease-in-out infinite alternate;
}

.blob4 {
  background: var(--color4);
  animation: move4 42s ease-in-out infinite alternate;
}

/* Keyframes para movimiento lento y orgánico */
@keyframes move1 {
  from {
    transform: translate(-20%, -20%) scale(1) rotate(0deg);
  }

  to {
    transform: translate(30%, 40%) scale(1.4) rotate(360deg);
  }
}

@keyframes move2 {
  from {
    transform: translate(50%, -30%) scale(1.2) rotate(0deg);
  }

  to {
    transform: translate(-20%, 60%) scale(0.9) rotate(-360deg);
  }
}

@keyframes move3 {
  from {
    transform: translate(70%, 70%) scale(0.9) rotate(0deg);
  }

  to {
    transform: translate(10%, -10%) scale(1.5) rotate(360deg);
  }
}

@keyframes move4 {
  from {
    transform: translate(-10%, 80%) scale(1.1) rotate(0deg);
  }

  to {
    transform: translate(60%, -20%) scale(1) rotate(-360deg);
  }
}

/* ==================== IRIDESCENT BORDER EFFECTS (iOS 26 Style) ==================== */

/* Rainbow gradient animation for borders */
/* Chromatic aberration doesn't need animated gradients */

/* Base iridescent border effect - CHROMATIC ABERRATION STYLE */
.iridescent-border {
  position: relative;
  isolation: isolate;
}

/* RED CHANNEL - offset right/up slightly */
.iridescent-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  filter: hue-rotate(0deg) blur(0.4px) brightness(1.3);
  mix-blend-mode: screen;
  opacity: 0.7;
  transform: translate(
    calc(2px + var(--gyro-x) * 0.03px),
    calc(1px + var(--gyro-y) * 0.03px)
  );
  /* Radial mask: relaxed for more visibility */
  -webkit-mask: radial-gradient(circle at center, transparent 70%, black 100%);
  mask: radial-gradient(circle at center, transparent 70%, black 100%);
  pointer-events: none;
  z-index: -1;

  /* GPU acceleration */
  will-change: transform, filter;
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* GREEN/BLUE CHANNEL - offset left/down slightly */
.iridescent-border::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  filter: hue-rotate(180deg) blur(0.4px) brightness(1.3);
  mix-blend-mode: screen;
  opacity: 0.6;
  transform: translate(
    calc(-2px - var(--gyro-x) * 0.03px),
    calc(-1px - var(--gyro-y) * 0.03px)
  );
  /* Radial mask: relaxed for more visibility */
  -webkit-mask: radial-gradient(circle at center, transparent 70%, black 100%);
  mask: radial-gradient(circle at center, transparent 70%, black 100%);
  pointer-events: none;
  z-index: -1;

  /* GPU acceleration */
  will-change: transform, filter;
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Hover: increase brightness and intensity even more */
.iridescent-border:hover::before {
  opacity: 0.9;
  filter: hue-rotate(0deg) blur(0.3px) brightness(1.8);
}

.iridescent-border:hover::after {
  opacity: 0.8;
  filter: hue-rotate(180deg) blur(0.3px) brightness(1.8);
}

/* Subtle variant for small elements (buttons) */
.iridescent-border-subtle::before {
  /* Smaller offset for subtle effect */
  transform: translate(
    calc(0.5px + var(--gyro-x) * 0.01px),
    calc(0.25px + var(--gyro-y) * 0.01px)
  );
  opacity: 0.2;
  filter: hue-rotate(0deg) blur(0.3px);
  /* Tighter mask for smaller elements */
  -webkit-mask: radial-gradient(circle at center, transparent 85%, black 100%);
  mask: radial-gradient(circle at center, transparent 85%, black 100%);
}

.iridescent-border-subtle::after {
  /* Opposite offset */
  transform: translate(
    calc(-0.5px - var(--gyro-x) * 0.01px),
    calc(-0.25px - var(--gyro-y) * 0.01px)
  );
  opacity: 0.15;
  filter: hue-rotate(180deg) blur(0.3px);
  /* Tighter mask for smaller elements */
  -webkit-mask: radial-gradient(circle at center, transparent 85%, black 100%);
  mask: radial-gradient(circle at center, transparent 85%, black 100%);
}

.iridescent-border-subtle:hover::before {
  opacity: 0.35;
}

.iridescent-border-subtle:hover::after {
  opacity: 0.25;
}

/* CAPA DE TEXTURA - Efecto "papel antiguo" muy sutil */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="300" height="300" filter="url(%23n)" opacity="0.05"/></svg>');
  opacity: 0.08;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* ==================== INTERFACE PRINCIPAL ==================== */
.interface {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* MEJORAR CENTRADO VERTICAL PARA MINIMIZAR SCROLL */
  justify-content: center;
  /* Centra verticalmente cuando no hay scroll */
  /* Eliminada min-height: 100vh para evitar espacio innecesario */
  gap: 40px;
  width: 100%;
  max-width: 1400px;
  padding: 40px 20px;
  margin: 0 auto;
}

/* Cuando la carta está revelada, volver a flex-start para permitir scroll normal */
.interface.revealed {
  justify-content: flex-start;
}

/* ==================== CARTA - ZONA INTERACTIVA ==================== */
.card-stage {
  perspective: 1800px;
  width: 282px;
  /* Adjusted for 9:16 Aspect Ratio (approx) */
  height: 500px;
  cursor: pointer;
  z-index: 10;
  margin-top: 20px;
  flex-shrink: 0;
  transform-style: preserve-3d;
  animation: breathe 4s ease-in-out infinite;

  /* PREVENIR SCROLL AL INTERACTUAR CON LA CARTA */
  touch-action: none;
  /* Previene el comportamiento de scroll predeterminado en touch devices */
  overscroll-behavior: contain;
  /* Evita que el scroll se propague al contenedor padre */
  -webkit-user-select: none;
  user-select: none;
}

/* Breathing stops on hover to not interfere with tilt */
.card-stage:hover {
  animation-play-state: paused;
}

.card-stage.flipped {
  /* Flip state handled via variables */
  --flip-angle: 180deg;
}

/* CONTENEDOR INTERNO 3D - Maneja inclinación y volteo */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;

  /* Default: Fast transition for tilt responsiveness */
  transition: transform 0.1s ease-out;

  /* Combine Tilt (rx, ry) and Flip (flip-angle 0 or 180) */
  transform: rotateX(var(--rotate-x, 0deg))
    rotateY(calc(var(--rotate-y, 0deg) + var(--flip-angle, 0deg)));
}

/* Slow transition only when flipping */
.card-inner.is-flipping {
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 26px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  /* Fix for Safari handling of overflow with 3D */
  transform: translateZ(0);
}

/* GLARE EFFECT (Iluminación dinámica) */
.card-face::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at var(--glare-x, 50%) var(--glare-y, 50%),
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0) 60%
  );
  opacity: var(--glare-opacity, 0);
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.2s ease;
}

/* DORSO - Gradiente Púrpura/Índigo solicitado */
.front {
  /* Implementación de: bg-gradient-to-br from-purple-900/20 to-indigo-900/20 */
  /* Y radial-gradient(circle at 30% 30%, rgba(147, 51, 234, 0.1) 0%, transparent 50%) */

  background-image: radial-gradient(
      circle at 30% 30%,
      rgba(147, 51, 234, 0.15) 0%,
      transparent 50%
    ),
    linear-gradient(
      to bottom right,
      rgba(147, 51, 234, 0.25),
      rgba(79, 70, 229, 0.25)
    );

  /* backdrop-blur-sm (aproximadamente 8px) */
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);

  border: 1.5px solid rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.keyword-highlight {
  position: relative;
  display: inline-block;
  padding: 2px 1px;
  font-weight: 800;

  /* TRANSPARENT TEXT - wallpaper colors show through */
  color: transparent;
  background: inherit;
  /* Inherit wallpaper background */
  -webkit-background-clip: text;
  background-clip: text;

  /* Subtle outline to define letter edges */
  -webkit-text-stroke: 0.3px rgba(255, 255, 255, 0.3);
  text-stroke: 0.3px rgba(255, 255, 255, 0.3);

  /* Allow blend with wallpaper */
  mix-blend-mode: normal;

  transition: all 0.3s ease;
}

/* Hover: Slightly stronger outline */
.keyword-highlight:hover {
  -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.5);
  text-stroke: 0.5px rgba(255, 255, 255, 0.5);
  transform: scale(1.03);
}

/* NO pseudo-elementos (sin esferas ni brillos extras) */
.keyword-highlight::before,
.keyword-highlight::after {
  content: none !important;
  display: none !important;
}

/* Símbolo lunar central - Ajustado para el nuevo fondo */
.symbol {
  width: 70px;
  height: 70px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* ANVERSO - La revelación */
.back {
  /* Fondo tipo cristal claro para la carta revelada */
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: rotateY(180deg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  overflow: hidden;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tarot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  /* ELIMINACIÓN DE FONDO BLANCO (Importante si las imágenes lo tienen) */
  mix-blend-mode: darken;
  filter: contrast(1.1) saturate(1.1) brightness(1.05);
  transition: transform 4s var(--ease-smooth);
}

/* Efecto zoom al revelar */
.card-stage.flipped .tarot-img {
  transform: scale(1.02);
}

@media (max-width: 600px) {
  .card-slot {
    width: 45px;
    height: 72px;
  }

  .progress-text {
    font-size: 12px;
  }
}

/* ==================== PANEL DE LECTURA ==================== */
/* Estilo Apple Music Lyrics */
.insight-panel {
  width: 92%;
  max-width: 720px;
  background: rgba(245, 245, 245, 0.45);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border-radius: 22px;
  padding: 32px 42px 36px;
  border: 1.5px solid var(--glass-border);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* Estado inicial: invisible */
  opacity: 0;
  transform: translateY(25px) scale(0.96);
  transition: all 0.9s var(--ease-smooth);
  text-align: left;
  pointer-events: none;
  z-index: 5;
  margin-bottom: 60px;
  flex-shrink: 0;
}

.insight-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* TÍTULO Y TEXTOS - AJUSTADOS PARA LECTURA SOBRE CRISTAL CLARO */

h2 {
  margin: 0 0 22px 0;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-primary);
  /* Efecto de texto "grabado" sutil en lugar de shimmer brillante */
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
  animation: fadeSlideIn 0.6s var(--ease-smooth) 0.2s both;
}

/* SECCIONES DE CONTENIDO */
.section {
  margin-bottom: 24px;
  animation: fadeSlideIn 0.7s var(--ease-smooth) both;
}

.section:nth-child(2) {
  animation-delay: 0.3s;
}

.section:nth-child(3) {
  animation-delay: 0.4s;
}

.section:nth-child(4) {
  animation-delay: 0.5s;
}

.section:nth-child(5) {
  animation-delay: 0.6s;
}

.section:nth-child(6) {
  animation-delay: 0.7s;
}

.section:nth-child(7) {
  animation-delay: 0.8s;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.section-title:hover {
  color: var(--accent-primary);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.section-title::after {
  content: ">";
  opacity: 0.6;
  font-weight: 300;
  font-size: 0.75em;
  transition: opacity 0.2s ease;
}

.section-title:hover::after {
  opacity: 0.9;
  color: var(--accent-primary);
}

.intro-section {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 0 0 24px 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fadeSlideIn 0.6s ease-out;
}

.intro-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
  text-align: justify;
}

.intro-text em {
  color: var(--accent-primary);
  font-weight: 500;
  font-style: italic;
}

.section-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-weight: 400;
  margin: 0;
}

.biblical-verse {
  font-style: italic;
  border-left: 2px solid rgba(0, 0, 0, 0.2);
  padding-left: 16px;
  margin-top: 6px;
  color: var(--text-secondary);
}

.verse-reference {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-style: normal;
  text-align: right;
}

/* ==================== FLOATING STARS (APPLE-STYLE MAGNETIC SCROLL) ==================== */
.floating-star {
  position: fixed;
  width: 12px;
  height: 12px;
  pointer-events: none;
  z-index: 1;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.floating-star::before,
.floating-star::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 1.5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.9) 50%,
    transparent 100%
  );
  transform: translate(-50%, -50%);
  filter: blur(0.3px);
}

.floating-star::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.floating-star {
  filter: drop-shadow(0 0 2px rgba(255, 235, 59, 0.6))
    drop-shadow(0 0 4px rgba(255, 235, 59, 0.3));
  animation: starTwinkle 2s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes starTwinkle {
  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.8;
  }
}

/* ==================== MODAL GLASSMORPHISM BLANCO ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: modalFadeIn 0.3s ease-out;
  padding: 20px;
}

.modal-content {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: 700px;
  width: 100%;
  /* FIX SCROLL: Limitar altura y usar flex column */
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 24px 28px 20px 28px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Header no se encoge */
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: #2c2c2c;
}

.ai-btn {
  /* El botón es el MICROCOSMOS: Refleja los colores del MACROCOSMOS (Fondo) */
  background: linear-gradient(
    135deg,
    var(--color1, #ffffff),
    var(--color2, #e0e0e0)
  );
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #2c2c2c;
}

.modal-body {
  padding: 24px 28px;
  /* SCROLLABLE */
  overflow-y: auto;
  flex-grow: 1;
}

.modal-body p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
  text-align: justify;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.modal-footer {
  padding: 16px 28px 28px 28px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: right;
}

.modal-footer small {
  font-size: 0.9rem;
  color: #666;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apple Music-style letter reveal with white fill */
@keyframes letterReveal {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    filter: blur(3px);
  }

  50% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* White fill animation */
@keyframes whiteFill {
  from {
    color: rgba(0, 0, 0, 0.3);
  }

  to {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6),
      0 0 12px rgba(255, 255, 255, 0.3);
  }
}

/* Class for animating letters individually */
.letter-animate {
  display: inline-block;
  opacity: 0;
  animation: letterReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-play-state: paused;
}

.letter-animate.reveal {
  animation-play-state: running;
}

/* Apply white fill after reveal */
.letter-animate.reveal.fill {
  animation: letterReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    whiteFill 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

/* TEXTO DE LECTURA */
p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-weight: 400;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .card-stage {
    width: 260px;
    height: 460px;
  }

  .insight-panel {
    width: 90%;
    max-width: 600px;
  }

  .blob {
    filter: blur(90px);
  }
}

@media (max-width: 768px) {
  .card-stage {
    width: 236px;
    height: 420px;
  }

  .insight-panel {
    width: 94%;
    max-width: 500px;
    padding: 22px 28px;
  }

  h2 {
    font-size: 1.1rem;
  }

  p,
  .section-content {
    font-size: 0.92rem;
    line-height: 1.65;
  }

  .blob {
    filter: blur(70px);
  }
}

@media (max-width: 480px) {
  .card-stage {
    width: 220px;
    height: 390px;
  }

  .insight-panel {
    width: 96%;
    padding: 18px 24px;
    max-width: 400px;
  }

  h2 {
    font-size: 1rem;
    letter-spacing: 1px;
    margin-bottom: 12px;
  }

  p,
  .section-content {
    font-size: 0.88rem;
  }
}

@media (max-width: 360px) {
  .card-stage {
    width: 180px;
    height: 320px;
  }

  .insight-panel {
    width: 98%;
    padding: 16px 20px;
  }

  h2 {
    font-size: 0.95rem;
  }

  p,
  .section-content {
    font-size: 0.85rem;
  }
}

/* ==================== ACCESIBILIDAD ==================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .blob {
    animation: none !important;
  }
}

/* ==================== APPLE MUSIC READING EFFECT ==================== */

.reading-unit {
  opacity: 0.35;
  filter: blur(1.5px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: inline-block;
  /* Or block depending on flow */
}

.reading-unit.active {
  opacity: 1;
  filter: blur(0);
}

/* ==================== KEYWORD HIGHLIGHTING - FIXED TRANSPARENCY ==================== */

/* Keywords: "Crystal" effect allowing background blobs to show through */
.keyword-highlight {
  /* TRANSPARENT TEXT - wallpaper shows through */
  color: transparent;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;

  font-weight: 700;
  position: relative;
  display: inline-block;

  /* Subtle outline */
  -webkit-text-stroke: 0.3px rgba(255, 255, 255, 0.3);
  text-stroke: 0.3px rgba(255, 255, 255, 0.3);

  mix-blend-mode: normal;
  transition: all 0.5s ease;
}

/* Filled/Active state - same transparent */
.keyword-highlight.filled {
  -webkit-text-stroke: 0.4px rgba(255, 255, 255, 0.4);
  text-stroke: 0.4px rgba(255, 255, 255, 0.4);
}

.keyword-highlight:hover {
  transform: scale(1.05);
  -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.5);
  text-stroke: 0.5px rgba(255, 255, 255, 0.5);
}

/* ==================== ESTILOS BOTÓN IA ==================== */
.ai-synthesis-container {
  margin-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.ai-btn {
  /* El botón es el MICROCOSMOS: Refleja los colores del MACROCOSMOS (Fondo) */
  /* Fondo base translúcido para las mini-blobs */
  background: rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Mini-blob 1 - Movimiento lento */
.ai-btn::before {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color1, #ffd1dc);
  filter: blur(25px);
  mix-blend-mode: multiply;
  opacity: 0.6;
  top: -20px;
  left: -10px;
  animation: microMove1 12s ease-in-out infinite alternate;
  z-index: 1;
}

/* Mini-blob 2 - Movimiento diferente */
.ai-btn::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--color2, #b8e0ff);
  filter: blur(20px);
  mix-blend-mode: multiply;
  opacity: 0.5;
  bottom: -15px;
  right: -10px;
  animation: microMove2 14s ease-in-out infinite alternate;
  z-index: 1;
}

.ai-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.ai-btn:active {
  transform: scale(0.95);
}

.ai-btn:disabled {
  opacity: 0.7;
  cursor: wait;
  filter: grayscale(0.5);
}

/* Icono dentro del botón (opcional, o solo el color) */
.ai-btn-icon {
  position: relative;
  z-index: 2;
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: transform 0.5s ease;
}

/* Estado "Pensando" (Microcosmo activo) */
.ai-btn.thinking {
  animation: liquidButton 2s ease infinite, pulseMicro 1.5s ease-in-out infinite;
  cursor: wait;
}

.ai-btn.thinking .ai-btn-icon {
  animation: spinStar 2s linear infinite;
}

@keyframes pulseMicro {
  0% {
    transform: scale(1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }

  50% {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.6);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
}

@keyframes spinStar {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Animaciones micro para las mini-blobs del botón */
@keyframes microMove1 {
  from {
    transform: translate(-5px, -5px) scale(1);
  }

  to {
    transform: translate(10px, 8px) scale(1.2);
  }
}

@keyframes microMove2 {
  from {
    transform: translate(8px, -6px) scale(0.9);
  }

  to {
    transform: translate(-7px, 10px) scale(1.1);
  }
}

.ai-result {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  animation: fadeSlideIn 0.5s ease-out;
}

.ai-header {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  /* Negro/Oscuro */
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 8px;
}

.ai-result p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-style: italic;
}

/* BOTÓN DE IDIOMA (TOP-RIGHT, MINIMALIST) */
.lang-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: transparent;
  border: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.lang-btn:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.lang-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Social Buttons */
.social-btn {
  position: fixed;
  right: 30px;
  width: 56px;
  height: 56px;
  /* Ajustado al nuevo estilo glassmorphism */
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.instagram-btn {
  display: none;
}

.patreon-btn {
  bottom: 30px;
}

.social-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.8);
}

.social-btn svg {
  transition: transform 0.3s ease;
}

.social-btn:hover svg {
  transform: scale(1.1);
}

/* Ajuste específico para el logo de Patreon que suele ser más pequeño visualmente */
.patreon-btn svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .social-btn {
    right: 20px;
    width: 48px;
    height: 48px;
  }

  .instagram-btn {
    bottom: 20px;
  }

  .patreon-btn {
    bottom: 80px;
    /* 20px + 48px + 12px gap */
  }

  .social-btn svg {
    width: 28px;
    height: 28px;
  }

  .patreon-btn svg {
    width: 22px;
    height: 22px;
  }
}
