/* ═══════════ CAPITÁN PULPO — mascota animada ═══════════ */
.captain {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  pointer-events: none; user-select: none;
  opacity: 1;
}

.captain-stage {
  position: relative; width: 100%; aspect-ratio: 3 / 4;
  filter: drop-shadow(0 0 14px rgba(0, 229, 255, .45)) drop-shadow(0 10px 18px rgba(0, 0, 0, .7));
}
/* Poster estático SIEMPRE debajo: visible hasta que el canvas pinta el
   primer fotograma; después se oculta (sin hueco en ningún momento). */
.captain-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center bottom;
  pointer-events: none; z-index: 0;
  transition: opacity .3s ease;
}
.captain.live .captain-poster { opacity: 0; }
/* Canvas con los sprites (misma proporción 3:4 que el poster) */
.captain-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center bottom;
  pointer-events: none; z-index: 1;
  image-rendering: auto;
}

/* Bocadillo */
.captain-bubble {
  position: absolute; left: 50%; top: 0;
  transform: translate(-50%, 10px) scale(.85);
  transform-origin: 50% 100%;
  max-width: 230px; min-width: 120px;
  padding: 8px 14px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(220,245,255,.96));
  color: #04223a; font-weight: 800; font-size: clamp(11px, 1.1vw, 14px);
  line-height: 1.25; text-align: center;
  border: 2px solid rgba(0, 229, 255, .9);
  box-shadow: 0 0 18px rgba(0, 229, 255, .55), 0 6px 16px rgba(0, 0, 0, .55);
  opacity: 0; z-index: 5;
  transition: opacity .22s ease, transform .32s cubic-bezier(.2, 1.4, .4, 1);
}
.captain-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -9px;
  width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg);
  background: rgba(230, 248, 255, .97);
  border-right: 2px solid rgba(0, 229, 255, .9); border-bottom: 2px solid rgba(0, 229, 255, .9);
}
.captain-bubble.show {
  opacity: 1; transform: translate(-50%, -10px) scale(1);
  animation: capBubblePop .5s cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes capBubblePop {
  0%   { transform: translate(-50%, 12px) scale(.6); }
  60%  { transform: translate(-50%, -14px) scale(1.06); }
  100% { transform: translate(-50%, -10px) scale(1); }
}

/* Color del bocadillo según estado */
.captain[data-state="win"] .captain-bubble,
.captain[data-state="bigwin"] .captain-bubble {
  background: linear-gradient(180deg, #fff8d6, #ffe68a);
  border-color: #ffd700; color: #4a3200;
  box-shadow: 0 0 22px rgba(255, 215, 0, .7), 0 6px 16px rgba(0, 0, 0, .55);
}
.captain[data-state="win"] .captain-bubble::after,
.captain[data-state="bigwin"] .captain-bubble::after {
  background: #ffe68a; border-color: #ffd700;
}
.captain[data-state="lose"] .captain-bubble {
  background: linear-gradient(180deg, rgba(235,245,255,.97), rgba(200,225,245,.95));
  border-color: rgba(120, 190, 230, .9); color: #10304a;
  box-shadow: 0 0 14px rgba(120, 190, 230, .45), 0 6px 16px rgba(0, 0, 0, .55);
}
.captain[data-state="lose"] .captain-bubble::after { background: rgba(205,228,245,.96); border-color: rgba(120,190,230,.9); }

/* Brillo extra del personaje en premios grandes */
.captain[data-state="bigwin"] .captain-stage {
  filter: drop-shadow(0 0 22px rgba(255, 215, 0, .75)) drop-shadow(0 0 40px rgba(0, 229, 255, .5)) drop-shadow(0 10px 18px rgba(0, 0, 0, .7));
}
