.hpp-pet-root {
  --hpp-size: 190px;
  --hpp-edge: 18px;
  --hpp-rose: #e96f83;
  --hpp-ink: #3d2530;
  position: fixed;
  z-index: 2147483000;
  width: var(--hpp-size);
  max-width: calc(100vw - 24px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
}

.hpp-pet-root--bottom-right {
  right: var(--hpp-edge);
  bottom: var(--hpp-edge);
}

.hpp-pet-root--bottom-left {
  left: var(--hpp-edge);
  bottom: var(--hpp-edge);
}

.hpp-pet-root--top-right {
  right: var(--hpp-edge);
  top: var(--hpp-edge);
}

.hpp-pet-root--top-left {
  left: var(--hpp-edge);
  top: var(--hpp-edge);
}

.hpp-pet-root--custom {
  right: auto;
  bottom: auto;
}

.hpp-pet {
  position: relative;
  width: 100%;
  isolation: isolate;
  pointer-events: auto;
  animation: hpp-breathe 3.8s ease-in-out infinite;
  transform-origin: 50% 100%;
  will-change: transform;
}

.hpp-pet.is-hovering {
  animation: hpp-breathe 3.8s ease-in-out infinite, hpp-sway 1.8s ease-in-out infinite;
}

.hpp-pet.is-tap {
  animation: hpp-tap 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hpp-pet.is-wave {
  animation: hpp-wave 820ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hpp-pet.is-heart {
  animation: hpp-heart 960ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hpp-pet.is-pop {
  animation: hpp-pop 820ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hpp-pet.is-dragging {
  cursor: grabbing;
  animation-play-state: paused;
}

.hpp-pet__stage {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  transform: translateZ(0);
}

.hpp-pet__stage:active {
  transform: translateY(1px) scale(0.99);
}

.hpp-pet__image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 18px 22px rgba(61, 37, 48, 0.18));
}

.hpp-pet__bubble {
  position: absolute;
  z-index: 5;
  right: 8%;
  bottom: calc(100% + 10px);
  max-width: min(260px, calc(100vw - 32px));
  min-width: 132px;
  padding: 10px 13px;
  border: 2px solid rgba(255, 177, 190, 0.92);
  border-radius: 16px 16px 6px 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(61, 37, 48, 0.15);
  color: var(--hpp-ink);
  font-size: 14px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.hpp-pet-root--bottom-left .hpp-pet__bubble,
.hpp-pet-root--top-left .hpp-pet__bubble {
  right: auto;
  left: 8%;
  border-radius: 16px 16px 16px 6px;
}

.hpp-pet-root--top-right .hpp-pet__bubble,
.hpp-pet-root--top-left .hpp-pet__bubble {
  top: calc(100% + 10px);
  bottom: auto;
}

.hpp-pet__bubble.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hpp-pet__close {
  position: absolute;
  z-index: 4;
  top: -8px;
  right: -6px;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 189, 198, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--hpp-rose);
  cursor: pointer;
  font-size: 20px;
  line-height: 21px;
  box-shadow: 0 8px 20px rgba(61, 37, 48, 0.15);
}

.hpp-pet__close:active,
.hpp-pet__toggle:active {
  transform: translateY(1px) scale(0.96);
}

.hpp-pet__toggle {
  display: none;
  width: 52px;
  height: 52px;
  margin-left: auto;
  border: 2px solid rgba(255, 177, 190, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--hpp-rose);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 34px rgba(61, 37, 48, 0.16);
  pointer-events: auto;
  cursor: pointer;
}

.hpp-pet-root.is-closed .hpp-pet {
  display: none;
}

.hpp-pet-root.is-closed .hpp-pet__toggle {
  display: block;
}

.hpp-popcorn {
  position: absolute;
  z-index: 3;
  left: 48%;
  top: 44%;
  width: 13px;
  height: 13px;
  border: 2px solid #e4a56c;
  border-radius: 60% 45% 60% 45%;
  background: #fff7df;
  box-shadow: inset -2px -2px 0 #f0ca8b;
  pointer-events: none;
  animation: hpp-popcorn 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes hpp-breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.018);
  }
}

@keyframes hpp-sway {
  0%,
  100% {
    rotate: 0deg;
  }
  50% {
    rotate: -1.8deg;
  }
}

@keyframes hpp-tap {
  0% {
    transform: translateY(0) scale(1);
  }
  42% {
    transform: translateY(-14px) scale(1.04) rotate(-2deg);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes hpp-wave {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  44% {
    transform: translateY(-9px) rotate(-3deg) scale(1.025);
  }
}

@keyframes hpp-heart {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  36% {
    transform: translateY(-6px) scale(1.035);
  }
  62% {
    transform: translateY(-3px) scale(1.012);
  }
}

@keyframes hpp-pop {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  35% {
    transform: translateY(-16px) rotate(2deg) scale(1.045);
  }
  68% {
    transform: translateY(2px) rotate(-1deg) scale(0.99);
  }
}

@keyframes hpp-popcorn {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.3) rotate(0deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--hpp-x), calc(var(--hpp-y) * -1), 0) scale(1) rotate(var(--hpp-rotate));
  }
}

@media (max-width: 640px) {
  .hpp-pet-root {
    --hpp-edge: 10px;
    width: min(var(--hpp-size), 38vw);
  }

  .hpp-pet__bubble {
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 118px;
    font-size: 12px;
  }

  .hpp-pet__close {
    top: -7px;
    right: -4px;
    width: 25px;
    height: 25px;
    font-size: 18px;
  }

  .hpp-pet-root--top-right .hpp-pet__bubble,
  .hpp-pet-root--top-left .hpp-pet__bubble {
    top: calc(100% + 8px);
  }
}
