/* ========================== */
/*  CSS Variables / Theming    */
/* ========================== */
:root {
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f2f5;
  --text-primary: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8888a0;
  --border-color: #e2e4ea;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-bg: rgba(99,102,241,0.08);
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --sidebar-width: 260px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #242442;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6a6a88;
  --border-color: #2a2a48;
  --accent: #818cf8;
  --accent-light: #a5b4fc;
  --accent-bg: rgba(129,140,248,0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

/* ========================== */
/*  Base Reset                */
/* ========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }

/* ========================== */
/*  App Layout                */
/* ========================== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ========================== */
/*  Sidebar                   */
/* ========================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition), background var(--transition);
}

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

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

.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  list-style: none;
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.925rem;
  transition: all var(--transition);
}

.nav-link:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

.nav-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.nav-link svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--warning);
}
.streak-fire { font-size: 1.1rem; }
.streak-label { color: var(--text-muted); font-weight: 400; }

/* ========================== */
/*  Theme Toggle              */
/* ========================== */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.theme-toggle:hover {
  background: var(--accent-bg);
  color: var(--accent);
}
[data-theme="light"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }

/* ========================== */
/*  Mobile Header             */
/* ========================== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  padding: 0 16px;
  z-index: 90;
  gap: 12px;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 4px;
}

.mobile-title {
  font-weight: 700;
  font-size: 1.1rem;
  flex: 1;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ========================== */
/*  Content Area              */
/* ========================== */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 40px;
  max-width: 960px;
  transition: margin var(--transition);
}

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

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

.section-header { margin-bottom: 32px; }
.section-header h1 { font-size: 1.75rem; font-weight: 800; }
.subtitle { color: var(--text-secondary); margin-top: 4px; }

/* ========================== */
/*  Buttons                   */
/* ========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  transition: all var(--transition);
}

.btn-sm { padding: 6px 14px; font-size: 0.825rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: white;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { opacity: 0.9; }

.btn-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-mic {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
  box-shadow: 0 2px 10px rgba(239,68,68,0.3);
}
.btn-mic:hover { box-shadow: 0 4px 18px rgba(239,68,68,0.4); transform: translateY(-1px); }
.btn-mic.recording {
  animation: pulse-mic 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(239,68,68,0.5);
}

@keyframes pulse-mic {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  70% { box-shadow: 0 0 0 14px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* ========================== */
/*  Dashboard                 */
/* ========================== */
.daily-phrase-card {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: white;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.daily-phrase-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.daily-label { font-size: 0.85rem; opacity: 0.85; margin-bottom: 8px; font-weight: 500; }
.daily-phrase { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.daily-meaning { font-size: 0.95rem; opacity: 0.85; margin-bottom: 16px; }
.daily-phrase-card .btn-outline {
  border-color: rgba(255,255,255,0.4);
  color: white;
}
.daily-phrase-card .btn-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: white;
}

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

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { font-size: 2rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.quick-actions h2 { margin-bottom: 16px; font-size: 1.2rem; }
.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.action-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: left;
  transition: all var(--transition);
}
.action-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.action-icon { font-size: 2rem; margin-bottom: 12px; }
.action-card h3 { font-size: 1rem; margin-bottom: 4px; }
.action-card p { font-size: 0.825rem; color: var(--text-muted); }

/* ========================== */
/*  Conversation              */
/* ========================== */
.conversation-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.topic-selector { margin-bottom: 20px; }
.topic-selector h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text-secondary); }
.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.topic-chip {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.topic-chip:hover, .topic-chip.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: msgIn 0.3s ease;
}
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.ai { align-self: flex-start; }

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

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ai .msg-avatar { background: var(--accent-bg); }
.user .msg-avatar { background: var(--success-bg); }

.msg-bubble {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  line-height: 1.5;
}
.ai .msg-bubble {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top-left-radius: 4px;
}
.user .msg-bubble {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: white;
  border-top-right-radius: 4px;
}

.msg-correction {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  color: var(--warning);
  border-left: 3px solid var(--warning);
}

.msg-listen-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.msg-listen-btn:hover { color: var(--accent); }

.chat-input-area {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.voice-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
}
.voice-indicator.active { display: flex; }

.pulse-ring {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse-ring-anim 1.5s ease-in-out infinite;
}
.pulse-ring.delay { animation-delay: 0.3s; }

@keyframes pulse-ring-anim {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}

.chat-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-text-input {
  flex: 1;
  padding: 12px 18px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.925rem;
  outline: none;
  transition: border-color var(--transition);
}
.chat-text-input:focus { border-color: var(--accent); }
.chat-text-input::placeholder { color: var(--text-muted); }

/* ========================== */
/*  Pronunciation             */
/* ========================== */
.level-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.level-btn {
  padding: 8px 24px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition);
}
.level-btn:hover { border-color: var(--accent); }
.level-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pronunciation-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

.pron-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.pron-word-display { margin-bottom: 12px; }
.pron-word { font-size: 2.5rem; font-weight: 800; margin-bottom: 4px; }
.pron-phonetic { color: var(--text-muted); font-size: 1.1rem; font-style: italic; }
.pron-meaning { color: var(--text-secondary); margin-bottom: 32px; font-size: 1rem; }

.pron-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.pron-result {
  margin: 24px auto;
  padding: 20px;
  border-radius: var(--radius-md);
  max-width: 400px;
}
.pron-result.success { background: var(--success-bg); border: 1px solid var(--success); }
.pron-result.partial { background: var(--warning-bg); border: 1px solid var(--warning); }
.pron-result.error { background: var(--danger-bg); border: 1px solid var(--danger); }

.result-icon { font-size: 2rem; margin-bottom: 8px; }
.result-text { font-weight: 600; font-size: 1.1rem; margin-bottom: 4px; }
.result-details { font-size: 0.875rem; color: var(--text-secondary); }

.pron-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}

/* ========================== */
/*  Vocabulary                */
/* ========================== */
.vocab-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.vocab-category-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
}
.vocab-category-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.category-emoji { font-size: 2.5rem; margin-bottom: 12px; }
.category-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.category-count { font-size: 0.825rem; color: var(--text-muted); }
.category-progress-bar {
  margin-top: 12px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.category-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.back-btn { margin-bottom: 20px; }
.vocab-category-title { margin-bottom: 24px; font-size: 1.3rem; }

.flashcard-container {
  perspective: 1000px;
  margin: 0 auto 24px;
  max-width: 480px;
}

.flashcard {
  position: relative;
  width: 100%;
  height: 280px;
  cursor: pointer;
  transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
  transform-style: preserve-3d;
}
.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.flashcard-back { transform: rotateY(180deg); }

.fc-word { font-size: 2rem; font-weight: 800; margin-bottom: 4px; }
.fc-phonetic { color: var(--text-muted); font-style: italic; font-size: 1rem; margin-bottom: 4px; }
.fc-pos { color: var(--accent); font-weight: 600; font-size: 0.825rem; text-transform: uppercase; margin-bottom: 16px; }
.fc-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 16px; }
.fc-definition { font-size: 1.15rem; font-weight: 600; margin-bottom: 12px; text-align: center; }
.fc-example { color: var(--text-secondary); font-size: 0.925rem; font-style: italic; margin-bottom: 12px; text-align: center; }

.fc-listen {
  z-index: 2;
  position: relative;
}

.fc-progress { text-align: center; color: var(--text-muted); font-size: 0.875rem; margin-bottom: 16px; }

.fc-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ========================== */
/*  Quiz                      */
/* ========================== */
.quiz-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
}
.quiz-question {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 20px;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-option {
  padding: 14px 20px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  font-size: 0.925rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}
.quiz-option:hover { border-color: var(--accent); background: var(--accent-bg); }
.quiz-option.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); font-weight: 600; }
.quiz-option.wrong { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.quiz-option.disabled { pointer-events: none; }

.quiz-feedback {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
}
.quiz-feedback.correct { background: var(--success-bg); color: var(--success); }
.quiz-feedback.wrong { background: var(--danger-bg); color: var(--danger); }

.quiz-progress {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* ========================== */
/*  Grammar                   */
/* ========================== */
.grammar-lessons-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grammar-lesson-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
}
.grammar-lesson-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.lesson-icon { font-size: 2rem; margin-bottom: 12px; }
.lesson-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.lesson-desc { font-size: 0.825rem; color: var(--text-muted); margin-bottom: 12px; }
.lesson-difficulty {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.lesson-difficulty.easy { background: var(--success-bg); color: var(--success); }
.lesson-difficulty.medium { background: var(--warning-bg); color: var(--warning); }
.lesson-difficulty.hard { background: var(--danger-bg); color: var(--danger); }

.grammar-lesson-title { margin-bottom: 20px; font-size: 1.3rem; }

.grammar-explanation {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  line-height: 1.8;
  font-size: 0.95rem;
}
.grammar-explanation h3 { margin-bottom: 12px; }
.grammar-explanation .example {
  background: var(--accent-bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  border-left: 3px solid var(--accent);
  font-style: italic;
}
.grammar-explanation .rule {
  font-weight: 600;
  color: var(--accent);
}

.grammar-exercise {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
}

.exercise-progress {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.exercise-question {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.6;
}
.exercise-question .blank {
  display: inline-block;
  min-width: 100px;
  border-bottom: 2px dashed var(--accent);
  text-align: center;
  color: var(--accent);
  font-weight: 700;
}

.exercise-input-area {
  margin-bottom: 20px;
}

.exercise-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
}
.exercise-input:focus { border-color: var(--accent); }

.exercise-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.exercise-option {
  padding: 10px 20px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  font-size: 0.925rem;
  cursor: pointer;
  transition: all var(--transition);
}
.exercise-option:hover { border-color: var(--accent); background: var(--accent-bg); }
.exercise-option.selected { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.exercise-option.correct { border-color: var(--success); background: var(--success-bg); }
.exercise-option.wrong { border-color: var(--danger); background: var(--danger-bg); }

.exercise-feedback {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.exercise-feedback.correct { background: var(--success-bg); color: var(--success); }
.exercise-feedback.wrong { background: var(--danger-bg); color: var(--danger); }

/* ========================== */
/*  Toast                     */
/* ========================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }

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

/* ========================== */
/*  Typing Indicator          */
/* ========================== */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 4px;
}
.typing-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* ========================== */
/*  Responsive                */
/* ========================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }

  .mobile-header { display: flex; }

  .content {
    margin-left: 0;
    padding: 80px 20px 20px;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .action-cards { grid-template-columns: 1fr; }
  .grammar-lessons-list { grid-template-columns: 1fr; }

  .pronunciation-card { padding: 24px 16px; }
  .pron-word { font-size: 1.8rem; }
  .pron-actions { flex-direction: column; align-items: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .level-selector { flex-wrap: wrap; }
}
