/* ============================================================
   Tasty Bonanza — Mascota animada "Gummy" (vídeo con alfa)
   ------------------------------------------------------------
   Escritorio / apaisado: la mascota está de pie sobre el suelo de
   caramelo, delante del escenario izquierdo del marco, entre el
   panel de SALDO y la barra de apuesta (sin tocar la cuadrícula ni
   los botones). Todas las medidas derivan de las variables del
   marco (--tb-fw / --tb-fh / --tb-band-*) definidas en
   bg_panoramic.css, así que la posición es estable en 16:9, 21:9
   y 4:3. La variante móvil (portrait) vive en mobile/mobile.css.
   ============================================================ */

:root {
  --tb-mascot-ratio: 0.6027;                              /* 540 / 896 */
  --tb-mascot-h: calc(var(--tb-fh) * 0.40);
  --tb-mascot-w: calc(var(--tb-mascot-h) * var(--tb-mascot-ratio));
}

#tb-mascot {
  position: fixed;
  z-index: 9000;                /* por encima del juego, debajo de intro (9999) y "Regresar" (10000) */
  pointer-events: none;
  width: var(--tb-mascot-w);
  height: var(--tb-mascot-h);
  /* pies ligeramente por delante del borde superior de la barra inferior (81 % del marco) */
  bottom: calc(var(--tb-band-y) + var(--tb-fh) * 0.165);
  /* pegada al borde izquierdo del marco; en pantallas anchas se desplaza
     hacia la banda libre para no tapar los dulces del escenario */
  left: calc(var(--tb-band-x) + var(--tb-fw) * 0.012 - min(var(--tb-band-x) * 0.65, var(--tb-fw) * 0.09));
  opacity: 0;
  transform: translateY(6%) scale(.96);
  transform-origin: 50% 100%;
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .9, .3, 1.2);
  filter: drop-shadow(0 10px 14px rgba(60, 0, 40, .45));
  will-change: transform, opacity;
}
#tb-mascot.tb-ready {
  opacity: 1;
  transform: none;
}

/* capas: vídeo WebM alfa (Chrome/Firefox/Edge) o canvas (Safari/iOS) */
#tb-mascot video,
#tb-mascot canvas,
#tb-mascot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
  max-width: none;           /* anula la regla global img/video de responsive-games.css */
}
#tb-mascot video { opacity: 0; transition: opacity .25s ease; }
#tb-mascot video.tb-visible { opacity: 1; }
#tb-mascot img.tb-poster { opacity: 1; transition: opacity .4s ease; }
#tb-mascot.tb-playing img.tb-poster { opacity: 0; }

/* sombra de contacto en el suelo */
#tb-mascot::after {
  content: "";
  position: absolute;
  left: 14%; right: 14%;
  bottom: -2.5%;
  height: 6%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(60, 0, 40, .5), rgba(60, 0, 40, 0) 70%);
  z-index: -1;
}

/* celebración: pequeño rebote del contenedor (el vídeo ya baila) */
#tb-mascot.tb-win {
  animation: tbMascotCheer .5s ease-in-out 2;
}
@keyframes tbMascotCheer {
  0%, 100% { transform: none; }
  50%      { transform: translateY(-3%) scale(1.03); }
}

/* ocultar en ventanas muy estrechas apaisadas donde no cabe sin tapar la UI */
@media (orientation: landscape) and (max-height: 420px) {
  #tb-mascot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #tb-mascot.tb-win { animation: none; }
}
