
:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface2: #1a1a26;
  --border: #ffffff12;
  --border2: #ffffff22;
  --text: #f0f0f8;
  --muted: #8888aa;
  --accent: #7c6af7;
  --accent2: #a594fa;
  --green: #22d3a0;
  --red: #f45b69;
  --amber: #f5a623;
  --blue: #4facfe;
  --debutant: #22d3a0;
  --intermediaire: #f5a623;
  --avance: #f45b69;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* GRID BG */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,106,247,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,106,247,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* LAYOUT */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .app-name {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.sidebar-logo .app-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-family: 'DM Mono', monospace;
}

.progress-overview {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.progress-overview .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}
.prog-bar-bg {
  height: 3px;
  background: var(--border2);
  border-radius: 99px;
  overflow: hidden;
}
.prog-bar-fill {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: 99px;
  transition: width 0.5s ease;
}
.prog-text {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-family: 'DM Mono', monospace;
}

.nav-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.nav-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 4px 24px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
  font-size: 13px;
  color: var(--muted);
}
.nav-item:hover { background: rgba(124,106,247,0.06); color: var(--text); }
.nav-item.active {
  background: rgba(124,106,247,0.1);
  border-left-color: var(--accent);
  color: var(--text);
}
.nav-item.completed { color: var(--green); }
.nav-item.completed .nav-check { opacity: 1; }

.nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
  transition: all 0.15s;
}
.nav-item.active .nav-dot { background: var(--accent); border-color: var(--accent); }
.nav-item.completed .nav-dot { background: var(--green); border-color: var(--green); }

.nav-check {
  margin-left: auto;
  font-size: 11px;
  opacity: 0;
  color: var(--green);
}

.level-badge {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 99px;
  font-family: 'DM Mono', monospace;
  margin-left: auto;
}
.badge-debutant { background: rgba(34,211,160,0.12); color: var(--debutant); }
.badge-inter { background: rgba(245,166,35,0.12); color: var(--intermediaire); }
.badge-avance { background: rgba(244,91,105,0.12); color: var(--avance); }

/* MAIN */
.main {
  flex: 1;
  padding: 40px 48px;
  max-width: 860px;
}

/* SCREENS */
.screen { display: none; animation: fadeIn 0.3s ease; }
.screen.active { display: block; }

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

/* HOME SCREEN */
.home-header {
  margin-bottom: 48px;
}
.home-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--accent2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.home-title {
  font-family: 'Syne', sans-serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #f0f0f8 0%, var(--accent2) 60%, var(--blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.home-desc {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 560px;
}

.level-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.level-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.level-card.debutant::before { background: var(--debutant); }
.level-card.inter::before { background: var(--intermediaire); }
.level-card.avance::before { background: var(--avance); }
.level-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }

.level-card .lc-icon { font-size: 28px; margin-bottom: 12px; }
.level-card .lc-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.level-card.debutant .lc-name { color: var(--debutant); }
.level-card.inter .lc-name { color: var(--intermediaire); }
.level-card.avance .lc-name { color: var(--avance); }
.level-card .lc-desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }
.level-card .lc-modules {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

.start-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 12px;
}
.level-card.debutant .start-btn:hover { background: rgba(34,211,160,0.1); border-color: var(--debutant); color: var(--debutant); }
.level-card.inter .start-btn:hover { background: rgba(245,166,35,0.1); border-color: var(--intermediaire); color: var(--intermediaire); }
.level-card.avance .start-btn:hover { background: rgba(244,91,105,0.1); border-color: var(--avance); color: var(--avance); }

/* MODULE SCREEN */
.module-header { margin-bottom: 32px; }
.module-breadcrumb {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.module-breadcrumb .sep { color: var(--border2); }
.module-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.module-meta {
  display: flex;
  gap: 16px;
  align-items: center;
}
.meta-pill {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--border2);
  color: var(--muted);
}

/* LESSON SECTIONS */
.lesson-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 20px;
  overflow: hidden;
}

.lesson-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.lesson-section-header:hover { background: rgba(255,255,255,0.02); }

.section-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.icon-theory { background: rgba(124,106,247,0.15); }
.icon-prompt { background: rgba(79,172,254,0.15); }
.icon-exercise { background: rgba(245,166,35,0.15); }
.icon-corrected { background: rgba(34,211,160,0.15); }

.section-title {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}
.section-toggle {
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.2s;
}
.lesson-section.open .section-toggle { transform: rotate(180deg); }

.section-body {
  display: none;
  padding: 0 24px 24px;
  border-top: 1px solid var(--border);
}
.lesson-section.open .section-body { display: block; }

/* THEORY */
.theory-content {
  padding-top: 18px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}
.theory-content p { margin-bottom: 12px; }
.theory-content strong { color: var(--text); font-weight: 500; }

.info-box {
  background: rgba(124,106,247,0.08);
  border: 1px solid rgba(124,106,247,0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}
.info-box .info-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--accent2);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.warn-box {
  background: rgba(244,91,105,0.08);
  border: 1px solid rgba(244,91,105,0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}
.warn-box .warn-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--red);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* PROMPTS */
.prompt-list { padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.prompt-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.prompt-card:hover { border-color: rgba(79,172,254,0.3); background: rgba(79,172,254,0.04); }
.prompt-card .prompt-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}
.prompt-card .prompt-text {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--blue);
  line-height: 1.6;
  flex: 1;
}
.prompt-card .copy-hint {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.prompt-card:hover .copy-hint { opacity: 1; }
.prompt-card.copied { border-color: rgba(34,211,160,0.4); }
.prompt-card.copied .prompt-text { color: var(--green); }

/* EXERCISE */
.exercise-wrapper { padding-top: 18px; }
.exercise-scenario {
  background: var(--surface2);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  border-left: 3px solid var(--amber);
}
.exercise-scenario strong { color: var(--text); }
.exercise-scenario .scenario-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--amber);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.exercise-question {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
  color: var(--text);
}

.choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface2);
}
.choice:hover { border-color: var(--border2); color: var(--text); }
.choice.selected-correct {
  border-color: var(--green);
  background: rgba(34,211,160,0.08);
  color: var(--green);
}
.choice.selected-wrong {
  border-color: var(--red);
  background: rgba(244,91,105,0.08);
  color: var(--red);
}
.choice.reveal-correct {
  border-color: rgba(34,211,160,0.4);
  color: var(--green);
  background: rgba(34,211,160,0.04);
}
.choice .choice-letter {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  flex-shrink: 0;
}

.feedback-box {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  display: none;
}
.feedback-box.correct { background: rgba(34,211,160,0.08); border: 1px solid rgba(34,211,160,0.25); color: var(--green); }
.feedback-box.wrong { background: rgba(244,91,105,0.08); border: 1px solid rgba(244,91,105,0.25); color: #f8a0a8; }
.feedback-box.show { display: block; }

.exercise-actions { display: flex; gap: 10px; }
.btn {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
}
.btn:hover { color: var(--text); border-color: var(--border2); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); color: white; }
.btn:disabled { opacity: 0.35; cursor: default; }

/* CORRECTED */
.corrected-wrapper { padding-top: 18px; }
.corrected-step {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}
.corrected-num {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: rgba(124,106,247,0.15);
  color: var(--accent2);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.corrected-content { flex: 1; }
.corrected-content .step-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.corrected-content .step-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.corrected-prompt {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--blue);
  line-height: 1.6;
  border-left: 2px solid rgba(79,172,254,0.4);
}

.result-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--green);
  font-family: 'DM Mono', monospace;
  line-height: 1.6;
}
.result-preview::before {
  content: '✓ Expected result';
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

/* MODULE NAV */
.module-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.module-complete-btn {
  padding: 11px 28px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(124,106,247,0.3);
}
.module-complete-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(124,106,247,0.45); }

/* COMPLETION */
.completion-screen {
  text-align: center;
  padding: 60px 0;
}
.completion-icon { font-size: 64px; margin-bottom: 24px; }
.completion-title {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.completion-desc { font-size: 15px; color: var(--muted); line-height: 1.7; max-width: 480px; margin: 0 auto 32px; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

.sidebar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.sidebar-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.sidebar-breadcrumb a:hover { color: var(--accent2); }
.sidebar-breadcrumb .sep { opacity: 0.4; }
.sidebar-breadcrumb .crumb-current { color: var(--accent2); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-back {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  transition: color 0.15s;
}
.topbar-back:hover { color: var(--accent2); }
.topbar-sep { color: var(--border2); font-size: 1.1rem; }
.topbar-title { font-family: 'Syne', sans-serif; font-size: 0.85rem; font-weight: 700; color: var(--text); }
.lang-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border2);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.lang-toggle:hover { color: var(--accent2); border-color: var(--accent2); }
