/* ── Variables (même thème que top10) ── */
:root {
  --bg: #0b0e14;
  --panel: #111726;
  --line: #1a2236;
  --text: #e8eefc;
  --muted: #9aa3b2;
  --gold: #ffd166;
  --header-height: 58px;
  --bottom-safe: 20px;
}

/* ── Reset & base ── */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: linear-gradient(180deg, #0b0e14, #0d111d);
  color: var(--text);
  font:
    16px/1.45 Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0b0e14;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-bar {
  max-width: 1100px;
  margin: 0 auto;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
}

.lang-switcher {
  display: inline-flex !important;
  align-items: center !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
}
.lang-btn {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.35) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 0 5px !important;
  text-shadow: none !important;
}
.lang-btn.active {
  color: #fff !important;
}
.lang-btn:focus,
.lang-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
.lang-sep {
  color: rgba(255, 255, 255, 0.2);
  font-size: 11px;
  pointer-events: none;
}

.brand {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.header-tabs {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}


/* ── Nav right (user info) ── */
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.username {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.profile-link,
.stats-button,
.records-button,
.suggest-button,
.likes-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.profile-link:hover,
.stats-button:hover,
.records-button:hover,
.likes-button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.stats-button {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.3);
}
.records-button {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}
.likes-button {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.3);
}
.suggest-button {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.3);
}
.logout-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: border-color 0.15s;
}

.logout-button:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.google-icon {
  width: 18px;
  height: 18px;
}

/* ── Zone scrollable ── */
.main-content {
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--bottom-safe);
  box-sizing: border-box;
}

/* ── Container ── */
.ranking-container {
  max-width: 1100px;
  margin: 28px auto 40px;
  padding: 0 16px;
}

/* ── Titre ── */
h1 {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: clamp(20px, 3.5vw, 28px);
  text-align: center;
}

h1 #ranking-scope {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.9em;
}

/* ── Records restants ── */
#records-restants {
  font-size: 18px;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
  margin: 8px 0 24px;
  letter-spacing: 0.02em;
}

/* ── Dropdown ── */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.custom-dropdown {
  position: relative;
  min-width: 240px;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: #1e2b45 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  text-align: left;
  font-family: inherit;
}

.dropdown-trigger:hover {
  background: #253452 !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.custom-dropdown.open .dropdown-trigger {
  background: #253452 !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.chevron {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.custom-dropdown.open .chevron {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 6px;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.custom-dropdown.open .dropdown-menu {
  display: block;
  animation: ddIn 0.14s ease;
}

@keyframes ddIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-option {
  padding: 11px 16px;
  border-radius: 6px;
  font-size: 15px;
  color: #e8eefc;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s;
  font-family: inherit;
}

.dropdown-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-option.selected {
  color: #ffd166;
  background: rgba(255, 209, 102, 0.1);
  font-weight: 700;
}

/* ── Table ── */
.ranking-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.18); /* ← plus visible */
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  margin-top: 0;
}

.ranking-table thead th {
  text-align: left;
  font-weight: 600;
  color: #cdd6f4;
  background: #0f1629;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ranking-table thead th:nth-child(1) {
  width: 50px;
  text-align: center;
}
.ranking-table thead th:nth-child(2) {
  width: 60px;
  text-align: center;
}

.ranking-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
  font-size: 14px;
}

.ranking-table tbody tr:last-child td {
  border-bottom: 0;
}

.ranking-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Rang centré */
.ranking-table tbody td:nth-child(1) {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  font-size: 15px;
}

/* Top 3 rang en couleur */
.ranking-table tbody tr:nth-child(1) td:nth-child(1) {
  color: var(--gold);
}
.ranking-table tbody tr:nth-child(2) td:nth-child(1) {
  color: #d1d5db;
}
.ranking-table tbody tr:nth-child(3) td:nth-child(1) {
  color: #d3956b;
}

.ranking-table tbody tr:nth-child(-n+3) td {
  padding-top: 18px;
}

/* Avatar centré */
.ranking-table tbody td:nth-child(2) {
  text-align: center;
}

.ranking-table td img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Lien joueur */
.ranking-table a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
}

.ranking-table a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* ── Mobile ── */
@media (max-width: 800px) {
  :root {
    --header-height: 52px;
  }

  .header-tabs {
    gap: 4px !important;
  }

  .header-tabs .tab-link {
    font-size: 10px !important;
    padding: 4px 5px !important;
    gap: 3px !important;
    white-space: nowrap;
  }

  .header-bar {
    height: 48px !important;
    padding: 0 8px !important;
    gap: 6px !important;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .brand {
    font-size: 13px !important;
  }
  .tab-link {
    font-size: 11px !important;
    padding: 4px 6px !important;
  }

  .nav-right .records-button,
  .nav-right .likes-button,
  .nav-right .logout-button,
  .nav-right .profile-link {
    display: none !important;
  }

  .nav-right .stats-button {
    font-size: 11px !important;
    padding: 4px 7px !important;
  }
  .profile-img {
    width: 26px !important;
    height: 26px !important;
  }
  .username {
    font-size: 12px !important;
  }

  .ranking-container {
    margin: 12px auto;
    padding: 0 8px;
  }

  h1 {
    font-size: 18px !important;
  }
  #records-restants {
    font-size: 14px !important;
    margin: 6px 0 14px;
  }

  .controls {
    margin-bottom: 16px;
  }
  .custom-dropdown {
    min-width: unset;
    width: 100%;
  }

  .ranking-table thead th,
  .ranking-table tbody td {
    padding: 10px 8px !important;
    font-size: 13px !important;
  }

  .ranking-table th:nth-child(n + 4):not(:last-child),
  .ranking-table td:nth-child(n + 4):not(:last-child) {
    display: none !important;
  }

  .ranking-table td img {
    width: 32px !important;
    height: 32px !important;
  }

  .login-button-google {
    font-size: 12px !important;
    padding: 6px 12px !important;
    gap: 6px !important;
  }

  .login-button-google .google-icon {
    width: 16px !important;
    height: 16px !important;
  }

  .login-button-google span {
    display: inline !important;
  }
}

@media (max-width: 480px) {
  .tab-link {
    font-size: 10px !important;
    padding: 4px 5px !important;
  }
  .brand {
    font-size: 13px !important;
  }
  .username {
    display: none !important;
  }

  .lang-switcher {
    display: none !important;
  }

  /* Garde Rang + Avatar + Joueur + Records, cache seulement les colonnes du milieu */
  .ranking-table th:nth-child(n + 4):not(:last-child),
  .ranking-table td:nth-child(n + 4):not(:last-child) {
    display: none !important;
  }

  /* Cache XP Total sur mobile, garde Niveau */
  #view-levels .ranking-table th:nth-child(5),
  #view-levels .ranking-table td:nth-child(5) {
    display: none !important;
  }
  #view-levels .ranking-table th:nth-child(4),
  #view-levels .ranking-table td:nth-child(4) {
    display: table-cell !important;
  }
}

@media (max-width: 768px) {
  .suggest-button {
    display: none !important;
  }
}

/*  TOGGLE RECORDS / NIVEAUX  */

.ranking-toggle {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.toggle-btn {
  padding: 8px 24px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: #9aa3b2;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.toggle-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: #e8eefc;
}

.toggle-btn.active {
  background: linear-gradient(135deg, #7c6aff, #9d8fff);
  border-color: transparent;
  color: #fff;
}

/* ══════════════════════════════════════════════════════════
   MODAL AUTH (Google / Twitch)
══════════════════════════════════════════════════════════ */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.auth-modal-box {
  position: relative;
  z-index: 10000;
  background: linear-gradient(180deg, #141a2a, #0f1423);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 40px 32px 32px;
  width: min(420px, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  overflow: hidden;
}

.auth-modal-close {
  all: unset;
  position: absolute;
  top: 14px;
  right: 16px;
  color: #9aa3b2;
  font-size: 22px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  z-index: 1;
}
.auth-modal-close:hover {
  opacity: 1;
  color: #fff;
}
.auth-modal-close:focus,
.auth-modal-close:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.auth-modal-title {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 8px;
}

.auth-modal-subtitle {
  font-size: 14px;
  color: #9aa3b2;
  margin: 0 0 28px;
}

.auth-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 0.15s,
    opacity 0.15s;
  cursor: pointer;
}
.auth-btn:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.auth-btn-google {
  background: #fff;
  color: #1e1b4b;
}

.auth-btn-twitch {
  background: #9146ff;
  color: #fff;
}

.auth-btn-discord {
  background: #5865f2;
  color: #fff;
  border: none;
}
.auth-btn-discord:hover {
  background: #4752c4;
}

/* ── Bouton connexion header ── */
a.login-button-google {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #1e1b4b;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity 0.15s;
}
a.login-button-google:hover {
  opacity: 0.9;
  color: #1e1b4b;
}

/* ── Bouton hero CTA ── */
a.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #081018;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
a.hero-cta:hover {
  opacity: 0.9;
  color: #081018;
}

/* ── Hamburger ── */
.hamburger-btn {
  display: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 20px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  z-index: 998;
}
.hamburger-btn:hover { background: rgba(255, 255, 255, 0.12); }

.hamburger-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 999;
}
.hamburger-overlay.open { display: block; }

.hamburger-panel {
  position: fixed;
  top: 0; right: 0;
  width: 280px;
  height: 100vh;
  background: #111827;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 20px 0 32px;
  overflow-y: auto;
}
.hamburger-panel.open { transform: translateX(0); }

.hamburger-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: #9aa3b2; font-size: 22px;
  cursor: pointer; opacity: 0.5;
}
.hamburger-close:hover { color: #fff; opacity: 1; }

.hamburger-user {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px 20px;
  border-bottom: 2px solid rgba(99, 120, 255, 0.5);
}
.hamburger-avatar {
  width: 40px; height: 40px;
  border-radius: 50%; object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}
.hamburger-username {
  font-size: 15px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.hamburger-links {
  display: flex; flex-direction: column;
  gap: 0; padding: 0 12px; flex: 1;
}
.hamburger-link {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  color: #e8eefc; text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid transparent;
  transition: background 0.15s, border-left 0.15s;
}
.hamburger-link:last-child { border-bottom: none; }
.hamburger-link:hover {
  background: rgba(99, 120, 255, 0.08);
  border-left: 3px solid rgba(99, 120, 255, 0.6);
  color: #fff;
}
.hamburger-logout {
  color: #9aa3b2; margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
  border-left: 3px solid transparent;
}
.hamburger-logout:hover {
  color: #fff;
  background: rgba(255, 80, 80, 0.08);
  border-left: 3px solid rgba(255, 80, 80, 0.5);
}
.hamburger-suggest { margin-top: 8px; }
.hamburger-login {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 16px; border-radius: 10px;
  color: #fff; font-size: 14px; font-weight: 500;
}
.hamburger-lang {
  display: flex; align-items: center;
  justify-content: center; gap: 4px;
  padding: 20px 20px 0;
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .nav-right .profile-link,
  .nav-right .stats-button,
  .nav-right .records-button,
  .nav-right .likes-button,
  .nav-right .suggest-button,
  .nav-right .logout-button,
  .nav-right .login-button-google,
  .nav-right .lang-switcher,
  .nav-right .username,
  .nav-right .profile-img,
  .header-tabs { display: none !important; }
  .nav-right {
    margin-left: auto;
    display: flex !important;
    align-items: center;
    gap: 8px;
    overflow: visible !important;
  }
  .header-bar {
    height: 56px !important;
    padding: 0 12px !important;
    gap: 0 !important;
  }
}

