:root {
  --game-bg: radial-gradient(circle at 50% 15%, #f0fdfa 0%, #e0f2fe 45%, #bae6fd 100%);
  --bubble-border: rgba(255, 255, 255, 0.85);
}

.bubble-field {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  background: var(--game-bg);
}

.bubble-area {
  position: absolute;
  inset: 0;
}

/* Base bubble button */
.bubble-btn {
  position: absolute;
  border-radius: 50%;
  border: 2.5px solid var(--bubble-border);
  box-shadow:
    inset 0 -6px 14px rgba(0, 0, 0, 0.05),
    inset 0 4px 10px rgba(255, 255, 255, 0.85),
    0 8px 24px rgba(14, 116, 144, 0.16);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  padding: 0;
  will-change: transform;
}

.bubble-btn:focus-visible {
  outline: 3px solid #ffb300;
  outline-offset: 4px;
}

/* Specular highlight crescent */
.bubble-btn::before {
  content: '';
  position: absolute;
  top: 12%;
  left: 18%;
  width: 32%;
  height: 22%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.3) 70%, transparent 100%);
  border-radius: 50%;
  transform: rotate(-35deg);
  pointer-events: none;
}

/* Secondary rim reflection */
.bubble-btn::after {
  content: '';
  position: absolute;
  bottom: 12%;
  right: 18%;
  width: 24%;
  height: 14%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.6) 0%, transparent 80%);
  border-radius: 50%;
  transform: rotate(-30deg);
  pointer-events: none;
}

/* Giant bubble styling */
.bubble-btn.bubble-giant {
  border-width: 3.5px;
  box-shadow:
    inset 0 -8px 20px rgba(0, 0, 0, 0.07),
    inset 0 6px 16px rgba(255, 255, 255, 0.95),
    0 12px 32px rgba(147, 51, 234, 0.22);
}

/* Floating surprise icon inside bubble */
.bubble-content {
  font-size: var(--item-size, 34px);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.16));
  animation: bubble-item-bob 2.6s ease-in-out infinite alternate;
}

@keyframes bubble-item-bob {
  0% { transform: translateY(-2px) scale(0.96); }
  100% { transform: translateY(2px) scale(1.04); }
}

/* Popped surprise flying out */
.popped-surprise {
  position: absolute;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  animation: surprise-rise 1.1s cubic-bezier(0.18, 0.89, 0.32, 1.25) forwards;
}

.surprise-icon {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

.surprise-label {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: #0369a1;
  background: rgba(255, 255, 255, 0.94);
  padding: 3px 12px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

@keyframes surprise-rise {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0.2;
  }
  35% {
    transform: translate(-50%, -75%) scale(1.25);
    opacity: 1;
  }
  75% {
    transform: translate(-50%, -105%) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -135%) scale(0.85);
    opacity: 0;
  }
}

/* Droplet / Sparkle particles */
.sparkle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 15%, var(--drop-color, #7dd3fc) 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  animation: sparkle-burst 0.45s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

@keyframes sparkle-burst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* Gentle water ripple on touching background */
.water-ripple {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: ripple-spread 0.6s cubic-bezier(0.1, 0.6, 0.3, 1) forwards;
}

@keyframes ripple-spread {
  0% {
    width: 8px;
    height: 8px;
    opacity: 0.9;
    border-width: 3px;
  }
  100% {
    width: 130px;
    height: 130px;
    opacity: 0;
    border-width: 1px;
  }
}

.ripple-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  font-size: 14px;
  font-weight: 700;
  color: #0284c7;
  pointer-events: none;
  opacity: 0.85;
  white-space: nowrap;
  animation: ripple-text 0.6s ease-out forwards;
}

@keyframes ripple-text {
  0% { transform: translate(-50%, -40%) scale(0.8); opacity: 0.9; }
  100% { transform: translate(-50%, -130%) scale(1.1); opacity: 0; }
}

/* Celebration floating stars */
.celebration-star {
  position: absolute;
  pointer-events: none;
  font-size: 28px;
  line-height: 1;
  z-index: 12;
  animation: celeb-float 1.2s ease-out forwards;
}

@keyframes celeb-float {
  0% {
    transform: translate(-50%, 0) scale(0.5);
    opacity: 0;
  }
  25% {
    transform: translate(calc(-50% + var(--dx, 0px) * 0.3), -35px) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx, 0px)), -150px) scale(0.8);
    opacity: 0;
  }
}

/* Accessibility / Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bubble-content {
    animation: none;
  }
  .sparkle {
    animation: sparkle-fade 0.3s ease-out forwards;
  }
  @keyframes sparkle-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
  }
  .popped-surprise {
    animation: surprise-fade 0.7s ease-out forwards;
  }
  @keyframes surprise-fade {
    0% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
  }
  .water-ripple {
    animation: ripple-fade 0.4s ease-out forwards;
  }
  @keyframes ripple-fade {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
  }
  .ripple-label {
    animation: ripple-fade 0.4s ease-out forwards;
  }
  .celebration-star {
    animation: celeb-fade 0.8s ease-out forwards;
  }
  @keyframes celeb-fade {
    0% { opacity: 1; }
    100% { opacity: 0; }
  }
}
