/* =====================================================================
   La Classe Mission — styles (LOT 1 : maquette connexion + accueil)
   Couleurs de la marque Mission Réussite :
   teal #2D6772 (primaire), orange #F2AE5D (accent),
   bleu #2E86C1 (accent secondaire), vert clair #B7DAC4,
   fond menthe #F0F5EF.
   Thème clair / sombre : choix conservé (localStorage), tout doit
   rester lisible dans les deux thèmes.
   ===================================================================== */

:root {
  --teal: #2D6772;
  --teal-dark: #21484F;
  --orange: #F2AE5D;
  --blue: #2E86C1;
  --green-light: #B7DAC4;
  --mint: #F0F5EF;
  --radius: 14px;
}

html[data-theme="light"] {
  --bg: var(--mint);
  --surface: #ffffff;
  --surface-muted: #E7EFEA;
  --text: #1F2A2D;
  --muted: #5A6B6E;
  --border: #CFDDD3;
  --accent: var(--teal);
  --accent-contrast: #ffffff;
  --danger: #B3261E;
  --shadow: rgba(31, 42, 45, 0.12);
}

html[data-theme="dark"] {
  --bg: #16211F;
  --surface: #1E2C2A;
  --surface-muted: #263735;
  --text: #EDF4EF;
  --muted: #A9BDB2;
  --border: #3A4F4B;
  --accent: #6FB3BE;
  --accent-contrast: #10201F;
  --danger: #FF8A80;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 0.75rem; }

.hint { color: var(--muted); margin: 0.25rem 0 1rem; }
.error { color: var(--danger); font-weight: 600; }
.ok { color: var(--teal); font-weight: 600; }

/* ---- Bandeau maquette (lot 1 seulement) ---- */
.mock-banner {
  background: var(--orange);
  color: #3A2A10;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 1rem 0;
}

/* ---- Barre supérieure ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar-logo { border-radius: 8px; object-fit: contain; background: #fff; }
.topbar-titles { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-titles strong { font-size: 1.15rem; color: var(--teal); }
html[data-theme="dark"] .topbar-titles strong { color: #8FD0DA; }
.topbar-titles span { font-size: 0.85rem; color: var(--muted); }
.topbar-actions {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem 0.6rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.brand-stripe {
  height: 4px;
  background: linear-gradient(90deg, var(--teal) 0 45%, var(--orange) 45% 70%, var(--blue) 70% 100%);
}

/* ---- Mises en page ---- */
.login-main, .home-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}
.login-card, .inside-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px var(--shadow);
  padding: 1.25rem;
  margin-top: 1rem;
}
.inside-card img { max-width: 100%; border-radius: 10px; margin-top: 0.75rem; }
.inside-card ul { margin: 0.5rem 0; padding-left: 1.25rem; }

/* ---- Formulaires ---- */
label { display: block; font-weight: 600; margin: 0.9rem 0 0.3rem; }
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.checkline { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }

/* ---- Boutons ---- */
.btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
}
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
html[data-theme="dark"] .btn-primary { background: #6FB3BE; border-color: #6FB3BE; color: #10201F; }
.btn-secondary { background: var(--orange); border-color: var(--orange); color: #3A2A10; font-weight: 700; }
.btn-ghost { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.linklike {
  background: none; border: none; color: var(--blue);
  cursor: pointer; text-decoration: underline; font-size: 1rem; padding: 0;
}
html[data-theme="dark"] .linklike { color: #7FBFE8; }
.login-preview { margin-top: 1rem; font-size: 0.95rem; color: var(--muted); }

/* ---- Accueil : cartes d'espaces ---- */
.home-head { margin-top: 0.5rem; }
.home-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.75rem; }
.spaces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}
.space-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--teal);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.space-card h3 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.space-card p { margin: 0.2rem 0; color: var(--muted); font-size: 0.95rem; }
.space-card .space-code {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  background: var(--surface-muted);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}
.space-card .btn { margin-top: 0.75rem; }
.people-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.people-list p { margin: 0.4rem 0; }
.daily-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--blue);
  border-radius: var(--radius);
  padding: 0.25rem 1rem 1rem;
  margin-top: 1.5rem;
}

/* ---- Modale générique (lot 2) ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 28, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  z-index: 50;
  overflow-y: auto;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px var(--shadow);
  padding: 1.25rem;
  width: 100%;
  max-width: 520px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.modal-head h2 { margin: 0; }
.modal-card form { margin-top: 0.5rem; }
.modal-card .btn-primary { margin-top: 1rem; }

/* ---- Confirmation (toast, lot 2) ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  box-shadow: 0 4px 16px var(--shadow);
  z-index: 60;
  max-width: 90%;
  text-align: center;
}
html[data-theme="dark"] .toast { background: #6FB3BE; color: #10201F; }

/* ---- Cartes d'espaces : menu ⋯ et actions (lot 2) ---- */
.space-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.space-menu-wrap { position: relative; flex-shrink: 0; }
.space-menu-btn { font-size: 1.1rem; line-height: 1; padding: 0.2rem 0.6rem; }
.space-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px var(--shadow);
  min-width: 200px;
  z-index: 20;
  padding: 0.3rem;
}
.space-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}
.space-menu-item:hover { background: var(--surface-muted); }
.space-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.space-actions .btn { margin-top: 0; }

/* ---- Rangées de personnes et codes (lot 2) ---- */
.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.person-row:last-child { border-bottom: none; }
.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.9rem; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.code-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.6rem 0;
}
.invite-text {
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

/* ---- Pied de page ---- */
.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.site-footer p { margin: 0.15rem 0; }

@media (max-width: 560px) {
  .topbar-actions { gap: 0.4rem; }
  h1 { font-size: 1.3rem; }
}

/* =====================================================================
   Salle de classe (LOT 3) — disposition inspirée de LessonSpace,
   style Mission Réussite (couleurs de la marque, jamais un clone).
   ===================================================================== */
.class-topbar .topbar-inner { max-width: none; }
.class-topbar-inner { flex-wrap: wrap; }
.class-actions { max-width: none; }
.class-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
  align-items: start;
}
.class-main { min-width: 0; display: flex; flex-direction: column; gap: 0.6rem; }

/* ---- Barre d'onglets ---- */
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  flex-wrap: wrap;
}
.tabs-list {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn.tab-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 700;
}
html[data-theme="dark"] .tab-btn.tab-active { background: #6FB3BE; border-color: #6FB3BE; color: #10201F; }
.tabs-add-wrap { position: relative; flex-shrink: 0; }
.tabs-add-btn { font-size: 1.15rem; line-height: 1; padding: 0.3rem 0.7rem; }
.tabs-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px var(--shadow);
  min-width: 240px;
  z-index: 30;
  padding: 0.3rem;
}
.tabs-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}
.tabs-menu button:hover { background: var(--surface-muted); }
.bg-color-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 400;
  margin: 0;
}
.bg-color-line input[type="color"] { width: 44px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }

/* ---- Barre d'outils du tableau blanc ---- */
.board-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
}
.tool-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
}
.tool-btn.tool-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
html[data-theme="dark"] .tool-btn.tool-active { background: #6FB3BE; border-color: #6FB3BE; color: #10201F; }
.tool-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.tb-sep { width: 1px; height: 26px; background: var(--border); margin: 0 0.25rem; }
.tool-colors { display: flex; gap: 0.3rem; align-items: center; }
.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
  padding: 0;
}
.color-swatch.swatch-active { box-shadow: 0 0 0 2px var(--teal); }
#tool-width {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.4rem;
  font-size: 0.95rem;
}
.zoom-label { min-width: 52px; text-align: center; font-size: 0.95rem; color: var(--muted); }
.toolbar-readonly { opacity: 0.75; }

/* ---- Surface de travail ---- */
.board-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.board-scroll { overflow: auto; }
.board-stage, .pdf-stage, .file-stage {
  position: relative;
  width: fit-content;
  margin: 0 auto;
}
#board-canvas { display: block; background: #fff; border-radius: 8px; box-shadow: 0 1px 6px var(--shadow); touch-action: none; }
#pdf-canvas, #file-img { display: block; border-radius: 8px; box-shadow: 0 1px 6px var(--shadow); }
#pdf-annot-canvas, #file-annot-canvas {
  position: absolute;
  top: 0;
  left: 0;
  touch-action: none;
}
.pdf-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
#video-wrap { max-width: 960px; margin: 0 auto; }
#video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; }
.board-text-input {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 4px 16px var(--shadow);
}
.board-text-input input { min-width: 220px; }
.board-readonly {
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  margin-top: 0.6rem;
}
.board-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.board-foot .hint { margin: 0; }

/* ---- Panneau latéral de la classe ---- */
.class-side { display: flex; flex-direction: column; gap: 1rem; }
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 1rem 1rem;
}
.side-card h2 { margin-top: 1rem; }

@media (max-width: 900px) {
  .class-layout { grid-template-columns: 1fr; }
  .class-side { order: 2; }
}

/* =====================================================================
   Vidéo en direct — LOT 5 : Daily Prebuilt, 3 dispositions de caméra
   approuvées + vue grille. Le panneau vidéo reste dans la barre
   latérale en mode « côte à côte » ; dans les autres modes il se
   place en surimpression (position fixed) sans jamais déplacer
   l'iframe dans le DOM (un déplacement rechargerait l'appel).
   En « plein écran », la barre latérale disparaît sauf la carte
   vidéo, et le tableau blanc prend toute la largeur.
   ===================================================================== */

/* ---- Carte vidéo (panneau latéral, par défaut) ---- */
.video-layout-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.6rem;
}
.video-layout-btn.video-layout-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 700;
}
html[data-theme="dark"] .video-layout-btn.video-layout-active {
  background: #6FB3BE;
  border-color: #6FB3BE;
  color: #10201F;
}
.daily-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 180px;
  background: #16211F;
  border-radius: 10px;
  overflow: hidden;
}
.daily-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
#daily-rejoin-btn { margin-top: 0.6rem; }

/* ---- Grande + petite en coin : grand panneau en haut à droite ---- */
#view-class.video-layout-large .video-card {
  position: fixed;
  top: 4.75rem;
  right: 1rem;
  width: min(720px, 62vw);
  z-index: 45;
  box-shadow: 0 8px 30px var(--shadow);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

/* ---- Vue grille : grand panneau centré ---- */
#view-class.video-layout-grid .video-card {
  position: fixed;
  top: 4.75rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, 88vw);
  z-index: 45;
  box-shadow: 0 8px 30px var(--shadow);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

/* ---- Plein écran : tableau blanc toute largeur, vidéo flottante ---- */
#view-class.video-layout-floating .class-layout {
  grid-template-columns: 1fr;
}
#view-class.video-layout-floating .class-side {
  display: contents;
}
#view-class.video-layout-floating .class-side > :not(.video-card) {
  display: none;
}
#view-class.video-layout-floating .video-card {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 320px;
  z-index: 45;
  box-shadow: 0 8px 30px var(--shadow);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
#view-class.video-layout-floating .daily-video-wrap {
  min-height: 160px;
}

@media (max-width: 900px) {
  #view-class.video-layout-large .video-card,
  #view-class.video-layout-grid .video-card {
    width: calc(100vw - 2rem);
    right: 1rem;
    left: 1rem;
    transform: none;
  }
  #view-class.video-layout-floating .video-card {
    width: calc(100vw - 2rem);
  }
}

/* =====================================================================
   Salle de classe — LOT 4 : minuteur, salle d'attente, clavardage,
   réactions, présence. Style Mission Réussite, lisible en clair et
   en sombre (le rouge du minuteur reste lisible dans les deux).
   ===================================================================== */

/* ---- Minuteur (en haut à droite de la classe) ---- */
.timer-wrap { position: relative; flex-shrink: 0; }
.timer-display {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0.35rem 0.9rem;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.timer-display.timer-running { border-color: var(--teal); }
.timer-display.timer-red {
  color: var(--danger);
  border-color: var(--danger);
}
.timer-analog { display: block; }
.timer-analog .clock-face {
  fill: var(--surface);
  stroke: var(--teal);
  stroke-width: 3;
}
.timer-analog .clock-num { fill: var(--muted); font-size: 13px; font-weight: 700; }
.timer-analog .clock-hand { stroke: var(--teal); stroke-linecap: round; }
.timer-analog .clock-hour { stroke-width: 5; }
.timer-analog .clock-minute { stroke-width: 3; }
.timer-analog .clock-center { fill: var(--teal); }
.timer-analog.timer-red .clock-face { stroke: var(--danger); }
.timer-analog.timer-red .clock-hand { stroke: var(--danger); }
.timer-analog.timer-red .clock-center { fill: var(--danger); }
.timer-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--shadow);
  min-width: 280px;
  z-index: 30;
  padding: 0.9rem 1rem;
}
.timer-menu-title { font-weight: 700; margin: 0 0 0.6rem; }
.timer-presets { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.timer-custom-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-weight: 400;
  margin: 0.4rem 0;
}
.timer-custom-line input[type="number"] {
  width: 80px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.5rem;
  font-size: 1rem;
}
.timer-actions { display: flex; gap: 0.5rem; margin: 0.6rem 0; }
.timer-menu .hint { margin: 0.4rem 0 0; }

/* ---- Salle d'attente ---- */
.waiting-card { max-width: 560px; margin-left: auto; margin-right: auto; }
.wait-video-wrap { margin: 1rem 0; }
#wait-video {
  display: block;
  width: 100%;
  max-height: 320px;
  background: #16211F;
  border-radius: 10px;
  object-fit: cover;
}
.waiting-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
#wait-pending { font-weight: 700; color: var(--teal); }

/* ---- Présence dans la classe ---- */
.presence-list { margin-top: 0.5rem; }
.presence-list .hint { margin: 0.25rem 0; }
.presence-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.presence-row:last-child { border-bottom: none; }
.presence-hand { font-weight: 700; }
.side-card h3 { font-size: 1rem; margin: 1rem 0 0.25rem; }

/* ---- Clavardage ---- */
.chat-card { display: flex; flex-direction: column; }
.chat-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.25rem;
}
.chat-msg {
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
}
.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.chat-author { font-weight: 700; }
.chat-time { color: var(--muted); }
.chat-body { margin: 0.15rem 0 0; overflow-wrap: break-word; }
#chat-form { display: flex; gap: 0.4rem; margin-top: 0.7rem; }
#chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
}

/* ---- Réactions ---- */
.reactions-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.5rem 0 0.75rem; }
.reaction-btn {
  min-width: 44px;
  height: 44px;
  font-size: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.reaction-btn:hover { background: var(--surface-muted); }
#hand-btn.hand-raised { background: var(--orange); border-color: var(--orange); color: #3A2A10; }

/* ---- Effets de réactions (couche flottante sur la classe) ---- */
#view-class { position: relative; }
.fx-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 40;
}
.fx-float {
  position: absolute;
  bottom: 8%;
  animation: fx-rise 2.6s ease-out forwards;
}
@keyframes fx-rise {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-52vh) scale(1.15); opacity: 0; }
}
.fx-chip {
  position: absolute;
  bottom: 18%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 2px 10px var(--shadow);
  animation: fx-rise 2.8s ease-out forwards;
  white-space: nowrap;
}
.fx-burst { position: absolute; width: 0; height: 0; animation: fx-burst-fade 1.2s ease-out forwards; }
.fx-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  animation: fx-burst-dot 1.1s ease-out forwards;
}
@keyframes fx-burst-dot {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx, 40px), var(--dy, 40px)) scale(0.2); opacity: 0; }
}
@keyframes fx-burst-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
.fx-confetti {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fx-fall 3.2s linear forwards;
}
@keyframes fx-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(72vh) rotate(540deg); opacity: 0; }
}
.fx-cake {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  font-size: 4.5rem;
  animation: fx-cake 3.2s ease-out forwards;
}
@keyframes fx-cake {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
