/* ============= RESET & BASE ============= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ============= LUCIDE ICONS ============= */
.lui {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  stroke-width: 2;
}
.lui svg {
  width: 100%;
  height: 100%;
  display: block;
}
/* Default sizes by context */
i[data-lucide] { width: 18px; height: 18px; }
.lui.lui-sm { width: 14px; height: 14px; }
.lui.lui-md { width: 18px; height: 18px; }
.lui.lui-lg { width: 22px; height: 22px; }
.lui.lui-xl { width: 28px; height: 28px; }
.lui.lui-2xl { width: 36px; height: 36px; }

/* Color modifiers for mode icons */
.mi-yellow { color: var(--accent-yellow); }
.mi-blue { color: var(--accent-blue); }
.mi-red { color: var(--accent-red); }
.mi-purple { color: var(--accent-purple); }
.mi-cyan { color: var(--accent-cyan); }
.mi-pink { color: var(--accent-pink); }
.mi-orange { color: var(--accent-orange); }
.mi-green { color: var(--accent-green); }

/* Mode icon container */
.mode-icon {
  width: 36px !important;
  height: 36px !important;
  display: block !important;
  margin: 0 auto var(--s-3);
  filter: drop-shadow(0 6px 14px currentColor);
  opacity: 0.95;
  stroke-width: 1.75;
}
.mode-card { padding-top: var(--s-5); }
.mode-card .mode-icon svg { stroke-width: 1.75; }

/* DC card emoji slot */
.dc-card .dc-emoji .lui,
.continue-card .cc-emoji .lui {
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}
.dc-card .dc-arrow .lui { display: block; }

/* Grammar trail card icon */
.gt-emoji .lui { display: block; }
.gt-arrow .lui { display: block; }

/* Lesson card status icon */
.lesson-status .lui { display: block; }

/* Header settings button — fill the circle */
.header-settings-btn .lui { width: 16px; height: 16px; color: var(--text-secondary); }

/* Nav bar icons — replace fixed size */
.nav-btn .nav-icon { width: 22px !important; height: 22px !important; }
.nav-btn .nav-icon svg { stroke-width: 2; }
.nav-btn.active .nav-icon { color: var(--accent-blue); }

/* Card TTS button */
.card-tts-btn .lui { color: currentColor; }
.card-tts-btn:hover .lui { color: #fff; }

/* Stats card h3 inline icons */
.stats-card h3 { display: flex; align-items: center; gap: var(--s-2); }
.settings-section h3 { display: flex; align-items: center; gap: var(--s-2); }
.settings-section h3 .lui { color: var(--accent-blue); }

/* Buttons: icon + text alignment */
.action-btn, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}
.copy-btn { display: inline-flex; align-items: center; gap: 4px; }
.te-tts { display: inline-flex; align-items: center; gap: 4px; }
.te-tts .lui { display: inline-flex; }

/* Inline icons in prompts/labels */
.prompt-label { display: flex; align-items: center; gap: var(--s-1); }
.prompt-label .lui { color: var(--accent-orange); }

/* Error row icon */
.error-row .error-icon .lui,
.error-row .lui.error-icon { display: block; }

/* VSB tiles icons */
.vsb-tile .lui { display: inline-block; vertical-align: middle; margin-right: 2px; }

/* Trail dot check icon */
.trail-dot .lui { width: 14px; height: 14px; display: inline-flex; }

/* Daily dot icons */
.daily-dot .lui { display: inline-flex; }

/* GT badges */
.gt-badge { display: inline-flex; align-items: center; gap: 4px; }
.gt-badge .lui { display: inline-flex; }

/* Word popover save button */
.wp-save { display: flex; align-items: center; justify-content: center; gap: var(--s-2); }
.wp-tts .lui { color: currentColor; }

/* Page title icon */
.page-title { display: flex; align-items: center; gap: var(--s-2); }
.pt-icon {
  width: 26px !important;
  height: 26px !important;
  color: var(--accent-blue);
}

/* Stats card title icons */
.stats-card h3 .lui {
  width: 14px;
  height: 14px;
  color: var(--accent-blue);
}

/* Mode section title icons */
.mode-section-title .lui {
  width: 13px;
  height: 13px;
  color: var(--text-tertiary);
}

/* Stats / streak icon colors */
.stat-icon-xp { color: var(--accent-yellow); }
.stat-icon-streak { color: var(--accent-orange); }
.stat-icon { width: 18px !important; height: 18px !important; }

:root {
  /* === COLOR SYSTEM === */
  /* Surface layers (dark theme) */
  --bg-primary: #0a0c14;
  --bg-secondary: #131722;
  --bg-tertiary: #1c2130;
  --bg-quaternary: #2a3045;

  /* Text */
  --text-primary: #f2f5fb;
  --text-secondary: #a0a8be;
  --text-tertiary: #687085;

  /* Accent colors — refined */
  --accent-purple: #8b5cf6;
  --accent-blue: #6366f1;
  --accent-cyan: #22d3ee;
  --accent-orange: #fb923c;
  --accent-pink: #f472b6;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-yellow: #fbbf24;

  /* Gradients — more cohesive, softer */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --gradient-success: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --gradient-danger: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --gradient-cool: linear-gradient(135deg, #22d3ee 0%, #6366f1 100%);

  /* Glows / soft tints */
  --tint-primary: rgba(99, 102, 241, 0.12);
  --tint-success: rgba(52, 211, 153, 0.12);
  --tint-danger: rgba(248, 113, 113, 0.12);
  --tint-warning: rgba(251, 191, 36, 0.12);
  --glow-primary: 0 8px 24px rgba(99, 102, 241, 0.25);
  --glow-success: 0 8px 24px rgba(52, 211, 153, 0.2);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 3px rgba(0, 0, 0, 0.2);

  /* === SPACING (4px scale) === */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;

  /* === RADII === */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* === ANIMATION === */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* === SAFE AREA === */
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(99, 102, 241, 0.1), transparent 50%),
    radial-gradient(ellipse 50% 35% at 85% 25%, rgba(139, 92, 246, 0.08), transparent 50%),
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(34, 211, 238, 0.05), transparent 60%),
    var(--bg-primary);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============= APP SHELL ============= */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding-top: calc(var(--safe-top) + var(--s-3));
  padding-bottom: calc(var(--safe-bottom) + 88px);
}

/* ============= HEADER ============= */
.app-header {
  padding: var(--s-3) var(--s-4) 0;
  margin-bottom: var(--s-4);
  position: sticky;
  top: var(--safe-top);
  z-index: 50;
  backdrop-filter: saturate(140%) blur(20px);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
}
.header-content {
  background: rgba(28, 33, 48, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--shadow-md);
}
.header-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
}
.stat-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-icon { font-size: 18px; }
.level-badge {
  background: var(--gradient-gold);
  padding: 4px var(--s-3);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #1a1208;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

/* ============= MAIN CONTENT ============= */
main { padding: 0 var(--s-4); flex: 1; }
.tab-content { display: none; animation: fadeIn 0.3s var(--ease-out); }
.tab-content.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: var(--s-1);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--s-6);
  line-height: 1.5;
}

/* ============= CARDS ============= */
.stats-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-4);
  margin-bottom: var(--s-3);
  box-shadow: var(--shadow-card);
}
.stats-card h3 {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--s-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* ============= LESSON LIST ============= */
.lesson-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.lesson-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-md);
  padding: var(--s-4);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  position: relative;
  overflow: hidden;
}
.lesson-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.02) 50%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.lesson-card:hover::before { opacity: 1; }
.lesson-card:active { transform: scale(0.985); }
.lesson-card.mastered { border-color: rgba(52, 211, 153, 0.4); background: linear-gradient(135deg, var(--bg-secondary), rgba(52, 211, 153, 0.03)); }
.lesson-card.reviewed { border-color: rgba(251, 146, 60, 0.4); }
.lesson-number {
  background: var(--gradient-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  box-shadow: var(--glow-primary);
}
.lesson-card.mastered .lesson-number { background: var(--gradient-success); box-shadow: var(--glow-success); }
.lesson-info { flex: 1; min-width: 0; }
.lesson-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.lesson-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.lesson-status { font-size: 20px; flex-shrink: 0; }

.lesson-mastery-bar {
  height: 3px;
  background: var(--bg-quaternary);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 6px;
}
.lmb-fill {
  height: 100%;
  background: var(--gradient-success);
  border-radius: var(--r-pill);
  transition: width 0.5s var(--ease-out);
}

/* ============= MODE GRID (Flashcards) ============= */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.mode-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-3);
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-align: center;
  color: var(--text-primary);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.mode-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, transparent, rgba(99, 102, 241, 0.3), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.mode-card:hover::after,
.mode-card:active::after { opacity: 1; }
.mode-card:active { transform: scale(0.97); }
.mode-emoji {
  font-size: 32px;
  display: block;
  margin-bottom: var(--s-2);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}
.mode-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; letter-spacing: -0.01em; }
.mode-sub { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }

/* ============= BUTTONS ============= */
.action-btn {
  width: 100%;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  padding: var(--s-4);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-top: var(--s-2);
  letter-spacing: -0.005em;
  box-shadow: var(--glow-primary);
  transition: transform 0.12s var(--ease-out), box-shadow 0.2s, filter 0.2s;
  position: relative;
  overflow: hidden;
}
.action-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), transparent 60%);
  pointer-events: none;
}
.action-btn:hover { filter: brightness(1.08); }
.action-btn:active { transform: scale(0.98); box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2); }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: var(--s-2);
  transition: transform 0.12s, background 0.2s, border-color 0.2s;
}
.btn-secondary:hover { background: var(--bg-quaternary); border-color: rgba(255, 255, 255, 0.1); }
.btn-secondary:active { transform: scale(0.97); }

.btn-danger {
  background: var(--tint-danger);
  color: var(--accent-red);
  border: 1px solid rgba(248, 113, 113, 0.25);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s, background 0.2s;
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.18); }
.btn-danger:active { transform: scale(0.97); }

/* ============= WRITING ============= */
.prompt-card {
  background: linear-gradient(135deg, var(--bg-secondary), rgba(251, 146, 60, 0.04));
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  border-left: 3px solid var(--accent-orange);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.prompt-label {
  font-size: 10px;
  color: var(--accent-orange);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--s-1);
}
.prompt-text {
  font-size: 14px;
  margin-bottom: var(--s-2);
  line-height: 1.5;
}
#writing-area {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  padding: var(--s-4);
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
#writing-area:focus {
  border-color: var(--accent-blue);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 4px var(--tint-primary);
}
.writing-stats {
  display: flex;
  justify-content: space-between;
  margin-top: var(--s-2);
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.diagnosis-output {
  background: rgba(76, 217, 100, 0.05);
  border-left: 3px solid var(--accent-green);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  font-family: 'SF Mono', Monaco, monospace;
  white-space: pre-wrap;
  position: relative;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}

/* ============= GRAMMAR ERRORS ============= */
.error-priorities {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.error-row {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.error-icon { font-size: 18px; flex-shrink: 0; }
.error-name { flex: 1; font-size: 13px; font-weight: 500; letter-spacing: -0.005em; }
.error-stats {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
.error-bar {
  width: 64px;
  height: 5px;
  background: var(--bg-quaternary);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.error-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.5s var(--ease-out);
}
.error-bar-fill.weak { background: var(--gradient-danger); }
.error-bar-fill.mid { background: linear-gradient(135deg, var(--accent-orange), var(--accent-yellow)); }
.error-bar-fill.strong { background: var(--gradient-success); }

/* ============= BACKLOG ============= */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.summary-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-md);
  padding: var(--s-4);
  text-align: center;
  transition: transform 0.2s var(--ease-out);
}
.summary-card:hover { transform: translateY(-2px); }
.summary-value {
  font-size: 26px;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.summary-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: var(--s-1);
  font-weight: 500;
}
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-2) 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.session-row:last-child { border-bottom: none; }
.session-date { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: var(--s-2); }
.session-mode { font-weight: 600; }
.session-score { color: var(--accent-green); font-weight: 700; font-variant-numeric: tabular-nums; }
.data-controls { display: flex; gap: var(--s-2); margin-top: var(--s-4); flex-wrap: wrap; }
.data-controls button { flex: 1; min-width: 100px; }

/* ============= BOTTOM NAVIGATION ============= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 12, 20, 0.78);
  backdrop-filter: saturate(160%) blur(24px);
  -webkit-backdrop-filter: saturate(160%) blur(24px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-around;
  padding: var(--s-2) var(--s-1);
  padding-bottom: calc(var(--s-2) + var(--safe-bottom));
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}
.nav-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: var(--s-2) var(--s-1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: inherit;
  transition: color 0.2s, transform 0.15s var(--ease-spring);
  flex: 1;
  position: relative;
}
.nav-btn::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 28px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 var(--r-pill) var(--r-pill);
  transition: transform 0.3s var(--ease-spring);
}
.nav-btn.active { color: var(--accent-blue); }
.nav-btn.active::before { transform: translateX(-50%) scaleX(1); }
.nav-btn.active .nav-icon { transform: scale(1.1); }
.nav-icon {
  font-size: 22px;
  transition: transform 0.25s var(--ease-spring);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: 0.2px; }

/* ============= GAME OVERLAY ============= */
.game-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 200;
  overflow-y: auto;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
  padding-top: calc(var(--safe-top) + 12px);
  padding-bottom: calc(var(--safe-bottom) + 12px);
}

/* GAME UI */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-4);
  font-size: 13px;
  gap: var(--s-3);
}
.back-btn {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
}
.back-btn:hover { background: var(--bg-tertiary); }
.back-btn:active { transform: scale(0.96); }
.game-progress {
  flex: 1;
  margin: 0;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.game-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  width: 0%;
  transition: width 0.45s var(--ease-out);
}
.game-lives {
  display: flex;
  gap: 3px;
}
.heart {
  font-size: 16px;
  transition: opacity 0.3s, filter 0.3s;
}
.heart.lost {
  opacity: 0.25;
  filter: grayscale(1);
}
.game-timer {
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
}
.game-timer.urgent {
  background: var(--accent-red);
  animation: pulse 0.5s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* FLASHCARD */
.flashcard-wrapper {
  perspective: 1200px;
  min-height: 320px;
  margin-bottom: var(--s-4);
}
.flashcard {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(99, 102, 241, 0.08), transparent 70%),
    var(--bg-secondary);
  border-radius: var(--r-xl);
  padding: var(--s-7) var(--s-5);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.55s var(--ease-out);
  transform-style: preserve-3d;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-lg);
}
.flashcard.at-risk {
  border-color: rgba(248, 113, 113, 0.4);
  box-shadow: 0 0 40px rgba(248, 113, 113, 0.2), var(--shadow-lg);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(248, 113, 113, 0.08), transparent 70%),
    var(--bg-secondary);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  backface-visibility: hidden;
  padding: var(--s-5);
}
.flashcard-back { transform: translate(-50%, -50%) rotateY(180deg); }
.card-word {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: var(--s-3);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.card-context {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--s-4);
  line-height: 1.5;
  padding: 0 var(--s-3);
}
.card-translation {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-orange);
  margin-bottom: var(--s-4);
  letter-spacing: -0.01em;
}
.card-level {
  display: inline-block;
  background: var(--gradient-primary);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 800;
  margin-top: var(--s-2);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.card-tap-hint {
  position: absolute;
  bottom: var(--s-4);
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.7;
}
.flashcard-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.flashcard-actions button {
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-wrong {
  background: rgba(255, 59, 48, 0.2);
  color: var(--accent-red);
  border: 2px solid var(--accent-red);
}
.btn-right {
  background: rgba(76, 217, 100, 0.2);
  color: var(--accent-green);
  border: 2px solid var(--accent-green);
}

/* QUESTION (grammar) */
.question-area {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-3);
}
.question-pill {
  display: inline-block;
  padding: 4px var(--s-3);
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 800;
  margin-bottom: var(--s-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--tint-danger);
  color: var(--accent-red);
}
.question-prompt {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--s-2);
  font-weight: 500;
}
.question-text {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: var(--s-4);
  line-height: 1.45;
  letter-spacing: -0.01em;
}
.options-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.option-btn {
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  font-family: inherit;
  font-weight: 500;
  transition: transform 0.12s, border-color 0.2s, background 0.2s;
}
.option-btn:hover { border-color: rgba(99, 102, 241, 0.4); background: var(--bg-quaternary); }
.option-btn:active { transform: scale(0.99); }
.option-btn.correct {
  background: var(--tint-success);
  border-color: var(--accent-green);
  color: var(--accent-green);
  font-weight: 600;
}
.option-btn.wrong {
  background: var(--tint-danger);
  border-color: var(--accent-red);
  color: var(--accent-red);
}
.option-btn:disabled { pointer-events: none; opacity: 0.55; }
.text-input-game {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  margin-bottom: var(--s-2);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.text-input-game:focus {
  border-color: var(--accent-blue);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 4px var(--tint-primary);
}
.text-input-game.correct {
  background: rgba(76, 217, 100, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
  font-weight: 600;
}
.text-input-game.partial {
  background: rgba(255, 167, 38, 0.15);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  font-weight: 600;
}
.text-input-game.wrong {
  background: rgba(255, 59, 48, 0.15);
  border-color: var(--accent-red);
  color: var(--accent-red);
  font-weight: 600;
}
.explanation-box {
  background: var(--tint-warning);
  border-left: 3px solid var(--accent-orange);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  margin-top: var(--s-3);
  font-size: 13px;
  color: #ffd1a3;
  display: none;
  line-height: 1.5;
  animation: fadeInUp 0.3s var(--ease-out);
}
.explanation-box.show { display: block; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* COMBO POPUP */
.combo-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 64px;
  font-weight: 900;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.6);
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  letter-spacing: -0.02em;
  filter: drop-shadow(0 4px 24px rgba(251, 191, 36, 0.4));
  transition: opacity 0.3s, transform 0.5s var(--ease-spring);
}
.combo-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-5);
  animation: fadeIn 0.2s var(--ease-out);
}
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-xl);
  padding: var(--s-5);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s var(--ease-spring);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-4);
}
.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.modal-close {
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: var(--bg-quaternary); color: var(--text-primary); }
.modal textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 2px solid var(--bg-quaternary);
  border-radius: 10px;
  padding: 12px;
  color: #fff;
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  min-height: 200px;
  margin-bottom: 12px;
  outline: none;
  resize: vertical;
}

/* STORY VIEW */
.story-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-3);
}
.story-text {
  font-size: 16px;
  line-height: 1.75;
  color: #e2e8f5;
  font-weight: 400;
}
.story-text b {
  color: var(--accent-orange);
  font-weight: 700;
  background: linear-gradient(180deg, transparent 55%, rgba(251, 146, 60, 0.18) 55%);
  padding: 0 2px;
}
.story-text u {
  color: var(--accent-cyan);
  text-decoration: underline dotted;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
}
.story-translation {
  background: rgba(34, 211, 238, 0.06);
  border-left: 3px solid var(--accent-cyan);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-3);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: #b8e8f0;
  font-style: italic;
  line-height: 1.6;
}
.vocab-list-card {
  background: var(--bg-tertiary);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-4);
}
.vocab-list-card h4 {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: var(--s-2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}
.vocab-row {
  display: flex;
  justify-content: space-between;
  padding: var(--s-1) 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.vocab-row:last-child { border-bottom: none; }
.vocab-row b { color: var(--accent-orange); font-weight: 600; }
.vocab-row span { color: var(--text-secondary); margin-left: var(--s-3); text-align: right; }

/* RESULT SCREEN */
.result-screen {
  text-align: center;
  padding: var(--s-7) var(--s-5);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(99, 102, 241, 0.1), transparent 70%),
    var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  animation: resultPop 0.5s var(--ease-spring);
}
@keyframes resultPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.result-emoji {
  font-size: 72px;
  margin-bottom: var(--s-3);
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
  animation: emojiBounce 0.6s var(--ease-spring) 0.1s both;
}
@keyframes emojiBounce {
  0% { transform: scale(0) rotate(-15deg); }
  60% { transform: scale(1.2) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
.result-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: var(--s-2);
  letter-spacing: -0.02em;
}
.result-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: var(--s-6); line-height: 1.5; }
.result-stats {
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin: var(--s-4) 0;
  text-align: left;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-2) 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.result-row:last-child { border-bottom: none; }
.result-row strong { font-variant-numeric: tabular-nums; font-weight: 700; }

/* MISC */
.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-5);
  color: var(--text-secondary);
}
.empty-emoji { font-size: 56px; margin-bottom: var(--s-3); opacity: 0.6; }
.empty-state-mini {
  text-align: center;
  padding: var(--s-4);
  color: var(--text-secondary);
  font-size: 13px;
}
.es-emoji { font-size: 32px; display: block; margin-bottom: var(--s-2); opacity: 0.5; }

@media (max-width: 360px) {
  .summary-value { font-size: 22px; }
  .mode-card { padding: var(--s-3) var(--s-2); }
  .mode-emoji { font-size: 28px; }
  .page-title { font-size: 24px; }
  .flashcard { padding: var(--s-5) var(--s-4); }
  .card-word { font-size: 26px; }
}

/* ============= GLOBAL POLISH ============= */
html { scroll-behavior: smooth; }

/* Better focus state for keyboard nav */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[onclick]:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Smooth scrolling within overlays */
.game-overlay,
.modal-content {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Disable text selection on UI chrome */
.nav-btn,
.back-btn,
.mode-card,
.sm2-btn,
.option-btn,
.daily-dot,
.trail-dot,
.match-tile,
.scramble-word {
  user-select: none;
  -webkit-user-select: none;
}

/* Number formatting */
.stat-value,
.summary-value,
.la-score,
.vs-pct {
  font-variant-numeric: tabular-nums;
}

/* Subtle scrollbar styling (Chromium/WebKit) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* Game overlay refinements */
.game-overlay {
  padding-top: calc(var(--safe-top) + var(--s-4));
  padding-bottom: calc(var(--safe-bottom) + var(--s-4));
}

/* ============= HEADER SETTINGS BUTTON ============= */
.header-settings-btn {
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 16px;
  font-size: 16px;
  cursor: pointer;
  margin-left: 8px;
  transition: transform 0.15s;
}
.header-settings-btn:active { transform: rotate(45deg); }

/* ============= MODE SECTION TITLE ============= */
.mode-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin: var(--s-5) 0 var(--s-2);
  padding-left: var(--s-1);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.mode-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent);
}
.mode-section-title:first-of-type { margin-top: 0; }

/* ============= FLASHCARD TTS BUTTON ============= */
.card-tts-btn {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 16px;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s var(--ease-spring), background 0.2s, box-shadow 0.2s;
}
.card-tts-btn:hover { background: var(--accent-blue); box-shadow: var(--glow-primary); }
.card-tts-btn:active { transform: scale(0.9); }

/* ============= SM-2 ANSWER BUTTONS ============= */
.flashcard-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: var(--s-2);
  margin-top: var(--s-4);
}
.sm2-btn {
  padding: var(--s-3) var(--s-1);
  border-radius: var(--r-md);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-size: 24px;
  cursor: pointer;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: transform 0.12s var(--ease-spring), background 0.2s, border-color 0.2s;
  line-height: 1.1;
}
.sm2-btn span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  margin-top: var(--s-1);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.sm2-btn:hover { transform: translateY(-2px); }
.sm2-btn:active { transform: scale(0.94); }
.sm2-again { border-color: rgba(248, 113, 113, 0.4); color: var(--accent-red); background: var(--tint-danger); }
.sm2-hard { border-color: rgba(251, 146, 60, 0.4); color: var(--accent-orange); background: rgba(251, 146, 60, 0.1); }
.sm2-good { border-color: rgba(99, 102, 241, 0.4); color: var(--accent-blue); background: var(--tint-primary); }
.sm2-easy { border-color: rgba(52, 211, 153, 0.4); color: var(--accent-green); background: var(--tint-success); }
.sm2-again:hover { background: rgba(248, 113, 113, 0.18); }
.sm2-hard:hover { background: rgba(251, 146, 60, 0.18); }
.sm2-good:hover { background: rgba(99, 102, 241, 0.18); }
.sm2-easy:hover { background: rgba(52, 211, 153, 0.18); }

/* ============= SCRAMBLE ============= */
.scramble-built {
  background: var(--bg-tertiary);
  border-radius: var(--r-md);
  padding: var(--s-4);
  min-height: 60px;
  font-size: 17px;
  margin-bottom: var(--s-4);
  border: 2px dashed rgba(255, 255, 255, 0.08);
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s;
}
.scramble-built:not(:empty) {
  border-color: var(--accent-blue);
  background: var(--tint-primary);
}
.scramble-words {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.scramble-word {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), filter 0.2s;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.scramble-word:hover { filter: brightness(1.1); }
.scramble-word:active { transform: scale(0.94); }

/* ============= MATCHING ============= */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-2);
}
.match-tile {
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  min-height: 84px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  padding: var(--s-2);
  text-align: center;
  font-weight: 500;
  transition: transform 0.25s var(--ease-spring), opacity 0.3s, background 0.2s, border-color 0.2s;
}
.match-tile:hover { border-color: rgba(99, 102, 241, 0.3); }
.match-tile.flipped {
  background: var(--gradient-primary);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  transform: scale(1.02);
}
.match-tile.matched {
  background: var(--tint-success);
  border-color: var(--accent-green);
  color: var(--accent-green);
  opacity: 0.6;
  transform: scale(0.97);
}
.match-side { font-size: 18px; }
.match-text { font-size: 12px; line-height: 1.25; font-weight: 600; }

/* ============= DICTATION / TTS BUTTONS ============= */
.big-tts-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  padding: var(--s-3) var(--s-6);
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s var(--ease-spring), filter 0.2s, box-shadow 0.2s;
  box-shadow: var(--glow-primary);
}
.big-tts-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.big-tts-btn:active { transform: scale(0.95); }

/* ============= PRONUNCIATION MIC ============= */
.mic-btn {
  background: var(--gradient-danger);
  color: #fff;
  border: none;
  padding: var(--s-5) var(--s-7);
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 20px rgba(248, 113, 113, 0.35);
  transition: transform 0.15s, filter 0.2s;
  letter-spacing: 0.3px;
}
.mic-btn:hover { filter: brightness(1.1); }
.mic-btn:active { transform: scale(0.96); }
.mic-btn.recording {
  animation: micPulse 1.2s infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(248, 113, 113, 0.4), 0 0 0 0 rgba(248, 113, 113, 0.6); }
  50% { box-shadow: 0 4px 32px rgba(248, 113, 113, 0.7), 0 0 0 12px rgba(248, 113, 113, 0); }
}

/* ============= HEATMAP ============= */
.heatmap-grid {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: var(--s-1);
}
.hm-week {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hm-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--bg-quaternary);
  display: inline-block;
  transition: transform 0.15s;
}
.hm-cell:hover { transform: scale(1.4); z-index: 2; position: relative; }
.hm-l0 { background: rgba(255, 255, 255, 0.04); }
.hm-l1 { background: rgba(52, 211, 153, 0.3); }
.hm-l2 { background: rgba(52, 211, 153, 0.55); }
.hm-l3 { background: rgba(52, 211, 153, 0.8); }
.hm-l4 { background: var(--accent-green); box-shadow: 0 0 8px rgba(52, 211, 153, 0.4); }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin-top: var(--s-3);
  font-size: 11px;
  color: var(--text-tertiary);
  justify-content: flex-end;
}

/* ============= ACHIEVEMENTS ============= */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
}
.ach-tile {
  background: var(--bg-tertiary);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-2);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: transform 0.15s var(--ease-spring), border-color 0.2s;
  position: relative;
}
.ach-tile.unlocked {
  border-color: rgba(251, 191, 36, 0.5);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(251, 191, 36, 0.04));
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.1);
}
.ach-tile.unlocked:hover { transform: translateY(-2px); }
.ach-tile.locked { opacity: 0.4; }
.ach-emoji {
  font-size: 26px;
  margin-bottom: var(--s-1);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}
.ach-name { font-size: 11px; font-weight: 700; line-height: 1.25; letter-spacing: -0.005em; }
.ach-desc { font-size: 9px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.3; }

@media (max-width: 380px) {
  .ach-grid { grid-template-columns: repeat(3, 1fr); }
}

.achievement-popup {
  position: fixed;
  top: calc(var(--safe-top) + 80px);
  left: 50%;
  transform: translate(-50%, -150%);
  background: var(--gradient-gold);
  color: #1a1208;
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-5);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  box-shadow: 0 12px 40px rgba(251, 191, 36, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  z-index: 1500;
  transition: transform 0.5s var(--ease-spring);
  max-width: 90%;
  font-weight: 600;
}
.achievement-popup.show { transform: translate(-50%, 0); }
.achievement-popup .ap-emoji {
  font-size: 36px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}
.achievement-popup .ap-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: 0.85;
  font-weight: 800;
}
.achievement-popup .ap-name { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.achievement-popup .ap-desc { font-size: 11px; opacity: 0.85; font-weight: 500; }

/* ============= LOCAL ANALYSIS ============= */
.local-analysis {
  font-family: inherit;
  font-size: 14px;
}
.la-header {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.la-score {
  font-size: 42px;
  font-weight: 900;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.la-score span { font-size: 18px; color: var(--text-tertiary); -webkit-text-fill-color: var(--text-tertiary); }
.la-meta { flex: 1; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.la-section {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin: var(--s-4) 0 var(--s-2);
}
.la-text {
  background: var(--bg-tertiary);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  line-height: 1.7;
  font-size: 14px;
  color: var(--text-primary);
}
.la-text mark {
  background: var(--tint-success);
  color: var(--accent-green);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}
.analysis-error {
  background: var(--tint-warning);
  border-left: 3px solid var(--accent-orange);
  border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-2);
}
.ae-head { font-weight: 700; color: var(--accent-orange); font-size: 13px; margin-bottom: var(--s-1); }
.ae-snippet {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: #ffd1a3;
  margin-bottom: var(--s-1);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}
.ae-msg { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.chip-warn {
  display: inline-block;
  background: var(--tint-danger);
  color: #ffa5a5;
  padding: 4px var(--s-3);
  border-radius: var(--r-pill);
  font-size: 12px;
  margin: 2px;
  font-weight: 600;
}
.chip-good {
  display: inline-block;
  background: var(--tint-success);
  color: var(--accent-green);
  padding: 4px var(--s-3);
  border-radius: var(--r-pill);
  font-size: 12px;
  margin: 2px;
  font-weight: 600;
}

/* ============= SETTINGS UI ============= */
.settings-section {
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.settings-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  gap: 12px;
  border-bottom: 1px solid var(--bg-quaternary);
}
.setting-row:last-child { border-bottom: none; }
.setting-row select, .setting-row input[type="range"] {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--bg-quaternary);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  max-width: 50%;
}
.setting-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-blue);
}

/* ============= LIGHT THEME ============= */
html[data-theme="light"] {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef1f6;
  --bg-quaternary: #d8dde6;
  --text-primary: #1a1f2e;
  --text-secondary: #5b6481;
  --text-tertiary: #8b94a8;
}
html[data-theme="light"] body { background: var(--bg-primary); color: var(--text-primary); }
html[data-theme="light"] .bottom-nav { background: rgba(255, 255, 255, 0.95); }
html[data-theme="light"] .game-overlay { background: var(--bg-primary); }
html[data-theme="light"] .la-text { color: var(--text-primary); }
html[data-theme="light"] .story-text { color: var(--text-primary); }

/* ============= READING MODE (tap-to-translate) ============= */
.story-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.story-card-head h2 { font-size: 18px; flex: 1; }
.reading-mode .story-word {
  display: inline-block;
  padding: 1px 1px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.reading-mode .story-word:active,
.reading-mode .story-word.tapped {
  background: var(--accent-blue);
  color: #fff;
}
.story-translation-wrap {
  margin-top: 12px;
  background: rgba(72, 187, 255, 0.05);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 8px;
  overflow: hidden;
}
.story-translation-wrap summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
}
.story-translation-wrap .story-translation {
  margin-top: 0;
  border-left: none;
  background: transparent;
}

/* ============= WORD POPOVER ============= */
.word-popover {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 400;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + var(--safe-bottom));
}
.word-popover.show { display: flex; animation: fadeIn 0.2s; }
.wp-content {
  background: var(--bg-secondary);
  border-radius: 18px;
  padding: 18px 18px 22px;
  width: 100%;
  max-width: 420px;
  position: relative;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.wp-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
}
.wp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding-right: 30px;
}
.wp-en { font-size: 20px; font-weight: 700; color: var(--accent-orange); }
.wp-tts {
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 17px;
  font-size: 14px;
  cursor: pointer;
}
.wp-pt { font-size: 15px; color: var(--text-primary); margin-bottom: 8px; }
.wp-context {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-bottom: 8px;
}
.wp-source { font-size: 11px; color: var(--text-tertiary); margin-bottom: 10px; }
.wp-save { width: 100%; margin-top: 4px; }

/* ============= ONBOARDING ============= */
.onboarding { display: flex; flex-direction: column; gap: var(--s-3); }
.ob-intro {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: var(--s-3);
  background: var(--bg-tertiary);
  border-radius: var(--r-md);
  margin-bottom: var(--s-2);
}
.ob-feature {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.ob-emoji { font-size: 28px; flex-shrink: 0; line-height: 1; }
.ob-feature strong { font-size: 14px; display: block; margin-bottom: 2px; }
.ob-feature p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.ob-tip {
  font-size: 12px;
  padding: var(--s-3) var(--s-4);
  background: var(--tint-primary);
  border-left: 3px solid var(--accent-blue);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  line-height: 1.5;
}

/* ============= CUSTOM SESSION CARD ============= */
.custom-session-wrap { margin-bottom: var(--s-3); }
.cs-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid rgba(34, 211, 238, 0.25);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.06), rgba(99, 102, 241, 0.04));
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s var(--ease-out), border-color 0.2s;
}
.cs-card:hover { border-color: rgba(34, 211, 238, 0.5); }
.cs-card:active { transform: scale(0.985); }
.cs-card-emoji { font-size: 28px; flex-shrink: 0; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25)); }
.cs-card-info { flex: 1; min-width: 0; }
.cs-card-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.cs-card-sub { font-size: 12px; color: var(--text-secondary); }
.cs-card-arrow { font-size: 14px; color: var(--text-tertiary); flex-shrink: 0; }

/* Custom session modal */
.cs-section { margin-bottom: var(--s-4); }
.cs-section h3 {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: var(--s-2);
}
.cs-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-2);
}
.cs-tile {
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-1);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  color: var(--text-primary);
  transition: transform 0.12s, border-color 0.2s, background 0.2s;
}
.cs-tile:hover { border-color: rgba(99, 102, 241, 0.3); }
.cs-tile.active {
  background: var(--tint-primary);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
.cs-tile-val {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.cs-tile-val span { font-size: 10px; font-weight: 600; color: var(--text-secondary); display: block; margin-top: 2px; }
.cs-tile-sub { font-size: 9px; color: var(--text-tertiary); margin-top: 4px; }

.cs-focus-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.cs-focus {
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  padding: var(--s-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: inherit;
  color: var(--text-primary);
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.cs-focus:hover { border-color: rgba(99, 102, 241, 0.3); }
.cs-focus.active {
  background: var(--tint-primary);
  border-color: var(--accent-blue);
}
.cs-focus-emoji { font-size: 24px; flex-shrink: 0; }
.cs-focus-info { flex: 1; }
.cs-focus-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.cs-focus-desc { font-size: 11px; color: var(--text-secondary); }

/* ============= CONTINUE CARD ============= */
.continue-card-wrap { margin-bottom: var(--s-3); }
.continue-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(99, 102, 241, 0.05));
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s var(--ease-out), border-color 0.2s;
}
.continue-card:hover { border-color: rgba(251, 191, 36, 0.5); }
.continue-card:active { transform: scale(0.985); }
.cc-emoji {
  font-size: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}
.cc-info { flex: 1; min-width: 0; }
.cc-label {
  font-size: 10px;
  color: var(--accent-yellow);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  margin-bottom: 2px;
}
.cc-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--s-2);
}
.cc-progress {
  height: 4px;
  background: var(--bg-quaternary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.cc-progress-bar {
  height: 100%;
  background: var(--gradient-gold);
  border-radius: 2px;
  transition: width 0.4s;
}
.cc-step {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ============= DAILY CHALLENGE CARD ============= */
.daily-challenge-wrap { margin-bottom: 14px; }
.dc-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(118, 75, 162, 0.85) 0%, rgba(102, 126, 234, 0.85) 100%);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
}
.dc-card:active { transform: scale(0.98); }
.dc-card:not(.done) {
  animation: dcGlow 3s ease-in-out infinite;
}
@keyframes dcGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25); }
  50% { box-shadow: 0 4px 28px rgba(139, 92, 246, 0.4); }
}
.dc-card.done {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.18) 0%, rgba(16, 185, 129, 0.18) 100%);
  border: 1px solid rgba(52, 211, 153, 0.4);
  cursor: default;
  box-shadow: none;
  animation: none;
}
.dc-emoji { font-size: 32px; flex-shrink: 0; }
.dc-info { flex: 1; min-width: 0; }
.dc-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.dc-sub { font-size: 12px; opacity: 0.9; }
.dc-arrow { font-size: 18px; opacity: 0.85; flex-shrink: 0; }

/* ============= DAILY CHALLENGE PROGRESS ============= */
.daily-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 6px;
}
.daily-dot {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-quaternary);
  transition: all 0.3s;
}
.daily-dot.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: var(--accent-blue);
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(102, 126, 234, 0.5);
}
.daily-dot.done {
  background: rgba(76, 217, 100, 0.2);
  color: var(--accent-green);
  border-color: var(--accent-green);
}
.daily-task-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

/* ============= WEEKLY GOAL ============= */
.wg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wg-meta { flex: 1; }
.wg-title { font-size: 13px; font-weight: 700; }
.wg-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.wg-pct {
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.wg-bar {
  height: 8px;
  background: var(--bg-quaternary);
  border-radius: 4px;
  overflow: hidden;
}
.wg-fill {
  height: 100%;
  background: var(--gradient-success);
  border-radius: 4px;
  transition: width 0.5s;
}

/* ============= GRAMMAR TRAIL HUB ============= */
.grammar-trails-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.grammar-trail-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
  width: 100%;
  transition: transform 0.15s var(--ease-out), border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}
.grammar-trail-card:hover { border-color: rgba(99, 102, 241, 0.3); }
.grammar-trail-card:active { transform: scale(0.985); }
.grammar-trail-card.completed {
  border-color: rgba(52, 211, 153, 0.4);
  background: linear-gradient(135deg, var(--bg-secondary), rgba(52, 211, 153, 0.05));
}
.gt-emoji {
  font-size: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}
.gt-info { flex: 1; min-width: 0; }
.gt-title { font-size: 14px; font-weight: 600; margin-bottom: var(--s-1); letter-spacing: -0.01em; }
.gt-badge {
  display: inline-block;
  padding: 3px var(--s-2);
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.gt-badge.new {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.gt-badge.progress { background: var(--tint-warning); color: var(--accent-orange); }
.gt-badge.done { background: var(--tint-success); color: var(--accent-green); }
.gt-arrow { font-size: 16px; color: var(--text-tertiary); flex-shrink: 0; }

/* ============= TRAIL PLAYER (stepper) ============= */
.trail-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 6px;
}
.trail-dot {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-quaternary);
  transition: all 0.3s;
}
.trail-dot.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: var(--accent-blue);
  transform: scale(1.15);
}
.trail-dot.done {
  background: rgba(76, 217, 100, 0.2);
  color: var(--accent-green);
  border-color: var(--accent-green);
}
.trail-step-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.trail-rule {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-3);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
}
.trail-rule p { margin-bottom: var(--s-3); }
.trail-rule p:last-child { margin-bottom: 0; }
.trail-rule strong { color: var(--accent-orange); font-weight: 700; }

.trail-keypoints {
  background: rgba(255, 167, 38, 0.08);
  border-left: 3px solid var(--accent-orange);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.trail-keypoints h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-orange);
  margin-bottom: 8px;
}
.trail-keypoints ul { margin: 0; padding-left: 18px; }
.trail-keypoints li { font-size: 13px; margin: 4px 0; line-height: 1.5; }

.trail-examples {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.trail-example {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  gap: var(--s-3);
  transition: border-color 0.2s;
}
.trail-example:hover { border-color: rgba(99, 102, 241, 0.2); }
.te-num {
  background: var(--gradient-primary);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.te-body { flex: 1; min-width: 0; }
.te-wrong {
  font-size: 13px;
  color: var(--accent-red);
  margin-bottom: 4px;
  text-decoration: line-through;
  opacity: 0.7;
}
.te-right {
  font-size: 14px;
  color: var(--accent-green);
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.te-tts {
  background: var(--bg-tertiary);
  border: none;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
}
.te-note {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.4;
}

/* ============= PRONUNCIATION RESULT ============= */
.pron-verdict {
  font-size: 16px;
  margin-bottom: 10px;
  text-align: center;
}
.pron-row {
  font-size: 13px;
  margin: 4px 0;
  display: flex;
  gap: 6px;
}
.pron-label {
  color: var(--text-secondary);
  min-width: 80px;
}
.pron-alts {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.pron-alts summary { cursor: pointer; padding: 4px 0; }
.pron-alts ul { margin: 4px 0 0 16px; padding: 0; }
.pron-alts li { margin: 2px 0; }

/* ============= VOCAB DASHBOARD ============= */
.vocab-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--bg-quaternary);
  margin-bottom: 14px;
}
.vs-big { flex-shrink: 0; min-width: 90px; }
.vs-pct {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.vs-pct span { font-size: 16px; color: var(--text-tertiary); -webkit-text-fill-color: var(--text-tertiary); }
.vs-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; line-height: 1.3; }
.vs-breakdown {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.vsb-tile {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.vsb-tile span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.vsb-tile.mastered span { color: var(--accent-green); }
.vsb-tile.learning span { color: var(--accent-orange); }
.vsb-tile.at-risk span { color: var(--accent-red); }
.vsb-tile.untouched span { color: var(--text-secondary); }

.vocab-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 8px;
}

.vocab-level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.vl-tag {
  background: var(--gradient-primary);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}
.vl-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-quaternary);
  border-radius: 3px;
  overflow: hidden;
}
.vl-fill {
  height: 100%;
  background: var(--gradient-success);
  border-radius: 3px;
  transition: width 0.5s;
}
.vl-count { font-size: 11px; color: var(--text-secondary); min-width: 50px; text-align: right; }

.vocab-lessons {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.vocab-lesson-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.vocab-lesson-row:hover { background: var(--bg-tertiary); }
.vocab-lesson-row:active { background: var(--bg-quaternary); }
.vlr-num {
  background: var(--gradient-primary);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  min-width: 30px;
  text-align: center;
  letter-spacing: 0.3px;
}
.vlr-title {
  flex: 1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.vlr-bar {
  width: 64px;
  height: 5px;
  background: var(--bg-quaternary);
  border-radius: var(--r-pill);
  overflow: hidden;
  display: inline-block;
}
.vlr-fill { display: block; height: 100%; background: var(--gradient-success); border-radius: var(--r-pill); transition: width 0.5s; }
.vlr-pct { font-size: 10px; color: var(--text-secondary); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ============= iOS VOICE TIP ============= */
.ios-voice-tip {
  background: rgba(102, 126, 234, 0.1);
  border-left: 3px solid var(--accent-blue);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.ios-voice-tip strong { color: var(--text-primary); }
