/* Télécommande — côté ordinateur (app/ui/telecommande.js) : bouton discret,
   panneau d'appairage, pointeur laser et curseur pilotés depuis l'iPhone.
   La page de l'iPhone a sa propre feuille (telecommande-iphone.css). */

/* Bouton : presque invisible au repos, net au survol. Réservé à l'enseignant,
   il ne doit pas attirer l'œil des élèves. */
#tele-btn {
  position: fixed; right: 12px; bottom: 12px; z-index: 950;
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: .28; transition: opacity .2s, box-shadow .2s;
}
#tele-btn:hover, #tele-btn:focus-visible, #tele-btn[aria-expanded="true"] { opacity: 1; box-shadow: var(--shadow-sm); }
#tele-btn[hidden] { display: none; }
/* Un téléphone dessiné au trait. */
.tele-icone { width: 9px; height: 14px; border: 1.5px solid currentColor; border-radius: 2.5px; position: relative; }
.tele-icone::after { content: ""; position: absolute; left: 50%; bottom: 1px; width: 2px; height: 2px; margin-left: -1px; border-radius: 50%; background: currentColor; }
/* iPhone en ligne : une pastille verte, discrète elle aussi. */
#tele-btn.connecte::after {
  content: ""; position: absolute; right: 3px; top: 3px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); border: 1.5px solid var(--panel);
}
html.en-presentation #tele-btn, html.en-presentation #tele-panneau { display: none; }
/* Les élèves lisent sur téléphone : le bouton n'y a pas sa place. */
@media (max-width: 699px) { #tele-btn { display: none; } }

#tele-panneau {
  position: fixed; right: 12px; bottom: 52px; z-index: 960; width: 300px; max-width: calc(100vw - 24px);
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 14px 16px 16px; font-size: 14px; line-height: 1.45;
}
#tele-panneau[hidden] { display: none; }
.tele-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tele-tete strong { font-size: 15px; }
.tele-x { border: none; background: transparent; color: var(--text-dim); font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 7px; }
.tele-x:hover { background: var(--panel-2); color: var(--text); }
.tele-aide { margin: 6px 0; color: var(--text-dim); }
.tele-aide strong { color: var(--text); font-weight: 600; }
.tele-note { margin: 8px 0 0; font-size: 12px; color: var(--text-faint); }
.tele-ok { margin: 4px 0 6px; font-weight: 600; color: var(--green); }
.tele-alerte { margin: 6px 0; padding: 8px 10px; border-radius: var(--r-xs); background: var(--red-soft); color: var(--red); font-size: 13px; }
/* Le QR code reste noir sur blanc, en thème sombre aussi : c'est ce que lit l'appareil photo. */
.tele-qr { width: 176px; margin: 8px auto 4px; border-radius: 8px; overflow: hidden; background: #fff; }
.tele-qr svg { display: block; width: 100%; height: auto; }
.tele-code {
  margin: 4px 0 2px; text-align: center; font-size: 30px; font-weight: 700; letter-spacing: .12em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.tele-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 8px; }
.tele-lien { border: none; background: transparent; padding: 4px 0; font: inherit; font-size: 13.5px; color: var(--accent); cursor: pointer; }
.tele-lien:hover { text-decoration: underline; }
.tele-danger { color: var(--red); }

/* Pointeurs pilotés à distance : au-dessus de TOUT (présentation, aperçus),
   et transparents aux clics. Placés par `transform` (app/ui/telecommande.js) ;
   le glissement adoucit les positions qui arrivent par paquets. */
#tele-laser, #tele-curseur, .tele-onde {
  position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; will-change: transform;
}
#tele-laser[hidden], #tele-curseur[hidden] { display: none; }
#tele-laser.glisse, #tele-curseur.glisse { transition: transform .11s linear; }
/* Le laser : un point rouge lumineux, visible sur fond clair comme sombre. */
#tele-laser::before {
  content: ""; position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, #ff2a1a 32% 62%, rgba(255, 42, 26, 0) 72%);
  box-shadow: 0 0 14px 5px rgba(255, 42, 26, .55);
}
/* La souris : un disque translucide cerclé, comme le pointeur de l'iPad. */
#tele-curseur::before {
  content: ""; position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: rgba(120, 120, 128, .35); border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .3);
}
.tele-onde::before {
  content: ""; position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  border: 3px solid var(--accent); animation: tele-onde .55s var(--ease) forwards;
}
@keyframes tele-onde { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  #tele-laser.glisse, #tele-curseur.glisse { transition: none; }
}

/* Vidéo filmée par l'iPhone ou l'iPad (app/ui/tele-video.js) : plein écran,
   au-dessus de la présentation (2000), SOUS le brouillon (2500) — en mode
   « Sur le cours », on annote ce qu'on filme — et sous le laser (3000). */
#tele-video {
  position: fixed; inset: 0; z-index: 2400; background: #000;
  display: flex; align-items: center; justify-content: center;
}
#tele-video[hidden] { display: none; }
#tele-video-flux { width: 100%; height: 100%; object-fit: contain; background: #000; }
#tele-video-fermer {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 18px; cursor: pointer;
  opacity: .35; transition: opacity .2s;
}
#tele-video-fermer:hover, #tele-video-fermer:focus-visible { opacity: 1; }
