/* ==========================================================================
   SimScope · AFGSU — page iPad des participants (scope.css)
   Seulement l'enveloppe de la page : plein écran noir/bleu nuit, zones de sécurité (encoche,
   barre d'accueil), voile de démarrage, fin de session, message « tournez l'iPad », bouton
   plein écran, message bref. Classes préfixées .sc-.
   L'intérieur du moniteur (classes .ss-…) est dans moteur.css : on n'y touche pas.
   Aucun style en ligne n'est admis par la CSP : tout passe par cette feuille.
   Safari iPadOS 16+ (100dvh, env(safe-area-inset-*), overscroll-behavior).
   ========================================================================== */

:root {
  --sc-fond: #050505;
  --sc-fond-haut: #121212;
  --sc-texte: #f2f2f2;
  --sc-attenue: #a1a1a6;
  --sc-trait: rgba(161, 161, 166, 0.30);
  --sc-accent: #3ddc84;
  --sc-erreur: #ff8f87;
  --sc-police: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

/* ----------------------------------------------------------------------- page */
[hidden] { display: none !important; }

html {
  height: 100%;
  background: var(--sc-fond);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;           /* pas de zoom au double toucher */
}

body {
  position: fixed;                      /* ni défilement ni rebond élastique */
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: var(--sc-fond);
  color: var(--sc-texte);
  font-family: var(--sc-police);
  line-height: 1.35;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 3px;
}

/* ----------------------------------------------------------------------- moniteur */
.sc-ecran {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--sc-fond);
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}

.sc-noscript {
  position: fixed;
  top: 40%;
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  padding: 0 24px;
  text-align: center;
  font-size: 20px;
  color: var(--sc-attenue);
}

/* ----------------------------------------------------------------------- voile de démarrage */
.sc-voile {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 32px calc(env(safe-area-inset-bottom, 0px) + 24px);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(61, 220, 132, 0.10), rgba(61, 220, 132, 0) 55%),
    rgba(5, 5, 5, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sc-voile:disabled { cursor: default; }

.sc-voile-icone {
  width: 84px;
  height: 84px;
  margin-bottom: 6px;
  border-radius: 20px;
  box-shadow: 0 0 0 1px var(--sc-trait);
}

.sc-voile-titre {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sc-attenue);
}

.sc-voile-invite {
  font-size: clamp(26px, 4.4vw, 42px);
  font-weight: 700;
  color: var(--sc-texte);
  animation: sc-pulsation 2.2s ease-in-out infinite;
}

.sc-voile-aide {
  font-size: 16px;
  color: var(--sc-attenue);
}

.sc-voile-etat {
  min-height: 1.35em;
  font-size: 15px;
  color: var(--sc-accent);
}

.sc-voile-mention {
  max-width: 560px;
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--sc-attenue);
}

.sc-voile-erreur {
  max-width: 560px;
  font-size: 18px;
  font-weight: 600;
  color: var(--sc-erreur);
}

/* tant que le moniteur charge, l'invitation est atténuée et immobile */
.sc-voile:disabled .sc-voile-invite,
.sc-voile:disabled .sc-voile-aide {
  opacity: 0.35;
  animation: none;
}

@keyframes sc-pulsation {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ----------------------------------------------------------------------- fin de session */
.sc-fin {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 24px 32px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%, var(--sc-fond-haut), var(--sc-fond) 70%);
}

.sc-fin-titre {
  margin: 0;
  font-size: clamp(26px, 4.4vw, 42px);
  font-weight: 700;
}

.sc-fin-texte {
  max-width: 520px;
  margin: 0;
  font-size: 18px;
  color: var(--sc-attenue);
}

.sc-bouton-discret {
  margin-top: 10px;
  padding: 11px 24px;
  border: 1px solid var(--sc-trait);
  border-radius: 999px;
  background: transparent;
  font-size: 16px;
  color: var(--sc-attenue);
  cursor: pointer;
}

.sc-bouton-discret:active { color: var(--sc-texte); border-color: var(--sc-attenue); }

/* ----------------------------------------------------------------------- « Tournez l'iPad » (portrait seulement) */
.sc-portrait {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 10;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border: 1px solid var(--sc-trait);
  border-radius: 999px;
  background: rgba(5, 5, 5, 0.82);
  font-size: 14px;
  color: var(--sc-attenue);
  white-space: nowrap;
  pointer-events: none;                 /* le moniteur reste utilisable en portrait */
  transform: translateX(-50%);
}

@media (orientation: portrait) {
  .sc-portrait {
    display: flex;
    animation: sc-effacement 0.8s ease 10s forwards;   /* discret : disparaît après 10 s */
  }
}

.sc-portrait-icone {
  box-sizing: border-box;
  flex: none;
  width: 11px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 3px;
  animation: sc-rotation 3.2s ease-in-out infinite;
}

@keyframes sc-rotation {
  0%, 25% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}

@keyframes sc-effacement {
  to { opacity: 0; visibility: hidden; }
}

/* ----------------------------------------------------------------------- plein écran (discret, coin haut droit) */
.sc-plein-ecran {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 2px);
  right: calc(env(safe-area-inset-right, 0px) + 2px);
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;                          /* zone tactile confortable, pictogramme de 18 px */
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sc-attenue);
  opacity: 0.3;
  cursor: pointer;
}

.sc-plein-ecran:active,
.sc-plein-ecran:focus-visible { opacity: 0.9; }

/* bouton affiché : l'en-tête du moniteur lui laisse le coin (sinon il cache l'heure et le témoin de connexion) */
body:has(> .sc-plein-ecran:not([hidden])) .ss-entete {
  padding-right: calc(env(safe-area-inset-right, 0px) + 50px);
}

/* ----------------------------------------------------------------------- message bref */
.sc-message {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 50;
  box-sizing: border-box;
  max-width: min(90vw, 560px);
  margin: 0;
  padding: 10px 20px;
  border: 1px solid var(--sc-trait);
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.95);
  font-size: 16px;
  text-align: center;
  color: var(--sc-texte);
  pointer-events: none;
  transform: translateX(-50%);
  animation: sc-apparition 0.18s ease-out;
}

@keyframes sc-apparition {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ----------------------------------------------------------------------- mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  .sc-voile-invite,
  .sc-portrait-icone,
  .sc-message { animation: none; }
  .sc-portrait { animation: none; }
}

/* ======================================================================= Simulateur scope (Métier Lab) */
/* entre deux séances : par-dessus le scope, le flux reste ouvert */
.sc-attente {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(5, 5, 5, 0.92); color: var(--sc-texte); text-align: center; padding: 24px;
}
.sc-attente[hidden] { display: none; }
.sc-attente-titre { margin: 0; font-size: clamp(26px, 4.4vw, 44px); font-weight: 700; }
.sc-attente-texte { margin: 0; font-size: 17px; color: var(--sc-attenue); }

/* code de la séance, en petit, pour vérifier qu'on est sur la bonne */
.sc-code-coin {
  position: fixed; left: calc(env(safe-area-inset-left, 0px) + 10px); bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  z-index: 30; margin: 0; font-size: 11px; letter-spacing: 0.08em; color: var(--sc-attenue); opacity: 0.6;
  pointer-events: none;
}
.sc-voile-autre {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); transform: translateX(-50%);
  z-index: 60; color: var(--sc-attenue); font-size: 15px;
}
.sc-voile-autre[hidden] { display: none; }
/* sélecteur de langue FR | EN (web/i18n) : au-dessus du voile de démarrage, retiré dès que le moniteur démarre */
.sc-langue { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; z-index: 70; color: var(--sc-attenue); }
.sc-langue[hidden] { display: none; }
.langue-pied { color: var(--sc-attenue); }

/* page « Code de la séance » */
.sc-rejoindre {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; background: var(--sc-fond); color: var(--sc-texte); font-family: var(--sc-police); text-align: center;
}
.sc-rejoindre h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); }
.sc-rejoindre form { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sc-code-champ {
  width: 9.5ch; padding: 10px 14px; font-size: clamp(36px, 7vw, 56px); font-weight: 700; letter-spacing: 0.18em;
  text-align: center; color: var(--sc-texte); background: var(--sc-fond-haut); border: 2px solid var(--sc-trait);
  border-radius: 14px; font-family: var(--sc-police);
}
.sc-code-champ:focus { outline: 3px solid var(--sc-accent); outline-offset: 2px; }
.sc-bouton-principal {
  min-height: 52px; min-width: 220px; padding: 0 28px; font-size: 19px; font-weight: 700; color: #050505;
  background: var(--sc-accent); border: 0; border-radius: 12px; cursor: pointer;
}
.sc-rejoindre-erreur { margin: 0; min-height: 1.4em; color: var(--sc-erreur); font-size: 16px; }
.sc-rejoindre-mention { margin: 24px 0 0; max-width: 520px; font-size: 13px; color: var(--sc-attenue); }

/* Pied de page juridique (discret, hors de la zone d'écran) */
.sc-legal { position: fixed; right: 8px; bottom: 4px; z-index: 1; font-size: 0.65rem; opacity: 0.5; text-align: right; }
.sc-legal a { color: inherit; }
