/* ==========================================================================
   MOBILE-FIRST RESPONSIVE DESIGN FOR ENGLISH-UZBEK LEARNING HUB
   ========================================================================== */

:root {
  --ink: #0f172a;
  --paper: #f8fafc;
  --card-bg: #ffffff;
  --line: #e2e8f0;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent-gold: #f59e0b;
  --accent-gold-bg: #fffbeb;
  --accent-green: #10b981;
  --accent-green-bg: #ecfdf5;
  --accent-red: #ef4444;
  --accent-red-bg: #fef2f2;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  scroll-padding-bottom: 90px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* ==========================================================================
   MOBILE BASE LAYOUT (Default: Mobile Screen 320px - 767px)
   ========================================================================== */

.app-container {
  display: block;
  width: 100%;
  min-height: 100vh;
}

/* Mobile Fixed Bottom Navigation Bar */
.sidebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  height: auto;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.22);
  z-index: 2000;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.brand-section,
.sidebar-footer {
  display: none;
}

.nav-menu {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-icon {
  font-size: 1.15rem;
  line-height: 1.1;
  display: block;
  margin-bottom: 2px;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.35);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.6);
}

.nav-item.active .nav-label {
  color: #93c5fd;
  font-weight: 800;
}

.nav-num {
  display: none;
}

/* Mobile Sticky Top Header */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--primary);
  text-transform: uppercase;
}

.cloud-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.cloud-sync-pill.saving,
.cloud-sync-pill.syncing {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.35);
}

.cloud-sync-pill.offline {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.25);
}

.cloud-sync-pill .sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.cloud-sync-pill.saving .sync-dot,
.cloud-sync-pill.syncing .sync-dot {
  background: #f59e0b;
  animation: pulseSyncDot 0.8s infinite alternate ease-in-out;
}

.cloud-sync-pill.offline .sync-dot {
  background: #94a3b8;
}

@keyframes pulseSyncDot {
  from { opacity: 0.35; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.2); }
}

.audio-speed-btn {
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 11px;
  border-radius: var(--radius-full);
  font-weight: 750;
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.audio-speed-btn.slow-active {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-gold-bg);
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.76rem;
  white-space: nowrap;
}

/* Main Content Area */
.main-content {
  padding: 16px 16px 28px;
  width: 100%;
  max-width: 100%;
}

/* View Sections */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: viewFadeIn 0.2s ease-out;
}

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

/* Typography Defaults */
h2 {
  font-size: 1.45rem;
  font-weight: 850;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.18rem;
  font-weight: 750;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 6px;
}

p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Common Buttons */
.primary-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 750;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.15s ease;
}

.primary-btn:active {
  transform: scale(0.98);
}

.secondary-btn {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 750;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  touch-action: manipulation;
}

.secondary-btn:active {
  transform: scale(0.98);
}

.ghost-btn {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 650;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.ghost-btn.danger {
  color: var(--accent-red);
  border-color: #fca5a5;
  background: var(--accent-red-bg);
}

/* ==========================================================================
   1. TODAY VIEW (Mobile)
   ========================================================================== */

.today-header {
  margin-bottom: 18px;
}

.today-greeting {
  margin-bottom: 12px;
}

.today-greeting h2 {
  font-size: 1.45rem;
  line-height: 1.25;
  margin-top: 4px;
}

.streak-widget {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.streak-icon {
  font-size: 1.7rem;
  line-height: 1;
}

.streak-details b {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: #92400e;
}

.streak-details small {
  color: #b45309;
  font-size: 0.78rem;
  font-weight: 600;
}

.today-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.hero-lesson-card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.card-tag {
  background: var(--accent-gold);
  color: #0f172a;
  font-size: 0.68rem;
  font-weight: 850;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  display: inline-block;
  width: max-content;
  margin-bottom: 10px;
}

.hero-lesson-card h3 {
  font-size: 1.35rem;
  color: #ffffff;
  line-height: 1.28;
  margin-bottom: 2px;
}

.hero-lesson-card .en-sub {
  color: #94a3b8;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.hero-lesson-card .goal-text {
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 18px;
}

.hero-actions .continue-btn {
  width: 100%;
  font-size: 0.95rem;
  font-weight: 800;
}

.stats-mini-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
}

.stats-mini-card h4 {
  font-size: 0.95rem;
  font-weight: 750;
  margin-bottom: 10px;
}

.circular-progress {
  text-align: center;
  margin: 10px 0 14px;
}

.stat-big {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary);
  display: block;
  line-height: 1;
  margin-bottom: 4px;
}

.circular-progress span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.progress-bar-wrap {
  height: 8px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 14px;
}

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

.due-alert {
  background: #eff6ff;
  color: var(--primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.due-done {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.stages-overview {
  margin-top: 24px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h3 {
  font-size: 1.15rem;
  margin-bottom: 2px;
}

.section-title small {
  color: var(--muted);
  font-size: 0.8rem;
}

.stages-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stage-badge {
  background: #e2e8f0;
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 8px;
}

.stage-card h4 {
  font-size: 1.05rem;
  font-weight: 750;
  margin-bottom: 4px;
}

.stage-card p {
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.stage-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.stage-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.stage-bar div {
  height: 100%;
  background: var(--accent-green);
}

/* ==========================================================================
   2. COURSE VIEW (Mobile)
   ========================================================================== */

.course-header {
  margin-bottom: 16px;
}

.course-filter-tabs {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.filter-tab {
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
}

.filter-tab.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-row {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.lesson-row.done {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.lesson-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  flex-shrink: 0;
}

.lesson-row.done .lesson-num {
  background: var(--accent-green);
  color: #ffffff;
}

.lesson-info h3 {
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.lesson-en {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.lesson-goal {
  display: block;
  font-size: 0.78rem;
  color: #475569;
  margin-bottom: 10px;
  line-height: 1.4;
}

.lesson-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}

.tag-stage {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  background: #e2e8f0;
  border-radius: 4px;
}

.tag-done {
  font-size: 0.7rem;
  font-weight: 750;
  color: var(--accent-green);
}

.lesson-action {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
}

.lesson-action .secondary-btn {
  width: 100%;
}

/* ==========================================================================
   3. LESSON WORKSPACE (Mobile)
   ========================================================================== */

.lesson-top-bar {
  margin-bottom: 16px;
}

.back-link-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-weight: 750;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
  display: inline-block;
}

.lesson-title-wrap h2 {
  font-size: 1.35rem;
  line-height: 1.25;
  margin-bottom: 2px;
}

.lesson-title-wrap .en-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.lesson-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 750;
  background: #f1f5f9;
  color: var(--muted);
  margin-top: 8px;
}

.lesson-status-pill.done {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

/* Lesson Horizontal Scroller Tabs */
.lesson-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.ltab {
  flex-shrink: 0;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: #ffffff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.ltab.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.lesson-section {
  display: none;
}

.lesson-section.active {
  display: block;
  animation: viewFadeIn 0.2s ease-out;
}

.content-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.rule-box {
  background: #f0fdf4;
  border-left: 4px solid var(--accent-green);
  padding: 14px 14px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
}

.rule-box h4 {
  font-size: 0.95rem;
  color: #065f46;
  margin-bottom: 6px;
}

.rule-box ul {
  padding-left: 18px;
  margin-top: 6px;
}

.rule-box li {
  font-size: 0.88rem;
  margin-bottom: 6px;
  color: #1e293b;
}

.reading-note {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 14px;
}

.reading-note h4 {
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.reading-note p {
  font-size: 0.84rem;
}

/* Vocabulary Cards (Mobile) */
.words-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
}

.word-main {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.word-audio-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.word-audio-btn.speaking {
  background: #dbeafe;
  border-color: var(--primary);
  transform: scale(1.05);
}

.en-word {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.word-tr {
  font-size: 0.8rem;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  margin: 3px 0 4px;
  font-style: normal;
}

.uz-word {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 700;
}

.word-example {
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  font-size: 0.82rem;
}

.ex-en {
  color: var(--ink);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-audio-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px;
  touch-action: manipulation;
}

.ex-uz {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Dialogue (Mobile) */
.dialogue-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialogue-line {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 92%;
}

.dialogue-line.speaker-a {
  align-self: flex-start;
}

.dialogue-line.speaker-b {
  align-self: flex-end;
}

.speaker-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
}

.dialogue-bubble {
  padding: 12px 14px;
  border-radius: var(--radius-lg);
}

.speaker-a .dialogue-bubble {
  background: #f1f5f9;
  border-bottom-left-radius: 4px;
}

.speaker-b .dialogue-bubble {
  background: #eff6ff;
  border-bottom-right-radius: 4px;
}

.bubble-en {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 4px;
}

.bubble-uz {
  font-size: 0.82rem;
  color: #475569;
}

/* Tasks & Options (Mobile) */
.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  background: #f8fafc;
}

.task-image-wrapper,
.cp-image-wrapper {
  margin: 12px 0 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--line);
  background: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}

.task-illustration,
.cp-illustration {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

@media (min-width: 640px) {
  .task-illustration,
  .cp-illustration {
    max-height: 280px;
  }
}

.task-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}

.task-prompt {
  font-size: 0.98rem;
  font-weight: 750;
  margin-bottom: 12px;
}

.listen-audio-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 750;
  font-size: 0.84rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  touch-action: manipulation;
}

.task-options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-opt-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-height: 48px;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.task-opt-btn:active {
  background: #f1f5f9;
}

.task-opt-btn.correct {
  background: var(--accent-green-bg);
  border-color: var(--accent-green);
  color: #065f46;
  font-weight: 800;
}

.task-opt-btn.wrong {
  background: var(--accent-red-bg);
  border-color: var(--accent-red);
  color: #991b1b;
}

.task-feedback {
  margin-top: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.feedback-correct {
  color: var(--accent-green);
  font-weight: 800;
  display: block;
}

.feedback-wrong {
  color: var(--accent-red);
  font-weight: 800;
  display: block;
}

/* Word Order Chips (Mobile) */
.tiles-dropzone {
  min-height: 56px;
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}

.dropzone-placeholder {
  color: #94a3b8;
  font-size: 0.84rem;
}

.tiles-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tile-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 750;
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
}

.tile-btn.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.tiles-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Checkpoint Quiz (Mobile) */
.quiz-rule-pill {
  background: var(--accent-gold-bg);
  color: #92400e;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
}

.checkpoint-q-card {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.cp-num {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
  margin-bottom: 2px;
}

.cp-prompt {
  font-size: 0.98rem;
  font-weight: 750;
  margin-bottom: 10px;
}

.cp-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cp-opt-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  touch-action: manipulation;
}

.cp-opt-label.correct {
  background: var(--accent-green-bg);
  border-color: var(--accent-green);
}

.cp-opt-label.wrong {
  background: var(--accent-red-bg);
  border-color: var(--accent-red);
}

.quiz-submit-wrap {
  margin-top: 20px;
}

.section-nav-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.result-summary {
  padding: 20px 16px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.result-score {
  font-size: 2rem;
  font-weight: 900;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

/* ==========================================================================
   4. REVIEW (SPACED REPETITION) (Mobile)
   ========================================================================== */

.review-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.flashcard-card {
  perspective: 1000px;
  min-height: 250px;
  cursor: pointer;
  margin-bottom: 10px;
}

.card-side {
  background: var(--card-bg);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
  box-shadow: var(--shadow-md);
}

.card-hint {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 750;
  text-align: center;
}

.card-text {
  font-size: 1.25rem;
  font-weight: 800;
  margin-top: 10px;
  line-height: 1.35;
}

.card-audio-btn {
  background: #eff6ff;
  border: 1px solid var(--primary);
  color: var(--primary);
  min-height: 42px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 750;
  cursor: pointer;
  margin-bottom: 8px;
}

.card-tap-indicator {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 750;
  text-align: center;
}

.flashcard-card:not(.flipped) .card-back {
  display: none;
}

.flashcard-card.flipped .card-front {
  display: none;
}

.flashcard-card.flipped .card-back {
  border-color: var(--primary);
  background: #f8fafc;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rating-btn {
  min-height: 46px;
  font-size: 0.86rem;
}

.rating-btn.red {
  color: #b91c1c;
  border-color: #fca5a5;
  background: var(--accent-red-bg);
}

.rating-btn.green {
  background: var(--accent-green);
  color: #ffffff;
}

.mistake-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-red);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.mistake-badge {
  font-size: 0.65rem;
  color: var(--accent-red);
  font-weight: 800;
  text-transform: uppercase;
}

.mistake-prompt {
  font-weight: 750;
  margin: 4px 0;
  color: var(--ink);
}

.mistake-why {
  color: #475569;
  font-size: 0.8rem;
}

/* ==========================================================================
   5. EXAMS (Mobile)
   ========================================================================== */

.exams-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exam-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
}

.exam-badge-tag {
  background: #e2e8f0;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  width: max-content;
  margin-bottom: 8px;
}

.exam-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.exam-runner-box {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  box-shadow: var(--shadow-md);
}

.exam-runner-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.exam-q-prompt {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.35;
}

.exam-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.exam-opt-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-height: 50px;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}

.exam-opt-btn.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
  font-weight: 800;
}

.exam-runner-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==========================================================================
   6. PROGRESS (Mobile)
   ========================================================================== */

.stats-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 650;
  display: block;
}

.stat-number {
  font-size: 1.65rem;
  font-weight: 900;
  display: block;
  margin: 4px 0;
  color: var(--ink);
  line-height: 1.1;
}

.stat-number i {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: normal;
}

.stat-box small {
  font-size: 0.72rem;
  color: var(--muted);
}

.can-do-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.can-do-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.can-do-card.unlocked {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.can-do-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.can-do-card.unlocked .can-do-icon {
  background: var(--accent-green);
  color: #ffffff;
}

.can-do-body b {
  font-size: 0.88rem;
  display: block;
}

.can-do-body p {
  font-size: 0.75rem;
  color: var(--muted);
}

.backup-section {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.backup-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(78px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 2500;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   DESKTOP ENHANCEMENT (>= 768px Tablet & Laptop/Desktop)
   ========================================================================== */

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }

  .app-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    width: 240px;
    height: 100vh;
    padding: 24px 16px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    box-shadow: none;
    z-index: 50;
  }

  .brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 8px;
  }

  .brand-icon {
    font-size: 1.8rem;
  }

  .brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
  }

  .brand-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    display: block;
  }

  .sidebar-footer {
    display: block;
    margin-top: auto;
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.4;
  }

  .nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: none;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    min-height: auto;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
  }

  .nav-icon {
    font-size: 1.1rem;
    margin-bottom: 0;
  }

  .nav-label {
    font-size: 0.92rem;
  }

  .nav-num {
    display: inline;
    font-size: 0.75rem;
    opacity: 0.6;
  }

  .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }

  .nav-item.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  }

  .nav-item.active .nav-label {
    color: #ffffff;
  }

  .main-content {
    padding: 28px 40px 60px;
    max-width: 1000px;
  }

  .top-bar {
    padding: 14px 0;
    margin-bottom: 28px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .today-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
  }

  .today-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
  }

  .stages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .lesson-row {
    grid-template-columns: 48px 1fr auto;
    padding: 18px 22px;
  }

  .lesson-action {
    grid-column: auto;
    border-top: none;
    padding-top: 0;
  }

  .lesson-action .secondary-btn {
    width: auto;
  }

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

  .review-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
  }

  .card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .stats-cards-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .can-do-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .backup-section {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .backup-buttons {
    flex-direction: row;
  }

  .section-nav-footer {
    flex-direction: row;
    justify-content: space-between;
  }

  .primary-btn {
    width: auto;
  }

  .toast {
    bottom: 24px;
    left: auto;
    right: 24px;
    width: auto;
  }
}
