/* ============================================================
   WCS Discord — refonte 2026
   Principes :
   - Palette resserrée (proche-noir chaud, accent indigo, teal pour vocal)
   - Zéro backdrop-filter, zéro keyframe continue, transitions ≤ 150ms
   - Hiérarchie typographique marquée (Inter), échelle spacing 4/6/8/12/16/20/24
   - Scroll fin, bordures 1px subtiles, micro-depth contrôlée
   - CPU-light : pas de filter/blur/shadow animé, GPU inactif au repos
   ============================================================ */

:root {
  /* Base chromatique */
  --bg-0:        #0a0a0d;   /* rail guildes, fond ultime */
  --bg-1:        #0f1015;   /* colonnes latérales */
  --bg-2:        #14151c;   /* main chat / surfaces */
  --bg-3:        #1a1c25;   /* cartes élevées */
  --bg-hover:    #1f212c;
  --bg-active:   #262938;

  /* Texte */
  --text-0:      #ececf1;   /* titres, messages */
  --text-1:      #b4b6c3;   /* corps secondaire */
  --text-2:      #7c7f90;   /* labels, hints */
  --text-3:      #4a4c5a;   /* séparateurs texte */

  /* Accents — indigo + teal (vocal/en ligne) */
  --accent:      #6366f1;
  --accent-2:    #818cf8;
  --accent-soft: rgba(99,102,241,0.14);
  --accent-ring: rgba(99,102,241,0.35);
  --grad:        linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  /* Signal */
  --online:      #22c55e;
  --voice:       #10b981;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --gold:        #fbbf24;

  /* Surfaces */
  --border:        rgba(255,255,255,0.055);
  --border-strong: rgba(255,255,255,0.11);
  --shadow-1:      0 1px 2px rgba(0,0,0,0.35);
  --shadow-2:      0 8px 28px rgba(0,0,0,0.45);
  --ring-focus:    0 0 0 3px var(--accent-ring);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Typo */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* Reset minimal ------------------------------------------------ */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-0);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; }
::selection { background: var(--accent-soft); color: var(--text-0); }

/* Scrollbar -------------------------------------------------- */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.07);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); background-clip: padding-box; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(99,102,241,0.18) 0%, transparent 60%),
    var(--bg-0);
  position: relative;
  overflow: hidden;
}
.auth-glow {
  position: absolute;
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(99,102,241,0.25), transparent 65%);
  top: -120px; left: 50%; transform: translateX(-50%);
  pointer-events: none;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 34px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-2);
}
.auth-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
}
.auth-logo {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--grad);
  display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
  color: white;
  box-shadow: 0 6px 18px rgba(99,102,241,0.35);
}
.auth-card h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.auth-card p  { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-card input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  color: var(--text-0);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.auth-card input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.auth-alt   { text-align: center; color: var(--text-2); font-size: 13px; margin-top: 4px; }
.auth-sep {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.09em;
  margin: 2px 0;
}
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
}

/* Boutons ---------------------------------------------------- */
.btn-primary {
  background: var(--grad);
  color: white;
  border-radius: var(--r-sm);
  padding: 11px 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: filter .12s, transform .08s, box-shadow .12s;
  box-shadow: 0 3px 10px rgba(99,102,241,0.28);
}
.btn-primary:hover  { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  color: var(--text-1);
  transition: background .12s, color .12s, border-color .12s;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-0); border-color: var(--border-strong); }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: white; color: #202124;
  border-radius: var(--r-sm);
  padding: 11px;
  font-weight: 600; font-size: 14px;
  text-decoration: none;
  transition: filter .12s, transform .08s;
  border: 1px solid transparent;
}
.btn-google:hover  { filter: brightness(0.97); text-decoration: none; color: #202124; }
.btn-google:active { transform: translateY(1px); }
.btn-google svg    { flex-shrink: 0; }

/* ============================================================
   APP SHELL — 4 colonnes
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 72px 252px 1fr 228px;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-0);
}

/* ---- col guildes (rail) ---- */
.col-guilds {
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: none;
}
.col-guilds::-webkit-scrollbar { width: 0; }

.guild-item {
  width: 48px; height: 48px;
  border-radius: 16px;
  background: var(--bg-2);
  display: grid; place-items: center;
  font-weight: 700; font-size: 18px;
  color: var(--text-0);
  cursor: pointer;
  position: relative;
  transition: border-radius .18s cubic-bezier(.2,1,.3,1), background .12s;
  flex-shrink: 0;
}
.guild-item:hover  { border-radius: 14px; background: var(--accent); color: white; }
.guild-item.active { border-radius: 14px; }
.guild-item.active::before {
  content: '';
  position: absolute;
  left: -14px; top: 50%;
  width: 4px; height: 36px;
  transform: translateY(-50%);
  background: var(--text-0);
  border-radius: 0 4px 4px 0;
}
.guild-item.home { background: var(--grad); color: white; }
.guild-item.home:hover { background: var(--grad); filter: brightness(1.08); }
.guild-item.add, .guild-item.join {
  background: var(--bg-2);
  color: var(--online);
  font-size: 22px;
  font-weight: 400;
}
.guild-item.join { color: var(--accent-2); }
.guild-item.add:hover  { background: var(--online); color: white; border-radius: 14px; }
.guild-item.join:hover { background: var(--accent); color: white; border-radius: 14px; }
.guild-sep {
  width: 32px; height: 2px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 4px 0;
}

/* icône guilde en image */
.guild-item.has-icon {
  background: transparent;
  padding: 0;
  overflow: visible;
  position: relative;
}
.guild-item.has-icon:hover { background: transparent; }
.guild-icon-img {
  width: 100%; height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
  transition: border-radius .18s cubic-bezier(.2,1,.3,1);
}
.guild-item.has-icon:hover .guild-icon-img { border-radius: 14px; }
.guild-owner-crown {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--bg-0);
  border: 1px solid var(--gold);
  border-radius: 50%;
  padding: 1px 3px;
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

/* ---- col channels ---- */
.col-channels {
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.channels-header {
  padding: 0 14px;
  height: 52px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.channels-header #guild-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channels-header button {
  color: var(--text-2);
  font-size: 15px;
  padding: 5px 7px;
  border-radius: var(--r-xs);
  transition: background .12s, color .12s;
}
.channels-header button:hover { color: var(--text-0); background: var(--bg-hover); }

.channels-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.channel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-1);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: background .1s, color .1s;
}
.channel-row:hover  { background: var(--bg-hover); color: var(--text-0); }
.channel-row.active { background: var(--bg-active); color: var(--text-0); }
.channel-row .hash  { color: var(--text-3); font-weight: 500; }
.channel-row.voice .hash { font-size: 14px; }
.channel-row.voice-active { color: var(--voice); }
.channel-row.voice-active .hash { color: var(--voice); }

.channel-create-row {
  display: flex;
  gap: 4px;
  margin: 4px 8px 10px;
}
.btn-inline-add {
  flex: 1;
  padding: 7px 10px;
  color: var(--text-2);
  text-align: left;
  font-size: 12.5px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--border-strong);
  transition: background .12s, color .12s, border-color .12s;
}
.btn-inline-add:hover { background: var(--bg-hover); color: var(--text-0); border-color: var(--accent); border-style: solid; }

/* voice occupants sous un channel vocal */
.voice-occupants {
  padding: 2px 0 6px 28px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.voice-occupant {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-1);
  padding: 3px 6px;
  border-radius: var(--r-xs);
  transition: background .1s;
}
.voice-occupant:hover { background: var(--bg-hover); }
.voice-occupant .avatar { width: 22px; height: 22px; font-size: 11px; }
.voice-occupant.speaking { background: rgba(16,185,129,0.09); }
.voice-occupant.speaking .avatar { box-shadow: 0 0 0 2px var(--voice); }
.voice-occupant .vo-flags {
  margin-left: auto;
  display: inline-flex;
  gap: 4px;
  font-size: 10px;
  opacity: .85;
}
.voice-occupant.deafened-flag .avatar { filter: grayscale(0.6); }

/* voice panel — barre de contrôle utilisateur */
.voice-panel {
  background: var(--bg-3);
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.voice-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.voice-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--voice);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-ico { font-size: 12px; }
.voice-panel-status {
  font-size: 11px;
  color: var(--text-2);
  flex-shrink: 0;
}
.voice-panel-actions { display: flex; gap: 6px; }
.vp-btn {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 7px;
  border-radius: var(--r-sm);
  color: var(--text-1);
  transition: background .12s, color .12s, border-color .12s;
  font-size: 14px;
}
.vp-btn:hover        { background: var(--bg-hover); color: var(--text-0); }
.vp-btn.active       { background: var(--danger); color: white; border-color: var(--danger); }
.vp-danger:hover     { background: var(--danger); color: white; border-color: var(--danger); }

/* user card (bas de col-channels) */
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.u-meta { flex: 1; min-width: 0; }
.u-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.u-status {
  font-size: 11px;
  color: var(--online);
  display: flex; align-items: center; gap: 4px;
}
.u-status::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--online);
  display: inline-block;
}
.u-logout {
  color: var(--text-2);
  font-size: 17px;
  padding: 6px 8px;
  border-radius: var(--r-xs);
  transition: color .12s, background .12s;
}
.u-logout:hover { color: var(--danger); background: var(--bg-hover); }

/* Avatars ---------------------------------------------------- */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  display: grid; place-items: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  font-size: 14px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}
.avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.avatar-uploader { position: relative; cursor: pointer; display: inline-flex; }
.avatar-uploader .avatar-edit-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  display: grid; place-items: center;
  font-size: 13px;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
}
.avatar-uploader:hover .avatar-edit-overlay { opacity: 1; }
.avatar.online::after {
  content: '';
  position: absolute;
  right: -1px; bottom: -1px;
  width: 12px; height: 12px;
  background: var(--online);
  border-radius: 50%;
  border: 2px solid var(--bg-1);
}
.avatar.has-border {
  box-shadow: 0 0 0 3px var(--bc, transparent);
  outline: 1px solid rgba(0,0,0,0.3);
  outline-offset: 2px;
}

/* ---- col main ---- */
.col-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-2);
  min-width: 0;
}
.chat-header {
  padding: 0 20px;
  height: 52px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
}
.chat-header .hash        { color: var(--text-3); font-size: 20px; font-weight: 500; }
.chat-header #channel-name{ font-weight: 600; font-size: 15px; letter-spacing: -0.005em; }
.chat-header .divider     { color: var(--text-3); margin: 0 4px; }
.chat-header .topic       { color: var(--text-2); font-size: 13px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}

/* message groups */
.msg-group {
  display: flex;
  gap: 14px;
  padding: 6px 20px 2px;
  position: relative;
}
.msg-group:hover { background: rgba(255,255,255,0.018); }
.msg-group.continuation { padding-top: 0; padding-bottom: 0; }
.msg-group.continuation .avatar { visibility: hidden; height: 0; }
.msg-avatar { width: 40px; flex-shrink: 0; }
.msg-avatar .avatar { width: 40px; height: 40px; font-size: 15px; }
.msg-body { flex: 1; min-width: 0; }
.msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.msg-author {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-0);
}
.msg-time { color: var(--text-3); font-size: 11px; }
.msg-content {
  color: var(--text-1);
  line-height: 1.5;
  font-size: 14.5px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-content code {
  background: var(--bg-0);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #e7e9ff;
}
.msg-content pre {
  background: var(--bg-0);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  margin: 6px 0;
  color: #e7e9ff;
}
.msg-content .mention {
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 0 4px;
  border-radius: var(--r-xs);
  font-weight: 500;
}
.msg-content a { color: var(--accent-2); }
.msg-content a:hover { text-decoration: underline; text-underline-offset: 2px; }

.typing-indicator {
  padding: 0 20px;
  min-height: 20px;
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
  flex-shrink: 0;
}
.typing-indicator:empty { height: 0; min-height: 0; }

/* composer */
.chat-composer {
  padding: 4px 20px 20px;
  flex-shrink: 0;
  position: relative;
}
.chat-composer textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 52px 13px 16px;
  color: var(--text-0);
  resize: none;
  outline: none;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.45;
  transition: border-color .12s, box-shadow .12s;
}
.chat-composer textarea::placeholder { color: var(--text-3); }
.chat-composer textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.chat-composer #btn-send {
  position: absolute;
  right: 32px;
  bottom: 30px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad);
  color: white;
  display: grid; place-items: center;
  font-size: 13px;
  transition: transform .1s, filter .12s, opacity .12s;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.chat-composer #btn-send:hover  { filter: brightness(1.08); transform: scale(1.04); }
.chat-composer #btn-send:active { transform: scale(.95); }

/* ---- col membres ---- */
.col-members {
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}
.col-members header {
  padding: 16px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-2);
}
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: var(--r-xs);
  margin: 0 6px;
  opacity: .42;
  transition: background .1s, opacity .12s;
}
.member-row.online { opacity: 1; }
.member-row:hover  { background: var(--bg-hover); }
.member-row .avatar { width: 32px; height: 32px; font-size: 12px; }
.member-row .m-name { font-size: 13px; font-weight: 500; color: var(--text-1); }
.member-row.online .m-name { color: var(--text-0); }

/* ============================================================
   DM list (Accueil)
   ============================================================ */
.channels-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
}
.channels-section-head .btn-inline-add {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  border-radius: var(--r-xs);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  flex: 0;
}
.channels-section-head .btn-inline-add:hover {
  background: var(--bg-hover);
  color: var(--text-0);
  border-color: var(--accent);
  border-style: solid;
}
.dm-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  margin: 2px 4px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-2);
  transition: background .1s, color .1s;
}
.dm-row:hover  { background: var(--bg-hover); color: var(--text-0); }
.dm-row.active { background: var(--bg-active); color: var(--text-0); }
.dm-row .avatar { width: 32px; height: 32px; font-size: 13px; }
.dm-avatar-wrap { position: relative; }
.dm-online-dot {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 10px; height: 10px;
  background: var(--online);
  border-radius: 50%;
  border: 2px solid var(--bg-1);
}
.dm-meta    { min-width: 0; overflow: hidden; }
.dm-name    { font-size: 14px; font-weight: 600; color: var(--text-0); text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.dm-preview { font-size: 12px; color: var(--text-3); text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.dm-unread {
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.68);
  display: grid;
  place-items: center;
  z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 92%;
  max-width: 440px;
  box-shadow: var(--shadow-2);
  max-height: 88vh;
  overflow-y: auto;
}
.modal h2 {
  margin: 0 0 16px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.modal input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  color: var(--text-0);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.modal input:focus { border-color: var(--accent); box-shadow: var(--ring-focus); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}
.modal .info {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  color: var(--accent-2);
  font-size: 13px;
  word-break: break-all;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 64px 220px 1fr; }
  .col-members { display: none; }
}
@media (max-width: 640px) {
  .app-shell { grid-template-columns: 56px 1fr; }
  .col-channels { display: none; }
}

/* ============================================================
   VOICE STAGE — vue salon vocal (vidéo / participants)
   ============================================================ */
.voice-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
  background: var(--bg-0);
  overflow: hidden;
}
.voice-stage-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: minmax(180px, 1fr);
  gap: 12px;
  align-content: center;
  justify-content: center;
  overflow: auto;
}
.voice-stage-grid:empty { display: none; }
.voice-stage-empty {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
  padding: 40px 20px;
}
.voice-stage-grid:not(:empty) + .voice-stage-empty { display: none; }
.voice-stage[hidden] { display: none; }

.voice-stage .video-tile {
  position: relative;
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 2px solid transparent;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  transition: border-color .15s;
  cursor: pointer;
}
.voice-stage .video-tile.local     { border-color: var(--accent); }
.voice-stage .video-tile.speaking  { border-color: var(--voice); }
.voice-stage .video-tile:hover     { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice-stage .video-tile video {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.voice-stage .video-tile .vt-label {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.72);
  color: white;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08);
}
.voice-stage .video-tile .vt-kind { font-size: 13px; }

.voice-stage-participants {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 4px 4px;
  border-top: 1px solid var(--border);
}
.voice-stage-participants:empty { display: none; }
.vsp-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--bg-2);
  border: 1px solid var(--border);
  min-width: 96px;
  position: relative;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.vsp-tile:hover           { background: var(--bg-hover); border-color: var(--border-strong); }
.vsp-tile.speaking        { box-shadow: 0 0 0 2px var(--voice); border-color: transparent; }
.vsp-tile.muted-flag::after {
  content: '🎙';
  position: absolute; right: 4px; top: 4px;
  font-size: 11px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  line-height: 1;
}
.vsp-tile .avatar { width: 52px; height: 52px; font-size: 20px; }
.vsp-tile .vsp-name {
  font-size: 12px;
  color: var(--text-1);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* ============================================================
   BADGES & DISTINCTIONS
   ============================================================ */
.admin-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--gold);
  margin-left: 4px;
}
.owner-crown {
  display: inline-block;
  font-size: 12px;
  margin-right: 3px;
}
.owner-badge {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1b1b1f;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 4px;
}

/* bouton header générique (utilisé hors channels-header) */
.header-btn {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--text-2);
  font-size: 15px;
  user-select: none;
  transition: background .12s, color .12s;
}
.header-btn:hover { background: var(--bg-hover); color: var(--text-0); }

/* ============================================================
   POPUP PROFIL
   ============================================================ */
.profile-pop { display: flex; flex-direction: column; gap: 18px; }
.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
}
.avatar.profile-big {
  width: 96px; height: 96px;
  font-size: 36px;
}
.avatar.profile-big.has-border {
  box-shadow: 0 0 0 5px var(--bc, transparent);
}
.profile-ident { flex: 1; min-width: 0; }
.profile-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-rank-line {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rank-ring-inline {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--bc, #4f545c);
  background: transparent;
}
.profile-status {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--bg-3);
  color: var(--text-2);
  font-weight: 600;
}
.profile-status.online {
  background: rgba(34,197,94,0.2);
  color: var(--online);
}
.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 13px;
}
.stat-k {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.stat-v {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-0);
  margin-top: 2px;
  letter-spacing: -0.01em;
}
.profile-section { display: flex; flex-direction: column; gap: 8px; }
.profile-section-title {
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}
.profile-hint { font-size: 12px; color: var(--text-3); }

.rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.rank-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform .1s, border-color .12s, background .12s;
  position: relative;
}
.rank-card:hover { transform: translateY(-1px); border-color: var(--accent); background: var(--bg-3); }
.rank-card.locked { opacity: 0.42; cursor: not-allowed; }
.rank-card.locked:hover { transform: none; border-color: var(--border); background: var(--bg-2); }
.rank-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(99,102,241,0.2);
}
.rank-ring {
  width: 36px; height: 36px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--bc, #4f545c);
}
.rank-label { font-size: 12px; font-weight: 600; color: var(--text-1); text-align: center; }
.rank-thr   { font-size: 10px; color: var(--text-3); }
.rank-grid.readonly .rank-card { cursor: default; }
.rank-grid.readonly .rank-card:hover { transform: none; border-color: var(--border); background: var(--bg-2); }

.profile-actions-row { display: flex; gap: 8px; justify-content: flex-end; }

#user-card-avatar.has-border {
  box-shadow: 0 0 0 3px var(--bc, transparent);
}

/* chips serveurs possédés (popup profil) */
.owned-guilds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.og-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  font-size: 12px;
  color: var(--text-1);
}
.og-chip img,
.og-chip .og-letter {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  object-fit: cover;
}

/* ============================================================
   MENU CONTEXTUEL (clic droit guilde)
   ============================================================ */
.guild-ctx-menu {
  position: fixed;
  z-index: 10000;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  padding: 4px;
  min-width: 220px;
}
.gcm-header {
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gcm-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text-1);
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13px;
  cursor: pointer;
  transition: background .1s, color .1s;
}
.gcm-item:hover         { background: var(--accent); color: white; }
.gcm-item.danger        { color: var(--danger); }
.gcm-item.danger:hover  { background: var(--danger); color: white; }

/* ============================================================
   ACCESSIBILITÉ : réduire encore si prefers-reduced-motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
