/* Kids English App Design System */

:root {
  --bg-primary: #f0f9ff;
  --bg-secondary: #e0f2fe;
  --color-primary: #0284c7;
  --color-secondary: #f43f5e;
  --color-accent: #eab308;
  --color-success: #22c55e;
  --color-error: #ef4444;
  --color-card-bg: #ffffff;
  --color-text-main: #1e293b;
  --color-text-muted: #64748b;
  
  --font-kids: 'Fredoka', sans-serif;
  --font-text: 'Quicksand', sans-serif;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-bubble: 0 8px 0px 0px rgba(0, 0, 0, 0.1);
  
  --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-smooth: all 0.3s ease;
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-text);
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  color: var(--color-text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Floating animated background clouds */
.sky-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud {
  position: absolute;
  font-size: 4rem;
  opacity: 0.25;
  user-select: none;
  animation: floatCloud 45s linear infinite;
}

.cloud-1 {
  top: 15%;
  left: -10%;
  animation-duration: 55s;
}

.cloud-2 {
  top: 45%;
  left: -10%;
  animation-duration: 40s;
  animation-delay: -15s;
}

.cloud-3 {
  top: 75%;
  left: -10%;
  animation-duration: 50s;
  animation-delay: -30s;
}

@keyframes floatCloud {
  0% { transform: translateX(-10vw); }
  100% { transform: translateX(110vw); }
}

/* Main Container */
.app-container {
  width: 100%;
  max-width: 1024px;
  min-height: 90vh;
  margin: 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 4px solid #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 3px dashed var(--bg-secondary);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
}

.animated-icon {
  font-size: 2.5rem;
  display: inline-block;
  animation: wobble 3s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-10deg) scale(1.1); }
  30% { transform: rotate(10deg) scale(1.1); }
  45% { transform: rotate(-10deg) scale(1.1); }
  60% { transform: rotate(5deg) scale(1.05); }
  75% { transform: rotate(-5deg) scale(1.05); }
}

.title-group h1 {
  font-family: var(--font-kids);
  font-size: 1.8rem;
  color: var(--color-primary);
  text-shadow: 1px 1px 0px #ffffff;
}

.title-group p {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Audio Controls Group */
.audio-controls-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f1f5f9;
  padding: 6px 16px;
  border-radius: 50px;
  border: 1px solid #e2e8f0;
}

.audio-toggle-wrapper {
  background: transparent;
  padding: 0;
  border: none;
}

.select-bubble {
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-main);
  background-color: white;
  border: 2px solid #cbd5e1;
  border-radius: 50px;
  padding: 5px 10px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  max-width: 160px;
  text-overflow: ellipsis;
}

.select-bubble:hover {
  border-color: var(--color-primary);
}

.select-bubble:focus {
  border-color: var(--color-primary);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.switch-input {
  display: none;
}

.switch-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  background-color: #cbd5e1;
  border-radius: 34px;
  transition: var(--transition-smooth);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.switch-input:checked + .switch-slider {
  background-color: var(--color-primary);
}

.switch-input:checked + .switch-slider:before {
  transform: translateX(22px);
}

/* Score Board */
.score-board {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
  padding: 8px 18px;
  border-radius: 50px;
  font-family: var(--font-kids);
  font-size: 1.2rem;
  font-weight: bold;
  color: #854d0e;
  box-shadow: 0 4px 0px #ca8a04;
  border: 2px solid #ca8a04;
}

.star-icon {
  font-size: 1.4rem;
  animation: spinStar 4s linear infinite;
}

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

/* Main Section Content */
.app-main {
  flex: 1;
  padding: 30px;
  position: relative;
}

/* Screen Transitions */
.app-screen {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.app-screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Screen Title and Back buttons */
.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.screen-header h2 {
  font-family: var(--font-kids);
  font-size: 1.8rem;
  color: var(--color-primary);
}

.btn-back {
  background: var(--color-secondary);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-family: var(--font-kids);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #be123c;
  transition: var(--transition-bounce);
}

.btn-back:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #be123c;
}

.btn-back:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #be123c;
}

/* HERO Section on Home */
.hero-section {
  text-align: center;
  margin-bottom: 35px;
}

.hero-banner {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 5px solid #ffffff;
  box-shadow: var(--shadow-md);
}

.hero-section h2 {
  font-family: var(--font-kids);
  font-size: 2.2rem;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.hero-section p {
  font-weight: 700;
  color: var(--color-text-muted);
}

/* Lessons Grid & Selector Cards */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 15px;
}

.lesson-select-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md), 0 8px 0px rgba(0,0,0,0.05);
  border: 3px solid #ffffff;
  transition: var(--transition-bounce);
  position: relative;
  text-align: left;
}

.lesson-select-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg), 0 14px 0px rgba(0,0,0,0.03);
}

.lesson-icon-box {
  width: 70px;
  height: 70px;
  background: white;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2.5px solid var(--color-primary);
  transition: var(--transition-bounce);
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.lesson-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lesson-emoji-fallback {
  font-size: 2.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.lesson-select-card:hover .lesson-icon-box {
  transform: scale(1.15) rotate(-5deg);
}

.lesson-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lesson-details h3 {
  font-family: var(--font-kids);
  font-size: 1.3rem;
  color: var(--color-text-main);
  margin-bottom: 5px;
}

.lesson-details p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.lesson-details .lesson-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 6px;
  background: var(--bg-secondary);
  padding: 2px 10px;
  border-radius: 50px;
  align-self: flex-start;
}

/* Theme variations for lesson cards */
.lesson-select-card.a1-theme, .lesson-select-card.b1-theme, .lesson-select-card.c1-theme, .lesson-select-card.d1-theme { border-color: #fca5a5; } /* Red/Pink */
.lesson-select-card.a1-theme .lesson-icon-box, .lesson-select-card.b1-theme .lesson-icon-box, .lesson-select-card.c1-theme .lesson-icon-box, .lesson-select-card.d1-theme .lesson-icon-box { border-color: #f87171; background: #fee2e2; }
.lesson-select-card.a1-theme h3, .lesson-select-card.b1-theme h3, .lesson-select-card.c1-theme h3, .lesson-select-card.d1-theme h3 { color: #b91c1c; }

.lesson-select-card.a2-theme, .lesson-select-card.b2-theme, .lesson-select-card.c2-theme, .lesson-select-card.d2-theme { border-color: #fde047; } /* Yellow */
.lesson-select-card.a2-theme .lesson-icon-box, .lesson-select-card.b2-theme .lesson-icon-box, .lesson-select-card.c2-theme .lesson-icon-box, .lesson-select-card.d2-theme .lesson-icon-box { border-color: #facc15; background: #fef9c3; }
.lesson-select-card.a2-theme h3, .lesson-select-card.b2-theme h3, .lesson-select-card.c2-theme h3, .lesson-select-card.d2-theme h3 { color: #a16207; }

.lesson-select-card.a3-theme, .lesson-select-card.b3-theme, .lesson-select-card.c3-theme, .lesson-select-card.d3-theme { border-color: #86efac; } /* Green */
.lesson-select-card.a3-theme .lesson-icon-box, .lesson-select-card.b3-theme .lesson-icon-box, .lesson-select-card.c3-theme .lesson-icon-box, .lesson-select-card.d3-theme .lesson-icon-box { border-color: #4ade80; background: #dcfce7; }
.lesson-select-card.a3-theme h3, .lesson-select-card.b3-theme h3, .lesson-select-card.c3-theme h3, .lesson-select-card.d3-theme h3 { color: #15803d; }

.lesson-select-card.a4-theme, .lesson-select-card.b4-theme, .lesson-select-card.c4-theme, .lesson-select-card.d4-theme { border-color: #93c5fd; } /* Blue */
.lesson-select-card.a4-theme .lesson-icon-box, .lesson-select-card.b4-theme .lesson-icon-box, .lesson-select-card.c4-theme .lesson-icon-box, .lesson-select-card.d4-theme .lesson-icon-box { border-color: #60a5fa; background: #dbeafe; }
.lesson-select-card.a4-theme h3, .lesson-select-card.b4-theme h3, .lesson-select-card.c4-theme h3, .lesson-select-card.d4-theme h3 { color: #1d4ed8; }

.lesson-select-card.a5-theme, .lesson-select-card.b5-theme, .lesson-select-card.c5-theme, .lesson-select-card.d5-theme { border-color: #c084fc; } /* Purple */
.lesson-select-card.a5-theme .lesson-icon-box, .lesson-select-card.b5-theme .lesson-icon-box, .lesson-select-card.c5-theme .lesson-icon-box, .lesson-select-card.d5-theme .lesson-icon-box { border-color: #a855f7; background: #f3e8ff; }
.lesson-select-card.a5-theme h3, .lesson-select-card.b5-theme h3, .lesson-select-card.c5-theme h3, .lesson-select-card.d5-theme h3 { color: #7e22ce; }

/* Menu Grid */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 25px;
  margin-top: 10px;
}

.menu-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-md), 0 8px 0px rgba(0,0,0,0.05);
  border: 3px solid #ffffff;
  transition: var(--transition-bounce);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
  min-height: 250px;
}

.menu-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg), 0 16px 0px rgba(0,0,0,0.03);
}

.menu-card-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  transition: var(--transition-bounce);
}

.menu-card:hover .menu-card-icon {
  transform: scale(1.25) rotate(5deg);
}

.menu-card h3 {
  font-family: var(--font-kids);
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.menu-card p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 15px;
}

/* Palette variations for menu cards */
.menu-card.learn { border-color: #93c5fd; }
.menu-card.learn h3 { color: #1e40af; }
.menu-card.game-pick { border-color: #a7f3d0; }
.menu-card.game-pick h3 { color: #065f46; }
.menu-card.game-spell { border-color: #fde047; }
.menu-card.game-spell h3 { color: #854d0e; }
.menu-card.game-memory { border-color: #fbcfe8; }
.menu-card.game-memory h3 { color: #9d174d; }

/* Bubbly Button */
.btn-bubble {
  background: var(--color-primary);
  color: white;
  border-radius: 50px;
  padding: 8px 25px;
  font-family: var(--font-kids);
  font-size: 1rem;
  font-weight: bold;
  box-shadow: 0 4px 0 #0369a1;
  transition: var(--transition-bounce);
}

.menu-card:hover .btn-bubble {
  background: var(--color-secondary);
  box-shadow: 0 4px 0 #be123c;
}

/* LEARN MODE */
.learn-container {
  display: flex;
  gap: 30px;
}

.words-sidebar {
  width: 200px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 8px;
  border-right: 3px dashed var(--bg-secondary);
}

/* Sidebar scrollbar style */
.words-sidebar::-webkit-scrollbar {
  width: 8px;
}
.words-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.words-sidebar::-webkit-scrollbar-thumb {
  background: var(--bg-secondary);
  border-radius: 10px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
  transition: var(--transition-bounce);
}

.sidebar-item:hover {
  transform: translateX(4px);
  border-color: var(--color-primary);
}

.sidebar-item.active {
  background: var(--bg-secondary);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.sidebar-emoji {
  font-size: 1.4rem;
}

/* Flashcard view */
.flashcard-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.flashcard {
  width: 100%;
  max-width: 450px;
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  box-shadow: var(--shadow-lg);
  border: 4px solid var(--bg-secondary);
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: var(--transition-bounce);
}

.card-number {
  position: absolute;
  top: 15px;
  right: 20px;
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.card-emoji-container {
  width: 150px;
  height: 150px;
  background: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 25px;
  border: 3px dashed var(--color-primary);
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.03);
}

.card-emoji {
  font-size: 6rem;
  animation: bounceMini 3s infinite ease-in-out;
}

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

.card-details {
  width: 100%;
}

.word-group {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.word-group h3 {
  font-family: var(--font-kids);
  font-size: 2.2rem;
  color: var(--color-primary);
}

.word-type {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.ipa-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.ipa-text {
  font-family: var(--font-text);
  font-size: 1.2rem;
  color: var(--color-secondary);
  font-weight: 700;
  background: #fff1f2;
  padding: 4px 12px;
  border-radius: 8px;
}

.btn-audio {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  font-family: var(--font-kids);
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #0369a1;
  transition: var(--transition-bounce);
}

.btn-audio:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #0369a1;
}

.btn-audio:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0369a1;
}

.vietnamese-translation {
  font-size: 1.4rem;
  font-weight: bold;
  color: #1e293b;
  margin-bottom: 25px;
}

.sentence-box {
  width: 100%;
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 20px;
  border-left: 5px solid var(--color-primary);
  text-align: left;
}

.sentence-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sentence-header h4 {
  font-family: var(--font-kids);
  font-size: 1rem;
  color: var(--color-text-muted);
}

.btn-audio.sentence-audio {
  padding: 4px 12px;
  font-size: 0.8rem;
}

.english-sentence {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.vietnamese-sentence {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Card navigation controls */
.card-controls {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.btn-nav {
  background: white;
  color: var(--color-primary);
  border: 3px solid var(--bg-secondary);
  border-radius: 50px;
  padding: 12px 30px;
  font-family: var(--font-kids);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--bg-secondary);
  transition: var(--transition-bounce);
}

.btn-nav:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--color-primary);
}

.btn-nav:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--color-primary);
}

/* SPEED TOGGLE slow read */
.speed-toggle {
  background: white;
  padding: 6px 15px;
  border-radius: 50px;
  font-weight: 700;
  border: 2px solid var(--bg-secondary);
  font-size: 0.9rem;
}

/* GAMES COMMON */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  border: 4px solid var(--bg-secondary);
  margin-top: 10px;
}

.game-progress {
  font-family: var(--font-kids);
  font-size: 1.1rem;
  color: var(--color-secondary);
  background: #ffe4e6;
  padding: 6px 15px;
  border-radius: 50px;
}

/* GAME 1: PICK */
.game-sound-trigger {
  text-align: center;
  margin-bottom: 35px;
}

.btn-play-sound {
  background: linear-gradient(135deg, #a7f3d0 0%, #34d399 100%);
  color: #065f46;
  border: 4px solid #ffffff;
  box-shadow: var(--shadow-md), 0 8px 0 #059669;
  border-radius: 50%;
  width: 140px;
  height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-bounce);
}

.btn-play-sound:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: var(--shadow-lg), 0 12px 0 #059669;
}

.btn-play-sound:active {
  transform: translateY(4px) scale(0.97);
  box-shadow: var(--shadow-sm), 0 4px 0 #059669;
}

.speaker-large {
  font-size: 3.5rem;
  animation: shake 2s infinite ease-in-out;
}

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

.game-hint-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-top: 15px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 550px;
}

.option-card {
  background: #f8fafc;
  border: 3px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-bounce);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #cbd5e1;
}

.option-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: 0 8px 0 var(--bg-secondary);
}

.option-emoji {
  font-size: 3.5rem;
  margin-bottom: 8px;
}

.option-word {
  font-weight: 700;
  font-size: 1.1rem;
}

/* Option feedback */
.option-card.correct {
  background: #f0fdf4;
  border-color: var(--color-success);
  box-shadow: 0 4px 0 #15803d;
  color: #166534;
  animation: bounceGreen 0.4s ease;
}

.option-card.incorrect {
  background: #fef2f2;
  border-color: var(--color-error);
  box-shadow: 0 4px 0 #991b1b;
  color: #991b1b;
  animation: shakeRed 0.4s ease;
}

@keyframes bounceGreen {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes shakeRed {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* GAME 2: SPELLING */
.spell-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.spell-emoji-box {
  font-size: 5rem;
  width: 110px;
  height: 110px;
  background: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 3px solid var(--color-primary);
}

.spelling-blanks {
  display: flex;
  gap: 10px;
  margin-bottom: 35px;
  justify-content: center;
  flex-wrap: wrap;
}

.blank-box {
  width: 50px;
  height: 50px;
  border: 3px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-kids);
  font-size: 1.8rem;
  color: var(--color-primary);
  font-weight: bold;
  background: #f8fafc;
  text-transform: uppercase;
  transition: var(--transition-bounce);
}

.blank-box.filled {
  border-style: solid;
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 4px 0 var(--bg-secondary);
}

.blank-box.correct {
  border-style: solid;
  border-color: var(--color-success) !important;
  color: var(--color-success) !important;
  background: #f0fdf4 !important;
  box-shadow: 0 4px 0 #dcfce7 !important;
}

.blank-box.incorrect {
  border-style: solid;
  border-color: var(--color-error) !important;
  color: var(--color-error) !important;
  background: #fef2f2 !important;
  box-shadow: 0 4px 0 #fee2e2 !important;
  cursor: pointer;
  animation: shakeRed 0.4s ease;
}

.spelling-letters {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 500px;
}

.letter-bubble {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: white;
  border: 3px solid #e2e8f0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-kids);
  font-size: 1.6rem;
  color: var(--color-text-main);
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 0 #e2e8f0;
  transition: var(--transition-bounce);
}

.letter-bubble:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent);
  box-shadow: 0 7px 0 var(--color-accent);
}

.letter-bubble:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #cbd5e1;
}

.letter-bubble.used {
  opacity: 0.3;
  pointer-events: none;
  transform: translateY(2px);
  box-shadow: none;
}

.letter-bubble.incorrect {
  background: #fef2f2;
  border-color: var(--color-error);
  box-shadow: 0 4px 0 #ef4444;
  color: var(--color-error);
  animation: shakeRed 0.4s ease;
}

.spelling-controls {
  display: flex;
  gap: 15px;
}

.btn-secondary {
  background: #cbd5e1;
  color: #334155;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-family: var(--font-kids);
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #94a3b8;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: #94a3b8;
}

.btn-secondary.hint {
  background: #fde047;
  color: #854d0e;
  box-shadow: 0 4px 0 #eab308;
}

.btn-secondary.hint:hover {
  background: #facc15;
}

/* GAME 3: MEMORY MATCH */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.memory-card-wrapper {
  aspect-ratio: 1;
  perspective: 1000px;
  cursor: pointer;
}

.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

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

.memory-card-front, .memory-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-md);
  border: 3px solid white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-md);
}

/* Face Back (Default visible card back) */
.memory-card-back {
  background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
  color: white;
  font-size: 2rem;
  border-color: #818cf8;
}

/* Face Front (Flipped state revealing details) */
.memory-card-front {
  background: white;
  transform: rotateY(180deg);
  padding: 8px;
}

.memory-card-wrapper.matched .memory-card-front {
  border-color: var(--color-success);
  background: #f0fdf4;
}

.memory-card-wrapper.matched {
  pointer-events: none;
  animation: pulseGreen 0.5s ease;
}

@keyframes pulseGreen {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.memory-emoji {
  font-size: 2.8rem;
}

.memory-word {
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 4px;
  color: var(--color-primary);
  text-align: center;
  word-break: break-word;
}

.memory-stats {
  background: #eef2f6;
  padding: 6px 15px;
  border-radius: 50px;
  font-weight: bold;
  font-size: 0.9rem;
}

/* OVERLAY WIN POPUP */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.overlay.active {
  display: flex;
}

.success-card {
  background: white;
  width: 90%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 4px solid var(--color-accent);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-trophy {
  font-size: 5rem;
  display: inline-block;
  animation: bounceMini 2s infinite ease-in-out;
}

.success-card h2 {
  font-family: var(--font-kids);
  font-size: 2rem;
  color: #854d0e;
  margin: 15px 0 10px;
}

.success-card p {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 25px;
}

.success-stars {
  font-size: 2.2rem;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
}

.success-stars span {
  animation: starPulse 1s infinite alternate;
}

.success-stars span:nth-child(2) {
  animation-delay: 0.2s;
}

.success-stars span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes starPulse {
  from { transform: scale(1); }
  to { transform: scale(1.3); filter: drop-shadow(0 0 8px #fde047); }
}

/* APP FOOTER */
.app-footer {
  text-align: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-top: 1px solid #f1f5f9;
}

/* GROUP FILTER TABS */
.group-tabs {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 10px 0 25px 0;
  flex-wrap: wrap;
}

.tab-btn {
  font-family: var(--font-kids);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 10px 22px;
  border: 3px solid #cbd5e1;
  border-radius: 50px;
  background: white;
  color: var(--color-text-main);
  cursor: pointer;
  box-shadow: 0 4px 0 #cbd5e1;
  transition: var(--transition-bounce);
  outline: none;
}

.tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #cbd5e1;
}

.tab-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #cbd5e1;
}

.tab-btn.active {
  color: white;
}

/* Distinct color active states */
#tab-btn-A.active {
  background: #f43f5e;
  border-color: #f43f5e;
  box-shadow: 0 4px 0 #be123c;
}

#tab-btn-B.active {
  background: #eab308;
  border-color: #eab308;
  box-shadow: 0 4px 0 #a16207;
}

#tab-btn-C.active {
  background: #10b981;
  border-color: #10b981;
  box-shadow: 0 4px 0 #047857;
}

#tab-btn-D.active {
  background: #3b82f6;
  border-color: #3b82f6;
  box-shadow: 0 4px 0 #1d4ed8;
}

/* Group Placeholder Screen */
.group-placeholder {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 30px;
  text-align: center;
  background: white;
  border-radius: var(--radius-lg);
  border: 3px dashed #cbd5e1;
  color: var(--color-text-muted);
  width: 100%;
}

.group-placeholder-emoji {
  font-size: 4rem;
  margin-bottom: 15px;
  animation: wobble 3s infinite ease-in-out;
  display: inline-block;
}

.group-placeholder h3 {
  font-family: var(--font-kids);
  font-size: 1.6rem;
  color: var(--color-text-main);
  margin-bottom: 10px;
}

.group-placeholder p {
  font-size: 1rem;
  max-width: 450px;
  line-height: 1.6;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .app-container {
    margin: 5px;
    border-radius: var(--radius-md);
  }
  
  .app-header {
    padding: 10px 15px;
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  
  .learn-container {
    flex-direction: column;
  }
  
  .words-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 3px dashed var(--bg-secondary);
    padding-bottom: 12px;
    max-height: none;
  }
  
  .sidebar-item {
    white-space: nowrap;
    padding: 8px 12px;
  }
  
  .menu-grid {
    grid-template-columns: 1fr;
  }
  
  .options-grid {
    grid-template-columns: 1fr;
  }
  
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================
   GLOBAL AUDIO BAR & USER PROFILE STYLES
   ========================================== */

.global-audio-bar {
  display: flex;
  justify-content: center;
  margin-top: 15px;
  margin-bottom: 5px;
  width: 100%;
}

.user-profile-wrapper {
  position: relative;
  display: inline-block;
}

.user-profile-outer {
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-radius: 50px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  background: transparent;
  cursor: pointer;
  transition: var(--transition-bounce);
}

.user-profile-outer:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.user-profile-inner {
  background: var(--color-secondary); /* pink theme */
  border-radius: 50px;
  padding: 5px 14px;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Logout dropdown styling */
.logout-menu {
  position: absolute;
  top: 115%;
  right: 0;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 2.5px solid #e2e8f0;
  padding: 8px;
  display: none;
  z-index: 1000;
  min-width: 130px;
  transform-origin: top right;
  animation: slideDown 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logout-menu.active {
  display: block;
}

.logout-menu button {
  width: 100%;
  padding: 8px 12px;
  background: var(--color-error);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-sm);
}

.logout-menu button:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==========================================
   BALLOON POP GAME STYLES
   ========================================== */

.balloon-game {
  position: relative;
  overflow: hidden;
  min-height: 480px;
  background: linear-gradient(to top, #bae6fd 0%, #e0f2fe 100%);
  border-radius: var(--radius-lg);
  border: 3px solid #bae6fd;
  box-shadow: inset 0 4px 15px rgba(0,0,0,0.05);
}

.balloon-sky {
  position: relative;
  width: 100%;
  height: 380px;
  overflow: hidden;
  margin-top: 15px;
  background: transparent;
  border-radius: var(--radius-md);
}

/* Balloon Element */
.balloon {
  position: absolute;
  bottom: -110px; /* start below container */
  width: 85px;
  height: 105px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: inset -6px -12px 18px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.1);
  animation: floatUp 6s linear infinite;
  transition: transform 0.1s ease;
  user-select: none;
}

/* Balloon String/Basket */
.balloon::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 2px;
  height: 14px;
  background: rgba(0,0,0,0.25);
  left: 50%;
  transform: translateX(-50%);
}

/* Balloon knot */
.balloon::before {
  content: "";
  position: absolute;
  bottom: -4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid rgba(0,0,0,0.15);
  left: 50%;
  transform: translateX(-50%);
}

.balloon-emoji {
  font-size: 2.3rem;
  pointer-events: none;
}

/* Balloon color variations */
.balloon.b-red { background: #f87171; border: 2px solid #ef4444; }
.balloon.b-blue { background: #60a5fa; border: 2px solid #3b82f6; }
.balloon.b-green { background: #4ade80; border: 2px solid #22c55e; }
.balloon.b-yellow { background: #fbbf24; border: 2px solid #f59e0b; }
.balloon.b-purple { background: #c084fc; border: 2px solid #a855f7; }

/* Float Up Animation */
@keyframes floatUp {
  0% {
    bottom: -110px;
    transform: translateX(0) rotate(0deg);
  }
  25% {
    transform: translateX(12px) rotate(3deg);
  }
  50% {
    transform: translateX(-12px) rotate(-3deg);
  }
  75% {
    transform: translateX(8px) rotate(2deg);
  }
  100% {
    bottom: 105%;
    transform: translateX(0) rotate(0deg);
  }
}

/* Pop animation class */
.balloon.popped {
  animation: none;
  transform: scale(1.8);
  opacity: 0;
  transition: all 0.15s ease-out;
  pointer-events: none;
}

.game-sound-trigger {
  position: relative;
  z-index: 10;
}

/* Balloon Success Popup */
.balloon-success-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 4px solid var(--color-success);
  border-radius: var(--radius-lg);
  padding: 20px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 12px 0 var(--bg-secondary);
  z-index: 200;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.popup-congrats {
  font-family: var(--font-kids);
  font-size: 1.1rem;
  color: var(--color-accent);
  display: block;
  margin-bottom: 5px;
}

.popup-word {
  font-family: var(--font-kids);
  font-size: 3.2rem;
  color: var(--color-success);
  text-transform: uppercase;
  margin: 5px 0;
  letter-spacing: 2px;
}

.popup-vi {
  font-family: var(--font-text);
  font-size: 1.3rem;
  color: var(--color-text-main);
  font-weight: 700;
}

@keyframes popIn {
  from {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* GAME 5: WHACK-A-MOLE */
.whack-game {
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
}

.whack-field {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px 20px;
  width: 100%;
  padding: 20px;
  margin-top: 20px;
  background: #f0fdf4;
  border-radius: var(--radius-lg);
  border: 3px dashed var(--color-success);
}

.hole {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #78350f;
  border-radius: 50% / 30%;
  border: 4px solid #451a03;
  overflow: hidden;
  box-shadow: inset 0 10px 0 rgba(0,0,0,0.4);
  cursor: pointer;
}

.mole {
  position: absolute;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 85%;
  background: #d97706;
  border: 3px solid #78350f;
  border-radius: 50% 50% 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: bottom 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mole-emoji {
  font-size: 2.8rem;
  user-select: none;
  animation: floatSmall 2s infinite ease-in-out;
}

.hole.up .mole {
  bottom: 0px;
}

.dirt {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20%;
  background: #451a03;
  border-radius: 50% 50% 0 0;
  pointer-events: none;
  z-index: 2;
}

.hole.whacked .mole {
  animation: whackShake 0.15s ease-in-out 2;
  background: #ef4444 !important;
}

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

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

.whack-success-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 4px solid var(--color-success);
  border-radius: var(--radius-lg);
  padding: 20px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 12px 0 var(--bg-secondary);
  z-index: 200;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}



