/* Efectos del chat de casa: stickers vivos y zumbido. Lo usa publico/efectos.js.
   Todo va en una capa encima del chat que no bloquea los toques (pointer-events: none). */

.ef-capa {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; overflow: hidden;
  contain: strict;
}
.ef-capa * { box-sizing: border-box; }
.ef-capa svg { overflow: visible; display: block; }
.ef-capa svg * { transform-box: fill-box; }

/* ---------- Anacleto ---------- */
.ef-gato { position: absolute; left: 0; bottom: 18%; width: 170px; will-change: transform; }
.ef-gato .gir { transform-origin: 50% 50%; transition: transform .25s ease; }
.ef-gato.izq .gir { transform: scaleX(-1); }
.ef-gato .cuerpo { transform-origin: 50% 100%; }
.ef-gato .pata { transform-origin: 50% 0; transition: transform .45s ease; }
.ef-gato .cola { transform-origin: 100% 100%; animation: ef-cola 1.6s ease-in-out infinite; }
.ef-gato .cabeza { transform-origin: 30% 80%; transition: transform .5s ease; }
.ef-gato .ojo-cerrado, .ef-gato .rubor { opacity: 0; transition: opacity .35s ease; }
.ef-gato.andando .cuerpo { animation: ef-bote .5s ease-in-out infinite; }
.ef-gato.andando .pata.a { animation: ef-paso .5s ease-in-out infinite; }
.ef-gato.andando .pata.b { animation: ef-paso .5s ease-in-out infinite reverse; }
.ef-gato.tumbado .mover { transform: translateY(20px); transition: transform .6s cubic-bezier(.3,1.4,.5,1); }
.ef-gato .mover { transition: transform .6s ease; }
.ef-gato.tumbado .pata { transform: scaleY(.25); }
.ef-gato.tumbado .cabeza { transform: rotate(-12deg) translateY(4px); }
.ef-gato.tumbado .cola { animation: ef-cola 2.6s ease-in-out infinite; }
.ef-gato.feliz .ojo-abierto { opacity: 0; }
.ef-gato.feliz .ojo-cerrado, .ef-gato.feliz .rubor { opacity: 1; }
.ef-gato .ojo-abierto { transition: opacity .2s ease; animation: ef-parpadeo 3.2s infinite; transform-origin: 50% 50%; }

@keyframes ef-paso { 0%, 100% { transform: rotate(20deg); } 50% { transform: rotate(-20deg); } }
@keyframes ef-bote { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes ef-cola { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(14deg); } }
@keyframes ef-parpadeo { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

/* ---------- Efecto anime «¡Demasiado mono!» ---------- */
.ef-anime { position: absolute; inset: 0; opacity: 0; transition: opacity .3s ease; }
.ef-anime.visible { opacity: 1; }
.ef-anime .fondo {
  position: absolute; inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 70%), rgba(255, 182, 213, .55), rgba(255, 140, 190, .18) 45%, transparent 75%);
}
.ef-anime .rayos {
  position: absolute; left: 50%; top: 50%; width: 260vmax; height: 260vmax; margin: -130vmax 0 0 -130vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .85) 0deg 1.2deg, transparent 1.2deg 7deg);
  -webkit-mask: radial-gradient(circle, transparent 22vmin, #000 48vmin);
          mask: radial-gradient(circle, transparent 22vmin, #000 48vmin);
  animation: ef-girar 9s linear infinite; opacity: .75;
}
.ef-anime .letrero {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) rotate(-7deg) scale(0);
  text-align: center; white-space: nowrap; animation: ef-pop .55s cubic-bezier(.2, 1.6, .4, 1) .1s forwards;
  font-family: "Arial Black", "Helvetica Neue", system-ui, sans-serif; font-weight: 900; line-height: 1;
}
.ef-anime .letrero .jp { display: block; font-size: 18px; letter-spacing: 6px; color: #ff4f93; margin-bottom: 6px; font-weight: 800; }
.ef-anime .letrero .grande {
  display: block; font-size: clamp(34px, 11vw, 64px); color: #fff; letter-spacing: 1px;
  -webkit-text-stroke: 8px #ff4f93; paint-order: stroke fill;
  text-shadow: 0 6px 0 #c21f66, 0 10px 18px rgba(194, 31, 102, .35);
}
.ef-anime .letrero .corazon { color: #ff2e7e; -webkit-text-stroke: 6px #fff; display: inline-block; animation: ef-latido .6s ease-in-out infinite; }
.ef-chispa {
  position: absolute; color: #fff; font-size: 26px; text-shadow: 0 0 8px #ff8fc0, 0 0 2px #ff4f93;
  animation: ef-chispa 1.1s ease-out forwards;
}
.ef-flota { position: absolute; font-size: 26px; animation: ef-flotar 2.2s ease-out forwards; }

@keyframes ef-girar { to { transform: rotate(360deg); } }
@keyframes ef-pop { to { transform: translate(-50%, -50%) rotate(-7deg) scale(1); } }
@keyframes ef-latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes ef-chispa { 0% { transform: scale(0) rotate(0); opacity: 0; } 30% { opacity: 1; transform: scale(1.2) rotate(40deg); } 100% { transform: scale(0) rotate(120deg); opacity: 0; } }
@keyframes ef-flotar { 0% { transform: translateY(0) scale(.4); opacity: 0; } 15% { opacity: 1; transform: translateY(-10px) scale(1); } 100% { transform: translateY(-140px) translateX(var(--dx, 0)) scale(1.1); opacity: 0; } }

/* ---------- Pollito ---------- */
.ef-pollito { position: absolute; left: 0; bottom: 18%; width: 110px; will-change: transform; }
.ef-pollito .gir { transform-origin: 50% 50%; }
.ef-pollito.izq .gir { transform: scaleX(-1); }
.ef-pollito .ala { transform-origin: 20% 20%; }
.ef-pollito.aleteo .ala { animation: ef-aleteo .14s ease-in-out infinite alternate; }
.ef-pollito .pico-ab { transform-origin: 0% 0%; transition: transform .12s ease; }
.ef-pollito.pia .pico-ab { transform: rotate(28deg); }
.ef-pollito .rubor { opacity: .8; }
.ef-bocadillo {
  position: absolute; padding: 8px 14px; border-radius: 18px; background: #fff; color: #e08a00;
  border: 3px solid #3a2a20; font: 900 26px/1 "Arial Black", system-ui, sans-serif; white-space: nowrap;
  transform: scale(0); transform-origin: 0% 100%; animation: ef-bocadillo .35s cubic-bezier(.2, 1.6, .4, 1) forwards;
}
.ef-bocadillo::after {
  content: ""; position: absolute; left: 14px; bottom: -12px; border: 9px solid transparent; border-top-color: #3a2a20; border-bottom: 0;
}
@keyframes ef-aleteo { from { transform: rotate(-10deg); } to { transform: rotate(-55deg); } }
@keyframes ef-bocadillo { to { transform: scale(1); } }

/* ---------- Zumbido ---------- */
.ef-sacudir { animation: ef-sacudir .62s linear 1; }
@keyframes ef-sacudir {
  0% { transform: translate(0, 0); } 10% { transform: translate(-11px, 3px); } 20% { transform: translate(10px, -4px); }
  30% { transform: translate(-9px, -3px); } 40% { transform: translate(9px, 4px); } 50% { transform: translate(-7px, 2px); }
  60% { transform: translate(7px, -3px); } 70% { transform: translate(-5px, 3px); } 80% { transform: translate(4px, -2px); }
  90% { transform: translate(-2px, 1px); } 100% { transform: translate(0, 0); }
}
.ef-cartel {
  position: absolute; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translate(-50%, -140%);
  background: #ffcf33; color: #2b1d00; border: 3px solid #2b1d00; border-radius: 16px; padding: 10px 16px;
  font: 800 16px/1.2 system-ui, sans-serif; white-space: nowrap; box-shadow: 0 6px 0 #2b1d00;
  animation: ef-cartel 2.6s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
@keyframes ef-cartel {
  0% { transform: translate(-50%, -140%); } 14%, 82% { transform: translate(-50%, 0); } 100% { transform: translate(-50%, -160%); }
}

/* ---------- Lluvia de corazones ---------- */
.ef-cae { position: absolute; bottom: -60px; animation: ef-subir var(--t, 3s) cubic-bezier(.3, .6, .4, 1) forwards; }
@keyframes ef-subir {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; } 10% { opacity: 1; }
  100% { transform: translate(var(--dx, 0), -115vh) rotate(var(--r, 0deg)); opacity: .9; }
}

/* ---------- Sin movimiento (ajuste de accesibilidad del móvil) ---------- */
.ef-quieto {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); text-align: center;
  background: rgba(255, 255, 255, .95); color: #3a2a20; border-radius: 24px; padding: 18px 22px; border: 3px solid #3a2a20;
  font: 800 18px/1.3 system-ui, sans-serif; animation: ef-aparecer 1.8s ease forwards;
}
.ef-quieto svg { width: 110px; margin: 0 auto 8px; }
@keyframes ef-aparecer { 0% { opacity: 0; } 15%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Mini sticker dentro de la burbuja (se toca para repetirlo) ---------- */
.ef-mini { position: static; width: 96px; display: block; cursor: pointer; }
.ef-mini.ef-gato { width: 120px; }
.ef-mini svg { overflow: visible; }
.ef-mini svg * { transform-box: fill-box; }
.ef-mini.ef-gato .mover, .ef-mini.ef-gato .pata, .ef-mini.ef-gato .cabeza { transition: none; }
.ef-mini.ef-emoji { font-size: 64px; line-height: 1; width: auto; }

/* Sticker que espera a que acabe su animación, y luego «aterriza» en la burbuja */
.ef-mini.ef-esperando { opacity: 0; transform: scale(.3); pointer-events: none; }
.ef-mini.ef-aterriza { animation: ef-aterriza .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes ef-aterriza { 0% { opacity: 0; transform: scale(.3) translateY(10px); } 100% { opacity: 1; transform: scale(1); } }

/* ---------- Coco (siamesa, digna) ---------- */
.ef-gato .ojo-desden { opacity: 0; transition: opacity .25s ease; }
.ef-gato.desden .ojo-abierto { opacity: 0; animation: none; }
.ef-gato.desden .ojo-desden { opacity: 1; }
.ef-gato.altiva .cabeza { transform: rotate(-14deg) translate(2px, -3px); }
.ef-gato.coco .cola { animation-duration: 2.4s; }

/* ---------- Mono ---------- */
.ef-mono { position: absolute; left: 0; bottom: 18%; width: 112px; will-change: transform; }
.ef-mono .brazo.izq { transform-origin: 100% 0%; }
.ef-mono .brazo.der { transform-origin: 0% 0%; }
.ef-mono .boca-ab { opacity: 0; }
.ef-mono.grita .boca-ab { opacity: 1; animation: ef-boca .25s ease-in-out infinite alternate; transform-origin: 50% 50%; }
.ef-mono.grita .boca { opacity: 0; }
.ef-mono.baila .brazo.izq { animation: ef-brazo-i .3s ease-in-out infinite alternate; }
.ef-mono.baila .brazo.der { animation: ef-brazo-d .3s ease-in-out infinite alternate-reverse; }
.ef-mono.baila .salta { animation: ef-bote-mono .3s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.ef-mono .salta { transform-origin: 50% 100%; }
@keyframes ef-brazo-i { from { transform: rotate(0); } to { transform: rotate(130deg); } }
@keyframes ef-brazo-d { from { transform: rotate(0); } to { transform: rotate(-130deg); } }
@keyframes ef-bote-mono { from { transform: translateY(0) scale(1.04, .96); } to { transform: translateY(-10px) scale(.97, 1.03); } }
@keyframes ef-boca { from { transform: scale(.7); } to { transform: scale(1.15); } }

/* ---------- Confeti ---------- */
.ef-confeti { position: absolute; top: -24px; animation: ef-caer var(--t, 3s) cubic-bezier(.25, .5, .5, 1) forwards; }
@keyframes ef-caer {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx, 0), 110vh) rotate(var(--r, 720deg)); opacity: .9; }
}
.ef-pum { position: absolute; left: 50%; top: 42%; font-size: 90px; transform: translate(-50%, -50%) scale(0); animation: ef-pum 1.4s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes ef-pum { 0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); } 30% { transform: translate(-50%, -50%) scale(1.2) rotate(8deg); } 70% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }

/* ---------- Buenas noches ---------- */
.ef-noche { position: absolute; inset: 0; background: linear-gradient(#0b1430e6, #1b1f4ad9); opacity: 0; transition: opacity .8s ease; }
.ef-noche.visible { opacity: 1; }
.ef-noche .luna { position: absolute; right: 16%; top: 12%; width: 74px; height: 74px; border-radius: 50%; box-shadow: -16px 10px 0 0 #ffe9a8; filter: drop-shadow(0 0 14px #ffe9a888); transform: rotate(-20deg); }
.ef-noche .estrella { position: absolute; color: #fff7cf; animation: ef-titila 1.6s ease-in-out infinite alternate; }
.ef-noche .texto { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; color: #fff7cf; font: 700 38px/1.1 Georgia, "Times New Roman", serif; font-style: italic; white-space: nowrap; text-shadow: 0 0 18px #ffe9a866; }
.ef-noche .texto .peq { font-size: 18px; margin-top: 10px; opacity: .85; }
@keyframes ef-titila { from { opacity: .2; transform: scale(.7); } to { opacity: 1; transform: scale(1.2); } }

/* ---------- Regalo ---------- */
.ef-velo { position: absolute; inset: 0; background: rgba(20, 10, 30, .45); animation: ef-aparece .3s ease forwards; }
@keyframes ef-aparece { from { opacity: 0; } to { opacity: 1; } }
.ef-regalo { position: absolute; left: 50%; top: 50%; width: 170px; transform: translate(-50%, -50%); }
.ef-regalo .tapa { transform-origin: 50% 100%; transition: transform .6s cubic-bezier(.3, 1.4, .5, 1); }
.ef-regalo.abierto .tapa { transform: translate(40px, -120px) rotate(35deg); }
.ef-regalo.tiembla svg { animation: ef-tiembla .4s ease-in-out; }
@keyframes ef-tiembla { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg) scale(1.05); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); } }
.ef-carta {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(0); max-width: 82%; min-width: 180px;
  background: #fff; color: #3a2a20; border: 3px solid #3a2a20; border-radius: 18px; padding: 14px 18px; text-align: center;
  font: 700 20px/1.35 system-ui, sans-serif; box-shadow: 0 8px 0 #3a2a20; white-space: pre-wrap; overflow-wrap: anywhere;
  animation: ef-carta .5s cubic-bezier(.2, 1.6, .4, 1) .2s forwards;
}
.ef-carta .de { font-size: 13px; color: #ff4f93; margin-bottom: 6px; letter-spacing: .5px; }
@keyframes ef-carta { to { transform: translate(-50%, -50%) scale(1); } }
.ef-mini.ef-regalo-mini { width: 80px; }
.ef-mini.ef-mono { position: static; width: 90px; }

/* ---------- Mini-Leny ---------- */
.ef-leny { position: absolute; bottom: 20%; width: 130px; will-change: transform; }
.ef-leny svg { filter: drop-shadow(0 0 16px rgba(60, 230, 210, .55)); }
.ef-leny .gel { transform-origin: 50% 100%; }
.ef-leny .ojos { transition: transform .25s ease; }
.ef-leny.mira-izq .ojos { transform: translateX(-9px); }
.ef-leny.mira-der .ojos { transform: translateX(9px); }
.ef-leny.parpadea .ojo-abierto { transform: scaleY(.1); transform-origin: 50% 50%; }
.ef-leny .ojo-cerrado, .ef-leny .rubor { opacity: 0; transition: opacity .25s ease; }
.ef-leny.feliz .ojo-abierto { opacity: 0; }
.ef-leny.feliz .ojo-cerrado, .ef-leny.feliz .rubor { opacity: 1; }
.ef-leny.tiembla-gel .gel { animation: ef-gelatina .45s ease-in-out infinite; }
@keyframes ef-gelatina { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(1.1, .9); } 60% { transform: scale(.94, 1.07); } }
.ef-mini.ef-leny { position: static; width: 84px; }

/* ---------- ¡Tarea hecha! ---------- */
.ef-tarea {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(0); min-width: 230px; max-width: 86%;
  background: #fff; color: #3a2a20; border: 3px solid #3a2a20; border-radius: 22px; padding: 30px 18px 16px; text-align: center;
  box-shadow: 0 8px 0 #3a2a20; animation: ef-carta .5s cubic-bezier(.2, 1.6, .4, 1) .1s forwards;
  font-family: system-ui, sans-serif;
}
.ef-tarea .sello {
  position: absolute; left: 50%; top: -30px; width: 58px; height: 58px; margin-left: -29px; border-radius: 50%;
  background: #2fbf71; color: #fff; border: 3px solid #3a2a20; font: 900 34px/52px system-ui; transform: scale(0) rotate(-30deg);
  animation: ef-sello .5s cubic-bezier(.2, 1.8, .4, 1) .45s forwards;
}
.ef-tarea .titulo {
  font: 900 30px/1 "Arial Black", system-ui, sans-serif; color: #fff; -webkit-text-stroke: 7px #2fbf71; paint-order: stroke fill;
  text-shadow: 0 4px 0 #1d7a48; letter-spacing: .5px;
}
.ef-tarea .nombre { font-weight: 800; font-size: 19px; margin-top: 12px; overflow-wrap: anywhere; }
.ef-tarea .quien { color: #66707a; font-weight: 600; margin-top: 4px; }
.ef-tarea .puntos {
  display: inline-block; margin-top: 10px; padding: 6px 14px; border-radius: 999px; background: #ffd43b; border: 2.5px solid #3a2a20;
  font: 900 22px/1 system-ui; font-variant-numeric: tabular-nums;
}
.ef-tarea .puntos.listo { animation: ef-latido .5s ease-in-out 2; }
@keyframes ef-sello { to { transform: scale(1) rotate(0); } }
.ef-bocadillo.largo { white-space: normal; text-align: center; font-size: 21px; line-height: 1.2; }
.ef-bocadillo.largo::after { left: 50%; margin-left: -9px; }
