/* Vi Mascot GAME — widget por página de juego (1 personaje + menú custom).
   Independiente de vi-mascot.css (home / /juegos). Convive en la esquina
   inferior derecha, reemplazando al botón WhatsApp flotante. */

#vi-mg-root { position: fixed; bottom: 2.5rem; right: 2rem; z-index: 9998;
  font-family: 'DM Sans', system-ui, sans-serif; }
@media (max-width: 700px) { #vi-mg-root { bottom: 1.2rem; right: 0.8rem; } }

#vi-mg-root button { font-family: inherit; cursor: pointer; }

/* Avatar flotante */
.vi-mg-avatar-wrap { position: relative; display: flex; flex-direction: column;
  align-items: center; gap: 6px; }
.vi-mg-avatar { border: none; background: transparent; padding: 0;
  width: 88px; height: 88px; border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45), 0 0 24px rgba(204,26,26,0.35);
  overflow: hidden; animation: vi-mg-float 3.6s ease-in-out infinite;
  transition: transform 0.2s; }
.vi-mg-avatar:hover { transform: scale(1.05); }
.vi-mg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; object-position: center 18%; }
/* Ajuste específico por personaje: object-position controla qué parte de la
   imagen queda visible dentro del círculo. Un % menor sube la imagen (baja el
   sujeto para verle la cara/cabeza). Lola necesita más porque su cara queda
   más arriba en el crop original. */
.vi-mg-avatar-salazar img { object-position: center 18%; }
.vi-mg-avatar-dimitri img { object-position: center 18%; }
.vi-mg-avatar-sicario img { object-position: center 18%; }
.vi-mg-avatar-lola img    { object-position: center 0%; }
.vi-mg-name { background: rgba(15,15,20,0.9); color: #f4f2ed;
  border: 1px solid rgba(200,169,110,0.35); padding: 3px 10px;
  font-size: 0.72rem; letter-spacing: 0.05em; border-radius: 4px;
  white-space: nowrap; }
@media (max-width: 700px) {
  .vi-mg-avatar { width: 72px; height: 72px; }
  .vi-mg-name { font-size: 0.68rem; padding: 2px 8px; }
}
@keyframes vi-mg-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* Bocadillo de invitación */
.vi-mg-bubble { position: absolute; right: 100%; top: 12px; margin-right: 12px;
  background: rgba(15,15,20,0.95); color: #f4f2ed;
  border: 1px solid rgba(200,169,110,0.45); padding: 8px 12px;
  border-radius: 8px; font-size: 0.82rem; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5); pointer-events: none;
  animation: vi-mg-bubble-in 0.5s ease-out; }
.vi-mg-bubble::after { content: ''; position: absolute; right: -6px; top: 14px;
  width: 0; height: 0; border-top: 6px solid transparent;
  border-bottom: 6px solid transparent; border-left: 6px solid rgba(200,169,110,0.45); }
@media (max-width: 700px) { .vi-mg-bubble { display: none; } }
@keyframes vi-mg-bubble-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Panel de diálogo */
.vi-mg-panel { position: absolute; bottom: 100%; right: 0; margin-bottom: 12px;
  width: 340px; max-width: calc(100vw - 24px);
  background: #40404a; color: #e0ded6;
  border: 1px solid rgba(255,255,255,0.22); border-radius: 12px;
  padding: 14px 16px 14px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  animation: vi-mg-panel-in 0.25s ease-out; }
@keyframes vi-mg-panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.vi-mg-panel-header { display: flex; align-items: flex-start;
  gap: 8px; margin-bottom: 10px; }
.vi-mg-charlabel { flex: 1; color: #f0d495; font-size: 0.74rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.vi-mg-back { background: none; border: none; color: #e6e4de;
  font-size: 0.78rem; padding: 0 6px; }
.vi-mg-back:hover { color: #fff; }
.vi-mg-close { background: none; border: none; color: #e6e4de;
  font-size: 1rem; padding: 0 4px; line-height: 1; }
.vi-mg-close:hover { color: #fff; }
.vi-mg-title { color: #fff; font-weight: 600; font-size: 0.98rem;
  line-height: 1.3; margin-bottom: 10px; }
.vi-mg-body { color: #e0ded6; font-size: 0.85rem; line-height: 1.45;
  margin-bottom: 12px; }
.vi-mg-body p { margin: 0 0 8px 0; }
.vi-mg-body p:last-child { margin-bottom: 0; }
.vi-mg-options { display: flex; flex-direction: column; gap: 6px; }
.vi-mg-option { display: flex; align-items: center; gap: 8px;
  background: #16161c; border: 1px solid rgba(255,255,255,0.12);
  color: #e6e4de; padding: 8px 10px; border-radius: 6px;
  font-size: 0.85rem; text-align: left; transition: background 0.15s; }
.vi-mg-option:hover { background: #2a1010; color: #fff; }
.vi-mg-option-primary { background: #cc1a1a; border-color: #cc1a1a; color: #fff;
  justify-content: center; font-weight: 600; }
.vi-mg-option-primary:hover { background: #a11515; }
.vi-mg-option-wa { background: #128c7e; border-color: #128c7e; color: #fff;
  justify-content: center; }
.vi-mg-option-wa:hover { background: #0e6f65; }
.vi-mg-option-icon { flex-shrink: 0; font-size: 1rem; }

/* Botón reabrir (cuando el usuario cierra el panel) */
.vi-mg-reopen { position: fixed; bottom: 2.5rem; right: 2rem;
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: rgba(20,20,26,0.92); color: #f0d495;
  font-size: 1.3rem; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  display: none; z-index: 9997; }
.vi-mg-reopen:hover { background: rgba(40,40,50,0.98); }
#vi-mg-root.is-hidden .vi-mg-avatar-wrap,
#vi-mg-root.is-hidden .vi-mg-panel,
#vi-mg-root.is-hidden .vi-mg-bubble { display: none !important; }
#vi-mg-root.is-hidden ~ .vi-mg-reopen,
body.vi-mg-hidden .vi-mg-reopen { display: block; }

/* Cuando el cliente está en el bloque del calendario/iframe de reserva,
   ocultamos el avatar y su botón de reabrir: ahí solo despista. */
body.vi-in-calendar #vi-mg-root,
body.vi-in-calendar .vi-mg-reopen { display: none !important; }

/* Animación de entrada — el avatar del juego entra desde abajo con rebote,
   mismo estilo que el widget global de la home/juegos. */
@keyframes vi-mg-jump-in {
  0%   { transform: translateY(140%) scale(0.55); opacity: 0; }
  55%  { transform: translateY(-12%) scale(1.06); opacity: 1; }
  75%  { transform: translateY(3%) scale(0.98); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
#vi-mg-root.is-entering .vi-mg-avatar-wrap {
  animation: vi-mg-jump-in 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-origin: 50% 100%;
}
@media (prefers-reduced-motion: reduce) {
  #vi-mg-root.is-entering .vi-mg-avatar-wrap { animation: none; }
}
@media (max-width: 700px) {
  .vi-mg-reopen { bottom: 1.2rem; right: 0.8rem; width: 44px; height: 44px; font-size: 1.1rem; }
}

/* Ocultar el botón WhatsApp flotante nativo cuando el widget del avatar
   está activo (los reemplaza en la esquina). */
body.vi-mg-active .wa-float { display: none !important; }
