/* ═══════════════════════════════════════════
   IO · INTERLOCUCIÓN ESTRUCTURAL
   pantallas.css — Sistema visual completo
   Construido desde io_sistema.html (base probada)
   Selectores verificados contra chat.js y index.html
   Mobile-first · Celular + tablet
   2026
   ═══════════════════════════════════════════ */


/* ══════════════════════════════════════════
   1. SISTEMA DE PANTALLAS
   ══════════════════════════════════════════ */

.pantalla {
  display: none;
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pantalla.activa {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Atmósfera */
.pantalla.activa::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 80%  8%, rgba(6,148,148,0.052) 0%, transparent 52%),
    radial-gradient(ellipse at  8% 90%, rgba(201,165,90,0.038) 0%, transparent 48%);
  pointer-events: none;
  z-index: 0;
}

/* Grano */
.pantalla.activa::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.022'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* Transiciones */
.pantalla.saliendo {
  display: flex;
  animation: pantallaSalir 0.6s ease forwards;
}
.pantalla.entrando {
  animation: pantallaEntrar 1.2s ease forwards;
}
@keyframes pantallaSalir {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}
@keyframes pantallaEntrar {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════
   2. CHROME GLOBAL
   ══════════════════════════════════════════ */

.io-marca-mini {
  position: fixed;
  top: 16px; left: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.io-marca-mini.visible {
  opacity: 1;
  pointer-events: auto;
}

.mini-logo-ring {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(11,21,32,0.85);
  backdrop-filter: blur(8px);
}
.mini-logo-ring::after {
  content: '';
  position: absolute;
  top: -3px; left: 50%;
  transform: translateX(-50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--oro);
  box-shadow: 0 0 6px var(--oro-glow);
}

.btn-volver {
  position: fixed;
  top: 14px; right: 20px;
  z-index: 100;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, color 0.2s ease;
}
.btn-volver.visible {
  opacity: 1;
  pointer-events: auto;
}
.btn-volver:hover { color: var(--text); }


/* ══════════════════════════════════════════
   3. PANTALLA ENTRADA
   ══════════════════════════════════════════ */

/* La pantalla llena el viewport completo sin restricción de ancho */
#entrada.pantalla.activa {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* Cada sección se centra con max-width propio */
#entrada .logo-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 0;
  box-sizing: border-box;
  margin-top: clamp(40px, 8vh, 72px);
  margin-bottom: clamp(28px, 5vh, 48px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#entrada .texto-entrada {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 0 26px;
  box-sizing: border-box;
  flex: 1;
}

#entrada .botones-entrada {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 0 26px clamp(28px, 5vh, 48px);
  box-sizing: border-box;
  flex-shrink: 0;
}

/* ─── Logo SVG — contenedor ─── */


/* ─── Texto de entrada ─── */

/* Párrafos generados por renderizarEntrada() */
.linea-entrada {
  font-family: var(--font-serif);
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.72;
  color: var(--text-mid);
  margin-bottom: 0;
  opacity: 0;
  animation: emerger 0.8s ease forwards;
}

/* Primera línea del texto — más prominente */
.linea-entrada:first-child {
  font-family: var(--font-headline);
  font-size: clamp(16px, 4.2vw, 20px);
  color: var(--text);
  font-weight: 400;
  margin-bottom: 4px;
}

/* Última línea — énfasis */
.linea-entrada:last-child {
  font-family: var(--font-display);
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 300;
  font-style: italic;
  color: var(--oro);
  margin-top: 8px;
}


/* ─── Botones de sesión ─── */

.botones-entrada {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-sesion {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  border-radius: 2px;
  z-index: 0;
}
.btn-sesion::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 2px;
  padding: 1px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
                linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: opacity 0.25s;
}
.btn-sesion::after {
  content: '';
  position: absolute; inset: 1px;
  border-radius: 1px;
  z-index: -1;
  transition: background 0.25s;
}

.btn-sesion-primario { color: var(--text); }
.btn-sesion-primario::before {
  background: linear-gradient(90deg, var(--oro), var(--teal));
  opacity: 1;
}
.btn-sesion-primario::after { background: rgba(201,165,90,0.08); }
.btn-sesion-primario {
  box-shadow: 0 0 18px rgba(201,165,90,0.14), 0 0 36px rgba(6,148,148,0.07);
}
.btn-sesion-primario:hover::after { background: rgba(201,165,90,0.15); }
.btn-sesion-primario:hover {
  color: #fff;
  box-shadow: 0 0 24px rgba(201,165,90,0.28), 0 0 48px rgba(6,148,148,0.14);
}

.btn-sesion-secundario { color: var(--text-dim); }
.btn-sesion-secundario::before {
  background: linear-gradient(90deg, var(--teal), var(--oro));
  opacity: 0.35;
}
.btn-sesion-secundario::after { background: transparent; }
.btn-sesion-secundario:hover { color: var(--text-mid); }
.btn-sesion-secundario:hover::before { opacity: 0.72; }


/* ══════════════════════════════════════════
   4. CHAT — INTERLOCUTOR Y REFLEXIÓN
   Selectores verificados contra chat.js:
   agregarMensaje() crea:
   <div class="mensaje mensaje-io">texto</div>
   <div class="mensaje mensaje-user">texto</div>
   El texto va DIRECTO en el div, sin hijos.
   ══════════════════════════════════════════ */

.chat-area {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 64px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

/* Base compartida de burbujas */
.mensaje {
  max-width: 88%;
  padding: 13px 16px;
  font-family: var(--font-serif);
  font-size: clamp(15px, 3.8vw, 17px);
  line-height: 1.68;
  animation: emerger 0.5s ease forwards;
}

/* Burbuja IO — izquierda, borde oro */
.mensaje-io {
  align-self: flex-start;
  color: var(--text-mid);
  background: rgba(15,28,45,0.75);
  border-left: 2px solid var(--oro);
}

/* Burbuja usuario — derecha, borde tenue */
.mensaje-user {
  align-self: flex-end;
  color: var(--text-mid);
  background: transparent;
  border: 1px solid var(--line-mid);
}

/* Typing indicator */
.typing-indicator {
  display: none;
  align-self: flex-start;
  padding: 13px 16px;
  background: rgba(15,28,45,0.6);
  border-left: 2px solid var(--oro);
}
.typing-indicator.visible { display: flex; }

.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--oro);
  opacity: 0.5;
  animation: dot-pulse 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
  0%,80%,100% { opacity: 0.3; transform: scale(0.8); }
  40%          { opacity: 1;   transform: scale(1); }
}

/* Input */
.input-area {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(11,21,32,0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(15px, 3.8vw, 17px);
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  overflow-y: auto;
}
.chat-input::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

.btn-enviar {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--oro);
  flex-shrink: 0;
  position: relative;
  transition: opacity 0.2s;
}
.btn-enviar::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  padding: 1px;
  background: linear-gradient(135deg, var(--oro), var(--teal));
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
                linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.btn-enviar:hover { opacity: 0.8; }


/* ══════════════════════════════════════════
   5. LLAVES DE CONCIENCIA
   ══════════════════════════════════════════ */

.llaves-contenido {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px 32px;
  overflow-y: auto;
}

.carta-wrapper {
  animation: emerger 1.2s ease both;
  width: 100%;
  max-width: 440px;
}

.carta-cabecera {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}
.carta-linea-oro {
  width: 32px; height: 1px;
  background: linear-gradient(90deg, var(--oro), var(--teal));
  margin-bottom: 20px;
  animation: expandir 1s ease 0.4s both;
}
.carta-icono {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  opacity: 0.9;
}
.carta-icono svg {
  width: clamp(36px, 9vw, 52px);
  height: auto;
}
.carta-texto {
  font-family: var(--font-serif);
  font-size: clamp(16px, 4vw, 19px);
  line-height: 1.80;
  color: var(--text);
  letter-spacing: 0.01em;
  animation: emerger 1s ease 0.6s both;
}
.carta-texto em    { font-style: italic; color: var(--oro); }
.carta-texto strong { font-weight: 500; letter-spacing: 0.06em; }

.carta-separador {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  animation: emerger 1s ease 0.8s both;
}
.carta-separador::before,
.carta-separador::after {
  content: ''; flex: 1;
  height: 1px;
  background: var(--line);
}
.carta-punto {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 7px var(--teal-glow);
}

.carta-pie {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: emerger 1s ease 0.9s both;
}
.carta-pie-texto {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.carta-pie-io {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 14px;
  letter-spacing: 0.3em;
  color: rgba(201,165,90,0.45);
}

.carta-accion { margin-top: 24px; }

.btn-trabajar-carta {
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 2px;
  position: relative;
  color: var(--text);
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
}
.btn-trabajar-carta::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 2px;
  padding: 1px;
  background: linear-gradient(90deg, var(--oro), var(--teal));
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
                linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 1;
}
.btn-trabajar-carta::after {
  content: '';
  position: absolute; inset: 1px;
  border-radius: 1px;
  z-index: -1;
  background: rgba(201,165,90,0.08);
  transition: background 0.25s;
}
.btn-trabajar-carta:hover::after { background: rgba(201,165,90,0.15); }
.btn-trabajar-carta:hover { color: #fff; }


/* ══════════════════════════════════════════
   6. MONITOR
   ══════════════════════════════════════════ */

.monitor-contenido {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  padding: 72px 26px 40px;
  flex: 1;
}
.monitor-titulo {
  font-family: var(--font-headline);
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.monitor-subtitulo {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  opacity: 0.55;
  margin-bottom: 40px;
}
.monitor-metricas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 36px;
}
.metrica {
  background: rgba(15,28,45,0.6);
  border: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 2px;
  transition: border-color 0.2s;
}
.metrica:hover { border-color: var(--line-mid); }
.metrica-valor {
  font-family: var(--font-headline);
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 400;
  color: var(--oro);
  line-height: 1;
}
.metrica-label {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}
.monitor-log-titulo {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}


/* ══════════════════════════════════════════
   7. ACCESO MONITOR — oculto
   Acceso: 5 toques sobre el logo
   ══════════════════════════════════════════ */

.monitor-acceso { display: none; }


/* ══════════════════════════════════════════
   8. ANIMACIONES COMPARTIDAS
   ══════════════════════════════════════════ */

@keyframes emerger {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes expandir {
  from { width: 0; opacity: 0; }
  to   { width: 32px; opacity: 1; }
}
