:root {
  --fond: #0b0d12;
  --carte: #12151d;
  --bord: #232838;
  --texte: #e8eaf0;
  --sourd: #9aa3b5;
  --accent: #5b8cff;
  --ok: #4ade80;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}
.carte {
  width: 100%;
  max-width: 560px;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
h1 { margin: 0; font-size: 20px; }
.sous-titre { margin: 4px 0 16px; color: var(--sourd); font-size: 13px; }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--sourd); }
.note { font-size: 12px; }
input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--bord);
  background: #0f1219;
  color: var(--texte);
  font-size: 15px;
}
input:focus { outline: 1px solid var(--accent); }
button {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
.erreur { color: #f87171; font-size: 14px; }
.limites { margin-top: 18px; font-size: 13px; color: var(--sourd); }
.limites summary { cursor: pointer; }
.limites li { margin: 6px 0; }
.barre { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#titre-salon { font-weight: 600; }
.badge {
  font-size: 11px;
  border: 1px solid var(--bord);
  border-radius: 99px;
  padding: 3px 9px;
  color: var(--sourd);
  white-space: nowrap;
}
.statut { color: var(--sourd); font-size: 13px; margin: 8px 0 0; }
.code { font-size: 12px; color: var(--ok); margin: 6px 0 0; word-spacing: 4px; }
#messages {
  flex: 1;
  min-height: 280px;
  max-height: 50vh;
  overflow-y: auto;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px;
}
.systeme { align-self: center; color: var(--sourd); font-size: 12px; text-align: center; }
.bulle {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  overflow-wrap: anywhere;
}
.bulle .nom { font-size: 11px; color: var(--sourd); margin-bottom: 2px; }
.bulle.moi { align-self: flex-end; background: #1d3a8a; }
.bulle.pair { align-self: flex-start; background: #1a1f2c; }
#formulaire { display: flex; gap: 8px; align-items: stretch; }
#formulaire #champ-message { margin-top: 0; flex: 1; }
#formulaire button { margin-top: 0; }
#bouton-fichier { padding: 10px 12px; background: #1a1f2c; border: 1px solid var(--bord); font-size: 16px; }
#bouton-fichier:hover:not(:disabled) { border-color: var(--accent); }
.media-corps { display: flex; flex-direction: column; gap: 6px; }
.media-titre { font-size: 12px; color: var(--ok); }
.media-apercu { max-width: 100%; max-height: 240px; border-radius: 8px; }
.bulle audio { width: 240px; max-width: 100%; }
.bulle .statut-msg { font-size: 10px; color: #9aa3b5; margin-top: 3px; align-self: flex-end; }
#table-preuves { width: 100%; border-collapse: collapse; margin-top: 8px; }
#table-preuves td, #table-preuves th {
  padding: 4px 6px; border-bottom: 1px solid var(--bord);
  text-align: left; font-size: 11px;
}
#table-preuves .ok { color: var(--ok); }
#table-preuves .ko { color: #f87171; }

/* Recherche locale + historique persistant (incrément 16) */
.barre-recherche { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.barre-recherche #champ-recherche { margin-top: 0; flex: 1; font-size: 13px; padding: 7px 10px; }
.barre-recherche #compteur-recherche { white-space: nowrap; font-size: 11px; }
.barre-recherche button { margin-top: 0; padding: 7px 10px; background: #1a1f2c;
  border: 1px solid var(--bord); font-size: 13px; }
.barre-recherche button:hover { border-color: var(--accent); }
.media-oublie { color: var(--sourd); font-style: italic; }

/* Notes vocales (incrément 17) */
#bouton-micro { padding: 10px 12px; background: #1a1f2c; border: 1px solid var(--bord);
  font-size: 16px; min-width: 46px; }
#bouton-micro:hover:not(:disabled) { border-color: var(--accent); }
#bouton-micro.enregistre { background: #7f1d1d; border-color: #f87171; font-size: 13px;
  font-variant-numeric: tabular-nums; animation: pulse-micro 1.2s ease-in-out infinite; }
@keyframes pulse-micro { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

/* Réactions & réponses (incrément 18) */
.bulle { position: relative; }
.actions-bulle {
  position: absolute; top: -14px; right: 6px; display: none; gap: 1px;
  background: #0f131c; border: 1px solid var(--bord); border-radius: 14px; padding: 2px 4px;
}
.bulle:hover .actions-bulle, .bulle:focus-within .actions-bulle { display: flex; }
.action-emoji {
  margin-top: 0; padding: 1px 3px; background: none; border: none;
  font-size: 13px; line-height: 1.1; cursor: pointer;
}
.action-emoji:hover { transform: scale(1.25); }
.reactions { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.reaction {
  background: #0f131c; border: 1px solid var(--bord); border-radius: 10px;
  padding: 0 5px; font-size: 12px; line-height: 1.6;
}
.citation {
  display: block; border-left: 3px solid var(--accent); padding-left: 6px; margin-bottom: 4px;
  font-size: 11px; color: var(--sourd); font-style: italic;
}
/* `display:flex` sur un id l'emporte sur l'attribut `hidden` du navigateur :
   sans cette ligne, le bandeau reste visible et vide au chargement. */
#bandeau-reponse[hidden] { display: none; }
#bandeau-reponse {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 6px 10px;
  background: #0f131c; border: 1px solid var(--bord); border-left: 3px solid var(--accent);
  border-radius: 8px; font-size: 12px; color: var(--sourd);
}
#bandeau-reponse .reponse-texte { flex: 1; }
#bandeau-reponse button { margin-top: 0; padding: 1px 7px; background: none; border: none; font-size: 13px; }

/* Contacts & lien d'invitation (incrément 19) */
#lien-invitation { font-family: ui-monospace, monospace; font-size: 11px; }
.contact { padding: 3px 0; border-bottom: 1px solid var(--bord); }
.contact a { color: var(--accent); text-decoration: none; }
.contact a:hover { text-decoration: underline; }

/* Groupes (incrément 21) */
#panneau-groupe[hidden] { display: none; }
.membre { padding: 2px 0; border-bottom: 1px solid var(--bord); font-size: 12px; }
.statut-media { font-size: 11px; color: var(--ok); margin-top: 3px; }
