/* ========================================================
   Insightología - El Ojo de Iberoamérica
   Estilos principales y sistema de capas 16:9
   ======================================================== */

.svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

:root {
  /* Calibración precisa de la bola de cristal (% respecto al #stage 16:9) */
  --ball-x: 44.8%;
  --ball-y: 74.5%;
  --ball-size: 13.2%;

  /* Calibración del tercer ojo y pupila interactiva (% respecto al #stage 16:9) */
  --eye-x: 48.9%;
  --eye-y: 20.8%;
  --eye-size: 8%;

  --pupil-x: 49.596%;
  --pupil-y: 20.370%;
  --pupil-w: 1.641%;
  --pupil-h: 2.407%;

  /* Calibración de posición del gato (% de desplazamiento respecto a la mesa) */
  --cat-offset-x: 28%; /* Más a la derecha sobre la mesa */
  --cat-offset-y: 9.5%; /* Más abajo apoyado en la mesa */

  /* Paleta cromática */
  --color-primary-violet: #2B1E5C;
  --color-pill-bg: #C9CFDA;
  --color-pill-text: #1d1736;
  --color-oracle-light: #F7F4FF;
  --color-oracle-glow: rgba(165, 140, 255, 0.85);
  --color-oracle-credit: #2B1E5C; /* Violeta oscuro institucional de máxima legibilidad */

  /* Tipografía */
  --font-family-base: 'Open Sans', system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #0d0a14;
  font-family: var(--font-family-base);
  color: #ffffff;
}

/* ========================================================
   Cursor personalizado en Desktop (Mística El Ojo)
   ======================================================== */
@media (hover: hover) and (pointer: fine) {
  html,
  body {
    cursor: url('assets/cursor.png') 1 1, url('assets/cursor.webp') 1 1, auto;
  }

  /* Elementos interactivos */
  a,
  button,
  .pill-btn,
  .btn-reset,
  .btn-sound,
  .btn-menu,
  .lang-btn,
  .menu-item-link,
  .modal-about-close,
  .phrase-link {
    cursor: url('assets/cursor.png') 1 1, url('assets/cursor.webp') 1 1, pointer;
  }

  input,
  textarea {
    cursor: text;
  }
}

/* Modo Kiosco (?kiosk=1) */
body.kiosk-mode {
  cursor: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

body.kiosk-mode * {
  cursor: none !important;
}

/* ========================================================
   0. PANTALLA DE CARGA MÍSTICA (Abriendo la mirada...)
   ======================================================== */
.preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #0d0a14 url('assets/fondo-aterciopelado.jpeg') center center / cover no-repeat;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: auto;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.7s;
}

.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
  margin: auto;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.85);
}

.preloader-picture {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.preloader-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.preloader-controls {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  width: min(65%, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}

.preloader-bar-track {
  width: 100%;
  height: 7px;
  background: rgba(18, 10, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: 
    inset 0 1px 3px rgba(0, 0, 0, 0.8),
    0 2px 8px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.preloader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.95);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.preloader-percent {
  margin-top: 8px;
  font-family: var(--font-family-base);
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  text-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(168, 85, 247, 0.85);
}

/* Contenedor padre a pantalla completa que encuadra el stage en 16:9 */
#viewport-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0a14 url('assets/fondo-aterciopelado.jpeg') center center / cover no-repeat;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#viewport-wrapper.is-ready {
  opacity: 1;
}

/* ========================================================
   Stage 16:9 con contenedor de capas
   ======================================================== */
#stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
  margin: auto;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.85);
  /* Origen de transformación anclado al centro de la bola */
  transform-origin: var(--ball-x) var(--ball-y);
  will-change: transform;
}

/* Capas comunes */
.stage-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  display: block;
}

picture.stage-layer {
  display: block;
}

.stage-layer-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  display: block;
}

/* 1. Capa Fondo Escena */
#layer-scene-picture,
#layer-scene {
  z-index: 1;
}

/* Tercer Ojo Interactivo y Pupila 3D (Desktop) */
.third-eye-interactive {
  position: absolute;
  top: var(--pupil-y);
  left: var(--pupil-x);
  width: var(--pupil-w);
  height: var(--pupil-h);
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  perspective: 800px;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.third-eye-pupil {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transform-style: preserve-3d;
  will-change: transform;
}

.third-eye-pupil img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 3px rgba(10, 5, 25, 0.45));
}

/* Destello sutil del Tercer Ojo */
#third-eye-glow {
  position: absolute;
  top: var(--eye-y);
  left: var(--eye-x);
  width: var(--eye-size);
  height: var(--eye-size);
  transform: translate(-50%, -50%);
  z-index: 2;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(160, 220, 255, 0.95) 0%, rgba(99, 102, 241, 0.6) 45%, rgba(67, 56, 202, 0) 75%);
  opacity: 0;
  filter: blur(4px);
  mix-blend-mode: screen;
  will-change: opacity, transform, filter;
}

/* 2. Capa Contenido Bola de Cristal (#ball-content) */
#ball-content {
  position: absolute;
  top: var(--ball-y);
  left: var(--ball-x);
  width: var(--ball-size);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  z-index: 3;
  clip-path: circle(50% at 50% 50%);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: inset 0 0 15px rgba(180, 150, 255, 0.2);
}

/* Efectos de plasma y energía dentro de la bola */
#ball-plasma {
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(220, 195, 255, 0.4) 0%,
    rgba(155, 105, 245, 0.28) 45%,
    rgba(100, 60, 200, 0.12) 75%,
    rgba(40, 20, 90, 0) 100%
  );
  filter: blur(4px);
  mix-blend-mode: screen;
  opacity: 0; /* Totalmente transparente en IDLE para que no se vea el círculo */
  transition: opacity 0.8s ease;
  pointer-events: none;
}

#ball-plasma-core {
  position: absolute;
  width: 50%;
  height: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(180, 150, 255, 0.4) 45%, rgba(90, 50, 180, 0) 80%);
  filter: blur(8px);
  opacity: 0; /* Totalmente transparente en IDLE */
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Canvas de partículas mágicas dentro de la bola */
#particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
}

/* Contenedor de la frase del oráculo */
.phrase-container {
  position: relative;
  z-index: 4;
  width: 76%;
  height: 76%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 4%;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Frase del oráculo: Lexend Tera, All Caps, sutil glow violeta */
.phrase-text {
  font-family: 'Lexend Tera', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  color: #FFFFFF;
  line-height: 1.25;
  letter-spacing: 0.035em;
  text-shadow: 
    0 0 5px rgba(185, 145, 245, 0.85),
    0 0 14px rgba(145, 95, 235, 0.5);
  filter: url(#glass-distortion);
  margin-bottom: 0;
  will-change: transform, opacity, filter;
  max-width: 54%;
  word-break: break-word;
  hyphens: auto;
}

/* Cada palabra o fragmento de la frase */
.phrase-word {
  display: inline-block;
  opacity: 0;
  filter: blur(12px);
  transform: translateY(6px);
  margin: 0 1.5px;
  will-change: opacity, filter, transform;
}

/* Crédito de la frase (Helvetica violeta oscuro nítido y centrado) */
.phrase-credit {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--color-oracle-credit);
  font-size: 2.7px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: none;
  line-height: 1.35;
  margin-top: 3.5px;
  max-width: 68%;
  opacity: 0;
}

/* Enlace "VER MÁS ALLÁ" debajo del crédito */
.phrase-link-wrapper {
  margin-top: 3.0px;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: auto;
  z-index: 10;
  will-change: transform, opacity;
}

.phrase-link-wrapper.visible {
  display: flex;
}

.phrase-link {
  color: var(--color-oracle-credit);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 2.8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 1px;
  text-decoration-thickness: 0.6px;
  background: transparent;
  border: none;
  box-shadow: none;
  text-shadow: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  display: inline-block;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.phrase-link:hover {
  opacity: 0.8;
  transform: scale(1.03);
}

.phrase-link:active {
  transform: scale(0.97);
}

/* 3. Capa Manos y Gato */
#layer-hands-picture,
#layer-hands {
  z-index: 4;
}

#layer-cat {
  z-index: 4;
  pointer-events: none;
  transform: translate(var(--cat-offset-x), var(--cat-offset-y));
  will-change: transform;
  border: none;
  outline: none;
}

/* Botón / Cartel interactivo abajo de la bola, centrado (casi footer): "¿Quién es el insightólogo de turno?" */
.stage-insightologo-btn,
.cat-insightologo-btn {
  position: absolute;
  bottom: 2.8%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(18, 12, 34, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(195, 170, 255, 0.38);
  border-radius: 9999px;
  padding: 6px 18px;
  color: #FFFFFF;
  font-family: 'Lexend Tera', sans-serif;
  font-size: clamp(7px, 0.60vw, 9.5px);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.4s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 14px rgba(150, 110, 240, 0.25);
  user-select: none;
}

.stage-insightologo-btn:hover,
.cat-insightologo-btn:hover {
  background: rgba(43, 30, 92, 0.95);
  border-color: rgba(230, 220, 255, 0.85);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.75), 0 0 22px rgba(180, 140, 255, 0.65);
  transform: translateX(-50%) translateY(-2px);
  color: #FFFFFF;
}

.stage-insightologo-btn:active,
.cat-insightologo-btn:active {
  transform: translateX(-50%) scale(0.96);
}

/* ========================================================
   4. UI Lateral Izquierda (Panel de entrada)
   ======================================================== */
#input-panel {
  position: absolute;
  left: 9.12%;
  top: 55.35%;
  width: 22.08%;
  height: 3.82%;
  z-index: 5;
  display: flex;
  align-items: center;
  pointer-events: auto;
}

/* Chat Input Pill - Calzado perfecto sobre la píldora dibujada del fondo */
.pill-form {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  background-color: transparent;
  border-radius: 9999px;
  padding: 0 4px 0 14px;
  box-sizing: border-box;
  transition: box-shadow 0.25s ease;
}

.pill-form:focus-within {
  box-shadow: 
    0 0 0 2px rgba(43, 30, 92, 0.45),
    0 0 14px rgba(99, 102, 241, 0.35);
}

.pill-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family-base);
  font-size: clamp(11px, 0.95vw, 15px);
  font-weight: 600;
  color: #1a1333;
  padding: 0 4px 0 0;
  min-width: 0;
  height: 100%;
}

.pill-input::placeholder {
  color: rgba(43, 30, 92, 0.55);
  font-weight: 500;
}

.pill-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.pill-btn {
  position: relative;
  height: 80%;
  aspect-ratio: 1 / 1;
  width: auto;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  padding: 0;
  transition: transform 0.15s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.pill-btn svg {
  width: 55%;
  height: 55%;
}

.pill-btn:active {
  transform: scale(0.92);
}

/* Botón Micrófono */
.btn-mic {
  background-color: rgba(43, 30, 92, 0.12);
  color: var(--color-primary-violet);
}

.btn-mic:hover {
  background-color: rgba(43, 30, 92, 0.22);
}

.btn-mic.recording {
  background-color: #ef4444;
  color: #ffffff;
  animation: pulse-recording 1.2s infinite ease-in-out;
}

.btn-mic.hidden-unsupported {
  display: none !important;
}

@keyframes pulse-recording {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* Botón Enviar */
.btn-send {
  background-color: var(--color-primary-violet);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(43, 30, 92, 0.35);
}

.btn-send:hover {
  background-color: #3b2b78;
  transform: scale(1.04);
}

/* Estado de dictado por voz */
.mic-status {
  position: absolute;
  top: 100%;
  left: 14px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary-violet);
  min-height: 16px;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
  transition: opacity 0.2s ease;
}

.mic-status.active {
  opacity: 1;
}

/* ========================================================
   Animación de la pregunta flotando hacia la bola
   ======================================================== */
#floating-question {
  position: absolute;
  top: 50%;
  left: 20%;
  z-index: 6;
  max-width: 320px;
  font-size: clamp(14px, 1.4vw, 20px);
  font-weight: 700;
  color: #ffffff;
  background: rgba(43, 30, 92, 0.75);
  backdrop-filter: blur(8px);
  padding: 10px 18px;
  border-radius: 9999px;
  border: 1px solid rgba(186, 172, 255, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  text-align: center;
  will-change: transform, opacity, filter;
}

/* ========================================================
   Controles durante REVEAL (Botón "Hacer otra pregunta")
   ======================================================== */
#reveal-controls {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#reveal-controls.visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-reset {
  background: rgba(43, 30, 92, 0.85);
  color: #ffffff;
  border: 1px solid rgba(190, 175, 255, 0.45);
  padding: 10px 24px;
  border-radius: 9999px;
  font-family: var(--font-family-base);
  font-size: clamp(12px, 1.1vw, 15px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(120, 80, 220, 0.3);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-reset:hover {
  background: rgba(60, 42, 128, 0.95);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 25px rgba(150, 110, 255, 0.5);
}

.btn-reset:active {
  transform: translateY(0) scale(0.98);
}

/* ========================================================
   Botón Menú Hamburguesa
   ======================================================== */
.btn-menu {
  position: fixed;
  top: max(20px, calc((100vh - (100vw * 9 / 16)) / 2 + 20px));
  left: max(24px, calc((100vw - (100vh * 16 / 9)) / 2 + 24px));
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(190, 175, 255, 0.45);
  background: rgba(30, 20, 60, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #F7F4FF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(120, 80, 220, 0.35);
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.25s ease;
}

.btn-menu:hover {
  background: rgba(50, 35, 95, 0.9);
  transform: scale(1.08);
  border-color: rgba(220, 205, 255, 0.7);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 18px rgba(140, 100, 240, 0.5);
}

.btn-menu:active {
  transform: scale(0.94);
}

/* ========================================================
   Menú Desplegable
   ======================================================== */
.menu-dropdown {
  position: fixed;
  top: max(74px, calc((100vh - (100vw * 9 / 16)) / 2 + 74px));
  left: max(24px, calc((100vw - (100vh * 16 / 9)) / 2 + 24px));
  z-index: 1001;
  background: rgba(24, 15, 48, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(190, 175, 255, 0.4);
  border-radius: 14px;
  padding: 6px;
  min-width: 210px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 18px rgba(120, 80, 220, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.menu-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-item-lang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 10px 12px;
  border-bottom: 1px solid rgba(190, 175, 255, 0.2);
  margin-bottom: 4px;
}

.lang-label {
  font-family: var(--font-family-base);
  font-size: 11px;
  font-weight: 700;
  color: rgba(220, 205, 255, 0.65);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lang-toggle-group {
  display: inline-flex;
  align-items: center;
  background: rgba(14, 9, 30, 0.7);
  border: 1px solid rgba(190, 175, 255, 0.35);
  border-radius: 9999px;
  padding: 2px 4px;
  gap: 2px;
}

.lang-divider {
  color: rgba(190, 175, 255, 0.35);
  font-size: 10px;
  user-select: none;
}

.lang-btn {
  background: transparent;
  border: none;
  color: rgba(220, 210, 245, 0.6);
  font-family: 'Lexend Tera', sans-serif;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
  outline: none;
}

.lang-btn:hover {
  color: #FFFFFF;
}

.lang-btn.is-active {
  background: linear-gradient(135deg, rgba(140, 100, 240, 0.95), rgba(95, 55, 205, 0.95));
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(160, 120, 255, 0.55);
  font-weight: 700;
}

.menu-item-link {
  width: 100%;
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  color: #F7F4FF;
  font-family: var(--font-family-base);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 9px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.menu-item-link:hover {
  background: rgba(140, 100, 240, 0.3);
  color: #FFFFFF;
  text-shadow: 0 0 8px rgba(220, 205, 255, 0.6);
  transform: translateX(3px);
}

/* ========================================================
   Pop up / Modal "¿Qué estoy viendo?"
   ======================================================== */
.modal-about {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0a14 url('assets/fondo-aterciopelado.jpeg') center center / cover no-repeat;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal-about.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-about-stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
  background: url('assets/desk-insight.webp') center center / cover no-repeat;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: clamp(20px, 3vh, 35px);
  padding-bottom: clamp(40px, 9vh, 80px);
  padding-left: clamp(20px, 4vw, 40px);
  padding-right: clamp(20px, 4vw, 40px);
  box-sizing: border-box;
  overflow-y: auto;
}

.modal-about-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: clamp(340px, 39vw, 680px);
  margin: auto;
}

.modal-about-close {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 6px;
  margin-left: -6px;
  margin-bottom: clamp(10px, 1.8vh, 18px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.modal-about-close:hover {
  opacity: 1;
  transform: scale(1.15);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.85));
}

.modal-about-close:active {
  transform: scale(0.95);
}

.modal-about-title {
  font-family: 'Lexend Tera', sans-serif;
  font-size: clamp(13px, 1.25vw, 19px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #FFFFFF;
  text-align: center;
  margin: 0 0 clamp(16px, 2.6vh, 28px) 0;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.75), 0 0 22px rgba(255, 255, 255, 0.4);
}

.modal-about-body {
  font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif;
  font-size: clamp(10.5px, 0.82vw, 13.5px);
  line-height: 1.58;
  color: #FFFFFF;
  text-align: left;
}

.modal-about-body p {
  margin: 0 0 1.25em 0;
}

.modal-about-body p:last-child {
  margin-bottom: 0;
}

/* Modal específico de Insightólogos */
/* Modal específico de Insightólogos */
.modal-insightologo-stage {
  align-items: center;
  justify-content: center;
  padding-top: clamp(24px, 4vh, 40px);
  padding-bottom: clamp(30px, 5vh, 50px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-insightologo-content {
  margin: auto;
  width: 100%;
}

.insightologo-single-card {
  width: 100%;
  text-align: left;
}

.insightologo-item-header {
  font-family: 'Lexend Tera', sans-serif;
  font-size: clamp(12px, 1.05vw, 15px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #FFFFFF;
  margin-bottom: clamp(10px, 1.6vh, 16px);
  text-shadow: 0 0 8px rgba(220, 205, 255, 0.45);
  text-align: left;
}

.insightologo-item-bio {
  font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif;
  font-size: clamp(10.5px, 0.82vw, 13px);
  line-height: 1.58;
  color: #FFFFFF;
  text-align: left;
  margin: 0;
}

.insightologo-reload-hint {
  font-family: 'Lexend Tera', sans-serif;
  font-size: clamp(8px, 0.65vw, 10.5px);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(220, 205, 255, 0.82);
  text-align: center;
  margin-top: clamp(22px, 3.6vh, 36px);
  padding-top: clamp(14px, 2.2vh, 20px);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  width: 100%;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease, text-shadow 0.2s ease;
  user-select: none;
}

.insightologo-reload-hint:hover {
  color: #FFFFFF;
  text-shadow: 0 0 10px rgba(185, 145, 255, 0.7);
  transform: translateY(-1px);
}

/* ========================================================
   Control de Audio (Mute / Unmute)
   ======================================================== */
.btn-sound {
  position: fixed;
  top: max(20px, calc((100vh - (100vw * 9 / 16)) / 2 + 20px));
  right: max(24px, calc((100vw - (100vh * 16 / 9)) / 2 + 24px));
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(190, 175, 255, 0.45);
  background: rgba(30, 20, 60, 0.75);
  backdrop-filter: blur(10px);
  color: #F7F4FF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(120, 80, 220, 0.35);
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn-sound:hover {
  background: rgba(50, 35, 95, 0.9);
  transform: scale(1.08);
  border-color: rgba(220, 205, 255, 0.7);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 18px rgba(140, 100, 240, 0.5);
}

.btn-sound:active {
  transform: scale(0.94);
}

.btn-sound.muted {
  color: rgba(220, 210, 240, 0.45);
  border-color: rgba(140, 130, 180, 0.3);
  background: rgba(20, 15, 35, 0.65);
}

/* Prompt para permiso de giroscopio en mobile / iOS (completamente oculto en desktop) */
.gyro-permission-prompt {
  display: none !important;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  pointer-events: none;
}

/* ========================================================
   Mobile Layout Responsive (9:16 Portrait)
   ======================================================== */
@media (max-width: 768px), (orientation: portrait) {
  :root {
    /* Calibración precisa para la composición mobile 9:16 */
    --ball-x: 40.28%;
    --ball-y: 82.81%;
    --ball-size: 27.31%;

    --eye-x: 48.33%;
    --eye-y: 40.26%;
    --eye-size: 14%;

    /* Pupila en mobile 9:16 */
    --pupil-x: 49.144%;
    --pupil-y: 44.635%;
    --pupil-w: 3.009%;
    --pupil-h: 1.406%;
  }

  #viewport-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .preloader-stage {
    width: min(100vw, calc(100vh * 9 / 16));
    width: min(100vw, calc(100dvh * 9 / 16));
    height: min(100vh, calc(100vw * 16 / 9));
    height: min(100dvh, calc(100vw * 16 / 9));
    aspect-ratio: 9 / 16;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
  }

  .preloader-controls {
    bottom: 11%;
    width: min(72%, 260px);
  }

  #stage {
    position: relative;
    width: min(100vw, calc(100vh * 9 / 16));
    width: min(100vw, calc(100dvh * 9 / 16));
    height: min(100vh, calc(100vw * 16 / 9));
    height: min(100dvh, calc(100vw * 16 / 9));
    aspect-ratio: 9 / 16;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    margin: auto;
    overflow: hidden;
    transform-origin: var(--ball-x) var(--ball-y);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
  }

  .stage-layer,
  .stage-layer-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
  }

  /* Ocultar gato y su botón interactivo en mobile según el mockup provisto */
  #layer-cat,
  .cat-insightologo-btn,
  .stage-insightologo-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Posición exacta del input sobre la píldora dibujada en el fondo mobile */
  #input-panel {
    position: absolute;
    left: 22.55%;
    top: 30.91%;
    width: 57.50%;
    height: 3.26%;
    max-width: none;
    transform: none;
    z-index: 5;
    background: transparent;
    padding: 0;
    border-radius: 9999px;
    box-shadow: none;
  }

  .pill-form {
    padding: 0 4px 0 10px;
  }

  .pill-input {
    font-size: clamp(9px, 2.55vw, 11.5px);
    padding: 0 2px 0 0;
  }

  .pill-actions {
    gap: 3px;
  }

  .pill-btn {
    height: 72%;
  }

  .pill-btn svg {
    width: 48%;
    height: 48%;
  }

  /* Respuestas más compactas en mobile para que no las tapen los dedos de las manos */
  .phrase-container {
    width: 66%;
    height: 75%;
    padding: 0 4%;
  }

  .phrase-text {
    line-height: 1.25;
    margin-bottom: 0;
    letter-spacing: 0.03em;
    max-width: 82%;
  }

  .phrase-credit {
    font-size: 2.3px;
    line-height: 1.32;
    margin-top: 3.0px;
    max-width: 80%;
    letter-spacing: 0.03em;
    text-shadow: none;
  }

  .phrase-link-wrapper {
    margin-top: 2.6px;
  }

  .phrase-link {
    font-size: 2.4px;
    letter-spacing: 0.05em;
    text-underline-offset: 1px;
    text-decoration-thickness: 0.5px;
    background: transparent;
    border: none;
    box-shadow: none;
    text-shadow: none;
    padding: 0;
  }

  .btn-menu {
    top: max(16px, calc((100vh - (100vw * 16 / 9)) / 2 + 16px));
    left: max(16px, calc((100vw - (100vh * 9 / 16)) / 2 + 16px));
    width: 40px;
    height: 40px;
  }

  .menu-dropdown {
    top: max(64px, calc((100vh - (100vw * 16 / 9)) / 2 + 64px));
    left: max(16px, calc((100vw - (100vh * 9 / 16)) / 2 + 16px));
  }

  .modal-about-stage {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    aspect-ratio: unset;
    padding-top: clamp(30px, 8vh, 60px);
    padding-bottom: 30px;
    padding-left: 20px;
    padding-right: 20px;
    background-position: center top;
  }

  .modal-about-content {
    max-width: 90%;
  }

  .modal-about-title {
    font-size: clamp(13px, 4vw, 17px);
    letter-spacing: 0.06em;
  }

  .modal-about-body {
    font-size: clamp(12px, 3.4vw, 14px);
    line-height: 1.52;
  }

  .third-eye-interactive {
    display: flex !important;
    top: var(--pupil-y);
    left: var(--pupil-x);
    width: var(--pupil-w);
    height: var(--pupil-h);
  }

  /* Prompt para permiso de giroscopio en mobile / iOS */
  .gyro-permission-prompt {
    display: none !important;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: gyroPillFloat 3s ease-in-out infinite alternate;
  }

  .gyro-permission-prompt.is-visible {
    display: flex !important;
    pointer-events: auto;
  }

  .btn-gyro-permission {
    background: rgba(43, 30, 92, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(190, 175, 255, 0.55);
    color: #FFFFFF;
    font-family: var(--font-family-base);
    font-size: 12.5px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55), 0 0 16px rgba(140, 100, 240, 0.45);
    letter-spacing: 0.02em;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  }

  .btn-gyro-permission:active {
    transform: scale(0.96);
  }

  @keyframes gyroPillFloat {
    0% { transform: translateX(-50%) translateY(0); }
    100% { transform: translateX(-50%) translateY(-5px); }
  }

  .btn-sound {
    top: max(16px, calc((100vh - (100vw * 16 / 9)) / 2 + 16px));
    right: max(16px, calc((100vw - (100vh * 9 / 16)) / 2 + 16px));
    width: 40px;
    height: 40px;
  }

  #reveal-controls {
    bottom: max(20px, calc((100vh - (100vw * 16 / 9)) / 2 + 20px));
  }
}

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

  .phrase-text {
    filter: none !important;
  }
}
