/* Custom Animated Characters and UI Elements */

/* Animated 2D Character: Quiz Master */
.quiz-master-character {
  position: relative;
  width: 100px;
  height: 150px;
  margin: 20px auto;
}

.quiz-master-head {
  position: absolute;
  top: 0;
  left: 30px;
  width: 40px;
  height: 40px;
  background: #f9d1b7;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  z-index: 10;
  animation: headBob 3s ease-in-out infinite;
}

.quiz-master-body {
  position: absolute;
  top: 35px;
  left: 35px;
  width: 30px;
  height: 60px;
  background: #4f46e5;
  border-radius: 10px 10px 0 0;
}

.quiz-master-left-arm {
  position: absolute;
  top: 40px;
  left: 20px;
  width: 10px;
  height: 40px;
  background: #f9d1b7;
  border-radius: 5px;
  animation: armWave 2s ease-in-out infinite;
  transform-origin: top center;
}

.quiz-master-right-arm {
  position: absolute;
  top: 40px;
  left: 50px;
  width: 10px;
  height: 40px;
  background: #f9d1b7;
  border-radius: 5px;
  animation: armWave 2s ease-in-out 0.5s infinite;
  transform-origin: top center;
}

.quiz-master-left-leg {
  position: absolute;
  top: 95px;
  left: 30px;
  width: 10px;
  height: 40px;
  background: #f9d1b7;
  border-radius: 5px;
  animation: legMove 1.5s ease-in-out infinite;
  transform-origin: top center;
}

.quiz-master-right-leg {
  position: absolute;
  top: 95px;
  left: 40px;
  width: 10px;
  height: 40px;
  background: #f9d1b7;
  border-radius: 5px;
  animation: legMove 1.5s ease-in-out 0.75s infinite;
  transform-origin: top center;
}

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

@keyframes armWave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-10deg); }
}

@keyframes legMove {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(10deg); }
}

/* Custom Loading Screen Animations */
.custom-loading-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0d0628 0%, #1a0830 50%, #2c0b3a 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 2rem;
}

.loading-spinner::before,
.loading-spinner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 4px solid transparent;
}

.loading-spinner::before {
  width: 100%;
  height: 100%;
  border-top: 4px solid #6366f1;
  border-right: 4px solid #6366f1;
  animation: spin 1.5s linear infinite;
}

.loading-spinner::after {
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
  border-bottom: 4px solid #8b5cf6;
  border-left: 4px solid #8b5cf6;
  animation: spinReverse 1.5s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinReverse {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

.loading-text {
  color: white;
  font-size: 1.5rem;
  text-align: center;
  margin-top: 1rem;
  font-weight: 600;
}

.loading-dots::after {
  content: '.';
  animation: dots 1.5s steps(5, end) infinite;
}

.loading-dots::after {
  content: '.';
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Bouncing Quiz Balls Loading Animation */
.bouncing-balls {
  display: flex;
  gap: 10px;
  margin: 2rem 0;
}

.bouncing-ball {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 50%;
  animation: bounceBall 1.5s ease-in-out infinite;
}

.bouncing-ball:nth-child(2) {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  animation-delay: 0.2s;
}

.bouncing-ball:nth-child(3) {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  animation-delay: 0.4s;
}

@keyframes bounceBall {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-30px); }
}

/* Pulsing Quiz Logo */
.pulse-logo {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #b4a0ff 0%, #d1b3ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2rem;
  animation: pulse 2s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(123, 31, 162, 0.5);
}

@keyframes pulse {
  0%, 100% { 
    transform: scale(1); 
    text-shadow: 0 0 10px rgba(123, 31, 162, 0.5);
  }
  50% { 
    transform: scale(1.05); 
    text-shadow: 0 0 20px rgba(123, 31, 162, 0.8);
  }
}

/* Animated Progress Bar */
.loading-progress-container {
  width: 80%;
  max-width: 400px;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin: 2rem 0;
  overflow: hidden;
  position: relative;
}

.loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  animation: progress 3s linear infinite;
  transition: width 0.4s ease;
}

@keyframes progress {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.loading-progress-bar {
  background-size: 200% 200%;
  background-position: 0% 50%;
}

/* Animated Question Marks Loading */
.question-marks-container {
  display: flex;
  gap: 15px;
  margin: 2rem 0;
}

.question-mark {
  font-size: 2rem;
  color: #6366f1;
  animation: float 3s ease-in-out infinite;
}

.question-mark:nth-child(1) { animation-delay: 0s; }
.question-mark:nth-child(2) { animation-delay: 0.5s; }
.question-mark:nth-child(3) { animation-delay: 1s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* Animated Confetti Effect */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10000;
  display: none;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f00;
  animation: confetti-fall linear forwards;
}

.confetti:nth-child(2n) {
  background: #0f0;
}

.confetti:nth-child(3n) {
  background: #00f;
}

.confetti:nth-child(4n) {
  background: #ff0;
}

.confetti:nth-child(5n) {
  background: #f0f;
}

.confetti:nth-child(6n) {
  background: #0ff;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Animated Celebration Effect */
.celebration-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5000;
  display: none;
}

.star {
  position: absolute;
  width: 10px;
  height: 10px;
  background: gold;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: star-sparkle 1.5s ease-out forwards;
}

@keyframes star-sparkle {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(1);
    opacity: 0;
  }
}

/* Animated Player Avatars */
.animated-avatar {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  animation: floatPlayer 3s ease-in-out infinite;
}

.animated-avatar::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  background: inherit;
  filter: blur(10px);
  opacity: 0.7;
  z-index: -1;
}

@keyframes floatPlayer {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Animated Feedback Effects */
.feedback-animation {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 2rem;
  font-weight: bold;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  animation: feedback-appear 2s ease-out forwards;
}

@keyframes feedback-appear {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1.1);
  }
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.8);
  }
}

.feedback-correct {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.feedback-incorrect {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.feedback-waiting {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}