/* ===== English Study - Cartoon Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #4F9CF7;
  --primary-light: #E3F2FD;
  --secondary: #FF6B9D;
  --accent-yellow: #FFD93D;
  --accent-green: #6BCB77;
  --accent-purple: #9B59B6;
  --accent-orange: #FF8C42;
  --bg: #F8FBFF;
  --card-bg: #FFFFFF;
  --text: #2D3748;
  --text-light: #718096;
  --text-lighter: #A0AEC0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(79, 156, 247, 0.08);
  --shadow-hover: 0 8px 30px rgba(79, 156, 247, 0.15);
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===== Layout ===== */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 80px;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, #4F9CF7 0%, #667eea 100%);
  padding: 20px 20px 24px;
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  border-radius: 0 0 24px 24px;
}
.header-top { display: flex; align-items: center; justify-content: space-between; }
.header-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.5px; }
.header-subtitle { font-size: 0.8rem; opacity: 0.85; margin-top: 2px; }
.header-back {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
}
.header-back:hover { background: rgba(255,255,255,0.35); }
.header-logo {
  display: flex; align-items: center; gap: 10px;
}
.header-logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.streak-badge {
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: white;
  border-top: 1px solid #EEF2F7;
  display: flex;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-lighter);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font);
  transition: color 0.2s;
}
.nav-item.active { color: var(--primary); }
.nav-item .nav-icon { font-size: 1.4rem; line-height: 1; }

/* ===== Page Content ===== */
.page-content { padding: 20px; }
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

/* ===== Daily Sentence Card ===== */
.daily-sentence {
  background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.daily-sentence::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: rgba(255, 152, 0, 0.1);
  border-radius: 50%;
}
.daily-sentence-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-orange);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.daily-sentence-en {
  font-size: 1.15rem;
  font-weight: 700;
  color: #E65100;
  margin-bottom: 6px;
}
.daily-sentence-cn {
  font-size: 0.85rem;
  color: #BF360C;
  opacity: 0.8;
}

/* ===== Scenario Cards ===== */
.section-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text);
}
.scenario-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
.scenario-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.scenario-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--primary);
}
.scenario-card:active { transform: translateY(-1px) scale(0.98); }
.scenario-emoji {
  font-size: 2.2rem;
  margin-bottom: 10px;
  display: block;
}
.scenario-title { font-size: 1rem; font-weight: 800; margin-bottom: 3px; }
.scenario-subtitle { font-size: 0.75rem; color: var(--text-light); font-weight: 600; }
.scenario-age {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
}
.scenario-card[data-color="blue"] { border-left: 4px solid var(--primary); }
.scenario-card[data-color="yellow"] { border-left: 4px solid var(--accent-yellow); }
.scenario-card[data-color="green"] { border-left: 4px solid var(--accent-green); }
.scenario-card[data-color="purple"] { border-left: 4px solid var(--accent-purple); }

/* ===== Lesson List ===== */
.lesson-list { display: flex; flex-direction: column; gap: 12px; }
.lesson-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}
.lesson-card:hover { box-shadow: var(--shadow-hover); border-color: var(--primary); }
.lesson-emoji {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}
.lesson-info { flex: 1; }
.lesson-title { font-size: 0.95rem; font-weight: 700; }
.lesson-title-en { font-size: 0.8rem; color: var(--text-light); font-weight: 500; }
.lesson-arrow { color: var(--text-lighter); font-size: 1.2rem; }

/* ===== Learn Page (Tabs) ===== */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: white;
  padding: 6px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.tab-btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 156, 247, 0.35);
}
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

/* ===== Flashcard ===== */
.flashcard-container { perspective: 1000px; margin-bottom: 20px; }
.flashcard {
  width: 100%;
  min-height: 220px;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  background: var(--card-bg);
  box-shadow: var(--shadow-hover);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.flashcard-front { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.flashcard-back { background: white; transform: rotateY(180deg); }
.flashcard-word { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.flashcard-phonetic { font-size: 0.9rem; opacity: 0.85; }
.flashcard-meaning { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.flashcard-example { font-size: 0.85rem; color: var(--text-light); font-style: italic; line-height: 1.5; }
.flashcard-hint { font-size: 0.75rem; opacity: 0.7; margin-top: 16px; }

.flashcard-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
}
.flashcard-nav-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  font-family: var(--font);
}
.flashcard-nav-btn:hover { background: var(--primary); color: white; }
.flashcard-counter { font-size: 0.9rem; font-weight: 700; color: var(--text-light); }

/* ===== Dialogue ===== */
.dialogue-header {
  background: linear-gradient(135deg, #4F9CF7 0%, #667eea 100%);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: white;
  margin-bottom: 16px;
}
.dialogue-title { font-size: 1.1rem; font-weight: 800; }
.dialogue-title-en { font-size: 0.85rem; opacity: 0.85; }

.dialogue-bubble {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-start;
}
.dialogue-bubble.right { flex-direction: row-reverse; }
.dialogue-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.dialogue-content { max-width: 75%; }
.dialogue-name { font-size: 0.72rem; font-weight: 700; color: var(--text-light); margin-bottom: 4px; }
.dialogue-text {
  background: white;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  color: var(--text);
}
.dialogue-text-cn {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 4px;
  padding: 0 4px;
}
.dialogue-bubble.right .dialogue-text {
  background: var(--primary-light);
}
.dialogue-bubble.right .dialogue-name { text-align: right; }

/* ===== Quiz ===== */
.quiz-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.quiz-dot {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #E2E8F0;
  transition: background 0.3s;
}
.quiz-dot.done { background: var(--accent-green); }
.quiz-dot.current { background: var(--primary); }
.quiz-dot.wrong { background: #FC8181; }

.quiz-question-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.quiz-q-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.quiz-question {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
}

.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.quiz-option {
  background: white;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  color: var(--text);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}
.quiz-option:hover:not(.disabled) { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.correct { border-color: var(--accent-green); background: #F0FFF4; }
.quiz-option.wrong { border-color: #FC8181; background: #FFF5F5; }
.quiz-option.disabled { cursor: default; opacity: 0.7; }
.quiz-option-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #F7FAFC;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, #4F9CF7 0%, #667eea 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(79, 156, 247, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79, 156, 247, 0.5); }
.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-block { width: 100%; }

/* ===== Result Screen ===== */
.result-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-hover);
}
.result-emoji { font-size: 4rem; margin-bottom: 16px; }
.result-score { font-size: 3rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.result-label { font-size: 1rem; color: var(--text-light); font-weight: 600; margin-bottom: 24px; }
.result-stars { font-size: 2rem; margin-bottom: 20px; letter-spacing: 4px; }
.result-buttons { display: flex; flex-direction: column; gap: 10px; }

/* ===== Progress Bar ===== */
.progress-bar {
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-green));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ===== Scenario Header ===== */
.scenario-hero {
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 20px;
  color: white;
  position: relative;
  overflow: hidden;
}
.scenario-hero::after {
  content: '';
  position: absolute;
  bottom: -30px; right: -30px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.scenario-hero-emoji { font-size: 2.5rem; margin-bottom: 10px; }
.scenario-hero-title { font-size: 1.4rem; font-weight: 800; }
.scenario-hero-subtitle { font-size: 0.85rem; opacity: 0.9; }
.scenario-hero-desc { font-size: 0.8rem; opacity: 0.85; margin-top: 8px; line-height: 1.5; }

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bounceIn {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade { animation: fadeIn 0.3s ease; }
.animate-bounce { animation: bounceIn 0.4s ease; }
.animate-slide { animation: slideUp 0.4s ease; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .app-container { max-width: 100%; }
}
@media (min-width: 768px) {
  .scenario-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 2px; }
