/* ============================================================
   PrepaCadet — styles globaux (thème "premium aviation")
   Toutes les couleurs, polices et espacements sont des
   variables CSS définies dans :root. Modifier ici = changer
   partout.
   ============================================================ */

:root {
  /* --- Couleurs de base --- */
  --bleu-nuit: #081428;
  --bleu-profond: #0e2548;
  --bleu-ciel: #3b82f6;
  --bleu-clair: #93c5fd;
  --indigo: #6366f1;
  --or: #e8c98a; /* accent doré, touche "premium aviation", usage parcimonieux */

  --blanc: #f8fafc;
  --gris-texte: #aab7c9;
  --gris-doux: #8696ab;

  /* --- Surfaces "verre dépoli" --- */
  --surface: rgba(255, 255, 255, 0.055);
  --surface-forte: rgba(255, 255, 255, 0.09);
  --bordure: rgba(255, 255, 255, 0.1);
  --bordure-claire: rgba(255, 255, 255, 0.18);

  /* --- Dégradé d'accent (boutons, éléments actifs) --- */
  --accent: linear-gradient(135deg, var(--bleu-ciel), var(--indigo));

  /* --- Ombres --- */
  --ombre-douce: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ombre-accent: 0 12px 34px rgba(59, 130, 246, 0.28);

  /* --- Polices --- */
  --police-titre: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --police-corps: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* --- Espacements --- */
  --espace-xs: 6px;
  --espace-s: 10px;
  --espace-m: 18px;
  --espace-l: 32px;
  --espace-xl: 48px;

  /* --- Divers --- */
  --rayon: 18px;
  --rayon-s: 12px;
  --largeur-max: 820px;
  --hauteur-nav: 70px;
}

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

body {
  font-family: var(--police-corps);
  color: var(--blanc);
  min-height: 100vh;
  padding-bottom: var(--hauteur-nav);
  line-height: 1.5;
  /* -webkit-font-smoothing : rend le texte plus fin/net sur Mac */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* Fond : halo lumineux en haut + dégradé profond.
     Le halo donne la sensation de "lumière" premium. */
  background:
    radial-gradient(1100px 560px at 50% -12%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(99, 102, 241, 0.14), transparent 55%),
    linear-gradient(165deg, var(--bleu-nuit), var(--bleu-profond) 70%);
  background-attachment: fixed;
}

h1, h2, h3 {
  font-family: var(--police-titre);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* ============================================================
   En-tête (fixe, avec flou)
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--espace-m) var(--espace-l);
  background: rgba(8, 20, 40, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bordure);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espace-m);
}

/* Chip "compte" (email + déconnexion) dans l'en-tête */
.compte {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
/* Respecter l'attribut hidden (sinon display:flex ci-dessus l'écrase). */
.compte[hidden] { display: none; }
.compte-email {
  color: var(--gris-doux);
  font-size: 0.82rem;
  font-weight: 600;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compte-btn {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--bleu-clair);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.compte-btn:hover { border-color: var(--bordure-claire); background: var(--surface-forte); }

/* L'en-tête et la nav du bas disparaissent sur l'écran de connexion */
body.auth-actif .nav-bas { display: none; }
body.auth-actif .compte { display: none; }

/* ============================================================
   Écran de connexion / inscription
   ============================================================ */
.auth {
  max-width: 560px;
  margin: 6vh auto 0;
  text-align: center;
  padding: var(--espace-l);
}
/* Texte de présentation : plus large que le formulaire, aéré. */
.auth-intro {
  max-width: 520px;
  margin: 20px auto 34px;
  color: var(--gris-texte);
  font-size: 1.04rem;
  line-height: 1.65;
}
.auth-intro strong { color: var(--blanc); font-weight: 600; }
/* Onglets + formulaire restent à taille "champ", centrés. */
.auth-onglets,
.auth-form { max-width: 380px; margin-left: auto; margin-right: auto; }
.auth-form { width: 100%; }
.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  font-size: 1.7rem;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  margin-bottom: var(--espace-m);
}
.auth h1 { font-family: var(--police-titre); font-size: 1.8rem; margin-bottom: 6px; }
.auth .subtitle { margin-bottom: var(--espace-l); }
.auth-onglets {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 999px;
  margin-bottom: var(--espace-m);
}
.auth-onglet {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--gris-doux);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.auth-onglet.actif { background: var(--accent); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: var(--espace-s); text-align: left; }
.auth-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--rayon-s);
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--blanc);
  font-family: inherit;
  font-size: 1rem;
}
.auth-input:focus { outline: none; border-color: var(--bleu-ciel); }
/* Champ mot de passe + bouton œil (à l'extérieur, à droite) */
.auth-mdp-ligne { display: flex; gap: 8px; align-items: stretch; }
.auth-mdp-ligne .auth-input { flex: 1; min-width: 0; }
.auth-oeil {
  flex: none;
  width: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rayon-s);
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--gris-doux);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.auth-oeil:hover { border-color: var(--bordure-claire); color: var(--bleu-clair); background: var(--surface-forte); }
.auth-oeil svg { display: block; }
.auth-erreur {
  color: #f7a7a7;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--rayon-s);
  padding: 10px 12px;
  font-size: 0.86rem;
}
.auth-info { color: #9ce8c0; font-size: 0.86rem; }
.auth-form .btn-principal { margin-top: 6px; }

.brand {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
}

.brand-logo {
  font-size: 1.4rem;
  /* Pastille dégradée autour de l'avion */
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--accent);
  box-shadow: var(--ombre-accent);
}

.brand-name {
  font-family: var(--police-titre);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ============================================================
   Conteneur + écrans
   ============================================================ */
.page {
  max-width: var(--largeur-max);
  margin: 0 auto;
  padding: var(--espace-xl) var(--espace-m);
}

.ecran {
  display: none;
}
.ecran.actif {
  display: block;
  /* Petite apparition en fondu + glissement à chaque écran */
  animation: apparition 0.35s ease both;
}

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

/* ============================================================
   Accueil
   ============================================================ */
.intro {
  text-align: center;
  margin-bottom: var(--espace-xl);
}

.intro h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: var(--espace-s);
}

.subtitle {
  font-size: 1.05rem;
  color: var(--gris-texte);
}

.grille-modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--espace-m);
}

/* ---------- Carte d'un module ---------- */
.carte-module {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--espace-s);
  text-align: left;
  padding: var(--espace-m);
  min-height: 168px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-douce);
  color: var(--blanc);
  cursor: pointer;
  font-family: inherit;
  /* Transition douce et "premium" (courbe d'accélération) */
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.22s ease,
              background 0.22s ease,
              box-shadow 0.22s ease;
}

.carte-module:hover {
  transform: translateY(-5px);
  border-color: var(--bordure-claire);
  background: var(--surface-forte);
  box-shadow: var(--ombre-accent);
}

/* Pendant le survol avec tilt 3D : la rotation suit le curseur de façon réactive
   (transform court), tandis que couleurs/ombre gardent leur transition douce. */
.carte-module.carte-tilt {
  transition: transform 0.09s ease-out,
              border-color 0.22s ease,
              background 0.22s ease,
              box-shadow 0.22s ease;
  will-change: transform;
}

/* Liseré dégradé qui s'illumine en haut de la carte au survol */
.carte-module::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.6), transparent 40%);
  /* Astuce pour n'afficher que la bordure du dégradé */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}
.carte-module:hover::before {
  opacity: 1;
}

.carte-icone-tuile {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(99, 102, 241, 0.18));
  border: 1px solid var(--bordure);
}

.carte-corps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.carte-nom {
  font-family: var(--police-titre);
  font-size: 1.08rem;
  font-weight: 700;
}

.carte-desc {
  font-size: 0.88rem;
  color: var(--gris-texte);
  line-height: 1.45;
}

.carte-fleche {
  position: absolute;
  top: var(--espace-m);
  right: var(--espace-m);
  color: var(--bleu-clair);
  font-size: 1.1rem;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.carte-module:hover .carte-fleche {
  opacity: 1;
  transform: translateX(0);
}

.carte-badge {
  position: absolute;
  top: var(--espace-m);
  right: var(--espace-m);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(232, 201, 138, 0.14);
  color: var(--or);
  border: 1px solid rgba(232, 201, 138, 0.3);
}

.carte-module.indisponible {
  opacity: 0.82;
}

/* ============================================================
   Écrans secondaires (module, dashboard)
   ============================================================ */
.bloc-centre {
  text-align: center;
  padding: var(--espace-xl) 0;
}

.bloc-centre h1 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: var(--espace-m);
}

.note {
  margin-top: var(--espace-s);
  color: var(--gris-doux);
  font-size: 0.9rem;
}

.bouton-retour {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  color: var(--bleu-clair);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.bouton-retour:hover {
  background: var(--surface-forte);
  border-color: var(--bordure-claire);
}

/* ============================================================
   Barre de navigation du bas (fixe, verre dépoli)
   ============================================================ */
.nav-bas {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--hauteur-nav);
  display: flex;
  background: rgba(8, 20, 40, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--bordure);
}

/* « Slider » bleu doux qui se déplace sous l'onglet actif (placé en JS). */
.nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: var(--rayon-s);
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(147, 197, 253, 0.28);
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.42s cubic-bezier(0.34, 1.25, 0.5, 1), width 0.42s cubic-bezier(0.34, 1.25, 0.5, 1);
}

.nav-item {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--gris-doux);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s ease;
}

.nav-item.actif {
  color: var(--bleu-clair);
}

.nav-icone {
  font-size: 1.2rem;
}

.nav-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ============================================================
   Boutons réutilisables
   ============================================================ */
.btn-principal {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  margin-top: var(--espace-m);
  border: none;
  border-radius: var(--rayon-s);
  background: var(--accent);
  color: var(--blanc);
  font-family: var(--police-titre);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--ombre-accent);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-principal:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.btn-secondaire {
  display: inline-block;
  width: 100%;
  padding: 13px 20px;
  margin-top: var(--espace-s);
  border: 1px solid var(--bordure-claire);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--blanc);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-secondaire:hover {
  background: var(--surface-forte);
}

/* ============================================================
   Écran de JEU
   ============================================================ */
.jeu {
  max-width: 560px;
  margin: 0 auto;
}

/* Barre du haut : quitter + progression + compteur */
.jeu-haut {
  display: flex;
  align-items: center;
  gap: var(--espace-m);
  margin-bottom: var(--espace-l);
}

.jeu-quitter {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--gris-texte);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.jeu-quitter:hover {
  background: var(--surface-forte);
  color: var(--blanc);
}

.jeu-progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.jeu-progress-barre {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.jeu-compteur {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gris-texte);
  font-variant-numeric: tabular-nums;
}

/* Barre de timer par question (verte → orange → rouge) */
.qtimer {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: var(--espace-s) 0 var(--espace-l);
}
.qtimer-barre {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background-color: #34d399; /* vert au départ */
}
/* Toute la barre change de couleur au fil du temps : vert → orange → rouge */
@keyframes qtimer-couleur {
  0% { background-color: #34d399; }
  50% { background-color: #fbbf24; }
  100% { background-color: #f87171; }
}

/* Chrono : numéro + piste qui se vide */
.jeu-chrono {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
  margin-bottom: var(--espace-l);
}
.jeu-chrono-num {
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--bleu-clair);
  min-width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.jeu-chrono-piste {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.jeu-chrono-barre {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--or), var(--bleu-ciel));
}

/* Énoncé + choix */
.jeu-tag {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gris-doux);
  margin-bottom: var(--espace-s);
}

.jeu-question {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: var(--espace-l);
}

/* Question centrée (Calcul mental, Carrés & cubes, Suites & séries) */
.jeu--centre .jeu-tag,
.jeu--centre .jeu-question {
  text-align: center;
}
.jeu--centre .jeu-question {
  font-size: 1.9rem;
}

.jeu-choix {
  display: flex;
  flex-direction: column;
  gap: var(--espace-s);
}

.jeu-choix-btn {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--rayon-s);
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--blanc);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}
.jeu-choix-btn:hover:not(:disabled) {
  transform: translateX(3px);
  border-color: var(--bordure-claire);
  background: var(--surface-forte);
}
.jeu-choix-btn:disabled {
  cursor: default;
}
/* Bonne réponse (vert) et mauvais clic (rouge) après validation */
.jeu-choix-btn.correct {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.16);
  color: #d1fae5;
}
.jeu-choix-btn.faux {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.16);
  color: #fee2e2;
}

/* Bloc de correction */
.jeu-correction {
  margin-top: var(--espace-l);
  padding: var(--espace-m);
  border-radius: var(--rayon-s);
  background: var(--surface);
  border: 1px solid var(--bordure);
  animation: apparition 0.3s ease both;
}
.correction-titre {
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: var(--espace-s);
}
.correction-titre.ok {
  color: #6ee7b7;
}
.correction-titre.ko {
  color: #fca5a5;
}
.correction-texte {
  color: var(--gris-texte);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ============================================================
   Module RÉACTIVITÉ (Go / No-Go)
   ============================================================ */
.reac-intro {
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
  padding: var(--espace-l) 0;
}
.reac-intro h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--espace-s);
}
.reac-legende {
  display: flex;
  flex-direction: column;
  gap: var(--espace-s);
  margin: var(--espace-l) 0;
  text-align: left;
}
.reac-leg {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  padding: 12px 14px;
  font-size: 0.95rem;
}
.reac-pastille {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}
.reac-pastille.go { background: #34d399; }
.reac-pastille.nogo { background: #f87171; }

/* Partie en cours */
.reac {
  max-width: 560px;
  margin: 0 auto;
}
.reac-haut {
  display: flex;
  align-items: center;
  gap: var(--espace-m);
  margin-bottom: var(--espace-m);
}
.reac-chrono {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.reac-chrono-barre {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.reac-score {
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gris-texte);
}
.reac-score span {
  color: var(--blanc);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Zone de tap (grande, les ronds y apparaissent à des positions aléatoires) */
.reac-zone {
  position: relative;
  width: 100%;
  min-height: 72vh;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  color: var(--blanc);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.reac-zone.flash-ok { border-color: #34d399; background: rgba(52, 211, 153, 0.1); }
.reac-zone.flash-ko { border-color: #f87171; background: rgba(248, 113, 113, 0.1); }

.reac-cible {
  position: absolute;
  left: 0;
  top: 0;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0.5);
  opacity: 0;
  transition: transform 0.08s ease, opacity 0.08s ease;
  pointer-events: none; /* les taps sont gérés par la zone entière */
}
.reac-cible.visible {
  opacity: 1;
  transform: scale(1);
}
.reac-cible.go {
  background: #34d399;
  box-shadow: 0 0 40px rgba(52, 211, 153, 0.5);
}
.reac-cible.nogo {
  background: #f87171;
  box-shadow: 0 0 40px rgba(248, 113, 113, 0.5);
}

/* ============================================================
   Module VISION DANS L'ESPACE (figures de rotation)
   ============================================================ */
.jeu-visuel {
  display: flex;
  justify-content: center;
  margin: var(--espace-s) 0 var(--espace-l);
}
.jeu-visuel .figure {
  width: 132px;
  height: 132px;
}
.figure {
  display: block;
}
.fig-cell {
  fill: #6ea8fe;
  stroke: #0b1f3a;
  stroke-width: 1.5;
}

/* Zone de jeu élargie quand on affiche des figures */
.jeu--large {
  max-width: 780px;
}

/* Zone "plein écran" (intrus) : tout tient sans scroll, encarts à parts égales.
   La hauteur soustrait l'en-tête + les marges + la barre de navigation. */
.jeu--plein {
  display: flex;
  flex-direction: column;
  max-width: 460px;
  margin: 0 auto;
  height: calc(100vh - 230px);
  height: calc(100dvh - 230px);
}
.jeu--plein .jeu-corps {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.jeu--plein .jeu-question {
  font-size: 1.05rem;
  margin-bottom: var(--espace-s);
}

/* Choix en grille (figures) */
.jeu-choix--grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--espace-s);
}
/* 3 propositions → une seule ligne */
.jeu-choix--ligne {
  grid-template-columns: repeat(3, 1fr);
}
.jeu-choix--grille .jeu-choix-btn,
.jeu-choix--grille .jeu-choix-fig {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--espace-m);
}

/* Figure-choix manipulable (remplace le bouton en correction) */
.jeu-choix-fig {
  border-radius: var(--rayon-s);
  border: 1px solid var(--bordure);
  background: var(--surface);
  overflow: hidden;
}
.jeu-choix-fig.correct {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.16);
}
.jeu-choix-fig.faux {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.16);
}
.jeu-choix--grille .figure {
  width: 100%;
  max-width: 120px;
  height: auto;
}

/* Figures 3D (empilements de cubes, projection isométrique) */
.jeu-visuel .figure3d {
  width: 150px;
  height: 150px;
}
/* Astuce de manipulation (figure tournable en correction) */
.jeu-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gris-texte);
  margin: var(--espace-s) 0;
}
.figure3d {
  display: block;
}
.jeu-choix--grille .figure3d {
  width: 100%;
  max-width: 150px;
  height: auto;
}

/* Disposition en colonne (exercice "intrus") : 3 encarts identiques empilés,
   qui se partagent la hauteur disponible (pas de scroll). */
.jeu-choix--colonne {
  grid-template-columns: 1fr;
  width: 100%;
  margin: 0 auto;
}
.jeu--plein .jeu-choix--colonne {
  flex: 1;
  grid-auto-rows: 1fr; /* les 3 lignes ont la même hauteur */
  min-height: 0;
}
.jeu-choix--colonne .jeu-choix-btn,
.jeu-choix--colonne .jeu-choix-fig {
  height: 100%;
  min-height: 0;
  padding: var(--espace-s);
  overflow: hidden;
}
/* La figure se met à l'échelle pour tenir dans l'encart (taille standardisée). */
.jeu-choix--colonne .figure3d {
  width: 100%;
  height: 100%;
  max-width: none;
}
.fig3d-top { fill: #8bb4f2; stroke: #0b1f3a; stroke-width: 1; stroke-linejoin: round; }
.fig3d-left { fill: #5e86c9; stroke: #0b1f3a; stroke-width: 1; stroke-linejoin: round; }
.fig3d-right { fill: #3f63a0; stroke: #0b1f3a; stroke-width: 1; stroke-linejoin: round; }

/* Plans 2D (exercice "vue de dessus") */
.figure-vue {
  display: block;
}
.jeu-choix--grille .figure-vue {
  width: 100%;
  max-width: 110px;
  height: auto;
}
/* Pas de `fill` ici : sinon il écrase la couleur inline de la case. */
.vue-cell {
  stroke: #0b1f3a;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

/* Taille NATURELLE des figures : même unité de cube/case partout. On ne réduit
   que si la figure dépasse son encart (en conservant les proportions). */
.figure3d,
.figure-vue,
.figure {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
}
.jeu-visuel .figure3d,
.jeu-visuel .figure {
  max-height: 230px;
}

/* ============================================================
   Matrices abstraites (Logique)
   ============================================================ */
.matrice-grille {
  display: block;
  width: 320px;
  max-width: 84vw;
  height: auto;
  margin: 4px auto 0;
}
.jeu-choix--grille .matrice-fig {
  display: block;
  width: 100%;
  max-width: 120px;
  height: auto;
  margin: 0 auto;
}

/* Matrices : tout tient sur un écran (pas de scroll). Grille + propositions
   dimensionnées en vh ; propositions sur 3 colonnes (2 rangées). */
.jeu--matrice {
  max-width: 720px;
  margin: 0 auto;
}
.jeu--matrice .jeu-tag { display: none; }     /* on gagne de la hauteur */
.jeu--matrice .jeu-haut { margin-bottom: 8px; }
.jeu--matrice .matrice-grille {
  width: min(33vh, 270px);
  height: min(33vh, 270px);
  max-width: 90vw;
  margin: 2px auto 8px;
}
.jeu--matrice .jeu-choix--ligne {
  grid-template-columns: repeat(3, 1fr);
  gap: var(--espace-s);
}
.jeu--matrice .jeu-choix-btn { padding: 6px; }
.jeu--matrice .matrice-fig {
  width: min(13vh, 98px);
  height: min(13vh, 98px);
  max-width: 100%;
}
.mat-cell-bg {
  fill: rgba(255, 255, 255, 0.045);
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1.4;
}
.mat-q {
  fill: var(--bleu-clair);
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 46px;
}

/* ============================================================
   Mémoire de travail (N-back)
   ============================================================ */
.nback {
  max-width: 460px;
  margin: 0 auto;
}
.nb-haut {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
  margin-bottom: var(--espace-l);
}
.nb-progress {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.nb-progress-barre {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s linear;
}
.nb-badge {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--bleu-clair);
  padding: 4px 12px;
  border: 1px solid var(--bordure);
  border-radius: 99px;
}
.nb-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44vh;
}
.nb-carte {
  width: min(52vw, 220px);
  height: min(52vw, 220px);
  border-radius: var(--rayon);
  border: 1px solid var(--bordure);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.nb-carte.actif {
  border-color: var(--bordure-claire);
  box-shadow: 0 0 42px rgba(59, 130, 246, 0.22);
}
.nb-carte.ok { background: rgba(52, 211, 153, 0.18); border-color: #34d399; }
.nb-carte.ko { background: rgba(248, 113, 113, 0.18); border-color: #f87171; }
.nb-stim {
  display: flex;
  align-items: center;
  justify-content: center;
}
.nb-lettre {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: min(28vw, 120px);
  line-height: 1;
  color: var(--blanc);
}
.nb-svg {
  width: min(30vw, 135px);
  height: min(30vw, 135px);
  display: block;
}
.nb-btn { width: 100%; margin-top: var(--espace-l); }
.nb-btn-sous { font-weight: 500; opacity: 0.7; font-size: 0.8rem; }

/* ============================================================
   Lecture d'horloge
   ============================================================ */
.horloge-svg {
  display: block;
  width: min(66vw, 250px);
  height: min(66vw, 250px);
  margin: 0 auto;
}
.horloge-cadran { fill: rgba(255, 255, 255, 0.03); stroke: rgba(219, 230, 247, 0.75); stroke-width: 3.5; }
.horloge-h { stroke: #dbe6f7; stroke-width: 7; stroke-linecap: round; }   /* heures : épaisse, courte */
.horloge-m { stroke: #6ea8fe; stroke-width: 4; stroke-linecap: round; }   /* minutes : fine, longue, bleue */
.horloge-axe { fill: #dbe6f7; }

/* ============================================================
   Reconnaissance d'angles
   ============================================================ */
.angle-svg {
  display: block;
  width: min(64vw, 240px);
  height: min(64vw, 240px);
  margin: 0 auto;
}
.angle-fond { fill: rgba(255, 255, 255, 0.03); stroke: var(--bordure); stroke-width: 1.5; }
.angle-ray { stroke: #6ea8fe; stroke-width: 5; stroke-linecap: round; }
.angle-arc { fill: none; stroke: #ffd54a; stroke-width: 3; }
.angle-vertex { fill: #dbe6f7; }

/* ============================================================
   Poursuite (tracking)
   ============================================================ */
.pour { max-width: 760px; margin: 0 auto; }
.pour-haut {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
  margin-bottom: var(--espace-m);
}
.pour-progress {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}
.pour-progress-barre { height: 100%; width: 100%; background: var(--accent); }
.pour-manette {
  font-weight: 700;
  font-size: 0.78rem;
  color: #5be0a0;
  white-space: nowrap;
}
.pour-score {
  font-weight: 700;
  color: var(--bleu-clair);
  font-variant-numeric: tabular-nums;
  min-width: 96px;
  text-align: right;
}
.pour-scene {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 46vh;
  padding: var(--espace-s) 0;
}
.ils-svg { display: block; width: min(74vw, 300px); height: min(74vw, 300px); }
.ils-bezel { fill: #0b1a30; stroke: rgba(255, 255, 255, 0.22); stroke-width: 3; }
.ils-face { fill: #0e2038; }
.ils-dot { fill: rgba(219, 230, 247, 0.55); }
.ils-ref { stroke: #ffd54a; stroke-width: 3; stroke-linecap: round; }
.ils-ring { fill: none; stroke: #ffd54a; stroke-width: 2.5; transition: stroke 0.1s ease; }
.ils-ring.on { stroke: #5be0a0; }
.ils-needle { stroke: #6ea8fe; stroke-width: 4; stroke-linecap: round; transition: stroke 0.1s ease; }
.ils-needle.on { stroke: #5be0a0; }

/* ============================================================
   Cap & instruments (compas, horizon artificiel)
   ============================================================ */
.inst-svg {
  display: block;
  width: min(58vw, 230px);
  height: min(58vw, 230px);
  margin: 0 auto;
}
.inst-bezel { fill: #0b1a30; stroke: rgba(255, 255, 255, 0.22); stroke-width: 3; }
.inst-face { fill: #0e2038; }
.inst-ring { fill: none; stroke: rgba(255, 255, 255, 0.22); stroke-width: 3; }
.inst-tick { stroke: rgba(255, 255, 255, 0.55); stroke-width: 2; }
.inst-card { fill: #dbe6f7; font-family: "Sora", sans-serif; font-weight: 700; font-size: 15px; }
.inst-arrow { fill: #6ea8fe; }
.inst-arrow-tail { stroke: #cbd8ee; stroke-width: 3; }
.inst-hub { fill: #dbe6f7; }
/* Horizon artificiel */
.ai-sky { fill: #4a90d9; }
.ai-ground { fill: #9c6b3f; }
.ai-horizon { stroke: #ffffff; stroke-width: 3; }
.ai-ladder { stroke: rgba(255, 255, 255, 0.85); stroke-width: 2; }
.ai-plane { stroke: #ffd54a; stroke-width: 4; stroke-linecap: round; fill: none; }
.ai-plane circle { fill: #ffd54a; stroke: none; }
.ai-ptr { fill: #ffd54a; }

/* ============================================================
   Écran de RÉSULTATS
   ============================================================ */
.res {
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
  padding: var(--espace-l) 0;
}
.res-module {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gris-doux);
  margin-bottom: var(--espace-l);
}
.res-cercle {
  width: 150px;
  height: 150px;
  margin: 0 auto var(--espace-l);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Anneau dégradé autour d'un disque sombre */
  background: var(--accent);
  box-shadow: var(--ombre-accent);
  position: relative;
}
.res-cercle::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--bleu-nuit);
}
.res-pct {
  position: relative;
  z-index: 1;
  font-family: var(--police-titre);
  font-size: 2.6rem;
  font-weight: 800;
}
.res-score {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--espace-s);
}
.res-message {
  font-family: var(--police-titre);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--bleu-clair);
  margin-bottom: var(--espace-s);
}
.res-detail {
  color: var(--gris-texte);
  font-size: 0.95rem;
  margin-bottom: var(--espace-l);
}
/* Catégories de réponses (série chronométrée) */
.res-cats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--espace-s);
  margin-bottom: var(--espace-l);
}
.res-cat {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  padding: var(--espace-s) 4px;
}
.res-cat-val {
  display: block;
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--bleu-clair);
}
.res-cat-lab {
  display: block;
  font-size: 0.68rem;
  color: var(--gris-texte);
  margin-top: 2px;
}
.res-actions {
  margin-top: var(--espace-l);
}

/* ============================================================
   Écran de RÉGLAGES (difficulté)
   ============================================================ */
.config {
  max-width: 520px;
  margin: 0 auto;
}
.config-entete {
  text-align: center;
  margin: var(--espace-m) 0 var(--espace-xl);
}
.config-icone {
  display: inline-block;
  font-size: 2.4rem;
  margin-bottom: var(--espace-s);
}
.config-entete h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.config-options {
  display: flex;
  flex-direction: column;
  gap: var(--espace-s);
}
.diff-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  padding: var(--espace-m);
  border-radius: var(--rayon-s);
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--blanc);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.diff-option:hover {
  background: var(--surface-forte);
  transform: translateX(3px);
}
.diff-option.actif {
  border-color: var(--bleu-ciel);
  background: rgba(59, 130, 246, 0.14);
}
.diff-option.actif::after {
  content: "✓";
  position: absolute;
  top: var(--espace-m);
  right: var(--espace-m);
  color: var(--bleu-clair);
  font-weight: 700;
}
.diff-nom {
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.05rem;
}
.diff-desc {
  font-size: 0.88rem;
  color: var(--gris-texte);
}

.config-note {
  text-align: center;
  margin-top: var(--espace-l);
  margin-bottom: var(--espace-s);
  color: var(--gris-texte);
  font-size: 0.9rem;
}

/* ============================================================
   Écran de CONSIGNE (avant chaque série)
   ============================================================ */
.consigne {
  max-width: 540px;
  margin: 0 auto;
  text-align: center;
}
.consigne-icone {
  display: inline-block;
  font-size: 2.6rem;
  margin: var(--espace-m) 0 var(--espace-s);
}
.consigne h1 {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: var(--espace-l);
}
.consigne-corps {
  text-align: left;
  color: var(--gris-texte);
  font-size: 0.98rem;
  line-height: 1.65;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: var(--espace-l);
  margin-bottom: var(--espace-l);
}
.consigne-corps strong {
  color: var(--blanc);
  font-weight: 700;
}

/* ============================================================
   Chrono global du SPRINT
   ============================================================ */
.sprint-haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espace-m);
  margin-bottom: var(--espace-xl);
}
.sprint-chrono {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--espace-s);
}
.sprint-temps {
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--bleu-clair);
  min-width: 56px;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}
.sprint-temps.urgent {
  color: #fca5a5; /* rouge doux dans les 10 dernières secondes */
}
.sprint-piste {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sprint-barre {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--or), var(--bleu-ciel));
  transition: width 0.4s linear;
}
.sprint-compteur {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gris-texte);
  white-space: nowrap;
}
.sprint-compteur span {
  color: var(--blanc);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Barre du haut de session + interrupteur "Correction"
   ============================================================ */
.jeu-barre-haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--espace-m);
}

.switch-correction {
  display: inline-flex;
  align-items: center;
  gap: var(--espace-s);
  cursor: pointer;
  user-select: none;
}
.switch-texte {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gris-texte);
}

/* L'interrupteur lui-même (deux positions) */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.switch-piste {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.2s ease;
}
.switch-bouton {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}
.switch input:checked ~ .switch-piste {
  background: var(--bleu-ciel);
}
.switch input:checked ~ .switch-bouton {
  transform: translateX(20px);
}

/* Choix simplement "sélectionné" en mode examen (sans révéler le résultat) */
.jeu-choix-btn.choisi {
  border-color: var(--bleu-ciel);
  background: rgba(59, 130, 246, 0.16);
}

/* ============================================================
   Tableau de bord (progression par module)
   ============================================================ */
.dash {
  max-width: 720px;
  margin: 0 auto;
}
.dash > h1 {
  text-align: center;
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.dash > .subtitle {
  text-align: center;
  margin-bottom: var(--espace-xl);
}

/* Un bloc par module */
.dash-modules {
  display: flex;
  flex-direction: column;
  gap: var(--espace-m);
}
.dash-module {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: var(--espace-m);
}
.dash-module.bientot {
  opacity: 0.6;
}
.dash-module-tete {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
  margin-bottom: var(--espace-m);
}
.dash-module-icone {
  font-size: 1.4rem;
}
.dash-module-nom {
  flex: 1;
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.05rem;
}
.dash-module-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(147, 197, 253, 0.14);
  color: var(--bleu-clair);
  border: 1px solid var(--bordure);
}
.dash-module-vide {
  color: var(--gris-texte);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Mini-statistiques d'un module */
.dash-mini-stats {
  display: flex;
  gap: var(--espace-s);
  margin-bottom: var(--espace-m);
}
.mini-stat {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  padding: var(--espace-s);
}
.mini-val {
  display: block;
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--bleu-clair);
  font-variant-numeric: tabular-nums;
}
.mini-label {
  display: block;
  font-size: 0.72rem;
  color: var(--gris-texte);
  margin-top: 2px;
}

/* Graphe : cadriage horizontal + axe Y + survol */
.chart {
  display: flex;
  height: 140px;
}
.chart-yaxis {
  position: relative;
  width: 30px;
  flex-shrink: 0;
}
.chart-ylab {
  position: absolute;
  right: 5px;
  transform: translateY(-50%);
  font-size: 0.62rem;
  color: var(--gris-doux);
  font-variant-numeric: tabular-nums;
}
.chart-plot {
  position: relative;
  flex: 1;
  height: 100%;
}
.chart-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.chart-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}
.dash-courbe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.chart-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-0.5px);
  pointer-events: none;
}
.chart-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
  pointer-events: none;
}
.chart-tip {
  position: absolute;
  transform: translate(-50%, -135%);
  background: #0c2240;
  border: 1px solid var(--bordure-claire);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  z-index: 6;
}
.dash-courbe-note {
  color: var(--gris-texte);
  font-size: 0.88rem;
}

/* Slider de difficulté (Calcul mental) */
.calc-filtre {
  margin-bottom: var(--espace-m);
}
.slider-diff {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  /* Piste neutre et sobre (look premium), sans dégradé de couleur. */
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--bordure);
  outline: none;
  cursor: pointer;
}
.slider-diff::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--bleu-ciel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.slider-diff::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--bleu-ciel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}
.slider-labels span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gris-doux);
  transition: color 0.15s ease;
}
.slider-labels span.actif {
  color: var(--bleu-clair);
}

/* ---------- Vue d'ensemble : tuiles de modules ---------- */
.progres-tuiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--espace-m);
}
.progres-tuile {
  display: flex;
  flex-direction: column;
  gap: var(--espace-s);
  text-align: left;
  padding: var(--espace-m);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-douce);
  color: var(--blanc);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, background 0.2s ease;
}
button.progres-tuile:hover {
  transform: translateY(-4px);
  border-color: var(--bordure-claire);
  background: var(--surface-forte);
}
.progres-tuile.indispo {
  opacity: 0.5;
}
.progres-tuile-tete {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
}
.progres-tuile-icone {
  font-size: 1.35rem;
}
.progres-tuile-nom {
  flex: 1;
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1rem;
}
.progres-tuile-fleche {
  color: var(--bleu-clair);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
button.progres-tuile:hover .progres-tuile-fleche {
  opacity: 1;
  transform: translateX(0);
}
.progres-tuile-graph {
  height: 42px;
  display: flex;
  align-items: center;
}
.spark {
  width: 100%;
  height: 42px;
  display: block;
}
.spark-plat {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
.progres-tuile-pied {
  font-size: 0.78rem;
  color: var(--gris-texte);
}

/* ---------- Détail d'un module ---------- */
.detail-tete {
  display: flex;
  align-items: center;
  gap: var(--espace-s);
  margin: var(--espace-m) 0 var(--espace-l);
}
.detail-icone {
  font-size: 1.8rem;
}
.detail-tete h1 {
  font-size: 1.6rem;
  font-weight: 800;
}

/* Hero : dernier score */
.hero-stat {
  text-align: center;
  padding: var(--espace-m) 0;
}
.hero-val {
  display: block;
  font-family: var(--police-titre);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}
.hero-label {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gris-texte);
}
.hero-sous {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--gris-texte);
}
.hero-delta {
  display: inline-block;
  margin-top: var(--espace-s);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.hero-delta.up {
  color: #9ce8c0;
  background: rgba(156, 232, 192, 0.14);
}
.hero-delta.down {
  color: #f0a6a6;
  background: rgba(240, 166, 166, 0.14);
}
.hero-delta.flat {
  color: var(--gris-texte);
  background: rgba(255, 255, 255, 0.06);
}

/* Encart subtil "explication de l'indice" + infobulle au survol */
.info-indice {
  position: relative;
  display: inline-block;
  margin-bottom: var(--espace-m);
  cursor: help;
  outline: none;
}
.info-pastille {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bleu-clair);
  background: var(--surface);
  border: 1px solid var(--bordure);
  padding: 6px 12px;
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.info-indice:hover .info-pastille,
.info-indice:focus .info-pastille {
  background: var(--surface-forte);
  border-color: var(--bordure-claire);
}
.info-bulle {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  width: min(340px, 82vw);
  background: #0c2240;
  border: 1px solid var(--bordure-claire);
  border-radius: var(--rayon-s);
  padding: var(--espace-m);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--gris-texte);
  box-shadow: var(--ombre-douce);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}
.info-bulle strong {
  color: var(--blanc);
  font-weight: 700;
}
.info-indice:hover .info-bulle,
.info-indice:focus .info-bulle {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* "/N" plus discret dans les cartes de stats */
.mini-sur {
  font-size: 0.62em;
  font-weight: 600;
  color: var(--gris-texte);
}

/* Tendance dans le temps */
.tendance {
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: var(--espace-l);
}
.tendance span {
  font-weight: 500;
  color: var(--gris-texte);
}
.tendance.up { color: #9ce8c0; }
.tendance.down { color: #f0a6a6; }
.tendance.flat { color: var(--gris-texte); }

.detail-courbe {
  margin: var(--espace-m) 0 var(--espace-s);
}
/* Bloc "titre + courbe", espacé pour aérer quand il y en a plusieurs */
.bloc-courbe {
  margin-top: var(--espace-xl);
}
.bloc-courbe:first-child {
  margin-top: var(--espace-m);
}
.courbe-titre {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gris-texte);
  margin: 0 0 6px;
}
.detail-periode {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gris-doux);
}

/* ---------- Tuiles de thèmes (sélecteur Culture) ---------- */
.theme-tuiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--espace-s);
  margin-bottom: var(--espace-l);
}
.theme-tuile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espace-m);
  padding: 14px 16px;
  border-radius: var(--rayon-s);
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--blanc);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.theme-tuile:hover {
  background: var(--surface-forte);
  border-color: var(--bordure-claire);
}
.theme-tuile.actif {
  background: rgba(59, 130, 246, 0.16);
  border-color: var(--bleu-ciel);
}
.theme-tuile-nom {
  flex: 1;
  line-height: 1.35;
}
.theme-tuile .ecart {
  flex-shrink: 0;
}

/* Badge d'écart à la moyenne (discret : vert si +, rouge si -) */
.ecart {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ecart.up { color: #9ce8c0; }
.ecart.down { color: #f0a6a6; }
.ecart.flat,
.ecart.vide { color: var(--gris-doux); }

.dash-reset {
  margin-top: var(--espace-l);
}

/* ============================================================
   Adaptation mobile
   ============================================================ */
@media (max-width: 520px) {
  .page {
    padding: var(--espace-l) var(--espace-m);
  }
  .intro h1 {
    font-size: 1.7rem;
  }
  .site-header {
    padding-left: var(--espace-m);
    padding-right: var(--espace-m);
  }
  .grille-modules {
    grid-template-columns: 1fr;
  }
  .jeu-question {
    font-size: 1.35rem;
  }
}
