/* ===== CSS Variables ===== */
:root {
  --purple-deep:    #7B2FBE;
  --purple-mid:     #9333EA;
  --purple-light:   #A855F7;
  --purple-pale:    #F3E8FF;
  --purple-glow:    rgba(168, 85, 247, 0.15);

  --bg:             #ffffff;
  --bg-secondary:   #f8f7ff;
  --sidebar-bg:     #0f0f1a;
  --sidebar-text:   #c4b5fd;
  --sidebar-hover:  rgba(168, 85, 247, 0.12);
  --sidebar-active: rgba(168, 85, 247, 0.2);

  --text-primary:   #1a1a2e;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;

  --card-shadow:    0 2px 16px rgba(123, 47, 190, 0.08);
  --border:         rgba(123, 47, 190, 0.15);

  --topbar-h:       60px;
  --sidebar-w:      260px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Background Orbs ===== */
.orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}
.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(123,47,190,0.12) 0%, transparent 70%);
  top: -200px; right: -100px;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,0.08) 0%, transparent 70%);
  bottom: -150px; left: 50px;
}

/* ===== Top Bar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  z-index: 100;
  box-shadow: 0 1px 12px rgba(123,47,190,0.06);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: fit-content;
}
.logo-icon {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
}
.claude-icon {
  width: 28px;
  height: 28px;
  display: block;
}
.logo-text {
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
/* On desktop, collapse the word-spans into a single line */
.logo-text span { display: inline; }
.logo-text span:not(:last-child)::after { content: ' '; }

.topbar-nav {
  display: flex;
  gap: 6px;
  flex: 1;
}
.nav-tab {
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background: transparent;
  color: var(--text-secondary);
}
.nav-tab:hover {
  background: var(--purple-pale);
  color: var(--purple-deep);
}
.nav-tab.active {
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  color: #fff;
  box-shadow: 0 2px 10px rgba(123,47,190,0.3);
}

.model-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--purple-pale);
  color: var(--purple-deep);
  font-weight: 500;
  font-family: 'SF Mono', 'Fira Code', monospace;
  white-space: nowrap;
}

/* ===== App Layout ===== */
.app-layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(168,85,247,0.3) transparent;
  z-index: 50;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.3); border-radius: 2px; }

.sidebar-header {
  padding: 20px 16px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(196,181,253,0.5);
}

.toc-chapter { border-bottom: 1px solid rgba(255,255,255,0.04); }

.toc-chapter-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s;
}
.toc-chapter-btn:hover { background: var(--sidebar-hover); }
.toc-chapter.open .toc-chapter-btn { color: #e9d5ff; }

.toc-icon { font-size: 0.95rem; flex-shrink: 0; }
.toc-title { flex: 1; line-height: 1.3; }
.toc-arrow {
  font-size: 1rem;
  color: rgba(196,181,253,0.4);
  transition: transform 0.2s;
}
.toc-chapter.open .toc-arrow { transform: rotate(90deg); color: var(--purple-light); }

.toc-sections {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.toc-section-link {
  display: block;
  padding: 7px 16px 7px 40px;
  color: rgba(196,181,253,0.6);
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.toc-section-link:hover {
  color: #e9d5ff;
  background: var(--sidebar-hover);
}
.toc-section-link.active {
  color: var(--purple-light);
  border-left-color: var(--purple-light);
  background: var(--sidebar-active);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 40px 48px;
  max-width: 100%;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Theory Content ===== */
.chapter-block {
  margin-bottom: 60px;
}

.chapter-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.chapter-icon { font-size: 2rem; }
.chapter-heading h2 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-block {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}

.section-title {
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--purple-deep);
  background: linear-gradient(to right, var(--purple-pale), transparent);
  border-bottom: 1px solid var(--border);
}

.section-body {
  padding: 20px 24px;
}

.section-text {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-line;
}
.section-text strong { color: var(--text-primary); font-weight: 600; }
.section-text code {
  background: var(--purple-pale);
  color: var(--purple-deep);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.88em;
}

/* Callout boxes */
.callout {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
  border-left: 4px solid;
}
.callout-tip {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #166534;
}
.callout-warning {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}
.callout-info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.theory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.theory-table th {
  background: var(--purple-pale);
  color: var(--purple-deep);
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.theory-table td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(123,47,190,0.06);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
}
.theory-table tr:last-child td { border-bottom: none; }
.theory-table tr:hover td { background: var(--bg-secondary); }

/* Code blocks */
.code-block-wrapper {
  position: relative;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.code-block {
  background: #1a1a2e;
  color: #e2e8f0;
  padding: 20px 24px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.83rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
.copy-btn {
  position: absolute;
  top: 10px; right: 12px;
  padding: 4px 10px;
  background: rgba(168,85,247,0.2);
  color: var(--purple-light);
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover {
  background: rgba(168,85,247,0.35);
}

/* ===== Exam ===== */
.exam-header {
  margin-bottom: 28px;
}
.exam-header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.exam-header p { color: var(--text-secondary); font-size: 0.95rem; }

.exam-stats {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-mid));
  border-radius: var(--radius-md);
  padding: 20px 28px;
  margin-bottom: 32px;
  box-shadow: 0 4px 20px rgba(123,47,190,0.25);
}
.stat-box { text-align: center; padding: 0 16px; }
.stat-val {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}
.stat-val.errors { color: #fca5a5; }
.stat-val.success { color: #86efac; }
.stat-val.answered { color: #fde68a; }
.stat-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}
.reset-btn {
  margin-left: auto;
  padding: 10px 20px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.2s;
}
.reset-btn:hover { background: rgba(255,255,255,0.25); }

.exam-scenario {
  margin-bottom: 48px;
}
.scenario-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--purple-deep);
  padding: 16px 20px;
  background: var(--purple-pale);
  border-left: 4px solid var(--purple-deep);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.exam-question {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  border-top: 3px solid var(--purple-light);
  padding: 24px;
  margin-bottom: 20px;
}

.q-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--purple-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.q-situation {
  background: var(--bg-secondary);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--purple-light);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.q-situation strong { color: var(--purple-deep); }

.q-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.q-options { display: flex; flex-direction: column; gap: 10px; }

.q-option {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-left: 4px solid #ddd;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  line-height: 1.6;
}
.q-option:hover:not(.answered) {
  background: var(--purple-pale);
  border-left-color: var(--purple-light);
  transform: translateX(4px);
}

.opt-label {
  font-weight: 700;
  color: var(--purple-light);
  flex-shrink: 0;
  min-width: 22px;
}
.opt-text { color: var(--text-secondary); }

.q-option.answered { cursor: default; }
.q-option.correct {
  background: #f0fdf4;
  border-left-color: #22c55e;
  border-color: #bbf7d0;
}
.q-option.correct .opt-label { color: #16a34a; }
.q-option.correct::after {
  content: " ✓";
  color: #16a34a;
  font-weight: 700;
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
}
.q-option.incorrect {
  background: #fff1f2;
  border-left-color: #ef4444;
  border-color: #fecaca;
}
.q-option.incorrect .opt-label { color: #dc2626; }
.q-option.incorrect::after {
  content: " ✗";
  color: #dc2626;
  font-weight: 700;
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
}

.q-feedback {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
}
.feedback-correct {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.feedback-incorrect {
  background: #fff1f2;
  border: 1px solid #fecaca;
}
.feedback-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.feedback-correct .feedback-title { color: #16a34a; }
.feedback-incorrect .feedback-title { color: #dc2626; }
.feedback-explanation { color: var(--text-secondary); }

/* ===== Courses Page ===== */
.courses-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.courses-header-text h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.courses-header-text p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.courses-header-text a {
  color: var(--purple-mid);
  text-decoration: none;
}
.courses-header-text a:hover { text-decoration: underline; }

.courses-portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  color: #fff;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(123,47,190,0.3);
  transition: box-shadow 0.2s, transform 0.2s;
}
.courses-portal-btn:hover {
  box-shadow: 0 6px 20px rgba(123,47,190,0.4);
  transform: translateY(-1px);
}

.courses-group {
  margin-bottom: 48px;
}
.courses-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.courses-group-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.group-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  color: #fff;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.course-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  padding: 22px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.course-card:hover {
  box-shadow: 0 6px 24px rgba(123,47,190,0.13);
  transform: translateY(-2px);
}

.course-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.course-icon { font-size: 1.8rem; }
.course-level {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid;
}

.course-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.course-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 18px;
}

.course-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  background: var(--purple-pale);
  color: var(--purple-deep);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(123,47,190,0.2);
  transition: all 0.2s;
  align-self: flex-start;
}
.course-btn:hover {
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(123,47,190,0.3);
}

/* ===== Theory Attribution ===== */
.theory-attribution {
  margin-top: 40px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.theory-attribution a {
  color: var(--purple-mid);
  text-decoration: none;
}
.theory-attribution a:hover {
  text-decoration: underline;
}

/* ===== Progress Widget (topbar) ===== */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.progress-widget {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-track {
  width: 100px;
  height: 6px;
  background: rgba(123,47,190,0.15);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-deep), var(--purple-light));
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--purple-deep);
  min-width: 32px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ===== Theory: Section Checkboxes ===== */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-text {
  flex: 1;
}

.section-checkbox-label {
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.section-checkbox {
  display: none;
}

.section-checkbox-ui {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(123,47,190,0.3);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background: #fff;
}

.section-checkbox-ui::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0;
  transition: opacity 0.15s;
}

.section-checkbox:checked + .section-checkbox-ui {
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  border-color: transparent;
}

.section-checkbox:checked + .section-checkbox-ui::after {
  opacity: 1;
}

.section-checkbox-label:hover .section-checkbox-ui {
  border-color: var(--purple-light);
}

.section-block.section-done {
  opacity: 0.7;
}

.section-block.section-done .section-title {
  background: linear-gradient(to right, rgba(168,85,247,0.08), transparent);
}

/* ===== TOC: Done dots & chapter progress ===== */
.toc-section-link {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-done-dot {
  font-size: 0.55rem;
  color: var(--purple-light);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.toc-done-dot.visible {
  opacity: 1;
}

.toc-chapter-progress {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 16px;
}

.toc-chapter.open .toc-chapter-progress {
  /* height is set by JS via maxHeight */
}

.toc-progress-bar {
  height: 3px;
  background: rgba(196,181,253,0.2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.toc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-deep), var(--purple-light));
  border-radius: 2px;
  transition: width 0.4s ease;
}

.toc-progress-label {
  font-size: 0.68rem;
  color: rgba(196,181,253,0.5);
  display: block;
  text-align: right;
}

/* ===== Exam: Scenario Pills ===== */
.scenario-pills {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.scenario-pill {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.2);
  white-space: nowrap;
}

.scenario-pill.pill-done {
  background: rgba(134,239,172,0.2);
  color: #86efac;
  border-color: rgba(134,239,172,0.4);
}

/* ===== Courses: Complete Button ===== */
.course-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.course-complete-btn {
  padding: 9px 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(123,47,190,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.course-complete-btn:hover {
  border-color: var(--purple-light);
  color: var(--purple-deep);
}

.course-complete-btn.is-done {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
  font-weight: 600;
}

.course-card.course-completed {
  border-color: #bbf7d0;
  box-shadow: 0 2px 16px rgba(34,197,94,0.1);
}

.course-card.course-completed .course-title::after {
  content: ' ✓';
  color: #16a34a;
  font-size: 0.85em;
}

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a0a2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(123,47,190,0.35);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo-icon { font-size: 2rem; }

.login-logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.google-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px 24px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.google-signin-btn:hover:not(:disabled) {
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
  background: #f8f9fa;
}

.google-signin-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.google-icon { flex-shrink: 0; }

.login-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fff1f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 0.85rem;
  text-align: left;
}

/* ===== User Badge (topbar) ===== */
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 3px;
  background: var(--purple-pale);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.user-badge-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.user-badge-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--purple-deep);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signout-btn {
  padding: 4px 12px;
  background: var(--purple-deep);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.signout-btn:hover { background: var(--purple-mid); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 24px 20px; }
}
@media (max-width: 600px) {
  /* Two-row topbar: logo+right on top, scrollable nav below */
  :root { --topbar-h: 96px; }

  .topbar {
    flex-direction: column;
    height: auto;
    padding: 0;
    align-items: stretch;
  }

  /* Row 1: logo left, right controls right — single flex row */
  .topbar-logo {
    padding: 0 14px;
    height: 48px;
    flex: 1 1 auto;
    order: 1;
    min-width: 0;
  }
  .topbar-right {
    position: absolute;
    right: 0;
    top: 0;
    height: 48px;
    padding: 0 14px;
    margin-left: 0;
  }

  /* Row 2: nav scrolls horizontally across full width */
  .topbar-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid var(--border);
    padding: 6px 12px;
    gap: 6px;
    flex-wrap: nowrap;
    height: 48px;
    align-items: center;
  }
  .topbar-nav::-webkit-scrollbar { display: none; }

  .nav-tab {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* Keep app layout offset correct */
  .app-layout { padding-top: var(--topbar-h); }
  .sidebar    { top: var(--topbar-h); }

  .logo-text {
    display: flex;
    flex-direction: column;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.25;
    white-space: nowrap;
  }
  .model-badge { display: none; }
  .progress-track { width: 60px; }
  .exam-stats { padding: 16px; }
  .stat-box { padding: 0 8px; }
  .stat-val { font-size: 1.5rem; }
  .user-badge-name { display: none; }
}

/* ===== Home Page ===== */
:root {
  --home-bg: #09090f;
  --home-surface: rgba(13,13,22,0.55);
  --home-border: rgba(255,255,255,0.08);
  --home-text-dim: rgba(255,255,255,0.55);
  --home-text-bright: rgba(255,255,255,0.92);
}

@keyframes home-orb-float {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(40px, -30px) scale(1.06); }
  66%  { transform: translate(-20px, 20px) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes home-orb-float-2 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-50px, 25px) scale(1.08); }
  66%  { transform: translate(30px, -20px) scale(0.93); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes home-orb-pulse {
  0%, 100% { opacity: 0.75; }
  50%       { opacity: 1; }
}
@keyframes home-fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes home-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

#tab-home {
  margin: -40px -48px;
  background: var(--home-bg);
  min-height: calc(100vh - var(--topbar-h));
  position: relative;
  overflow: hidden;
}

.home-orb-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.home-orb-hero {
  position: absolute;
  width: 700px;
  height: 700px;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(123,47,190,0.45) 0%, rgba(168,85,247,0.15) 50%, transparent 70%);
  filter: blur(70px);
  animation: home-orb-float 18s ease-in-out infinite, home-orb-pulse 6s ease-in-out infinite;
}
.home-orb-accent {
  position: absolute;
  width: 500px;
  height: 500px;
  bottom: 10%;
  right: -100px;
  background: radial-gradient(circle, rgba(217,70,219,0.35) 0%, rgba(168,85,247,0.1) 50%, transparent 70%);
  filter: blur(60px);
  animation: home-orb-float-2 22s ease-in-out infinite, home-orb-pulse 8s ease-in-out infinite 1s;
}
.home-orb-secondary {
  position: absolute;
  width: 400px;
  height: 400px;
  top: 40%;
  left: -80px;
  background: radial-gradient(circle, rgba(6,182,212,0.25) 0%, rgba(99,102,241,0.1) 50%, transparent 70%);
  filter: blur(80px);
  animation: home-orb-float 26s ease-in-out infinite 4s, home-orb-pulse 10s ease-in-out infinite 2s;
}

#homeInner {
  position: relative;
  z-index: 1;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 70vh;
  justify-content: center;
  padding: 80px 40px 60px;
  animation: home-fade-up 0.7s ease both;
}

.home-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.3);
  color: #c084fc;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-bottom: 28px;
}
.home-eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a855f7;
  box-shadow: 0 0 8px 2px rgba(168,85,247,0.7);
  animation: home-orb-pulse 2.5s ease-in-out infinite;
}

.home-hero-title {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}
.home-hero-title-plain {
  color: var(--home-text-bright);
  display: block;
}
.home-hero-title-accent {
  display: inline-block;
  background: linear-gradient(90deg, #a855f7, #ec4899, #06b6d4, #a855f7);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: home-shimmer 4s linear infinite;
}

.home-hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--home-text-dim);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.home-hero-cta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.home-cta-primary {
  padding: 14px 32px;
  background: linear-gradient(135deg, #7b2fbe, #a855f7);
  color: #fff;
  border: none;
  border-radius: 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(168,85,247,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.home-cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(168,85,247,0.6);
}

.home-cta-secondary {
  padding: 14px 32px;
  background: rgba(255,255,255,0.06);
  color: var(--home-text-bright);
  border: 1px solid var(--home-border);
  border-radius: 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.home-cta-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(168,85,247,0.4);
  transform: translateY(-2px);
}

.home-stats-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 28px 40px;
  background: var(--home-surface);
  border-top: 1px solid var(--home-border);
  border-bottom: 1px solid var(--home-border);
  backdrop-filter: blur(12px);
}
.home-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 48px;
}
.home-stat-num {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.home-stat-label {
  font-size: 0.8rem;
  color: var(--home-text-dim);
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.home-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--home-border);
}

.home-features {
  padding: 80px 40px;
  max-width: 1100px;
  margin: 0 auto;
  animation: home-fade-up 0.8s ease 0.2s both;
}
.home-features-heading {
  text-align: center;
  margin-bottom: 48px;
}
.home-features-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--home-text-bright);
  margin-bottom: 12px;
}
.home-features-heading p {
  font-size: 1rem;
  color: var(--home-text-dim);
}

.home-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.home-feature-card {
  position: relative;
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  outline: none;
  overflow: hidden;
}
.home-feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7b2fbe, #a855f7, #ec4899);
  opacity: 0;
  transition: opacity 0.25s;
}
.home-feature-card:hover,
.home-feature-card:focus {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(168,85,247,0.2), 0 0 0 1px rgba(168,85,247,0.2);
  border-color: rgba(168,85,247,0.3);
}
.home-feature-card:hover::before,
.home-feature-card:focus::before {
  opacity: 1;
}
.home-feature-card:nth-child(1) { animation: home-fade-up 0.6s ease 0.1s both; }
.home-feature-card:nth-child(2) { animation: home-fade-up 0.6s ease 0.2s both; }
.home-feature-card:nth-child(3) { animation: home-fade-up 0.6s ease 0.3s both; }

.home-card-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.home-card-icon { font-size: 1.6rem; }
.home-card-img-icon { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; }

.home-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--home-text-bright);
  margin-bottom: 10px;
}
.home-card-desc {
  font-size: 0.9rem;
  color: var(--home-text-dim);
  line-height: 1.65;
  margin-bottom: 20px;
}
.home-card-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.25);
  color: #c084fc;
  font-size: 0.76rem;
  font-weight: 600;
}

.home-footer-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 40px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: home-fade-up 0.8s ease 0.3s both;
}
.home-disclaimer {
  padding: 16px 20px;
  background: rgba(251,191,36,0.06);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: rgba(253,224,132,0.75);
  line-height: 1.6;
}
.home-disclaimer strong { color: rgba(253,224,132,0.95); }

.home-attribution {
  padding: 16px 20px;
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--home-text-dim);
  line-height: 1.6;
  backdrop-filter: blur(8px);
}
.home-attribution a {
  color: #a855f7;
  text-decoration: none;
}
.home-attribution a:hover { text-decoration: underline; }
.home-attribution strong { color: var(--home-text-bright); }

@media (max-width: 768px) {
  #tab-home { margin: -24px -20px; }
  .home-hero { padding: 60px 24px 48px; min-height: 60vh; }
  .home-stats-strip { padding: 20px 16px; }
  .home-stat-item { padding: 0 24px; }
  .home-stat-num { font-size: 1.8rem; }
  .home-features { padding: 56px 24px; }
  .home-footer-section { padding: 0 24px 56px; }
}
@media (max-width: 480px) {
  .home-stats-strip { flex-direction: column; gap: 16px; }
  .home-stat-divider { width: 60px; height: 1px; }
  .home-stat-item { padding: 0; }
  .home-cards-grid { grid-template-columns: 1fr; }
  .home-hero-cta-row { flex-direction: column; align-items: stretch; }
  .home-cta-primary, .home-cta-secondary { text-align: center; }
}

/* ===== Learning Progress Tab ===== */
.lp-page {
  max-width: 960px;
  margin: 0 auto;
  padding-bottom: 60px;
}

/* Hero: level card */
.lp-hero {
  margin-bottom: 28px;
}

.lp-level-card {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, var(--purple-deep) 0%, var(--purple-mid) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: 0 8px 32px rgba(123,47,190,0.35);
  position: relative;
  overflow: hidden;
}

.lp-level-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.lp-level-icon {
  font-size: 3rem;
  line-height: 1;
  flex-shrink: 0;
}

.lp-level-info {
  flex: 1;
  min-width: 0;
}

.lp-level-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.75;
  margin-bottom: 4px;
}

.lp-level-name {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 8px;
}

.lp-xp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.lp-xp-value {
  font-size: 1rem;
  font-weight: 700;
}

.lp-xp-next {
  font-size: 0.82rem;
  opacity: 0.75;
}

.lp-level-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  overflow: hidden;
  max-width: 360px;
}

.lp-level-bar {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Overall ring */
.lp-overall-ring {
  position: relative;
  flex-shrink: 0;
}

.lp-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

/* XP sources strip */
.lp-xp-sources {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.lp-xp-source {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.lp-xp-source-icon { font-size: 1.5rem; margin-bottom: 6px; }
.lp-xp-source-val {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--purple-deep);
  line-height: 1.2;
}
.lp-xp-source-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.lp-xp-source-note {
  font-size: 0.7rem;
  color: var(--purple-mid);
  margin-top: 6px;
  line-height: 1.3;
  opacity: 0.85;
}

/* Section title */
.lp-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Domain rings */
.lp-domains {
  display: flex;
  gap: 20px;
}

.lp-domain-card {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lp-domain-ring-wrap {
  position: relative;
  display: inline-flex;
}

.lp-domain-ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lp-domain-pct {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.lp-domain-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.lp-domain-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.lp-domain-btn {
  padding: 7px 18px;
  background: var(--purple-pale);
  color: var(--purple-deep);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}

.lp-domain-btn:hover {
  background: var(--purple-deep);
  color: #fff;
}

/* Exam stat cards */
.lp-exam-stats {
  display: flex;
  gap: 16px;
}

.lp-stat-card {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--card-shadow);
  border-top: 3px solid var(--border);
}

.lp-stat-card.lp-stat-green { border-top-color: #22c55e; }
.lp-stat-card.lp-stat-red   { border-top-color: #ef4444; }
.lp-stat-card.lp-stat-purple { border-top-color: var(--purple-mid); }

.lp-stat-big {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.lp-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Scenario breakdown */
.lp-scenarios-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-top: 16px;
  box-shadow: var(--card-shadow);
}

.lp-scenarios-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lp-scenario-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.lp-scenario-row:last-child { border-bottom: none; }

.lp-scenario-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  width: 220px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-scenario-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--purple-pale);
  border-radius: 4px;
  overflow: hidden;
}

.lp-scenario-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.lp-scenario-stat {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 80px;
  text-align: right;
  flex-shrink: 0;
}

/* Badges */
.lp-badge-count {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--purple-pale);
  color: var(--purple-deep);
}

.lp-badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.lp-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.lp-badge-earned {
  border-color: rgba(168,85,247,0.3);
  background: linear-gradient(135deg, #fff 60%, var(--purple-pale));
}

.lp-badge-earned:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(168,85,247,0.2);
}

.lp-badge-locked {
  opacity: 0.5;
  filter: grayscale(0.6);
}

.lp-badge-icon { font-size: 1.8rem; margin-bottom: 6px; line-height: 1; }
.lp-badge-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.lp-badge-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Level roadmap */
.lp-roadmap {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 8px 4px;
}

.lp-roadmap-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
  min-width: 110px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.45;
  transition: all 0.2s;
}

.lp-roadmap-step.lp-roadmap-passed {
  opacity: 1;
  border-color: rgba(168,85,247,0.3);
}

.lp-roadmap-step.lp-roadmap-active {
  opacity: 1;
  border-color: var(--purple-mid);
  background: var(--purple-pale);
  box-shadow: 0 4px 16px rgba(168,85,247,0.2);
  transform: scale(1.05);
}

.lp-roadmap-icon { font-size: 1.6rem; }
.lp-roadmap-step-name { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.lp-roadmap-step-xp { font-size: 0.72rem; color: var(--text-muted); }

.lp-roadmap-connector {
  height: 2px;
  width: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .lp-xp-sources { flex-direction: column; gap: 10px; }
  .lp-domains { flex-direction: column; gap: 16px; }
  .lp-exam-stats { flex-wrap: wrap; }
  .lp-stat-card { min-width: calc(50% - 8px); }
  .lp-level-card { flex-direction: column; text-align: center; }
  .lp-overall-ring { margin: 0 auto; }
  .lp-level-bar-wrap { max-width: 100%; }
  .lp-scenario-label { width: 140px; font-size: 0.8rem; }
  .lp-badges { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (max-width: 480px) {
  .lp-exam-stats { gap: 10px; }
  .lp-stat-card { min-width: 100%; }
}

/* ===== Loading Screen ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a0a2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

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

.loading-logo-icon { font-size: 2rem; }

.loading-logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-bar-wrap {
  width: 220px;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  overflow: hidden;
}

@keyframes loading-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

.loading-bar-fill {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--purple-deep), var(--purple-light));
  border-radius: 2px;
  animation: loading-slide 1.2s ease-in-out infinite;
}

.loading-hint {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.3px;
}

/* XP gain particle animation */
.xp-float {
  position: fixed;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-light));
  color: #fff;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 14px;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(123,47,190,0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* Confetti/spark particles for XP burst */
.xp-spark {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  font-size: 0.75rem;
  line-height: 1;
  user-select: none;
  filter: drop-shadow(0 0 3px currentColor);
}

/* ── Changelog nav badge ─────────────────────────────────────────── */
.nav-tab-changelog {
  opacity: 0.75;
  font-size: 0.78rem;
}
.nav-tab-changelog.active { opacity: 1; }
.nav-beta-badge {
  display: inline-block;
  background: var(--purple-light);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 3px;
  letter-spacing: 0.04em;
}

/* ── Changelog page ──────────────────────────────────────────────── */
.cl-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.cl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.cl-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--purple-deep);
  margin: 0 0 0.25rem;
}
.cl-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}
.cl-current-badge {
  background: var(--purple-deep);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  margin-top: 6px;
}

/* Demo banner */
.cl-demo-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.cl-demo-icon { font-size: 1.4rem; flex-shrink: 0; }
.cl-demo-body {
  flex: 1;
  font-size: 0.88rem;
  color: #78350f;
  line-height: 1.5;
}
.cl-demo-body a { color: #92400e; font-weight: 600; }
.cl-demo-body a:hover { color: var(--purple-deep); }
.cl-github-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1f2328;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.cl-github-btn:hover { background: #333; }

/* Entries */
.cl-entries { display: flex; flex-direction: column; gap: 1.5rem; }
.cl-entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.cl-entry-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.2rem;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.cl-version {
  font-size: 1rem;
  font-weight: 800;
  color: var(--purple-deep);
}
.cl-label {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}
.cl-label-beta  { background: #ddd6fe; color: #5b21b6; }
.cl-label-stable { background: #d1fae5; color: #065f46; }
.cl-entry-title {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}
.cl-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* Change items */
.cl-list {
  list-style: none;
  margin: 0;
  padding: 0.6rem 1.2rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.cl-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--text-primary);
}
.cl-tag {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.04em;
  min-width: 48px;
  text-align: center;
}
.cl-tag-new    { background: #d1fae5; color: #065f46; }
.cl-tag-fix    { background: #dbeafe; color: #1e40af; }
.cl-tag-change { background: #fef3c7; color: #92400e; }
.cl-tag-remove { background: #fee2e2; color: #991b1b; }
.cl-item-text  { line-height: 1.4; }
