/* ── Leaderboard page ── */
.lb-body {
  overflow-y: auto;
  overflow-x: hidden;
  background: #f0f4ec;
  min-height: 100vh;
}

.lb-body .logo { text-decoration: none; font-size: 1.5rem; font-weight: 800; letter-spacing: 2px; color: #a3e635; }

.lb-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Hero ── */
.lb-hero {
  background: linear-gradient(135deg, #1e4d14 0%, #2d6b1f 100%);
  border-radius: 20px;
  padding: 36px 32px;
  color: white;
  box-shadow: 0 8px 32px rgba(30,77,20,0.25);
  position: relative;
  overflow: hidden;
}

.lb-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.lb-hero-title { font-size: 2rem; font-weight: 900; letter-spacing: -0.5px; position: relative; }
.lb-hero-sub { color: #bbf7d0; margin-top: 6px; font-size: 0.95rem; position: relative; }

/* ── Leagues legend ── */
.lb-leagues {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.lb-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a2e12;
  margin-bottom: 16px;
}

.leagues-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.league-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid transparent;
}

.league-pill .league-icon { font-size: 1.1rem; }
.league-pill .league-pts { font-size: 0.75rem; font-weight: 500; opacity: 0.75; }

.league-promeneur  { background: #f3f4f6; border-color: #d1d5db; color: #374151; }
.league-randonneur { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.league-gardien    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.league-forestier  { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.league-legende    { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ── Period tabs (Semaine / Mois / Depuis toujours) ── */
.lb-tabs {
  display: flex;
  gap: 6px;
  background: white;
  padding: 6px;
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.lb-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lb-tab:hover { background: #f3f4f6; }

.lb-tab.active {
  background: #166534;
  color: white;
}

/* ── My rank card ── */
.lb-my-rank {
  background: white;
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid #a3e635;
}

.lb-my-rank.hidden { display: none; }

.my-rank-num {
  font-size: 2rem;
  font-weight: 900;
  color: #1e4d14;
  min-width: 48px;
  text-align: center;
}

.my-rank-info { flex: 1; }
.my-rank-name { font-weight: 700; font-size: 1.05rem; color: #1a2e12; }
.my-rank-league { font-size: 0.85rem; color: #4b7a3f; margin-top: 2px; }

.my-rank-stats { display: flex; gap: 16px; text-align: center; }
.my-rank-stat-num { font-size: 1.3rem; font-weight: 800; color: #1e4d14; display: block; }
.my-rank-stat-lbl { font-size: 0.72rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Table ── */
.lb-table-wrap {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
}

.lb-loading {
  padding: 48px;
  text-align: center;
  color: #6b7280;
  font-size: 0.95rem;
}

.lb-empty {
  padding: 48px;
  text-align: center;
  color: #6b7280;
}
.lb-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.lb-empty-text { font-size: 0.95rem; }

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #f0f0e8;
}

.lb-table thead th:last-child,
.lb-table tbody td:last-child { text-align: right; }

.lb-table tbody tr {
  border-bottom: 1px solid #f3f4ec;
  transition: background 0.15s;
}
.lb-table tbody tr:last-child { border-bottom: none; }
.lb-table tbody tr:hover { background: #fafdf7; }
.lb-table tbody tr.is-me { background: #f0fdf4; }
.lb-table tbody tr.is-me:hover { background: #ecfdf5; }

.lb-table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
}

.lb-rank-cell {
  font-weight: 800;
  font-size: 1rem;
  color: #1e4d14;
  min-width: 36px;
}

.lb-rank-cell.rank-1 { color: #f59e0b; }
.lb-rank-cell.rank-2 { color: #94a3b8; }
.lb-rank-cell.rank-3 { color: #b45309; }

.lb-medal { font-size: 1.2rem; }

.lb-user-cell { display: flex; align-items: center; gap: 10px; }

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #d1fae5;
  color: #065f46;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.lb-name { font-weight: 600; color: #1a2e12; }
.lb-name-you { font-size: 0.72rem; color: #16a34a; font-weight: 600; margin-left: 4px; background: #dcfce7; padding: 1px 6px; border-radius: 999px; }

.lb-league-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.lb-stat-cell { color: #374151; font-size: 0.92rem; text-align: center !important; }

.lb-cov-cell { min-width: 110px; }

.lb-cov-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-cov-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  min-width: 50px;
}

.lb-cov-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #16a34a);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.lb-cov-pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: #15803d;
  white-space: nowrap;
}

.lb-points-cell {
  font-weight: 800;
  font-size: 1rem;
  color: #1e4d14;
}

@media (max-width: 600px) {
  .lb-hero { padding: 28px 20px; }
  .lb-hero-title { font-size: 1.6rem; }
  .leagues-grid { gap: 8px; }
  .league-pill { padding: 6px 12px; font-size: 0.8rem; }
  .lb-my-rank { flex-wrap: wrap; }
  .my-rank-info { min-width: 0; }
  /* Let the stat trio wrap instead of forcing the card (and page) wider
     than the viewport on narrow screens. */
  .my-rank-stats { flex-wrap: wrap; justify-content: center; width: 100%; }

  .lb-table thead th.hide-mobile,
  .lb-table tbody td.hide-mobile { display: none; }

  /* Tighter cell padding so the 3 visible columns fit narrow phones (≤360px)
     without the table forcing the page wider than the viewport. */
  .lb-table thead th,
  .lb-table tbody td { padding-left: 10px; padding-right: 10px; }
}
