/* =====================================================================
   Asistente de la web pública — el búho de la portada (17-nov-2026)
   ---------------------------------------------------------------------
   Dos partes: (1) las animaciones de la mascota, que se gobiernan con
   `data-estado` en cualquier contenedor del SVG, y (2) el chat.
   Usa los tokens de public.css (con su valor de respaldo, por si se
   incluye en una página que no la cargue). Prefijos: `buho-` y `asis-`.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. La mascota
   ---------------------------------------------------------------------
   Los puntos de giro (transform-origin) van en las unidades del dibujo
   (viewBox 240 × 336 de partials/asistente/buho.blade.php): si allí se
   mueve una pieza, aquí hay que mover su punto.
   --------------------------------------------------------------------- */
.buho { display: block; width: 100%; height: auto; overflow: visible; --buho-ojo-abierto: -34px; }
.buho g, .buho path, .buho circle, .buho ellipse, .buho rect, .buho text, .buho polygon { transform-box: view-box; }

.buho-cuerpo { transform-origin: 120px 300px; animation: buho-respira 4.6s ease-in-out infinite; }
.buho-cabeza { transform-origin: 120px 166px; animation: buho-ladea 12s ease-in-out infinite; }
.buho-borla { transform-origin: 170px 40px; transform: rotate(6deg); animation: buho-borla 3.8s ease-in-out infinite; }
.buho-flecos { transform-origin: 170px 67px; animation: buho-flecos 3.8s ease-in-out infinite; }
.buho-parpado { transform: translateY(var(--buho-ojo-abierto)); animation: buho-parpadea 6.4s infinite; }
.buho-pupila { transform: translate(var(--buho-mx, 0px), var(--buho-my, 0px)); transition: transform .22s ease-out; }
.buho-ala-d { transform-origin: 156px 166px; }
.buho-ala-i { transform-origin: 84px 166px; }
.buho-ala { transition: transform .5s var(--oia-ease, ease); }
.buho-penacho-i { transform-origin: 84px 92px; animation: buho-penacho-i 8s ease-in-out infinite; }
.buho-penacho-d { transform-origin: 156px 92px; animation: buho-penacho-d 8s ease-in-out infinite; }
.buho-ceja, .buho-tapa { transition: transform .3s var(--oia-ease, ease); }
.buho-ceja-i { transform-origin: 92px 100px; }
.buho-ceja-d { transform-origin: 148px 100px; }
.buho-pico-inf { transform-origin: 120px 144px; }
.buho-todo { transform-origin: 120px 302px; }
.buho-sonrisa, .buho-mejilla, .buho-zzz, .buho-idea, .buho-chispas { opacity: 0; transition: opacity .25s ease; }
.buho-chispas { transform-origin: 120px 110px; }
.buho-percha, .buho-destellos { display: none; }
.buho-reflejo { animation: buho-reflejo 7s ease-in-out infinite; }

/* Los destellos: cada estrella late a su ritmo y gira sobre sí misma. */
.buho .buho-estrella { transform-box: fill-box; transform-origin: 50% 50%; animation: buho-estrella 3.4s ease-in-out infinite; }
.buho-destellos g:nth-child(2) .buho-estrella { animation-delay: -1.1s; animation-duration: 4.2s; }
.buho-destellos g:nth-child(3) .buho-estrella { animation-delay: -2s; animation-duration: 3.8s; }
.buho-destellos g:nth-child(4) .buho-estrella { animation-delay: -.6s; animation-duration: 4.8s; }
@keyframes buho-estrella { 0%, 100% { transform: scale(.2) rotate(0deg); opacity: 0; } 50% { transform: scale(1) rotate(45deg); opacity: .95; } }

/* Reposo: todo se mueve poco y despacio. Es un búho sereno, no inquieto. */
@keyframes buho-respira { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.02); } }
@keyframes buho-ladea {
    0%, 40%, 100% { transform: rotate(0deg); }
    45%, 57% { transform: rotate(-4deg); }
    63%, 82% { transform: rotate(0deg); }
    86%, 94% { transform: rotate(3deg); }
}
@keyframes buho-borla { 0%, 100% { transform: rotate(2deg); } 50% { transform: rotate(10deg); } }
@keyframes buho-flecos { 0%, 100% { transform: rotate(3deg); } 50% { transform: rotate(-4deg); } }
/* Un parpadeo y, de vez en cuando, dos seguidos. */
@keyframes buho-parpadea {
    0%, 44%, 50%, 90%, 100% { transform: translateY(var(--buho-ojo-abierto)); }
    46.5%, 47.5% { transform: translateY(0); }
    92%, 93% { transform: translateY(0); }
    95% { transform: translateY(var(--buho-ojo-abierto)); }
    97%, 98% { transform: translateY(0); }
}
@keyframes buho-penacho-i { 0%, 72%, 100% { transform: rotate(0); } 77% { transform: rotate(-7deg); } 83% { transform: rotate(2deg); } }
@keyframes buho-penacho-d { 0%, 22%, 100% { transform: rotate(0); } 27% { transform: rotate(7deg); } 33% { transform: rotate(-2deg); } }
@keyframes buho-reflejo { 0%, 70%, 100% { opacity: .07; } 80% { opacity: .3; } }
@keyframes buho-brinco { 0% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-9px) scale(.99, 1.015); } 70% { transform: translateY(0) scale(1.015, .98); } 100% { transform: translateY(0) scale(1, 1); } }

/* Entrada: llega aleteando y se posa. */
[data-estado="entrada"] .buho-ala-d { animation: buho-aleteo-d .24s ease-in-out 6 alternate; transition: none; }
[data-estado="entrada"] .buho-ala-i { animation: buho-aleteo-i .24s ease-in-out 6 alternate; transition: none; }
[data-estado="entrada"] .buho-todo { animation: buho-posa 1.4s var(--oia-ease, ease) both; }
[data-estado="entrada"] .buho-borla { animation-duration: .7s; }
[data-estado="entrada"] .buho-penacho-i { animation: none; transform: rotate(-8deg); }
[data-estado="entrada"] .buho-penacho-d { animation: none; transform: rotate(8deg); }
@keyframes buho-posa { 0% { transform: translateY(-16px) rotate(-3deg); } 55% { transform: translateY(-20px) rotate(2deg); } 82% { transform: translateY(3px) scale(1.02, .97); } 100% { transform: translateY(0) rotate(0); } }
@keyframes buho-aleteo-d { from { transform: rotate(-6deg); } to { transform: rotate(-44deg); } }
@keyframes buho-aleteo-i { from { transform: rotate(6deg); } to { transform: rotate(44deg); } }

/* Saludo: una reverencia, con el ala abierta. Nada de aspavientos. */
[data-estado="saludo"] .buho-cabeza { animation: buho-reverencia 2s var(--oia-ease, ease) both; }
[data-estado="saludo"] .buho-ala-i { animation: buho-saluda 2s var(--oia-ease, ease) both; transition: none; }
[data-estado="saludo"] .buho-ceja { transform: translateY(-3px); }
[data-estado="saludo"] .buho-parpado { animation: buho-reverencia-ojos 2s ease-in-out both; }
[data-estado="saludo"] .buho-borla { animation-duration: 1s; }
@keyframes buho-reverencia {
    0%, 100% { transform: translateY(0) rotate(0); }
    28%, 46% { transform: translateY(9px) rotate(5deg); }
    70% { transform: translateY(0) rotate(-2deg); }
}
@keyframes buho-reverencia-ojos {
    0%, 14%, 62%, 100% { transform: translateY(var(--buho-ojo-abierto)); }
    28%, 46% { transform: translateY(0); }
}
@keyframes buho-saluda {
    0%, 100% { transform: rotate(0); }
    26% { transform: rotate(46deg); }
    40% { transform: rotate(36deg); }
    54% { transform: rotate(48deg); }
    70% { transform: rotate(40deg); }
}

/* Escucha: mientras el visitante escribe, atiende con los penachos tiesos. */
[data-estado="escucha"] .buho-cabeza { animation: none; transform: rotate(5deg); transition: transform .4s var(--oia-ease, ease); }
[data-estado="escucha"] .buho-penacho-i { animation: none; transform: rotate(-9deg); }
[data-estado="escucha"] .buho-penacho-d { animation: none; transform: rotate(9deg); }
[data-estado="escucha"] .buho-ceja { transform: translateY(-3.5px); }
[data-estado="escucha"] .buho-pupila { transform: translate(3.4px, 2.4px); }

/* Asiente: «entendido». */
[data-estado="asiente"] .buho-cabeza { animation: buho-asiente .44s ease-in-out 2; }
[data-estado="asiente"] .buho-parpado { animation: none; transform: translateY(-25px); }
@keyframes buho-asiente { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(6px) rotate(1.5deg); } }

/* Pensando: mira arriba, enarca una ceja y le suben las ideas. */
[data-estado="pensando"] .buho-cabeza { animation: buho-piensa-cabeza 2.6s ease-in-out infinite; }
[data-estado="pensando"] .buho-pupila { animation: buho-piensa-ojos 2.6s ease-in-out infinite; transition: none; }
[data-estado="pensando"] .buho-parpado { animation: none; transform: translateY(-28px); }
[data-estado="pensando"] .buho-borla { animation-duration: 1.3s; }
[data-estado="pensando"] .buho-ceja-i { transform: rotate(-5deg) translateY(-3px); }
[data-estado="pensando"] .buho-ceja-d { transform: translateY(1px); }
[data-estado="pensando"] .buho-ala-i { transform: rotate(10deg); }
[data-estado="pensando"] .buho-idea { opacity: 1; }
[data-estado="pensando"] .buho-idea circle { animation: buho-idea 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 50%; }
[data-estado="pensando"] .buho-idea circle:nth-child(2) { animation-delay: .2s; }
[data-estado="pensando"] .buho-idea circle:nth-child(3) { animation-delay: .4s; }
@keyframes buho-piensa-cabeza { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(-8deg); } }
@keyframes buho-piensa-ojos { 0%, 100% { transform: translate(-3.4px, -3.4px); } 50% { transform: translate(-.8px, -4.2px); } }
@keyframes buho-idea { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* Hablando: mueve el pico y acompaña con la cabeza y un ala. */
[data-estado="hablando"] .buho-pico-inf { animation: buho-habla .26s ease-in-out infinite alternate; }
[data-estado="hablando"] .buho-cabeza { animation: buho-habla-cabeza 1.2s ease-in-out infinite; }
[data-estado="hablando"] .buho-ala-i { animation: buho-gesto 1.8s ease-in-out infinite; transition: none; }
@keyframes buho-habla { from { transform: translateY(0); } to { transform: translateY(5px); } }
@keyframes buho-habla-cabeza { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(2deg) translateY(1.5px); } }
@keyframes buho-gesto { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(12deg); } }

/* Señala: «mira esto», con el ala hacia el chat. */
[data-estado="senala"] .buho-ala-d { animation: buho-senala 1.3s ease-in-out infinite; transition: none; }
[data-estado="senala"] .buho-cabeza { animation: none; transform: rotate(5deg); transition: transform .4s var(--oia-ease, ease); }
[data-estado="senala"] .buho-pupila { transform: translate(3.6px, .6px); }
[data-estado="senala"] .buho-pico-inf { animation: buho-habla .3s ease-in-out infinite alternate; }
[data-estado="senala"] .buho-ceja { transform: translateY(-2.5px); }
/* Ángulo corto a propósito: el ala es larga y, más abierta, tapa el texto del chat. */
@keyframes buho-senala { 0%, 100% { transform: rotate(-20deg); } 50% { transform: rotate(-27deg); } }

/* Feliz: ojos de sonrisa, mejillas, chispas y un salto. */
[data-estado="feliz"] .buho-parpado { animation: none; transform: translateY(0); }
[data-estado="feliz"] .buho-sonrisa { opacity: 1; }
[data-estado="feliz"] .buho-pestana { opacity: 0; }
[data-estado="feliz"] .buho-mejilla { opacity: .55; }
[data-estado="feliz"] .buho-chispas { opacity: 1; animation: buho-chispas .9s ease-out both; }
[data-estado="feliz"] .buho-todo { animation: buho-brinco .45s ease-out 2; }
[data-estado="feliz"] .buho-ala-d { animation: buho-alegria-d .28s ease-in-out 4 alternate; transition: none; }
[data-estado="feliz"] .buho-ala-i { animation: buho-alegria-i .28s ease-in-out 4 alternate; transition: none; }
[data-estado="feliz"] .buho-borla { animation-duration: .8s; }
[data-estado="feliz"] .buho-ceja { transform: translateY(-3.5px); }
@keyframes buho-chispas { from { opacity: 0; transform: scale(.75); } 35% { opacity: 1; } to { opacity: 0; transform: scale(1.16); } }
@keyframes buho-alegria-d { from { transform: rotate(0); } to { transform: rotate(-26deg); } }
@keyframes buho-alegria-i { from { transform: rotate(0); } to { transform: rotate(26deg); } }

/* Dormido: ojos cerrados, cabeza caída y zetas que suben. */
[data-estado="dormido"] .buho-parpado { animation: none; transform: translateY(0); transition: transform .6s ease; }
[data-estado="dormido"] .buho-cabeza { animation: buho-cabecea 5s ease-in-out infinite; }
[data-estado="dormido"] .buho-cuerpo { animation-duration: 6.5s; }
[data-estado="dormido"] .buho-borla { animation-duration: 6s; }
[data-estado="dormido"] .buho-penacho { animation: none; transform: rotate(0); }
[data-estado="dormido"] .buho-ceja { transform: translateY(2px); }
[data-estado="dormido"] .buho-zzz { opacity: 1; }
[data-estado="dormido"] .buho-zzz text { animation: buho-zzz 3s ease-in-out infinite; }
[data-estado="dormido"] .buho-zzz text:nth-child(2) { animation-delay: .5s; }
[data-estado="dormido"] .buho-zzz text:nth-child(3) { animation-delay: 1s; }
@keyframes buho-cabecea { 0%, 100% { transform: rotate(4deg) translateY(3px); } 50% { transform: rotate(6deg) translateY(6px); } }
@keyframes buho-zzz { 0% { opacity: 0; transform: translate(-6px, 8px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -10px); } }

/* Sorpresa: se le encogen las pupilas y se le erizan los penachos. */
[data-estado="sorpresa"] .buho-pupila { transform-box: fill-box; transform-origin: 50% 50%; transform: scale(.62); }
[data-estado="sorpresa"] .buho-parpado { animation: none; transform: translateY(var(--buho-ojo-abierto)); }
[data-estado="sorpresa"] .buho-penacho-i { animation: none; transform: rotate(-11deg); }
[data-estado="sorpresa"] .buho-penacho-d { animation: none; transform: rotate(11deg); }
[data-estado="sorpresa"] .buho-ceja { transform: translateY(-5px); }
[data-estado="sorpresa"] .buho-tapa, [data-estado="escucha"] .buho-tapa { transform: translateY(-5px); }
[data-estado="sorpresa"] .buho-todo { animation: buho-brinco .35s ease-out both; }

/* ---------------------------------------------------------------------
   1 bis. Manías y números
   ---------------------------------------------------------------------
   Manías: gestos cortos que hace sola cuando no pasa nada (curiosa,
   sacude, reojo). Números: lo que hace cuando se le pulsa, uno distinto
   cada vez (giro, birrete, voltereta, estornudo, baile, tapado, guino).
   Todos siguen la misma receta: anticipación → acción → rebote → vuelta.
   La duración de cada uno está también en public/js/asistente.js
   (NUMEROS y MANIAS): si se cambia aquí, se cambia allí.
   --------------------------------------------------------------------- */
.buho-birrete { transform-origin: 120px 46px; }
.buho-mareo, .buho-notas, .buho-plumas, .buho-confeti, .buho-destello-guino { opacity: 0; pointer-events: none; }
.buho .buho-nota, .buho .buho-pluma, .buho .buho-trozo, .buho .buho-destello-guino { transform-box: fill-box; transform-origin: 50% 50%; }
.buho-mareo-rueda { transform-origin: 0 0; }

/* --- Manía: curiosa. Ladea la cabeza como hacen los búhos. --- */
[data-estado="curiosa"] .buho-cabeza { animation: buho-curiosa 1.9s var(--oia-ease, ease) both; }
[data-estado="curiosa"] .buho-tapa { transform: translateY(-5px); }
[data-estado="curiosa"] .buho-ceja { transform: translateY(-3px); }
[data-estado="curiosa"] .buho-penacho-i { animation: none; transform: rotate(-8deg); }
[data-estado="curiosa"] .buho-penacho-d { animation: none; transform: rotate(8deg); }
@keyframes buho-curiosa {
    0%, 100% { transform: rotate(0); }
    8% { transform: rotate(4deg); }
    26%, 68% { transform: rotate(-26deg) translate(-4px, 2px); }
    84% { transform: rotate(4deg); }
}

/* --- Manía: sacude. Se ahueca las plumas de un escalofrío. --- */
[data-estado="sacude"] .buho-todo { animation: buho-sacude 1s ease-in-out both; }
[data-estado="sacude"] .buho-ala-i { animation: buho-sacude-ala-i 1s ease-in-out both; transition: none; }
[data-estado="sacude"] .buho-ala-d { animation: buho-sacude-ala-d 1s ease-in-out both; transition: none; }
[data-estado="sacude"] .buho-parpado { animation: none; transform: translateY(0); }
[data-estado="sacude"] .buho-borla { animation-duration: .25s; }
[data-estado="sacude"] .buho-penacho-i { animation: buho-sacude-ala-i .25s ease-in-out 4; }
[data-estado="sacude"] .buho-penacho-d { animation: buho-sacude-ala-d .25s ease-in-out 4; }
@keyframes buho-sacude {
    0%, 100% { transform: rotate(0) scale(1, 1); }
    12% { transform: rotate(-3deg) scale(1.06, 1.02); }
    26% { transform: rotate(3deg) scale(1.07, 1.02); }
    40% { transform: rotate(-3deg) scale(1.07, 1.02); }
    54% { transform: rotate(3deg) scale(1.06, 1.02); }
    68% { transform: rotate(-2deg) scale(1.04, 1.01); }
    84% { transform: rotate(1deg) scale(1, .99); }
}
@keyframes buho-sacude-ala-i { 0%, 100% { transform: rotate(0); } 30%, 70% { transform: rotate(13deg); } 50% { transform: rotate(6deg); } }
@keyframes buho-sacude-ala-d { 0%, 100% { transform: rotate(0); } 30%, 70% { transform: rotate(-13deg); } 50% { transform: rotate(-6deg); } }

/* --- Manía: reojo. Mira de lado al chat, enarca una ceja y vuelve. --- */
[data-estado="reojo"] .buho-pupila { animation: buho-reojo 1.7s ease-in-out both; transition: none; }
[data-estado="reojo"] .buho-ceja-d { transform: translateY(-3px) rotate(4deg); }
[data-estado="reojo"] .buho-cabeza { animation: none; transform: rotate(-2deg); transition: transform .4s var(--oia-ease, ease); }
@keyframes buho-reojo { 0%, 100% { transform: translate(0, 0); } 22%, 74% { transform: translate(4px, .5px); } }

/* ===== Número 1: giro. La cabeza da dos vueltas enteras y se marea. ===== */
[data-estado="giro"] .buho-cabeza { transform-origin: 120px 118px; animation: buho-giro 3.2s both; }
[data-estado="giro"] .buho-todo { animation: buho-tambaleo 3.2s ease-in-out both; }
[data-estado="giro"] .buho-borla { animation-duration: .22s; }
[data-estado="giro"] .buho-flecos { animation-duration: .22s; }
[data-estado="giro"] .buho-tapa { transform: translateY(-5px); }
[data-estado="giro"] .buho-ceja-i { animation: buho-giro-ceja-i 3.2s both; }
[data-estado="giro"] .buho-ceja-d { animation: buho-giro-ceja-d 3.2s both; }
[data-estado="giro"] .buho-pupila { animation: buho-mareo-ojos .42s linear 1.72s 3; transition: none; }
[data-estado="giro"] .buho-ojo-d .buho-pupila { animation-direction: reverse; }
[data-estado="giro"] .buho-parpado { animation: buho-giro-parpado 3.2s both; }
[data-estado="giro"] .buho-mareo { animation: buho-aparece 1.5s ease-in-out 1.6s both; }
[data-estado="giro"] .buho-mareo-rueda { animation: buho-rueda .7s linear infinite; }
[data-estado="giro"] .buho-penacho { animation: none; }
@keyframes buho-giro {
    0% { transform: rotate(0); animation-timing-function: ease-out; }
    9% { transform: rotate(-26deg); animation-timing-function: cubic-bezier(.5, 0, .2, 1); }   /* toma impulso */
    50% { transform: rotate(720deg); animation-timing-function: ease-out; }                    /* dos vueltas */
    56% { transform: rotate(738deg); }                                                         /* se pasa */
    62% { transform: rotate(714deg); }
    68%, 100% { transform: rotate(720deg); }
}
@keyframes buho-tambaleo {
    0%, 52%, 100% { transform: rotate(0); }
    6% { transform: rotate(-2deg); }
    62% { transform: rotate(5deg); }
    72% { transform: rotate(-5deg); }
    82% { transform: rotate(3deg); }
    91% { transform: rotate(-1.5deg); }
}
@keyframes buho-giro-ceja-i { 0%, 52%, 100% { transform: translateY(-4px); } 60%, 92% { transform: translateY(-5px) rotate(-8deg); } }
@keyframes buho-giro-ceja-d { 0%, 52%, 100% { transform: translateY(-4px); } 60%, 92% { transform: translateY(1px) rotate(-5deg); } }
@keyframes buho-mareo-ojos {
    0%, 100% { transform: translate(3.2px, 0); }
    25% { transform: translate(0, 3.2px); }
    50% { transform: translate(-3.2px, 0); }
    75% { transform: translate(0, -3.2px); }
}
@keyframes buho-giro-parpado {
    0%, 93%, 96.5%, 100% { transform: translateY(var(--buho-ojo-abierto)); }
    94.5%, 95.5% { transform: translateY(0); }
    98%, 99% { transform: translateY(0); }
}
@keyframes buho-aparece { 0%, 100% { opacity: 0; } 12%, 86% { opacity: 1; } }
@keyframes buho-rueda { to { transform: rotate(360deg); } }

/* ===== Número 2: birrete. Lo lanza al aire como en una graduación y lo recoge. ===== */
[data-estado="birrete"] .buho-birrete { animation: buho-lanza 3.3s both; }
[data-estado="birrete"] .buho-todo { animation: buho-impulso 3.3s both; }
[data-estado="birrete"] .buho-cabeza { animation: buho-mira-vuelo 3.3s ease-in-out both; }
[data-estado="birrete"] .buho-pupila { animation: buho-sigue 3.3s ease-in-out both; transition: none; }
[data-estado="birrete"] .buho-ala-d { animation: buho-brazos-d 3.3s both; transition: none; }
[data-estado="birrete"] .buho-ala-i { animation: buho-brazos-i 3.3s both; transition: none; }
[data-estado="birrete"] .buho-tapa { transform: translateY(-5px); }
[data-estado="birrete"] .buho-ceja { transform: translateY(-4px); }
[data-estado="birrete"] .buho-borla { animation-duration: .3s; }
[data-estado="birrete"] .buho-parpado { animation: buho-ojos-de-fiesta 3.3s both; }
[data-estado="birrete"] .buho-sonrisa { animation: buho-fiesta 3.3s both; }
[data-estado="birrete"] .buho-pestana { animation: buho-fiesta-fuera 3.3s both; }
[data-estado="birrete"] .buho-mejilla { animation: buho-fiesta-media 3.3s both; }
[data-estado="birrete"] .buho-confeti { opacity: 1; }
[data-estado="birrete"] .buho-trozo { animation: buho-confeti 1s cubic-bezier(.15, .7, .3, 1) 2.2s both; }
[data-estado="birrete"] .buho-penacho-i { animation: none; transform: rotate(-7deg); }
[data-estado="birrete"] .buho-penacho-d { animation: none; transform: rotate(7deg); }
@keyframes buho-lanza {
    0% { transform: translateY(0) rotate(0) scale(1, 1); animation-timing-function: ease-in-out; }
    11% { transform: translateY(7px) rotate(0) scale(1.04, .92); animation-timing-function: cubic-bezier(.15, .8, .35, 1); }   /* se encoge */
    42% { transform: translateY(-178px) rotate(580deg) scale(.8, .8); animation-timing-function: cubic-bezier(.65, 0, .9, .45); } /* arriba del todo */
    68% { transform: translateY(5px) rotate(1080deg) scale(1.05, .9); animation-timing-function: ease-out; }                    /* lo caza */
    75% { transform: translateY(-8px) rotate(1080deg) scale(.98, 1.03); }
    82%, 100% { transform: translateY(0) rotate(1080deg) scale(1, 1); }
}
@keyframes buho-impulso {
    0%, 28%, 62%, 82%, 100% { transform: translateY(0) scale(1, 1); }
    10% { transform: translateY(0) scale(1.05, .93); }
    17% { transform: translateY(-10px) scale(.97, 1.05); }
    69% { transform: translateY(0) scale(1.05, .94); }
    76% { transform: translateY(-4px) scale(.99, 1.02); }
}
@keyframes buho-mira-vuelo {
    0%, 100% { transform: translateY(0) rotate(0); }
    10% { transform: translateY(4px) rotate(0); }
    22%, 56% { transform: translateY(-3px) rotate(-4deg); }
    69% { transform: translateY(6px) rotate(1deg); }
    78% { transform: translateY(-1px) rotate(0); }
}
@keyframes buho-sigue { 0%, 12%, 66%, 100% { transform: translate(0, 0); } 24%, 54% { transform: translate(1px, -4.4px); } }
@keyframes buho-brazos-d {
    0%, 100% { transform: rotate(0); }
    10% { transform: rotate(10deg); }
    19%, 30% { transform: rotate(-148deg); }
    46% { transform: rotate(-24deg); }
    60%, 67% { transform: rotate(-136deg); }
    80% { transform: rotate(-34deg); }
}
@keyframes buho-brazos-i {
    0%, 100% { transform: rotate(0); }
    10% { transform: rotate(-10deg); }
    19%, 30% { transform: rotate(148deg); }
    46% { transform: rotate(24deg); }
    60%, 67% { transform: rotate(136deg); }
    80% { transform: rotate(34deg); }
}
/* Ojos de sonrisa del remate: del 70 % al 96 %. */
@keyframes buho-ojos-de-fiesta { 0%, 68%, 98%, 100% { transform: translateY(var(--buho-ojo-abierto)); } 71%, 95% { transform: translateY(0); } }
@keyframes buho-fiesta { 0%, 69%, 97%, 100% { opacity: 0; } 72%, 94% { opacity: 1; } }
@keyframes buho-fiesta-fuera { 0%, 68%, 98%, 100% { opacity: 1; } 70%, 96% { opacity: 0; } }
@keyframes buho-fiesta-media { 0%, 69%, 97%, 100% { opacity: 0; } 72%, 94% { opacity: .55; } }
@keyframes buho-confeti {
    0% { opacity: 0; transform: translate(0, 0) rotate(0) scale(.2); }
    10% { opacity: 1; }
    55% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--giro)) scale(1); }
    100% { opacity: 0; transform: translate(calc(var(--dx) * 1.12), calc(var(--dy) + 78px)) rotate(calc(var(--giro) * 1.6)) scale(.9); }
}

/* ===== Número 3: voltereta. Salto mortal, aterriza y «¡tachán!». ===== */
[data-estado="voltereta"] .buho-todo { transform-origin: 120px 190px; animation: buho-voltereta 3.2s both; }
[data-estado="voltereta"] .buho-ala-d { animation: buho-voltereta-ala-d 3.2s both; transition: none; }
[data-estado="voltereta"] .buho-ala-i { animation: buho-voltereta-ala-i 3.2s both; transition: none; }
[data-estado="voltereta"] .buho-borla { animation-duration: .26s; }
[data-estado="voltereta"] .buho-tapa { transform: translateY(-5px); }
[data-estado="voltereta"] .buho-ceja { transform: translateY(-4px); }
[data-estado="voltereta"] .buho-parpado { animation: buho-ojos-de-tachan 3.2s both; }
[data-estado="voltereta"] .buho-sonrisa { animation: buho-tachan 3.2s both; }
[data-estado="voltereta"] .buho-pestana { animation: buho-tachan-fuera 3.2s both; }
[data-estado="voltereta"] .buho-mejilla { animation: buho-tachan-media 3.2s both; }
[data-estado="voltereta"] .buho-cabeza { animation: buho-tachan-cabeza 3.2s both; }
[data-estado="voltereta"] .buho-confeti { opacity: 1; }
[data-estado="voltereta"] .buho-trozo { animation: buho-confeti 1s cubic-bezier(.15, .7, .3, 1) 1.66s both; }
@keyframes buho-voltereta {
    0% { transform: translateY(0) rotate(0) scale(1, 1); animation-timing-function: ease-in-out; }
    9% { transform: translateY(13px) rotate(0) scale(1.08, .88); animation-timing-function: cubic-bezier(.2, .8, .4, 1); }   /* se agacha */
    19% { transform: translateY(-66px) rotate(-46deg) scale(.95, 1.07); animation-timing-function: linear; }
    30% { transform: translateY(-124px) rotate(-190deg) scale(1, 1); animation-timing-function: linear; }                    /* boca abajo */
    41% { transform: translateY(-70px) rotate(-328deg) scale(.96, 1.05); animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
    49% { transform: translateY(15px) rotate(-360deg) scale(1.1, .86); animation-timing-function: ease-out; }                /* aterriza */
    56% { transform: translateY(-8px) rotate(-360deg) scale(.97, 1.04); }
    63%, 100% { transform: translateY(0) rotate(-360deg) scale(1, 1); }
}
@keyframes buho-voltereta-ala-d {
    0%, 100% { transform: rotate(0); }
    9% { transform: rotate(8deg); }
    18%, 42% { transform: rotate(-78deg); }
    49% { transform: rotate(-20deg); }
    58% { transform: rotate(-124deg); }      /* ¡tachán! */
    66% { transform: rotate(-108deg); }
    74%, 88% { transform: rotate(-118deg); }
}
@keyframes buho-voltereta-ala-i {
    0%, 100% { transform: rotate(0); }
    9% { transform: rotate(-8deg); }
    18%, 42% { transform: rotate(78deg); }
    49% { transform: rotate(20deg); }
    58% { transform: rotate(124deg); }
    66% { transform: rotate(108deg); }
    74%, 88% { transform: rotate(118deg); }
}
@keyframes buho-ojos-de-tachan { 0%, 52%, 92%, 100% { transform: translateY(var(--buho-ojo-abierto)); } 56%, 89% { transform: translateY(0); } }
@keyframes buho-tachan { 0%, 53%, 91%, 100% { opacity: 0; } 57%, 88% { opacity: 1; } }
@keyframes buho-tachan-fuera { 0%, 52%, 92%, 100% { opacity: 1; } 55%, 90% { opacity: 0; } }
@keyframes buho-tachan-media { 0%, 53%, 91%, 100% { opacity: 0; } 57%, 88% { opacity: .55; } }
@keyframes buho-tachan-cabeza { 0%, 52%, 94%, 100% { transform: rotate(0); } 60%, 88% { transform: rotate(-5deg) translateY(-2px); } }

/* ===== Número 4: estornudo. «A… aaa… ¡ACHÍS!»: le salta el birrete y suelta plumas. ===== */
[data-estado="estornudo"] .buho-cabeza { animation: buho-estornudo 3s both; }
[data-estado="estornudo"] .buho-cuerpo { animation: buho-estornudo-cuerpo 3s both; }
[data-estado="estornudo"] .buho-pico-inf { animation: buho-estornudo-pico 3s both; }
[data-estado="estornudo"] .buho-parpado { animation: buho-estornudo-ojos 3s both; }
[data-estado="estornudo"] .buho-ceja-i { animation: buho-estornudo-ceja-i 3s both; }
[data-estado="estornudo"] .buho-ceja-d { animation: buho-estornudo-ceja-d 3s both; }
[data-estado="estornudo"] .buho-birrete { animation: buho-estornudo-birrete 3s both; }
[data-estado="estornudo"] .buho-ala-i { animation: buho-estornudo-ala-i 3s both; transition: none; }
[data-estado="estornudo"] .buho-ala-d { animation: buho-estornudo-ala-d 3s both; transition: none; }
[data-estado="estornudo"] .buho-borla { animation: buho-borla .2s ease-in-out 1.5s 5; }
[data-estado="estornudo"] .buho-plumas { opacity: 1; }
[data-estado="estornudo"] .buho-pluma { animation: buho-pluma 1.5s cubic-bezier(.15, .6, .4, 1) 1.5s both; }
[data-estado="estornudo"] .buho-penacho { animation: none; }
@keyframes buho-estornudo {
    0%, 86%, 100% { transform: translateY(0) rotate(0); }
    14% { transform: translateY(-3px) rotate(-5deg); }                                              /* a… */
    22% { transform: translateY(-1px) rotate(-3deg); }
    36% { transform: translateY(-7px) rotate(-10deg); }                                             /* aaa… */
    46% { transform: translateY(-9px) rotate(-13deg); animation-timing-function: cubic-bezier(.8, 0, 1, .6); }
    51% { transform: translateY(17px) rotate(13deg); animation-timing-function: ease-out; }         /* ¡ACHÍS! */
    60% { transform: translateY(2px) rotate(-4deg); }
    68% { transform: translateY(6px) rotate(4deg); }
    77% { transform: translateY(0) rotate(-1deg); }
}
@keyframes buho-estornudo-cuerpo {
    0%, 70%, 100% { transform: scale(1, 1); }
    14% { transform: scale(1.02, 1.015); }
    22% { transform: scale(1.01, 1.005); }
    46% { transform: scale(1.06, 1.045); }
    51% { transform: scale(1.07, .93); }
    60% { transform: scale(.98, 1.03); }
}
@keyframes buho-estornudo-pico {
    0%, 60%, 100% { transform: translateY(0); }
    14% { transform: translateY(3px); }
    22% { transform: translateY(1.5px); }
    36%, 46% { transform: translateY(6px); }
    51% { transform: translateY(7px); }
}
@keyframes buho-estornudo-ojos {
    0%, 6%, 74%, 82%, 100% { transform: translateY(var(--buho-ojo-abierto)); }
    14% { transform: translateY(-22px); }
    22% { transform: translateY(-27px); }
    36%, 46% { transform: translateY(-10px); }
    50%, 64% { transform: translateY(0); }
    78% { transform: translateY(0); }
}
@keyframes buho-estornudo-ceja-i { 0%, 6%, 72%, 100% { transform: none; } 14%, 22% { transform: translateY(-2px) rotate(5deg); } 36%, 46% { transform: translateY(-4px) rotate(9deg); } 51%, 62% { transform: translateY(3px) rotate(-4deg); } }
@keyframes buho-estornudo-ceja-d { 0%, 6%, 72%, 100% { transform: none; } 14%, 22% { transform: translateY(-2px) rotate(-5deg); } 36%, 46% { transform: translateY(-4px) rotate(-9deg); } 51%, 62% { transform: translateY(3px) rotate(4deg); } }
@keyframes buho-estornudo-birrete {
    0%, 48%, 82%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-4px) rotate(2deg); animation-timing-function: cubic-bezier(.1, .8, .3, 1); }
    60% { transform: translateY(-34px) rotate(19deg); animation-timing-function: cubic-bezier(.7, 0, .9, .5); }   /* le salta */
    70% { transform: translateY(4px) rotate(-3deg); }
    76% { transform: translateY(-3px) rotate(1deg); }
}
@keyframes buho-estornudo-ala-i { 0%, 44%, 72%, 100% { transform: rotate(0); } 36% { transform: rotate(8deg); } 52% { transform: rotate(30deg); } 60% { transform: rotate(10deg); } }
@keyframes buho-estornudo-ala-d { 0%, 44%, 72%, 100% { transform: rotate(0); } 36% { transform: rotate(-8deg); } 52% { transform: rotate(-30deg); } 60% { transform: rotate(-10deg); } }
@keyframes buho-pluma {
    0% { opacity: 0; transform: translate(0, 0) rotate(0) scale(.3); }
    8% { opacity: 1; }
    45% { opacity: 1; transform: translate(var(--dx), calc(var(--dy) - 26px)) rotate(var(--giro)) scale(1); }
    100% { opacity: 0; transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) + 46px)) rotate(calc(var(--giro) * 1.7)) scale(1); }
}

/* ===== Número 5: baile. Un bailecito de lado a lado, cantando. ===== */
[data-estado="baile"] .buho-todo { animation: buho-baile .8s ease-in-out 4 both; }
[data-estado="baile"] .buho-cabeza { animation: buho-baile-cabeza .8s ease-in-out 4 both; }
[data-estado="baile"] .buho-ala-i { animation: buho-baile-ala-i .8s ease-in-out 4 both; transition: none; }
[data-estado="baile"] .buho-ala-d { animation: buho-baile-ala-d .8s ease-in-out 4 both; transition: none; }
[data-estado="baile"] .buho-pico-inf { animation: buho-habla .2s ease-in-out infinite alternate; }
[data-estado="baile"] .buho-borla { animation-duration: .8s; }
[data-estado="baile"] .buho-parpado { animation: none; transform: translateY(0); }
[data-estado="baile"] .buho-sonrisa { opacity: 1; }
[data-estado="baile"] .buho-pestana { opacity: 0; }
[data-estado="baile"] .buho-mejilla { opacity: .5; }
[data-estado="baile"] .buho-ceja { transform: translateY(-3px); }
[data-estado="baile"] .buho-notas { opacity: 1; }
[data-estado="baile"] .buho-nota { animation: buho-nota 1.6s ease-out 2 both; }
[data-estado="baile"] .buho-notas > g:nth-child(2) .buho-nota { animation-delay: .4s; }
[data-estado="baile"] .buho-notas > g:nth-child(3) .buho-nota { animation-delay: .8s; }
[data-estado="baile"] .buho-notas > g:nth-child(4) .buho-nota { animation-delay: 1.2s; }
@keyframes buho-baile {
    0%, 100% { transform: translateX(0) rotate(0) scale(1, 1); }
    25% { transform: translateX(-8px) rotate(-7deg) scale(1.03, .97); }
    50% { transform: translateX(0) rotate(0) scale(.98, 1.03); }
    75% { transform: translateX(8px) rotate(7deg) scale(1.03, .97); }
}
@keyframes buho-baile-cabeza { 0%, 50%, 100% { transform: rotate(0) translateY(0); } 25% { transform: rotate(9deg) translateY(2px); } 75% { transform: rotate(-9deg) translateY(2px); } }
@keyframes buho-baile-ala-i { 0%, 50%, 100% { transform: rotate(14deg); } 25% { transform: rotate(66deg); } 75% { transform: rotate(4deg); } }
@keyframes buho-baile-ala-d { 0%, 50%, 100% { transform: rotate(-14deg); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(-66deg); } }
@keyframes buho-nota {
    0% { opacity: 0; transform: translate(0, 10px) rotate(-10deg) scale(.5); }
    20% { opacity: 1; }
    60% { opacity: 1; transform: translate(6px, -22px) rotate(10deg) scale(1); }
    100% { opacity: 0; transform: translate(-4px, -46px) rotate(-8deg) scale(.9); }
}

/* ===== Número 6: tapado. El birrete se le cae sobre los ojos y lo recoloca con el ala. ===== */
[data-estado="tapado"] .buho-birrete { animation: buho-tapado 3.6s both; }
[data-estado="tapado"] .buho-cabeza { animation: buho-tapado-cabeza 3.6s ease-in-out both; }
[data-estado="tapado"] .buho-pupila { animation: buho-tapado-ojos 3.6s ease-in-out both; transition: none; }
[data-estado="tapado"] .buho-ala-d { animation: buho-tapado-ala 3.6s both; transition: none; }
[data-estado="tapado"] .buho-ala-i { animation: buho-tapado-ala-i 3.6s both; transition: none; }
[data-estado="tapado"] .buho-parpado { animation: buho-tapado-parpado 3.6s both; }
[data-estado="tapado"] .buho-borla { animation: buho-borla .22s ease-in-out .35s 6; }
[data-estado="tapado"] .buho-todo { animation: buho-tapado-susto 3.6s both; }
[data-estado="tapado"] .buho-penacho { animation: none; }
@keyframes buho-tapado {
    0% { transform: translateY(0) rotate(0); }
    5% { transform: translateY(-6px) rotate(-5deg); animation-timing-function: cubic-bezier(.6, 0, .9, .5); }   /* se suelta */
    12% { transform: translateY(54px) rotate(10deg); animation-timing-function: ease-out; }                    /* ¡plof! */
    16% { transform: translateY(48px) rotate(6deg); }
    20%, 62% { transform: translateY(51px) rotate(8deg); }                                                      /* a oscuras */
    66% { transform: translateY(46px) rotate(4deg); animation-timing-function: cubic-bezier(.2, .9, .3, 1); }
    74% { transform: translateY(-16px) rotate(-7deg); }                                                         /* el ala lo sube */
    82% { transform: translateY(3px) rotate(2deg); }
    89%, 100% { transform: translateY(0) rotate(0); }
}
@keyframes buho-tapado-cabeza {
    0%, 22%, 58%, 100% { transform: rotate(0) translateY(0); }
    12% { transform: rotate(0) translateY(5px); }
    30%, 36% { transform: rotate(-10deg); }       /* ¿quién ha apagado la luz? */
    44%, 50% { transform: rotate(10deg); }
    76% { transform: rotate(0) translateY(-3px); }
    84% { transform: rotate(0) translateY(2px); }
}
@keyframes buho-tapado-ojos {
    0%, 16%, 80%, 100% { transform: translate(0, 0); }
    30%, 36% { transform: translate(-4px, 1px); }
    44%, 50% { transform: translate(4px, 1px); }
    58%, 68% { transform: translate(0, -4px); }
}
@keyframes buho-tapado-ala {
    0%, 54%, 92%, 100% { transform: rotate(0); }
    64% { transform: rotate(-150deg); }
    72% { transform: rotate(-176deg); }
    80% { transform: rotate(-120deg); }
}
@keyframes buho-tapado-ala-i { 0%, 22%, 56%, 100% { transform: rotate(0); } 30%, 36% { transform: rotate(38deg); } 44%, 50% { transform: rotate(14deg); } }
@keyframes buho-tapado-parpado {
    0%, 91%, 94.5%, 100% { transform: translateY(var(--buho-ojo-abierto)); }
    92.5%, 93.5% { transform: translateY(0); }
    96%, 97% { transform: translateY(0); }
}
@keyframes buho-tapado-susto { 0%, 9%, 20%, 100% { transform: translateY(0) scale(1, 1); } 13% { transform: translateY(0) scale(1.04, .95); } 16% { transform: translateY(-3px) scale(.99, 1.02); } }

/* ===== Número 7: guiño. Corto y con destello. ===== */
[data-estado="guino"] .buho-ojo-d .buho-parpado { animation: buho-guino 1.6s ease-in-out both; }
[data-estado="guino"] .buho-ojo-i .buho-parpado { animation: none; transform: translateY(var(--buho-ojo-abierto)); }
[data-estado="guino"] .buho-ojo-i .buho-tapa { transform: translateY(-5px); }
[data-estado="guino"] .buho-cabeza { animation: buho-guino-cabeza 1.6s var(--oia-ease, ease) both; }
[data-estado="guino"] .buho-ceja-i { transform: translateY(-4px); }
[data-estado="guino"] .buho-ceja-d { transform: translateY(1.5px) rotate(3deg); }
[data-estado="guino"] .buho-mejilla { opacity: .45; }
[data-estado="guino"] .buho-pico-inf { transform: translateY(2.5px); }
[data-estado="guino"] .buho-todo { animation: buho-brinco .4s ease-out .34s both; }
[data-estado="guino"] .buho-destello-guino { animation: buho-destello 1.6s ease-out both; }
[data-estado="guino"] .buho-ala-i { animation: buho-guino-ala 1.6s var(--oia-ease, ease) both; transition: none; }
@keyframes buho-guino { 0%, 16%, 74%, 100% { transform: translateY(var(--buho-ojo-abierto)); } 26%, 62% { transform: translateY(0); } }
@keyframes buho-guino-cabeza { 0%, 100% { transform: rotate(0); } 24%, 66% { transform: rotate(8deg) translateY(1px); } }
@keyframes buho-guino-ala { 0%, 100% { transform: rotate(0); } 28%, 62% { transform: rotate(30deg); } }
@keyframes buho-destello {
    0%, 20%, 72%, 100% { opacity: 0; transform: scale(.2) rotate(0); }
    34% { opacity: 1; transform: scale(1.5) rotate(40deg); }
    52% { opacity: 1; transform: scale(1) rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
    .buho *, .buho { animation: none !important; transition: none !important; }
    .buho-mareo, .buho-notas, .buho-plumas, .buho-confeti, .buho-destello-guino { opacity: 0 !important; }
    .buho-parpado { transform: translateY(var(--buho-ojo-abierto)) !important; }
    [data-estado="dormido"] .buho-parpado, [data-estado="feliz"] .buho-parpado { transform: translateY(0) !important; }
    .buho .buho-estrella { opacity: .6; }
}

/* ---------------------------------------------------------------------
   2. El chat
   --------------------------------------------------------------------- */
.asis {
    --asis-oro: var(--oia-amber, #d59a2f);
    --asis-oro-2: var(--oia-amber-2, #e9b84a);
    --asis-negro: #0c0c0f;
    --asis-negro-2: #16161a;
    --asis-negro-3: #1f1f25;
    --asis-linea: rgba(255, 255, 255, .1);
    --asis-texto: #f1f0ec;
    --asis-suave: #a1a1a6;
    --asis-tinta: #1a1205;
    /* Tamaños de la mascota: cerrada (el botón) y abierta (junto al chat). */
    --asis-buho: 126px;
    --asis-buho-abierto: 300px;
    /* El chat es más grande que el de un chatbot al uso (petición del
       propietario): se abre para trabajar en él con comodidad. */
    --asis-panel: 540px;
    --asis-panel-alto: 790px;
    position: fixed; right: 22px; bottom: 22px; z-index: 2500;
    font-family: var(--oia-font-body, 'Inter', system-ui, sans-serif);
    color: var(--asis-texto);
}
.asis [x-cloak] { display: none !important; }
.asis button { font: inherit; color: inherit; cursor: pointer; }

/* --- La mascota: UN solo búho. Cerrado es el botón de la esquina; al abrir
       el chat se desliza hasta su lado, crece y se posa en su libro, fuera
       de la caja. Va SOLA, sin disco ni resplandor detrás (regla del
       propietario): solo la figura, que se recorta sobre el negro con su
       filo de oro. --- */
.asis-mascota {
    position: absolute; right: 0; bottom: 0; z-index: 3; width: var(--asis-buho); padding: 0; border: 0; background: none;
    display: block; line-height: 0; -webkit-tap-highlight-color: transparent;
    transition: right .75s var(--oia-ease, ease), bottom .75s var(--oia-ease, ease), width .75s var(--oia-ease, ease), transform .35s var(--oia-ease, ease);
}
.asis-mascota:focus-visible { outline: 2px solid #fff; outline-offset: 6px; border-radius: 30px; }
.asis-mascota .buho { position: relative; z-index: 1; margin-bottom: -5%; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .45)); }
.asis:not(.is-abierto) .asis-mascota:hover { transform: translateY(-4px) scale(1.05); }

.asis-aviso {
    position: absolute; z-index: 2; top: 37%; right: 0; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
    background: #fff; color: var(--asis-tinta); font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

/* Abierto, en escritorio: al lado del chat, en grande y sobre su libro. */
@media (min-width: 720px) {
    .asis.is-abierto .asis-mascota {
        right: calc(var(--asis-panel) - var(--asis-buho-abierto) * .24); bottom: -2px; width: var(--asis-buho-abierto);
        /* La caja del SVG pisa el borde del chat: solo el dibujo recibe el ratón. */
        pointer-events: none;
    }
    .asis.is-abierto .asis-mascota .buho { margin-bottom: 0; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .6)); }
    .asis.is-abierto .asis-mascota .buho-todo, .asis.is-abierto .asis-mascota .buho-percha { pointer-events: auto; cursor: pointer; }
    .asis.is-abierto .buho-percha, .asis.is-abierto .buho-destellos { display: block; }
    .asis.is-abierto .buho-sombra { display: none; }
}
@media (min-width: 720px) and (max-width: 1099px) { .asis { --asis-panel: 440px; --asis-buho-abierto: 232px; } }
@media (min-width: 720px) and (max-height: 800px) { .asis { --asis-buho-abierto: 220px; } }

/* --- Globo de invitación --- */
.asis-globo {
    position: absolute; z-index: 4; right: calc(var(--asis-buho) + 4px); bottom: 34px; width: max-content; max-width: min(280px, calc(100vw - var(--asis-buho) - 44px));
    background: #fff; color: #17171b; border-radius: 18px 18px 4px 18px; padding: 12px 34px 12px 15px;
    font-size: 14px; line-height: 1.4; font-weight: 500; text-align: left; border: 0;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .65);
    animation: asis-entra .5s var(--oia-ease, ease) both;
}
.asis-globo strong { color: #8a6118; font-weight: 700; }
.asis-globo-x {
    position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0;
    background: transparent; color: #6e6e76 !important; font-size: 15px; line-height: 1;
}
.asis-globo-x:hover { background: #eeece6; }
@keyframes asis-entra { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }

/* --- El velo: con el chat abierto la página de detrás se difumina y se
       oscurece, para que todo el protagonismo sea del chat y de la mascota.
       Pulsarlo cierra. En móvil no hace falta: el chat ocupa la pantalla. --- */
.asis-velo {
    position: fixed; inset: 0; z-index: 1; background: rgba(4, 4, 6, .56);
    -webkit-backdrop-filter: blur(10px) saturate(.85); backdrop-filter: blur(10px) saturate(.85);
    animation: asis-velo .5s ease both;
}
@keyframes asis-velo { from { opacity: 0; } to { opacity: 1; } }

/* --- Panel --- */
.asis-panel {
    position: absolute; right: 0; bottom: 0; z-index: 2; width: var(--asis-panel); height: min(var(--asis-panel-alto), calc(100dvh - 40px));
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--asis-negro); border: 1px solid var(--asis-linea); border-radius: 26px;
    box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(213, 154, 47, .12), 0 0 70px -30px rgba(213, 154, 47, .5);
    transform-origin: 100% 100%; animation: asis-abre .42s var(--oia-ease, ease) both;
}
@keyframes asis-abre { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }

.asis-cab {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px;
    background: radial-gradient(ellipse 80% 140% at 0% 0%, rgba(213, 154, 47, .22), transparent 62%), #000;
    border-bottom: 1px solid var(--asis-linea);
}
.asis-cab-txt { flex: 1; min-width: 0; }
.asis-nombre { font-family: var(--oia-font-display, Georgia, serif); font-size: 25px; font-weight: 600; line-height: 1.1; color: #fff; letter-spacing: -.01em; }
.asis-rol { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--asis-suave); }
.asis-rol::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #4bbf85; box-shadow: 0 0 0 3px rgba(75, 191, 133, .18); }
.asis-cab-btn {
    flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .07);
    color: #d6d6da !important; display: grid; place-items: center; font-size: 14px; transition: background .2s ease;
}
.asis-cab-btn:hover { background: rgba(255, 255, 255, .16); }

.asis-msgs {
    position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 20px 10px;
    display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: #33333a transparent;
}
.asis-msg { max-width: 88%; animation: asis-entra .32s var(--oia-ease, ease) both; }
.asis-msg-bot { align-self: flex-start; }
.asis-msg-yo { align-self: flex-end; }
.asis-burbuja { padding: 12px 16px; border-radius: 18px; font-size: 15.5px; line-height: 1.55; overflow-wrap: anywhere; }
.asis-msg-bot .asis-burbuja { background: var(--asis-negro-2); border: 1px solid var(--asis-linea); border-bottom-left-radius: 6px; color: var(--asis-texto); }
.asis-msg-yo .asis-burbuja { background: linear-gradient(135deg, var(--asis-oro-2), var(--asis-oro)); color: var(--asis-tinta); border-bottom-right-radius: 6px; font-weight: 500; }
.asis-burbuja p { margin: 0 0 .55em; }
.asis-burbuja p:last-child, .asis-burbuja ul:last-child { margin-bottom: 0; }
.asis-burbuja ul { margin: 0 0 .55em; padding: 0; list-style: none; display: grid; gap: .32em; }
.asis-burbuja li { position: relative; padding-left: 15px; }
.asis-burbuja li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--asis-oro); }
.asis-burbuja strong { color: #fff; font-weight: 650; }
.asis-burbuja a { color: var(--asis-oro-2); text-decoration: underline; text-underline-offset: 2px; }
.asis-etiqueta { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 5px 4px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--asis-suave); }

/* Escribiendo… */
.asis-puntos { display: inline-flex; gap: 5px; padding: 4px 2px; }
.asis-puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--asis-oro); animation: asis-punto 1.1s ease-in-out infinite; }
.asis-puntos i:nth-child(2) { animation-delay: .15s; }
.asis-puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes asis-punto { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* Acciones dentro de un mensaje */
.asis-ctas { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.asis-cta {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
    text-decoration: none; border: 1px solid rgba(255, 255, 255, .22); background: transparent; color: #fff !important; transition: transform .2s ease, background .2s ease;
}
.asis-cta:hover { background: rgba(255, 255, 255, .1); transform: translateY(-1px); }
.asis-cta-p { background: #fff; border-color: #fff; color: #0b0b0d !important; }
.asis-cta-p:hover { background: var(--asis-oro-2); border-color: var(--asis-oro-2); }

/* Tarjetas de plan */
.asis-planes { display: grid; gap: 8px; margin-top: 8px; }
.asis-plan { position: relative; padding: 12px 13px; border-radius: 16px; background: var(--asis-negro-2); border: 1px solid var(--asis-linea); }
.asis-plan.is-dest { border-color: rgba(233, 184, 74, .7); background: linear-gradient(160deg, rgba(213, 154, 47, .16), var(--asis-negro-2) 60%); }
.asis-plan-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.asis-plan-n { font-weight: 650; font-size: 15px; color: #fff; }
.asis-plan-p { font-family: var(--oia-font-display, Georgia, serif); font-size: 19px; font-weight: 600; color: var(--asis-oro-2); white-space: nowrap; }
.asis-plan-p small { font-family: var(--oia-font-body, sans-serif); font-size: 11.5px; font-weight: 500; color: var(--asis-suave); }
.asis-plan-rec { display: inline-block; margin-bottom: 6px; padding: 2px 8px; border-radius: 999px; background: var(--asis-oro); color: var(--asis-tinta); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.asis-plan ul { margin: 7px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 12.5px; line-height: 1.4; color: #c9c9cf; }
.asis-plan li { position: relative; padding-left: 14px; }
.asis-plan li::before { content: ''; position: absolute; left: 1px; top: .55em; width: 5px; height: 5px; border-radius: 50%; background: var(--asis-oro); }
.asis-plan-mas { margin-top: 4px; padding: 0; border: 0; background: none; font-size: 12px; color: var(--asis-suave) !important; text-decoration: underline; text-underline-offset: 2px; }
.asis-plan .asis-cta { margin-top: 10px; width: 100%; justify-content: center; }

/* Con el chat ancho, los planes van de dos en dos: se comparan de un vistazo. */
.asis-msg-ancho { max-width: 100%; align-self: stretch; }
@media (min-width: 1100px) {
    .asis-planes { grid-template-columns: 1fr 1fr; }
    .asis-plan { display: flex; flex-direction: column; }
    .asis-plan-cab { flex-direction: column; align-items: flex-start; gap: 1px; }
    .asis-plan .asis-cta { margin-top: auto; }
    .asis-plan-mas { align-self: flex-start; margin-bottom: 10px; }
    .asis-plan-rec { align-self: flex-start; }
}

/* Preguntas prefijadas */
.asis-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0 4px; animation: asis-entra .4s var(--oia-ease, ease) both; }
.asis-chip {
    padding: 9px 15px; border-radius: 999px; border: 1px solid rgba(233, 184, 74, .5); background: rgba(213, 154, 47, .08);
    color: #f3dca6 !important; font-size: 13px; font-weight: 500; line-height: 1.25; text-align: left; transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.asis-chip:hover { background: rgba(213, 154, 47, .22); border-color: var(--asis-oro-2); transform: translateY(-1px); }
.asis-chip-gris { border-color: var(--asis-linea); background: transparent; color: var(--asis-suave) !important; }
.asis-chips-rejilla { max-height: 236px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #33333a transparent; }

/* Pie: escribir */
.asis-pie { border-top: 1px solid var(--asis-linea); padding: 12px 16px 10px; background: #000; }
.asis-form { display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 14px; border-radius: 22px; background: var(--asis-negro-2); border: 1px solid var(--asis-linea); transition: border-color .2s ease; }
.asis-form:focus-within { border-color: rgba(233, 184, 74, .7); }
.asis-form textarea {
    flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--asis-texto);
    font: inherit; font-size: 14.5px; line-height: 1.4; padding: 8px 0; max-height: 96px; box-shadow: none;
}
.asis-form textarea::placeholder { color: #77777e; }
.asis-enviar {
    flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--asis-oro-2), var(--asis-oro)); color: var(--asis-tinta) !important; font-size: 14px; transition: transform .2s ease, opacity .2s ease;
}
.asis-enviar:disabled { opacity: .35; cursor: default; }
.asis-enviar:not(:disabled):hover { transform: scale(1.07); }
.asis-nota { margin: 7px 4px 0; font-size: 10.8px; line-height: 1.4; color: #7d7d85; text-align: center; }
.asis-nota a { color: #a1a1a6; text-decoration: underline; }
.asis-trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Estrecho: el chat ocupa la pantalla y el búho se sube a la cabecera,
   asomando por debajo de ella. */
@media (max-width: 719px) {
    .asis { right: 12px; bottom: 12px; --asis-buho: 94px; }
    .asis-panel { position: fixed; inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
    .asis.is-abierto { z-index: 9000; }
    .asis-velo { display: none; }
    .asis.is-abierto .asis-mascota { position: fixed; right: auto; left: 10px; bottom: auto; top: 4px; width: 100px; transition: none; animation: asis-entra .45s var(--oia-ease, ease) both; }
    .asis.is-abierto .asis-aviso { display: none; }
    .asis-cab { min-height: 104px; padding-left: 122px; }
    .asis-nombre { font-size: 24px; }
    .asis-msgs { padding-top: 40px; }
    .asis-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
    .asis *, .asis *::after { animation: none !important; transition: none !important; }
}
@media print { .asis { display: none !important; } }
