/* ═══════════ Mascotas (13/10/2026): búho guía + gallito que felicita ═══════════
   Diseño y animaciones de icontable.app/ruta (ruta.html), con los colores de NotiWeb (claro y oscuro).
   ⚠ El ícono «Chat del equipo» vive en right:22px / bottom:22px (56 px, control.css): el búho se posa
   a su IZQUIERDA y se esconde mientras el panel del chat está abierto. */
:root { --masc-bd: #a7f3d0; --masc-tit: #047857; --masc-oro: #c2410c; --masc-oro-bd: #fdba74; }
html[data-theme="dark"] { --masc-bd: #065f46; --masc-tit: #6ee7b7; --masc-oro: #fdba74; --masc-oro-bd: #9a3412; }

/* Alas (mismas reglas que la ruta) */
.nw-masc .ala, .nw-gallito .ala { transform-box: fill-box; }
.nw-masc .ala-i { transform-origin: 100% 0; }
.nw-masc .ala-d { transform-origin: 0 0; }
.nw-masc .aletea .ala-i { animation: nwAleteoI .32s ease-in-out infinite alternate; }
.nw-masc .aletea .ala-d { animation: nwAleteoD .32s ease-in-out infinite alternate; }
.nw-masc .posado .ala-i { animation: nwAleteoI 2.6s ease-in-out infinite alternate; }
.nw-masc .posado .ala-d { animation: nwAleteoD 2.6s ease-in-out infinite alternate; }
@keyframes nwAleteoI { from { transform: rotate(8deg); } to { transform: rotate(-38deg); } }
@keyframes nwAleteoD { from { transform: rotate(-8deg); } to { transform: rotate(38deg); } }

/* Búho: a la izquierda del chat (22 + 56 + 10 = 88 px del borde) */
.nw-masc { position: fixed; right: calc(88px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 45; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; }
.nw-masc[hidden] { display: none; }
.nw-masc > * { pointer-events: auto; }
body:has(.nw-chat-panel) .nw-masc { display: none; }   /* con el chat abierto, el búho se aparta */
.nw-masc-buho { width: 70px; height: 76px; border: 0; background: none; padding: 0; cursor: pointer; flex: none; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .25)); }
.nw-masc-buho svg { width: 100%; height: 100%; display: block; }
.nw-masc-buho:focus-visible { outline: 2px solid var(--sunat); outline-offset: 2px; border-radius: 12px; }
.nw-masc-buho.llega { animation: nwLlega .9s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes nwLlega { 0% { transform: translate(60px, -120px) rotate(12deg); } 60% { transform: translate(-6px, 6px) rotate(-4deg); } 100% { transform: translate(0, 0); } }

.nw-masc-globo { max-width: 290px; background: var(--card); color: var(--txt); border: 1px solid var(--masc-bd); border-radius: 16px 16px 4px 16px;
    padding: 12px 14px; box-shadow: 0 12px 30px rgba(15, 23, 42, .2); font-size: .88rem; line-height: 1.45; margin-bottom: 40px; animation: nwAparece .3s ease; }
.nw-masc-globo[hidden] { display: none; }
@keyframes nwAparece { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.nw-masc-globo .de { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--masc-tit);
    margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nw-masc-globo p { margin: 0; }
.nw-masc-globo .acc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.nw-masc-globo .acc button, .nw-masc-globo .acc a { font: 600 .78rem/1.2 inherit; border-radius: 8px; padding: 5px 10px; border: 1px solid var(--linea);
    background: var(--hover); color: var(--txt); text-decoration: none; cursor: pointer; }
.nw-masc-globo .acc button:hover, .nw-masc-globo .acc a:hover { border-color: var(--masc-tit); }
/* Tuku explicando un problema (13/10/2026): rojo = «Te explico», ámbar = «Ojo». No se va solo en escritorio. */
.nw-masc-globo.problema { border-color: #fca5a5; border-left: 4px solid #dc2626; max-width: 330px; }
.nw-masc-globo.aviso { border-color: #fcd34d; border-left: 4px solid #d97706; max-width: 330px; }
.nw-masc-globo.problema .de { color: #b91c1c; }
.nw-masc-globo.aviso .de { color: #b45309; }
html[data-theme="dark"] .nw-masc-globo.problema .de { color: #fca5a5; }
html[data-theme="dark"] .nw-masc-globo.aviso .de { color: #fcd34d; }
.nw-masc-globo p.hacer { margin-top: 6px; }
.nw-gallito-globo .firma { font-weight: 800; color: var(--masc-oro); margin-right: 2px; }
.nw-masc-globo .cerrar { border: 0; background: none; padding: 0 2px; font-size: 1.1rem; line-height: 1; color: var(--tenue); cursor: pointer; }

/* Celular: el chat va en right:14px; el búho más chico y el globo ENCIMA (no a un costado), para no ensanchar la página */
@media (max-width: 760px) { .nw-masc { right: calc(78px + env(safe-area-inset-right, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); } }
@media (max-width: 560px) {
    .nw-masc-buho { width: 54px; height: 58px; }
    .nw-masc-globo { position: absolute; right: 0; bottom: 62px; margin: 0; width: max-content; max-width: calc(100vw - 96px); font-size: .84rem; padding: 10px 12px;
        border-radius: 16px 16px 4px 16px; }
    .nw-masc-globo.problema, .nw-masc-globo.aviso { max-width: calc(100vw - 96px); }
}

/* Gallito: abajo a la IZQUIERDA (lejos del chat), sube con un saltito y se va solo */
.nw-gallito { position: fixed; left: calc(16px + env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 46;
    display: flex; align-items: flex-end; gap: 8px; transform: translateY(160%); transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); pointer-events: none;
    max-width: calc(100vw - 110px); }
.nw-gallito.si { transform: none; }
.nw-gallito svg { width: 92px; height: auto; flex: none; }
.nw-gallito.si svg { animation: nwSalta .6s ease-in-out 2; }
@keyframes nwSalta { 50% { transform: translateY(-14px); } }
.nw-gallito-globo { background: var(--card); color: var(--txt); border: 1px solid var(--masc-oro-bd); border-radius: 16px 16px 16px 4px; padding: 10px 14px;
    font-size: .9rem; max-width: 240px; margin-bottom: 58px; box-shadow: 0 10px 26px rgba(15, 23, 42, .18); }
.nw-gallito-globo b { color: var(--masc-oro); }
@media (max-width: 560px) { .nw-gallito svg { width: 68px; } .nw-gallito-globo { margin-bottom: 42px; font-size: .84rem; max-width: calc(100vw - 180px); } }

.nw-confeti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.nw-confeti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: nwCae 2.6s linear forwards; }
@keyframes nwCae { to { transform: translateY(110vh) rotate(720deg); } }

/* Sin movimiento si el equipo lo pide */
@media (prefers-reduced-motion: reduce) {
    .nw-masc *, .nw-masc-buho, .nw-masc-globo, .nw-gallito, .nw-gallito *, .nw-confeti i { animation: none !important; transition: none !important; }
}
@media print { .nw-masc, .nw-gallito, .nw-confeti { display: none !important; } }

/* ═════ Gracias de Tuku y Tunki (13/10/2026, igual que en icontable.app/ruta) ═════ */
.parpado,.parpado-g{transform:scaleY(0);transform-box:fill-box;transform-origin:50% 0}
.parpado{animation:mcParpadea 5.6s infinite}
.parpado.pd{animation-delay:.03s}
.parpado-g{animation:mcParpadea 7.3s 1.2s infinite}
@keyframes mcParpadea{0%,92%,100%{transform:scaleY(0)}95%{transform:scaleY(1)}}
.cabeza-b{transform-box:view-box;transform-origin:70px 75px}
.cabeza-g{transform-box:view-box;transform-origin:44px 70px}
.cresta{transform-box:fill-box;transform-origin:80% 100%}
.cola{transform-box:fill-box;transform-origin:0 0;animation:mcColea 4.5s ease-in-out infinite}
@keyframes mcColea{0%,80%,100%{transform:rotate(0)}86%{transform:rotate(-7deg)}92%{transform:rotate(4deg)}}
.g-guino .parpado.pi{animation:mcGuino 1s ease}
@keyframes mcGuino{0%,100%{transform:scaleY(0)}25%,70%{transform:scaleY(1)}}
.g-giro .cabeza-b{animation:mcGiro 1.3s ease-in-out}
@keyframes mcGiro{0%,100%{transform:rotate(0)}25%{transform:rotate(-16deg)}60%{transform:rotate(13deg)}}
.g-salto{animation:mcSalto .9s cubic-bezier(.3,1.4,.5,1)}
@keyframes mcSalto{0%,100%{transform:translateY(0)}35%{transform:translateY(-22px) rotate(-8deg)}65%{transform:translateY(0) rotate(4deg)}82%{transform:translateY(-6px)}}
.g-mira .pupilas{animation:mcMira 1.6s ease-in-out}
@keyframes mcMira{0%,100%{transform:translateX(0)}25%,45%{transform:translateX(-4px)}60%,80%{transform:translateX(4px)}}
.g-cresta .cresta{animation:mcCresta .9s ease-in-out}
@keyframes mcCresta{0%,100%{transform:rotate(0) scale(1)}20%{transform:rotate(-8deg) scale(1.08)}40%{transform:rotate(6deg) scale(1.1)}60%{transform:rotate(-5deg)}80%{transform:rotate(3deg)}}
.g-baile{animation:mcBaile 1.1s ease-in-out}
@keyframes mcBaile{0%,100%{transform:translateY(0) rotate(0)}20%{transform:translateY(-10px) rotate(-10deg)}40%{transform:translateY(0) rotate(8deg)}60%{transform:translateY(-8px) rotate(-6deg)}80%{transform:translateY(0) rotate(4deg)}}
.g-canta .cabeza-g{animation:mcCanta .9s ease-in-out 2}
@keyframes mcCanta{0%,100%{transform:rotate(0)}50%{transform:rotate(-12deg)}}
.mc-nota{position:absolute;font:700 18px system-ui,sans-serif;color:#ff7a2e;pointer-events:none;z-index:2;animation:mcNota 1.8s ease-out forwards;text-shadow:0 2px 6px rgba(0,0,0,.25)}
@keyframes mcNota{0%{opacity:0;transform:translate(0,0) scale(.6)}20%{opacity:1}100%{opacity:0;transform:translate(14px,-46px) scale(1.15) rotate(12deg)}}
@media (prefers-reduced-motion:reduce){.parpado,.parpado-g,.cola{animation:none!important}}

/* 17/10/2026: con una hoja de trabajo en pantalla (tabla a todo el alto) el búho y el chat se encogen y
   se aclaran para no tapar filas; vuelven a su tamaño al pasar el mouse. */
body:has(#app .nw-hoja-alta) .nw-masc-buho,
body:has(#app .nw-hoja-alta) .nw-chat-flotante { transform: scale(.72); opacity: .55; transform-origin: bottom right; transition: transform .2s, opacity .2s; }
body:has(#app .nw-hoja-alta) .nw-masc-buho:hover,
body:has(#app .nw-hoja-alta) .nw-chat-flotante:hover { transform: none; opacity: 1; }
