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

:root {
  --bg: #0F172A;
  --surface: #1E293B;
  --card: #293548;
  --border: #334155;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --primary: #3B82F6;
  --primary-light: #60A5FA;
  --green: #10B981;
  --purple: #8B5CF6;
  --orange: #F59E0B;
  --red: #EF4444;
  --cyan: #06B6D4;
  --sidebar-width: 240px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

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

.logo-icon { font-size: 24px; }
.logo-text {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  padding: 12px 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary-light);
  font-weight: 600;
}

.nav-icon { font-size: 18px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.credits {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Main Content */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 40px;
  max-width: 1200px;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

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

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-icon.blue { background: rgba(59,130,246,0.15); }
.stat-icon.green { background: rgba(16,185,129,0.15); }
.stat-icon.purple { background: rgba(139,92,246,0.15); }
.stat-icon.orange { background: rgba(245,158,11,0.15); }

.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* Features */
.features-section { margin-bottom: 40px; }
.features-section h2 { font-size: 20px; margin-bottom: 16px; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  transition: transform 0.2s;
}

.feature-card:hover { transform: translateY(-2px); }
.feature-icon { font-size: 32px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; margin-bottom: 6px; font-weight: 600; }
.feature-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* CTA */
.cta-section {
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.1));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}

.cta-section h2 { margin-bottom: 8px; }
.cta-section p { color: var(--text-muted); margin-bottom: 16px; }

.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white;
  padding: 12px 28px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59,130,246,0.3);
}

/* Lessons */
.level-section { margin-bottom: 32px; }
.level-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}
.level-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white;
}
.level-header h3 { font-size: 16px; flex: 1; }
.level-count { font-size: 12px; color: var(--text-muted); }

.lessons-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.lesson-card:hover {
  border-color: var(--primary);
  background: rgba(59,130,246,0.05);
}
.lesson-card h4 { font-size: 14px; margin-bottom: 4px; }
.lesson-card p { font-size: 12px; color: var(--text-muted); }

/* Vocabulary */
.vocab-levels { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.vocab-tab {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.vocab-tab.active { background: var(--primary); border-color: var(--primary); color: white; }

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.vocab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.vocab-word { font-size: 18px; font-weight: 600; color: var(--primary-light); }
.vocab-phonetic { font-size: 12px; color: var(--text-muted); font-style: italic; }
.vocab-spanish { font-size: 14px; margin: 6px 0; color: var(--green); }
.vocab-example { font-size: 13px; color: var(--text-muted); font-style: italic; }

/* Games */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border-color: var(--primary);
}
.game-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 12px;
}
.game-card h3 { font-size: 14px; margin-bottom: 4px; }
.game-card p { font-size: 12px; color: var(--text-muted); }

/* Idioms */
.idioms-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.idiom-tab {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.idiom-tab.active { background: var(--purple); border-color: var(--purple); }

.idioms-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }

.idiom-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.idiom-expression { font-size: 16px; font-weight: 600; color: var(--purple); margin-bottom: 6px; }
.idiom-meaning { font-size: 14px; margin-bottom: 8px; }
.idiom-example { font-size: 13px; color: var(--text-muted); font-style: italic; margin-bottom: 6px; }
.idiom-usage { font-size: 12px; color: var(--orange); }

/* Pronunciation */
.pron-levels { display: flex; gap: 8px; margin-bottom: 20px; }
.pron-tab { padding: 8px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.pron-tab.active { background: var(--cyan); border-color: var(--cyan); }

.pron-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.pron-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.pron-symbol { font-size: 20px; font-weight: 700; color: var(--cyan); margin-bottom: 4px; }
.pron-examples { font-size: 14px; margin-bottom: 6px; }
.pron-tip { font-size: 12px; color: var(--text-muted); background: rgba(6,182,212,0.08); padding: 8px 10px; border-radius: 8px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
}


/* Lesson Detail */
.btn-back {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 20px;
  transition: all 0.2s;
}
.btn-back:hover { background: var(--card); border-color: var(--primary); }

.lesson-detail h2 { font-size: 24px; margin-bottom: 4px; }
.lesson-subtitle { color: var(--text-muted); margin-bottom: 24px; }

.lesson-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.section-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.section-icon.blue { background: rgba(59,130,246,0.15); }
.section-icon.red { background: rgba(239,68,68,0.15); }
.section-icon.orange { background: rgba(245,158,11,0.15); }
.section-icon.yellow { background: rgba(234,179,8,0.15); }
.section-icon.purple { background: rgba(139,92,246,0.15); }
.section-icon.green { background: rgba(16,185,129,0.15); }

.section-content {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.signal-words { display: flex; flex-wrap: wrap; gap: 6px; }
.signal-word {
  padding: 4px 10px;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 6px;
  font-size: 12px;
  color: #A78BFA;
}

.example-item {
  padding: 10px;
  background: rgba(16,185,129,0.05);
  border-radius: 8px;
  margin-bottom: 8px;
}
.example-en { font-size: 14px; font-weight: 500; margin-bottom: 2px; color: var(--text); }
.example-es { font-size: 12px; color: var(--text-muted); }


/* Games page centering */
#page-games .page-header { text-align: center; }
.game-play { max-width: 550px; margin: 0 auto; }
.game-progress { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.game-question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
}
.q-label { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.q-word { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.q-hint { font-size: 14px; color: var(--primary-light); }

.game-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.option-btn:hover { border-color: var(--primary); background: rgba(59,130,246,0.05); }
.option-btn.correct { border-color: var(--green); background: rgba(16,185,129,0.1); color: var(--green); }
.option-btn.incorrect { border-color: var(--red); background: rgba(239,68,68,0.1); color: var(--red); }
.option-btn:disabled { cursor: default; opacity: 0.8; }

.game-result { text-align: center; padding: 60px 20px; }
.game-result h2 { font-size: 28px; margin-bottom: 16px; }
.result-score { font-size: 48px; font-weight: 700; color: var(--primary); margin-bottom: 24px; }

/* Flashcards v2 */
.game-header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.game-title { font-size: 16px; font-weight: 600; }
.game-counter { font-size: 13px; color: var(--text-muted); }
.game-instruction { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.progress-bar { height: 6px; background: var(--surface); border-radius: 3px; margin-bottom: 16px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--purple)); border-radius: 3px; transition: width 0.4s ease; }

.flashcard-wrapper { display: flex; justify-content: center; margin-bottom: 24px; }

.flashcard-v2 {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  min-height: 260px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  user-select: none;
}
.flashcard-v2:hover { border-color: var(--primary); transform: scale(1.01); }
.flashcard-v2.flipped { border-color: var(--green); background: rgba(16,185,129,0.04); }

.fc-content { text-align: center; padding: 32px; }
.fc-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 16px; }
.fc-word { font-size: 42px; font-weight: 700; margin-bottom: 8px; }
.fc-hint { font-size: 15px; color: var(--primary-light); margin-bottom: 20px; }
.fc-tap { font-size: 12px; color: var(--text-muted); opacity: 0.6; }
.fc-word-answer { font-size: 48px; font-weight: 700; color: var(--green); margin-bottom: 8px; }
.fc-original { font-size: 14px; color: var(--text-muted); }
.fc-answer .fc-label { color: var(--green); }

.fc-buttons { display: flex; gap: 12px; justify-content: center; }
.fc-btn {
  padding: 14px 28px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.fc-btn-no:hover { border-color: var(--red); background: rgba(239,68,68,0.08); color: var(--red); }
.fc-btn-yes:hover { border-color: var(--green); background: rgba(16,185,129,0.08); color: var(--green); }

.result-emoji { font-size: 56px; margin-bottom: 12px; }
.result-label { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

/* Old flashcard styles removed */
.flashcard { display: none; }
.flash-front, .flash-back, .flash-actions { display: none; }

/* Fill blanks */
.fill-input { display: flex; gap: 10px; margin-bottom: 16px; }
.fill-input input {
  flex: 1; padding: 14px 16px;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 16px;
  outline: none;
}
.fill-input input:focus { border-color: var(--primary); }
.fb-correct { color: var(--green); font-size: 16px; font-weight: 600; text-align: center; }
.fb-incorrect { color: var(--red); font-size: 16px; text-align: center; }


/* Audio play button */
.pron-play-btn {
  background: rgba(6,182,212,0.15);
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
.pron-play-btn:hover {
  background: rgba(6,182,212,0.25);
  transform: scale(1.1);
}


/* Audio tracks section */
.audio-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}
.audio-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.audio-tab {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
.audio-tab.active { background: var(--cyan); border-color: var(--cyan); color: white; }

.audio-track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}
.audio-track:hover { background: rgba(6,182,212,0.05); }

.audio-play-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(6,182,212,0.15);
  border: 1px solid rgba(6,182,212,0.3);
  color: var(--cyan);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.audio-play-btn:hover { background: rgba(6,182,212,0.25); transform: scale(1.1); }

.audio-track-title { font-size: 13px; }
