/* Asistente de Torvix: botón fijo con el vikingo, panel de chat y acceso en «Preguntas frecuentes». */

.ma-launch { position: fixed; z-index: 31; right: 22px; bottom: 22px; width: 68px; height: 68px; padding: 0; border-radius: 50%; cursor: pointer; overflow: hidden;
  border: 2px solid var(--ac); background: radial-gradient(circle at 50% 30%, #26323a, #11171a 70%); box-shadow: 0 12px 30px rgb(0 0 0 / 55%), 0 0 0 6px rgb(165 241 45 / 10%), 0 0 22px rgb(165 241 45 / 30%);
  transition: transform .2s, box-shadow .2s; }
.ma-launch:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 34px rgb(0 0 0 / 60%), 0 0 0 7px rgb(165 241 45 / 16%), 0 0 30px rgb(165 241 45 / 45%); }
.ma-launch:focus-visible { outline: 3px solid var(--ac); outline-offset: 4px; }
.ma-launch img { position: absolute; left: 50%; top: 6px; width: 108px; transform: translateX(-50%); transition: transform .25s, filter .25s; }
.ma-launch:hover img { transform: translateX(-50%) translateY(-3px); }
.ma-launch.open img { transform: translateX(-50%) translateY(6px); filter: brightness(.7); }
.ma-dot { position: absolute; right: 7px; top: 7px; width: 11px; height: 11px; border-radius: 50%; background: var(--ac); border: 2px solid #11171a; box-shadow: 0 0 8px var(--ac); }
.ma-launch.open .ma-dot { display: none; }

.ma-nudge { position: fixed; z-index: 31; right: 102px; bottom: 40px; padding: 10px 14px; border-radius: 12px; background: rgb(20 27 30 / 95%); border: 1px solid rgb(165 241 45 / 35%);
  color: var(--ink); font-size: 14px; white-space: nowrap; cursor: pointer; box-shadow: 0 12px 28px rgb(0 0 0 / 50%);
  opacity: 0; transform: translateX(8px); transition: opacity .25s, transform .3s cubic-bezier(.3, 1.4, .5, 1); pointer-events: none; }
.ma-nudge.on { opacity: 1; transform: none; pointer-events: auto; }
.ma-nudge::after { content: ""; position: absolute; right: -6px; top: 50%; width: 10px; height: 10px; margin-top: -5px; background: inherit; border-top: 1px solid rgb(165 241 45 / 35%); border-right: 1px solid rgb(165 241 45 / 35%); transform: rotate(45deg); }
.ma-nudge b { color: var(--ac); font-weight: 650; }

.ma-panel { position: fixed; z-index: 32; right: 22px; bottom: 104px; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 200px));
  display: flex; flex-direction: column; border-radius: 20px; background: rgb(15 21 24 / 97%); border: 1px solid rgb(165 241 45 / 28%);
  box-shadow: 0 28px 70px rgb(0 0 0 / 65%); backdrop-filter: blur(14px); opacity: 0; transform: translateY(16px) scale(.97); transform-origin: 90% 100%;
  transition: opacity .2s, transform .3s cubic-bezier(.3, 1.3, .5, 1); pointer-events: none; }
.ma-panel.on { opacity: 1; transform: none; pointer-events: auto; }

/* Cabecera: el vikingo asoma por encima del panel. */
.ma-head { position: relative; display: flex; align-items: flex-end; gap: 12px; min-height: 74px; padding: 0 12px 12px 140px; border-bottom: 1px solid var(--line);
  background: radial-gradient(120% 140% at 15% 100%, rgb(165 241 45 / 14%), transparent 60%); border-radius: 20px 20px 0 0; }
.ma-hero { position: absolute; left: 6px; bottom: 0; width: 124px; height: 128px; cursor: pointer; }
.ma-pose { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; opacity: 0; transition: opacity .28s ease;
  filter: drop-shadow(0 8px 12px rgb(0 0 0 / 55%)); transform-origin: 50% 100%; }
.ma-pose.on { opacity: 1; }
.ma-pose.pop { animation: ma-pop .38s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ma-pop { 0% { transform: scale(.9, .94); } 60% { transform: scale(1.04, 1.02); } 100% { transform: none; } }
/* «Buscando» es más ancha que los otros bustos: se agranda un poco para que la cabeza quede del mismo tamaño. */
.ma-hero[data-pose="buscando"] .ma-pose.on { scale: 1.12; transform-origin: 50% 100%; }
/* Mientras piensa, una luz recorre la silueta (como el barrido de un análisis de Torvix). */
.ma-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: linear-gradient(100deg, transparent 40%, rgb(190 255 90 / 28%) 47%, rgb(240 255 210 / 55%) 50%, rgb(190 255 90 / 28%) 53%, transparent 60%) no-repeat;
  background-size: 260% 100%; background-position: 130% 0;
  -webkit-mask: url("assets/mascota/buscando.webp") 50% 100% / contain no-repeat; mask: url("assets/mascota/buscando.webp") 50% 100% / contain no-repeat;
  scale: 1.12; transform-origin: 50% 100%; mix-blend-mode: screen; }
.ma-hero.thinking[data-pose="buscando"]::after { opacity: 1; animation: ma-scan 1.5s cubic-bezier(.45, .05, .55, .95) infinite; }
@keyframes ma-scan { from { background-position: 130% 0; } to { background-position: -30% 0; } }
.ma-title { flex: 1; min-width: 0; line-height: 1.25; padding-bottom: 2px; }
.ma-title b { display: block; font-size: 16px; }
.ma-title small { color: var(--sub); font-size: 12.5px; }
.ma-title small::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ac); box-shadow: 0 0 6px var(--ac); vertical-align: 1px; }
.ma-close { align-self: flex-start; margin-top: 10px; border: 0; background: none; color: var(--dim); width: 32px; height: 32px; border-radius: 9px; cursor: pointer; font-size: 20px; line-height: 1; }
.ma-close:hover { color: var(--ink); background: rgb(255 255 255 / 8%); }

.ma-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.ma-msg { max-width: 88%; padding: 10px 13px; border-radius: 15px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; animation: ma-in .22s ease-out; }
@keyframes ma-in { from { opacity: 0; transform: translateY(6px); } }
.ma-msg.bot { align-self: flex-start; background: var(--card1); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.ma-msg.me { align-self: flex-end; background: var(--ac); color: var(--ac-ink); border-bottom-right-radius: 5px; font-weight: 520; }
.ma-msg a { color: var(--ac); }
.ma-msg.bot b { color: #fff; }
.ma-msg.typing { display: flex; gap: 4px; padding: 13px 15px; }
.ma-msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--sub); animation: ma-dot 1s infinite; }
.ma-msg.typing i:nth-child(2) { animation-delay: .15s; } .ma-msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ma-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.ma-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px; }
.ma-chips.compact { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.ma-chips.compact::-webkit-scrollbar { display: none; }
.ma-chips button { flex: none; border: 1px solid var(--line-hi); background: rgb(255 255 255 / 4%); color: var(--ink); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.ma-chips button:hover { border-color: rgb(165 241 45 / 55%); color: var(--ac); }
.ma-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ma-form input { flex: 1; min-width: 0; border: 1px solid var(--line-hi); background: var(--bg); color: var(--ink); border-radius: 11px; padding: 10px 12px; font: inherit; font-size: 14px; }
.ma-form input:focus { outline: none; border-color: rgb(165 241 45 / 60%); }
.ma-form button { border: 0; border-radius: 11px; background: var(--ac); color: var(--ac-ink); width: 42px; cursor: pointer; display: grid; place-items: center; }
.ma-form button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ma-form button:disabled { opacity: .5; cursor: default; }
.ma-foot { padding: 0 14px 12px; color: var(--dim); font-size: 11.5px; line-height: 1.4; }

/* Acceso en «Preguntas frecuentes». */
.ma-ask { max-width: 820px; margin: 22px auto 0; display: flex; align-items: center; gap: 18px; padding: 14px 22px 0 14px; border-radius: var(--r); overflow: hidden;
  border: 1px solid rgb(165 241 45 / 30%); background: radial-gradient(90% 160% at 0% 100%, rgb(165 241 45 / 13%), transparent 60%), linear-gradient(180deg, var(--card1), var(--card2)); }
.ma-ask img { width: 96px; align-self: flex-end; filter: drop-shadow(0 6px 10px rgb(0 0 0 / 50%)); }
.ma-ask div { flex: 1; padding-bottom: 14px; }
.ma-ask b { display: block; font-size: 17px; margin-bottom: 2px; }
.ma-ask p { margin: 0; color: var(--sub); font-size: 14.5px; }
.ma-ask .btn { flex: none; margin-bottom: 14px; }

@media (max-width: 700px) {
  .ma-launch { right: 14px; bottom: 14px; width: 60px; height: 60px; }
  .ma-launch img { width: 96px; }
  .ma-nudge { right: 86px; bottom: 28px; }
  .ma-panel { right: 10px; left: 10px; width: auto; bottom: 86px; height: min(540px, calc(100dvh - 110px)); }
  .ma-ask { flex-wrap: wrap; padding: 14px 16px 0; }
  .ma-ask img { width: 76px; }
  .ma-ask .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ma-panel, .ma-nudge, .ma-pose, .ma-launch, .ma-launch img { transition: none; }
  .ma-pose.pop, .ma-msg, .ma-msg.typing i, .ma-hero.thinking::after { animation: none; }
}

/* «¿Te sirvió?» bajo las respuestas (fase 3). */
.ma-fb { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.ma-fb span { flex: 1; }
.ma-fb button { border: 1px solid var(--line-hi); background: rgb(255 255 255 / 3%); border-radius: 8px; width: 30px; height: 26px; cursor: pointer; font-size: 13px; line-height: 1; filter: grayscale(.6); transition: filter .2s, border-color .2s, transform .15s; }
.ma-fb button:hover:not(:disabled) { filter: none; border-color: rgb(165 241 45 / 55%); transform: translateY(-1px); }
.ma-fb.done button { opacity: .35; cursor: default; }
.ma-fb.done button.on { opacity: 1; filter: none; border-color: rgb(165 241 45 / 60%); }
.ma-fb.done span { color: var(--sub); }
