/* =====================================================
   LUMIX – Design System v2.0 "African Sunrise"
   Mobile-first · PWA · Glassmorphism · Modern
   ===================================================== */

/* --- IMPORT FONT -------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900;1000&display=swap');

/* --- VARIABLES ---------------------------------------- */
:root {
  /* Couleurs principales */
  --primary:        #7C3AED;
  --primary-dark:   #5B21B6;
  --primary-mid:    #8B5CF6;
  --primary-light:  #C4B5FD;
  --primary-pale:   #EDE9FE;
  --secondary:      #F97316;
  --secondary-dark: #EA580C;
  --secondary-light:#FED7AA;
  --success:        #10B981;
  --success-light:  #D1FAE5;
  --warning:        #F59E0B;
  --warning-light:  #FEF3C7;
  --danger:         #EF4444;
  --danger-light:   #FEE2E2;
  --info:           #3B82F6;
  --info-light:     #DBEAFE;

  /* Dégradés signature */
  --gradient-primary:  linear-gradient(135deg, #7C3AED 0%, #F97316 100%);
  --gradient-primary-v: linear-gradient(180deg, #7C3AED 0%, #F97316 100%);
  --gradient-purple:   linear-gradient(135deg, #7C3AED 0%, #8B5CF6 100%);
  --gradient-dark:     linear-gradient(135deg, #0F0A1E 0%, #1E1B4B 50%, #2D1B69 100%);
  --gradient-success:  linear-gradient(135deg, #10B981 0%, #059669 100%);
  --gradient-gold:     linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
  --gradient-info:     linear-gradient(135deg, #3B82F6 0%, #6366F1 100%);
  --gradient-sunset:   linear-gradient(135deg, #7C3AED 0%, #DB2777 50%, #F97316 100%);
  --gradient-ocean:    linear-gradient(135deg, #0EA5E9 0%, #6366F1 100%);

  /* Fond & surfaces */
  --bg:              #F5F3FF;
  --bg-dark:         #0F0A1E;
  --surface:         #FFFFFF;
  --surface-2:       #F8F6FF;
  --surface-3:       #F0EDFF;
  --surface-dark:    #1A1438;

  /* Ombres */
  --shadow-xs:    0 1px 3px rgba(124,58,237,0.08);
  --shadow-sm:    0 4px 12px rgba(124,58,237,0.10);
  --shadow-md:    0 8px 24px rgba(124,58,237,0.15);
  --shadow-lg:    0 16px 40px rgba(124,58,237,0.20);
  --shadow-xl:    0 24px 60px rgba(124,58,237,0.25);
  --shadow-glow:  0 0 24px rgba(124,58,237,0.4);
  --card-shadow:  0 4px 20px rgba(124,58,237,0.10);
  --card-shadow-hover: 0 10px 40px rgba(124,58,237,0.22);

  /* Texte */
  --text:        #1E1B4B;
  --text-muted:  #6D6B8A;
  --text-light:  #9E9BB8;
  --text-inverse:#FFFFFF;

  /* Bordures */
  --border:       #E5E0F8;
  --border-focus: #7C3AED;

  /* Navigation */
  --nav-height:   70px;
  --header-height: 64px;

  /* Tailles de police */
  --text-xs:   0.72rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  /* Rayons */
  --radius-xs:  6px;
  --radius-sm:  10px;
  --radius:     16px;
  --radius-lg:  22px;
  --radius-xl:  30px;
  --radius-full: 9999px;

  /* Transitions */
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition:   0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* --- RESET & BASE ------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

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

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
button { cursor: pointer; font-family: inherit; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
}

/* --- LAYOUT PRINCIPAL --------------------------------- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--nav-height);
}

/* --- HEADER ------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(124,58,237,0.08);
  box-shadow: 0 2px 20px rgba(124,58,237,0.08);
}

/* Logo */
.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.app-header .logo-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(124,58,237,0.4);
  flex-shrink: 0;
}
.app-header .logo-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(124,58,237,0.4);
  flex-shrink: 0;
}

.app-header .logo-text {
  font-size: 1.35rem;
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.xp-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--gradient-gold);
  color: white;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(245,158,11,0.4);
  letter-spacing: -0.01em;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #EF4444, #F97316);
  color: white;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(239,68,68,0.4);
}

.avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  border: 2px solid rgba(124,58,237,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: var(--text-base);
  text-transform: uppercase;
  flex-shrink: 0;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(124,58,237,0.35);
  transition: transform var(--transition);
}
.avatar-btn:hover { transform: scale(1.05); }

.app-content {
  flex: 1;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* --- NAVIGATION BAS (avec FAB central) ---------------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(124,58,237,0.10);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  box-shadow: 0 -8px 32px rgba(124,58,237,0.12);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-light);
  transition: all var(--transition);
  padding: 8px 4px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-icon {
  font-size: 1.35rem;
  line-height: 1;
  transition: transform var(--transition-slow);
  display: block;
}

.nav-label {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--transition);
}

.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon { transform: translateY(-2px) scale(1.1); }

/* Indicateur actif */
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
}

/* FAB central (Quiz) */
.nav-fab-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-fab {
  width: 56px;
  height: 56px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: white;
  box-shadow: 0 4px 20px rgba(124,58,237,0.5), 0 0 0 4px rgba(124,58,237,0.12);
  transition: all var(--transition-slow);
  margin-top: -24px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 10;
}

.nav-fab .nav-icon {
  font-size: 1.5rem;
  color: white;
  transform: none;
}

.nav-fab .nav-label {
  font-size: 0.5rem;
  color: rgba(255,255,255,0.9);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-fab:hover, .nav-fab.active {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 28px rgba(124,58,237,0.6), 0 0 0 6px rgba(124,58,237,0.15);
}

.nav-item.active-special { color: var(--secondary); }
.nav-item.active-special::before { background: var(--secondary); }

/* --- BOUTONS ------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 800;
  border: none;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}
.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(124,58,237,0.55);
  color: white;
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.97) translateY(0); }

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white;
  box-shadow: 0 4px 16px rgba(249,115,22,0.35);
}
.btn-secondary:hover { box-shadow: 0 6px 24px rgba(249,115,22,0.5); color: white; }

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 16px rgba(16,185,129,0.35);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: white; }

.btn-sm   { padding: 8px 16px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg   { padding: 16px 28px; font-size: var(--text-lg); border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: 10px; border-radius: var(--radius-full); aspect-ratio: 1; }

/* --- CARTES ------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid rgba(124,58,237,0.04);
}

.card:hover { box-shadow: var(--card-shadow-hover); }

.card-clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card-clickable:active { transform: scale(0.98); }

.card-gradient {
  background: var(--gradient-primary);
  color: white;
  border: none;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 900;
  color: inherit;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- FORMULAIRES -------------------------------------- */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.12);
}

.form-control::placeholder { color: var(--text-light); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237C3AED' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
  cursor: pointer;
}

.form-hint  { font-size: var(--text-xs); color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: var(--text-xs); color: var(--danger); margin-top: 5px; font-weight: 700; }

/* Checkbox custom */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }

.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--surface);
}

.checkbox-pill input { display: none; }
.checkbox-pill:has(input:checked) {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}

/* --- HERO / SECTION HEADER ---------------------------- */
.hero-section {
  background: var(--gradient-dark);
  border-radius: var(--radius-xl);
  padding: 28px 22px;
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Orbes décoratifs */
.hero-section::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(124,58,237,0.6) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -50px;
  left: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(249,115,22,0.5) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-greeting {
  font-size: var(--text-sm);
  opacity: 0.75;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: var(--text-3xl);
  font-weight: 900;
  margin-bottom: 16px;
  line-height: 1.2;
  position: relative;
  z-index: 1;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.hero-title span {
  background: linear-gradient(135deg, #C4B5FD, #FED7AA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.hero-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 800;
  backdrop-filter: blur(10px);
}

/* --- STATS GRID --------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Couleurs alternées pour les stat cards */
.stat-card:nth-child(1) { background: linear-gradient(135deg, #7C3AED15, #7C3AED08); border: 1px solid #7C3AED25; }
.stat-card:nth-child(2) { background: linear-gradient(135deg, #10B98115, #10B98108); border: 1px solid #10B98125; }
.stat-card:nth-child(3) { background: linear-gradient(135deg, #F9711615, #F9711608); border: 1px solid #F9711625; }
.stat-card:nth-child(4) { background: linear-gradient(135deg, #3B82F615, #3B82F608); border: 1px solid #3B82F625; }

.stat-card::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.15;
}
.stat-card:nth-child(1)::before { background: #7C3AED; }
.stat-card:nth-child(2)::before { background: #10B981; }
.stat-card:nth-child(3)::before { background: #F97316; }
.stat-card:nth-child(4)::before { background: #3B82F6; }

.stat-card .stat-icon {
  font-size: 1.8rem;
  line-height: 1;
  display: block;
}

.stat-card .stat-value {
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.03em;
}

.stat-card .stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- SECTION TITLES ----------------------------------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.section-link {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- SUBJECT CARDS ------------------------------------ */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.subject-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition);
}

.subject-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border); }
.subject-card:hover::before { opacity: 1; }
.subject-card:active { transform: scale(0.97); }
.subject-card.active { border-color: var(--primary-light); }

.subject-card .subject-icon {
  font-size: 2rem;
  line-height: 1;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--primary-pale);
  flex-shrink: 0;
}

.subject-card .subject-name {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

.subject-card .subject-progress { display: flex; flex-direction: column; gap: 5px; }

.subject-card .progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 700;
}

/* --- PROGRESS BARS ------------------------------------ */
.progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.7s var(--ease);
}

/* --- LESSON ITEMS ------------------------------------- */
.lesson-list { display: flex; flex-direction: column; gap: 10px; }

.lesson-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  border: 1.5px solid var(--border);
}

.lesson-item:hover { box-shadow: var(--shadow-sm); border-color: var(--primary-light); transform: translateX(4px); }
.lesson-item:active { transform: scale(0.99); }

.lesson-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

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

.lesson-title {
  font-size: var(--text-base);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 700;
}

.lesson-status {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  font-weight: 800;
}

.status-done    { background: var(--success-light); color: var(--success); }
.status-started { background: var(--warning-light);  color: var(--warning); }
.status-new     { background: var(--surface-3);      color: var(--text-light); }

/* --- QUIZ CARDS --------------------------------------- */
.quiz-card {
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  padding: 22px;
  color: white;
  margin-bottom: 14px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(124,58,237,0.3);
}

.quiz-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

.quiz-card::after {
  content: '▶';
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.quiz-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(124,58,237,0.45); }
.quiz-card:active { transform: scale(0.98); }

/* --- DAILY CHALLENGE ---------------------------------- */
.challenge-card {
  background: linear-gradient(135deg, #0F0A1E 0%, #1E1B4B 50%, #2D1B69 100%);
  border-radius: var(--radius-xl);
  padding: 22px;
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(196,181,253,0.2);
  box-shadow: 0 8px 32px rgba(15,10,30,0.4);
}

.challenge-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(124,58,237,0.5) 0%, transparent 70%);
}

.challenge-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(249,115,22,0.2));
  border: 1px solid rgba(245,158,11,0.4);
  color: #FCD34D;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.challenge-question {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.challenge-options { display: flex; flex-direction: column; gap: 8px; }

.challenge-option {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.challenge-option:hover, .challenge-option:focus {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.25);
}
.challenge-option:active { transform: scale(0.99); }
.challenge-option.selected-correct { background: rgba(16,185,129,0.25); border-color: #10B981; }
.challenge-option.selected-wrong   { background: rgba(239,68,68,0.25);  border-color: #EF4444; }
.challenge-option.reveal-correct   { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.4); }

/* --- BADGES ------------------------------------------- */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  text-align: center;
  opacity: 0.4;
  filter: grayscale(1);
  transition: all var(--transition);
  border: 1.5px solid var(--border);
}

.badge-item.earned {
  opacity: 1;
  filter: none;
  border-color: transparent;
}

.badge-item .badge-icon { font-size: 2rem; line-height: 1; }
.badge-item .badge-name { font-size: 0.6rem; font-weight: 800; color: var(--text-muted); line-height: 1.3; }

.badge-rarity-rare      { box-shadow: 0 4px 16px rgba(124,58,237,0.3); border-color: var(--primary-light); }
.badge-rarity-epic      { box-shadow: 0 4px 20px rgba(249,115,22,0.4); border-color: var(--secondary-light); }
.badge-rarity-legendary { box-shadow: 0 4px 24px rgba(245,158,11,0.5); border-color: #FDE68A; }

/* Icône info badge (coin haut-droit) */
.badge-info-ico {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  color: rgba(0,0,0,0.2);
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.badge-info-ico svg { width: 100%; height: 100%; display: block; }
.badge-info-ico:active { transform: scale(1.3); }
.badge-info-ico.earned { color: var(--primary); opacity: 0.6; }
@keyframes badgePopIn {
  from { opacity:0; transform:scale(0.85) translateY(20px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

/* --- ALERTES / FLASH ---------------------------------- */
.flash-container {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  pointer-events: all;
  animation: slideDown 0.35s var(--ease-spring);
}

.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10B981; }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #EF4444; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3B82F6; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #F59E0B; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- QUIZ GAME UI ------------------------------------- */
.quiz-game { padding: 0; position: relative; }

.quiz-header {
  background: var(--gradient-dark);
  padding: 18px 16px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  color: white;
  display: flex;
  align-items: center;
  gap: 14px;
}

.quiz-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.18);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #C4B5FD, white);
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease);
}

.quiz-counter { font-size: var(--text-sm); font-weight: 900; white-space: nowrap; }

.quiz-timer {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-size: var(--text-sm);
  font-weight: 800;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
}

.quiz-body {
  background: var(--surface);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  padding: 26px 20px;
  box-shadow: var(--shadow-sm);
}

.quiz-question {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

/* ── Notation mathématique (quiz + leçons) ────── */
.quiz-question sup,
.quiz-question sub,
.quiz-options   sup,
.quiz-options   sub,
#lessonContent  sup,
#lessonContent  sub {
  font-size: 0.72em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
  font-weight: 700;
}
.quiz-question sup, .quiz-options sup, #lessonContent sup { top: -0.5em; }
.quiz-question sub, .quiz-options sub, #lessonContent sub { bottom: -0.25em; }

/* Formule inline (encadrée) */
.math-inline {
  display: inline-block;
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: 0.92em;
  background: var(--surface-2, #f3f4f6);
  color: var(--primary, #7C3AED);
  border-radius: 5px;
  padding: 1px 6px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Fraction verticale */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: 0.85em;
  line-height: 1.1;
  margin: 0 2px;
  position: relative;
  top: -1px;
}
.math-num {
  border-bottom: 1.5px solid currentColor;
  padding: 0 3px 1px;
  font-weight: 700;
}
.math-den {
  padding: 1px 3px 0;
  font-weight: 700;
}

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

.quiz-option {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  -webkit-tap-highlight-color: transparent;
}

.quiz-option .option-letter {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 900;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition);
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--primary-light);
  background: var(--primary-pale);
  transform: translateX(4px);
}
.quiz-option.selected   { border-color: var(--primary); background: var(--primary-pale); }
.quiz-option.selected .option-letter { background: var(--primary); color: white; }
.quiz-option.correct    { border-color: var(--success); background: var(--success-light); }
.quiz-option.correct .option-letter { background: var(--success); color: white; }
.quiz-option.wrong      { border-color: var(--danger); background: var(--danger-light); }
.quiz-option.wrong .option-letter  { background: var(--danger); color: white; }
.quiz-option:disabled   { cursor: default; opacity: 0.75; }

.quiz-explanation {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--warning-light);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: #78350F;
  font-weight: 600;
  display: none;
  line-height: 1.5;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}

/* --- RÉSULTAT QUIZ ------------------------------------ */
.result-card {
  text-align: center;
  padding: 36px 20px;
}

.result-emoji { font-size: 4.5rem; margin-bottom: 14px; display: block; }

.result-score {
  font-size: var(--text-4xl);
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: -0.04em;
}

.result-label { font-size: var(--text-base); color: var(--text-muted); font-weight: 700; }

.xp-earned-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient-gold);
  color: white;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: var(--text-lg);
  font-weight: 900;
  margin: 18px auto;
  box-shadow: 0 4px 16px rgba(245,158,11,0.4);
}

/* --- FLASHCARDS --------------------------------------- */
.flashcard-scene {
  perspective: 1200px;
  width: 100%;
  max-width: 380px;
  height: 230px;
  margin: 0 auto 24px;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease);
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.flashcard-front {
  background: var(--gradient-dark);
  color: white;
  border: 1px solid rgba(124,58,237,0.3);
}

.flashcard-back {
  background: var(--surface);
  border: 2px solid var(--primary-light);
  color: var(--text);
  transform: rotateY(180deg);
}

.flashcard-text { font-size: var(--text-lg); font-weight: 800; line-height: 1.5; letter-spacing: -0.01em; }
.flashcard-hint { font-size: var(--text-sm); opacity: 0.6; margin-top: 10px; }

.flashcard-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.quality-btn {
  padding: 14px 10px;
  border-radius: var(--radius);
  border: none;
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.quality-btn:active { transform: scale(0.95); }
.quality-btn-fail  { background: var(--danger-light);  color: var(--danger); }
.quality-btn-hard  { background: var(--warning-light); color: var(--warning); }
.quality-btn-good  { background: var(--success-light); color: var(--success); }
.quality-btn-easy  { background: var(--info-light);    color: var(--info); }

/* --- PROGRESS CHART ----------------------------------- */
.week-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  padding: 0 4px;
}

.week-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.week-bar-fill {
  flex: 1;
  width: 100%;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  position: relative;
  overflow: hidden;
}

.week-bar-fill::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--gradient-primary);
  border-radius: inherit;
  transition: height 0.7s var(--ease);
}

.week-bar-label { font-size: 0.58rem; font-weight: 800; color: var(--text-light); text-transform: uppercase; }

/* --- TAGS / PILLS ------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.tag-primary   { background: var(--primary-pale); color: var(--primary); }
.tag-success   { background: var(--success-light); color: #065f46; }
.tag-warning   { background: var(--warning-light); color: #92400e; }
.tag-danger    { background: var(--danger-light);  color: #991b1b; }
.tag-secondary { background: #FFF7ED; color: var(--secondary-dark); }
.tag-easy      { background: var(--success-light); color: #065f46; }
.tag-medium    { background: var(--warning-light); color: #92400e; }
.tag-hard      { background: var(--danger-light);  color: #991b1b; }

/* --- TABS --------------------------------------------- */
.tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
  gap: 2px;
  border: 1.5px solid var(--border);
}

.tab-item {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 800;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(124,58,237,0.12);
}

/* --- SEARCH ------------------------------------------- */
.search-bar {
  position: relative;
  margin-bottom: 20px;
}

.search-bar input { padding-left: 46px; }

.search-bar .search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--text-light);
  pointer-events: none;
}

/* --- LEADERBOARD -------------------------------------- */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: 8px;
  border: 1.5px solid transparent;
  transition: all var(--transition);
}

.leaderboard-rank {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 900;
  color: var(--text-muted);
  flex-shrink: 0;
}

.leaderboard-rank.rank-1 { background: linear-gradient(135deg, #FDE68A, #F59E0B); color: #78350F; }
.leaderboard-rank.rank-2 { background: linear-gradient(135deg, #E2E8F0, #CBD5E1); color: #475569; }
.leaderboard-rank.rank-3 { background: linear-gradient(135deg, #FED7AA, #FB923C); color: #7C2D12; }

.leaderboard-name { flex: 1; font-weight: 800; font-size: var(--text-sm); }
.leaderboard-xp   { font-weight: 900; color: var(--primary); font-size: var(--text-sm); }
.leaderboard-item.is-me { background: var(--primary-pale); border-color: var(--primary-light); }

/* --- OFFLINE INDICATOR -------------------------------- */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #0F0A1E, #1E1B4B);
  color: white;
  text-align: center;
  padding: 9px 16px;
  font-size: var(--text-sm);
  font-weight: 800;
  z-index: 9999;
  transform: translateY(-100%);
  transition: transform var(--transition-slow);
}

.offline-banner.visible { transform: translateY(0); }

.offline-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  margin-right: 8px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* --- LOADING / SKELETON ------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- ANNALES ------------------------------------------ */
.annals-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
}

.annals-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.annals-card:active { transform: scale(0.98); }

.annals-year {
  display: inline-flex;
  align-items: center;
  background: var(--gradient-primary);
  color: white;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

.annals-title { font-size: var(--text-sm); font-weight: 800; line-height: 1.4; }
.annals-actions { display: flex; gap: 8px; }

/* --- MODALS ------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,10,30,0.75);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  backdrop-filter: blur(6px);
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.3);
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: -8px auto 20px;
}

/* --- ONBOARDING --------------------------------------- */
.onboarding-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gradient-dark);
  color: white;
}

.onboarding-step {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 28px 20px;
  animation: fadeIn 0.4s var(--ease);
}

.onboarding-step.active { display: flex; }

.onboarding-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 36px;
}

.onboarding-dot {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.18);
  transition: background var(--transition);
}
.onboarding-dot.done { background: linear-gradient(90deg, #C4B5FD, white); }

.onboarding-title { font-size: var(--text-3xl); font-weight: 900; margin-bottom: 8px; letter-spacing: -0.02em; }
.onboarding-subtitle { font-size: var(--text-base); opacity: 0.7; margin-bottom: 32px; line-height: 1.6; }

.country-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.country-btn {
  padding: 14px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: white;
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.country-btn.selected {
  background: rgba(124,58,237,0.4);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}
.country-btn:active { transform: scale(0.97); }

.level-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.level-btn {
  padding: 17px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: white;
  font-size: var(--text-base);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  -webkit-tap-highlight-color: transparent;
}

.level-btn.selected {
  background: rgba(124,58,237,0.4);
  border-color: var(--primary-light);
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
  max-height: 360px;
  overflow-y: auto;
}

.subject-toggle {
  padding: 14px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: white;
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}

.subject-toggle.selected {
  background: rgba(124,58,237,0.4);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}

/* --- AUTH LAYOUT --------------------------------------- */
.auth-layout {
  min-height: 100vh;
  background: var(--gradient-dark);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.auth-top {
  background: var(--gradient-primary);
  padding: 56px 24px 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-top::before {
  content: '';
  position: absolute;
  top: -70px;
  right: -70px;
  width: 220px;
  height: 220px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

.auth-top::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 160px;
  height: 160px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.auth-logo {
  font-size: 3.5rem;
  font-weight: 900;
  color: white;
  margin-bottom: 10px;
  display: block;
  text-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.auth-tagline {
  color: rgba(255,255,255,0.85);
  font-size: var(--text-base);
  font-weight: 700;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  margin-top: -28px;
  padding: 32px 22px;
  flex: 1;
  min-height: 50vh;
  position: relative;
  z-index: 1;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.2);
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: 900;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 28px;
  font-weight: 600;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  color: var(--text-light);
  font-size: var(--text-sm);
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 20px;
  padding-bottom: 24px;
  font-weight: 600;
}

.auth-footer a { font-weight: 900; color: var(--primary); }

/* --- UTILITAIRES -------------------------------------- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-white   { color: white; }
.text-sm  { font-size: var(--text-sm); }
.text-xs  { font-size: var(--text-xs); }
.text-lg  { font-size: var(--text-lg); }
.text-xl  { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.font-bold   { font-weight: 700; }
.font-black  { font-weight: 900; }
.font-medium { font-weight: 600; }

.d-flex      { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-col    { flex-direction: column; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }

.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

.p-12  { padding: 12px; }
.p-16  { padding: 16px; }
.p-20  { padding: 20px; }

.rounded    { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }
.ml-4 { margin-left: 4px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.overflow-hidden { overflow: hidden; }

/* --- ANIMATIONS --------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

.animate-fade   { animation: fadeIn 0.35s var(--ease); }
.animate-scale  { animation: fadeInScale 0.3s var(--ease-spring); }
.animate-up     { animation: slideUp 0.4s var(--ease); }

/* --- TOAST NOTIFICATION ------------------------------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 700;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  opacity: 0;
  transition: all var(--transition-slow);
  z-index: 2000;
  white-space: nowrap;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- RESPONSIVE (tablette/desktop) -------------------- */
@media (min-width: 640px) {
  .app-content { padding: 24px; max-width: 560px; }
  .stats-grid  { grid-template-columns: repeat(4, 1fr); }
  .auth-card   { max-width: 480px; margin: -28px auto 0; border-radius: var(--radius-xl); }
  .auth-top    { padding: 72px 24px 90px; }
}

@media (min-width: 1024px) {
  body { background: #EDE9FE; }
  .app-layout {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 80px rgba(124,58,237,0.18);
    border-radius: 28px;
    min-height: 100vh;
    background: white;
    overflow: hidden;
  }
  .bottom-nav   { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: 0 0 28px 28px; }
  .app-header   { border-radius: 28px 28px 0 0; }
  .flash-container { max-width: 480px; }
  .offline-banner  { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: var(--radius); top: 8px; }
}

/* --- NAV LOADER (barre progression haut) -------------- */
#navLoader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
}
#navLoader.active { opacity: 1; }
.nav-loader-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
  border-radius: 0 2px 2px 0;
  animation: none;
}
#navLoader.active .nav-loader-bar {
  animation: navLoad 1.5s ease-in-out forwards;
}
@keyframes navLoad {
  0%   { width: 0; }
  20%  { width: 40%; }
  50%  { width: 65%; }
  80%  { width: 85%; }
  100% { width: 95%; }
}

/* --- OFFLINE ILLUSTRATION ANIMEE ---------------------- */
.offline-illustration { text-align: center; padding: 40px 16px; }
.offline-illu-icon { position: relative; width: 140px; height: 140px; margin: 0 auto 20px; }

/* Élève stylisé */
.offline-student { position: relative; width: 60px; margin: 0 auto; }
.student-head {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  margin: 0 auto 2px; position: relative; z-index: 2;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}
.student-head::after { /* yeux pensifs */
  content: ''; position: absolute; top: 14px; left: 8px;
  width: 6px; height: 3px; border-radius: 50%;
  background: #92400E; box-shadow: 14px 0 0 #92400E;
}
.student-body {
  width: 32px; height: 40px; margin: 0 auto;
  background: linear-gradient(135deg, var(--primary), #6D28D9);
  border-radius: 8px 8px 4px 4px; position: relative; z-index: 1;
}
.student-backpack {
  position: absolute; top: 30px; right: -6px; width: 18px; height: 24px;
  background: #F97316; border-radius: 4px; z-index: 0;
  box-shadow: 0 2px 6px rgba(249,115,22,0.3);
}
.student-backpack::after {
  content: ''; position: absolute; top: 4px; left: 3px;
  width: 12px; height: 8px; border: 2px solid rgba(255,255,255,0.4);
  border-radius: 2px;
}
.student-arm-left {
  position: absolute; top: 42px; left: 4px; width: 8px; height: 20px;
  background: var(--primary); border-radius: 4px; z-index: 2;
  transform-origin: top center;
  animation: armThink 2s ease-in-out infinite;
}
.student-arm-right {
  position: absolute; top: 42px; right: 10px; width: 8px; height: 20px;
  background: var(--primary); border-radius: 4px; z-index: 2;
}

@keyframes armThink {
  0%, 100% { transform: rotate(-15deg); }
  50% { transform: rotate(5deg); }
}

/* WiFi barré animé */
.offline-wifi {
  position: absolute; top: 0; right: 10px; width: 36px; height: 36px;
  color: #9CA3AF;
  animation: wifiBounce 3s ease-in-out infinite;
}
.offline-wifi svg { width: 100%; height: 100%; }
@keyframes wifiBounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(-6px); opacity: 1; }
}

/* Points de réflexion */
.offline-dots {
  position: absolute; top: 8px; left: 12px;
  display: flex; gap: 4px;
}
.offline-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); opacity: 0.3;
  animation: dotPulse 1.5s ease-in-out infinite;
}
.offline-dots span:nth-child(2) { animation-delay: 0.3s; }
.offline-dots span:nth-child(3) { animation-delay: 0.6s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

.offline-illu-title { font-size: var(--text-lg); font-weight: 900; color: var(--text-primary); margin-bottom: 8px; }
.offline-illu-msg { font-size: var(--text-sm); color: var(--text-muted); font-weight: 600; line-height: 1.5; max-width: 280px; margin: 0 auto; }

/* --- BOUTONS DE TELECHARGEMENT ----------------------- */
.dl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: var(--text-xs); font-weight: 800; color: var(--primary);
  cursor: pointer; transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.dl-btn:active { transform: scale(0.95); }
.dl-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.dl-btn.dl-done { color: #10B981; border-color: #10B981; background: rgba(16,185,129,0.06); }

.dl-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Badge hors ligne dans le header */
.offline-badge {
  display: none; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 800; color: #F59E0B;
  background: rgba(245,158,11,0.1); padding: 2px 8px;
  border-radius: 99px; text-transform: uppercase; letter-spacing: 0.5px;
}
.is-offline .offline-badge { display: inline-flex; }

/* --- PWA INSTALL PROMPT ------------------------------- */
.pwa-install-banner {
  position: fixed;
  bottom: calc(var(--nav-height) + 14px);
  left: 14px;
  right: 14px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 -4px 30px rgba(124,58,237,0.2), 0 8px 30px rgba(124,58,237,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 500;
  transform: translateY(140%);
  transition: transform 0.45s var(--ease-spring);
  border: 2px solid var(--primary-light);
}

.pwa-install-banner.visible { transform: translateY(0); }

.pwa-install-banner .install-icon { font-size: 2.2rem; }
.pwa-install-banner .install-text { flex: 1; }
.pwa-install-banner .install-text strong { display: block; font-size: var(--text-sm); font-weight: 900; color: var(--text); }
.pwa-install-banner .install-text span   { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }

/* --- RIPPLE EFFECT ------------------------------------ */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transform: scale(0);
  animation: rippleEffect 0.6s linear;
  pointer-events: none;
}

@keyframes rippleEffect {
  to { transform: scale(4); opacity: 0; }
}

/* =====================================================
   BOUTON RETOUR (sous-pages)
   ===================================================== */
.back-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -8px -4px 14px;
  padding: 0;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-size: var(--text-sm);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.back-btn:active { transform: scale(0.95); background: rgba(124,58,237,0.08); }
.back-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.back-bar-title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =====================================================
   OBJECTIFS JOURNALIERS
   ===================================================== */

/* Barre de progression globale */
.obj-progress-wrap {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.obj-progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.obj-progress-label { font-size: var(--text-sm); font-weight: 700; color: var(--text-primary); }
.obj-progress-pct { font-size: var(--text-sm); font-weight: 900; color: var(--primary); }
.obj-progress-bar {
  width: 100%; height: 10px;
  background: rgba(124,58,237,0.12);
  border-radius: 999px; overflow: hidden;
}
.obj-progress-fill {
  height: 100%; border-radius: 999px;
  background: var(--gradient-primary);
  transition: width 0.6s ease;
}

/* Liste d'objectifs */
.obj-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.obj-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 14px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.obj-card.obj-done {
  background: rgba(16,185,129,0.06);
  border-color: rgba(16,185,129,0.25);
}

/* Icone objectif */
.obj-icon-wrap {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.obj-icon-easy   { background: rgba(16,185,129,0.12); }
.obj-icon-medium { background: rgba(245,158,11,0.12); }
.obj-icon-hard   { background: rgba(239,68,68,0.12); }
.obj-icon-done   { background: rgba(16,185,129,0.18); }

/* Info objectif */
.obj-info { flex: 1; min-width: 0; }
.obj-title { font-size: var(--text-sm); font-weight: 800; color: var(--text-primary); line-height: 1.3; }
.obj-desc { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; line-height: 1.3; }

/* Mini barre de progression */
.obj-bar-mini {
  width: 100%; height: 5px; margin-top: 6px;
  background: rgba(124,58,237,0.1);
  border-radius: 999px; overflow: hidden;
}
.obj-bar-mini-fill {
  height: 100%; border-radius: 999px;
  background: var(--gradient-primary);
  transition: width 0.5s ease;
}
.obj-done .obj-bar-mini-fill { background: #10B981; }

/* Meta */
.obj-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px;
  font-size: 11px; color: var(--text-muted); font-weight: 600;
}
.obj-xp-tag {
  background: rgba(124,58,237,0.12);
  color: var(--primary);
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 800;
}

/* Action (claim / check / pending) */
.obj-action { flex-shrink: 0; display: flex; align-items: center; }
.obj-claim-btn {
  background: var(--gradient-primary);
  color: white; border: none; border-radius: var(--radius-lg);
  padding: 8px 14px; font-size: var(--text-xs); font-weight: 900;
  cursor: pointer; animation: pulse-claim 1.5s infinite;
  white-space: nowrap;
}
@keyframes pulse-claim {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(124,58,237,0); }
}
.obj-check { font-size: 1.4rem; }
.obj-pending { font-size: 1.4rem; color: var(--text-muted); opacity: 0.4; }

/* XP popup animation */
.obj-xp-popup {
  position: absolute; top: 50%; right: 60px;
  background: var(--gradient-primary);
  color: white; padding: 4px 12px; border-radius: 999px;
  font-size: var(--text-xs); font-weight: 900;
  animation: xpFloat 1.5s ease-out forwards;
  pointer-events: none; z-index: 10;
}
@keyframes xpFloat {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* ── Historique ── */
.obj-calendar {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 20px;
}
.obj-cal-header {
  text-align: center; font-size: 10px; font-weight: 800;
  color: var(--text-muted); text-transform: uppercase; padding: 4px 0;
}
.obj-cal-day {
  aspect-ratio: 1; border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-secondary);
  background: var(--glass-bg); border: 1px solid transparent;
  position: relative;
}
.obj-cal-today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(124,58,237,0.2); }
.obj-cal-perfect { background: rgba(16,185,129,0.15); color: #059669; border-color: rgba(16,185,129,0.3); }
.obj-cal-partial { background: rgba(245,158,11,0.12); color: #D97706; }
.obj-cal-missed  { background: rgba(239,68,68,0.08); color: #DC2626; opacity: 0.5; }
.obj-cal-future  { opacity: 0.2; }
.obj-cal-num { font-size: 12px; }
.obj-cal-icon { font-size: 10px; line-height: 1; }

/* Liste historique */
.obj-history-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.obj-history-day {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl); overflow: hidden;
}
.obj-history-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; cursor: pointer;
}
.obj-history-date { display: flex; flex-direction: column; }
.obj-history-label { font-size: var(--text-sm); font-weight: 800; color: var(--text-primary); }
.obj-history-dow { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.obj-history-stats {
  display: flex; align-items: center; gap: 8px;
}
.obj-history-count { font-size: var(--text-sm); font-weight: 800; color: var(--text-primary); }
.obj-history-bar {
  width: 50px; height: 6px; background: rgba(124,58,237,0.1);
  border-radius: 999px; overflow: hidden;
}
.obj-history-bar-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.obj-history-chevron {
  font-size: 12px; color: var(--text-muted);
  transition: transform 0.2s ease; display: inline-block;
}
.obj-history-day.open .obj-history-chevron { transform: rotate(180deg); }

.obj-history-details {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 14px;
}
.obj-history-day.open .obj-history-details {
  max-height: 500px; padding: 0 14px 12px;
}
.obj-history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: var(--text-sm);
  border-bottom: 1px solid rgba(124,58,237,0.06);
}
.obj-history-item:last-child { border-bottom: none; }
.obj-history-ok { color: var(--text-primary); }
.obj-history-fail { color: var(--text-muted); opacity: 0.7; }
.obj-history-prog { margin-left: auto; font-size: 11px; color: var(--text-muted); font-weight: 700; }

/* =====================================================
   TABLEAUX & GRAPHIQUES — Exercices & Cours
   ===================================================== */

/* Tables dans les exercices et cours */
#exerciseContent table,
#correctionContent table,
#lessonContent table,
.exercise-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  font-size: var(--text-sm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: table;
}

#exerciseContent table th,
#correctionContent table th,
#lessonContent table th,
.exercise-content table th {
  background: linear-gradient(135deg, #7C3AED12, #6D28D915);
  color: var(--text-primary);
  font-weight: 800;
  padding: 12px 14px;
  text-align: center;
  border-bottom: 2px solid rgba(124,58,237,0.15);
  font-size: var(--text-sm);
  white-space: nowrap;
}

#exerciseContent table td,
#correctionContent table td,
#lessonContent table td,
.exercise-content table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(124,58,237,0.08);
  text-align: center;
  vertical-align: middle;
  font-weight: 600;
}

#exerciseContent table tr:last-child td,
#correctionContent table tr:last-child td,
#lessonContent table tr:last-child td,
.exercise-content table tr:last-child td {
  border-bottom: none;
}

#exerciseContent table tr:nth-child(even),
#correctionContent table tr:nth-child(even),
#lessonContent table tr:nth-child(even),
.exercise-content table tr:nth-child(even) {
  background: rgba(124,58,237,0.02);
}

#exerciseContent table tr:hover,
#correctionContent table tr:hover,
#lessonContent table tr:hover {
  background: rgba(124,58,237,0.05);
}

/* Première colonne alignée à gauche (souvent les labels) */
#exerciseContent table td:first-child,
#correctionContent table td:first-child,
#lessonContent table td:first-child,
.exercise-content table td:first-child {
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
}

/* Tableaux de valeurs scientifiques (t, x, v, etc.) */
.data-table {
  font-family: 'Courier New', monospace;
}
.data-table td { letter-spacing: 0.02em; }
.data-table th { letter-spacing: 0.05em; text-transform: uppercase; font-size: 0.78rem; }

/* Graphique / Repère (cadre pour les descriptions graphiques) */
.graph-frame, .repere-frame {
  border: 2px solid rgba(124,58,237,0.2);
  border-radius: var(--radius-xl);
  background: white;
  padding: 20px;
  margin: 16px 0;
  text-align: center;
  position: relative;
}
.graph-frame::before {
  content: '📊 Représentation graphique';
  position: absolute;
  top: -10px;
  left: 16px;
  background: white;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.repere-frame::before {
  content: '📐 Repère';
}

/* Listes ordonnées dans exercices (1., 2., 3.) */
#exerciseContent ol,
#correctionContent ol {
  counter-reset: exo-counter;
  padding-left: 0;
  list-style: none;
}
#exerciseContent ol > li,
#correctionContent ol > li {
  counter-increment: exo-counter;
  padding-left: 32px;
  position: relative;
  margin-bottom: 12px;
  line-height: 1.7;
}
#exerciseContent ol > li::before,
#correctionContent ol > li::before {
  content: counter(exo-counter) '.';
  position: absolute;
  left: 0;
  font-weight: 900;
  color: var(--primary);
  font-size: 0.95em;
}

/* Sous-listes (a), b), c)) */
#exerciseContent ol ol,
#correctionContent ol ol {
  counter-reset: sub-counter;
  margin-top: 8px;
}
#exerciseContent ol ol > li::before,
#correctionContent ol ol > li::before {
  content: counter(sub-counter, lower-alpha) ')';
  counter-increment: sub-counter;
}

/* Formules en bloc dans exercices */
#exerciseContent .formula,
#correctionContent .formula,
.exercise-content .formula {
  background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(124,58,237,0.02));
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-family: 'Courier New', monospace;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--primary-dark, #5B21B6);
  margin: 14px 0;
  overflow-x: auto;
  text-align: center;
}

/* Unités scientifiques */
.unit { font-style: italic; color: var(--text-secondary); font-weight: 600; }

/* Encadré de résultat dans correction */
#correctionContent .result-box,
.result-box {
  background: rgba(16,185,129,0.06);
  border: 1.5px solid rgba(16,185,129,0.25);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin: 12px 0;
  font-weight: 800;
  color: #059669;
  text-align: center;
}

/* Données expérimentales */
.exp-data {
  background: #FFFBEB;
  border: 1.5px solid #FCD34D;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin: 12px 0;
  font-size: var(--text-sm);
}
.exp-data strong { color: #92400E; }

/* Responsive: tables scrollables sur mobile */
@media (max-width: 480px) {
  #exerciseContent table,
  #correctionContent table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  #exerciseContent table th,
  #exerciseContent table td,
  #correctionContent table th,
  #correctionContent table td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
}
