@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  --primary-color: #ff5e7e;
  --primary-hover: #ff335c;
  --secondary-color: #4facfe;
  --accent-yellow: #feca57;
  --accent-green: #1dd1a1;
  --accent-purple: #9b5de5;
  --bg-gradient: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
  --card-bg: rgba(255, 255, 255, 0.92);
  --text-dark: #2d3436;
  --text-muted: #636e72;
  --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.15);
  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 32px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Fredoka', 'Outfit', cursive, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-gradient);
  color: var(--text-dark);
  padding: 16px;
  overflow-x: hidden;
  position: relative;
}

/* Background Animated Bubbles/Circles */
body::before, body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  z-index: 0;
  opacity: 0.6;
  animation: floatBubble 10s ease-in-out infinite alternate;
}

body::before {
  width: 300px;
  height: 300px;
  background: #ff9a9e;
  top: 5%;
  left: 10%;
}

body::after {
  width: 350px;
  height: 350px;
  background: #a1c4fd;
  bottom: 5%;
  right: 10%;
  animation-delay: -5s;
}

@keyframes floatBubble {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(30px) scale(1.1); }
}

/* App Card Container */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.6);
  text-align: center;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Screen Switching */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Badges and Mascot */
.badge {
  display: inline-block;
  background: #ffeb3b;
  color: #5d4037;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 50px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(254, 202, 87, 0.4);
  margin-bottom: 12px;
  animation: bounce 2s infinite ease-in-out;
}

.mascot {
  font-size: 5rem;
  margin-bottom: 10px;
  display: inline-block;
  animation: wave 2.5s infinite ease-in-out;
  transform-origin: bottom center;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.1));
}

.trophy {
  font-size: 5.5rem;
  margin-bottom: 12px;
  animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), floatTrophy 3s infinite ease-in-out;
}

@keyframes popIn {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

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

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg) scale(1.05); }
  75% { transform: rotate(8deg) scale(1.05); }
}

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

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  color: #2e384d;
  margin-bottom: 12px;
}

h1 span {
  background: linear-gradient(45deg, #ff5e7e, #9b5de5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.small {
  font-size: 0.85rem;
  color: #a4b0be;
  margin-top: 14px;
  font-weight: 600;
}

/* Buttons */
button.primary {
  background: linear-gradient(135deg, #ff6b8b 0%, #ff8e53 100%);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 16px 36px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 20px rgba(255, 107, 139, 0.4);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  outline: none;
  width: 100%;
  max-width: 280px;
}

button.primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 25px rgba(255, 107, 139, 0.5);
}

button.primary:active {
  transform: translateY(1px) scale(0.98);
}

/* Topbar & Header in Game */
.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
  background: #f8f9fe;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.score {
  color: #ff9f43;
}

.question-count {
  color: #54a0ff;
}

.lives {
  letter-spacing: 2px;
  font-size: 1.1rem;
}

/* Progress Bar */
.progress {
  width: 100%;
  height: 10px;
  background: #eef1f6;
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
}

#progressBar {
  width: 10%;
  height: 100%;
  background: linear-gradient(90deg, #1dd1a1, #10ac84);
  border-radius: 10px;
  transition: width 0.35s ease;
}

/* Question Area */
.question-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.speech {
  font-size: 0.95rem;
  font-weight: 600;
  color: #747d8c;
  background: #f1f2f6;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 12px;
}

#question {
  font-size: 1.85rem;
  font-weight: 800;
  color: #2f3542;
  margin-bottom: 24px;
}

/* Choice Buttons */
.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 16px;
}

.choice-btn {
  background: #ffffff;
  border: 3px solid #e4e7eb;
  color: #2f3542;
  font-family: inherit;
  font-size: 2.2rem;
  font-weight: 700;
  padding: 18px 0;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 0 #dfe4ea, var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: #54a0ff;
  box-shadow: 0 9px 0 #dfe4ea, var(--shadow-sm);
}

.choice-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #dfe4ea;
}

.choice-btn.correct {
  background: #1dd1a1 !important;
  color: #ffffff !important;
  border-color: #10ac84 !important;
  box-shadow: 0 4px 0 #10ac84, 0 0 15px rgba(29, 209, 161, 0.4) !important;
  animation: pulseCorrect 0.4s ease;
}

.choice-btn.wrong {
  background: #ff6b6b !important;
  color: #ffffff !important;
  border-color: #ee5253 !important;
  box-shadow: 0 4px 0 #ee5253 !important;
  animation: shakeWrong 0.4s ease;
}

@keyframes pulseCorrect {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Feedback Message */
.feedback {
  min-height: 32px;
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 4px;
  transition: opacity 0.2s;
}

.feedback.correct {
  color: #10ac84;
}

.feedback.wrong {
  color: #ee5253;
}

/* Result Screen */
.final-score {
  background: linear-gradient(135deg, #f8f9fe, #eef1f6);
  padding: 16px 28px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
}

.final-score span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.final-score strong {
  font-size: 3rem;
  color: #ff5e7e;
  font-weight: 800;
}

.result-message {
  font-size: 1.15rem;
  font-weight: 600;
  color: #57606f;
  margin-bottom: 24px;
  line-height: 1.4;
  padding: 0 10px;
}

/* Confetti Container */
#confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 18px;
  opacity: 0.9;
  border-radius: 3px;
  animation: fall 3s linear forwards;
}

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