/* Course SNT — feuille de style commune */
:root {
  --fond: #f6f5f1;
  --carte: #ffffff;
  --texte: #1f2328;
  --doux: #667085;
  --bord: #d9d6cc;
  --accent: #2f6fde;
  --accent-fonce: #1f4fb0;
  --juste: #1f9d55;
  --faux: #d93c3c;
  --rayon: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  background: var(--fond);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0.2em 0 0.4em; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
code { background: #eceae3; padding: 0.05em 0.3em; border-radius: 4px; }

.ecran { padding: 16px; max-width: 760px; margin: 0 auto; }
.logo { text-align: center; font-size: 2rem; margin-top: 8vh; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 380px; margin: 16px auto; }
.carte.large { max-width: 760px; }
.carte label { font-weight: 600; }
input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 8px; background: #fff; }
input:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
/* un champ texte a une largeur naturelle (≈ 20 caractères) : sans ceci, il déborde de la carte */
.carte > input { width: 100%; min-width: 0; }
#champ-code { font-size: 2rem; text-align: center; letter-spacing: 0.3em; padding-left: calc(12px + 0.3em); }
fieldset { border: 1px solid var(--bord); border-radius: 8px; padding: 10px 14px; display: grid; gap: 8px; }
legend { font-weight: 700; padding: 0 4px; }
.ligne { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.ligne label { font-weight: 400; }
.ligne input[type="number"] { width: 6.5em; padding: 6px 8px; }
.aide { color: var(--doux); font-size: 0.92rem; margin: 0.3em 0; }
.erreur { color: var(--faux); min-height: 1.2em; margin: 0; white-space: pre-wrap; }

.bouton { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--bord); background: #fff; cursor: pointer; }
.bouton:hover:not(:disabled) { background: #f0eee8; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover:not(:disabled) { background: var(--accent-fonce); }
.bouton:disabled { opacity: 0.5; cursor: default; }
.bouton.discret { background: transparent; border-color: transparent; color: var(--doux); }
.bouton.geant { font-size: 1.25rem; padding: 14px 20px; width: 100%; }

.bandeau { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-weight: 600; }
.espace { flex: 1; }
.pastille { padding: 2px 10px; border-radius: 999px; background: #e7e4da; color: #fff; font-size: 0.9rem; }
.score { font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.serie { color: #d4570b; }

/* --- élève ------------------------------------------------------------ */
.page-eleve .ecran { max-width: 640px; }
.grille-avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 12px 0 16px; }
.avatar { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border: 2px solid var(--bord); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; }
.avatar-emoji { font-size: 2rem; line-height: 1.1; }
.avatar-nom { font-size: 0.78rem; }
.avatar.choisi { border-color: var(--accent); background: #eaf1ff; }
.avatar:disabled { opacity: 0.25; cursor: not-allowed; }
.choix-equipe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.equipe { font: inherit; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--couleur, var(--bord)); background: #fff; cursor: pointer; }
.equipe.choisi { background: var(--couleur, #333); color: #fff; }
#bouton-partir { width: 100%; font-size: 1.15rem; }

.piste-eleve { width: 100%; height: 110px; display: block; background: linear-gradient(#eaf3ff, #fdfcf8); border-radius: var(--rayon) var(--rayon) 0 0; border: 1px solid var(--bord); border-bottom: 0; }
.barre-temps { height: 8px; background: #e7e4da; border-radius: 0 0 6px 6px; overflow: hidden; margin-bottom: 12px; }
.barre-temps div { height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
.barre-temps div.urgent { background: var(--faux); }
.zone { transition: opacity 0.2s; }
.zone.voile { opacity: 0.08; pointer-events: none; }
.message, .correction { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; text-align: center; }
.correction { text-align: left; }
.grand { font-size: 1.4rem; font-weight: 700; margin: 0.2em 0 0.4em; }
.juste { color: var(--juste); }
.faux { color: var(--faux); }
.message.juste, .message.faux { color: inherit; }
.message.juste .grand { color: var(--juste); }
.message.faux .grand { color: var(--faux); }
.meta { color: var(--doux); font-size: 0.85rem; margin-bottom: 6px; }
.question { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; }
.enonce-texte { font-size: 1.15rem; line-height: 1.4; }
.enonce-image { display: block; max-width: 100%; max-height: 38vh; margin: 10px auto; border-radius: 6px; }
pre.code { background: #1e2430; color: #e6e6e6; padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 0.95rem; line-height: 1.45; margin: 10px 0; }
.c-mot { color: #c792ea; } .c-str { color: #c3e88d; } .c-num { color: #f78c6c; } .c-com { color: #7f8c98; font-style: italic; } .c-fn { color: #82aaff; }
.choix-liste { display: grid; gap: 8px; margin: 12px 0; }
.choix { display: flex; gap: 10px; align-items: center; text-align: left; font: inherit; font-size: 1.05rem; padding: 12px; border: 2px solid var(--bord); border-radius: 10px; background: #fff; cursor: pointer; }
.choix.choisi { border-color: var(--accent); background: #eaf1ff; }
.lettre { display: inline-grid; place-items: center; min-width: 1.8em; height: 1.8em; border-radius: 6px; background: #1f2328; color: #fff; font-weight: 700; font-size: 0.9rem; }
.saisie { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.champ-reponse { flex: 1; min-width: 0; font-size: 1.2rem; }
.unite { color: var(--doux); font-weight: 600; }
.attendu { font-size: 1.1rem; }
.explication { background: #f4f1e8; border-left: 4px solid #c7b98a; padding: 8px 12px; border-radius: 4px; }
.rang { font-weight: 600; text-align: center; }
.hors-ligne { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: #1f2328; color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 0.9rem; z-index: 10; }

/* --- professeur ------------------------------------------------------- */
.page-prof #ecran-partie { max-width: none; padding: 0; height: 100vh; display: flex; flex-direction: column; }
.bandeau-prof { padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--bord); }
.info-rejoindre { font-weight: 400; }
.info-rejoindre .code { font-size: 1.2rem; letter-spacing: 0.1em; }
.page-prof .pastille { background: var(--accent); }
.scene { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 34%); min-height: 0; }
body[data-etat="attente"] .scene { grid-template-columns: minmax(0, 1fr) minmax(420px, 42%); }
.course { overflow-y: auto; min-height: 0; background: linear-gradient(#eef5ff, #fbfaf6); }
.course canvas { width: 100%; display: block; }
.panneau { overflow-y: auto; padding: 16px 18px; background: #fff; border-left: 1px solid var(--bord); display: flex; flex-direction: column; gap: 10px; }
.panneau .enonce-texte { font-size: 1.35rem; }
.panneau .question, .panneau .enonce { margin: 0; }
.panneau pre.code { white-space: pre-wrap; } /* écran projeté : pas de défilement horizontal */
.qr { width: min(260px, 70%); align-self: center; image-rendering: pixelated; }
.url { text-align: center; font-size: 1.3rem; margin: 0; }
.code-geant { text-align: center; font-size: 3.4rem; font-weight: 800; letter-spacing: 0.15em; margin: 0; }
.joueurs { display: flex; flex-wrap: wrap; gap: 6px; }
.joueur { font: inherit; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--bord); background: #fff; cursor: pointer; }
.joueur.deconnecte { opacity: 0.45; }
.chrono { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.chrono.urgent { color: var(--faux); }
.choix-prof { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 1.15rem; }
.choix-prof li { display: flex; gap: 10px; align-items: center; }
.compte-reponses { font-size: 1.2rem; font-weight: 700; }
.taux { font-size: 1.2rem; font-weight: 700; }
.repartition { display: grid; gap: 6px; }
.barre-choix { display: grid; grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 1fr) 2.2em; gap: 8px; align-items: center; }
.barre-choix .libelle { overflow: hidden; text-overflow: ellipsis; }
.barre-choix.bonne .lettre { background: var(--juste); }
.barre-choix.bonne .libelle { font-weight: 700; color: var(--juste); }
.jauge { height: 14px; background: #eeebe3; border-radius: 7px; overflow: hidden; display: block; }
.jauge span { display: block; height: 100%; background: #9aa4b2; }
.barre-choix.bonne .jauge span { background: var(--juste); }
.nombre, .pts { font-variant-numeric: tabular-nums; text-align: right; }
.top { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; font-size: 1.1rem; }
.top li .pts { float: right; }
.equipes-scores { display: grid; gap: 6px; }
.barre-equipe { display: grid; grid-template-columns: 8em minmax(0, 1fr) 4.5em; gap: 8px; align-items: center; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 8px; height: 230px; text-align: center; }
.marche { background: #eef1f6; border-radius: 10px 10px 0 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 4px; }
.marche-emoji { font-size: 2.6rem; }
.place { font-size: 1.6rem; font-weight: 800; color: var(--doux); }
table.capacites { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.capacites th, .capacites td { text-align: left; padding: 6px; border-bottom: 1px solid #eee; vertical-align: top; }
.capacites td:nth-child(n+2) { text-align: right; white-space: nowrap; }
.capacites tr.faible td:last-child { color: var(--faux); font-weight: 700; }
.liste-fichiers { display: grid; gap: 6px; }
.fichier { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.fichier small { display: block; color: var(--doux); }
.fichier.en-erreur pre { white-space: pre-wrap; color: var(--faux); font-size: 0.85rem; margin: 4px 0; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { font-weight: 400 !important; padding: 4px 10px; border: 1px solid var(--bord); border-radius: 999px; }

@media (max-width: 900px) {
  .scene, body[data-etat="attente"] .scene { grid-template-columns: 1fr; grid-template-rows: 45vh auto; }
}

.pied { text-align: center; margin: 0; }
