/* Conexa — el asistente comercial (27-nov-2026). Marca de la web: azul marino, bronce pulido #D29A48, marfil.
   Siempre a mano: el lanzador vive abajo a la derecha; en el celular el chat ocupa la pantalla. */
.chat-lanzador { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 60; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: linear-gradient(160deg, #F3CF8C 0%, #D29A48 55%, #A9712A 100%); box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .85), 0 0 30px -6px rgba(232, 178, 94, .8); transition: transform .3s cubic-bezier(.2, .9, .3, 1.2), bottom .35s ease; -webkit-tap-highlight-color: transparent; }
.chat-lanzador:hover { transform: translateY(-2px) scale(1.04); }
.chat-lanzador:focus-visible { outline: 2px solid #F6D79A; outline-offset: 4px; }
.chat-lanzador.sobre-pildora { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 70px); }
.chat-lanzador .chat-cara { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); border-radius: 50%; object-fit: cover; }
.chat-punto { position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 3px #0E1930, 0 0 12px #4ADE80; }
.chat-invita { position: absolute; right: 76px; top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 10px 16px; border-radius: 16px 16px 4px 16px; font: 600 .9rem/1.2 inherit; font-family: inherit; color: #111B21; background: #FBF6EC; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); animation: chat-sube .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.chat-invita[hidden] { display: none; }
html.chat-abierto .chat-lanzador { transform: scale(.92); }

.chat-panel { position: fixed; z-index: 61; right: max(18px, env(safe-area-inset-right)); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 78px); width: min(390px, calc(100vw - 36px)); height: min(620px, calc(100dvh - 190px)); display: flex; flex-direction: column; overflow: hidden; border-radius: 24px; color: #F3EEE4; background: linear-gradient(180deg, #14213A, #0A1222); box-shadow: inset 0 0 0 1px rgba(232, 178, 94, .28), 0 40px 100px -30px rgba(0, 0, 0, .95), 0 0 70px -30px rgba(210, 154, 72, .45); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: chat-abre .35s cubic-bezier(.2, .9, .3, 1.1) both; }
.chat-panel[hidden] { display: none; }
.chat-cabeza { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid rgba(232, 178, 94, .2); background: linear-gradient(180deg, rgba(210, 154, 72, .12), transparent); }
.chat-cabeza .chat-cara { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px #D29A48, 0 0 18px -2px rgba(232, 178, 94, .7); }
.chat-quien { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-quien b { font-family: var(--letra-titulo, Georgia, serif); font-weight: 500; font-size: 1.15rem; letter-spacing: .01em; }
.chat-quien small { font-size: .76rem; color: rgba(243, 238, 228, .66); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-cerrar { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; color: rgba(243, 238, 228, .8); background: rgba(255, 255, 255, .06); }
.chat-cerrar:hover { color: #fff; background: rgba(255, 255, 255, .12); }

.chat-lista { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.chat-fila { display: flex; animation: chat-sube .3s ease both; }
.chat-fila.de-usuario { justify-content: flex-end; }
.chat-burbuja { margin: 0; max-width: 84%; padding: 11px 14px; border-radius: 18px; font-size: .95rem; line-height: 1.42; white-space: pre-line; overflow-wrap: anywhere; }
.de-asistente .chat-burbuja { border-top-left-radius: 6px; background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.de-usuario .chat-burbuja { border-top-right-radius: 6px; color: #1A1306; font-weight: 600; background: linear-gradient(160deg, #F3CF8C 0%, #D29A48 70%, #B98336 100%); }
.chat-escribiendo .chat-burbuja { display: inline-flex; gap: 5px; padding: 15px 16px; }
.chat-escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: #E8B25E; animation: chat-punto 1.1s infinite ease-in-out; }
.chat-escribiendo i:nth-child(2) { animation-delay: .15s; }
.chat-escribiendo i:nth-child(3) { animation-delay: .3s; }

/* Las opciones no tapan la charla (Mati, 27-nov: «son grandes y tapan todo lo conversado»): una sola tira
   que se desliza de costado. Las de varias respuestas (los dolores) van en dos filas, con «Listo» fijo
   a la derecha. Así nunca ocupan más de ~90 px de alto, sea cual sea la cantidad. */
.chat-opciones { flex: none; display: flex; flex-wrap: nowrap; gap: 6px; padding: 6px 16px 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding-inline: 16px; }
.chat-opciones::-webkit-scrollbar { display: none; }
.chat-opciones.varias { display: grid; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: max-content; }
.chat-opciones:empty { display: none; }
.chat-opcion { flex: none; white-space: nowrap; font: inherit; font-size: .82rem; line-height: 1.2; min-height: 36px; padding: 6px 12px; border: 0; border-radius: 999px; cursor: pointer; color: #F6D79A; background: rgba(210, 154, 72, .1); box-shadow: inset 0 0 0 1px rgba(232, 178, 94, .5); transition: background .2s ease; }
.chat-opcion:hover { background: rgba(210, 154, 72, .2); }
.chat-opcion[aria-pressed="true"] { color: #1A1306; background: linear-gradient(160deg, #F3CF8C, #D29A48); }
/* «Listo» va en el lugar del campo cuando eligió algún dolor (chat.js, verListo) */
.chat-listo { flex: 1; min-height: 46px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 700; font-size: .95rem; color: #1A1306; background: linear-gradient(160deg, #F3CF8C 0%, #D29A48 55%, #A9712A 100%); box-shadow: 0 0 22px -8px rgba(232, 178, 94, .9); animation: chat-sube .25s ease both; }
.chat-listo[hidden], .chat-campo[hidden], .chat-mandar[hidden] { display: none; }

.chat-forma { display: flex; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid rgba(232, 178, 94, .16); }
.chat-forma[hidden] { display: none; }
.chat-campo { flex: 1; min-width: 0; min-height: 46px; padding: 0 16px; border: 0; border-radius: 999px; font: inherit; font-size: 16px; color: #F3EEE4; background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.chat-campo::placeholder { color: rgba(243, 238, 228, .45); }
.chat-campo:focus { outline: none; box-shadow: inset 0 0 0 1.5px rgba(232, 178, 94, .75); }
.chat-mandar { display: grid; place-items: center; width: 46px; height: 46px; flex: none; padding: 0; border: 0; border-radius: 50%; cursor: pointer; color: #1A1306; background: linear-gradient(160deg, #F3CF8C 0%, #D29A48 55%, #A9712A 100%); }
.chat-pie { margin: 0; padding: 6px 16px 12px; font-size: .72rem; text-align: center; color: rgba(243, 238, 228, .5); }
.chat-cierre { display: grid; gap: 8px; padding: 10px 16px 4px; }
.chat-wa { display: flex; align-items: center; justify-content: center; min-height: 50px; border-radius: 999px; text-decoration: none; font-weight: 700; color: #1A1306; background: linear-gradient(160deg, #F3CF8C 0%, #D29A48 55%, #A9712A 100%); box-shadow: 0 0 26px -8px rgba(232, 178, 94, .9); }
.chat-reiniciar { font: inherit; font-size: .85rem; min-height: 40px; border: 0; cursor: pointer; color: rgba(243, 238, 228, .7); background: none; text-decoration: underline; text-underline-offset: 3px; }

@keyframes chat-abre { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes chat-sube { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.chat-invita { animation-name: chat-invita; }
@keyframes chat-invita { from { opacity: 0; transform: translate(8px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
@keyframes chat-punto { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* La pausa del video de portada vive en la misma esquina: en la compu se corre a la izquierda del lanzador
   (en el celular ya está arriba, estilos.css). */
@media (min-width: 701px) { .portada-pausa { right: max(100px, calc((100vw - var(--ancho)) / 2)); } }

/* En el celular: pantalla completa, y la página de atrás no se mueve. También con la pantalla BAJA
   (celular apaisado, ventana achicada): flotando, el chat quedaba de ~200 px y no se leía nada. */
@media (max-width: 560px), (max-height: 600px) {
  /* el alto es lo visible sobre el teclado (lo mide chat.js con visualViewport) */
  .chat-panel { inset: auto 0 auto 0; top: var(--chat-arriba, 0px); width: 100%; height: var(--chat-alto, 100dvh); border-radius: 0; }
  .chat-cabeza { padding: 10px 12px 10px 14px; }
  .chat-cabeza .chat-cara { width: 40px; height: 40px; }
  .chat-pie { padding: 4px 16px 8px; }
  html.chat-abierto, html.chat-abierto body { overflow: hidden; }
  html.chat-abierto .chat-lanzador { display: none; }
  .chat-invita { right: 72px; }
}
/* Pantalla baja pero ancha (compu achicada, celular apaisado): alto completo, ancho de chat a la derecha;
   a lo ancho de toda la pantalla, las líneas quedaban larguísimas. */
@media (max-height: 600px) and (min-width: 561px) {
  .chat-panel { left: auto; right: 0; width: min(440px, 100%); box-shadow: inset 1px 0 0 rgba(232, 178, 94, .3), -30px 0 80px -30px rgba(0, 0, 0, .9); }
}
@media (max-height: 480px) {
  .chat-pie { display: none; }
  .chat-cabeza { padding-block: 6px; }
  .chat-cabeza .chat-cara { width: 34px; height: 34px; }
  .chat-lista { padding-top: 10px; }
  .chat-opciones.varias { grid-template-rows: auto; }
}
/* Teclado arriba y muy poco lugar (lo marca chat.js): mientras escribe se ve la charla, no la cabecera. */
.chat-panel.apretado:has(.chat-campo:focus) .chat-cabeza,
.chat-panel.apretado:has(.chat-campo:focus) .chat-opciones,
.chat-panel.apretado .chat-pie { display: none; }
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-fila, .chat-invita, .chat-escribiendo i { animation: none !important; }
  .chat-lista { scroll-behavior: auto; }
}
