/* ==========================================================
   MgtsPayments — Leaderboard
   Shared by the public page, the user dashboard page and the rules page.
   All selectors are namespaced .lb-* to avoid collisions.
   ========================================================== */
.lb-scope {
  --lb-primary: #2966cb;
  --lb-ink: #0f172a;
  --lb-muted: #64748b;
  --lb-line: #e8edf5;
  --lb-surface: #ffffff;
  --lb-surface-alt: #f7f9fc;
  --lb-gold: #e0a83b;
  --lb-silver: #a4acb9;
  --lb-bronze: #bd7a4a;
  --lb-up: #12805c;
  --lb-down: #c0392b;
  --lb-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Countdown ---------- */
.lb-countdown {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  padding: 10px 20px;
  color: #fff;
  white-space: nowrap;
}
.lb-countdown--light { background: var(--lb-surface-alt); border: 1px solid var(--lb-line); color: var(--lb-ink); }
.lb-clock { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .02em; }
.lb-pulse { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); animation: lb-pulse 2s infinite; flex: 0 0 auto; }
@keyframes lb-pulse { 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

/* ---------- Tabs ---------- */
.lb-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 5px;
  background: var(--lb-surface-alt);
  border: 1px solid var(--lb-line);
  border-radius: 999px;
  scrollbar-width: none;
  width: max-content;
  max-width: 100%;
}
.lb-tabs::-webkit-scrollbar { display: none; }
.lb-tab {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--lb-muted);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background-color .25s var(--lb-ease), color .25s, box-shadow .25s;
}
.lb-tab:hover { color: var(--lb-ink); }
.lb-tab.is-active { background: #fff; color: var(--lb-primary); box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }

/* ---------- Board panels ---------- */
.lb-panel[hidden] { display: none !important; }
.lb-panel.is-entering .lb-podium-card,
.lb-panel.is-entering .lb-row { animation: lb-rise .6s var(--lb-ease) both; }
.lb-panel.is-entering .lb-podium-card--2 { animation-delay: 80ms; }
.lb-panel.is-entering .lb-podium-card--3 { animation-delay: 160ms; }
.lb-panel.is-entering .lb-row { animation-delay: calc(var(--i, 0) * 35ms + 180ms); }
@keyframes lb-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- Podium ---------- */
.lb-podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: end; margin: 26px 0 28px; }
.lb-podium-card {
  background: var(--lb-surface);
  border: 1px solid var(--lb-line);
  border-radius: 22px;
  padding: 28px 16px 22px;
  text-align: center;
  position: relative;
  transition: transform .3s var(--lb-ease), box-shadow .3s;
}
.lb-podium-card:hover { transform: translateY(-5px); box-shadow: 0 16px 36px rgba(15, 23, 42, .08); }
.lb-podium-card--1 { order: 2; padding-top: 38px; padding-bottom: 32px; border-color: var(--lb-gold); background: linear-gradient(180deg, #fffaf0 0%, #fff 60%); box-shadow: 0 14px 38px rgba(224, 168, 59, .2); }
.lb-podium-card--2 { order: 1; border-color: var(--lb-silver); }
.lb-podium-card--3 { order: 3; border-color: var(--lb-bronze); }
.lb-podium-card--empty { border-style: dashed; background: var(--lb-surface-alt); color: var(--lb-muted); }
.lb-crown { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); color: var(--lb-gold); font-size: 1.4rem; animation: lb-float 3s ease-in-out infinite; }
@keyframes lb-float { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }

.lb-medal { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; color: #fff; border: 3px solid #fff; }
.lb-podium-card--1 .lb-medal { background: var(--lb-gold); }
.lb-podium-card--2 .lb-medal { background: var(--lb-silver); }
.lb-podium-card--3 .lb-medal { background: var(--lb-bronze); }
.lb-podium-card--1 .lb-crown + .lb-medal { top: -14px; }

.lb-avatar { width: 52px; height: 52px; border-radius: 50%; background: #e8eefb; color: var(--lb-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; margin: 0 auto 12px; flex: 0 0 auto; }
.lb-podium-card--1 .lb-avatar { width: 68px; height: 68px; font-size: 1.2rem; background: #fdf0d5; color: #a86f10; }
.lb-handle { font-weight: 600; color: var(--lb-ink); margin-bottom: 4px; word-break: break-word; }
.lb-value { font-size: 1.35rem; font-weight: 800; color: var(--lb-primary); font-variant-numeric: tabular-nums; line-height: 1.2; }
.lb-podium-card--1 .lb-value { font-size: 1.6rem; }
.lb-unit { font-size: .78rem; color: var(--lb-muted); display: block; margin-top: 2px; }

/* ---------- Rank list ---------- */
.lb-list { background: var(--lb-surface); border: 1px solid var(--lb-line); border-radius: 20px; overflow: hidden; }
.lb-row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--lb-line); transition: background-color .2s; }
.lb-row:last-child { border-bottom: 0; }
.lb-row:hover { background: var(--lb-surface-alt); }
.lb-row.is-me { background: #eef4ff; }
.lb-rank { font-weight: 700; color: var(--lb-muted); font-variant-numeric: tabular-nums; text-align: center; }
.lb-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-identity .lb-avatar { width: 38px; height: 38px; font-size: .8rem; margin: 0; }
.lb-identity .lb-handle { margin: 0; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-metric { text-align: right; white-space: nowrap; }
.lb-metric .lb-value { font-size: 1.02rem; }
.lb-metric .lb-value small { font-size: .72rem; color: var(--lb-muted); font-weight: 600; }
.lb-you-chip { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--lb-primary); color: #fff; border-radius: 999px; padding: 2px 7px; margin-left: 6px; }

.lb-move { font-size: .74rem; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.lb-move--up { color: var(--lb-up); }
.lb-move--down { color: var(--lb-down); }
.lb-move--flat { color: var(--lb-muted); }
.lb-move--new { color: var(--lb-primary); }

/* ---------- Pinned "your position" bar ---------- */
.lb-you {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  margin-top: 18px;
  background: var(--lb-ink);
  color: #fff;
  border-radius: 18px;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 14px;
  box-shadow: 0 -6px 30px rgba(15, 23, 42, .2);
  animation: lb-rise .6s var(--lb-ease) both;
}
.lb-you .lb-rank, .lb-you .lb-handle { color: #fff; }
.lb-you .lb-value { color: #8fb4ff; }
.lb-you .lb-avatar { background: rgba(255, 255, 255, .16); color: #fff; }
.lb-you-hint { font-size: .85rem; color: #fff; font-weight: 500; line-height: 1.3; }
.lb-you-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .6); display: block; }

/* ---------- Notes & empty ---------- */
.lb-note { background: var(--lb-surface-alt); border: 1px solid var(--lb-line); border-radius: 16px; padding: 16px 20px; color: var(--lb-muted); font-size: .9rem; }
.lb-note i { color: var(--lb-primary); }
.lb-empty { padding: 44px 20px; text-align: center; color: var(--lb-muted); }
.lb-empty i { display: block; font-size: 2rem; color: #c7d7f5; margin-bottom: 8px; }

/* ---------- Rules page ---------- */
.lb-rule-card { background: var(--lb-surface); border: 1px solid var(--lb-line); border-radius: 20px; padding: 28px; transition: box-shadow .3s, transform .3s var(--lb-ease); }
.lb-rule-card:hover { box-shadow: 0 14px 34px rgba(15, 23, 42, .06); }
.lb-rule-num { width: 36px; height: 36px; border-radius: 12px; background: var(--lb-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; margin-bottom: 14px; }
.lb-boarddefs { margin: 0 0 12px; }
.lb-boarddef { display: grid; grid-template-columns: 210px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--lb-line); }
.lb-boarddef:first-of-type { padding-top: 0; }
.lb-boarddef:last-of-type { border-bottom: 0; padding-bottom: 0; }
.lb-boarddef dt { font-weight: 600; color: var(--lb-ink); }
.lb-boarddef dd { margin: 0; color: var(--lb-muted); line-height: 1.6; }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .lb-podium { grid-template-columns: 1fr; gap: 12px; }
  .lb-podium-card { display: flex; align-items: center; text-align: left; gap: 14px; padding: 16px 18px 16px 26px !important; }
  .lb-podium-card--1 { order: 1; }
  .lb-podium-card--2 { order: 2; }
  .lb-podium-card--3 { order: 3; }
  .lb-podium-card .lb-avatar, .lb-podium-card--1 .lb-avatar { margin: 0; width: 48px; height: 48px; font-size: .95rem; }
  .lb-crown { display: none; }
  .lb-medal { top: 50%; left: -10px; transform: translateY(-50%); width: 26px; height: 26px; font-size: .72rem; }
  .lb-podium-body { flex: 1; min-width: 0; }
  .lb-podium-body .lb-handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lb-value, .lb-podium-card--1 .lb-value { font-size: 1.1rem; }
  .lb-row, .lb-you { grid-template-columns: 34px 1fr auto; gap: 10px; padding: 12px 14px; }
  .lb-identity .lb-handle { font-size: .88rem; }
  .lb-boarddef { grid-template-columns: 1fr; gap: 6px; padding: 14px 0; }
  .lb-tabs { width: 100%; }
  .lb-tab { flex: 1 1 0; min-width: 0; justify-content: center; padding: 9px 6px; font-size: .8rem; }
  .lb-tab i { display: none; }
}
