/* Styles de l'app — couleurs, polices et animations reprises de la maquette v14.
   Les couleurs sont des « variables CSS » (--bg, --accent…) : on les change
   d'un coup pour passer du thème clair au thème sombre. */

:root {
  --bg: #F5F6FA; --surface: #FFFFFF; --surface2: #ECEEF5; --line: #DADDE7;
  --text: #151824; --muted: #555B6E;
  --accent: #3949C9; --accent-ink: #FFFFFF; --accent-soft: #E3E6FA;
  --flame: #E8590C; --flame-text: #B8440A; --flame-soft: #FFE8D9;
  --ok: #1B7F4B; --ok-soft: #DDF3E6; --ko: #C62F2F; --ko-soft: #FBE1E1;
  --or: #F2B705; --or-fonce: #A87A00; --or-soft: #FFF4CC; --argent: #AEB6C2; --argent-soft: #EEF1F5;
  --bronze: #CD7F45; --bronze-soft: #F8E6D8; --medal-ink: #151824;
  --ombre-carte: 0 10px 30px rgba(20, 24, 40, .10);
  color-scheme: light;
}
/* Thème sombre : automatique (réglage du téléphone) sauf si l'élève a forcé « clair » */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --bg: #0F1118; --surface: #191C26; --surface2: #232735; --line: #30354A;
    --text: #EEF0F7; --muted: #A6ACBF;
    --accent: #8E9BFF; --accent-ink: #0F1118; --accent-soft: #262B4A;
    --flame: #FF8F4A; --flame-text: #FF9F63; --flame-soft: #3A2418;
    --ok: #5BD08F; --ok-soft: #163525; --ko: #FF7B7B; --ko-soft: #3D1C1F;
    --or: #F2C230; --or-fonce: #A87A00; --or-soft: #3A3010; --argent: #B9C1CD; --argent-soft: #2A2F3A;
    --bronze: #D98E57; --bronze-soft: #3A2618; --medal-ink: #EEF0F7;
    --ombre-carte: 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="sombre"] {
  --bg: #0F1118; --surface: #191C26; --surface2: #232735; --line: #30354A;
  --text: #EEF0F7; --muted: #A6ACBF;
  --accent: #8E9BFF; --accent-ink: #0F1118; --accent-soft: #262B4A;
  --flame: #FF8F4A; --flame-text: #FF9F63; --flame-soft: #3A2418;
  --ok: #5BD08F; --ok-soft: #163525; --ko: #FF7B7B; --ko-soft: #3D1C1F;
  --or: #F2C230; --or-fonce: #A87A00; --or-soft: #3A3010; --argent: #B9C1CD; --argent-soft: #2A2F3A;
  --bronze: #D98E57; --bronze-soft: #3A2618; --medal-ink: #EEF0F7;
  --ombre-carte: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
button { font: inherit; }
.h { font-family: 'Space Grotesk', Inter, sans-serif; }
.muted { color: var(--muted); }
.cache { display: none !important; }

/* L'écran occupe toute la hauteur du téléphone ; sur ordinateur, colonne centrée */
#app {
  max-width: 480px; margin: 0 auto; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden; background: var(--bg);
}
.defile { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* Dans une zone qui défile, les blocs gardent leur hauteur (sinon, quand la
   page est longue, ceux en « overflow:hidden » sont écrasés à 0). */
.defile > * { flex-shrink: 0; }

/* ---------- éléments communs ---------- */
.carte-bloc { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.etiquette { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.barre { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; display: flex; }
.barre > span { display: block; height: 100%; background: var(--accent); }
.barre > span.leger { opacity: .35; }
.bouton {
  border: 0; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border-radius: 16px; min-height: 56px;
  display: flex; align-items: center; justify-content: center; width: 100%;
  font-size: 17px; font-weight: 700; box-shadow: 0 4px 0 rgba(0, 0, 0, .18);
}
.bouton:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.bouton[disabled] { opacity: .45; cursor: default; }
.bouton-texte {
  border: 0; background: none; color: var(--muted); text-decoration: none; cursor: pointer;
  min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600;
}
.retour {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  color: var(--text); border-radius: 12px; border: 0; background: none; cursor: pointer;
}
.entete-retour { display: flex; align-items: center; gap: 8px; padding: 18px 12px 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Barre de navigation du bas */
.nav {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 8px 8px calc(14px + env(safe-area-inset-bottom));
}
.nav a {
  text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 6px; min-height: 44px; font-size: 12px; font-weight: 500;
}
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* ---------- flamme ---------- */
@keyframes sway { 0%,100% { transform: rotate(-4deg) scaleY(1) } 50% { transform: rotate(3deg) scaleY(1.07) } }
@keyframes lick { 0%,100% { transform: scaleY(1) translateY(0) } 50% { transform: scaleY(1.22) translateY(-.5px) } }
@keyframes glow { 0%,100% { filter: drop-shadow(0 0 3px var(--flame)) } 50% { filter: drop-shadow(0 0 8px var(--flame)) } }
.flame-on { animation: glow 2.2s ease-in-out infinite; overflow: visible; }
.flame-on .outer { animation: sway 1.7s ease-in-out infinite; transform-origin: 50% 92%; transform-box: fill-box; }
.flame-on .inner { animation: lick .85s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.flame-off { filter: grayscale(1); opacity: .4; }

/* ---------- accueil ---------- */
.accueil-entete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 24px 20px 12px; }
.accueil-entete h1 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 700; }
.pastille-serie { display: flex; align-items: center; gap: 6px; padding: 8px 14px 8px 10px; border-radius: 999px; flex-shrink: 0; background: var(--surface2); }
.pastille-serie .h { font-size: 19px; font-weight: 700; color: var(--muted); }
.pastille-serie.allumee { background: var(--flame-soft); }
.pastille-serie.allumee .h { color: var(--flame-text); }
.accueil-corps { padding: 8px 20px 20px; display: flex; flex-direction: column; gap: 22px; }
.objectif { padding: 18px; display: flex; flex-direction: column; gap: 16px; border-radius: 20px; }
.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.semaine > div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.rond-jour { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.rond-jour.fait { background: var(--flame); }
.rond-jour.auj { border: 2px dashed var(--flame); }
.rond-jour.vide { background: var(--surface2); }
.chapitre-lien {
  text-decoration: none; color: var(--text); padding: 14px 16px; display: flex; align-items: center; gap: 14px; min-height: 44px;
}

/* ---------- lancement ---------- */
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats3 > div { padding: 12px; display: flex; flex-direction: column; gap: 2px; border-radius: 14px; }
.pied { padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.pied.avec-fond { border-top: 1px solid var(--line); background: var(--surface); }
.legende { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legende span { display: flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); display: inline-block; }

/* ---------- session recto/verso ---------- */
.session-entete { display: flex; align-items: center; gap: 10px; padding: 18px 16px 10px 8px; }
.progression { flex: 1; height: 12px; border-radius: 6px; background: var(--surface2); overflow: hidden; }
.progression > span { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .35s ease; }
.badge-type { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 5px 10px; border-radius: 999px; }
.badge-type.piege { color: var(--ko); background: var(--ko-soft); }
.badge-type.methode { color: var(--ok); background: var(--ok-soft); }
.zone-carte { position: relative; flex: 1; min-height: 300px; margin: 6px 0 22px; }
.pile { position: absolute; left: 14px; right: 14px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.scene { position: absolute; inset: 0; perspective: 1100px; touch-action: pan-y; cursor: pointer; user-select: none; -webkit-user-select: none; }
.scene.retournee { cursor: grab; } /* pan-y : on peut encore faire défiler une longue réponse */
.flipper { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, 1.4, .5, 1); }
.scene.retournee .flipper { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); box-shadow: var(--ombre-carte); border: 1px solid var(--line); overflow: hidden;
}
.face.verso { transform: rotateY(180deg); border: 2px solid var(--accent); }
.face .texte { overflow-y: auto; }
.recto-texte { margin: 0; font-size: 21px; line-height: 1.4; font-weight: 600; }
.verso-texte { margin: 0; font-size: 17px; line-height: 1.55; }
.consigne { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.45; }
.indices { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; }
.indices .ko { color: var(--ko); display: flex; align-items: center; gap: 4px; }
.indices .ok { color: var(--ok); display: flex; align-items: center; gap: 4px; }
@keyframes hint { 0%,100% { transform: translateX(0) } 30% { transform: translateX(-6px) } 70% { transform: translateX(6px) } }
.indices.anime { animation: hint 2.4s ease-in-out infinite; }
.tampon {
  position: absolute; top: 18px; padding: 6px 12px; border-radius: 10px; border: 3px solid;
  font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 700; font-size: 18px; letter-spacing: .04em;
  text-transform: uppercase; pointer-events: none; opacity: 0;
}
.tampon.ok { right: 18px; color: var(--ok); border-color: var(--ok); background: var(--ok-soft); transform: rotate(8deg); }
.tampon.ko { left: 18px; color: var(--ko); border-color: var(--ko); background: var(--ko-soft); transform: rotate(-8deg); }
.deux-boutons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choix {
  cursor: pointer; border-radius: 16px; min-height: 52px; display: flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 15px; font-weight: 700; border: 2px solid;
}
.choix.ko { border-color: var(--ko); color: var(--ko); background: var(--ko-soft); }
.choix.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.texte-math .katex { font-size: 1.05em; }

/* ---------- session QCM (3b) et Vrai/Faux (3c) ---------- */
.zone-carte.libre { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin: 4px 0 8px; }
.question-bloc {
  flex-shrink: 0; border-radius: 22px; padding: 20px 22px; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); box-shadow: var(--ombre-carte); border: 1px solid var(--line);
}
.options { display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }
.option {
  cursor: pointer; text-align: left; width: 100%; min-height: 54px; padding: 12px 14px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--surface); color: var(--text);
  display: flex; align-items: center; gap: 12px; font: inherit; font-size: 16px; line-height: 1.45;
  transition: border-color .15s, background .15s, opacity .2s;
}
.option .lettre {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--surface2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
@media (hover: hover) { .option:not(:disabled):hover { border-color: var(--accent); } }
.option:not(:disabled):active { transform: translateY(1px); }
.option:disabled { cursor: default; }
.option.bonne { border-color: var(--ok); background: var(--ok-soft); }
.option.bonne .lettre { background: var(--ok); color: var(--bg); }
.option.mauvaise { border-color: var(--ko); background: var(--ko-soft); }
.option.mauvaise .lettre { background: var(--ko); color: var(--bg); }
.option.estompee { opacity: .45; }
.choix.neutre { border-color: var(--line); color: var(--text); background: var(--surface); font-size: 17px; min-height: 60px; }
.choix.neutre:disabled { cursor: default; }
.choix.neutre.bonne { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.choix.neutre.mauvaise { border-color: var(--ko); color: var(--ko); background: var(--ko-soft); }
.choix.neutre.estompee { opacity: .45; }
@keyframes monte { 0% { transform: translateY(100%) } 100% { transform: translateY(0) } }
.correction {
  border-top: 3px solid; animation: monte .28s cubic-bezier(.2, .9, .3, 1.1) both;
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
}
.correction.ok { background: var(--ok-soft); border-color: var(--ok); }
.correction.ko { background: var(--ko-soft); border-color: var(--ko); }
.correction .titre { display: flex; align-items: center; gap: 8px; font-family: 'Space Grotesk', Inter, sans-serif; font-size: 19px; font-weight: 700; }
.correction.ok .titre { color: var(--ok); }
.correction.ko .titre { color: var(--ko); }
.correction .explication { font-size: 15px; line-height: 1.5; max-height: 32vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.correction .explication p { margin: 0; }
.correction .bouton { color: var(--bg); }
.correction.ok .bouton { background: var(--ok); }
.correction.ko .bouton { background: var(--ko); }

/* ---------- fin de session ---------- */
@keyframes grow { 0% { transform: scale(.35); opacity: 0 } 45% { transform: scale(1.35); opacity: 1 } 70% { transform: scale(.92) } 100% { transform: scale(1) } }
@keyframes halo { 0% { transform: scale(.4); opacity: 0 } 40% { opacity: .55 } 100% { transform: scale(1.9); opacity: 0 } }
@keyframes burst { 0% { transform: translate(0, 0) scale(1); opacity: 1 } 100% { transform: translate(var(--tx), var(--ty)) scale(.4) rotate(var(--r)); opacity: 0 } }
@keyframes outUp { 0% { transform: translateY(0); opacity: 1 } 100% { transform: translateY(-100%); opacity: 0 } }
@keyframes inUp { 0% { transform: translateY(100%); opacity: 0 } 100% { transform: translateY(0); opacity: 1 } }
@keyframes slideIn { 0% { transform: translateY(28px); opacity: 0 } 100% { transform: translateY(0); opacity: 1 } }
.grow { animation: grow .9s cubic-bezier(.2, .9, .3, 1.2) both; transform-origin: 50% 90%; }
.grow .outer { animation: sway 1.8s ease-in-out .9s infinite; transform-origin: 50% 92%; transform-box: fill-box; }
.grow .inner { animation: lick .9s ease-in-out .9s infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.halo { position: absolute; left: 50%; top: 50%; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%; background: radial-gradient(circle, var(--flame) 0%, transparent 70%); animation: halo 1.1s ease-out .35s both; }
.particule { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4px; border-radius: 2px; opacity: 0; animation: burst 1s cubic-bezier(.1, .7, .3, 1) .4s both; }
.compteur { position: relative; height: 62px; width: 140px; overflow: hidden; text-align: center; font-size: 58px; font-weight: 700; line-height: 62px; color: var(--flame-text); }
.compteur span { position: absolute; inset: 0; }
.compteur .ancien { animation: outUp .45s ease-in .9s both; }
.compteur .nouveau { animation: inUp .5s cubic-bezier(.2, .9, .3, 1.3) 1s both; }
.s0 { animation: slideIn .45s ease-out 1.3s both; }
.s1 { animation: slideIn .45s ease-out 1.5s both; }
.s2 { animation: slideIn .45s ease-out 1.65s both; }
.s3 { animation: slideIn .45s ease-out 1.8s both; }
.s4 { animation: slideIn .45s ease-out 1.95s both; }
.puce { width: 8px; height: 8px; border-radius: 50%; background: var(--ko); flex-shrink: 0; margin-top: 7px; }
.deux-lignes { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- profil ---------- */
.stats-profil { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; }
.stats-profil > * { border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.calendrier { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.calendrier .l { font-size: 11px; font-weight: 600; color: var(--muted); padding-bottom: 2px; }
.case { height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; color: var(--muted); }
.case.serie { background: var(--flame); color: #FFFFFF; font-weight: 700; }
.case.revise { background: var(--flame-soft); color: var(--flame-text); font-weight: 700; }
.case.saute, .case.a_faire { background: var(--surface2); }
.case.auj { border: 2px solid var(--text); }
.mois-btn { width: 36px; height: 36px; border: 0; background: none; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.mois-btn[disabled] { color: var(--line); cursor: default; }
.succes-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.badge { border-radius: 16px; padding: 12px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--surface2); border: 1px solid transparent; opacity: .75; }
.badge .rond { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--line); color: var(--muted); }
.badge.obtenu { background: var(--surface); border-color: var(--line); opacity: 1; }
.badge.obtenu .rond { background: var(--flame-soft); color: var(--flame-text); }
.reglage { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 52px; cursor: pointer; }
.reglage + .reglage { border-top: 1px solid var(--line); }
.reglage.inactif { cursor: default; opacity: .55; }
.sw { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw .track { position: absolute; inset: 0; border-radius: 13px; background: var(--line); transition: background .2s; }
.sw .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.sw input:checked ~ .track { background: var(--accent); }
.sw input:checked ~ .knob { transform: translateX(18px); }
.sw input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw input:disabled { cursor: default; }
.segment { display: flex; background: var(--surface2); border-radius: 10px; padding: 3px; gap: 2px; }
.segment button { border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 8px; cursor: pointer; min-height: 32px; }
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.bientot { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface2); padding: 3px 8px; border-radius: 999px; }
@keyframes open { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }
.accordeon-corps { animation: open .25s ease-out; border-top: 1px solid var(--line); padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }

/* Classement : podium (2e, 1er, 3e), groupes par catégorie, lignes d'élèves */
.etat-classement { align-self: flex-start; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface2); padding: 3px 9px; border-radius: 999px; margin-top: 2px; }
.podium { display: flex; align-items: flex-end; gap: 8px; padding: 18px 0 8px; }
.marche { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.medaille-zone { position: relative; display: flex; flex-direction: column; align-items: center; }
.couronne { margin-bottom: -2px; animation: couronne 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes couronne { 0%, 100% { transform: translateY(0) rotate(-4deg) } 50% { transform: translateY(-3px) rotate(4deg) } }
.medaille {
  width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', Inter, sans-serif; font-size: 19px; font-weight: 700; color: var(--medal-ink);
  border: 3px solid var(--argent); background: var(--argent-soft);
}
.place1 .medaille { width: 56px; height: 56px; font-size: 22px; border-color: var(--or); background: var(--or-soft); }
.place3 .medaille { border-color: var(--bronze); background: var(--bronze-soft); }
.nom-podium { max-width: 100%; font-size: 13px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marche.moi .nom-podium { color: var(--accent); font-weight: 700; }
.socle {
  width: 100%; height: 64px; border-radius: 14px 14px 6px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--medal-ink); background: var(--argent-soft); border: 1px solid var(--argent); border-bottom-width: 4px;
}
.place2 .socle { height: 80px; }
.place1 .socle { height: 104px; background: var(--or-soft); border-color: var(--or); }
.place3 .socle { background: var(--bronze-soft); border-color: var(--bronze); }
.titre-groupe { display: flex; align-items: center; gap: 8px; padding: 14px 2px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.titre-groupe .trait { flex: 1; height: 1px; background: var(--line); }
.ligne-eleve { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 56px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.ligne-eleve.moi { background: var(--accent-soft); border-color: var(--accent); }
.ligne-eleve .rang { width: 22px; text-align: center; font-size: 15px; font-weight: 700; color: var(--muted); }
.ligne-eleve .avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.ligne-eleve.moi .avatar { background: var(--accent); color: var(--accent-ink); }
.ligne-eleve .nom { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-eleve.moi .nom { font-weight: 700; }
.serie-eleve { display: flex; align-items: center; gap: 3px; font-family: 'Space Grotesk', Inter, sans-serif; font-size: 16px; font-weight: 700; color: var(--flame-text); }

/* Formulaires (rejoindre le classement) */
.formulaire { display: flex; flex-direction: column; gap: 16px; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > span { font-size: 14px; font-weight: 600; }
.champ input, .champ select {
  font: inherit; font-size: 16px; /* 16 px : évite le zoom automatique sur iPhone */
  color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; min-height: 48px; width: 100%;
}
.champ select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; }
.champ input:focus, .champ select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.saut-classement { text-align: center; color: var(--muted); font-size: 20px; letter-spacing: .3em; line-height: 1; padding: 2px 0 6px; }
.ma-place { margin: 6px 0 2px; font-size: 14px; text-align: center; }
.champ small { font-size: 12px; }
input.code { font-family: 'Space Grotesk', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.erreur { margin: 0; min-height: 1.2em; font-size: 14px; color: var(--ko); }
.erreur:empty { display: none; }
.code-recup { font-size: 22px; font-weight: 700; letter-spacing: .08em; text-align: center; word-break: break-all; user-select: all; }
.code-recup.petit { font-size: 15px; text-align: left; }

/* Moins d'animations si l'élève l'a demandé dans les réglages du téléphone */
@media (prefers-reduced-motion: reduce) {
  .flame-on, .flame-on .outer, .flame-on .inner, .flipper, .indices.anime, .grow, .grow .outer, .grow .inner,
  .halo, .particule, .compteur span, .s0, .s1, .s2, .s3, .s4, .accordeon-corps, .progression > span, .correction, .option, .couronne { animation: none; transition: none; }
  .particule, .halo, .compteur .ancien { display: none; }
}

/* Fenêtre de confirmation (quitter une session, se déconnecter) */
.voile {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
.dialogue {
  width: 100%; max-width: 448px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
}
/* Bandeau « Installe l'app » en haut de l'accueil */
.bandeau-installation { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-color: var(--accent); background: var(--accent-soft); }
.bandeau-installation p { margin: 0; font-size: 14px; line-height: 1.45; }
.bandeau-boutons { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.bandeau-boutons .bouton { width: auto; min-height: 44px; padding: 0 18px; font-size: 15px; }

.dialogue h2 { margin: 0; font-size: 19px; color: var(--text); }
.dialogue p { margin: 0 0 8px; font-size: 15px; }
