/* ===== TOPBAR UNIVERSELLE ===== */
#topbar-btns {
  position: fixed;
  top: 12px; right: 16px;
  display: flex; align-items: center; gap: 8px;
  z-index: 500;
}

/* Wrapper dropdown langue */
#tb-lang-wrap {
  position: relative;
}
#tb-lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: rgba(10, 20, 35, 0.97);
  border: 1px solid #1e3a5f;
  border-radius: 10px;
  padding: 5px;
  gap: 3px;
  flex-direction: column;
  min-width: 100px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  z-index: 600;
}
#tb-lang-menu.ouvert { display: flex; }
.tb-lang-opt {
  background: none;
  border: none;
  color: #94a3b8;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 13px; font-weight: 600;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.tb-lang-opt:hover { background: #162840; color: #e2e8f0; }
.tb-lang-opt.actif  { background: rgba(34,197,94,0.12); color: #22c55e; }

/* Pills langue dans le panel profil */
.lang-pills {
  display: flex; gap: 6px; flex: 1; justify-content: flex-end;
}
.lang-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid #1e3a5f;
  color: #64748b;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 12px; font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.lang-pill:hover { border-color: #2d5a8f; color: #e2e8f0; }
.lang-pill.actif  { background: rgba(34,197,94,0.12); border-color: #22c55e; color: #22c55e; }

.tb-btn {
  background: rgba(15, 31, 53, 0.92);
  border: 1px solid #1e3a5f;
  border-radius: 10px;
  color: #94a3b8;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 13px; font-weight: 600;
  padding: 7px 13px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  backdrop-filter: blur(10px);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  user-select: none;
}
.tb-btn:hover {
  background: #162840;
  border-color: #2d5a8f;
  color: #e2e8f0;
}
.tb-btn.actif {
  border-color: #22c55e;
  color: #22c55e;
}

/* Mini-avatar dans le bouton profil */
.tb-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: white;
  flex-shrink: 0;
}

/* ===== PANNEAU PROFIL ===== */
#profil-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 490;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
#profil-overlay.ouvert {
  opacity: 1; pointer-events: all;
}

#profil-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 320px; max-width: 90vw;
  background: #0f1f35;
  border-left: 1px solid #1e3a5f;
  z-index: 495;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
#profil-panel.ouvert {
  transform: translateX(0);
}

#profil-header {
  padding: 64px 20px 16px; /* top padding to clear topbar buttons */
  border-bottom: 1px solid #1e3a5f;
  display: flex; align-items: center; justify-content: space-between;
}
#profil-header h3 {
  font-size: 16px; font-weight: 800; color: #e2e8f0;
}
#profil-fermer {
  background: rgba(15,31,53,0.9);
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  color: #94a3b8; font-size: 16px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
#profil-fermer:hover { color: #e2e8f0; background: #162840; }

#profil-avatar-zone {
  padding: 28px 20px 20px;
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  border-bottom: 1px solid #1e3a5f;
}
#profil-avatar-cercle {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: white;
  border: 3px solid #1e3a5f;
}
#profil-pseudo-texte {
  font-size: 17px; font-weight: 800; color: #e2e8f0;
}

.profil-section {
  padding: 18px 20px;
  border-bottom: 1px solid #1e3a5f;
}
.profil-section-titre {
  font-size: 10px; font-weight: 700;
  color: #334155; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 12px;
}
.profil-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: #162840; border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px; color: #94a3b8;
}
.profil-row-icon { font-size: 17px; }

.profil-bientot {
  display: inline-flex; align-items: center;
  gap: 6px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  color: #f59e0b;
  font-size: 11px; font-weight: 700;
  border-radius: 20px; padding: 3px 10px;
  text-transform: uppercase; letter-spacing: 0.3px;
  margin-top: 6px;
}

#profil-version {
  padding: 16px 20px;
  margin-top: auto;
  font-size: 11px; color: #334155; text-align: center;
}

/* ===== PROFIL CONNECTÉ ===== */
#profil-avatar-zone {
  padding: 28px 20px 20px;
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  border-bottom: 1px solid #1e3a5f;
}
#profil-avatar-cercle {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: white;
  border: 3px solid rgba(255,255,255,0.15);
  transition: background 0.2s;
}
#profil-pseudo-texte {
  font-size: 16px; font-weight: 800; color: #e2e8f0;
}
.profil-section {
  padding: 16px 20px;
  border-bottom: 1px solid #1e3a5f;
}
.profil-section-titre {
  font-size: 10px; font-weight: 700;
  color: #334155; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 10px;
}
.profil-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: #162840; border-radius: 10px;
  font-size: 13px; color: #94a3b8;
  transition: background 0.15s;
}
.profil-row:hover { background: #1a2f4a; }
#profil-contenu .auth-field input {
  background: #162840;
  border: 2px solid #1e3a5f;
  border-radius: 10px; padding: 10px 14px;
  font-size: 14px; font-weight: 600;
  font-family: inherit; color: #e2e8f0;
  outline: none; width: 100%;
  transition: border-color 0.2s;
}
#profil-contenu .auth-field input:focus { border-color: #f59e0b; }

/* ===== HISTORIQUE PARTIES ===== */
.hist-row {
  display: grid;
  grid-template-columns: 20px 58px 1fr 60px 40px;
  align-items: center;
  gap: 6px;
  cursor: default;
}
.hist-result { font-size: 14px; text-align: center; }
.hist-jeu-badge {
  font-size: 10px; font-weight: 700; text-align: center;
  background: #1e3a5f; color: #93c5fd; border-radius: 8px;
  padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-vs { font-size: 12px; color: #94a3b8;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-score { font-weight: 700; color: #f59e0b; font-size: 11px; text-align: right; }
.hist-date  { color: #334155; font-size: 10px; text-align: right; }
