:root {
  --fond: #f4f6fa;
  --carte: #ffffff;
  --texte: #1b2333;
  --doux: #5d6b82;
  --bord: #d6dce7;
  --accent: #1f6feb;
  --accent-texte: #ffffff;
  --danger: #d1242f;
  --ok: #1a7f37;
  --barre: #111827;
  --barre-texte: #e5e7eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0d1117;
    --carte: #161b22;
    --texte: #e6edf3;
    --doux: #8b98a9;
    --bord: #30363d;
    --accent: #388bfd;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--fond);
  color: var(--texte);
}
[hidden] { display: none !important; }

/* ---------- accueil */
#accueil {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.carte {
  width: 100%; max-width: 380px;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 14px;
  padding: 28px 26px 22px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .06);
}
h1 { margin: 0; font-size: 24px; display: flex; align-items: center; gap: 10px; }
.sous-titre { margin: 4px 0 22px; color: var(--doux); }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.aide { font-weight: 400; color: var(--doux); }
input {
  display: block; width: 100%; margin-top: 5px;
  font: inherit; font-size: 17px; letter-spacing: .04em;
  padding: 9px 11px;
  border: 1px solid var(--bord); border-radius: 8px;
  background: var(--fond); color: var(--texte);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
#code { text-transform: uppercase; font-family: Consolas, ui-monospace, monospace; }
button {
  font: inherit; cursor: pointer;
  border: 1px solid var(--bord); border-radius: 8px;
  padding: 7px 12px;
  background: var(--carte); color: var(--texte);
}
#btn-connexion {
  width: 100%; margin-top: 6px; padding: 11px;
  background: var(--accent); border-color: var(--accent); color: var(--accent-texte);
  font-weight: 600;
}
#btn-connexion:disabled { opacity: .6; cursor: wait; }
.etat { min-height: 1.4em; margin: 14px 0 0; font-size: 14px; }

/* ---------- collègues en ligne (ouvert depuis gestion) */
.moi { margin: -8px 0 16px; font-size: 13px; color: var(--doux); }
.badge {
  display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 99px;
  font-size: 11px; background: #1a7f3720; color: var(--ok);
}
h2 { font-size: 14px; margin: 0 0 8px; }
.liste { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.collegue {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; border-radius: 10px;
}
.collegue:hover:not(:disabled) { border-color: var(--accent); background: var(--fond); }
.collegue:disabled { cursor: default; opacity: .55; }
.collegue .avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-texte); font-weight: 600;
}
.collegue .qui { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.collegue .qui strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collegue small { color: var(--doux); font-size: 12px; }
.collegue .dispo { font-size: 12px; color: var(--ok); }
.collegue:disabled .dispo { color: var(--doux); }
.collegue.commun .avatar { background: #b9770e; }
.collegue.commun .dispo { color: #9a6206; font-weight: 600; }
.vide { color: var(--doux); font-size: 13.5px; margin: 0 0 8px; }

#manuel > summary { display: none; }
#manuel.repli { margin-top: 16px; }
#manuel.repli > summary { display: list-item; cursor: pointer; color: var(--doux); font-size: 13px; margin-bottom: 12px; }
.pied a { color: var(--accent); }
.portable { font-size: 13px; color: var(--doux); margin: 0 0 14px; }
.portable p { margin: 0 0 8px; }
.portable a { color: var(--accent); }
.actions-portable { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions-portable button { font-size: 13px; padding: 5px 10px; }
#mail-portable { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
button.lien { border: 0; background: none; padding: 0 0 0 4px; color: var(--accent); text-decoration: underline; font-size: inherit; }
.installer { margin-top: 4px; }
.etat.erreur { color: var(--danger); }
.pied { max-width: 380px; text-align: center; color: var(--doux); font-size: 12.5px; margin-top: 16px; }

/* ---------- session */
#session { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
#barre {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--barre); color: var(--barre-texte);
  font-size: 13px;
}
#barre button, #barre select {
  font: inherit; font-size: 13px;
  background: #1f2937; color: var(--barre-texte);
  border: 1px solid #374151; border-radius: 6px; padding: 4px 10px;
}
#barre button:hover { background: #374151; }
#barre button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
#titre-session { font-weight: 600; }
.pastille { padding: 2px 8px; border-radius: 99px; font-size: 12px; background: #374151; }
.pastille.controle { background: var(--ok); color: #fff; }
.stats { margin-left: auto; color: #9ca3af; font-variant-numeric: tabular-nums; }
#scene { position: relative; flex: 1; min-height: 0; overflow: hidden; }
/* Vignettes des écrans : taille de case calculée par disposer() (viewer.js) */
#mur {
  position: absolute; inset: 0;
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 8px;
}
.tuile { position: relative; width: var(--cw, 100%); height: var(--ch, 100%); }
.tuile video { width: 100%; height: 100%; object-fit: contain; display: block; outline: none; }
.etiquette {
  display: none; position: absolute; left: 8px; top: 6px; pointer-events: none;
  padding: 1px 8px; border-radius: 6px; font-size: 12px;
  background: rgba(17, 24, 39, .75); color: #e5e7eb;
}
#mur.plusieurs .etiquette { display: block; }
#mur.plusieurs .tuile video { background: #111; }
#scene.controle .tuile video {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Ccircle cx='5' cy='5' r='3' fill='%23fff' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") 5 5, crosshair;
}
.attente {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 16px;
}
