/* Caly Fun Games — bubble pop, peek-a-Caly, song circle animations */

.caly-fun-stage {
  position: relative;
  min-height: 320px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, #dff9fb 0%, #c7ecee 100%);
}

.caly-fun-stage .caly-mascot-stage {
  position: relative;
  z-index: 2;
  margin: 0.5rem auto;
}

.caly-mascot-with-scene {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto 0.75rem;
  min-height: 200px;
}

.caly-scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  opacity: 0.95;
}

.caly-mascot-with-scene .play-mascot {
  position: relative;
  z-index: 2;
  margin: 2.5rem auto 0;
  display: block;
}

.caly-mascot-img.caly-mascot-wave { animation: caly-wave-bob 1.4s ease-in-out infinite; }
.caly-mascot-img.caly-mascot-listen { animation: caly-listen-bob 1.2s ease-in-out infinite; }
.caly-mascot-img.caly-mascot-celebrate { animation: caly-jump 0.6s ease-out; }
.caly-mascot-img.caly-mascot-peek { animation: caly-peek-wiggle 1s ease-in-out infinite; }
.caly-mascot-img.caly-mascot-dance { animation: caly-dance-bounce 0.5s ease-in-out infinite; }
.caly-mascot-img.caly-mascot-sleepy { animation: caly-sleepy-sway 2.5s ease-in-out infinite; }

@keyframes caly-wave-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

@keyframes caly-peek-wiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes caly-dance-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.04); }
}

@keyframes caly-sleepy-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.caly-mascot-react .play-mascot {
  animation: caly-jump 0.55s ease-out !important;
}

.bubble-field {
  position: relative;
  height: 220px;
  margin: 0.5rem 0;
  overflow: hidden;
}

.word-bubble {
  position: absolute;
  bottom: -80px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.9);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(116, 185, 255, 0.55));
  box-shadow: inset -4px -4px 12px rgba(0,0,0,0.08), 0 6px 16px rgba(0,0,0,0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bubble-float-up 6s linear forwards;
  padding: 0;
}

.word-bubble img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  pointer-events: none;
}

.word-bubble.popped {
  animation: bubble-pop 0.35s ease-out forwards;
  pointer-events: none;
}

@keyframes bubble-float-up {
  from { transform: translateY(0) scale(0.9); opacity: 0.85; }
  to { transform: translateY(-320px) scale(1.05); opacity: 1; }
}

@keyframes bubble-pop {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
  100% { transform: scale(0); opacity: 0; }
}

.peek-grid {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0;
  perspective: 800px;
}

.peek-card {
  width: 100px;
  height: 130px;
  position: relative;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
}

.peek-card-inner {
  width: 100%;
  height: 100%;
  transition: transform 0.55s ease;
  transform-style: preserve-3d;
  border-radius: 14px;
}

.peek-card.flipped .peek-card-inner {
  transform: rotateY(180deg);
}

.peek-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 4px solid #fff;
  box-shadow: 0 6px 0 #e17055;
}

.peek-face.front {
  background: linear-gradient(135deg, #74b9ff, #a29bfe);
  color: #fff;
  font-weight: 700;
}

.peek-face.back {
  background: #fff;
  transform: rotateY(180deg);
  overflow: hidden;
}

.peek-face.back img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.peek-face.back.caly-hidden img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.song-circle-orbit {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 1rem auto;
}

.orbit-symbol {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #ffd93d;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: orbit-bounce 0.8s ease-in-out infinite;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.orbit-symbol img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.orbit-symbol:nth-child(1) { top: 0; left: 50%; transform: translateX(-50%); animation-delay: 0s; }
.orbit-symbol:nth-child(2) { top: 50%; right: 0; transform: translateY(-50%); animation-delay: 0.2s; }
.orbit-symbol:nth-child(3) { bottom: 0; left: 50%; transform: translateX(-50%); animation-delay: 0.4s; }
.orbit-symbol:nth-child(4) { top: 50%; left: 0; transform: translateY(-50%); animation-delay: 0.6s; }

.orbit-symbol.highlight {
  border-color: #6bcb77;
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(107, 203, 119, 0.6);
}

@keyframes orbit-bounce {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

.song-lyrics-bar {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #2d3436;
  background: rgba(255, 234, 167, 0.85);
  border-radius: 16px;
  padding: 0.65rem 1rem;
  margin: 0.5rem 0;
  min-height: 2.5rem;
}

.caly-show-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #1a2332;
  min-height: 360px;
  margin-bottom: 1.5rem;
}

.caly-show-scene {
  position: relative;
  min-height: 280px;
}

.caly-show-lyrics {
  background: linear-gradient(90deg, #6bcb77, #74b9ff);
  color: #fff;
  text-align: center;
  padding: 0.85rem 1rem;
  font-size: 1.2rem;
  font-weight: 700;
  min-height: 3rem;
}

.caly-show-tiles {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: rgba(0,0,0,0.2);
}

.caly-show-tile {
  min-width: 88px;
  min-height: 100px;
  border-radius: 14px;
  border: 4px solid #fff;
  background: var(--panel, #1f2f45);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.caly-show-tile.active {
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(255, 217, 61, 0.8);
  border-color: #ffd93d;
}

.caly-show-tile.tapped {
  animation: tile-bounce 0.35s ease-out;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 1.2s ease-out forwards;
  pointer-events: none;
  z-index: 50;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(120px) rotate(540deg); opacity: 0; }
}
