/* ═══════════════════════════════════════════════════════════
   WINSTON — CHAT ÉPICO
   Chat con canvas de nodos, luces y ondas.
   ═══════════════════════════════════════════════════════════ */

#chatEpico {
  max-width: 940px;
  margin: 0 auto;
  position: relative;
}

.ce-marco {
  position: relative;
  border-radius: 26px;
  border: 1px solid rgba(120,170,255,.22);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(77,157,255,.09), transparent 70%),
    rgba(10,14,24,.82);
  backdrop-filter: blur(18px);
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.6), inset 0 1px 0 rgba(140,190,255,.1);
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

/* canvas del fondo épico */
#ceLienzo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}
.ce-brillo {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(5,7,13,.75) 100%);
}

/* ── CABECERA ──────────────────────────────────────────────────────────── */
.ce-cab {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: .9rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid rgba(120,170,255,.14);
  background: rgba(10,14,24,.6);
  backdrop-filter: blur(10px);
}
.ce-avatar {
  position: relative;
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(77,157,255,.5), rgba(77,157,255,.1));
  border: 1px solid rgba(140,190,255,.38);
  display: flex; align-items: center; justify-content: center;
}
.ce-inicial {
  font-weight: 800; font-size: 1.1rem; color: #dceafe;
  text-shadow: 0 0 14px rgba(140,200,255,.8);
}
.ce-pulso {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid rgba(140,200,255,.5);
  animation: cePulso 2.6s ease-out infinite;
}
@keyframes cePulso {
  0%   { transform: scale(.85); opacity: .9; }
  100% { transform: scale(1.35); opacity: 0; }
}
.ce-info b { display: block; font-size: 1rem; color: #eaf0f8; }
.ce-info small {
  display: flex; align-items: center; gap: .35rem;
  color: #6f8098; font-size: .76rem;
}
.ce-vivo {
  width: 6px; height: 6px; border-radius: 50%; background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: ceLatir 2s ease-in-out infinite;
}
@keyframes ceLatir { 0%,100% { opacity:1 } 50% { opacity:.4 } }

/* onda de voz animada */
.ce-onda { margin-left: auto; display: flex; align-items: center; gap: 3px; height: 22px; }
.ce-onda i {
  width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, #8fc4ff, #4d9dff);
  animation: ceOnda 1.15s ease-in-out infinite;
}
.ce-onda i:nth-child(1) { animation-delay: 0s; }
.ce-onda i:nth-child(2) { animation-delay: .15s; }
.ce-onda i:nth-child(3) { animation-delay: .3s; }
.ce-onda i:nth-child(4) { animation-delay: .45s; }
.ce-onda i:nth-child(5) { animation-delay: .6s; }
@keyframes ceOnda {
  0%,100% { height: 5px; opacity: .45; }
  50%     { height: 21px; opacity: 1; }
}

/* ── HILO DE CONVERSACIÓN ──────────────────────────────────────────────── */
.ce-hilo {
  position: relative; z-index: 2;
  flex: 1; overflow-y: auto;
  padding: 1.3rem;
  display: flex; flex-direction: column; gap: .8rem;
  max-height: 380px;
}
.ce-burbuja {
  max-width: 84%;
  padding: .85rem 1.1rem;
  border-radius: 17px;
  font-size: .91rem; line-height: 1.66;
  animation: ceEntra .42s cubic-bezier(.2,.8,.3,1);
  word-wrap: break-word;
}
@keyframes ceEntra {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.ce-burbuja.bot {
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  background: rgba(18,26,42,.92);
  border: 1px solid rgba(120,170,255,.24);
  color: #dbe6f5;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
}
.ce-burbuja.bot b { color: #8fc4ff; }
.ce-burbuja.yo {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, #4d9dff, #b28cff);
  color: #fff; font-weight: 500;
  box-shadow: 0 8px 26px rgba(77,157,255,.36);
}
/* escribiendo... */
.ce-burbuja.escribiendo {
  display: flex; gap: 5px; align-items: center; padding: .95rem 1.1rem;
}
.ce-burbuja.escribiendo i {
  width: 6px; height: 6px; border-radius: 50%; background: #8fc4ff;
  animation: cePuntito 1.1s ease-in-out infinite;
}
.ce-burbuja.escribiendo i:nth-child(2) { animation-delay: .18s; }
.ce-burbuja.escribiendo i:nth-child(3) { animation-delay: .36s; }
@keyframes cePuntito {
  0%,100% { opacity: .3; transform: translateY(0); }
  50%     { opacity: 1;  transform: translateY(-5px); }
}

/* ── CHIPS DE PREGUNTAS ────────────────────────────────────────────────── */
.ce-chips {
  position: relative; z-index: 2;
  display: flex; gap: .45rem; flex-wrap: wrap;
  padding: 0 1.3rem 1rem;
}
.ce-chip {
  background: rgba(77,157,255,.1);
  border: 1px solid rgba(120,170,255,.3);
  color: #b9cbe4;
  border-radius: 999px;
  padding: .48rem 1rem;
  font: inherit; font-size: .81rem;
  cursor: pointer;
  transition: .22s;
  animation: ceEntra .5s backwards;
}
.ce-chip:hover {
  background: rgba(77,157,255,.22);
  color: #fff;
  border-color: rgba(140,190,255,.55);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(77,157,255,.25);
}

/* ── FORMULARIO ────────────────────────────────────────────────────────── */
.ce-form {
  position: relative; z-index: 2;
  display: flex; gap: .6rem;
  padding: 1rem 1.3rem 1.3rem;
  border-top: 1px solid rgba(120,170,255,.14);
  background: rgba(10,14,24,.55);
  backdrop-filter: blur(10px);
}
.ce-form input {
  flex: 1;
  background: rgba(0,0,0,.42);
  border: 1px solid rgba(120,170,255,.22);
  border-radius: 999px;
  color: #eaf0f8;
  font: inherit; font-size: .9rem;
  padding: .85rem 1.2rem;
  transition: .22s;
}
.ce-form input:focus {
  outline: none;
  border-color: rgba(140,190,255,.6);
  box-shadow: 0 0 0 3px rgba(77,157,255,.12);
}
.ce-form input::placeholder { color: #5d6d84; }
.ce-form button {
  width: 46px; height: 46px; flex-shrink: 0;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, #4d9dff, #b28cff);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(77,157,255,.4);
  transition: .22s;
}
.ce-form button:hover { transform: scale(1.07); box-shadow: 0 10px 30px rgba(77,157,255,.55); }

/* ── RESPONSIVE ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ce-marco { min-height: 480px; border-radius: 20px; }
  .ce-hilo { max-height: 300px; padding: 1rem; }
  .ce-burbuja { max-width: 92%; font-size: .87rem; }
  .ce-cab { padding: .9rem 1rem; }
  .ce-chips { padding: 0 1rem .8rem; }
  .ce-chip { font-size: .76rem; padding: .42rem .85rem; }
  .ce-form { padding: .85rem 1rem 1.1rem; }
  .ce-onda { display: none; }
}

/* ── BOTÓN DE VOZ (que Winston hable) ──────────────────────────────────── */
.ce-voz {
  margin-left: .6rem;
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(77,157,255,.12);
  border: 1px solid rgba(120,170,255,.32);
  border-radius: 50%;
  color: #dceafe;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .22s;
}
.ce-voz:hover {
  background: rgba(77,157,255,.24);
  border-color: rgba(140,190,255,.6);
  transform: scale(1.06);
}
.ce-voz.sonando {
  animation: ceVozPulso 1.1s ease-in-out infinite;
  border-color: rgba(140,200,255,.7);
}
@keyframes ceVozPulso {
  0%,100% { box-shadow: 0 0 0 0 rgba(77,157,255,.5); }
  50%     { box-shadow: 0 0 0 9px rgba(77,157,255,0); }
}