/* === CSS Variables === */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2236;
  --bg-card-hover: #1f2a42;
  --bg-sidebar: #0d1321;
  --bg-input: #0f1729;
  --bg-code: #0b1120;
  --bg-header: rgba(10, 14, 23, 0.85);

  --accent-blue: #4f8fff;
  --accent-blue-dim: #3a6fd4;
  --accent-purple: #7c5cff;
  --accent-teal: #00d4aa;
  --accent-gold: #ffd700;
  --accent-orange: #ff8a3d;
  --accent-red: #ff4d6a;
  --accent-green: #34d399;

  --text-primary: #e1e8f0;
  --text-secondary: #8892a4;
  --text-muted: #5a6578;
  --text-heading: #f0f4f8;

  --border-color: #1e2a3a;
  --border-light: #2a3650;

  --gradient-blue: linear-gradient(135deg, #4f8fff 0%, #7c5cff 100%);
  --gradient-gold: linear-gradient(135deg, #ffd700 0%, #ff8a3d 100%);
  --gradient-teal: linear-gradient(135deg, #00d4aa 0%, #4f8fff 100%);
  --gradient-xp: linear-gradient(90deg, #4f8fff 0%, #7c5cff 50%, #00d4aa 100%);

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(79, 143, 255, 0.15);
  --shadow-glow-gold: 0 0 20px rgba(255, 215, 0, 0.15);
  --shadow-glow-teal: 0 0 20px rgba(0, 212, 170, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --sidebar-width: 280px;
  --header-height: 64px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* === Light Theme === */
[data-theme="light"] {
  --bg-primary: #f5f7fa;
  --bg-secondary: #edf0f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f7;
  --bg-sidebar: #ffffff;
  --bg-input: #f0f2f5;
  --bg-code: #f8f9fc;
  --bg-header: rgba(255, 255, 255, 0.9);

  --accent-blue: #2563eb;
  --accent-blue-dim: #1d4ed8;
  --accent-purple: #6d28d9;
  --accent-teal: #059669;
  --accent-gold: #d97706;
  --accent-orange: #ea580c;
  --accent-red: #dc2626;
  --accent-green: #16a34a;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-heading: #0f172a;

  --border-color: #e2e8f0;
  --border-light: #cbd5e1;

  --gradient-blue: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
  --gradient-gold: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
  --gradient-teal: linear-gradient(135deg, #059669 0%, #2563eb 100%);
  --gradient-xp: linear-gradient(90deg, #2563eb 0%, #6d28d9 50%, #059669 100%);

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-glow-blue: 0 0 20px rgba(37, 99, 235, 0.1);
  --shadow-glow-gold: 0 0 20px rgba(217, 119, 6, 0.1);
  --shadow-glow-teal: 0 0 20px rgba(5, 150, 105, 0.1);
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-purple);
}

::selection {
  background: rgba(79, 143, 255, 0.3);
  color: #fff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === Layout === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow-blue);
}

.sidebar-logo .logo-text {
  font-size: 20px;
  font-weight: 700;
  background: var(--gradient-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 8px 12px 8px;
  margin-top: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  margin-bottom: 2px;
}

.sidebar-item:hover {
  background: rgba(79, 143, 255, 0.08);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(79, 143, 255, 0.12);
  color: var(--accent-blue);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-blue);
  border-radius: 0 3px 3px 0;
}

.sidebar-item .item-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-item .item-progress {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(79, 143, 255, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sidebar-item .item-progress.complete {
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent-teal);
}

/* Sidebar Profile Mini */
.sidebar-profile {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-profile:hover {
  background: rgba(79, 143, 255, 0.05);
}

.sidebar-profile .avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gradient-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-profile .profile-info {
  flex: 1;
  min-width: 0;
}

.sidebar-profile .profile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile .profile-level {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 500;
}

/* === Main Content === */
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Header === */
.header {
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 32px;
  z-index: 50;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
}

.header-breadcrumb span {
  color: var(--text-secondary);
}

.header-breadcrumb .breadcrumb-current {
  color: var(--text-heading);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-breadcrumb .separator {
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

/* Theme Switch */
.theme-switch {
  width: 56px;
  height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  transition: background var(--transition-normal), border-color var(--transition-normal);
  flex-shrink: 0;
}

.theme-switch:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.theme-switch-icon {
  font-size: 13px;
  line-height: 1;
  z-index: 1;
  transition: opacity var(--transition-normal);
}

.theme-switch .sun {
  opacity: 0.2;
}

.theme-switch .moon {
  opacity: 1;
}

.theme-switch.light .sun {
  opacity: 1;
}

.theme-switch.light .moon {
  opacity: 0.2;
}

.theme-switch-knob {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 20px;
  height: 20px;
  background: linear-gradient(145deg, rgba(200, 210, 225, 0.2), rgba(150, 165, 185, 0.15));
  border-radius: 50%;
  transition: transform var(--transition-normal), background var(--transition-normal);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transform: translateY(-50%) translateX(26px);
}

.theme-switch.light .theme-switch-knob {
  background: linear-gradient(145deg, rgba(80, 95, 120, 0.2), rgba(55, 65, 85, 0.15));
  transform: translateY(-50%) translateX(0);
}

/* XP Bar in header */
.xp-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xp-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
  white-space: nowrap;
}

.xp-bar {
  width: 160px;
  height: 8px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  background: var(--gradient-gold);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  position: relative;
}

.xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.level-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gradient-gold);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  box-shadow: var(--shadow-glow-gold);
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-orange);
  background: rgba(255, 138, 61, 0.1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

/* === Page Content === */
.page-content {
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  height: auto;
}

/* === Home / Dashboard === */
.dashboard-hero {
  background: var(--gradient-blue);
  border-radius: var(--radius-xl);
  padding: 40px 48px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.dashboard-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: 30%;
  width: 250px;
  height: 250px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 50%;
}

.dashboard-hero h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.dashboard-hero p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  position: relative;
  z-index: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-card);
}

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* === Topic Cards === */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topic-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-blue);
}

.topic-card .topic-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.topic-card .topic-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.topic-card .topic-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
  overflow-wrap: break-word;
}

.topic-card .topic-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.topic-card .topic-lessons-count {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topic-card .topic-xp {
  color: var(--accent-gold);
  font-weight: 600;
}

.topic-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(79, 143, 255, 0.1);
  border-radius: var(--radius-full);
  margin-top: 12px;
  overflow: hidden;
}

.topic-progress-bar .fill {
  height: 100%;
  background: var(--gradient-teal);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* === Topic Detail View === */
.topic-header {
  margin-bottom: 32px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 16px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  background: none;
  border: none;
  font-family: inherit;
}

.back-btn:hover {
  background: rgba(79, 143, 255, 0.08);
  color: var(--accent-blue);
}

.topic-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topic-header p {
  font-size: 15px;
  color: var(--text-secondary);
}

.topic-stats-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.topic-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.topic-stat .label {
  color: var(--text-muted);
}

.topic-stat .value {
  font-weight: 600;
  color: var(--text-primary);
}

.topic-stat .value.gold {
  color: var(--accent-gold);
}

.topic-stat .value.teal {
  color: var(--accent-teal);
}

/* === Lesson List === */
.lesson-list {
  margin-top: 24px;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lesson-item:hover {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}

.lesson-item.completed {
  border-left: 3px solid var(--accent-teal);
}

.lesson-number {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(79, 143, 255, 0.1);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.lesson-item.completed .lesson-number {
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent-teal);
}

.lesson-info {
  flex: 1;
}

.lesson-info .lesson-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.lesson-info .lesson-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.lesson-type-badge.reading {
  background: rgba(79, 143, 255, 0.1);
  color: var(--accent-blue);
}

.lesson-type-badge.exercise {
  background: rgba(124, 92, 255, 0.1);
  color: var(--accent-purple);
}

.lesson-type-badge.sandbox {
  background: rgba(0, 212, 170, 0.1);
  color: var(--accent-teal);
}

.lesson-xp {
  font-size: 13px;
  color: var(--accent-gold);
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}

.lesson-check {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.lesson-item.completed .lesson-check {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  color: #fff;
  font-size: 12px;
}

/* === Lesson Content View === */
.lesson-view {
  max-width: 100%;
}

.lesson-view .lesson-header {
  margin-bottom: 32px;
}

.lesson-view .lesson-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.lesson-content {
  line-height: 1.8;
  font-size: 15px;
  color: var(--text-primary);
  overflow-wrap: break-word;
}

.lesson-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.lesson-content h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 24px 0 12px;
}

.lesson-content p {
  margin-bottom: 16px;
}

.lesson-content ul, .lesson-content ol {
  margin: 12px 0 16px 24px;
}

.lesson-content li {
  margin-bottom: 6px;
}

.lesson-content code {
  background: rgba(79, 143, 255, 0.1);
  color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9em;
  overflow-wrap: break-word;
}

.lesson-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-x: auto;
  margin: 16px 0 20px;
  position: relative;
}

.lesson-content pre code {
  background: none;
  color: var(--text-primary);
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
  padding-right: 36px;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}

.code-copy-btn svg {
  flex-shrink: 0;
}

.code-copy-btn:hover {
  opacity: 1;
  color: var(--text-primary);
}

.code-copy-btn.copied {
  color: var(--accent-teal);
  border-color: var(--accent-teal);
  opacity: 1;
}

.lesson-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 20px;
  display: block;
  overflow-x: auto;
}

.lesson-content th,
.lesson-content td {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
}

.lesson-content th {
  background: rgba(79, 143, 255, 0.1);
  color: var(--text-primary);
}

.lesson-content blockquote {
  border-left: 3px solid var(--accent-blue);
  padding: 12px 20px;
  margin: 16px 0;
  background: rgba(79, 143, 255, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.lesson-content .info-box {
  background: rgba(79, 143, 255, 0.08);
  border: 1px solid rgba(79, 143, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0;
}

.lesson-content .info-box .info-title {
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 6px;
  font-size: 14px;
}

.lesson-content .warning-box {
  background: rgba(255, 138, 61, 0.08);
  border: 1px solid rgba(255, 138, 61, 0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0;
}

.lesson-content .warning-box .warning-title {
  font-weight: 600;
  color: var(--accent-orange);
  margin-bottom: 6px;
  font-size: 14px;
}

.lesson-content .diagram-figure {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 20px 0;
  text-align: center;
}

.lesson-content .diagram-figure img {
  max-width: 100%;
  height: auto;
}

.lesson-content .diagram-figure figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

.lesson-content .screenshot-figure {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 20px 0;
  text-align: center;
}

.lesson-content .screenshot-figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.lesson-content .screenshot-figure figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

.lesson-content .tool-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lesson-content .tool-heading img.tool-logo {
  height: 28px;
  width: auto;
  max-width: 90px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 3px;
  flex-shrink: 0;
}

/* App / Tool Recommendation Cards */
.lesson-content .app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}

.lesson-content .app-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-normal);
}

.lesson-content .app-card:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow-blue);
  transform: translateY(-2px);
}

.lesson-content .app-card .app-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.lesson-content .app-card .app-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 6px;
  flex-shrink: 0;
}

.lesson-content .app-card .app-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
}

.lesson-content .app-card .app-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  overflow-wrap: break-word;
}

.lesson-content .app-card .app-privacy,
.lesson-content .app-card .app-drawbacks {
  margin: 0 0 12px 20px;
  font-size: 13px;
}

.lesson-content .app-card .app-privacy li {
  color: var(--accent-teal);
  margin-bottom: 4px;
}

.lesson-content .app-card .app-drawbacks li {
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.lesson-content .app-card .app-link {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--gradient-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.lesson-content .app-card .app-link:hover {
  box-shadow: 0 4px 16px rgba(79, 143, 255, 0.35);
}

/* Complete Lesson Button */
.lesson-actions {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* === Code Sandbox === */
.sandbox-container {
  margin: 24px 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.sandbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
}

.sandbox-header .sandbox-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sandbox-header .sandbox-lang {
  background: rgba(79, 143, 255, 0.1);
  color: var(--accent-blue);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.sandbox-editor {
  position: relative;
}

.sandbox-editor textarea {
  width: 100%;
  min-height: 200px;
  padding: 20px;
  background: var(--bg-code);
  color: var(--text-primary);
  border: none;
  outline: none;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  tab-size: 4;
}

.sandbox-editor textarea::placeholder {
  color: var(--text-muted);
}

.sandbox-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.sandbox-output {
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
  padding: 16px 20px;
  background: var(--bg-code);
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--accent-teal);
  border-top: 1px solid var(--border-color);
}

.sandbox-output.error {
  color: var(--accent-red);
}

.sandbox-output .output-line {
  margin-bottom: 2px;
}

.sandbox-output .output-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient-blue);
  color: #fff;
  box-shadow: 0 2px 12px rgba(79, 143, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(79, 143, 255, 0.4);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-teal);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 212, 170, 0.3);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(0, 212, 170, 0.4);
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--gradient-gold);
  color: #1a1a2e;
  box-shadow: 0 2px 12px rgba(255, 215, 0, 0.3);
}

.btn-gold:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(79, 143, 255, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(79, 143, 255, 0.08);
  color: var(--text-primary);
}

.btn-run {
  background: var(--accent-teal);
  color: #fff;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
}

.btn-run:hover:not(:disabled) {
  background: #00e6b8;
  box-shadow: 0 2px 12px rgba(0, 212, 170, 0.4);
}

.btn-reset {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-reset:hover:not(:disabled) {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* === Profile Page === */
.profile-page {
  max-width: 100%;
}

.profile-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 32px;
}

.profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  background: var(--gradient-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  box-shadow: var(--shadow-glow-blue);
  flex-shrink: 0;
}

.profile-details h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.profile-details .profile-joined {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.profile-level-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-level-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 215, 0, 0.1);
  padding: 6px 16px;
  border-radius: var(--radius-full);
}

.profile-level-badge .level-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-gold);
}

.profile-level-badge .level-label {
  font-size: 12px;
  color: var(--accent-gold);
  opacity: 0.8;
}

.profile-xp-display {
  font-size: 14px;
  color: var(--text-secondary);
}

.profile-xp-display strong {
  color: var(--accent-gold);
}

/* === Achievements Page === */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.achievement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.achievement-card.unlocked {
  border-color: rgba(255, 215, 0, 0.3);
  box-shadow: var(--shadow-glow-gold);
}

.achievement-card.locked {
  opacity: 0.5;
}

.achievement-card .achievement-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.achievement-card.locked .achievement-icon {
  filter: grayscale(100%);
}

.achievement-card .achievement-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.achievement-card .achievement-info p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.achievement-card .achievement-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.achievement-card.unlocked .achievement-badge {
  background: rgba(255, 215, 0, 0.15);
  color: var(--accent-gold);
}

.achievement-card.locked .achievement-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* === Settings Page === */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
}

.settings-section h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-section p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.settings-field {
  margin-bottom: 16px;
}

.settings-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.settings-field input[type="text"] {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.settings-field input[type="text"]:focus {
  border-color: var(--accent-blue);
}

.settings-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Avatar image */
.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
}

/* Settings image upload */
.settings-image-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

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

.import-area {
  margin-top: 12px;
}

.import-area textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  outline: none;
  resize: vertical;
}

.import-area textarea:focus {
  border-color: var(--accent-blue);
}

/* === Toast / Notification === */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s ease;
  min-width: 280px;
  max-width: 400px;
}

.toast.xp {
  border-color: rgba(255, 215, 0, 0.3);
}

.toast.achievement {
  border-color: rgba(124, 92, 255, 0.3);
}

.toast.success {
  border-color: rgba(0, 212, 170, 0.3);
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.toast-content .toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

.toast-content .toast-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-exit {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

/* === Progress Ring === */
.progress-ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-container .ring-text {
  position: absolute;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

/* === Section Titles === */
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* === Empty States === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state .empty-text {
  font-size: 16px;
  color: var(--text-muted);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade-in 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
  animation: modal-in 0.3s ease;
}

.modal h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 12px;
}

.modal p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* === XP Gain Animation === */
.xp-gain-anim {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  animation: xp-float 1.5s ease forwards;
}

@keyframes xp-float {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(1.2);
  }
}

/* === Welcome Modal / Onboarding === */
.onboarding-step {
  text-align: center;
}

.onboarding-step .step-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.onboarding-step h2 {
  margin-bottom: 12px;
}

.onboarding-step input[type="text"] {
  width: 100%;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  text-align: center;
  outline: none;
  margin: 16px 0;
}

.onboarding-step input[type="text"]:focus {
  border-color: var(--accent-blue);
}

/* === Loading Spinner === */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Sidebar Backdrop (Mobile) === */
.sidebar-backdrop {
  display: none;
}

/* === Responsive === */
@media (max-width: 1024px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.4);
  }

  .main-content {
    margin-left: 0;
  }

  .page-content {
    padding: 24px 16px;
  }

  .topics-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero {
    flex-direction: column;
    text-align: center;
    padding: 28px;
  }

  .dashboard-hero {
    padding: 28px;
  }

  .menu-toggle {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 16px;
    gap: 8px;
  }

  .header-right {
    gap: 10px;
  }

  .header-breadcrumb span:not(.breadcrumb-current) {
    display: none;
  }

  .header-breadcrumb .breadcrumb-current {
    flex: 1;
  }

  .xp-bar-container {
    display: none;
  }

  .topic-stats-bar {
    gap: 10px 16px;
    padding: 12px 16px;
  }

  .topic-header h1 {
    font-size: 22px;
  }
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.menu-toggle:hover {
  background: rgba(79, 143, 255, 0.08);
  border-color: var(--accent-blue);
}

/* === Tab System for lesson content === */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* === Confetti container === */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 2s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(-20px) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

/* Utility classes */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* === Footer === */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 16px;
  margin-top: auto;
}

.footer-content {
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
}

.footer-copyright {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.footer-copyright a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-copyright a:hover {
  color: var(--accent-teal);
  text-decoration: underline;
}

/* === Quiz Component === */

.quiz-container {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Score Banner --- */

.quiz-score {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid;
  animation: quizScoreIn 0.4s ease;
}

@keyframes quizScoreIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.quiz-score-pass {
  background: rgba(0, 212, 170, 0.08);
  border-color: rgba(0, 212, 170, 0.3);
}

.quiz-score-fail {
  background: rgba(255, 143, 61, 0.08);
  border-color: rgba(255, 143, 61, 0.3);
}

.quiz-score-icon {
  font-size: 28px;
}

.quiz-score-text {
  flex: 1;
  font-size: 15px;
  color: var(--text-primary);
}

.quiz-score-text strong {
  font-size: 18px;
}

.quiz-score-label {
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Question Card --- */

.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px 24px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.quiz-question.quiz-correct {
  border-color: rgba(0, 212, 170, 0.4);
  box-shadow: inset 0 0 0 1px rgba(0, 212, 170, 0.1);
}

.quiz-question.quiz-wrong {
  border-color: rgba(255, 77, 106, 0.4);
  box-shadow: inset 0 0 0 1px rgba(255, 77, 106, 0.1);
}

.quiz-question-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.quiz-question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.quiz-question-text {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.5;
  padding-top: 4px;
}

.quiz-question-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.quiz-question-badge.correct {
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent-teal);
}

.quiz-question-badge.wrong {
  background: rgba(255, 77, 106, 0.15);
  color: #ff4d6a;
}

/* --- Choices --- */

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-hover);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.quiz-choice:hover {
  border-color: var(--accent-blue);
  background: rgba(79, 143, 255, 0.06);
}

.quiz-choice-selected {
  border-color: var(--accent-blue);
  background: rgba(79, 143, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(79, 143, 255, 0.2);
}

.quiz-choice-correct {
  border-color: rgba(0, 212, 170, 0.5) !important;
  background: rgba(0, 212, 170, 0.08) !important;
  cursor: default;
}

.quiz-choice-wrong {
  border-color: rgba(255, 77, 106, 0.5) !important;
  background: rgba(255, 77, 106, 0.08) !important;
  cursor: default;
}

.quiz-choice-dim {
  opacity: 0.45;
  cursor: default;
}

.quiz-choice-dim:hover {
  border-color: var(--border-subtle);
  background: var(--bg-card-hover);
}

.quiz-choice-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(79, 143, 255, 0.08);
  color: var(--accent-blue);
  transition: all 0.2s ease;
}

.quiz-choice-selected .quiz-choice-indicator {
  background: var(--accent-blue);
  color: #fff;
}

.quiz-choice-correct .quiz-choice-indicator {
  background: var(--accent-teal);
  color: #fff;
}

.quiz-choice-wrong .quiz-choice-indicator {
  background: #ff4d6a;
  color: #fff;
}

.quiz-choice-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* --- Explanation --- */

.quiz-explanation {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(79, 143, 255, 0.06);
  border-left: 3px solid var(--accent-blue);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  animation: quizExplanationIn 0.3s ease;
}

@keyframes quizExplanationIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.quiz-explanation-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* --- Actions --- */

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
  flex-wrap: wrap;
}

.quiz-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}