/* ==========================================================================
   MAIN.CSS - FICHIER DE BASE OPTIMISÉ + RESPONSIVE
   
   TABLE DES MATIÈRES
   1.  VARIABLES & DESIGN SYSTEM
   2.  THÈME SOMBRE
   3.  RESET & STYLES DE BASE
   4.  TYPOGRAPHIE
   5.  LAYOUT GÉNÉRAL
   6.  NAVIGATION PRINCIPALE
   7.  BOUTONS UNIFIÉS
   8.  DROPDOWNS (Nouveau - Centralisé)
   9.  COMPOSANTS RÉUTILISABLES (Cards, Feedback, etc.)
   10. FOCUS CLAVIER
   11. UTILITAIRES & ANIMATIONS
   12. RESPONSIVE (TABLETTES ET MOBILE)
   13. IMPRESSION
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Great+Vibes&family=Nunito:wght@400;600;700&display=swap");
/* ==========================================================================
   1. VARIABLES & DESIGN SYSTEM
   ========================================================================== */
:root {
  /* Polices */
  --_font-family:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
    sans-serif;
  --_fw-normal: 400;
  --_fw-bold: 700;
  --_fw-black: 900;

  --_font-size-base: 1.25rem;
  --_font-size-lg: 1.5rem;
  --_font-size-xl: 1.875rem;
  --_font-size-2xl: 2.25rem;

  --_spacing-xs: 0.25rem;
  --_spacing-sm: 0.5rem;
  --_spacing-md: 1rem;
  --_spacing-lg: 1.5rem;
  --_spacing-xl: 2rem;

  --_radius: 1rem;
  --_radius-sm: 0.75rem;
  --_radius-md: 1rem;

  --_min-touch-target: 2.75rem;

  --_transition-fast: 0.15s ease;
  --_transition-speed: 0.2s ease;
  --_transition-smooth: 0.3s ease-out;

  /* Thème Clair (par défaut) */
  --_background: #f4f4f4;
  --_surface: #ffffff;
  --_surface-alt: #f0f2f5;
  --_text: #2d3748;
  --_text-secondary: #4a5568;
  --_primary: #4a5568;
  --_accent: #8b5cf6;
  --_accent-pulse: rgba(88, 38, 103, 0.5);

  --_shadow: 0 0.3125rem 0.9375rem rgba(74, 85, 104, 0.15);
  --_shadow-lg: 0 0.625rem 1.875rem rgba(74, 85, 104, 0.2);
  --_shadow-strong: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
  --_shadow-outset: 0 0.375rem 1.375rem rgb(0 0 0 / 0.13);
  --_inner-shadow:
    inset 0.25rem 0.25rem 0.5rem #d1d9e6, inset -0.25rem -0.25rem 0.5rem #ffffff;

  --_correct: #0d5c2e;
  --_incorrect: #991111;
  --_missed: #d97706;
  --_neutral: #d7dbe1;
  --_selected: #329137;
  --_linked: #2563eb;

  --_border-light: 0.0625rem solid #e2e8f0;
  --_border-default: 0.125rem solid var(--_primary);
}

/* ==========================================================================
   2. THÈME SOMBRE
   ========================================================================== */
:root[data-theme="dark"] {
  --_background: #1a202c;
  --_surface: #2d3748;
  --_surface-alt: #374151;
  --_text: #f7fafc;
  --_text-secondary: #a0aec0;
  --_primary: #cbd5e0;
  --_accent: #9f7aea;
  --_shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.3);
  --_shadow-lg: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.3);
  --_border-light: 0.0625rem solid #4a5568;
  --_link-color: #93c5fd;
  --_link-hover: #60a5fa;
}
:root[data-theme="dark"] .main a:not(.btn):not(.nav-link),
:root[data-theme="dark"] .card-raised a:not(.btn) {
  color: var(--_link-color);
}

:root[data-theme="dark"] .main a:not(.btn):not(.nav-link):hover,
:root[data-theme="dark"] .card-raised a:not(.btn):hover {
  color: var(--_link-hover);
}

/* Mode auto qui détecte la préférence système */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --_background: #1a202c;
    --_surface: #2d3748;
    --_surface-alt: #374151;
    --_text: #f7fafc;
    --_text-secondary: #a0aec0;
    --_primary: #cbd5e0;
    --_accent: #9f7aea;
    --_shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.3);
    --_shadow-lg: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.3);
    --_border-light: 0.0625rem solid #4a5568;
    --_link-color: #93c5fd;
    --_link-hover: #60a5fa;
  }
  :root:not([data-theme="light"]) .main a:not(.btn):not(.nav-link),
  :root:not([data-theme="light"]) .card-raised a:not(.btn) {
    color: var(--_link-color);
  }

  :root:not([data-theme="light"]) .main a:not(.btn):not(.nav-link):hover,
  :root:not([data-theme="light"]) .card-raised a:not(.btn):hover {
    color: var(--_link-hover);
  }
}

/* ==========================================================================
   3. RESET & STYLES DE BASE
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--_font-family);
  font-size: var(--_font-size-base);
  background: var(--_background);
  color: var(--_text);
  line-height: 1.5;
  min-height: 100vh;
  padding: var(--_spacing-xl) var(--_spacing-md);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ==========================================================================
   4. TYPOGRAPHIE
   ========================================================================== */
h1,
h2,
h3 {
  font-weight: var(--_fw-black);
  color: var(--_text);
  line-height: 1.2;
  margin-bottom: var(--_spacing-md);
}

h1 {
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  text-align: center;
}

h2 {
  font-size: var(--_font-size-2xl);
}

h3 {
  font-size: var(--_font-size-xl);
  margin-top: var(--_spacing-lg);
}

p {
  margin-bottom: var(--_spacing-md);
}

.consigne {
  text-align: center;
  font-style: italic;
  color: var(--_text-secondary);
  margin: 0 auto var(--_spacing-sm);
  max-width: 50rem;
}

/* ==========================================================================
   5. LAYOUT GÉNÉRAL
   ========================================================================== */
.main {
  width: 100%;
  max-width: 62.5rem;
  margin: var(--_spacing-lg) auto;
  padding: var(--_spacing-md);
  background: var(--_surface);
  border-radius: var(--_radius);
  box-shadow: var(--_shadow);
}

.page-exercice {
  display: block;
  min-height: 100vh;
  padding: 0;
}

.page-exercice .main {
  width: min(62.5rem, 95vw);
  max-width: 100%;
  margin: var(--_spacing-lg) auto;
  padding: var(--_spacing-lg);
  display: flex;
  flex-direction: column;
}

.footer {
  max-width: 62.5rem;
  margin: var(--_spacing-xl) auto var(--_spacing-md) auto;
  text-align: center;
  font-size: 1rem;
  color: var(--_text-secondary);
  padding: 0 var(--_spacing-md);
  min-height: 6rem;
}

.footer a {
  color: var(--_accent);
  font-weight: var(--_fw-bold);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Réserver l'espace pour éviter layout shift */
#nav-placeholder {
  min-height: 3.75rem;
  display: block;
}

#footer-placeholder {
  min-height: 6rem;
  display: block;
}
/* ==========================================================================
   6. NAVIGATION PRINCIPALE
   ========================================================================== */

/* ✅ Reset body/html pour éliminer les marges */
html,
body {
  margin: 0;
  padding: 0;
}

/* ✅ Nav : 62.5rem centrée, collée en haut, hauteur auto */
.nav {
  max-width: 62.5rem;
  width: 100%;
  margin: 0 auto; /* ✅ Centré horizontalement, pas de marge en haut */
  border-radius: var(--_radius);
  background: var(--_surface);
  box-shadow: var(--_shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.5rem var(--_spacing-md) 3rem var(--_spacing-md);
}

/* ✅ Container : Grid layout sur 2 lignes */
.nav-container {
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  position: relative;
  grid-template-columns: auto 1fr auto; /* Logo | Espace | Secondary */
  grid-template-rows: auto auto; /* 2 lignes */
  align-items: center;
  gap: var(--_spacing-md);
}

/* ✅ Logo - Colonne 1, Ligne 1 */
.nav-logo {
  grid-column: 1;
  grid-row: 1;
}

.nav-logo a {
  font-family: "Great Vibes", cursive;
  font-weight: var(--_fw-black);
  font-size: 3.25rem;
  color: var(--_primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--_spacing-sm);
  white-space: nowrap;
}

/* ✅ Colonne droite - Colonne 3, Ligne 1 */

/* ✅ Colonne droite - Colonne 2, Ligne 1 - MA PROGRESSION AU CENTRE */
.nav-secondary {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--_spacing-sm);
  justify-self: center;
}

/* ✅ Menu - Ligne 2, toute la largeur - CACHÉ PAR DÉFAUT */
.nav-menu {
  display: none;
  grid-column: 1 / -1;
  width: 100%;
  flex-direction: column;
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0.5rem 0;
  background: var(--_surface);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0 0 var(--_radius-sm) var(--_radius-sm);
}

.nav-menu.is-active {
  display: flex;
  animation: slideDown 0.25s ease-out;
}

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

.nav-link,
.nav-dropdown-toggle {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  text-align: left;
  color: var(--_text);
  text-decoration: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  transition: background 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.nav-link:hover,
.nav-dropdown-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.nav-dropdown-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Dropdowns */
.nav-dropdown {
  position: relative;
}

.nav-submenu {
  display: none;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.03);
  list-style: none;
  margin: 0;
  padding: 0;
  transition:
    max-height 0.25s ease,
    opacity 0.25s ease;
  overflow: hidden;
}

.nav-dropdown.is-open .nav-submenu {
  display: flex;
  padding: 0.25rem 0;
}

.nav-submenu a {
  display: block;
  padding: 0.5rem 1rem 0.5rem 2rem;
  font-size: 0.9rem;
  color: var(--_text-secondary);
  text-decoration: none;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.nav-submenu a:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--_text);
}

.arrow {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 0.8em;
}

.nav-dropdown:hover .arrow,
.nav-dropdown-toggle[aria-expanded="true"] .arrow {
  transform: rotate(180deg);
}

/* Niveau 1 : Ma progression */
.progress-link {
  display: flex;
  align-items: center;
  gap: var(--_spacing-sm);
  padding: var(--_spacing-xs) var(--_spacing-md);
  background: var(--_accent);
  color: white;
  height: 2.75rem;
  text-decoration: none;
  border-radius: var(--_radius);
  font-weight: var(--_fw-bold);
  font-size: 0.95rem;
  transition: all var(--_transition-fast);
  box-shadow: var(--_shadow);
  white-space: nowrap;
}

.progress-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--_shadow-lg);
}

.progress-icon {
  font-size: 1.2rem;
}

.progress-text {
  color: var(--_text);
}

/* Écrans moyens - Ma progression minimal */
/* Écrans moyens - 2 rangées pour éviter le chevauchement */
@media (max-width: 550px) {
  /* Réduire le padding de la nav */
  .nav {
    padding: 0.5rem var(--_spacing-md) !important;
  }

  /* Passer en 2 rangées avec 3 colonnes */
  .nav-container {
    grid-template-columns: auto 1fr auto !important;
    grid-template-rows: auto auto !important;
    gap: 0.5rem !important;
  }

  /* Logo sur toute la largeur - Rangée 1 */
  .nav-logo {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: start;
  }

  /* Ma progression - Rangée 2, à gauche */
  .nav-secondary {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: start;
  }

  /* Hamburger - Rangée 2, à droite */
  .nav-toggle {
    grid-column: 3 !important;
    grid-row: 2 !important;
    justify-self: end;
  }

  .nav-menu {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
  }
}

/* Niveau 3 : Thème */
.theme-switcher {
  display: flex;
  gap: var(--_spacing-xs);
  background: var(--_surface-alt);
  padding: 0.25rem;
  border-radius: var(--_radius);
}

.theme-switcher button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: transparent;
  border: none;
  border-radius: var(--_radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--_transition-fast);
  opacity: 0.6;
}

.theme-switcher button:hover {
  opacity: 1;
  background: var(--_background);
  transform: scale(1.1);
}

.theme-switcher button[aria-checked="true"] {
  opacity: 1;
  background: var(--_accent);
  box-shadow: 0 2px 8px rgba(88, 38, 103, 0.3);
}

/* Toggle hamburger - VISIBLE PARTOUT */
.nav-toggle {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  position: relative;
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  display: block;
  width: 1.5rem;
  height: 2px;
  background: var(--_text);
  border-radius: 1px;
  transition:
    transform 0.25s ease,
    background 0.25s ease;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-toggle-icon {
  top: 50%;
}

.nav-toggle-icon::before {
  top: -6px;
}

.nav-toggle-icon::after {
  top: 6px;
}

.nav-toggle.is-active .nav-toggle-icon {
  background: transparent;
}

.nav-toggle.is-active .nav-toggle-icon::before {
  top: 0;
  transform: translateX(-50%) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-icon::after {
  top: 0;
  transform: translateX(-50%) rotate(-45deg);
}

/* Badge de points dans la navigation */
.points-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
  margin-left: 0.3rem;
  min-width: 3rem;
  text-align: center;
}

/* Animation d'apparition */
.points-badge:not(:empty) {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive - ajuster pour mobile */
@media (max-width: 768px) {
  .points-badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
  }
}
/* ==========================================================================
   7. BOUTONS UNIFIÉS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--_spacing-sm);
  padding: var(--_spacing-sm) 1.2rem;
  font-size: 1.1rem;
  font-weight: var(--_fw-bold);
  border: 0.125rem solid transparent;
  border-radius: var(--_radius-sm);
  cursor: pointer;
  box-shadow: var(--_shadow);
  text-decoration: none;
  transition:
    transform var(--_transition-speed),
    box-shadow var(--_transition-speed);
}

.btn:hover:not(:disabled) {
  transform: translateY(-0.1875rem);
  box-shadow: var(--_shadow-lg);
}

.btn[aria-selected="true"] {
  transform: scale(1.05) translateY(-0.125rem);
  font-weight: var(--_fw-black);
}

button:disabled,
.btn:disabled {
  background: #94a3b8 !important;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.7;
  transform: none !important;
  color: #7f8c8d;
}

/* Boutons d'action spécifiques */
.btn-exercice {
  background: #22c55e;
  color: #ffffff;
}

.btn-restart {
  background: #dc2626;
  color: #ffffff;
}

.btn-prev {
  background-color: #7c3aed;
  color: white;
}

.btn-next-nav,
.btn-next-level {
  background-color: #eab308;
  color: #1a202c;
}

.btn-cancel,
.btn-resume,
.btn-restart-level {
  background: #22c55e;
  color: #1a202c;
}

.btn-complete {
  background: #3498db;
  color: white;
}

.btn-confirm-reset {
  background: #dc2626;
  color: white;
}

/* Thème sombre - ajuster contraste */
:root[data-theme="dark"] .btn-cancel,
:root[data-theme="dark"] .btn-resume,
:root[data-theme="dark"] .btn-restart-level {
  background: #16a34a;
  color: white;
}

:root[data-theme="dark"] .btn-complete {
  background: #2563eb;
  color: white;
}

:root[data-theme="dark"] .btn-confirm-reset {
  background: #b91c1c;
  color: white;
}

.navigation-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--_spacing-md);
  margin-top: var(--_spacing-xl);
  padding-top: var(--_spacing-lg);
  border-top: 0.125rem solid var(--_background);
}

/* ==========================================================================
   8. DROPDOWNS (Exercices et autres)
   ========================================================================== */

/* Conteneur du dropdown */
.exercise-dropdown {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* Menu déroulant - Caché par défaut */
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--_surface);
  border: 2px solid var(--_primary);
  border-radius: var(--_radius-sm);
  box-shadow: var(--_shadow-lg);
  min-width: 280px;
  z-index: 1000;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Afficher le menu au survol OU quand actif */
.exercise-dropdown:hover .dropdown-menu,
.exercise-dropdown.active .dropdown-menu {
  display: block;
  animation: dropdownFadeIn 0.2s ease;
}

/* Animation d'apparition */
@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Items du menu */
.dropdown-item {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--_text);
  transition: background 0.2s;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--_surface-alt);
  outline: none;
}

.dropdown-item strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--_text);
  font-weight: var(--_fw-bold);
}

.dropdown-item small {
  display: block;
  font-size: 0.85em;
  opacity: 0.7;
  line-height: 1.3;
  color: var(--_text-secondary);
}

.dropdown-item:hover strong {
  color: var(--_accent);
}

.dropdown-menu hr {
  margin: 0;
  border: none;
  border-top: 1px solid var(--_border-light);
}

.view-all {
  font-weight: var(--_fw-bold);
  color: var(--_accent);
}

/* Flèche du bouton dropdown */
.arrow {
  display: inline-block;
  margin-left: 0.25rem;
  transition: transform 0.3s ease;
  font-size: 0.8em;
}

.exercise-dropdown:hover .arrow,
.exercise-dropdown.active .arrow {
  transform: rotate(180deg);
}

/* ==========================================================================
   9. COMPOSANTS RÉUTILISABLES (Cards, Feedback, etc.)
   ========================================================================== */
.card-raised {
  background: var(--_surface);
  box-shadow: var(--_shadow-outset);
  border-radius: var(--_radius);
  padding: var(--_spacing-lg);
  margin-bottom: var(--_spacing-sm);
  transition: none;
}

.card-inset {
  background: var(--_surface);
  box-shadow: var(--_inner-shadow);
  border-radius: var(--_radius-md);
  padding: var(--_spacing-lg);
}

.answer-correct,
.locked-answer.answer-correct {
  color: var(--_correct);
  border-color: var(--_correct);
  font-weight: var(--_fw-black);
}

.answer-incorrect,
.locked-answer.answer-incorrect {
  color: var(--_incorrect);
  border-color: var(--_incorrect);
}

:root[data-theme="dark"] .answer-correct,
:root[data-theme="dark"] .answer-incorrect {
  color: var(--_background);
}

.feedback,
.feedback-icon {
  text-align: center;
  font-weight: var(--_fw-bold);
  min-height: 1.2em;
}

.feedback.correct {
  color: var(--_correct);
}

.feedback.incorrect {
  color: var(--_incorrect);
}

/* Settings FAB */
.settings-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--_primary);
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--_shadow-lg);
  transition: transform var(--_transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
}

.settings-fab:hover {
  transform: scale(1.1);
}

.settings-panel {
  position: fixed;
  bottom: 5.25rem;
  right: 1.5rem;
  background: var(--_surface);
  border-radius: var(--_radius);
  padding: var(--_spacing-md);
  box-shadow: var(--_shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.625rem);
  transition: all var(--_transition-fast);
  width: 15rem;
  z-index: 998;
}

.settings-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ==========================================================================
   10. FOCUS CLAVIER
   ========================================================================== */
:focus-visible {
  outline: 0.125rem solid var(--_accent);
  outline-offset: 0.125rem;
  border-radius: var(--_radius-sm);
}

button:focus-visible,
.mot:focus-visible,
.tab:focus-visible,
.custom-select-display:focus-visible,
.concept-btn:focus-visible,
.choice-button:focus-visible {
  outline: none;
  border-width: 0.25rem;
  border-color: var(--_primary);
  box-shadow:
    0 0 0 0.125rem var(--_background),
    0 0 0 0.25rem var(--_primary);
}

.concept-btn:focus-visible {
  box-shadow:
    0 0 0 0.125rem var(--_background),
    0 0 0 0.25rem var(--_concept-color, var(--_primary));
}

input:focus-visible,
select:focus-visible {
  outline: 0.125rem solid var(--_primary);
  outline-offset: 0.125rem;
}

/* ==========================================================================
   11. UTILITAIRES & ANIMATIONS
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -6.25rem;
  left: var(--_spacing-md);
  background: var(--_primary);
  color: white;
  padding: var(--_spacing-sm) var(--_spacing-md);
  border-radius: var(--_radius-sm);
  text-decoration: none;
  font-weight: var(--_fw-black);
  z-index: 10000;
  transition: top var(--_transition-smooth);
}

.skip-link:focus {
  top: var(--_spacing-md);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--_accent-pulse);
  }
  70% {
    box-shadow: 0 0 0 0.625rem rgba(143, 122, 234, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(143, 122, 234, 0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-0.3125rem);
  }
  75% {
    transform: translateX(0.3125rem);
  }
}

@keyframes feedbackPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* ==========================================================================
   12. RESPONSIVE (TABLETTES ET MOBILE)
   ========================================================================== */

/* Écrans moyens - 2 rangées pour éviter le chevauchement */
@media (max-width: 550px) {
  /* Réduire le padding de la nav */
  .nav {
    padding: 0.5rem var(--_spacing-md) !important;
    min-height: auto !important;
  }

  /* Passer en 3 rangées avec 3 colonnes */
  .nav-container {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    grid-template-rows: auto auto auto !important;
    gap: 0.5rem !important;
    align-items: center !important;
  }

  /* Logo sur toute la largeur - Rangée 1 */
  .nav-logo {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
  }

  /* Ma progression - Rangée 2, colonne 1 */
  .nav-secondary {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: start !important;
    position: relative !important;
  }

  /* Hamburger - Rangée 2, colonne 3 */
  .nav-toggle {
    grid-column: 3 !important;
    grid-row: 2 !important;
    justify-self: end !important;
  }

  /* Menu - Rangée 3 */
  .nav-menu {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
  }

  /* Ma progression minimal */
  .progress-link .progress-text {
    display: none !important;
  }

  .progress-link {
    padding: 0.5rem 0.7rem !important;
    min-width: auto !important;
  }

  .progress-icon {
    font-size: 1.3rem !important;
  }

  .points-badge {
    margin-left: 0.3rem !important;
  }
}

/* Tablettes et écrans moyens */
@media (max-width: 48rem) {
  body {
    padding: var(--_spacing-sm);
    font-size: 1.1rem;
  }

  .main {
    padding: var(--_spacing-md);
    border-radius: var(--_radius-sm);
  }

  .page-exercice {
    padding: var(--_spacing-xs);
  }

  .page-exercice .main {
    width: 100%;
    height: auto;
    min-height: 90vh;
    max-height: none;
    padding: var(--_spacing-md);
  }

  h1 {
    font-size: 1.75rem;
  }

  .btn {
    font-size: 1rem;
    padding: 0.65rem 1rem;
    min-height: var(--_min-touch-target);
  }

  .navigation-group {
    flex-wrap: wrap;
    gap: var(--_spacing-sm);
  }

  .card-raised,
  .card-inset {
    padding: var(--_spacing-md);
  }
}

/* Petits écrans */
@media (max-width: 30rem) {
  body {
    font-size: 1rem;
    padding: 0.25rem;
  }

  .page-exercice {
    padding: 0;
  }

  .page-exercice .main {
    border-radius: 0;
    padding: var(--_spacing-sm);
  }

  h1 {
    font-size: 1.5rem;
  }

  .btn {
    font-size: 0.95rem;
    padding: 0.65rem 0.75rem;
  }

  .navigation-group {
    flex-direction: flex;
    width: 100%;
    gap: var(--_spacing-md);
  }

  .navigation-group .btn {
    width: 7rem;
  }

  .card-raised,
  .card-inset {
    padding: var(--_spacing-sm);
  }

  .consigne {
    font-size: 0.9rem;
  }

  .dropdown-menu {
    left: 0;
    right: 0;
    min-width: auto;
    max-width: calc(100vw - 2rem);
  }
}

/* ==========================================================================
   13. IMPRESSION
   ========================================================================== */
@media print {
  body {
    background: white;
    color: black;
  }

  .btn,
  .navigation-group,
  .nav,
  .settings-fab,
  .cookie-modal,
  .dropdown-menu {
    display: none !important;
  }

  .main,
  .footer {
    box-shadow: none !important;
    border: 0.0625rem solid #000;
  }
}
/* ==========================================================================
   14. COOKIES (VERSION CORRIGÉE)
   ========================================================================== */

/* --- Bannière principale --- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: var(--_spacing-lg);
  animation: slideUp 0.4s ease-out;
  display: flex;
  justify-content: center;
  background: transparent;
  pointer-events: auto;
}

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

.cookie-banner-content {
  width: 100%;
  max-width: 62.5rem;
  background: var(--_surface);
  border-radius: var(--_radius);
  box-shadow: var(--_shadow-lg);
  padding: var(--_spacing-lg);
  pointer-events: auto;
}

.cookie-banner-text h2 {
  margin-bottom: var(--_spacing-sm);
  font-size: 1.4rem;
  font-weight: var(--_fw-black);
  color: var(--_primary);
}

.cookie-banner-text p {
  margin-bottom: var(--_spacing-md);
  color: var(--_text);
  line-height: 1.6;
}

/* --- Boutons --- */
.cookie-banner-actions {
  display: flex;
  gap: var(--_spacing-md);
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: var(--_spacing-sm);
}

.cookie-banner-actions .btn {
  flex: 1;
  min-width: 160px;
  cursor: pointer;
}

/* --- Lien politique --- */
.cookie-policy-link {
  display: block;
  text-align: center;
  font-size: 0.9rem;
  color: var(--_accent);
  text-decoration: none;
  margin-top: var(--_spacing-xs);
}

.cookie-policy-link:hover {
  text-decoration: underline;
}

/* --- Fermeture fluide --- */
.cookie-banner-closing {
  animation: fadeOutDown 0.3s ease forwards;
}

@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(100%);
  }
}

/* ==========================================================================
   MODAL DE PERSONNALISATION
   ========================================================================== */
.cookie-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cookie-modal.is-visible {
  opacity: 1;
  pointer-events: all;
}

.cookie-modal-content {
  background: var(--_surface);
  color: var(--_text);
  border-radius: var(--_radius);
  box-shadow: var(--_shadow-lg);
  max-width: 42rem;
  width: 95%;
  padding: var(--_spacing-lg);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    transform: translateY(1rem);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-modal-content h2 {
  font-size: 1.5rem;
  margin-bottom: var(--_spacing-md);
  color: var(--_primary);
}

/* --- Catégories --- */
.cookie-category {
  margin-bottom: var(--_spacing-lg);
}

.cookie-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--_spacing-xs);
}

.cookie-category-header h3 {
  font-size: 1.2rem;
  color: var(--_text);
  font-weight: var(--_fw-bold);
}

.cookie-status {
  font-weight: var(--_fw-bold);
  color: var(--_accent);
}

/* --- Toggle --- */
.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 2.75rem;
  height: 1.5rem;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  border-radius: 1.5rem;
  transition: 0.3s;
}

.cookie-toggle-slider::before {
  position: absolute;
  content: "";
  height: 1.1rem;
  width: 1.1rem;
  left: 0.2rem;
  bottom: 0.2rem;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background-color: var(--_accent);
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
  transform: translateX(1.2rem);
}

/* --- Texte --- */
.cookie-category p {
  color: var(--_text-secondary);
  line-height: 1.5;
  font-size: 1rem;
  margin: 0;
}

/* --- Boutons du modal --- */
.cookie-modal-actions {
  display: flex;
  justify-content: center;
  gap: var(--_spacing-md);
  flex-wrap: wrap;
  margin-top: var(--_spacing-lg);
}

.cookie-modal-actions .btn {
  flex: 1;
  min-width: 160px;
}

/* --- Accessibilité --- */
.cookie-modal:focus-visible,
.cookie-banner:focus-visible {
  outline: 0.125rem solid var(--_accent);
  outline-offset: 0.25rem;
}

/* --- Mode sombre --- */
:root[data-theme="dark"] .cookie-modal-content {
  background: var(--_surface);
  color: var(--_text);
}

:root[data-theme="dark"] .cookie-banner-content {
  background: var(--_surface);
}
.confirmation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.confirmation-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.footer {
  min-height: 120px;
  contain: layout;
}
/* ==========================================================================

/* ==========================================================================
   MODE SOMBRE - NAVIGATION
   ========================================================================== */
:root[data-theme="dark"] .nav-menu {
  background: var(--_surface);
  border-top-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .nav-submenu {
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .nav-link:hover,
:root[data-theme="dark"] .nav-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .nav-submenu a:hover {
  background: rgba(255, 255, 255, 0.1);
}
