/**
 * ============================================================================
 * HEALTHY HABITS - GAMING UI/UX
 * ============================================================================
 * Ultra-modern, kid-friendly gaming experience
 * Features: Animated characters, particles, 3D effects, rewards
 * ============================================================================
 */

/* ========================================================================== */
/* 1. GLOBAL GAMING THEME */
/* ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Fredoka+One&family=Poppins:wght@400;600;700&display=swap");

:root {
  /* Gaming Colors - Vibrant & Fun */
  --primary-green: #00d98f;
  --secondary-green: #00ff9f;
  --dark-green: #00a86e;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --yellow: #fbbf24;
  --orange: #f97316;
  --blue: #3b82f6;
  --red: #ef4444;

  /* Background Gaming Gradients */
  --bg-game: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-success: linear-gradient(135deg, #00d98f 0%, #00ff9f 100%);
  --bg-danger: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --bg-warning: linear-gradient(135deg, #fa709a 0%, #fee140 100%);

  /* Text */
  --text-dark: #1f2937;
  --text-light: #f9fafb;

  /* Shadows & Glow */
  --glow-green: 0 0 20px rgba(0, 217, 143, 0.5);
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.5);
  --shadow-gaming: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-floating: 0 20px 50px rgba(0, 0, 0, 0.4);

  /* Animations */
  --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  overflow-x: hidden;
  background: #f3f4f6;
}

/* ========================================================================== */
/* 2. WELCOME SCREEN - GAMING STYLE */
/* ========================================================================== */

#welcome-screen {
  min-height: 100vh;
  background: var(--bg-game);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* Animated Background Particles */
#welcome-screen::before {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(
      circle at 20% 50%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    );
  animation: particles 20s linear infinite;
}

@keyframes particles {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Floating Emoji Decorations */
.emoji-float {
  position: absolute;
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
  opacity: 0.3;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(10deg);
  }
}

/* Game Header */
.game-header {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: fadeInDown 0.8s var(--bounce);
}

.game-icon {
  font-size: 6rem;
  display: inline-block;
  animation: bounce 2s ease-in-out infinite;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

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

.game-title {
  font-family: "Fredoka One", cursive;
  font-size: 4rem;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 255, 255, 0.2);
  margin: 1rem 0;
  letter-spacing: 2px;
}

.game-description {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.95);
  max-width: 600px;
  margin: 0 auto;
  font-weight: 600;
}

/* Difficulty Selection - Gaming Cards */
.difficulty-selection {
  margin: 3rem 0;
  position: relative;
  z-index: 2;
}

.difficulty-selection h2 {
  font-family: "Fredoka One", cursive;
  font-size: 2rem;
  color: white;
  margin-bottom: 2rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.difficulty-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.difficulty-card {
  background: white;
  border-radius: 25px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s var(--bounce);
  border: 4px solid transparent;
  box-shadow: var(--shadow-gaming);
  position: relative;
  overflow: hidden;
  transform: translateY(0);
}

.difficulty-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(139, 92, 246, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s;
}

.difficulty-card:hover {
  transform: translateY(-15px) scale(1.05);
  box-shadow: var(--shadow-floating);
}

.difficulty-card:hover::before {
  opacity: 1;
}

.difficulty-card.selected {
  border-color: var(--primary-green);
  background: linear-gradient(135deg, #fff 0%, #f0fdf4 100%);
  transform: translateY(-10px) scale(1.08);
  box-shadow: var(--shadow-floating), 0 0 0 4px rgba(0, 217, 143, 0.3),
    var(--glow-green);
}

.difficulty-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}

.difficulty-card:hover .difficulty-icon {
  animation: spin 0.6s ease-in-out;
}

@keyframes spin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.difficulty-name {
  font-family: "Fredoka One", cursive;
  font-size: 1.75rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.difficulty-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--bg-success);
  color: white;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 1rem;
  box-shadow: 0 4px 10px rgba(0, 217, 143, 0.3);
}

.difficulty-info {
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Start Button - Epic Gaming Style */
.btn-primary {
  font-family: "Fredoka One", cursive;
  font-size: 1.75rem;
  padding: 1.25rem 3rem;
  background: var(--bg-success);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 217, 143, 0.4),
    inset 0 -5px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s var(--bounce);
  position: relative;
  overflow: hidden;
  margin: 2rem 0;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 15px 40px rgba(0, 217, 143, 0.6), var(--glow-green);
}

.btn-primary:active {
  transform: translateY(-2px) scale(1.05);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary span {
  position: relative;
  z-index: 1;
}

/* ========================================================================== */
/* 3. GAME SCREEN - CHARACTER & ANIMATIONS */
/* ========================================================================== */

#game-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  padding: 1.5rem;
  position: relative;
}

/* Top Bar - Gaming HUD */
.game-top-bar {
  background: white;
  border-radius: 25px;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-gaming);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border: 3px solid var(--primary-green);
}

.game-stats {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-family: "Fredoka One", cursive;
  font-size: 2rem;
  color: var(--primary-green);
  text-shadow: 0 2px 5px rgba(0, 217, 143, 0.3);
}

.icon-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-success);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 217, 143, 0.3);
  transition: all 0.3s var(--bounce);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  transform: scale(1.15) rotate(15deg);
  box-shadow: 0 8px 20px rgba(0, 217, 143, 0.5);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Health Meter - Gaming Style with Character */
.health-meter-container {
  background: white;
  border-radius: 25px;
  padding: 1.5rem;
  box-shadow: var(--shadow-gaming);
  margin-bottom: 2rem;
  border: 3px solid var(--primary-green);
  position: relative;
  overflow: visible;
}

/* Animated Character */
.health-character {
  position: absolute;
  left: -60px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  animation: characterBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

@keyframes characterBounce {
  0%,
  100% {
    transform: translateY(-50%) scale(1);
  }
  50% {
    transform: translateY(-60%) scale(1.1);
  }
}

.health-meter-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-family: "Fredoka One", cursive;
  font-size: 1.25rem;
}

.health-meter-value {
  font-size: 2rem;
  color: var(--primary-green);
  text-shadow: 0 2px 5px rgba(0, 217, 143, 0.3);
}

.health-meter-bar {
  height: 30px;
  background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 100%);
  border-radius: 50px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.health-meter-fill {
  height: 100%;
  border-radius: 50px;
  position: relative;
  transition: all 0.6s var(--smooth);
  box-shadow: 0 0 20px currentColor;
}

/* Health States with Gradients */
.health-meter-fill.critical {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
  animation: pulse-danger 1s ease-in-out infinite;
}

.health-meter-fill.poor {
  background: linear-gradient(90deg, #f97316 0%, #ea580c 100%);
}

.health-meter-fill.fair {
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
}

.health-meter-fill.good {
  background: linear-gradient(90deg, #00d98f 0%, #00ff9f 100%);
}

.health-meter-fill.flourishing {
  background: linear-gradient(90deg, #00ff9f 0%, #00d98f 50%, #10b981 100%);
  animation: pulse-success 2s ease-in-out infinite;
}

@keyframes pulse-danger {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes pulse-success {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(0, 217, 143, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 255, 159, 0.8);
  }
}

/* Sparkles Effect */
.health-meter-fill::after {
  content: "✨";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
  50% {
    opacity: 0.5;
    transform: translateY(-50%) scale(1.3);
  }
}

.health-meter-status {
  margin-top: 0.75rem;
  text-align: center;
  font-family: "Fredoka One", cursive;
  font-size: 1.125rem;
  text-transform: capitalize;
}

/* Scenario Container - Card Style */
.scenario-container {
  background: white;
  border-radius: 30px;
  padding: 2.5rem;
  box-shadow: var(--shadow-gaming);
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.scenario-title {
  font-family: "Fredoka One", cursive;
  font-size: 2.25rem;
  color: var(--primary-green);
  text-align: center;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 10px rgba(0, 217, 143, 0.2);
}

.scenario-context {
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--text-dark);
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: 20px;
  border-left: 5px solid var(--primary-green);
  margin-bottom: 2rem;
  box-shadow: 0 5px 15px rgba(0, 217, 143, 0.1);
}

.progress-indicator {
  text-align: center;
  margin: 2rem 0;
  font-family: "Fredoka One", cursive;
  font-size: 1.125rem;
  color: #6b7280;
}

/* Choice Buttons - Gaming Cards */
.choices-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 2rem 0;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  background: white;
  border: 4px solid #e5e7eb;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s var(--bounce);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.choice-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 217, 143, 0.1) 50%,
    transparent 100%
  );
  transition: left 0.5s;
}

.choice-btn:hover::before {
  left: 100%;
}

.choice-btn:hover {
  transform: translateX(10px) scale(1.02);
  border-color: var(--primary-green);
  box-shadow: 0 10px 25px rgba(0, 217, 143, 0.2),
    0 0 0 3px rgba(0, 217, 143, 0.1);
}

.choice-letter {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-success);
  color: white;
  font-family: "Fredoka One", cursive;
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 5px 15px rgba(0, 217, 143, 0.3);
  transition: all 0.3s var(--bounce);
}

.choice-btn:hover .choice-letter {
  transform: scale(1.15) rotate(5deg);
}

.choice-text {
  flex: 1;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-dark);
  font-weight: 600;
}

.choice-btn.selected {
  border-color: var(--primary-green);
  background: linear-gradient(135deg, #f0fdf4 0%, white 100%);
  transform: scale(1.02);
}

.choice-btn.disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* Feedback Section - Reward Style */
.feedback-section {
  margin-top: 2rem;
  padding: 2rem;
  border-radius: 25px;
  box-shadow: var(--shadow-gaming);
  animation: slideInUp 0.5s var(--bounce);
  position: relative;
  overflow: hidden;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-section::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 70%
  );
  animation: shimmer 3s linear infinite;
}

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

.feedback-section.correct {
  background: var(--bg-success);
  color: white;
  border: 4px solid var(--primary-green);
}

.feedback-section.wrong {
  background: var(--bg-danger);
  color: white;
  border: 4px solid var(--pink);
}

.feedback-text {
  position: relative;
  z-index: 2;
}

.feedback-text strong {
  font-family: "Fredoka One", cursive;
  font-size: 2rem;
  display: block;
  margin-bottom: 1rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.feedback-text p {
  font-size: 1.125rem;
  line-height: 1.8;
  margin: 1rem 0;
}

.feedback-tip {
  display: block;
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-dark);
  border-radius: 15px;
  font-weight: 600;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Next Button */
#next-btn {
  margin-top: 2rem;
  width: 100%;
  font-family: "Fredoka One", cursive;
  font-size: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-success);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 217, 143, 0.4);
  transition: all 0.3s var(--bounce);
}

#next-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 217, 143, 0.6);
}

/* ========================================================================== */
/* 4. ANIMATIONS & EFFECTS */
/* ========================================================================== */

/* Confetti Effect (will be triggered by JS) */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--primary-green);
  position: absolute;
  animation: confetti-fall 3s linear;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Star Burst Effect */
.star-burst {
  position: absolute;
  font-size: 2rem;
  animation: burst 0.6s ease-out forwards;
}

@keyframes burst {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(2) rotate(180deg);
    opacity: 0;
  }
}

/* ========================================================================== */
/* 5. RESPONSIVE DESIGN */
/* ========================================================================== */

@media (max-width: 768px) {
  .game-title {
    font-size: 2.5rem;
  }

  .difficulty-cards {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .scenario-container {
    padding: 1.5rem;
  }

  .choice-btn {
    padding: 1rem 1.5rem;
  }

  .health-character {
    display: none;
  }
}

/* ========================================================================== */
/* 6. LOADING & TRANSITIONS */
/* ========================================================================== */

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Screen Transitions */
.screen {
  display: none;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
