*{box-sizing:border-box;font-family:system-ui,Segoe UI,Roboto,Arial;}
body {
  margin: 0;
  color: #e8eefc;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.wrap {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  z-index: 1;
}

.card {
  width: 100%;
  height: 100%;
  background: rgba(17, 26, 46, 0.6);
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.header{
  padding:14px 16px;
  /* border-bottom:1px solid #223055; */ /* Quitamos borde para look más limpio */
  flex-shrink:0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute; /* Header flotante o fijo arriba */
  top: 0; left: 0; right: 0;
  z-index: 50; /* Por encima de todo */
  background: transparent; /* Fondo transparente */
  pointer-events: none; /* Dejar pasar clicks salvo en botones */
}
.header-left {
  pointer-events: auto;
  background: rgba(17, 26, 46, 0.8);
  padding: 5px 10px;
  border-radius: 8px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  pointer-events: auto;
}

.title{font-size:18px}
.sub{opacity:.75;font-size:12px;margin-top:4px}

.admin-link {
  text-decoration: none;
  font-size: 24px;
  opacity: 0.6;
  transition: opacity 0.2s;
  cursor: pointer;
  color: inherit;
  background: rgba(255,255,255,0.1);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.admin-link:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
}

/* Avatar flotante grande abajo a la derecha */
.avatar-floating {
  position: absolute;
  bottom: 0;
  right: 5%; /* Un poco separado del borde */
  height: 45vh; /* Altura relativa a la pantalla (grande) */
  max-height: 500px;
  min-height: 250px;
  object-fit: contain;
  z-index: 1; /* Detrás del input, pero visible */
  pointer-events: none; /* No bloquear clicks */
  transition: opacity 0.3s ease;
}

/* Ajustes del chat para que no tape al muñeco o viceversa */
.chat {
  flex: 1;
  overflow-y: auto; 
  overflow-x: hidden;
  padding: 80px 20px 20px 20px; /* Padding top extra por el header absoluto */
  display: flex;
  flex-direction: column;
  gap: 20px;
  
  /* Centrar el contenido pero dar espacio al muñeco a la derecha */
  /* En pantallas grandes, el chat se corre un poco a la izquierda */
  padding-left: max(20px, calc(50% - 400px));
  padding-right: max(20px, calc(50% - 400px));
  
  z-index: 2; /* Por encima del muñeco si es necesario, o debajo? */
  /* Si z-index es mayor, el chat tapa al muñeco. Si es menor, el muñeco tapa al chat. */
  /* Queremos que el muñeco esté "atrás" o "al lado". */
  /* Vamos a probar z-index 10 para chat, y muñeco 1. */
  position: relative;
  z-index: 10; 
}
/* Hacer transparente el fondo de los mensajes para ver el muñeco? No, mejor no. */

.input-area {
  padding: 20px;
  display: flex;
  gap: 10px;
  background: transparent;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 20; /* Por encima del muñeco */
}

.input-container {
  display: flex;
  width: 100%;
  max-width: 800px;
  gap: 10px;
  position: relative;
}

#user-input {
  flex: 1;
  background: #1b2747;
  border: 1px solid #3a4b83;
  color: #e8eefc;
  padding: 14px 20px;
  border-radius: 24px;
  outline: none;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#user-input:focus {
  border-color: #5c7cfa;
  background: #233155;
}

#send-btn {
  background: #3a4b83;
  color: #fff;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#send-btn:hover { background: #4b61a6; }

.msg {
  padding: 15px 22px;
  border-radius: 20px;
  max-width: 80%;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 15px;
  position: relative;
  z-index: 11;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.me{align-self:flex-end;background:#5c7cfa;border:1px solid rgba(255,255,255,0.25);color:#fff;text-align:right}
.bot{align-self:flex-start;background:linear-gradient(135deg,#3a4b83,#1b2747);border:1px solid rgba(147,174,255,0.65);color:#e8eefc}

/* Opciones (Botones) */
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 22px;
  animation: fadeIn 0.5s ease;
  z-index: 20;
  position: relative;
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 0 0 rgba(92, 124, 250, 0.0);
  }
  50% {
    box-shadow: 0 0 18px rgba(92, 124, 250, 0.65);
  }
  100% {
    box-shadow: 0 0 0 rgba(92, 124, 250, 0.0);
  }
}

.opt {
  background: linear-gradient(135deg, #3a4b83, #1b2747);
  border: 1px solid rgba(147, 174, 255, 0.8);
  color: #e8eefc;
  padding: 12px 24px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation: glowPulse 2s ease-in-out infinite;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.opt:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 22px rgba(92, 124, 250, 0.9);
}

/* Pantalla de bienvenida centrada (Overlay) */
.welcome-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Centrado verticalmente */
  text-align: center;
  color: #e8eefc;
  background: transparent; /* Fondo transparente para ver los efectos traseros */
  padding: 20px;
}

.welcome-screen h2 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 30px;
  position: relative; z-index: 101;
}

.welcome-input-box {
  position: relative;
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  z-index: 101;
}
.welcome-input-box input {
  width: 100%;
  background: rgba(27, 39, 71, 0.8);
  border: 1px solid rgba(58, 75, 131, 0.5);
  color: #e8eefc;
  padding: 16px 24px;
  border-radius: 30px;
  outline: none;
  font-size: 18px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.welcome-input-box input:focus {
  border-color: #5c7cfa;
  background: #233155;
}
.welcome-input-box button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #3a4b83, #5c7cfa);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 15px rgba(58, 75, 131, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.welcome-input-box button:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(58, 75, 131, 0.6);
}

/* Ocultar bienvenida cuando inicia chat */
body.chat-started .welcome-screen {
  display: none;
}

/* Cuando empieza el chat, el muñeco se queda de fondo */
body.chat-started .avatar-floating {
  /* Opcional: moverlo o hacerlo más pequeño? */
  /* Dejémoslo igual por ahora */
  opacity: 0.3; /* Un poco más transparente para no molestar la lectura */
}
