:root {
  --bleuet: #4338ca;
  --bleuet-fonce: #312e81;
  --bleuet-pale: #eef2ff;
  --lac: #0e7490;
  --fond: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --texte: #1e1b3a;
  --texte-2: #5b5f7a;
  --bord: #e3e5ef;
  --erreur: #dc2626;
  --vert: #16a34a;
  --rayon: 14px;
  --ombre: 0 10px 30px rgba(30, 27, 75, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bleuet: #818cf8; --bleuet-fonce: #a5b4fc; --bleuet-pale: #25264a;
    --fond: #0f1022; --surface: #181a33; --surface-2: #1f2240; --texte: #eceefe;
    --texte-2: #a3a7c7; --bord: #2c2f52; --ombre: 0 10px 30px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--fond); color: var(--texte); font-size: 15px; line-height: 1.45;
}
[hidden] { display: none !important; }
a { color: var(--bleuet); }
button, input, textarea, select { font: inherit; color: inherit; }
kbd { background: var(--surface-2); border: 1px solid var(--bord); border-radius: 4px; padding: 0 5px; font-size: 12px; }
.vue { min-height: 100%; }
.centre { display: flex; align-items: center; justify-content: center; padding: 20px; }
.centre-txt { text-align: center; }
.petit { font-size: 13px; color: var(--texte-2); }
.erreur { color: var(--erreur); min-height: 1.2em; font-size: 14px; margin: 8px 0; }
.logo { font-weight: 700; font-size: 20px; letter-spacing: -.3px; }
.logo b { color: var(--bleuet); }

/* Boutons */
.btn {
  border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer; font-weight: 600;
  background: var(--bleuet); color: #fff; transition: transform .1s, filter .15s;
}
@media (prefers-color-scheme: dark) { .btn { color: #0f1022; } }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-ghost { background: transparent; color: var(--bleuet); box-shadow: inset 0 0 0 2px var(--bleuet); }
@media (prefers-color-scheme: dark) { .btn-ghost { color: var(--bleuet); } }
.btn-gros { padding: 14px 28px; font-size: 17px; }
.btn-plein { width: 100%; padding: 13px; font-size: 16px; margin-top: 6px; }
.btn-petit { padding: 7px 14px; font-size: 13px; }
.icone {
  border: 0; background: transparent; cursor: pointer; font-size: 20px; width: 40px; height: 40px;
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icone:hover { background: var(--bleuet-pale); }
.icone.gif { font-size: 12px; font-weight: 800; letter-spacing: .5px; color: var(--bleuet); }
.icone.actif { background: var(--bleuet-pale); }
.retour {
  border: 0; background: var(--surface-2); width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; font-size: 18px; flex: none;
}

/* Accueil */
.accueil {
  min-height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(circle at 15% 20%, rgba(99, 102, 241, .25), transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(14, 116, 144, .25), transparent 45%),
    var(--fond);
}
.accueil-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; }
.hero { flex: 1; max-width: 860px; margin: 0 auto; padding: 40px 24px; text-align: center; }
.hero h1 { font-size: clamp(40px, 8vw, 72px); margin: 20px 0 10px; letter-spacing: -2px; }
.hero-sous { font-size: 19px; color: var(--texte-2); max-width: 640px; margin: 0 auto 30px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.atouts {
  list-style: none; padding: 0; margin: 50px 0 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px;
}
.atouts li {
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 18px; text-align: left; box-shadow: var(--ombre);
}
.atouts span { font-size: 28px; display: block; margin-bottom: 6px; }
.atouts b { display: block; }
.accueil-pied { text-align: center; padding: 20px; color: var(--texte-2); font-size: 14px; line-height: 1.9; }
.accueil-bloc { margin: 56px 0 0; text-align: left; }
.accueil-bloc h2 { font-size: 24px; text-align: center; margin: 0 0 18px; }
.salons-accueil { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.salons-accueil li { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px 14px; }
.salons-accueil span { font-size: 24px; flex: none; }
.salons-accueil b { display: block; }
.salons-accueil div { color: var(--texte-2); font-size: 14px; }
.salons-accueil div b { color: var(--texte); font-size: 15px; }
.accueil-bloc details { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 10px; }
.accueil-bloc summary { font-weight: 700; cursor: pointer; }
.accueil-bloc details p { margin: 10px 0 0; color: var(--texte-2); }

/* Cartes / formulaires */
.carte {
  background: var(--surface); border-radius: 20px; box-shadow: var(--ombre); padding: 28px;
  width: 100%; max-width: 440px; position: relative; border: 1px solid var(--bord);
}
.carte > .retour { position: absolute; top: 18px; left: 18px; }
.carte h2 { text-align: center; margin: 10px 0 20px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--bord); background: var(--surface-2); outline: none; font-weight: 400;
}
input:focus, textarea:focus, select:focus { border-color: var(--bleuet); }

/* Assistant d'inscription */
.assistant { max-width: 560px; min-height: 480px; display: flex; flex-direction: column; }
.assistant form { display: flex; flex-direction: column; flex: 1; }
.assistant-haut { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.progression { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
#q-barre { height: 100%; width: 0; background: linear-gradient(90deg, var(--bleuet), var(--lac)); transition: width .35s; }
#q-contenu { flex: 1; animation: entre .3s ease; }
@keyframes entre { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.q-emoji { font-size: 44px; }
.q-titre { font-size: 24px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -.4px; }
.q-aide { color: var(--texte-2); margin: 0 0 18px; }
.astuce { margin-top: 10px; }
.choix { display: grid; gap: 10px; }
.choix.deux { grid-template-columns: 1fr 1fr; }
.choix button {
  text-align: left; padding: 13px 16px; border-radius: 12px; border: 2px solid var(--bord);
  background: var(--surface-2); cursor: pointer; font-weight: 500;
}
.choix button:hover { border-color: var(--bleuet); }
.choix button.choisi { border-color: var(--bleuet); background: var(--bleuet-pale); font-weight: 700; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; max-height: 300px; overflow: auto; }
.puces button {
  border: 2px solid var(--bord); background: var(--surface-2); border-radius: 999px;
  padding: 7px 14px; cursor: pointer;
}
.puces button.choisi { border-color: var(--bleuet); background: var(--bleuet); color: #fff; }
@media (prefers-color-scheme: dark) { .puces button.choisi { color: #0f1022; } }
.liste-villes { max-height: 260px; overflow: auto; margin-top: 10px; display: grid; gap: 6px; }
.avatar-choix { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.avatar-choix .avatar { width: 120px; height: 120px; font-size: 44px; }
.case { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.case input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.regles { background: var(--surface-2); border-radius: 12px; padding: 12px 18px; margin: 0 0 16px; font-size: 14px; }
.regles li { margin: 5px 0; }
.compteur { text-align: right; font-size: 12px; color: var(--texte-2); margin-top: -8px; }
.dispo { font-size: 13px; margin-top: -6px; min-height: 1.2em; }
.dispo.ok { color: var(--vert); } .dispo.non { color: var(--erreur); }

/* Avatar */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px;
  background-size: cover; background-position: center; position: relative; text-transform: uppercase;
}
.avatar.en-ligne::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--vert); border: 2px solid var(--surface);
}

/* Disposition du chat */
.chat { display: grid; grid-template-columns: 260px 1fr 270px; height: 100vh; height: 100dvh; }
.barre-gauche, .barre-droite {
  background: var(--surface); border-right: 1px solid var(--bord); display: flex;
  flex-direction: column; overflow: hidden;
}
.barre-droite { border-right: 0; border-left: 1px solid var(--bord); padding: 14px 10px; }
.barre-gauche { padding: 18px 10px 0; }
.barre-gauche .logo { padding: 0 10px 8px; }
.barre-gauche h3, .barre-droite h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--texte-2); margin: 16px 10px 6px;
}
#liste-salons { overflow: auto; flex: 0 1 auto; }
#liste-communaute { overflow: auto; flex: 0 1 auto; max-height: 30vh; }
.h3-action { display: flex; align-items: center; justify-content: space-between; }
.mini-btn {
  border: 0; background: var(--bleuet-pale); color: var(--bleuet); width: 24px; height: 24px; border-radius: 8px;
  cursor: pointer; font-size: 15px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.mini-btn:hover { background: var(--bleuet); color: #fff; }
.lien-creer { border: 1px dashed var(--bord); color: var(--texte-2); }
.choix-emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 6px 0 14px; }
.choix-emoji button { border: 2px solid transparent; background: var(--surface-2); border-radius: 10px; font-size: 22px; padding: 4px 0; cursor: pointer; }
.choix-emoji button.choisi { border-color: var(--bleuet); background: var(--bleuet-pale); }
.entete-actions { display: flex; gap: 4px; }
.resultat-salon .sous { white-space: normal; }
#liste-dm { overflow: auto; flex: 1; }
.vide { color: var(--texte-2); font-size: 13px; padding: 0 10px; }
.item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent;
  text-align: left; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--texte);
}
.item:hover { background: var(--surface-2); }
.item.actif { background: var(--bleuet-pale); font-weight: 700; }
.item .em { font-size: 18px; width: 24px; text-align: center; flex: none; }
.item .nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sous { display: block; font-size: 12px; color: var(--texte-2); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--erreur); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.moi { border-top: 1px solid var(--bord); padding: 10px; display: flex; align-items: center; gap: 10px; }
.moi .nom { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
#liste-membres { overflow: auto; flex: 1; margin-top: 6px; }

.centre-chat { display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--fond); }
.chat-entete {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--surface);
  border-bottom: 1px solid var(--bord); min-height: 64px;
}
.titre-salon { flex: 1; min-width: 0; }
#titre-salon { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
#desc-salon { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-seul { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 16px 18px 6px; display: flex; flex-direction: column; }
.charger-plus { align-self: center; margin-bottom: 10px; }
.jour { align-self: center; font-size: 12px; color: var(--texte-2); background: var(--surface); border: 1px solid var(--bord); border-radius: 99px; padding: 2px 12px; margin: 12px 0; }
.msg { display: flex; gap: 10px; padding: 3px 0; max-width: 100%; }
.msg.suite { padding-top: 0; }
.msg.suite .avatar { visibility: hidden; height: 0; }
.msg-corps { min-width: 0; max-width: min(620px, 100%); }
.msg-entete { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-entete .auteur { font-weight: 700; cursor: pointer; }
.msg-entete .auteur:hover { text-decoration: underline; }
.msg-entete time { font-size: 11px; color: var(--texte-2); }
.bulle {
  background: var(--surface); border: 1px solid var(--bord); border-radius: 4px 16px 16px 16px;
  padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; display: inline-block; max-width: 100%;
}
.msg.moi-msg { flex-direction: row-reverse; }
.msg.moi-msg .msg-entete { flex-direction: row-reverse; }
.msg.moi-msg .msg-corps { display: flex; flex-direction: column; align-items: flex-end; }
.msg.moi-msg .bulle { background: var(--bleuet); color: #fff; border-color: transparent; border-radius: 16px 4px 16px 16px; }
@media (prefers-color-scheme: dark) { .msg.moi-msg .bulle { color: #0f1022; } }
.msg.moi-msg .bulle a { color: inherit; }
.bulle.emoji-seul { font-size: 40px; background: none !important; border: 0; padding: 0; line-height: 1.15; }
.msg img.media, .msg video.media {
  max-width: min(320px, 100%); max-height: 320px; border-radius: 12px; display: block; cursor: zoom-in;
  border: 1px solid var(--bord); background: var(--surface-2);
}
.msg audio { max-width: 300px; }
.fichier {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--bord);
  border-radius: 12px; padding: 10px 14px; text-decoration: none; color: var(--texte); max-width: 340px;
}
.fichier:hover { border-color: var(--bleuet); }
.fichier .ico { font-size: 28px; }
.fichier .nf { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legende { margin-top: 4px; }
.mention-sys { align-self: center; font-size: 13px; color: var(--texte-2); margin: 8px 0; }
.ecrit { height: 20px; padding: 0 20px; font-size: 12px; color: var(--texte-2); font-style: italic; }

/* Zone d'envoi */
.zone-envoi { padding: 0 14px 14px; position: relative; }
.barre-envoi {
  display: flex; align-items: flex-end; gap: 4px; background: var(--surface); border: 2px solid var(--bord);
  border-radius: 18px; padding: 5px;
}
.barre-envoi:focus-within { border-color: var(--bleuet); }
#saisie {
  flex: 1; border: 0 !important; background: transparent !important; resize: none; margin: 0 !important;
  padding: 9px 6px !important; max-height: 140px; line-height: 1.4;
}
.envoyer { background: var(--bleuet) !important; color: #fff; font-size: 18px; }
@media (prefers-color-scheme: dark) { .envoyer { color: #0f1022; } }
.panneau {
  position: absolute; bottom: calc(100% - 6px); left: 14px; width: min(380px, calc(100% - 28px));
  background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; box-shadow: var(--ombre);
  padding: 10px; z-index: 20; display: flex; flex-direction: column; height: 380px;
}
.panneau .recherche { margin: 0 0 8px; padding: 9px 12px; }
.panneau-onglets { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; margin-bottom: 8px; }
.panneau-onglets button { border: 0; background: transparent; font-size: 18px; padding: 4px 0; border-radius: 8px; cursor: pointer; }
.panneau-onglets button.actif { background: var(--bleuet-pale); }
.emoji-grille { display: grid; grid-template-columns: repeat(8, 1fr); overflow-y: auto; flex: 1; align-content: start; }
.emoji-grille button { border: 0; background: transparent; font-size: 24px; padding: 4px 0; border-radius: 8px; cursor: pointer; }
.emoji-grille button:hover { background: var(--surface-2); transform: scale(1.15); }
.emoji-grille h5 { grid-column: 1 / -1; margin: 8px 4px 4px; font-size: 12px; color: var(--texte-2); }
.gif-grille { columns: 2; column-gap: 6px; overflow-y: auto; flex: 1; }
.gif-grille img { width: 100%; border-radius: 8px; margin-bottom: 6px; cursor: pointer; display: block; break-inside: avoid; background: var(--surface-2); }
.gif-grille img:hover { outline: 3px solid var(--bleuet); }
.gif-grille p { column-span: all; color: var(--texte-2); font-size: 14px; text-align: center; padding: 10px; }
.gif-alt { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.apercu-fichier {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--bord);
  border-radius: 14px; padding: 8px 10px; margin-bottom: 8px;
}
.apercu-fichier img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }
.apercu-fichier .info { flex: 1; min-width: 0; }
.apercu-fichier .nf { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-progres { height: 4px; background: var(--surface-2); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.barre-progres div { height: 100%; width: 0; background: var(--bleuet); transition: width .2s; }
.depot {
  position: absolute; inset: 10px; border: 3px dashed var(--bleuet); border-radius: 20px;
  background: color-mix(in srgb, var(--bleuet-pale) 85%, transparent); display: flex; align-items: center;
  justify-content: center; font-size: 22px; font-weight: 700; z-index: 30; pointer-events: none;
}

/* Membres */
.membre .sous { font-size: 12px; }
.recherche { margin: 0 !important; }

/* Fenêtres modales */
.modal {
  border: 0; border-radius: 20px; padding: 0; width: min(460px, calc(100% - 24px)); background: var(--surface);
  color: var(--texte); box-shadow: var(--ombre); max-height: calc(100vh - 40px);
}
.modal::backdrop { background: rgba(15, 16, 34, .55); backdrop-filter: blur(3px); }
.profil-ban { height: 90px; background: linear-gradient(120deg, var(--bleuet), var(--lac)); }
.profil-corps { padding: 0 24px 24px; margin-top: -48px; }
.profil-corps .avatar { width: 96px; height: 96px; font-size: 36px; border: 4px solid var(--surface); }
.profil-corps h2 { margin: 8px 0 0; }
.profil-corps .infos { color: var(--texte-2); margin: 4px 0 14px; }
.profil-corps .section { margin: 14px 0; }
.profil-corps .section h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--texte-2); }
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; }
.etiquettes span { background: var(--bleuet-pale); color: var(--bleuet-fonce); border-radius: 99px; padding: 4px 11px; font-size: 13px; font-weight: 600; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.fermer { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .3); color: #fff; border: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px; }
.edition { padding: 24px; overflow: auto; }
.edition h2 { margin-top: 0; }
.modal-image { background: transparent; box-shadow: none; width: auto; max-width: 95vw; }
.modal-image img { max-width: 95vw; max-height: 90vh; border-radius: 12px; display: block; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--texte); color: var(--surface); padding: 10px 18px; border-radius: 12px; box-shadow: var(--ombre); animation: entre .25s; font-size: 14px; }
.toast.err { background: var(--erreur); color: #fff; }

/* Mobile */
.voile { display: none; }
@media (max-width: 980px) {
  .chat { grid-template-columns: 1fr; }
  .mobile-seul { display: inline-flex; }
  .barre-gauche, .barre-droite {
    position: fixed; top: 0; bottom: 0; width: 290px; max-width: 85vw; z-index: 50; transition: transform .25s;
    box-shadow: var(--ombre);
  }
  .barre-gauche { left: 0; transform: translateX(-100%); }
  .barre-droite { right: 0; transform: translateX(100%); }
  .barre-gauche.ouvert, .barre-droite.ouvert { transform: none; }
  .voile.ouvert { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
  .choix.deux { grid-template-columns: 1fr; }
  .carte { padding: 22px 18px; }
}
