/* style.css — les trois rôles. Charte du client par variables CSS (commun.js),
 * typographie Geologica (titres) et Onest (texte). Fond clair, aplats, ombres douces. */
:root {
  --principale: #1644fb;
  --accent: #0b0b0b;
  --fond: #ffffff;
  --gris: #6b7280;
  --gris-clair: #eef0f4;
  --ligne: #e3e6ec;
  --ok: #0b8a4a;
  --alerte: #c2410c;
  --ombre: 0 10px 30px rgba(11, 11, 11, .06);
  --rayon: 14px;
  --titre: 'Geologica', system-ui, sans-serif;
  --texte: 'Onest', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--accent); font-family: var(--texte); font-size: 16px; line-height: 1.45; }
h1, h2, h3 { font-family: var(--titre); margin: 0; letter-spacing: -.01em; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
.logo { height: 28px; width: auto; }
.sur-titre { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--principale); }
.aide { color: var(--gris); font-size: .9rem; margin: .4rem 0; }
.vide { color: var(--gris); font-style: normal; }
.pastille { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--tuile, var(--principale)); margin-right: .45em; vertical-align: middle; }

/* ── boutons ── */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: .4em; border: 0; border-radius: 12px; background: var(--principale); color: #fff; font-weight: 600; padding: .8em 1.2em; min-height: 48px; transition: transform .08s ease, opacity .15s; }
.bouton:active { transform: scale(.98); }
.bouton:disabled { opacity: .45; cursor: default; }
.bouton.grand { width: 100%; font-size: 1.1rem; min-height: 56px; }
.bouton.secondaire { background: var(--gris-clair); color: var(--accent); }
.bouton.vers-ecran { background: var(--accent); color: #fff; }
.discret, .bouton.discret { background: transparent; border: 1px solid var(--ligne); color: var(--gris); border-radius: 10px; padding: .5em .8em; min-height: 40px; font-weight: 500; }
.rangee { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .6rem 0; }
.rangee .bouton { flex: 1 1 auto; }
.champ, input[type=text], input[type=number], select { width: 100%; border: 1.5px solid var(--ligne); border-radius: 12px; padding: .75em .9em; min-height: 48px; background: #fff; color: var(--accent); }
input:focus, select:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--principale) 35%, transparent); outline-offset: 1px; }
.champ-ligne { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.champ-ligne input { width: 5.5rem; }

/* ── connexion, toast, file ── */
.connexion { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #c8ccd4; flex: none; }
.connexion.mode-flux { background: var(--ok); }
.connexion.mode-sondage { background: #d9a400; }
.connexion.mode-ferme { background: var(--alerte); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--accent); color: #fff; padding: .7em 1.1em; border-radius: 12px; font-weight: 500; box-shadow: var(--ombre); max-width: calc(100vw - 32px); z-index: 30; }
.toast.ton-alerte { background: var(--alerte); }
.file { position: fixed; right: 12px; bottom: 12px; background: #fff; border: 1px solid var(--ligne); color: var(--gris); font-size: .8rem; padding: .35em .7em; border-radius: 999px; box-shadow: var(--ombre); z-index: 20; }

/* ── formulaire du code ── */
.code { position: fixed; inset: 0; background: var(--fond); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; }
.code-boite { width: min(420px, 100%); background: #fff; border-radius: 20px; box-shadow: var(--ombre); padding: 32px; text-align: center; font-size: 16px; }
.code-boite .logo { height: 34px; margin-bottom: 16px; }
.code-boite h1 { font-size: 1.6rem; margin-bottom: .3rem; }
.code-boite p { color: var(--gris); margin: 0 0 1rem; }
.code-boite input { text-align: center; font-size: 1.8rem; letter-spacing: .3em; font-family: var(--titre); margin-bottom: 12px; }
.code-boite .message { color: var(--alerte); min-height: 1.4em; margin-top: .8rem; }

/* ── téléphones (pilote, participant) ── */
.tel-entete { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--ligne); }
.tel-entete .entete-texte { flex: 1; min-width: 0; }
.entete-programme { font-family: var(--titre); font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete-sous { font-size: .78rem; color: var(--gris); display: flex; gap: .5em; align-items: center; }
.equipe-badge { display: inline-block; padding: .1em .6em; border-radius: 999px; background: var(--tuile, var(--principale)); color: #fff; font-weight: 600; font-size: .75rem; }
.tel-corps { padding: 16px; padding-bottom: max(32px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; max-width: 640px; margin: 0 auto; }
.carte { background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre); border: 1px solid var(--ligne); padding: 18px; }
.carte-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.carte-titre { font-size: 1.35rem; line-height: 1.2; margin-bottom: 10px; }
.badge { font-size: .75rem; font-weight: 600; padding: .2em .7em; border-radius: 999px; background: var(--gris-clair); color: var(--gris); white-space: nowrap; }
.badge.ok, .badge.phase-jeu { background: color-mix(in srgb, var(--ok) 14%, #fff); color: var(--ok); }
.badge.attente, .badge.phase-verrouillee { background: #fff3cd; color: #8a6100; }
.badge.phase-revelation { background: color-mix(in srgb, var(--principale) 12%, #fff); color: var(--principale); }
.blocs { display: flex; flex-direction: column; gap: 14px; }
.commandes { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.commandes:empty { display: none; }
.debrief { margin-top: 14px; border-top: 1px solid var(--ligne); padding-top: 10px; color: var(--gris); font-size: .92rem; }
.debrief summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.debrief p { margin: .5rem 0 0; white-space: pre-line; }
.ligne-info { color: var(--gris); font-size: .9rem; }
.equipes { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.equipe-jeton { display: inline-flex; align-items: center; padding: .3em .8em; border-radius: 999px; background: var(--gris-clair); font-size: .85rem; font-weight: 500; }
.participants { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.participant { display: grid; grid-template-columns: 2.4rem 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--ligne); }
.participant.absent .participant-nom { color: var(--gris); }
.participant-carte { font-family: var(--titre); font-weight: 700; color: var(--principale); }
.participant-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant select { width: auto; min-width: 8rem; min-height: 40px; padding: .4em .6em; }
.sequences { display: flex; flex-direction: column; }
.sequence-ligne { display: grid; grid-template-columns: 2rem 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--ligne); }
.sequence-ligne.courante .sequence-nom > span { color: var(--principale); font-weight: 600; }
.sequence-index { font-family: var(--titre); font-weight: 700; color: var(--gris); }
.sequence-nom { display: flex; flex-direction: column; }
.sequence-nom small { color: var(--gris); }

/* ── blocs ── */
.bloc-titre { font-size: 1.3rem; }
.bloc-texte { margin: 0; }
.bloc-texte.ton-accent { font-weight: 600; font-size: 1.05rem; }
.bloc-attente, .sequence-attente { display: flex; align-items: center; gap: .6em; color: var(--gris); }
.point { width: .6em; height: .6em; border-radius: 50%; background: var(--principale); animation: pulser 1.6s ease-in-out infinite; flex: none; }
@keyframes pulser { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.05); } }
.bloc-etat { padding: .8em 1em; border-radius: 12px; background: var(--gris-clair); font-weight: 500; }
.bloc-etat.ton-ok { background: color-mix(in srgb, var(--ok) 12%, #fff); color: var(--ok); }
.bloc-etat.ton-alerte { background: color-mix(in srgb, var(--alerte) 12%, #fff); color: var(--alerte); }
.bloc-compteur { display: flex; align-items: baseline; gap: .6em; }
.compteur-valeur { font-family: var(--titre); font-weight: 700; font-size: 2rem; line-height: 1; }
.compteur-total { color: var(--gris); font-size: 1.1rem; font-weight: 500; }
.compteur-libelle { color: var(--gris); }
.chrono { display: flex; flex-direction: column; gap: .4em; }
.chrono-temps { font-family: var(--titre); font-weight: 700; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.chrono.presque .chrono-temps { color: var(--alerte); }
.chrono.ecoule .chrono-temps { color: var(--gris); font-size: 1.2rem; }
.chrono-piste { height: 6px; border-radius: 3px; background: var(--gris-clair); overflow: hidden; }
.chrono-barre { height: 100%; background: var(--principale); transform-origin: left; transition: transform .25s linear; }
.chrono.presque .chrono-barre { background: var(--alerte); }
.bloc-soustitre { font-size: 1.05rem; margin-bottom: .5rem; }
.barre-ligne, .jauge-ligne { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'libelle valeur' 'piste piste'; gap: .2em .8em; align-items: center; padding: .35em 0; }
.barre-ligne .barre-rang { grid-area: rang; }
.barre-ligne:has(.barre-rang) { grid-template-columns: 1.6em 1fr auto; grid-template-areas: 'rang libelle valeur' 'rang piste piste'; }
.barre-rang { font-family: var(--titre); font-weight: 700; color: var(--gris); }
.barre-libelle, .jauge-libelle { grid-area: libelle; display: flex; flex-direction: column; min-width: 0; }
.barre-libelle > span, .jauge-libelle > span { overflow: hidden; text-overflow: ellipsis; }
.barre-sous, .liste-sous { color: var(--gris); font-size: .82rem; }
.barre-piste, .jauge-piste { grid-area: piste; height: 10px; border-radius: 5px; background: var(--gris-clair); overflow: hidden; }
.barre-fond, .jauge-fond { height: 100%; border-radius: 5px; background: var(--principale); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.jauge-ligne:not(.accent) .jauge-fond { background: #b8bec9; }
.barre-valeur, .jauge-valeur { grid-area: valeur; font-family: var(--titre); font-weight: 700; font-variant-numeric: tabular-nums; }
.jauge-ecart { margin-left: .5em; font-family: var(--texte); font-weight: 600; font-size: .85em; }
.jauge-ecart.plus { color: var(--ok); }
.jauge-ecart.moins { color: var(--alerte); }
.jauge-ecart.egal { color: var(--gris); }
.bloc-liste ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35em; }
.bloc-liste li { display: flex; align-items: baseline; gap: .5em; padding: .45em .7em; background: var(--gris-clair); border-radius: 10px; flex-wrap: wrap; }
.liste-numero { font-family: var(--titre); font-weight: 700; color: var(--principale); min-width: 1.4em; }
.liste-texte { flex: 1 1 auto; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tuile { border-radius: 12px; padding: .7em .8em; background: var(--gris-clair); border-left: 5px solid var(--tuile, var(--principale)); }
.tuile.etat-fait { background: color-mix(in srgb, var(--tuile, var(--principale)) 16%, #fff); }
.tuile-texte { font-weight: 600; }
.tuile-sous { color: var(--gris); font-size: .85rem; }
.bloc-tableau table { width: 100%; border-collapse: collapse; }
.bloc-tableau th, .bloc-tableau td { text-align: left; padding: .4em .5em; border-bottom: 1px solid var(--ligne); }
.question { font-weight: 600; margin-bottom: .6em; }
.bloc-choix { display: flex; flex-direction: column; gap: 8px; }
.option { text-align: left; border: 1.5px solid var(--ligne); background: #fff; color: var(--accent); border-radius: 12px; padding: .8em 1em; min-height: 52px; font-weight: 500; transition: border-color .12s, background .12s; }
.option.choisi { border-color: var(--principale); background: color-mix(in srgb, var(--principale) 10%, #fff); color: var(--principale); font-weight: 600; }
.echelle { display: flex; gap: 6px; }
.echelon { flex: 1; min-width: 0; min-height: 52px; border: 1.5px solid var(--ligne); background: #fff; border-radius: 10px; font-family: var(--titre); font-weight: 600; font-size: 1.05rem; color: var(--accent); padding: 0; }
.echelon.choisi { background: var(--principale); border-color: var(--principale); color: #fff; }
.echelle-libelles { display: flex; justify-content: space-between; color: var(--gris); font-size: .8rem; margin-top: .4em; }
.bloc-saisie .aide { text-align: right; margin: .2rem 0 .4rem; font-size: .8rem; }
.bloc-saisie.fait .champ { border-color: color-mix(in srgb, var(--ok) 50%, var(--ligne)); }
.bloc-saisie .rangee { margin: 0; }

/* ── écran projeté ── */
html.ecran { font-size: min(1vw, 1.6vh); }
.role-ecran { overflow: hidden; height: 100vh; font-size: 2rem; }
.role-ecran .scene { position: relative; display: flex; flex-direction: column; height: 100vh; padding: 3rem 5rem 2rem; gap: 2rem; }
.ecran-entete { display: flex; align-items: center; gap: 2rem; }
.ecran-entete .logo { height: 4.2rem; }
.ecran-entete .entete-texte { display: flex; flex-direction: column; }
.ecran-entete .entete-programme { font-family: var(--titre); font-weight: 600; font-size: 2rem; }
.ecran-entete .entete-sequence { color: var(--gris); font-size: 1.6rem; }
.ecran-corps { flex: 1; min-height: 0; display: flex; gap: 5rem; }
.ecran-pied { display: flex; justify-content: space-between; align-items: center; color: var(--gris); font-size: 1.5rem; }
.ecran-pied .pied-outils { display: flex; align-items: center; gap: 1.5rem; }
.ecran-pied .discret { font-size: 1.4rem; padding: .3em .8em; min-height: 0; }
.ecran-pied .connexion { width: 1rem; height: 1rem; }
.role-ecran .sur-titre { font-size: 1.7rem; }
.accueil-gauche { flex: 0 0 38rem; display: flex; flex-direction: column; justify-content: center; gap: 1.6rem; }
.accueil-titre { font-size: 6.4rem; line-height: 1.02; letter-spacing: -.025em; }
.accueil-texte { font-size: 2.2rem; color: var(--gris); margin: 0; max-width: 34rem; }
.accueil-compte { display: flex; align-items: baseline; gap: 1rem; margin-top: 1rem; }
.compte-n { font-family: var(--titre); font-weight: 700; font-size: 6rem; line-height: 1; color: var(--principale); }
.compte-libelle { font-size: 2rem; color: var(--gris); }
.accueil-page { font-size: 1.6rem; color: var(--gris); }
.cartes { flex: 1; display: grid; grid-template-columns: repeat(var(--colonnes, 4), 1fr); gap: 1.6rem; align-content: center; }
.carte-qr { background: #fff; border: 1px solid var(--ligne); border-radius: 1.4rem; box-shadow: var(--ombre); padding: 1.2rem; display: flex; flex-direction: column; gap: .8rem; position: relative; }
.carte-qr .qr svg { width: 100%; height: auto; display: block; }
.carte-qr .qr { position: relative; }
.carte-qr.arrivee .qr { opacity: .12; }
.carte-qr.arrivee::after { content: ''; position: absolute; left: 50%; top: 42%; width: 3.6rem; height: 1.8rem; border-left: .6rem solid var(--principale); border-bottom: .6rem solid var(--principale); transform: translate(-50%, -60%) rotate(-45deg); }
.carte-pied { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.carte-numero { font-family: var(--titre); font-weight: 700; font-size: 2.4rem; color: var(--principale); }
.carte-nom { font-size: 1.6rem; color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ecran-corps.sequence { flex-direction: column; gap: 3rem; }
.sequence-tete { display: flex; flex-direction: column; gap: .8rem; }
.sequence-titre { font-size: 5.6rem; line-height: 1.05; letter-spacing: -.025em; max-width: 80rem; }
.ecran-corps .module { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2.4rem; overflow: hidden; transform-origin: 0 0; }
.ecran-corps .module.dense { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 5rem; align-content: start; }
.ecran-corps .module.dense > .bloc-liste { grid-column: 1 / -1; }
.role-ecran .bloc-texte { font-size: 2.6rem; max-width: 80rem; }
.role-ecran .bloc-texte.ton-accent { font-size: 3.4rem; font-weight: 600; }
.role-ecran .bloc-compteur { gap: 1.2rem; }
.role-ecran .compteur-valeur { font-size: 8rem; color: var(--principale); }
.role-ecran .compteur-total { font-size: 3.2rem; }
.role-ecran .compteur-libelle { font-size: 2.2rem; }
.role-ecran .chrono { max-width: 60rem; }
.role-ecran .chrono-temps { font-size: 6rem; }
.role-ecran .chrono.ecoule .chrono-temps { font-size: 4rem; }
.role-ecran .chrono-piste { height: 1.2rem; border-radius: .6rem; }
.role-ecran .bloc-soustitre { font-size: 2.6rem; margin-bottom: 1rem; }
.role-ecran .bloc-barres, .role-ecran .bloc-jauges { display: flex; flex-direction: column; gap: .6rem; }
.role-ecran .barre-ligne, .role-ecran .jauge-ligne { font-size: 2.2rem; gap: .4rem 2rem; padding: .5rem 0; }
.role-ecran .barre-piste, .role-ecran .jauge-piste { height: 1.8rem; border-radius: .9rem; }
.role-ecran .barre-fond, .role-ecran .jauge-fond { border-radius: .9rem; }
.role-ecran .barre-valeur, .role-ecran .jauge-valeur { font-size: 3rem; }
.role-ecran .barre-sous, .role-ecran .liste-sous { font-size: 1.6rem; }
.role-ecran .barre-rang { font-size: 2.6rem; }
.role-ecran .bloc-liste ul { gap: 1rem; display: grid; grid-template-columns: repeat(2, 1fr); }
.role-ecran .bloc-liste li { font-size: 2.3rem; padding: 1rem 1.6rem; border-radius: 1.2rem; }
.role-ecran .liste-numero { min-width: 2em; }
.role-ecran .grille { grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: 1.6rem; }
.role-ecran .tuile { padding: 1.6rem 2rem; border-radius: 1.4rem; border-left-width: .8rem; }
.role-ecran .tuile-texte { font-size: 2.6rem; }
.role-ecran .tuile-sous { font-size: 2rem; }
.role-ecran .bloc-attente, .role-ecran .sequence-attente { font-size: 2rem; }
.role-ecran .bloc-etat { font-size: 2.2rem; }
.ecran-corps.fin { flex-direction: column; justify-content: center; gap: 1.6rem; }
.fin-titre { font-size: 12rem; line-height: 1; letter-spacing: -.03em; color: var(--principale); }
.fin-texte { font-size: 2.6rem; color: var(--gris); margin: 0; }

/* ── cinématiques ── */
.cine { position: fixed; inset: 0; z-index: 25; background: var(--fond); opacity: 1; transition: opacity .4s ease; }
.cine.sortie { opacity: 0; }
.cine-scene { position: absolute; inset: 0; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .point { animation: none; opacity: 1; }
  .barre-fond, .jauge-fond, .chrono-barre { transition: none; }
}
@media (max-width: 480px) {
  .participant { grid-template-columns: 2rem 1fr; }
  .participant select, .participant .discret { grid-column: span 1; }
}
