/* Kawaii Dancing Characters - Hello Kitty Style Animations */

/* === Base Character Styles === */
.kawaii-character {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
  border-radius: 8px;
}

.kawaii-character:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(255, 182, 193, 0.6));
}

.kawaii-character:active {
  transform: scale(0.95);
}

.kawaii-character svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Dancing state */
.kawaii-character.dancing {
  filter: drop-shadow(0 0 12px rgba(255, 182, 193, 0.8));
}

/* Dance class application on parent */
.kawaii-character.dance-bounce {
  animation: bounceWave 0.8s ease-in-out infinite;
}

.kawaii-character.dance-spin {
  animation: spinTwirl 0.6s ease-in-out infinite;
}

.kawaii-character.dance-slide {
  animation: hipHopSlide 0.5s ease-in-out infinite;
}

.kawaii-character.dance-jump {
  animation: jumpJoy 0.7s ease-in-out infinite;
}

.kawaii-character.dance-wiggle {
  animation: wiggleWobble 0.8s ease-in-out infinite;
}

.kawaii-character.dance-disco {
  animation: discoFever 1s ease-in-out infinite;
}

/* === Dancing Animations Keyframes === */

/* Dance 1: Bounce Wave - for Les As (1) - Ichi-chan */
@keyframes bounceWave {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(-5deg); }
  50% { transform: translateY(-2px) rotate(0deg); }
  75% { transform: translateY(-8px) rotate(5deg); }
}

/* Dance 2: Spin Twirl - for Les Deux (2) - Ni-nyan */
@keyframes spinTwirl {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(15deg) scale(1.1); }
  50% { transform: rotate(0deg) scale(1); }
  75% { transform: rotate(-15deg) scale(1.1); }
  100% { transform: rotate(0deg) scale(1); }
}

/* Dance 3: Hip Hop Slide - for Les Trois (3) - San-chan */
@keyframes hipHopSlide {
  0%, 100% { transform: translateX(0) skewX(0deg); }
  25% { transform: translateX(-5px) skewX(-5deg); }
  50% { transform: translateX(0) skewX(0deg); }
  75% { transform: translateX(5px) skewX(5deg); }
}

/* Dance 4: Jump Joy - for Les Quatre (4) - Yon-pyon */
@keyframes jumpJoy {
  0%, 100% { transform: translateY(0) scaleY(1); }
  30% { transform: translateY(-12px) scaleY(1.1); }
  50% { transform: translateY(-12px) scaleY(1.1); }
  70% { transform: translateY(0) scaleY(0.9); }
  85% { transform: translateY(0) scaleY(1.05); }
}

/* Dance 5: Wiggle Wobble - for Les Cinq (5) - Go-chan */
@keyframes wiggleWobble {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(-10deg); }
  20% { transform: rotate(10deg); }
  30% { transform: rotate(-10deg); }
  40% { transform: rotate(10deg); }
  50% { transform: rotate(0deg); }
}

/* Dance 6: Disco Fever - for Les Six (6) - Roku-tan */
@keyframes discoFever {
  0%, 100% { transform: scale(1) rotate(0deg); }
  12.5% { transform: scale(1.15) rotate(5deg); }
  25% { transform: scale(1) rotate(0deg); }
  37.5% { transform: scale(1.15) rotate(-5deg); }
  50% { transform: scale(1) rotate(0deg); }
  62.5% { transform: scale(1.15) rotate(5deg); }
  75% { transform: scale(1) rotate(0deg); }
  87.5% { transform: scale(1.15) rotate(-5deg); }
}

/* === Arm Wave Animation (shared) === */
@keyframes armWave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(20deg); }
}

.wave-arm {
  transform-origin: center bottom;
  animation: armWave 0.4s ease-in-out infinite;
}

/* === Eye Blink Animation === */
@keyframes eyeBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

.blink-eye {
  animation: eyeBlink 3s ease-in-out infinite;
}

/* === Tear Drop Animation (for sad character) === */
@keyframes tearDrop {
  0%, 100% {
    opacity: 0.8;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(3px);
  }
}

.tear-drop {
  animation: tearDrop 1.5s ease-in-out infinite;
}

/* === Sad Shake Animation === */
@keyframes sadShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-2px) rotate(-1deg); }
  20% { transform: translateX(2px) rotate(1deg); }
  30% { transform: translateX(-2px) rotate(-1deg); }
  40% { transform: translateX(2px) rotate(1deg); }
  50% { transform: translateX(0) rotate(0deg); }
}

.dance-sad {
  animation: sadShake 2s ease-in-out infinite;
}

/* === Heart Float Animation === */
@keyframes heartFloat {
  0%, 100% { 
    opacity: 0;
    transform: translateY(0) scale(0);
  }
  10% {
    opacity: 1;
    transform: translateY(-5px) scale(1);
  }
  90% {
    opacity: 1;
    transform: translateY(-25px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(0);
  }
}

.heart-float {
  position: absolute;
  animation: heartFloat 1.5s ease-out infinite;
}

/* === Star Sparkle Animation === */
@keyframes starSparkle {
  0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

.star-sparkle {
  position: absolute;
  animation: starSparkle 0.8s ease-in-out infinite;
}

/* === Character Container === */
.character-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === Celebration Overlay Dancing Characters === */
.kawaii-dancer,
.kawaii-dancer-left,
.kawaii-dancer-right,
.kawaii-winner,
.kawaii-winner-champion {
  display: flex;
  align-items: center;
  justify-content: center;
}

.kawaii-dancer svg,
.kawaii-dancer-left svg,
.kawaii-dancer-right svg,
.kawaii-winner svg,
.kawaii-winner-champion svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Dancing animation classes for celebration overlays */
.dance-bounce {
  animation: bounceWave 0.8s ease-in-out infinite;
}

.dance-spin {
  animation: spinTwirl 0.6s ease-in-out infinite;
}

.dance-slide {
  animation: hipHopSlide 0.5s ease-in-out infinite;
}

.dance-jump {
  animation: jumpJoy 0.7s ease-in-out infinite;
}

.dance-wiggle {
  animation: wiggleWobble 0.8s ease-in-out infinite;
}

.dance-disco {
  animation: discoFever 1s ease-in-out infinite;
}

/* Champion winner special glow */
.kawaii-winner-champion {
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.6));
}

.kawaii-winner-champion svg {
  filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.5));
}

.character-container .sparkle-1 {
  top: -5px;
  left: -5px;
  animation-delay: 0s;
}

.character-container .sparkle-2 {
  top: -8px;
  right: -3px;
  animation-delay: 0.3s;
}

.character-container .sparkle-3 {
  bottom: 0;
  left: -8px;
  animation-delay: 0.6s;
}

/* === Glow Effect on Hover === */
.kawaii-character.dancing {
  filter: drop-shadow(0 0 8px rgba(255, 182, 193, 0.8));
}

/* === Puni Puni Scene Animations === */

/* Idle state - subtle breathing */
@keyframes punipuni-idle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.punipuni-idle {
  animation: punipuni-idle 2s ease-in-out infinite;
}

/* Tapping state - jiggle reaction */
@keyframes punipuni-tap {
  0%, 100% { transform: rotate(-3deg) scale(0.9); }
  50% { transform: rotate(3deg) scale(0.85); }
}

.punipuni-tap {
  animation: punipuni-tap 0.15s ease-in-out infinite;
}

/* Fart state - deflate + shake */
@keyframes punipuni-fart {
  0% { transform: scale(1.2); }
  20% { transform: scale(0.8) rotate(-10deg); }
  40% { transform: scale(0.9) rotate(10deg); }
  60% { transform: scale(0.85) rotate(-5deg); }
  80% { transform: scale(0.9) rotate(5deg); }
  100% { transform: scale(1); }
}

.punipuni-fart {
  animation: punipuni-fart 0.6s ease-out forwards;
}

/* Success state - happy bounce */
@keyframes punipuni-success {
  0% { transform: scale(1); }
  30% { transform: scale(1.3) translateY(-20px); }
  50% { transform: scale(1) translateY(0); }
  70% { transform: scale(1.1) translateY(-10px); }
  100% { transform: scale(1); }
}

.punipuni-success {
  animation: punipuni-success 0.8s ease-out forwards;
}

/* Puni Puni character wrapper styles */
.punipuni-character-wrapper {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.punipuni-character-wrapper:active {
  cursor: grabbing;
}

/* Puni Puni character glow effects */
.punipuni-character {
  filter: drop-shadow(0 4px 12px rgba(236, 72, 153, 0.3));
  transition: filter 0.3s ease;
}

.punipuni-tap .punipuni-character,
.punipuni-character-wrapper:active .punipuni-character {
  filter: drop-shadow(0 4px 20px rgba(236, 72, 153, 0.6));
}

.punipuni-success .punipuni-character {
  filter: drop-shadow(0 4px 25px rgba(34, 197, 94, 0.6));
}

.punipuni-fart .punipuni-character {
  filter: drop-shadow(0 4px 15px rgba(148, 163, 184, 0.4));
}

/* Fart cloud animation */
@keyframes fart-cloud {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(0) scale(0.5);
  }
  30% {
    opacity: 1;
    transform: translateY(-50%) translateX(20px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) translateX(60px) scale(1.5);
  }
}

.punipuni-fart-cloud {
  animation: fart-cloud 0.8s ease-out forwards;
}

/* Progress bar pulse animation for danger zone */
@keyframes danger-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.punipuni-progress-container .bg-red-500 {
  animation: danger-pulse 0.3s ease-in-out infinite;
}

/* Loser character styles */
.kawaii-loser {
  display: flex;
  align-items: center;
  justify-content: center;
}

.kawaii-loser svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* === Reduced Motion Support === */
@media (prefers-reduced-motion: reduce) {
  .kawaii-character,
  .dance-bounce,
  .dance-spin,
  .dance-slide,
  .dance-jump,
  .dance-wiggle,
  .dance-disco,
  .wave-arm,
  .blink-eye,
  .heart-float,
  .star-sparkle,
  .punipuni-idle,
  .punipuni-tap,
  .punipuni-fart,
  .punipuni-success,
  .punipuni-fart-cloud {
    animation: none !important;
  }
}
