/* ═══════════════════════════════════════════════════════════════
   CodeLearn — Complete stylesheet
   Original lesson styles + Dashboard additions merged
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   BASE VARIABLES & RESET
══════════════════════════════════════════════════════════════ */
:root {
  --bg:           #f0f4f8;
  --bg-card:      #ffffff;
  --sidebar-bg:   #1e1b4b;
  --sidebar-hover:#2d2a6e;
  --primary:      #7c3aed;
  --primary-light:#ede9fe;
  --primary-dark: #5b21b6;
  --success:      #10b981;
  --success-light:#d1fae5;
  --danger:       #ef4444;
  --danger-light: #fee2e2;
  --warning:      #f59e0b;
  --text:         #1e293b;
  --text-mid:     #475569;
  --text-muted:   #94a3b8;
  --border:       #e2e8f0;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
  --radius:       14px;
  --radius-sm:    8px;
  --nav-h:        60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   TOP NAV
══════════════════════════════════════════════════════════════ */
#topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  font-size: 24px;
}
.brand-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}
.brand-name strong { color: var(--primary); font-weight: 800; }
.nav-stats { display: none; }
.stat-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid transparent;
  transition: transform .2s;
}
.stat-chip:hover { transform: translateY(-2px); }
.xp-chip     { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.streak-chip { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.done-chip   { background: #ede9fe; border-color: #ddd6fe; color: #5b21b6; }
.chip-label  { opacity: .7; font-weight: 500; }

/* Nav continue button */
.continue-nav-btn { display: none; }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--primary); transform: rotate(20deg) scale(1.1); }

/* ══════════════════════════════════════════════════════════════
   PAGES
══════════════════════════════════════════════════════════════ */
.page {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity .3s ease, transform .3s ease;
}
.page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.page:not(.active) * { pointer-events: none !important; }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD — HOME PAGE
══════════════════════════════════════════════════════════════ */
.dashboard-wrap {
  width: 100%;
  padding: 32px clamp(16px, 3vw, 48px) 80px;
}

/* Section layout */
.dash-section { margin-top: 44px; }
.section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* Hero */
.dash-hero {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 260px);
  gap: clamp(16px, 2.5vw, 32px);
  align-items: start;
}
.dash-greeting {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  margin-bottom: 8px;
}
.dash-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 8px;
}
.dash-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dash-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* Continue card */
.continue-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: all .25s;
  box-shadow: var(--shadow-sm);
  max-width: 540px;
  position: relative;
  overflow: hidden;
}
.continue-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #06b6d4);
}
.continue-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cc-lang-dot {
  font-size: 26px;
  flex-shrink: 0;
  width: 48px; height: 48px;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.cc-body { flex: 1; min-width: 0; }
.cc-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  margin-bottom: 3px;
}
.cc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cc-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.cc-bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.cc-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #06b6d4);
  border-radius: 3px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.cc-pct { font-size: 11px; font-weight: 700; color: var(--text-muted); min-width: 28px; }
.cc-arrow {
  font-size: 20px;
  color: var(--text-muted);
  transition: all .2s;
  flex-shrink: 0;
}
.continue-card:hover .cc-arrow {
  color: var(--primary);
  transform: translateX(5px);
}

/* Stat cards */
.dash-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 240px;
}
.dash-stat {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.dash-stat::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.dash-stat.xp::after     { background: linear-gradient(90deg,#fbbf24,#f97316); }
.dash-stat.streak::after { background: linear-gradient(90deg,#fb923c,#ef4444); }
.dash-stat.done::after   { background: linear-gradient(90deg,#10b981,#06b6d4); }
.dash-stat.score::after  { background: linear-gradient(90deg,var(--primary),#8b5cf6); }
.dash-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ds-icon { font-size: 20px; margin-bottom: 4px; }
.ds-val  {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.5px;
}
.dash-stat.xp     .ds-val { color: #d97706; }
.dash-stat.streak .ds-val { color: #ea580c; }
.dash-stat.done   .ds-val { color: var(--success); }
.dash-stat.score  .ds-val { color: var(--primary); }
.ds-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Streak row */
.streak-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(14px, 2vw, 20px) clamp(16px, 2.5vw, 28px);
  box-shadow: var(--shadow-sm);
}
.streak-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-shrink: 0;
  min-width: 100px;
}
.streak-fire { font-size: 24px; }
.streak-num {
  font-size: 36px;
  font-weight: 800;
  color: #ea580c;
  line-height: 1;
  letter-spacing: -1px;
}
.streak-lbl { font-size: 13px; color: var(--text-muted); }

.streak-cal {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}
.sc-day {
  width: 52px; height: 52px;
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  border: 1.5px solid var(--border);
  gap: 2px;
  transition: all .2s;
}
.sc-day.active {
  background: #fff7ed;
  border-color: #fb923c;
  color: #9a3412;
}
.sc-day.today {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.sc-day .sc-xp { font-size: 8px; opacity: .7; }

.streak-spark-wrap {
  flex-shrink: 0;
  min-width: 130px;
  border-left: 1.5px solid var(--border);
  padding-left: 24px;
}
.spark-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin-bottom: 8px;
}
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 40px;
}
.spark-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--border);
  min-height: 3px;
  transition: height .6s cubic-bezier(.4,0,.2,1);
}
.spark-bar.has-xp { background: var(--primary-light); border: 1px solid #c4b5fd; }
.spark-bar.today  { background: var(--primary); }

/* ── Leaderboard ─────────────────────────────────────────────── */
.lb-tabs {
  display: flex; gap: 4px;
}
.lb-tab {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.lb-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.lb-tab:not(.active):hover {
  border-color: var(--primary);
  color: var(--primary);
}

.lb-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

/* Podium */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  padding: 28px 20px 0;
  border-bottom: 1.5px solid var(--border);
  background: linear-gradient(180deg, #faf9ff 0%, var(--bg-card) 100%);
}
.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.podium-slot.p2 { order: 1; }
.podium-slot.p1 { order: 2; transform: translateY(-14px); }
.podium-slot.p3 { order: 3; }

.podium-avatar {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: var(--bg);
  border: 2px solid var(--border);
  position: relative;
}
.podium-slot.p1 .podium-avatar {
  width: 56px; height: 56px;
  border-color: #fde68a;
  background: #fef3c7;
  box-shadow: 0 0 0 4px rgba(251,191,36,.2);
}
.podium-crown {
  position: absolute;
  top: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
}
.podium-name {
  font-size: 12px; font-weight: 600;
  color: var(--text);
  text-align: center;
  max-width: 80px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.podium-score {
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.podium-plinth {
  width: 80px;
  border-radius: 8px 8px 0 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
  padding: 10px 0;
}
.podium-slot.p1 .podium-plinth { height: 60px; background: linear-gradient(180deg,#fef3c7,#fde68a); color: #92400e; }
.podium-slot.p2 .podium-plinth { height: 46px; background: linear-gradient(180deg,#f1f5f9,#e2e8f0); color: #475569; }
.podium-slot.p3 .podium-plinth { height: 36px; background: linear-gradient(180deg,#fff7ed,#fed7aa); color: #7c2d12; }

/* Table rows */
.lb-table { padding: 4px 0; }
.lb-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(124,58,237,.03); }
.lb-row.is-you {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}
.lb-rank-num {
  font-size: 14px; font-weight: 700;
  text-align: center; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.lb-info-col { display: flex; align-items: center; gap: 10px; }
.lb-emoji {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.lb-uname {
  font-size: 14px; font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.you-badge {
  font-size: 9px; font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}
.lb-stats-row {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}
.lb-score-col { text-align: right; }
.lb-score-val {
  font-size: 16px; font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.lb-score-lbl { font-size: 10px; color: var(--text-muted); }

.your-rank-row {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.yr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  border: 1.5px solid #c4b5fd;
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 13px;
  color: var(--primary-dark);
}
.yr-chip strong { font-weight: 800; font-size: 15px; }

/* ── Course filters ─────────────────────────────────────────── */
.course-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.cf-pill {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.cf-pill:hover { border-color: var(--primary); color: var(--primary); }
.cf-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Course grid ─────────────────────────────────────────────── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: clamp(10px, 1.5vw, 16px);
}

.course-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all .25s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: fade-in-up .4s both;
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.course-card.in-progress { border-color: rgba(124,58,237,.3); }

.cc-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cc-icon-wrap {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.cc-runner-badge {
  position: absolute;
  bottom: -3px; right: -3px;
  font-size: 9px; font-weight: 700;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
  line-height: 1.4;
  font-family: 'JetBrains Mono', monospace;
}
.runner-python { color: #16a34a; }
.runner-node   { color: #15803d; }
.runner-sqlite { color: #0369a1; }
.runner-iframe { color: #7c3aed; }
.runner-ai     { color: var(--text-muted); }
.cc-tag-pill {
  font-size: 10px; font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.cc-name {
  font-size: 16px; font-weight: 700;
  color: var(--text); margin-bottom: 3px;
}
.cc-desc {
  font-size: 12px; color: var(--text-muted);
  line-height: 1.4; margin-bottom: 14px;
}
.cc-prog-row {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 6px;
}
.cc-prog-label { font-size: 11px; color: var(--text-muted); }
.cc-prog-pct   { font-size: 11px; font-weight: 700; color: var(--text-mid); }
.cc-prog-bar {
  height: 5px; background: var(--border);
  border-radius: 3px; overflow: hidden; margin-bottom: 14px;
}
.cc-prog-fill {
  height: 100%; border-radius: 3px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}
.cc-footer {
  display: flex; align-items: center; justify-content: space-between;
}
.cc-lesson-count { font-size: 11px; color: var(--text-muted); }
.cc-lesson-count strong { color: var(--text-mid); }
.cc-action-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-mid);
  font-size: 12px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.cc-action-btn:hover { background: var(--primary-light); border-color: #c4b5fd; color: var(--primary-dark); }
.cc-action-btn.resume { background: var(--primary-light); border-color: #c4b5fd; color: var(--primary-dark); }
.cc-action-btn.resume:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.cc-action-btn.done-btn { background: var(--success-light); border-color: #6ee7b7; color: #065f46; }

/* ══════════════════════════════════════════════════════════════
   LESSON PAGE
══════════════════════════════════════════════════════════════ */
#page-lesson { overflow: hidden; display: flex; }

#lesson-sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  transition: transform .3s ease;
  overflow-y: auto;
  z-index: 50;
  position: absolute;
  top: 0; bottom: 0; left: 0;
  transform: translateX(-100%);
}
#lesson-sidebar.sidebar-open { transform: translateX(0); }
#sidebar-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(0,0,0,.4); z-index: 49;
}
#sidebar-overlay.visible { display: block; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-back {
  background: none; border: none;
  color: #a5b4fc; font-size: 13px; cursor: pointer;
  font-family: inherit; font-weight: 500; padding: 0;
}
.sidebar-back:hover { color: #fff; }
.sidebar-close {
  background: none; border: none; color: #94a3b8;
  cursor: pointer; font-size: 16px; padding: 2px 6px;
}
.sidebar-close:hover { color: #fff; }
.sidebar-section-hdr {
  padding: 14px 18px 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: #818cf8;
}
.sidebar-lesson {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; font-size: 13px; color: #94a3b8;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar-lesson:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-lesson.active { background: rgba(124,58,237,.25); color: #c4b5fd; border-left-color: var(--primary); }
.sidebar-lesson.done { color: #6ee7b7; }
.sl-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; flex-shrink: 0; opacity: .5;
}
.sidebar-lesson.done .sl-dot   { background: var(--success); opacity: 1; }
.sidebar-lesson.active .sl-dot { background: var(--primary); opacity: 1; }

#lesson-main {
  flex: 1; display: flex; flex-direction: column;
  height: 100%; overflow: hidden; position: relative;
}
#lesson-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-menu {
  background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  width: 34px; height: 34px; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s; color: var(--text-mid);
}
.topbar-menu:hover { background: var(--bg); }
.topbar-back {
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; cursor: pointer; font-family: inherit;
  font-weight: 500; padding: 4px 8px; border-radius: 6px;
  transition: background .2s, color .2s; white-space: nowrap;
}
.topbar-back:hover { background: var(--bg); color: var(--text); }
.topbar-crumb {
  flex: 1; font-size: 13px; color: var(--text-mid);
  display: flex; align-items: center; gap: 4px; overflow: hidden;
}
.crumb-arrow { opacity: .4; }
#crumb-lesson {
  font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lesson-tabs {
  display: flex; gap: 4px;
  background: var(--bg); padding: 4px;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.ltab {
  padding: 6px 14px; border-radius: 6px; border: none;
  background: none; color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: all .2s;
}
.ltab:hover { background: var(--bg-card); color: var(--text); }
.ltab.active {
  background: var(--bg-card); color: var(--primary);
  font-weight: 600; box-shadow: var(--shadow-sm);
}

/* ── Tabs ──────────────────────────────────────────────────── */
.tab {
  position: absolute;
  top: 55px; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  padding: 28px 32px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.tab.active { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* Theory */
.theory-body {
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.75;
  font-size: 15px;
  color: var(--text);
}
.theory-body h3 { font-size: 20px; font-weight: 700; margin: 28px 0 10px; color: var(--text); }
.theory-body p  { margin-bottom: 14px; }
.theory-body code {
  background: #f1f5f9; color: var(--primary-dark);
  padding: 2px 7px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
}
.theory-body pre {
  background: #1e1b4b; color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 18px 20px; margin: 16px 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 1.7;
  box-shadow: var(--shadow-md);
}
.theory-body pre code { background: none; color: inherit; padding: 0; }

/* Quiz Gate */
.quiz-gate { max-width: 520px; margin: 40px auto 0; }
.gate-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 40px; text-align: center;
  box-shadow: var(--shadow-md); animation: pop-in .4s cubic-bezier(.4,0,.2,1);
}
.gate-mascot { font-size: 64px; margin-bottom: 16px; animation: float 3s ease-in-out infinite; }
.gate-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.gate-card p  { color: var(--text-mid); font-size: 14px; margin-bottom: 28px; }
.gate-btns { display: flex; gap: 12px; justify-content: center; }
.gate-btn-primary {
  padding: 11px 28px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.gate-btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124,58,237,.4); }
.gate-btn-secondary {
  padding: 11px 24px; background: var(--bg); color: var(--text-mid);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s;
}
.gate-btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* Quiz Tab */
.quiz-topbar {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 24px;
}
.quiz-progress-wrap { display: flex; align-items: center; gap: 12px; flex: 1; }
.quiz-progress-track {
  flex: 1; height: 8px; background: var(--border);
  border-radius: 99px; overflow: hidden; max-width: 340px;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #06b6d4);
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.quiz-prog-label { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.more-btn {
  padding: 7px 16px; background: var(--primary-light); color: var(--primary);
  border: 1.5px solid #c4b5fd; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s; white-space: nowrap;
}
.more-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.more-btn:disabled { opacity: .5; cursor: not-allowed; }

.mcq-stage { max-width: 660px; margin: 0 auto; }
.mcq-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow-sm);
  animation: slide-in .3s cubic-bezier(.4,0,.2,1);
}
.mcq-card-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.mcq-difficulty-badge {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 99px;
}
.badge-easy   { background: #d1fae5; color: #065f46; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-hard   { background: #fee2e2; color: #991b1b; }
.badge-expert { background: var(--primary-light); color: var(--primary-dark); }
.mcq-qnum { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.mcq-question { font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--text); margin-bottom: 20px; }
.options-grid { display: flex; flex-direction: column; gap: 10px; }
.option-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); cursor: pointer;
  transition: all .2s; background: var(--bg);
}
.option-row:hover:not(.locked) { border-color: var(--primary); background: var(--primary-light); }
.option-row.selected { border-color: var(--primary); background: var(--primary-light); }
.option-row.correct  { border-color: var(--success); background: var(--success-light); animation: bounce-in .4s ease; }
.option-row.wrong    { border-color: var(--danger); background: var(--danger-light); animation: shake .4s ease; }
.option-row.locked   { cursor: default; }
.opt-key {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--border); display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700;
  flex-shrink: 0; transition: background .2s; color: var(--text-mid);
}
.option-row.selected .opt-key { background: var(--primary); color: white; }
.option-row.correct .opt-key  { background: var(--success); color: white; }
.option-row.wrong .opt-key    { background: var(--danger); color: white; }
.opt-text { font-size: 14px; line-height: 1.5; color: var(--text); }
.mcq-footer { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.check-btn {
  padding: 10px 24px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s; align-self: flex-start;
  box-shadow: 0 2px 8px rgba(124,58,237,.3);
}
.check-btn:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.check-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.next-btn {
  padding: 10px 24px; background: var(--success); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s; align-self: flex-start;
  animation: pop-in .3s ease;
}
.next-btn:hover { background: #059669; transform: translateY(-1px); }
.mcq-feedback {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.5; animation: fade-in .3s ease;
}
.mcq-feedback.pass { background: var(--success-light); color: #065f46; border-left: 3px solid var(--success); }
.mcq-feedback.fail { background: var(--danger-light); color: #991b1b; border-left: 3px solid var(--danger); }

/* Code Tab */
#tab-code { padding: 20px 24px; }
.code-layout {
  display: flex; gap: 20px;
  height: calc(100vh - var(--nav-h) - 115px - 48px);
  min-height: 400px;
}
.code-info-col {
  width: 300px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; min-height: 0;
}
.code-editor-col {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; border-radius: var(--radius);
  overflow: clip; border: 1.5px solid var(--border);
  box-shadow: var(--shadow-md);
}
.code-qnav { display: flex; flex-wrap: wrap; gap: 6px; }
.cq-btn {
  padding: 6px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-card);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; color: var(--text-mid); transition: all .2s;
}
.cq-btn:hover  { border-color: var(--primary); color: var(--primary); }
.cq-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.cq-btn.solved { background: var(--success-light); border-color: #6ee7b7; color: #065f46; }
.challenge-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.challenge-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--primary); margin-bottom: 8px;
}
.challenge-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.challenge-card p  { font-size: 13px; color: var(--text-mid); line-height: 1.6; }
.output-panel {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); flex: 1;
  display: flex; flex-direction: column; min-height: 120px;
}
.output-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg); flex-shrink: 0;
}
.out-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background .3s; }
.out-dot.pass { background: var(--success); animation: pulse-dot .6s ease; }
.out-dot.fail { background: var(--danger); animation: pulse-dot .6s ease; }
.out-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.out-status { font-size: 12px; font-weight: 600; margin-left: auto; }
.out-status.pass { color: var(--success); }
.out-status.fail { color: var(--danger); }
.ai-btn {
  padding: 4px 10px; background: var(--primary-light); color: var(--primary);
  border: 1px solid #c4b5fd; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s;
}
.ai-btn:hover { background: var(--primary); color: white; }
.out-content {
  padding: 14px; font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; flex: 1; overflow-y: auto;
}
.out-content.has-pass  { color: var(--success); }
.out-content.has-error { color: var(--danger); }
.more-code-btn { align-self: flex-start; margin-top: 4px; }
.editor-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: #1e1b4b; flex-shrink: 0;
}
.lang-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; background: rgba(124,58,237,.4);
  color: #c4b5fd; padding: 3px 10px; border-radius: 99px;
}
.editor-hint { font-size: 11px; color: #6366f1; }
.editor-actions { margin-left: auto; display: flex; gap: 8px; }
.hint-btn {
  padding: 5px 12px; background: rgba(255,255,255,.08);
  color: #94a3b8; border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px; font-size: 12px; cursor: pointer;
  font-family: inherit; transition: all .2s;
}
.hint-btn:hover { background: rgba(255,255,255,.14); color: white; }
.run-btn {
  padding: 5px 16px; background: var(--success); color: white;
  border: none; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .2s;
  display: flex; align-items: center; gap: 5px;
}
.run-btn:hover:not(:disabled) { background: #059669; }
.run-btn:disabled { opacity: .5; cursor: not-allowed; }
#monaco-container { flex: 1; min-height: 0; }

/* Complete Bar */
.complete-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  color: white; display: flex; align-items: center;
  justify-content: space-between; padding: 14px 32px;
  font-size: 15px; font-weight: 600; z-index: 10;
  animation: slide-up .4s cubic-bezier(.4,0,.2,1);
}
.complete-bar button {
  padding: 8px 22px; background: white; color: var(--primary);
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: transform .2s;
}
.complete-bar button:hover { transform: scale(1.04); }

/* Center State / Loading */
.center-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 80px 20px; text-align: center;
}
.loading-text { font-size: 15px; color: var(--text-muted); font-weight: 500; }
.loading-snake { font-size: 52px; animation: float 2s ease-in-out infinite; display: block; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; animation: fade-in .2s ease;
}
.modal-box {
  background: var(--bg-card); border-radius: var(--radius);
  width: 90%; max-width: 680px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop-in .3s cubic-bezier(.4,0,.2,1);
}
.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700;
}
.modal-hdr button { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); }
.modal-body {
  padding: 20px; font-size: 14px; line-height: 1.7;
  color: var(--text); max-height: 400px; overflow-y: auto; white-space: pre-wrap;
}

/* XP Pop + Confetti */
.xp-pop {
  position: fixed;
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  color: white; padding: 6px 16px; border-radius: 99px;
  font-size: 14px; font-weight: 700; pointer-events: none; z-index: 300;
  animation: xp-float 1.5s cubic-bezier(.4,0,.2,1) forwards;
  white-space: nowrap; box-shadow: 0 4px 14px rgba(124,58,237,.4);
}
.conf-piece {
  position: fixed; width: 8px; height: 12px;
  pointer-events: none; z-index: 300; border-radius: 2px;
  animation: confetti-fall linear forwards;
}

/* Util */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   KEYFRAMES
══════════════════════════════════════════════════════════════ */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes pop-in {
  0%   { opacity: 0; transform: scale(.9); }
  70%  { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes bounce-in {
  0%, 100% { transform: scale(1); }
  40%       { transform: scale(1.03); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
@keyframes pulse-dot {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.6); }
  100% { transform: scale(1); }
}
@keyframes xp-float {
  0%   { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-60px); }
}
@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════
   DARK THEME
══════════════════════════════════════════════════════════════ */
html[data-theme="dark"] {
  --bg:           #1a1a1a;
  --bg-card:      #282828;
  --sidebar-bg:   #1a1a1a;
  --sidebar-hover:#323232;
  --primary:      #ffa116;
  --primary-light:rgba(255,161,22,.15);
  --primary-dark: #e08e00;
  --success:      #00b8a3;
  --success-light:rgba(0,184,163,.15);
  --danger:       #ef4743;
  --danger-light: rgba(239,71,67,.15);
  --text:         #eff1f6;
  --text-mid:     #b3b3b3;
  --text-muted:   #6b6b6b;
  --border:       #3c3c3c;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.35);
  --shadow-md:    0 4px 16px rgba(0,0,0,.45);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.55);
}
html[data-theme="dark"] .xp-chip     { background:#2d2600; border-color:#5a4500; color:#fbbf24; }
html[data-theme="dark"] .streak-chip { background:#2d1a00; border-color:#5a3000; color:#fb923c; }
html[data-theme="dark"] .done-chip   { background:#1a1030; border-color:#3c2060; color:#c4b5fd; }
html[data-theme="dark"] .option-row  { background:#323232; }
html[data-theme="dark"] .challenge-card,
html[data-theme="dark"] .output-panel,
html[data-theme="dark"] .gate-card,
html[data-theme="dark"] .mcq-card    { background:#282828; }
html[data-theme="dark"] .opt-key     { background:#3c3c3c; color:#b3b3b3; }
html[data-theme="dark"] .theory-body code { background:#323232; color:#ffa116; }
html[data-theme="dark"] .cq-btn      { background:#323232; }
html[data-theme="dark"] .output-header { background:#1a1a1a; }
html[data-theme="dark"] .continue-nav-btn { box-shadow: 0 2px 10px rgba(255,161,22,.25); }
html[data-theme="dark"] .dash-stat.xp     .ds-val { color: #fbbf24; }
html[data-theme="dark"] .dash-stat.streak .ds-val { color: #fb923c; }
html[data-theme="dark"] .streak-num  { color: #fb923c; }
html[data-theme="dark"] .sc-day.active { background: rgba(251,146,60,.15); border-color: #c2410c; color: #fb923c; }
html[data-theme="dark"] .lb-row.is-you { background: rgba(255,161,22,.07); border-left-color: var(--primary); }
html[data-theme="dark"] .yr-chip { border-color: rgba(255,161,22,.3); color: var(--primary); background: rgba(255,161,22,.08); }
html[data-theme="dark"] .lb-podium { background: linear-gradient(180deg,#222 0%,#282828 100%); }
html[data-theme="dark"] .podium-slot.p1 .podium-avatar { background: rgba(251,191,36,.1); }
html[data-theme="dark"] .podium-slot.p1 .podium-plinth { background: rgba(251,191,36,.2); color: #fbbf24; }
html[data-theme="dark"] .podium-slot.p2 .podium-plinth { background: rgba(148,163,184,.1); color: #94a3b8; }
html[data-theme="dark"] .podium-slot.p3 .podium-plinth { background: rgba(205,124,47,.1); color: #cd7c2f; }
html[data-theme="dark"] .course-card.in-progress { border-color: rgba(255,161,22,.25); }
html[data-theme="dark"] .cc-action-btn.done-btn { background: rgba(0,184,163,.1); border-color: rgba(0,184,163,.3); color: var(--success); }

/* ══════════════════════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 800px) {
  .dash-hero { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: repeat(4, 1fr); min-width: 0; }
  .lb-podium { padding: 16px 12px 0; }
  .podium-plinth { width: 60px; }
}
@media (max-width: 560px) {
  .dashboard-wrap { padding: 24px 16px 60px; }
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .continue-nav-btn { display: none; }
  .streak-spark-wrap { display: none; }
  .nav-stats { gap: 4px; }
  .stat-chip { padding: 4px 8px; font-size: 12px; }
}
/* ══════════════════════════════════════════════════════════════
   COURSE CARD — remove button, add explore hint
══════════════════════════════════════════════════════════════ */
.cc-action-btn { display: none; }
.cc-explore-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  opacity: 0;
  transition: opacity .2s;
}
.course-card:hover .cc-explore-hint { opacity: 1; }
.cc-status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}
.cc-status-dot.done   { background: var(--success-light); color: var(--success); }
.cc-status-dot.inprog {
  background: var(--primary-light);
  border: 2px solid var(--primary);
  animation: pulse-dot 2s infinite;
}

/* ══════════════════════════════════════════════════════════════
   LANGUAGE SECTIONS PAGE
══════════════════════════════════════════════════════════════ */
#page-lang-sections { overflow-y: auto; }

.lsp-wrap {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px clamp(16px, 3vw, 40px) 80px;
}

.lsp-header {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px,2.5vw,28px) clamp(18px,2.5vw,28px) clamp(16px,2vw,22px);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.lsp-back-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  padding: 0 0 14px 0;
  display: block;
  transition: color .15s;
}
.lsp-back-btn:hover { color: var(--primary); }

.lsp-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.lsp-lang-icon-big {
  font-size: 40px;
  width: 64px; height: 64px;
  background: var(--bg);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
}
.lsp-lang-name {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 3px;
}
.lsp-lang-desc { font-size: 13px; color: var(--text-muted); }

.lsp-resume-btn {
  margin-left: auto;
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: all .2s;
  box-shadow: 0 2px 10px rgba(124,58,237,.25);
  white-space: nowrap;
}
.lsp-resume-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
}

.lsp-prog-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 8px;
}
.lsp-prog-pct { margin-left: auto; font-weight: 700; color: var(--primary); }
.lsp-prog-track {
  height: 8px; background: var(--border);
  border-radius: 99px; overflow: hidden;
}
.lsp-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #06b6d4);
  border-radius: 99px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* Sections accordion */
.lsp-sections-list { display: flex; flex-direction: column; gap: 10px; }

.lsp-section {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s;
}
.lsp-section.lsp-inprog { border-color: rgba(124,58,237,.35); }
.lsp-section.lsp-done   { border-color: rgba(16,185,129,.3); }

.lsp-sec-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.lsp-sec-hdr:hover { background: rgba(0,0,0,.025); }
.lsp-sec-icon { font-size: 18px; flex-shrink: 0; }
.lsp-sec-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.lsp-sec-count { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.lsp-sec-bar {
  width: 80px; height: 5px;
  background: var(--border); border-radius: 99px; overflow: hidden;
  flex-shrink: 0;
}
.lsp-sec-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #06b6d4);
  border-radius: 99px;
  transition: width .6s ease;
}
.lsp-section.lsp-done .lsp-sec-fill { background: linear-gradient(90deg, var(--success), #06b6d4); }
.lsp-check { color: var(--success); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.lsp-chevron {
  color: var(--text-muted); font-size: 18px; font-weight: 600;
  transition: transform .2s; flex-shrink: 0;
}
.lsp-section.lsp-open .lsp-chevron { transform: rotate(90deg); }

/* Lessons inside section */
.lsp-sec-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.4,0,.2,1);
  border-top: 0px solid var(--border);
}
.lsp-section.lsp-open .lsp-sec-body,
.lsp-section.lsp-inprog .lsp-sec-body {
  max-height: 2000px;
  border-top-width: 1px;
}

.lsp-lessons {
  padding: 6px 0;
}
.sl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px 9px 24px;
  cursor: pointer;
  transition: background .15s;
  border-left: 3px solid transparent;
}
.sl-item:hover { background: rgba(124,58,237,.04); }
.sl-item.sl-done { border-left-color: var(--success); }
.sl-item.sl-next { border-left-color: var(--primary); background: var(--primary-light); }

.sl-dot-done { color: var(--success); font-weight: 700; font-size: 13px; flex-shrink: 0; width: 18px; text-align: center; }
.sl-dot-next { color: var(--primary); font-size: 11px; flex-shrink: 0; width: 18px; text-align: center; }
.sl-dot-todo { color: var(--text-muted); font-size: 11px; flex-shrink: 0; width: 18px; text-align: center; }

.sl-name { font-size: 13px; color: var(--text); flex: 1; }
.sl-item.sl-done .sl-name { color: var(--text-muted); }
.sl-item.sl-next .sl-name { color: var(--primary-dark); font-weight: 600; }

.sl-next-tag {
  font-size: 9px; font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .5px;
}

/* ══════════════════════════════════════════════════════════════
   FULLY DYNAMIC RESPONSIVE OVERRIDES
══════════════════════════════════════════════════════════════ */
/* Large screens — expand everything */
@media (min-width: 1400px) {
  .dashboard-wrap { padding: 36px clamp(48px, 6vw, 120px) 80px; }
  .courses-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .lb-podium { padding: 32px 32px 0; }
}

/* Medium screens */
@media (max-width: 960px) {
  .dash-hero { grid-template-columns: 1fr; gap: 20px; }
  .dash-stats {
    grid-template-columns: repeat(4, 1fr);
    min-width: 0;
  }
  .streak-row { grid-template-columns: auto 1fr; }
  .streak-spark-wrap { display: none; }
}

/* Tablet */
@media (max-width: 700px) {
  .lsp-resume-btn { margin-left: 0; width: 100%; text-align: center; }
  .lsp-title-row  { gap: 12px; }
  .lsp-sec-bar    { display: none; }
  .courses-grid   { grid-template-columns: 1fr 1fr; }
  .streak-row     { grid-template-columns: 1fr; gap: 16px; }
  .streak-cal     { justify-content: flex-start; }
}

/* Mobile */
@media (max-width: 480px) {
  .dashboard-wrap { padding: 16px 14px 60px; }
  .courses-grid   { grid-template-columns: 1fr; }
  .dash-stats     { grid-template-columns: 1fr 1fr; }
  .lb-podium      { padding: 16px 12px 0; }
  .podium-plinth  { width: 60px; }
  .lb-row         { grid-template-columns: 36px 1fr auto; padding: 10px 12px; }
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE — sections page additions
══════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .lsp-section.lsp-inprog { border-color: rgba(255,161,22,.25); }
html[data-theme="dark"] .lsp-sec-hdr:hover { background: rgba(255,255,255,.04); }
html[data-theme="dark"] .sl-item:hover { background: rgba(255,161,22,.04); }
html[data-theme="dark"] .sl-item.sl-next { background: rgba(255,161,22,.08); border-left-color: var(--primary); }
html[data-theme="dark"] .sl-item.sl-next .sl-name { color: var(--primary); }
html[data-theme="dark"] .lsp-prog-fill { background: linear-gradient(90deg, var(--primary), #06b6d4); }
/* ══════════════════════════════════════════════════════════════
   RESIZABLE CODE PANELS
══════════════════════════════════════════════════════════════ */
.resize-handle {
  width: 8px;
  flex-shrink: 0;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background .15s;
  align-self: stretch;
}
.resize-handle:hover { background: var(--primary-light); }
.resize-grip {
  width: 3px;
  height: 40px;
  border-radius: 2px;
  background: var(--border);
  transition: background .15s;
  pointer-events: none;
}
.resize-handle:hover .resize-grip { background: var(--primary); }

/* ── Lesson items always clickable ─────────────────────────── */
.sl-item { cursor: pointer; }
.sl-item:hover .sl-name { color: var(--primary) !important; text-decoration: underline; }
/* ══════════════════════════════════════════════════════════════
   AUTH UI — nav user, login modal, google button
══════════════════════════════════════════════════════════════ */

/* Nav user area */
.nav-user {
  position: relative;
  margin-left: auto;
  margin-right: 8px;
}
.nav-login-btn {
  padding: 7px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.nav-login-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  transition: all .15s;
}
.nav-user-info:hover { border-color: var(--primary); }

.nav-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.nav-avatar-initials {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.nav-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown menu */
.nav-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  animation: fade-in .15s ease;
}
.num-email {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}
.num-signout {
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.num-signout:hover { background: var(--danger-light); }

/* Login modal */
.login-modal-box {
  max-width: 400px !important;
  border-radius: 20px !important;
}
.login-modal-inner {
  padding: 36px 32px 28px;
  text-align: center;
}
.login-logo {
  font-size: 40px;
  margin-bottom: 12px;
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* Google login button */
.google-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: #fff;
  color: #1e293b;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  margin-bottom: 12px;
}
.google-login-btn:hover {
  border-color: #4285F4;
  box-shadow: 0 2px 8px rgba(66,133,244,.2);
  transform: translateY(-1px);
}
html[data-theme="dark"] .google-login-btn {
  background: #2a2a2a;
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] .google-login-btn:hover {
  border-color: #4285F4;
}

.login-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.login-skip-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 4px;
  transition: color .15s;
}
.login-skip-btn:hover { color: var(--text); }