/* Styles communs (tous les écrans) puis écrans observateurs E0 à E4. Valeurs : maquette/. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--police);
  color: var(--texte);
  background: var(--nuit-900);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--lueur-clair); }
:focus-visible { outline: 3px solid var(--lueur); outline-offset: 3px; }
[hidden] { display: none !important; }

.ic { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.chiffres { font-variant-numeric: tabular-nums; }

.ecran {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--fond);
}
@media (orientation: portrait) { .ecran { background: var(--fond-portrait); } }

/* En-tête : bouton à gauche, titre au centre, logo à droite */
.entete {
  position: relative;
  min-height: 112px;
  padding: 24px 32px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--nuit-600);
}
.entete h1 {
  margin: 0;
  text-align: center;
  font-family: var(--police-cond);
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.entete .logo { justify-self: end; height: 64px; width: auto; display: block; }
@media (orientation: portrait) { .entete { padding: 24px; } }

.btn-retour {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--cible);
  padding: 0 20px 0 12px;
  border-radius: 16px;
  border: 2px solid var(--nuit-500);
  background: transparent;
  color: var(--texte);
  text-decoration: none;
  font-size: 22px;
  font-weight: 600;
}
.btn-retour .ic { width: 28px; height: 28px; }

.credits { margin: 0; font-size: 18px; font-weight: 500; color: var(--texte-2); text-align: center; }
.credits b { color: var(--texte); font-weight: 600; }
.pied { min-height: 56px; padding: 8px 24px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }

.filigrane { position: absolute; pointer-events: none; transform: scaleX(-1); opacity: .18; }

.mesh { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mesh polygon { stroke: rgba(69, 212, 255, .38); stroke-width: 1; }
.m1 { fill: rgba(69, 212, 255, .04); } .m2 { fill: rgba(69, 212, 255, .09); } .m3 { fill: rgba(69, 212, 255, .16); }
.mesh .node { fill: var(--lueur-clair); }

/* Pastille de groupe numérotée */
.disque {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: var(--r-pill);
  border: 2px solid rgba(10, 23, 48, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--police-cond);
  font-weight: 800;
  font-size: 36px;
  color: var(--encre);
}

/* Dialogue de confirmation (E2 « déjà noté », E7 « effacer ») */
.voile {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 12, 26, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialogue {
  width: min(680px, 100%);
  padding: 40px;
  border-radius: var(--r-xl);
  background: var(--clair);
  color: var(--encre);
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}
.dialogue h2 { margin: 0; font-size: clamp(30px, 3.2vw, 40px); font-weight: 800; line-height: 1.1; }
.dialogue p { margin: 0; font-size: 24px; line-height: 1.4; color: #1E2D47; }
.dialogue .tete { display: flex; align-items: center; gap: 18px; }
.dialogue .rond { flex: none; width: 72px; height: 72px; border-radius: var(--r-pill); display: flex; align-items: center; justify-content: center; }
.dialogue .rond .ic { width: 38px; height: 38px; }
.dialogue .choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 8px; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 72px;
  padding: 0 24px;
  border-radius: var(--r-m);
  font-size: 26px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  text-align: center;
}
.btn .ic { width: 30px; height: 30px; }
.btn-encre { background: transparent; color: var(--encre); border: 2px solid var(--encre); }
.btn-plein { background: var(--lueur); color: var(--encre); }
.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-contour { background: transparent; color: var(--texte); border: 2px solid var(--lueur-clair); }
.btn-effacer { background: transparent; color: var(--erreur-sombre); border: 2px solid var(--erreur-sombre); }
.btn[disabled] { opacity: .55; cursor: default; }

/* ===================== E0 Accueil ===================== */
.e0 { justify-content: center; }
.e0 .halo {
  position: absolute; right: 38px; top: 50%; width: 540px; height: 540px; transform: translateY(-50%);
  border-radius: var(--r-pill);
  background: radial-gradient(circle, rgba(69, 212, 255, .24) 0%, rgba(69, 212, 255, .07) 45%, rgba(69, 212, 255, 0) 70%);
}
.e0 .joueur { position: absolute; right: 32px; top: 50%; height: min(500px, 70vh); width: auto; transform: translateY(-50%) scaleX(-1); }
.e0 main { position: relative; padding: 64px 96px; display: flex; flex-direction: column; align-items: flex-start; gap: 32px; max-width: 60%; }
.e0 h1 { margin: 0; font-family: var(--police-cond); font-size: clamp(64px, 7.5vw, 96px); line-height: .95; letter-spacing: .01em; text-transform: uppercase; }
.e0 h1 span { display: block; }
.e0 h1 .l1 { font-weight: 300; }
.e0 h1 .l2 { font-weight: 800; }
.e0 .trait { width: 160px; height: 3px; border-radius: 2px; background: var(--lueur); box-shadow: 0 0 16px rgba(69, 212, 255, .7); margin-top: 16px; }
.e0 nav { width: min(560px, 100%); display: flex; flex-direction: column; gap: 16px; }
.e0 .principal, .e0 .secondaire {
  display: flex; align-items: center; gap: 16px; border-radius: 20px; text-decoration: none;
}
.e0 .principal {
  min-height: 112px; padding: 0 40px; background: var(--lueur); color: var(--encre); font-size: 34px; font-weight: 700;
  box-shadow: 0 0 0 1px rgba(155, 230, 255, .6), 0 12px 40px rgba(69, 212, 255, .25);
}
.e0 .principal .ic { width: 40px; height: 40px; }
.e0 .secondaire {
  min-height: 96px; padding: 0 36px; border: 2px solid var(--lueur-clair); background: rgba(10, 30, 61, .6); color: var(--texte); font-size: 28px; font-weight: 600;
}
.e0 .secondaire .ic { width: 34px; height: 34px; }
.e0 .tertiaire {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 36px; border-radius: 20px; text-decoration: none;
  color: var(--texte); font-size: 24px; font-weight: 600; border: 2px solid var(--nuit-500);
}
.e0 .tertiaire .ic { width: 30px; height: 30px; }
@media (orientation: landscape) and (max-height: 820px) {
  .e0 main { padding: 32px 96px; gap: 24px; }
  .e0 .principal { min-height: 96px; }
  .e0 .secondaire { min-height: 80px; }
}
.e0 .createurs { display: flex; flex-direction: column; gap: 6px; }
.e0 .createurs .etiq { font-size: 18px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--texte-2); }
.e0 .createurs .noms { font-size: 30px; font-weight: 600; }
@media (orientation: portrait) {
  .e0 { justify-content: flex-start; }
  .e0 .halo { right: 50%; top: 4vh; width: 420px; height: 420px; transform: translateX(50%); }
  .e0 .joueur { position: relative; right: auto; top: auto; height: min(380px, 32vh); transform: scaleX(-1); align-self: center; margin-top: 6vh; }
  .e0 main { max-width: none; padding: 40px 48px 64px; }
  .e0 nav { width: 100%; }
}

/* ===================== E1 Choix du groupe ===================== */
.e1 main {
  flex: 1;
  padding: 28px 32px 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(140px, 1fr);
  gap: 24px;
}
@media (orientation: portrait) { .e1 main { grid-template-columns: 1fr; padding: 32px 24px 8px; grid-auto-rows: minmax(120px, 1fr); } }
.groupe-btn {
  display: flex; align-items: center; gap: 28px; padding: 0 32px; border: none; border-radius: var(--r-l);
  background: var(--clair); color: var(--encre); text-align: left;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 10px 30px rgba(0, 0, 0, .35);
}
.groupe-btn .disque { width: 112px; height: 112px; font-size: 64px; box-shadow: 0 0 0 6px var(--clair), 0 0 0 8px rgba(10, 23, 48, .18); }
.groupe-btn .txt { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.groupe-btn .nom { font-size: clamp(32px, 3.4vw, 44px); font-weight: 700; line-height: 1; }
.groupe-btn .detail { font-size: 22px; font-weight: 500; color: var(--encre-2); }
.groupe-btn .ic { width: 36px; height: 36px; color: var(--encre-2); }

.e1-vide main { flex: 1; padding: 48px 64px 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 36px; text-align: center; position: relative; }
.e1-vide .cercle {
  width: 168px; height: 168px; border-radius: var(--r-pill); border: 3px solid var(--lueur); color: var(--lueur-clair);
  box-shadow: 0 0 28px rgba(69, 212, 255, .35), inset 0 0 22px rgba(69, 212, 255, .2);
  display: flex; align-items: center; justify-content: center;
}
.e1-vide .cercle .ic { width: 80px; height: 80px; stroke-width: 1.8; }
.e1-vide .msg1 { margin: 0; font-size: 44px; font-weight: 700; line-height: 1.15; }
.e1-vide .msg2 { margin: 0; font-size: 28px; font-weight: 500; line-height: 1.35; color: var(--texte-2); }

.pret {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; border-radius: var(--r-pill);
  font-size: 20px; font-weight: 700; border: 2px solid var(--en-ligne); color: var(--en-ligne);
}
.pret .ic { width: 24px; height: 24px; stroke-width: 3; }
.pret.pas-pret { border: 2px dashed var(--texte-2); color: var(--texte-2); font-weight: 600; }
.lien-discret {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--cible); padding: 0 16px; border: none; background: transparent; color: var(--texte-2);
  font-size: 18px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px;
}
.pied-e1 { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 24px; }

/* ===================== E2 Joueurs du groupe ===================== */
.e2 header {
  min-height: 96px;
  padding: 16px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  border-bottom: 1px solid var(--nuit-600);
}
.e2 .gauche { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.e2 .gauche .logo { height: 64px; width: auto; display: block; }
.e2 .sep { width: 1px; height: 48px; background: var(--nuit-500); }
.e2 h1 { margin: 0; font-size: 36px; font-weight: 700; }
.e2 .changer { display: inline-flex; align-items: center; gap: 8px; min-height: var(--cible); padding: 0 14px; border: none; background: transparent; font-size: 20px; font-weight: 600; color: var(--lueur-clair); text-decoration: underline; text-underline-offset: 4px; }
.e2 .changer .ic { width: 24px; height: 24px; }
.connexion { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; border-radius: var(--r-pill); font-size: 20px; font-weight: 700; }
.connexion .ic { width: 26px; height: 26px; }
.connexion.en-ligne { border: 2px solid var(--en-ligne); color: var(--en-ligne); }
.connexion.hors-ligne { background: var(--hors-ligne); color: var(--encre); border-radius: 16px; min-height: 64px; padding: 6px 20px; font-size: 22px; line-height: 1.2; }
.connexion.hors-ligne small { display: block; font-size: 18px; font-weight: 600; }
@media (orientation: portrait) {
  .e2 header { padding: 16px 24px; border-bottom: none; }
  .e2 .connexion.hors-ligne { order: 3; flex-basis: 100%; }
}

.e2 main { flex: 1; padding: 20px 32px 132px; display: flex; flex-direction: column; gap: 12px; }
@media (orientation: portrait) { .e2 main { padding: 28px 24px 132px; } }
.tlab { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--texte-2); }
.e2 .tlab + .rangee + .tlab { margin-top: 12px; }
.rangee { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
@media (orientation: portrait) { .rangee { gap: 16px; } }

.joueur-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 168px; padding: 20px 20px 20px 28px; border: none; border-radius: var(--r-l);
  background: var(--clair); color: var(--encre); text-align: left; box-shadow: var(--ombre-clair);
}
.joueur-btn > *, .groupe-btn > * { pointer-events: none; }
.joueur-btn .infos { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.joueur-btn .nom { font-size: clamp(30px, 3.1vw, 40px); font-weight: 700; line-height: 1; overflow-wrap: anywhere; }
.joueur-btn .compte { font-size: 20px; font-weight: 500; color: var(--encre-2); }
.joueur-btn .compte b { font-size: 30px; font-weight: 700; color: var(--encre); font-variant-numeric: tabular-nums; }
.joueur-btn .dernier { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.puce { width: 88px; height: 88px; border-radius: var(--r-m); display: flex; align-items: center; justify-content: center; font-size: 52px; font-weight: 700; color: var(--encre); font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 2px rgba(10, 23, 48, .25); }
.puce.aucune { background: transparent; border: 2px dashed #8193AD; box-shadow: none; color: var(--encre-2); font-size: 40px; }
.joueur-btn .lastlab { font-size: 18px; font-weight: 500; color: var(--encre-2); }
.joueur-btn .note-il-y-a { display: inline-flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 600; color: var(--texte); }
.joueur-btn .note-il-y-a .ic { width: 22px; height: 22px; }
.joueur-btn.recent { background: var(--note-recente); color: var(--note-recente-texte); border: 2px dashed var(--note-recente-bord); box-shadow: none; }
.joueur-btn.recent .compte, .joueur-btn.recent .lastlab { color: var(--note-recente-texte); }
.joueur-btn.recent .compte b { color: var(--texte); }
@media (orientation: portrait) {
  .joueur-btn { flex-direction: column; align-items: stretch; min-height: 300px; padding: 24px 20px 20px 24px; }
  .joueur-btn .nom { font-size: clamp(28px, 4.8vw, 38px); }
  .joueur-btn .dernier { flex-direction: row-reverse; justify-content: space-between; align-items: center; }
  .puce { width: 84px; height: 84px; font-size: 50px; }
}

.bandeau {
  position: fixed; left: 32px; right: 32px; bottom: 20px; z-index: 20; min-height: 88px;
  padding: 0 12px 0 28px; border-radius: 20px; background: var(--bandeau); color: var(--encre);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.bandeau .quoi { display: inline-flex; align-items: center; gap: 16px; font-size: 30px; font-weight: 700; }
.bandeau .quoi .ic { width: 34px; height: 34px; color: var(--succes); stroke-width: 3; }
.bandeau button {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--cible); min-width: 180px; justify-content: center;
  padding: 0 24px; border-radius: var(--r-s); border: 2px solid var(--encre); background: #FFFFFF; color: var(--encre); font-size: 24px; font-weight: 700;
}
.bandeau button .ic { width: 26px; height: 26px; }
@media (orientation: portrait) { .bandeau { left: 24px; right: 24px; } }

/* ===================== E3 Échelle d'effort ===================== */
.e3 .entete h1 { font-family: var(--police); text-transform: none; letter-spacing: 0; font-size: clamp(30px, 3.1vw, 40px); font-weight: 500; white-space: nowrap; }
.e3 .entete h1 b { font-weight: 800; font-size: 1.2em; }
.e3 main { flex: 1; padding: 36px 32px; display: flex; align-items: center; justify-content: center; }
/* Paysage : une seule rangée. Portrait : coupure avant la zone (maquette, Echelle.dc.html). */
.echelle { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.echelle .ligne { display: contents; }
.valeur {
  flex: 0 1 96px; min-width: 64px; height: min(320px, calc(100vh - 112px - 96px));
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 20px 6px 16px; border: none; border-radius: var(--r-m); color: var(--encre);
  box-shadow: inset 0 0 0 2px rgba(10, 23, 48, .22), 0 8px 22px rgba(0, 0, 0, .35);
}
.valeur > * { pointer-events: none; }
.valeur:active { transform: scale(.96); }
.valeur .num { font-size: 64px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.valeur .visage { width: 64px; height: 64px; }
.visage circle, .visage path { fill: none; stroke: var(--encre); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.valeur .lab { font-size: 18px; font-weight: 600; line-height: 1.15; text-align: center; min-height: 42px; display: flex; align-items: flex-end; }
.zone { position: relative; display: flex; gap: 12px; padding: 10px; border: 3px solid var(--lueur); border-radius: var(--r-xl); box-shadow: var(--lueur-zone); }
.ztag {
  position: absolute; top: -21px; left: 50%; transform: translateX(-50%); background: var(--lueur); color: var(--encre);
  font-size: 18px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 7px 16px; border-radius: var(--r-pill); white-space: nowrap;
}
@media (orientation: landscape) and (max-height: 640px) {
  .valeur .num { font-size: 52px; }
  .valeur .visage { width: 52px; height: 52px; }
  .e3 main { padding: 28px 16px; }
}
@media (orientation: landscape) and (max-width: 1100px) {
  .valeur .lab { font-size: 15px; }
  .echelle, .zone { gap: 8px; }
}
@media (orientation: portrait) {
  .e3 main { padding: 40px 24px 64px; }
  .echelle { flex-direction: column; align-items: stretch; gap: 56px; }
  .echelle .ligne { display: flex; align-items: center; gap: 12px; }
  .valeur { flex: 1 1 0; min-width: 0; height: min(340px, calc((100vh - 112px - 200px) / 2)); padding: 24px 6px 18px; border-radius: 20px; }
  .valeur .num { font-size: 72px; }
  .valeur .visage { width: 72px; height: 72px; }
  .valeur .lab { font-size: 20px; min-height: 46px; }
  .zone { flex: var(--n) 1 0; min-width: 0; border-radius: 30px; }
}

/* ===================== E4 Retour au joueur ===================== */
.e4 {
  position: fixed; inset: 0; z-index: 40; overflow: hidden; border: none; width: 100%;
  padding: 56px 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  text-align: center; color: var(--encre);
}
.e4 > * { pointer-events: none; }
.e4 .filigrane { top: 16px; right: 16px; height: 300px; opacity: .16; }
.e4.lueur .filigrane { opacity: .28; }
.e4 .repere { width: 176px; height: 176px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.e4 .textes { display: flex; flex-direction: column; gap: 12px; }
.e4 .titre { font-family: var(--police-cond); font-size: clamp(64px, 7.8vw, 100px); font-weight: 800; line-height: .95; }
.e4 .titre span { display: inline; }
.e4 .titre span + span::before { content: ' '; }
.e4 .sous-titre { font-size: clamp(36px, 4vw, 52px); font-weight: 600; line-height: 1.1; }
.e4 .passage { margin-top: 12px; display: inline-flex; align-items: center; padding: 10px 28px; border: 3px solid currentColor; border-radius: var(--r-pill); font-size: clamp(26px, 2.8vw, 36px); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (orientation: portrait) {
  .e4 { padding: 64px 48px; gap: 40px; }
  .e4 .filigrane { height: 240px; }
  .e4 .repere { width: 220px; height: 220px; }
  .e4 .textes { gap: 20px; }
  .e4 .titre { font-size: clamp(72px, 14vw, 112px); }
  .e4 .titre span { display: block; }
  .e4 .titre span + span::before { content: none; }
  .e4 .passage { margin-top: 16px; }
}
.e4.r-loin-dessous { background: var(--e4-0-1); color: #FFFFFF; }
.e4.r-dessous { background: var(--e4-2-3); }
.e4.r-presque { background: var(--e4-4); }
.e4.r-zone { background: var(--e4-5-7); }
.e4.r-juste-dessus { background: var(--e4-8); }
.e4.r-loin-dessus { background: var(--e4-9-10); }
