/* Interactive mascot layer — “najlepszy misiu” */

.mascot-live {
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
  transform-origin: 50% 85%;
  animation: mascotBreathe 2.8s ease-in-out infinite;
  transition: filter .2s ease;
  -webkit-user-select: none;
  user-select: none;
}
.mascot-live:focus-visible {
  outline: 3px solid #FF5FA8;
  outline-offset: 4px;
  border-radius: 16px;
}
.mascot-live:hover { filter: brightness(1.06); }

@keyframes mascotBreathe {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(-6px) scale(1.03, .97); }
}

.mascot-live.mascot-tap {
  animation: mascotTap .55s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes mascotTap {
  0% { transform: translateY(0) scale(1) rotate(0); }
  25% { transform: translateY(-22px) scale(1.12, .9) rotate(-6deg); }
  50% { transform: translateY(-8px) scale(.95, 1.08) rotate(5deg); }
  75% { transform: translateY(-14px) scale(1.08) rotate(-3deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}

.mascot-live.mascot-celebrate {
  animation: mascotCelebrate .9s cubic-bezier(.34, 1.4, .64, 1);
}
@keyframes mascotCelebrate {
  0% { transform: scale(1) rotate(0); }
  20% { transform: scale(1.2) rotate(-10deg); }
  40% { transform: scale(1.05) rotate(10deg); }
  60% { transform: scale(1.18) rotate(-6deg); }
  80% { transform: scale(1.08) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

.mascot-live.mascot-comfort {
  animation: mascotComfort .7s ease-in-out;
}
@keyframes mascotComfort {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-3deg); }
  40% { transform: translateX(6px) rotate(3deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.mascot-live.mascot-wink::after {
  content: "😉";
  position: absolute;
  top: 18%;
  right: 8%;
  font-size: 1.35rem;
  line-height: 1;
  animation: mascotWinkPop .7s ease forwards;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
@keyframes mascotWinkPop {
  0% { opacity: 0; transform: scale(.4); }
  40% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 0; transform: scale(.8) translateY(-8px); }
}

.mascot-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 4px);
  transform: translateX(-50%) translateY(6px) scale(.85);
  background: #fff;
  color: #3A2460;
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.2;
  padding: .45rem .7rem;
  border-radius: 18px;
  border: 3px solid #FFB0E0;
  box-shadow: 0 4px 0 #FF8FD0, 0 8px 16px rgba(80, 40, 120, .18);
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.mascot-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #FFB0E0;
}
.mascot-bubble.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.mascot-bubble.celebrate {
  border-color: #FFE066;
  box-shadow: 0 4px 0 #FFB020, 0 8px 16px rgba(80, 40, 120, .18);
}
.mascot-bubble.celebrate::after { border-top-color: #FFE066; }

.mascot-heart {
  position: absolute;
  left: 50%;
  top: 30%;
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 25;
  animation: mascotHeart 1s ease-out forwards;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.15));
}
@keyframes mascotHeart {
  0% { opacity: 1; transform: translate(-50%, 0) scale(.6); }
  60% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--hx, 0px)), -56px) scale(1.25); }
}

/* Floating buddy during play (Lucas-style side companion) */
#mascot-buddy {
  position: fixed;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: max(88px, calc(72px + env(safe-area-inset-bottom, 0px)));
  width: 110px;
  height: 120px;
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
  filter: drop-shadow(0 10px 12px rgba(40, 20, 80, .32));
}
#mascot-buddy.visible { display: flex; }
#mascot-buddy .buddy-face {
  width: 100px;
  height: 110px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
#mascot-buddy .buddy-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  pointer-events: none;
  user-select: none;
}
#mascot-buddy .mascot-bubble {
  font-size: .82rem;
  padding: .35rem .55rem;
}

@media (min-width: 480px) {
  #mascot-buddy {
    right: calc(50% - 240px + 12px);
  }
}
