html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: radial-gradient(
    1200px 800px at 50% 40%,
    #eef2ff 0%,
    #dbe3ff 45%,
    #c7d2ff 100%
  );
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;

  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

#stage {
  position: fixed;
  inset: 0;
}

/* Blackout expanding circle */
#blackout {
  position: fixed;
  width: 20px;
  height: 20px;
  background: black;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  z-index: 999;
}

#blackout.active {
  animation: blackoutExpand 900ms ease-in forwards;
}

@keyframes blackoutExpand {
  to {
    transform: translate(-50%, -50%) scale(150);
  }
}

/* Base bubble */
.bubble {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform, opacity;
  pointer-events: none;
}

/* Word bubbles */
.word-bubble {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
  padding: 6px;

  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(6px);
}

/* Photo bubbles */
.photo-bubble {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  background-color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(6px);

  position: relative;
}

.photo-bubble::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 20%,
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0.08) 55%,
    rgba(0, 0, 0, 0.08)
  );
  pointer-events: none;
}

/* ✅ POP ANIMATION — applies to ALL bubbles */
.bubble.pop {
  animation: pop 600ms ease-out forwards;
}

@keyframes pop {
  0% {
    opacity: 1;
    transform: translate(var(--tx), var(--ty)) scale(var(--s));
  }
  60% {
    opacity: 1;
    transform: translate(var(--tx), var(--ty)) scale(calc(var(--s) * 1.4));
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(calc(var(--s) * 1.8));
  }
}

/* Center bubble */
.center-bubble {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  z-index: 10;

  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);

  display: grid;
  place-items: center;
  pointer-events: auto;
  cursor: pointer;
}

.center-bubble img {
  width: 92%;
  height: 92%;
  border-radius: 50%;
  object-fit: cover;
  transition: opacity 200ms ease;
}

.center-bubble .enter-text {
  position: absolute;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: #3a3a6a;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.center-bubble.hovered img {
  opacity: 0;
}

.center-bubble.hovered .enter-text {
  opacity: 1;
}

/* Click hint */
.click-hint {
  position: absolute;
  right: -140px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  color: #3a3a6a;
  white-space: nowrap;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  opacity: 0.85;
  transition: opacity 300ms ease;
  animation: hintBounce 1.5s ease-in-out infinite;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hint-arrow {
  display: inline-block;
  margin-right: 4px;
  animation: arrowBounce 1.5s ease-in-out infinite;
}

@keyframes hintBounce {
  0%, 100% {
    transform: translateY(-50%) translateX(0);
  }
  50% {
    transform: translateY(-50%) translateX(-5px);
  }
}

@keyframes arrowBounce {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-8px);
  }
}

.center-bubble.hovered .click-hint {
  opacity: 0;
}

.center-bubble.bursting .click-hint {
  opacity: 0;
}

#stage.no-pointer {
  pointer-events: none;
}

/* Center burst */
.center-bubble.bursting {
  animation: centerBurst 650ms ease-out forwards;
}

@keyframes centerBurst {
  0% {
    opacity: 1;
    transform: translate(var(--tx), var(--ty)) scale(1);
  }
  60% {
    opacity: 1;
    transform: translate(var(--tx), var(--ty)) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(1.6);
  }
}
