/* =========================================================
   MALI ENGLISH CENTER - SYSTEME DE DESIGN & STYLES APPRENANT
   ========================================================= */
:root {
  --indigo: #1A2238;
  --indigo-tint: rgba(26, 34, 56, 0.06);
  --clay: #C1622D;
  --clay-dark: #9E4B1F;
  --clay-tint: rgba(193, 98, 45, 0.12);
  --gold: #E8B85C;
  --gold-tint: rgba(232, 184, 92, 0.16);
  --sand: #F4EAD3;
  --cream: #FAF6EE;
  --paper: #FFFFFF;
  --card: #FFFFFF;
  --ink: #11182C;
  --gray: #64748B;
  --gray-light: #CBD5E1;
  --line: #E2E8F0;
  --green: #10B981;
  --green-tint: rgba(16, 185, 129, 0.12);
  --red: #EF4444;
  --red-tint: rgba(239, 68, 68, 0.1);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(26, 34, 56, 0.08);
  --shadow-lg: 0 12px 32px rgba(26, 34, 56, 0.12);
}

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--sand);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

.app { display: flex; min-height: 100vh; position: relative; }

/* =========================================================
   SIDEBAR (desktop)
   ========================================================= */
.sidebar {
  width: 280px;
  background: var(--indigo);
  color: #FFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  padding: 24px 20px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar__brand-icon { width: 32px; height: 32px; color: var(--gold); flex-shrink: 0; }
.sidebar__brand span em { font-style: normal; color: var(--clay); font-weight: 400; display: block; font-size: 0.78rem; font-family: var(--font-body); text-transform: uppercase; letter-spacing: 0.1em; margin-top: -2px; }

.sidebar__nav { display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; }

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.sidebar__item svg { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.85; }
.sidebar__item:hover { color: #FFF; background: rgba(255,255,255,0.06); }
.sidebar__item.is-active { color: #FFF; background: var(--clay); }
.sidebar__item.is-active svg { opacity: 1; }

.sidebar__footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar__streak {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--gold);
  margin-bottom: 12px;
}
.sidebar__streak-flame { width: 18px; height: 18px; fill: currentColor; }

.sidebar__progress-label { font-size: 0.78rem; color: rgba(255,255,255,0.6); margin-bottom: 6px; }
.sidebar__progress-track { height: 6px; background: rgba(255,255,255,0.15); border-radius: var(--radius-full); overflow: hidden; }
.sidebar__progress-fill { height: 100%; background: var(--gold); border-radius: var(--radius-full); transition: width 0.3s ease; }

.sidebar__teacher-link {
  display: block;
  margin-top: 16px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  text-decoration: underline;
  text-align: center;
}
.sidebar__teacher-link:hover { color: var(--gold); }

.sidebar__logout-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
  font-family: inherit;
  transition: color 0.2s;
}
.sidebar__logout-btn:hover { color: rgba(255,255,255,0.7); }

/* =========================================================
   MAIN LAYOUT & TOPBAR
   ========================================================= */
.main { flex: 1; margin-left: 280px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar__title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--indigo); }
.topbar__meta { display: flex; align-items: center; gap: 16px; }

.topbar__streak {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-tint);
  color: var(--clay-dark);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.88rem;
  font-family: var(--font-mono);
}
.topbar__streak svg { width: 16px; height: 16px; fill: currentColor; }

/* Badge de serie actif : degrade chaud + flamme qui vacille */
.topbar__streak.has-streak {
  background: linear-gradient(135deg, var(--gold) 0%, var(--clay) 100%);
  color: #FFF;
  box-shadow: 0 2px 10px rgba(193, 98, 45, 0.3);
}
.topbar__streak.has-streak .topbar__streak-flame {
  transform-origin: 50% 85%;
  animation: flameFlicker 1.6s ease-in-out infinite;
}
@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(-2deg); opacity: 0.92; }
  50%      { transform: scale(1.12) rotate(2deg); opacity: 1; }
}

.content { padding: 32px 28px 96px; max-width: 1040px; margin: 0 auto; width: 100%; }

/* Micro-transition d'entree de page */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content.is-entering { animation: fadeIn 0.28s ease-out both; }

/* Canvas de confettis (temporaire, retire apres l'animation) */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}

@media (prefers-reduced-motion: reduce) {
  .content.is-entering { animation: none; }
  .topbar__streak.has-streak .topbar__streak-flame { animation: none; }
}

/* =========================================================
   BOTTOMNAV (mobile)
   ========================================================= */
.bottomnav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  min-height: 72px;
  background: var(--indigo);
  color: #FFF;
  z-index: 40;
  border-top: 1px solid rgba(255,255,255,0.1);
  justify-content: space-around;
  align-items: center;
  padding: 6px 4px max(16px, env(safe-area-inset-bottom));
}

.bottomnav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,0.6);
  font-size: 0.7rem;
  font-weight: 600;
  flex: 1;
  align-self: stretch;
  min-height: 44px;
}
.bottomnav__item svg { width: 20px; height: 20px; }
.bottomnav__item.is-active { color: var(--gold); }

/* =========================================================
   FIL D'ARIANE (BREADCRUMB)
   ========================================================= */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.4;
}
.breadcrumb__link { color: var(--clay); border-bottom: 1px solid transparent; }
.breadcrumb__link:hover { border-bottom-color: var(--clay); }
.breadcrumb__sep { color: var(--gray-light); }
.breadcrumb__current { color: var(--gray); }

/* =========================================================
   BOUTON FLOTTANT RETOUR (FAB)
   ========================================================= */
.fab-back {
  position: fixed;
  right: 18px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius-full);
  background: var(--indigo);
  color: #FFF;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.12);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.fab-back:hover { background: #121930; }
.fab-back:active { transform: scale(0.97); }

/* =========================================================
   SEPARATEURS DE MOIS (PARCOURS)
   ========================================================= */
.month-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 4px 22px;
}
.month-sep__line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gray-light), transparent); }
.month-sep__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: 0 0 auto; }

.month-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--sand);
}
.month-head__num {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--clay-tint);
  color: var(--clay);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}
.month-head__text { min-width: 0; }
.month-head__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--indigo);
  margin: 0;
  line-height: 1.25;
}
.month-head__meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--gray);
  margin-top: 3px;
}

/* Compense la topbar sticky (64px) lors d'un scroll vers une ancre de mois */
[id^="mois-"] { scroll-margin-top: 78px; }

/* =========================================================
   COMPOSANTS REUTILISABLES (BUTTONS, CARDS, BADGES)
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn--primary { background: var(--clay); color: #FFF; }
.btn--primary:hover { background: var(--clay-dark); }
.btn--light { background: var(--cream); color: var(--indigo); border: 1px solid var(--line); }
.btn--light:hover { background: var(--sand); }
.btn--full { width: 100%; }
.btn--sm { padding: 10px 16px; min-height: 44px; font-size: 0.88rem; }

.card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--gold-tint);
  color: var(--clay-dark);
}
.badge--green { background: var(--green-tint); color: var(--green); }
.badge--locked { background: var(--line); color: var(--gray); }

/* =========================================================
   HERO / ACCUEIL
   ========================================================= */
.hero {
  background: linear-gradient(135deg, var(--indigo) 0%, #222D4A 55%, #26324F 100%);
  color: #FFF;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(232, 184, 92, 0.28);
}
/* Liseré doré en haut de carte */
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold) 80%, transparent);
}
/* Halo doré diffus, decoratif */
.hero::after {
  content: '';
  position: absolute;
  top: -60px; right: -40px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-tint) 0%, transparent 70%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero__title { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 10px; font-weight: 700; line-height: 1.25; }
.hero__subtitle { color: rgba(255,255,255,0.8); font-size: 1rem; max-width: 680px; margin-bottom: 24px; }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; }

.section-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--indigo); margin-bottom: 16px; }
.section-sub { font-size: 0.94rem; color: var(--gray); margin-top: -10px; margin-bottom: 20px; }

/* =========================================================
   PARCOURS & DIAMOND NODES
   ========================================================= */
.path-container { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }

.path-node {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
  width: 100%;
  transition: all 0.2s ease;
  position: relative;
}
.path-node:hover:not(:disabled) {
  border-color: var(--clay);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.path-node:disabled { opacity: 0.6; cursor: not-allowed; }

.path-node__diamond {
  width: 56px; height: 56px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.path-node__diamond svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.diamond-fill { fill: var(--sand); stroke: var(--line); }
.path-node--current .diamond-fill { fill: var(--clay); stroke: var(--clay-dark); }
.path-node--done .diamond-fill { fill: var(--green-tint); stroke: var(--green); }

.path-node__num {
  position: relative; z-index: 2;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem;
  color: var(--indigo);
}
.path-node--current .path-node__num { color: #FFF; }
.path-node--done .path-node__num { display: none; }
.path-node__check { display: none; width: 22px; height: 22px; color: var(--green); position: relative; z-index: 2; }
.path-node--done .path-node__check { display: block; }

.path-node__body { flex: 1; min-width: 0; }
.path-node__week { font-size: 0.76rem; font-weight: 700; text-transform: uppercase; color: var(--clay); letter-spacing: 0.05em; }
.path-node__title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--indigo); }
.path-node__sub { font-size: 0.86rem; color: var(--gray); }

/* =========================================================
   FLASHCARDS & EXERCICES
   ========================================================= */
.flashcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }

.flashcard {
  perspective: 1000px;
  height: 120px;
  cursor: pointer;
}
.flashcard__inner {
  position: relative; width: 100%; height: 100%;
  text-align: center; transition: transform 0.4s ease;
  transform-style: preserve-3d;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.flashcard.is-flipped .flashcard__inner { transform: rotateY(180deg); }

.flashcard__face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.05rem;
  border: 1px solid var(--line);
}
.flashcard__face--front { background: var(--card); color: var(--indigo); }
.flashcard__face--back { background: var(--indigo); color: var(--gold); transform: rotateY(180deg); }
.flashcard__hint { font-size: 0.72rem; color: var(--gray-light); margin-top: 6px; font-weight: 400; }
.flashcard__speak {
  position: absolute; top: 4px; right: 4px; color: var(--clay); opacity: 0.85;
  min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.flashcard__speak:hover { opacity: 1; background: var(--clay-tint); }
.flashcard__speak svg { width: 20px; height: 20px; }

.exercise { background: var(--card); border-radius: var(--radius-md); border: 1px solid var(--line); padding: 22px; margin-bottom: 20px; }
.exercise__title { font-weight: 700; font-size: 1.05rem; color: var(--indigo); margin-bottom: 6px; }
.exercise__instructions { font-size: 0.9rem; color: var(--gray); margin-bottom: 16px; }
.exercise__item { margin-bottom: 16px; }
.exercise__item-text { font-weight: 600; font-size: 0.98rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.speak-btn {
  color: var(--clay); padding: 8px; min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); touch-action: manipulation;
  transition: background 0.15s ease; -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.speak-btn:hover, .speak-btn:active { background: var(--clay-tint); }
.speak-btn svg { width: 20px; height: 20px; }

.mcq-options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.mcq-option {
  padding: 10px 16px; min-height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--cream); font-weight: 600; font-size: 0.94rem; transition: all 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.mcq-option:hover:not(:disabled) { border-color: var(--clay); background: var(--paper); }
.mcq-option:active:not(:disabled) { transform: scale(0.98); }
.mcq-option.is-correct { background: var(--green-tint); border-color: var(--green); color: var(--green); font-weight: 700; }
.mcq-option.is-incorrect { background: var(--red-tint); border-color: var(--red); color: var(--red); font-weight: 700; }

.check-row input[type="text"], .open-input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 1rem; background: var(--paper); min-height: 44px;
}
.check-row input[type="text"]:focus, .open-input:focus { border-color: var(--clay); outline: none; }
.open-input { min-height: 90px; resize: vertical; margin-top: 6px; }

.check-answer { display: none; font-size: 0.9rem; margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm); }
.check-answer.is-visible { display: block; }
.check-answer.is-correct-result { background: var(--green-tint); color: #065F46; border: 1px solid var(--green); }
.check-answer.is-incorrect-result { background: var(--red-tint); color: #991B1B; border: 1px solid var(--red); }

.check-toggle {
  display: inline-flex; align-items: center; gap: 12px; cursor: pointer;
  font-weight: 600; font-size: 0.94rem; min-height: 44px; padding: 8px 12px;
  border-radius: var(--radius-sm); touch-action: manipulation; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.check-toggle:active { background: var(--cream); }
.check-toggle__box {
  width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--gray-light);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all 0.15s ease;
}
.check-toggle.is-checked .check-toggle__box { background: var(--green); border-color: var(--green); color: #FFF; }
.check-toggle__box svg { width: 16px; height: 16px; }

/* STEPPER DE PROGRESSION (4 jalons) */
.stepper {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 16px 18px 14px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.stepper__bar { height: 6px; border-radius: var(--radius-full); background: var(--line); overflow: hidden; }
.stepper__fill { height: 100%; background: var(--green); border-radius: var(--radius-full); transition: width 0.35s ease; }
.stepper__steps {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.stepper__step { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.82rem; color: var(--gray); font-weight: 600; }
.stepper__dot {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream); border: 2px solid var(--gray-light); color: var(--gray);
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
  transition: all 0.2s ease;
}
.stepper__dot svg { width: 14px; height: 14px; }
.stepper__label { min-width: 0; line-height: 1.25; }
.stepper__meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--gray); white-space: nowrap; }
.stepper__step.is-done { color: var(--green); }
.stepper__step.is-done .stepper__dot { background: var(--green); border-color: var(--green); color: #FFF; }
.stepper__step.is-done .stepper__meta { color: var(--green); }
.stepper__step.is-started .stepper__dot { background: var(--green-tint); border-color: var(--green); color: var(--green); }

/* COMPTEUR D'EXERCICES */
.ex-counter {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 0.9rem; font-weight: 600; color: var(--gray);
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 18px;
}
.ex-counter__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-light); flex: 0 0 auto; }
.ex-counter strong { color: var(--indigo); }
.ex-counter.is-complete { background: var(--green-tint); border-color: var(--green); color: var(--green); }
.ex-counter.is-complete .ex-counter__dot { background: var(--green); }
.ex-counter.is-complete strong { color: var(--green); }
.ex-counter__badge { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* EXERCICE COMPLETE */
.exercise.is-done { border-color: var(--green); }
.exercise__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.exercise__done-pill {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  background: var(--green-tint); color: var(--green);
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: var(--radius-full); margin-bottom: 6px;
}
.exercise__done-pill svg { width: 12px; height: 12px; }
.btn--done { background: var(--green-tint); color: var(--green); border: 1px solid var(--green); }
.btn--done:hover { background: #D1FAE5; }
.btn--done svg { width: 15px; height: 15px; }

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  width: calc(100% - 32px); max-width: 420px;
}
.toast {
  background: var(--indigo); color: #FFF; padding: 12px 18px; border-radius: var(--radius-md);
  font-weight: 600; font-size: 0.94rem; box-shadow: var(--shadow-lg); display: flex; align-items: center;
  gap: 10px; animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; pointer-events: auto;
  border: 1px solid rgba(255,255,255,0.15);
}
.toast--success { background: #065F46; border-color: var(--green); }
.toast--info { background: var(--indigo); border-color: var(--gold); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================
   ONBOARDING MODAL & PIN LOGIN
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,34,56,0.65); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--card); border-radius: var(--radius-lg); padding: 36px 32px;
  max-width: 440px; width: 100%; text-align: center; box-shadow: var(--shadow-lg);
}
.modal h2 { font-family: var(--font-display); font-size: 1.45rem; margin-bottom: 10px; color: var(--indigo); }
.modal p { color: var(--gray); margin-bottom: 20px; font-size: 0.92rem; }

.onb-mode-switch {
  display: flex;
  background: var(--cream);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid var(--line);
}
.onb-mode-switch input[type="radio"] { display: none; }
.onb-mode-switch label {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gray);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.onb-mode-switch input[type="radio"]:checked + label {
  background: var(--paper);
  color: var(--indigo);
  box-shadow: var(--shadow-sm);
}

.modal input[type="text"] {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 1rem; margin-bottom: 12px; text-align: center;
}
.modal input[type="text"]:focus { border-color: var(--clay); outline: none; }

.onb-pin-hint { font-size: 0.78rem; color: var(--gray); margin-top: 4px; margin-bottom: 14px; }
.onb-error { color: var(--red); font-size: 0.84rem; font-weight: 600; margin-bottom: 12px; }

/* =========================================================
   ESPACE FORMATEUR
   ========================================================= */
.teacher-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.teacher-code-input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 1rem; text-align: center; letter-spacing: 0.1em;
}
.teacher-code-input:focus { border-color: var(--clay); outline: none; }
.teacher-code-error { color: var(--red); font-size: 0.84rem; margin-top: 8px; }

.teacher-student { margin-bottom: 18px; }
.teacher-student__head { margin-bottom: 14px; }
.teacher-student__name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--indigo); }
.teacher-student__meta { font-family: var(--font-mono); font-size: 0.76rem; color: var(--gray); margin-top: 2px; }

.teacher-submission { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.teacher-submission:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.teacher-submission__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.teacher-submission__type { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.9rem; color: var(--indigo); }
.teacher-submission__type svg { width: 16px; height: 16px; color: var(--clay); }
.teacher-submission__lesson { font-size: 0.85rem; color: var(--gray); margin-bottom: 8px; font-style: italic; }

.feedback-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.feedback-form textarea {
  width: 100%; min-height: 64px; resize: vertical; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.88rem; background: var(--paper);
}
.feedback-form textarea:focus { border-color: var(--gold); outline: none; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 980px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .bottomnav { display: flex; }
  .content { padding: 16px 14px calc(165px + env(safe-area-inset-bottom)); max-width: 100%; }
  .fab-back { bottom: calc(88px + max(16px, env(safe-area-inset-bottom))); right: 14px; }
}
@media (max-width: 520px) {
  .flashcards { grid-template-columns: repeat(2, 1fr); }
  .mcq-option { width: 100%; text-align: center; justify-content: center; }
  .btn { width: 100%; text-align: center; justify-content: center; white-space: normal; word-break: break-word; }
  .card { padding: 18px 14px; margin-bottom: 16px; }
  .path-node { padding: 14px 12px; gap: 12px; }
  .stepper { padding: 14px; }
  .stepper__steps { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
  .stepper__step { font-size: 0.78rem; }
}
