/* ===================================
   LinguaPlay - Global Styles
   =================================== */

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

:root {
  /* Primary Colors */
  --primary-blue: #4a90e2;
  --primary-purple: #9b59b6;
  --primary-green: #2ecc71;
  --primary-orange: #e67e22;
  --primary-pink: #e91e63;

  /* Language Colors */
  --english-color: #3498db;
  --arabic-color: #16a085;
  --french-color: #2980b9;
  --spanish-color: #e74c3c;
  --italian-color: #27ae60;
  --chinese-color: #c0392b;
  --russian-color: #8e44ad;

  /* Neutral Colors */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --border-color: #e0e0e0;

  /* Status Colors */
  --success-color: #27ae60;
  --error-color: #e74c3c;
  --warning-color: #f39c12;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* ===================================
   Screen Management
   =================================== */

.screen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-primary);
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

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

/* ===================================
   Header Styles
   =================================== */

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.game-title {
  font-size: 2rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.tagline {
  font-size: 1rem;
  opacity: 0.9;
  margin-top: 5px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-5px);
}

/* ===================================
   Home Screen
   =================================== */

.player-info {
  background: white;
  margin: 20px;
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.player-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-purple);
  margin-bottom: 15px;
}

.icon-btn {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
  transform: scale(1.1);
}

.overall-progress {
  margin-top: 15px;
}

.progress-label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.progress-bar-container {
  background: var(--bg-primary);
  height: 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-green), var(--primary-blue));
  border-radius: var(--radius-lg);
  transition: width var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-stats {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===================================
   Language Selection
   =================================== */

.language-selection {
  padding: 20px;
}

.language-selection h2 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  max-width: 800px;
  margin: 0 auto;
}

.language-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

.language-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--card-color, var(--primary-blue));
}

.language-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--card-color, var(--primary-blue));
}

.language-flag {
  font-size: 4rem;
  margin-bottom: 10px;
  display: block;
  animation: bounce 1s ease infinite;
}

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

.language-card:hover .language-flag {
  animation: spin 0.6s ease;
}

@keyframes spin {
  from {
    transform: rotate(0deg) scale(1);
  }
  to {
    transform: rotate(360deg) scale(1.2);
  }
}

.language-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.language-native {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.language-progress-mini {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.mini-progress-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  flex: 1;
  margin: 0 8px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  background: var(--card-color, var(--primary-blue));
  border-radius: 3px;
  transition: width var(--transition-slow);
}

.language-level-badge {
  display: inline-block;
  background: var(--card-color, var(--primary-blue));
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: bold;
  margin-top: 8px;
}

/* ===================================
   Bottom Navigation
   =================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-around;
  padding: 10px;
  z-index: 1000;
}

.nav-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 20px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-radius: var(--radius-md);
}

.nav-btn:hover {
  background: var(--bg-primary);
  transform: scale(1.05);
}

.nav-btn .icon {
  font-size: 1.5rem;
}

.nav-btn span:last-child {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===================================
   Language World Screen
   =================================== */

.language-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

#language-level {
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 12px;
  border-radius: var(--radius-md);
  font-weight: bold;
}

.stars {
  display: flex;
  gap: 3px;
}

.character-section {
  background: white;
  margin: 20px;
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.character {
  font-size: 8rem;
  cursor: pointer;
  transition: var(--transition-normal);
  display: inline-block;
  margin-bottom: 20px;
  animation: breathe 3.5s ease-in-out infinite;
  --audio-level: 0;
}

.character:hover {
  transform: scale(1.1) rotate(5deg);
}

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

.character.speaking {
  animation: speak-bounce 0.8s ease-in-out infinite;
  transform: scale(calc(1 + var(--audio-level, 0)));
}

@keyframes breathe {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes speak-bounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.character-speech {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 15px 20px;
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}

.character-speech::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--bg-primary);
}

#speech-text {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-style: italic;
}

/* ===================================
   Mode Selection
   =================================== */

.mode-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.mode-btn {
  background: white;
  border: 3px solid transparent;
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mode-btn:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.explore-mode {
  border-color: var(--primary-blue);
}
.explore-mode:hover {
  background: rgba(74, 144, 226, 0.1);
}

.learn-mode {
  border-color: var(--primary-green);
}
.learn-mode:hover {
  background: rgba(46, 204, 113, 0.1);
}

.quiz-mode {
  border-color: var(--primary-orange);
}
.quiz-mode:hover {
  background: rgba(230, 126, 34, 0.1);
}

.mode-icon {
  font-size: 3rem;
}

.mode-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text-primary);
}

.mode-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ===================================
   Explore Mode
   =================================== */

.explore-stats {
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 15px;
  border-radius: var(--radius-md);
  font-weight: bold;
}

#download-category-voices {
  margin-left: auto;
}

.category-tabs {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 15px 20px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.category-tab {
  background: var(--bg-primary);
  border: 2px solid transparent;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  font-weight: 600;
}

.category-tab:hover {
  background: var(--primary-blue);
  color: white;
}

.category-tab.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-purple);
}

.explore-world {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  padding: 20px;
  min-height: 400px;
}

.explore-object {
  background: white;
  border-radius: var(--radius-lg);
  #word-display[dir="rtl"] .bubble {
    direction: rtl;
  }
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.explore-object:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.explore-object.discovered {
  background: linear-gradient(
    135deg,
    rgba(46, 204, 113, 0.1),
    rgba(52, 152, 219, 0.1)
  );
}

.explore-object.discovered::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--success-color);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.object-emoji {
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
}

.object-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===================================
   Word Display
   =================================== */

.word-display {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
  padding: 20px;
}

.word-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

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

.word-image {
  font-size: 6rem;
  text-align: center;
  margin-bottom: 20px;
}

.word-text {
  text-align: center;
  margin-bottom: 20px;
}

.word-native {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.word-transliteration {
  font-size: 1.3rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 5px;
}

.word-english {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.play-audio-btn {
  width: 100%;
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 15px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-fast);
  font-weight: bold;
}

.play-audio-btn:hover {
  background: var(--primary-purple);
  transform: scale(1.02);
}

/* ===================================
   Learn Mode
   =================================== */

.lesson-select {
  padding: 20px;
}

.lesson-select h3 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  max-width: 800px;
  margin: 0 auto;
}

.category-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
  border: 3px solid transparent;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-green);
}

.category-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.category-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.category-word-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.lesson-content {
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

.lesson-header {
  text-align: center;
  margin-bottom: 30px;
}

.lesson-header h3 {
  margin-bottom: 15px;
  color: var(--text-primary);
}

.lesson-progress-bar {
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.lesson-step {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.word-lesson-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-bottom: 20px;
}

.word-lesson-image {
  font-size: 6rem;
  margin-bottom: 20px;
}

.word-lesson-native {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.word-lesson-trans {
  font-size: 1.3rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 5px;
}

.word-lesson-eng {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.btn-primary {
  background: var(--primary-green);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
  font-weight: bold;
  margin: 5px;
}

.btn-primary:hover {
  background: var(--primary-blue);
  transform: scale(1.05);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  padding: 12px 30px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
  font-weight: bold;
  margin: 5px;
}

.btn-secondary:hover {
  background: white;
  border-color: var(--primary-blue);
  transform: scale(1.05);
}

.lesson-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.lesson-actions button {
  flex: 1;
}

.lesson-complete {
  text-align: center;
  background: white;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.celebration {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: celebrate 0.6s ease;
}

@keyframes celebrate {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3) rotate(10deg);
  }
}

.lesson-complete h3 {
  font-size: 1.8rem;
  color: var(--success-color);
  margin-bottom: 15px;
}

.lesson-complete p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.stars-earned {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 2rem;
  margin: 20px 0;
}

/* ===================================
   Quiz Mode
   =================================== */

.quiz-stats {
  display: flex;
  gap: 20px;
  align-items: center;
}

.quiz-stats .score,
.quiz-stats .timer {
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 15px;
  border-radius: var(--radius-md);
  font-weight: bold;
}

.quiz-type-select {
  padding: 20px;
}

.quiz-type-select h3 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.quiz-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  max-width: 800px;
  margin: 0 auto;
}

.quiz-type-btn {
  background: white;
  border: 3px solid var(--primary-orange);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.quiz-type-btn:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  background: rgba(230, 126, 34, 0.1);
}

.quiz-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 10px;
}

.quiz-type-btn span:nth-child(2) {
  display: block;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.quiz-type-btn p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.quiz-content {
  padding: 20px;
  max-width: 700px;
  margin: 0 auto;
}

.quiz-progress {
  text-align: center;
  margin-bottom: 30px;
}

.quiz-progress-bar {
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.quiz-progress p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.quiz-question {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.question-prompt {
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.question-audio-btn {
  display: block;
  margin: 20px auto;
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.question-audio-btn:hover {
  background: var(--primary-purple);
  transform: scale(1.05);
}

.question-image {
  font-size: 6rem;
  text-align: center;
  margin: 20px 0;
}

.answer-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.answer-option {
  background: var(--bg-primary);
  border: 3px solid transparent;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 1.1rem;
}

.answer-option:hover {
  background: white;
  border-color: var(--primary-blue);
  transform: scale(1.05);
}

.answer-option.selected {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-purple);
}

.answer-option.correct {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.answer-option.incorrect {
  background: var(--error-color);
  color: white;
  border-color: var(--error-color);
}

.answer-option-emoji {
  font-size: 3rem;
  display: block;
  margin-bottom: 10px;
}

.quiz-feedback {
  background: white;
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: slideUp 0.3s ease;
}

.quiz-feedback.correct {
  background: linear-gradient(
    135deg,
    rgba(46, 204, 113, 0.1),
    rgba(52, 152, 219, 0.1)
  );
}

.quiz-feedback.incorrect {
  background: linear-gradient(
    135deg,
    rgba(231, 76, 60, 0.1),
    rgba(230, 126, 34, 0.1)
  );
}

.feedback-icon {
  font-size: 4rem;
  margin-bottom: 15px;
}

.feedback-text {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 20px;
}

.quiz-results {
  padding: 40px 20px;
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.quiz-results .celebration {
  font-size: 6rem;
  margin-bottom: 20px;
}

#quiz-result-title {
  font-size: 2rem;
  margin-bottom: 20px;
}

.result-stats {
  background: white;
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.result-stats p {
  font-size: 1.2rem;
  margin: 10px 0;
  color: var(--text-primary);
}

/* ===================================
   Dashboard
   =================================== */

.dashboard-content {
  padding: 20px;
  padding-bottom: 80px;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-blue);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.language-breakdown,
.achievements {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.language-breakdown h3,
.achievements h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.language-detail-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 15px;
  border-left: 5px solid var(--card-color, var(--primary-blue));
}

.language-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.language-detail-name {
  font-size: 1.2rem;
  font-weight: bold;
}

.achievement-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.achievement-card.locked {
  opacity: 0.5;
}

.achievement-icon {
  font-size: 2.5rem;
}

.achievement-info {
  flex: 1;
}

.achievement-title {
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.achievement-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===================================
   Settings
   =================================== */

.settings-content {
  padding: 20px;
  padding-bottom: 80px;
  max-width: 600px;
  margin: 0 auto;
}

.settings-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.settings-section h3 {
  margin-bottom: 15px;
  color: var(--text-primary);
}

.setting-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-item label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.setting-item input[type="range"] {
  flex: 1;
  margin: 0 10px;
}

.setting-item select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: white;
  font-size: 1rem;
}

/* ===================================
   Loading Overlay
   =================================== */

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#loading-overlay p {
  color: white;
  margin-top: 20px;
  font-size: 1.2rem;
}

/* ===================================
   Responsive Design
   =================================== */

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

  .language-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mode-selection {
    grid-template-columns: 1fr;
  }

  .dashboard-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .word-card {
    padding: 20px;
  }

  .word-native {
    font-size: 2rem;
  }

  .character {
    font-size: 6rem;
  }
}

@media (max-width: 480px) {
  .language-grid {
    grid-template-columns: 1fr;
  }

  .explore-world {
    grid-template-columns: repeat(2, 1fr);
  }

  .answer-options {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   Utility Classes
   =================================== */

.hidden {
  display: none !important;
}

/* ===================================
     Word Modal: Circle of Friends (Clean UI)
     =================================== */
.avatar-circle {
  position: relative;
  width: min(380px, 85vw);
  height: min(380px, 85vw);
  margin: 12px auto 8px;
}

.avatar-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid var(--accent, var(--primary-blue));
  background: #fff;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast);
  animation: bob 4s ease-in-out infinite;
}
.avatar-node:hover {
  transform: translate(-50%, -50%) scale(1.04);
  box-shadow: var(--shadow-lg);
}
.avatar-node .avatar-face {
  display: inline-flex;
  gap: 6px;
  font-size: 1.6rem;
  align-items: center;
}
.avatar-node.speaking {
  animation: speakPulse 0.9s ease;
}

@keyframes speakPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.15);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(0, 0, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

/* Static-audio availability dots on avatars */
.avatar-node[data-static]::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.avatar-node[data-static="1"]::after {
  background: var(--success-color);
}
.avatar-node[data-static="0"]::after {
  background: var(--warning-color);
}

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

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
body.reduce-motion * {
  animation: none !important;
  transition: none !important;
}

.now-playing {
  text-align: center;
  margin-top: 8px;
  color: var(--text-secondary);
  font-weight: 700;
}

/* RTL tweak for modal caption */
#word-display[dir="rtl"] .now-playing {
  direction: rtl;
}

/* Focus ring for keyboard users */
.avatar-node:focus {
  outline: 3px solid var(--accent, var(--primary-blue));
  outline-offset: 2px;
  transform: translate(-50%, -50%) scale(1.03);
}

.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.text-center {
  text-align: center;
}

/* ===============================
   Dev Coverage Overlay and Toggle
   =============================== */
#coverage-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coverage-panel {
  width: min(720px, 92vw);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px;
}
.coverage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.coverage-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.coverage-panel textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  resize: vertical;
}
.coverage-status {
  color: var(--text-secondary);
}
#coverage-results {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  max-height: 50vh;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}
.coverage-session {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  max-height: 30vh;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  margin-top: 8px;
}
.coverage-toggle {
  position: fixed;
  right: 16px;
  bottom: 80px;
  z-index: 3500;
  background: #fff;
  border: 2px solid var(--primary-purple);
  color: var(--primary-purple);
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
/* Position the Dev Runner button above the Dev toggle */
.coverage-toggle.dev-runner {
  bottom: 120px;
}

/* Dev: floating audio counters chip */
.audio-counters {
  position: fixed;
  left: 16px;
  bottom: 80px;
  z-index: 3500;
  background: #111a;
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}

.mt-10 {
  margin-top: 10px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* ===================================
   Dialogue System - Two Kids Talking
   =================================== */

.dialogue-container {
  background: white;
  border-radius: var(--radius-xl);
  padding: 30px 20px;
  margin: 20px;
  box-shadow: var(--shadow-lg);
  min-height: 400px;
}

.dialogue-stage {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  margin-bottom: 30px;
  min-height: 200px;
}

.dialogue-character {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: var(--transition-normal);
  position: relative;
}

.dialogue-character.speaking {
  transform: scale(1.1);
  animation: bounce 0.5s ease infinite;
}

.character-avatar {
  position: relative;
  font-size: 5rem;
  margin-bottom: 10px;
  transition: var(--transition-fast);
}

.character-tshirt {
  position: absolute;
  bottom: 10px;
  right: 5px;
  font-size: 2rem;
  background: white;
  border-radius: 50%;
  padding: 3px;
  box-shadow: var(--shadow-sm);
}

.character-name {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-top: 10px;
}

.speech-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: white;
  border: 3px solid var(--primary-blue);
  border-radius: var(--radius-lg);
  padding: 15px 20px;
  min-width: 150px;
  max-width: 250px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-normal);
  z-index: 10;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 15px solid var(--primary-blue);
}

.dialogue-character.speaking .speech-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(-20px);
}

.speech-text {
  font-size: 1.1rem;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.4;
}

.speech-emotion {
  font-size: 2rem;
  display: block;
  margin-bottom: 5px;
}

.translation-display {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-top: 20px;
  border: 2px dashed var(--border-color);
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-slow);
}

.translation-display.show {
  opacity: 1;
  transform: translateY(0);
}

.transliteration {
  font-size: 1.3rem;
  color: var(--primary-purple);
  font-style: italic;
  margin-bottom: 5px;
}

.translation-english {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.dialogue-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.dialogue-btn {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialogue-btn:hover {
  background: var(--primary-purple);
  transform: scale(1.05);
}

.dialogue-btn:disabled {
  background: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.5;
}

.dialogue-btn .icon {
  font-size: 1.2rem;
}

/* Dialogue scenario cards */
.scenario-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  padding: 20px;
}

.scenario-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
  border: 3px solid transparent;
}

.scenario-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-blue);
}

.scenario-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.scenario-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.scenario-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.scenario-level {
  display: inline-block;
  background: var(--primary-green);
  color: white;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: bold;
  margin-top: 5px;
}

.scenario-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Story mode progress */
.story-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
}

.story-scene-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  transition: var(--transition-fast);
}

.story-scene-dot.active {
  background: var(--primary-blue);
  transform: scale(1.5);
}

.story-scene-dot.completed {
  background: var(--success-color);
}

/* Bilingual word display */
.bilingual-word-card {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1),
    rgba(118, 75, 162, 0.1)
  );
  border-radius: var(--radius-xl);
  padding: 30px;
  text-align: center;
  margin: 20px;
}

.word-native-large {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary-purple);
  margin-bottom: 10px;
}

.word-arrow {
  font-size: 2rem;
  color: var(--text-secondary);
  margin: 10px 0;
}

.word-english-large {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-blue);
  margin-top: 10px;
}

.bilingual-audio-btns {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.lang-audio-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 15px 20px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-audio-btn:hover {
  border-color: var(--primary-blue);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.lang-audio-btn .flag {
  font-size: 2rem;
  margin-bottom: 8px;
}

.lang-audio-btn .lang-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Responsive for dialogue */
@media (max-width: 768px) {
  .dialogue-stage {
    flex-direction: column;
    gap: 30px;
  }

  .character-avatar {
    font-size: 4rem;
  }

  .speech-bubble {
    max-width: 200px;
  }
}

/* ===================================
   NEW INTERFACE - English Word + Avatars
   =================================== */

.english-word-header {
  text-align: center;
  padding: 20px;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1),
    rgba(118, 75, 162, 0.1)
  );
  border-radius: var(--radius-lg);
  margin-bottom: 30px;
}

.word-emoji-large {
  font-size: 6rem;
  margin-bottom: 15px;
  animation: bounce 2s ease-in-out infinite;
}

.english-word-large {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary-blue);
  margin-bottom: 10px;
  text-transform: capitalize;
}

.word-instruction {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 10px;
}

.language-avatars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.language-avatar-card {
  background: white;
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.language-avatar-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.language-avatar-card.speaking {
  animation: pulse 0.5s ease-in-out 3;
  border-width: 4px;
}

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

.avatar-character {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
}

.avatar-emoji {
  font-size: 4rem;
  display: block;
}

.avatar-flag {
  position: absolute;
  bottom: -5px;
  right: -5px;
  font-size: 1.8rem;
  background: white;
  border-radius: 50%;
  padding: 3px;
  box-shadow: var(--shadow-md);
}

.avatar-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.avatar-word {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary-purple);
  margin-bottom: 5px;
  min-height: 30px;
}

.avatar-trans {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 10px;
  min-height: 20px;
}

.avatar-speak-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.avatar-speak-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.close-word-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--error-color);
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-word-btn:hover {
  background: #c0392b;
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .language-avatars {
    grid-template-columns: repeat(2, 1fr);
  }
  .english-word-large {
    font-size: 2.5rem;
  }
}
