/* ============================================================
   CULTURILY — LEADERBOARD PAGE
   leaderboard.html — tabs, rows, rank badges, skeletons
   ============================================================ */

/* ── Loading splash ──────────────────────────────────────── */

.lb-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  min-height: 100dvh;
  background: var(--bg);
}

.lb-loading-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.lb-loading-logo-mark {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-loading-logo-mark svg {
  width: 24px;
  height: 24px;
}

.lb-loading-logo-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Page layout ─────────────────────────────────────────── */

.lb-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--app-width);
  margin-inline: auto;
  padding-bottom: calc(var(--nav-bottom-h) + var(--sp-4));
}

/* ── Header ──────────────────────────────────────────────── */

.lb-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  height: 56px;
  gap: var(--sp-3);
}

.lb-header-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.lb-header-back:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.lb-header-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.lb-header-spacer {
  width: 36px;
  flex-shrink: 0;
}

/* ── Tab bar ─────────────────────────────────────────────── */

.lb-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 56px;
  z-index: var(--z-sticky);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lb-tabs::-webkit-scrollbar { display: none; }

.lb-tab {
  flex: 1;
  min-width: 0;
  padding: var(--sp-3) var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-subtle);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition:
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.lb-tab:hover {
  color: var(--text-primary);
}

.lb-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Content area ────────────────────────────────────────── */

.lb-content {
  flex: 1;
  overflow-y: auto;
}

.lb-panel {
  padding: 0 var(--sp-4) var(--sp-6);
}

.lb-panel-desc {
  padding: var(--sp-4) 0 var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* ── Leaderboard row ─────────────────────────────────────── */

.lb-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: background var(--t-fast) var(--ease);
}

/* Top 3 get medal-colored borders */
.lb-row[data-rank="1"] {
  border-color: rgba(255, 215, 0, 0.5);
  background: linear-gradient(135deg, rgba(255,215,0,0.05) 0%, var(--surface) 100%);
}
.lb-row[data-rank="2"] {
  border-color: rgba(192, 192, 192, 0.4);
  background: linear-gradient(135deg, rgba(192,192,192,0.05) 0%, var(--surface) 100%);
}
.lb-row[data-rank="3"] {
  border-color: rgba(205, 127, 50, 0.4);
  background: linear-gradient(135deg, rgba(205,127,50,0.05) 0%, var(--surface) 100%);
}

/* Current user row */
.lb-row.is-me {
  border-color: rgba(204, 255, 0, 0.4);
  background: rgba(204, 255, 0, 0.04);
}

.lb-row.is-you-outside {
  background: rgba(204, 255, 0, 0.06);
}

/* ── Rank badge ──────────────────────────────────────────── */

.lb-rank {
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--text-subtle);
  line-height: 1;
}

.lb-rank-gold   { color: #FFD700; font-size: var(--text-lg); }
.lb-rank-silver { color: #B8C4CB; font-size: var(--text-lg); }
.lb-rank-bronze { color: #CD7F32; font-size: var(--text-lg); }
.lb-rank-you    { color: var(--accent); }

/* ── Avatar circle ───────────────────────────────────────── */

.lb-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1;
  user-select: none;
  letter-spacing: -0.02em;
}

/* ── Info column ─────────────────────────────────────────── */

.lb-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.lb-country {
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

.lb-country-flag {
  font-size: 20px;
  line-height: 1;
  user-select: none;
}

.lb-country-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-subtle);
}

/* "You" tag */
.lb-you-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #0e0e0e;
  padding: 1px 6px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* PRO badge */
.lb-super-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 800;
  background: var(--accent);
  color: #0e0e0e;
  padding: 1px 6px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Streak flame badge — 7 / 30 / 100 day thresholds */
.lb-streak-badge {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

/* XP crown badge — 1k / 5k / 10k thresholds */
.lb-crown {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  margin-right: 1px;
}

/* ── XP column ───────────────────────────────────────────── */

.lb-xp-col {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.lb-xp-value {
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.lb-xp-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* ── Separator (between top list and "You" row) ──────────── */

.lb-separator {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0 var(--sp-2);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lb-separator::before,
.lb-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Loading skeleton ────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

.lb-skeleton-rank,
.lb-skeleton-avatar,
.lb-skeleton-name,
.lb-skeleton-sub,
.lb-skeleton-xp {
  background: linear-gradient(
    90deg,
    var(--surface-3) 25%,
    var(--surface-4) 50%,
    var(--surface-3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}

.lb-skeleton-rank   { width: 28px; height: 16px; flex-shrink: 0; }
.lb-skeleton-avatar { width: 40px; height: 40px; border-radius: var(--r-full); flex-shrink: 0; }
.lb-skeleton-info   { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.lb-skeleton-name   { height: 13px; width: 52%; }
.lb-skeleton-sub    { height: 10px; width: 26%; }
.lb-skeleton-xp     { width: 46px; height: 16px; flex-shrink: 0; }

/* ── Empty state ─────────────────────────────────────────── */

.lb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-4);
  text-align: center;
}

.lb-empty-icon {
  font-size: 48px;
  line-height: 1;
}

.lb-empty-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.lb-empty-sub {
  font-size: var(--text-sm);
  color: var(--text-subtle);
  line-height: var(--leading-relaxed);
  max-width: 240px;
}
