:root {
  color-scheme: light dark;
  --font-persian: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, sans-serif;
  --font-en: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --bg: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-raised: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --fg: #0f172a;
  --fg-muted: #64748b;
  --fg-subtle: #94a3b8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-fg: #ffffff;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-fg: #065f46;

  --error: #ef4444;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-fg: #991b1b;

  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --amber-border: #fde68a;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --shadow-primary: 0 4px 14px rgba(79, 70, 229, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19;
    --bg-surface: #131b2e;
    --bg-surface-raised: #1e293b;
    --border: #243048;
    --border-strong: #334155;

    --fg: #f8fafc;
    --fg-muted: #94a3b8;
    --fg-subtle: #64748b;

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #1e1e38;
    --primary-fg: #ffffff;

    --success: #10b981;
    --success-bg: #064e3b;
    --success-border: #047857;
    --success-fg: #ecfdf5;

    --error: #f87171;
    --error-bg: #450a0a;
    --error-border: #991b1b;
    --error-fg: #fee2e2;

    --amber: #fbbf24;
    --amber-light: #451a03;
    --amber-border: #78350f;

    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-persian);
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.pulse-btn {
  animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(79, 70, 229, 0);
  }
}

.flame-anim {
  display: inline-block;
  animation: flameBounce 1.5s infinite alternate ease-in-out;
}

@keyframes flameBounce {
  from { transform: scale(1); }
  to { transform: scale(1.15) rotate(3deg); }
}

/* ==========================================================================
   Base Buttons & UI Components
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--bg-surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-surface-raised);
  border-color: var(--border-strong);
}

.btn-danger {
  padding: 0.65rem 1.2rem;
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  filter: brightness(0.9);
}

.audio-btn-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  border: 1px solid var(--primary);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s;
}

.audio-btn-sm:hover {
  transform: scale(1.1);
}

.audio-btn-md {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  border: 1px solid var(--primary);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.audio-btn-md:hover {
  transform: scale(1.1);
}

/* ==========================================================================
   App Layout & Header & Navigation
   ========================================================================== */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 5rem; /* For sticky bottom navigation on mobile */
}

@media (min-width: 768px) {
  .app-layout {
    max-width: 52rem;
    margin: 0 auto;
    padding-bottom: 6rem;
  }
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-logo-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--primary);
}

.lang-switcher-relative {
  position: relative;
}

.lang-badge-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--fg);
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.lang-badge-btn:hover {
  background: var(--border);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 17rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 50;
}

.dropdown-header {
  font-size: 0.75rem;
  color: var(--fg-muted);
  padding: 0.35rem 0.5rem;
  font-weight: 600;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--fg);
  text-align: right;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover, .dropdown-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.course-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
}

.course-pair-desc {
  display: block;
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}

.stat-pill.streak-pill {
  color: #ea580c;
  border-color: #fed7aa;
}

.stat-pill.xp-pill {
  color: var(--primary);
  border-color: #c7d2fe;
}

.stat-pill.hearts-pill {
  color: var(--error);
  border-color: #fecaca;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
}

/* Bottom Nav Bar */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 40;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.04);
}

.bottom-nav-inner {
  max-width: 42rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
}

.nav-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

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

.nav-tab-btn:hover {
  color: var(--fg);
}

.nav-tab-btn.active {
  color: var(--primary);
  font-weight: 800;
}

.nav-tab-btn.active .tab-icon {
  transform: scale(1.15);
}

/* ==========================================================================
   Main Content Containers
   ========================================================================== */
.app-main-content {
  padding: 1.25rem 1rem;
  max-width: 52rem;
  margin: 0 auto;
  width: 100%;
}

/* ==========================================================================
   Onboarding Flow
   ========================================================================== */
.onboarding-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--bg);
}

.onboarding-card {
  width: 100%;
  max-width: 32rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 1.5rem;
}

.onboarding-progress-track {
  height: 6px;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.onboarding-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.onboarding-step-indicator {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.step-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.onboarding-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.onboarding-header .subtitle {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
}

.language-grid, .choice-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.lang-option-card, .choice-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  text-align: right;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.lang-option-card:hover, .choice-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-raised);
}

.lang-option-card.selected, .choice-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.lang-flag, .choice-icon {
  font-size: 1.6rem;
}

.lang-info, .choice-content {
  flex: 1;
}

.lang-title, .choice-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fg);
}

.lang-subtitle, .choice-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.choice-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-tag, .tag-available {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  background: var(--success-bg);
  color: var(--success);
  border-radius: var(--radius-full);
  font-weight: 700;
}

.popular-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.check-mark {
  color: var(--primary);
  font-weight: 900;
  font-size: 1.1rem;
}

.onboarding-actions {
  display: flex;
  gap: 0.75rem;
}

.onboarding-actions.row-between {
  justify-content: space-between;
}

/* ==========================================================================
   Home Tab Styles
   ========================================================================== */
.home-tab-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-continue-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  border-radius: var(--radius-full);
  filter: blur(50px);
  opacity: 0.15;
  pointer-events: none;
}

.hero-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.unit-pill {
  padding: 0.2rem 0.55rem;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.lesson-time-pill, .xp-reward-pill {
  padding: 0.2rem 0.55rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  color: var(--fg-muted);
}

.hero-lesson-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.hero-lesson-desc {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
}

.hero-action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-start-btn {
  padding: 0.75rem 1.6rem;
  font-size: 1rem;
}

.btn-guide-outline {
  padding: 0.7rem 1.1rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-guide-outline:hover {
  background: var(--bg-surface-raised);
}

.hero-unit-badge {
  display: none;
}

@media (min-width: 600px) {
  .hero-unit-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: var(--bg-surface-raised);
    font-size: 2.8rem;
    flex-shrink: 0;
  }
}

.home-dashboard-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .home-dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.dashboard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.header-icon-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  font-size: 1.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 800;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.goal-stat-number {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}

.goal-progress-track {
  height: 8px;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.goal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  transition: width 0.3s ease;
}

.goal-footer-text {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.goal-reached {
  color: var(--success);
  font-weight: 700;
}

.week-days-row {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
}

.week-day-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.2rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.week-day-pill.today {
  border: 1px solid var(--primary);
}

.week-day-pill.active {
  background: #fff7ed;
  color: #c2410c;
}

/* Persian Pitfall Section */
.pitfall-card {
  border-right: 4px solid var(--amber);
}

.pitfall-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pitfall-spark {
  font-size: 1.5rem;
}

.pitfall-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.pitfall-subtitle {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.pitfall-comparison-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-md);
}

.pitfall-wrong-box {
  flex: 1;
  min-width: 140px;
}

.label-wrong {
  display: block;
  font-size: 0.7rem;
  color: var(--error);
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.label-correct {
  display: block;
  font-size: 0.7rem;
  color: var(--success);
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.pitfall-correct-box {
  flex: 1;
  min-width: 140px;
}

.correct-text-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.phrase-text {
  font-family: var(--font-en);
  font-size: 0.95rem;
}

.pitfall-arrow {
  color: var(--fg-muted);
  font-weight: 900;
}

.pitfall-explanation {
  font-size: 0.85rem;
  color: var(--fg);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.btn-link-action {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.btn-link-action:hover {
  text-decoration: underline;
}

/* Quick Access */
.quick-access-section {
  margin-top: 0.5rem;
}

.section-heading {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.quick-cards-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .quick-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.quick-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.quick-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.quick-card-icon {
  font-size: 1.6rem;
}

.quick-card-info {
  flex: 1;
}

.quick-card-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.quick-card-info p {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.quick-arrow {
  color: var(--fg-muted);
}

/* ==========================================================================
   Learn Tab & Path / Roadmap (Duolingo Style)
   ========================================================================== */
.learn-tab-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.level-selector-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.level-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.level-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.lvl-badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
}

.roadmap-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.unit-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.unit-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-right-width: 5px;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.unit-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.unit-number-pill {
  padding: 0.15rem 0.5rem;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.unit-lessons-count {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.unit-main-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.unit-desc-text {
  font-size: 0.825rem;
  color: var(--fg-muted);
}

.unit-guidebook-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--fg);
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.unit-guidebook-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Curvy Path Nodes */
.unit-path-nodes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  padding: 1rem 0;
}

.path-node-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.2s;
}

.path-offset-center {
  transform: translateX(0);
}

.path-offset-right {
  transform: translateX(-40px);
}

.path-offset-left {
  transform: translateX(40px);
}

.path-node-btn {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  border: 4px solid var(--border);
  background: var(--bg-surface);
  box-shadow: 0 5px 0 var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.path-node-btn.completed {
  background: #fef08a;
  border-color: #eab308;
  box-shadow: 0 5px 0 #ca8a04;
}

.path-node-btn.active-node {
  background: var(--primary);
  border-color: #818cf8;
  box-shadow: 0 5px 0 #4338ca;
  color: #fff;
  animation: bounceNode 2s infinite ease-in-out;
}

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

.path-node-btn.locked {
  background: var(--bg-surface-raised);
  border-color: var(--border);
  box-shadow: 0 4px 0 var(--border);
  color: var(--fg-subtle);
  cursor: not-allowed;
}

.node-content-completed {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.check-star {
  font-size: 1.4rem;
}

.stars-mini {
  font-size: 0.7rem;
  color: #ca8a04;
}

.play-icon {
  font-size: 1.6rem;
}

.lock-icon {
  font-size: 1.3rem;
  opacity: 0.6;
}

.path-node-label {
  font-size: 0.75rem;
  font-weight: 700;
  max-width: 120px;
  text-align: center;
}

.checkpoint-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 1rem;
  background: var(--bg-surface-raised);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg-muted);
}

/* ==========================================================================
   Modals (Guidebook, Lesson Runner, Lesson Preview)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lesson-preview-card, .guidebook-modal-card {
  width: 100%;
  max-width: 32rem;
  max-height: 85vh;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.guidebook-modal-card {
  max-width: 40rem;
}

.preview-header, .guidebook-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guidebook-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.unit-icon-badge {
  font-size: 2rem;
}

.unit-tag, .preview-unit-badge {
  font-size: 0.75rem;
  font-weight: 700;
  display: block;
}

.close-modal-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-surface-raised);
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
}

.preview-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 1rem 1.25rem;
}

.info-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-md);
}

.info-icon {
  font-size: 1.3rem;
  margin-bottom: 0.2rem;
}

.info-val {
  font-weight: 800;
  font-size: 0.9rem;
}

.info-lbl {
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.preview-intro-note {
  padding: 0 1.25rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.preview-actions, .guidebook-footer {
  padding: 1.25rem;
  display: flex;
  gap: 0.75rem;
}

/* Guidebook Specifics */
.guidebook-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.persian-alert-box {
  padding: 0.9rem 1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  color: #92400e;
}

.alert-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.alert-text {
  font-size: 0.825rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
}

.overview-text {
  font-size: 0.875rem;
  color: var(--fg);
  line-height: 1.6;
}

.grammar-card {
  padding: 1rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.grammar-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.grammar-summary {
  font-size: 0.825rem;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.persian-comparison {
  display: flex;
  gap: 0.35rem;
  font-size: 0.825rem;
  margin-bottom: 0.5rem;
}

.badge-persian {
  font-weight: 700;
  color: var(--primary);
}

.grammar-formula {
  padding: 0.4rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-en);
  font-size: 0.85rem;
  margin-bottom: 0.65rem;
  display: inline-block;
}

.examples-box, .mistakes-box {
  margin-top: 0.5rem;
}

.examples-header, .mistakes-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--fg);
  display: block;
  margin-bottom: 0.35rem;
}

.examples-list {
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.example-item {
  padding: 0.4rem 0.6rem;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.example-target-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-en);
  font-weight: 700;
}

.example-source {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.1rem;
}

.mistake-item {
  padding: 0.4rem 0.6rem;
  background: var(--error-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
}

.mistake-comparison {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 700;
}

.wrong-txt { color: var(--error); text-decoration: line-through; }
.correct-txt { color: var(--success); }
.arrow-sep { color: var(--fg-muted); }

.mistake-why {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.15rem;
}

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

.vocab-card {
  padding: 0.75rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.vocab-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-en);
  margin-bottom: 0.25rem;
}

.vocab-word { font-size: 0.95rem; }
.vocab-phonetic { font-size: 0.75rem; color: var(--fg-muted); }
.vocab-meaning { font-size: 0.825rem; font-weight: 700; }
.vocab-note { font-size: 0.725rem; color: var(--primary); margin-top: 0.2rem; }
.vocab-example { font-size: 0.725rem; margin-top: 0.35rem; border-top: 1px dashed var(--border); padding-top: 0.25rem; }

/* ==========================================================================
   Lesson Runner (Exercise Engine)
   ========================================================================== */
.lesson-runner-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lesson-runner-card {
  width: 100%;
  height: 100%;
  max-width: 42rem;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  position: relative;
}

.runner-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.runner-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--fg-muted);
  cursor: pointer;
}

.runner-progress-track {
  flex: 1;
  height: 12px;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.runner-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.runner-hearts {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--error);
  font-weight: 800;
}

.runner-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.intro-stage {
  justify-content: space-between;
}

.intro-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
}

.intro-desc {
  color: var(--fg-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.vocab-primer-grid {
  display: grid;
  gap: 0.75rem;
}

.vocab-primer-card {
  padding: 1rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s;
}

.vocab-primer-card:hover {
  border-color: var(--primary);
}

.primer-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-en);
  margin-bottom: 0.25rem;
}

.primer-target { font-size: 1.1rem; }
.primer-phonetic { font-size: 0.8rem; color: var(--fg-muted); }
.primer-source { font-size: 0.9rem; font-weight: 700; }
.primer-example { font-size: 0.8rem; margin-top: 0.35rem; color: var(--fg-muted); }
.ex-t { display: block; font-family: var(--font-en); }
.ex-s { display: block; }

.persian-contrast-box {
  padding: 0.9rem;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.contrast-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.grammar-formula-card {
  padding: 0.75rem 1rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.formula-label {
  display: block;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: 0.25rem;
}

.grammar-formula-card code {
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

.intro-mistake-highlight {
  padding: 0.9rem;
  background: var(--error-bg);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.mistake-title {
  font-size: 0.8rem;
  color: var(--error);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.mistake-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-en);
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.wrong-box { color: var(--error); text-decoration: line-through; }
.correct-box { color: var(--success); }
.mistake-note { font-size: 0.75rem; color: var(--fg-muted); }

/* Exercise Area */
.exercise-type-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.exercise-prompt-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.audio-prompt-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.audio-play-large-btn {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: transform 0.15s;
}

.audio-play-large-btn:hover {
  transform: scale(1.08);
}

.audio-play-slow-btn {
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.phonetic-hint {
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-family: var(--font-en);
}

.source-phrase-display {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.25rem;
}

/* Token Builder */
.token-builder-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.selected-tokens-slot {
  min-height: 60px;
  padding: 0.75rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.token-placeholder {
  font-size: 0.85rem;
  color: var(--fg-subtle);
  font-family: var(--font-persian);
}

.available-tokens-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  padding: 1rem 0;
}

.word-token {
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.55rem 0.95rem;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 3px 0 var(--border);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.1s;
}

.word-token:hover:not(:disabled) {
  border-color: var(--primary);
}

.word-token:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border);
}

.selected-token {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 3px 0 var(--primary);
}

/* Options Grid */
.options-selection-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.option-choice-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 3px 0 var(--border);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all 0.1s;
  width: 100%;
}

.option-choice-card:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.option-choice-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 3px 0 var(--primary);
}

.option-choice-card.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success-fg);
  box-shadow: 0 3px 0 var(--success);
}

.option-choice-card.wrong {
  border-color: var(--error);
  background: var(--error-bg);
  color: var(--error-fg);
  box-shadow: 0 3px 0 var(--error);
}

.choice-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}

.choice-text {
  flex: 1;
}

.result-marker {
  font-size: 1.2rem;
  font-weight: 900;
}

/* Feedback Drawer */
.feedback-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 10;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.feedback-correct {
  background: var(--success-bg);
  border-top: 2px solid var(--success);
}

.feedback-wrong {
  background: var(--error-bg);
  border-top: 2px solid var(--error);
}

.status-icon {
  font-size: 1.15rem;
  font-weight: 900;
  display: block;
  margin-bottom: 0.25rem;
}

.feedback-correct .status-icon { color: var(--success-fg); }
.feedback-wrong .status-icon { color: var(--error-fg); }

.feedback-explanation .note-text {
  font-size: 0.875rem;
  color: var(--fg);
}

.pitfall-box {
  display: flex;
  gap: 0.35rem;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.pitfall-tag {
  font-weight: 700;
  color: var(--error);
}

.btn-continue {
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.btn-correct {
  background: var(--success);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-wrong {
  background: var(--error);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.runner-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.btn-check {
  width: 100%;
}

@media (min-width: 500px) {
  .btn-check {
    width: auto;
    min-width: 160px;
  }
}

/* Completed Stage */
.completed-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.completed-card {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.celebration-badge {
  font-size: 4rem;
  animation: bounceNode 1s infinite alternate;
}

.completed-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.completed-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  margin: 0.75rem 0;
}

.stat-box {
  padding: 0.85rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-box-icon { font-size: 1.3rem; margin-bottom: 0.15rem; }
.stat-box-val { font-size: 1.1rem; font-weight: 900; }
.stat-box-label { font-size: 0.7rem; color: var(--fg-muted); }

.learned-words-recap {
  width: 100%;
  text-align: right;
  padding: 0.85rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-md);
}

.learned-words-recap h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.words-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.word-chip {
  padding: 0.25rem 0.55rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* ==========================================================================
   Practice Tab Styles
   ========================================================================== */
.practice-tab-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.practice-intro-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.practice-intro-header .subtitle {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
}

.practice-modes-grid {
  display: grid;
  gap: 1rem;
}

.practice-mode-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.practice-mode-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.practice-mode-card.featured-mode {
  border: 2px solid var(--amber);
}

.mode-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  background: var(--amber-light);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-full);
  color: #b45309;
}

.mode-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.bg-amber { background: #fef3c7; color: #d97706; }
.bg-indigo { background: #e0e7ff; color: #4f46e5; }
.bg-emerald { background: #d1fae5; color: #059669; }

.mode-card-content {
  flex: 1;
}

.mode-card-content h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.mode-card-content p {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.mode-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.count-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg-muted);
}

.arrow-btn {
  font-size: 0.825rem;
  font-weight: 800;
  color: var(--primary);
}

/* Practice Screens */
.btn-back-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 0.75rem;
}

.mistake-drill-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--fg-muted);
}

.mistake-card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.mistake-comparison-box {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-bottom: 1rem;
}

@media (min-width: 500px) {
  .mistake-comparison-box {
    grid-template-columns: 1fr 1fr;
  }
}

.mistake-wrong-item {
  padding: 0.75rem;
  background: var(--error-bg);
  border-radius: var(--radius-md);
}

.mistake-correct-item {
  padding: 0.75rem;
  background: var(--success-bg);
  border-radius: var(--radius-md);
}

.badge-wrong { display: block; font-size: 0.7rem; color: var(--error); font-weight: 700; }
.badge-correct { display: block; font-size: 0.7rem; color: var(--success); font-weight: 700; }

.mistake-explanation-quote {
  padding: 0.85rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.mistake-practice-box .box-prompt {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.drill-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.drill-feedback.correct {
  background: var(--success-bg);
  color: var(--success-fg);
  font-weight: 700;
}

.drill-feedback.wrong {
  background: var(--error-bg);
  color: var(--error-fg);
  font-weight: 700;
}

/* Flashcards 3D Box */
.flashcard-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.flashcard-3d-box {
  width: 100%;
  min-height: 260px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  cursor: pointer;
  position: relative;
  text-align: center;
  transition: all 0.2s;
}

.flashcard-3d-box:hover {
  border-color: var(--primary);
}

.flashcard-front, .flashcard-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.card-hint-click {
  font-size: 0.75rem;
  color: var(--fg-subtle);
  margin-bottom: 0.5rem;
}

.flashcard-word {
  font-family: var(--font-en);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
}

.flashcard-phonetic {
  font-family: var(--font-en);
  font-size: 1rem;
  color: var(--fg-muted);
}

.flashcard-pos {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  color: var(--fg-muted);
}

.flashcard-meaning {
  font-size: 1.6rem;
  font-weight: 800;
}

.card-persian-tip {
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 0.5rem;
}

.card-example-block {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.flashcard-controls {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Listening Lab */
.listening-lab-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.audio-hero-circle {
  margin-bottom: 1rem;
}

.big-speaker-btn {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: transform 0.15s;
}

.big-speaker-btn:hover {
  transform: scale(1.1);
}

.audio-speed-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.speed-pill-btn {
  padding: 0.35rem 0.75rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.listening-prompt {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Profile Tab Styles
   ========================================================================== */
.profile-tab-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.profile-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.profile-badges-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge-lang-tag, .badge-level-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-weight: 600;
}

.profile-subnav {
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  overflow-x: auto;
}

.subnav-btn {
  padding: 0.45rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.subnav-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 600px) {
  .stats-overview-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-card-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
.stat-card-number { font-size: 1.35rem; font-weight: 900; }
.stat-card-label { font-size: 0.75rem; color: var(--fg-muted); }

.architecture-note-card {
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.architecture-note-card h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.architecture-note-card p {
  font-size: 0.825rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.ach-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.achievement-card.unlocked .ach-icon-circle {
  background: #fef08a;
}

.ach-info {
  flex: 1;
}

.ach-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.ach-title { font-size: 0.95rem; font-weight: 800; }

.ach-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

.ach-status-badge.unlocked {
  background: var(--success-bg);
  color: var(--success);
}

.ach-status-badge.locked {
  background: var(--bg-surface-raised);
  color: var(--fg-muted);
}

.ach-desc {
  font-size: 0.775rem;
  color: var(--fg-muted);
}

/* Settings */
.settings-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.settings-section-card h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.section-desc {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}

.courses-select-list {
  display: grid;
  gap: 0.75rem;
}

.course-choice-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.course-choice-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.course-flag-lg { font-size: 1.8rem; }
.course-text-col { flex: 1; }
.course-name { display: block; font-size: 0.9rem; font-weight: 700; }
.course-detail { display: block; font-size: 0.75rem; color: var(--fg-muted); }

.active-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary);
}

.btn-secondary-sm {
  padding: 0.35rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.daily-goals-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.goal-btn-choice {
  padding: 0.65rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
}

.goal-btn-choice.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.danger-zone {
  border-color: var(--error-border);
}

.danger-text {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}
