
/* ============================================================================
   Base & typographie
   ========================================================================== */
html, body {
  height: 100%;
}
body {
  margin: 0;
  background: #111;
  color: #eee;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Liens, code */
a { color: #9be; text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: #222;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 2px 6px;
}

/* ============================================================================
   Conteneur plein écran centré
   ========================================================================== */
.viewport {
  /* dvh/svh gèrent mieux les barres UI mobiles que vh */
  min-height: 100dvh;
  min-height: 100svh;
  display: grid;
  place-items: center;        /* centre horizontal + vertical */
  padding: 0;                 /* évite le débordement global */
}

/* ============================================================================
   Scène : portrait 9:16 qui NE dépasse JAMAIS l’écran
   ========================================================================== */
.stage {
  aspect-ratio: 9 / 16;

  /* Contraintes strictes : le navigateur choisit la plus petite valeur compatible */
  width:  min(100vw, calc(100dvh * 9 / 16), calc(100svh * 9 / 16));
  height: min(100dvh, 100svh, calc(100vw * 16 / 9));

  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  overflow: hidden;           /* le contenu reste à l’intérieur */
  position: relative;         /* pour overlay et grille interne */
}

/* Grille interne : header / contenu (scroll) / footer */
.ui {
  position: absolute;
  inset: 0;                   /* top/right/bottom/left: 0 */
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ============================================================================
   Header & Footer
   ========================================================================== */
.header, .footer {
  padding: 12px 16px;
  background: #222;
  border-bottom: 1px solid #333;
}
.header h1 {
  margin: 0;
  font-size: 1.1rem;
}
.footer {
  border-top: 1px solid #333;
  border-bottom: none;
  color: #aaa;
  font-size: 0.85rem;
}

/* ============================================================================
   Zone contenu (scroll interne)
   ========================================================================== */
.content {
  padding: 12px 16px;
  overflow: auto;             /* scrolle à l’intérieur de la scène */
  display: grid;
  gap: 12px;
}

/* ============================================================================
   Contrôles (boutons)
   ========================================================================== */
.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
button {
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: #444; }
button.danger    { background: #c0392b; }
button:disabled  { opacity: 0.55; cursor: not-allowed; }

/* ============================================================================
   Statut + barre de progression
   ========================================================================== */
.status {
  font-size: 0.95rem;
  line-height: 1.6;
}
.status b { color: #9be; }

.progressbar {
  height: 6px;
  background: #333;
  border-radius: 6px;
  overflow: hidden;
}
.progressbar > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0d6efd, #46b3f3);
  transition: width 0.5s ease;
}

/* ============================================================================
   Lecteur YouTube (16:9) à l’intérieur de la scène 9:16
   ========================================================================== */
.playerBox {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;        /* le player garde 16:9 */
  width: 100%;
}
#player {
  width: 100%;
  height: 100%;
}

/* ============================================================================
   Overlay autoplay (si lecture auto bloquée)
   ========================================================================== */
#playOverlay {
  position: absolute;
  inset: 0;
  display: none;               /* affiché par le JS si nécessaire */
  place-items: center;
  background: rgba(0,0,0,0.5);
  z-index: 10;
}
#btnStart {
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #0d6efd;
  color: #fff;
}

/* ============================================================================
   Admin : liste d’événements socket qui DÉFILE
   ========================================================================== */

/* === Visibilité renforcée pour la zone d'événements === */
/* Conteneur du panel (si tu utilises <div id="eventsPanel">) */
/* Panel bien visible */
#eventsPanel {
  background: #163e2d;           /* vert foncé */
  border: 2px solid #2bd67b;     /* vert clair */
  border-radius: 10px;
  padding: 10px 12px;
}

/* Liste des événements : hauteur + scroll + couleur */
#events {
  margin: 8px 0 0;
  padding: 10px 14px;
  max-height: 30svh;             /* hauteur visible */
  overflow: auto;                 /* défilement interne */
  background: #1b5e3a;           /* vert moyen */
  color: #d3ffe8;                 /* texte vert très clair */
  border: 2px solid #2bd67b;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
  list-style: none;
}
#events li {
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.15);
}
#events li:last-child { border-bottom: none; }


/* ============================================================================
   Responsif
   ========================================================================== */
@media (max-width: 420px) {
  .controls {
    grid-template-columns: 1fr 1fr; /* 2 colonnes sur petits écrans */
  }
  .header h1 { font-size: 1rem; }
}

/* ============================================================================
   Variante "paysage 16:9" (si tu veux la scène façon TV)
   --------------------------------------------------------------------------
   Pour basculer, remplace tout le bloc .stage par celui-ci.
   ========================================================================== */
/*
.stage {
  aspect-ratio: 16 / 9;
  width:  min(100vw, calc(100dvh * 16 / 9), calc(100svh * 16 / 9));
  height: min(100dvh, 100svh, calc(100vw * 9 / 16));
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  overflow: hidden;
  position: relative;
}
*/
