/* light-theme: manual
   leaderboards.html: turns the JS-rendered podium (assets/js/leaderboards.js)
   into a real winners' stand - pillars with big rank numbers, a floating crown
   and glow for #1, staggered pop-in 3 -> 2 -> 1 - and the game tabs into a
   segmented control in each game's colour. CSS only, no change to the data logic. */

/* --- game tabs --- */
:root .lb-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 16px;
  border: 1px solid var(--nx-line);
  background: var(--nx-surface);
}

:root .lb-tab {
  --g: #38bdf8;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 700;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

:root .lb-tab[data-game="starjump"] { --g: #818cf8; }
:root .lb-tab[data-game="blockclicker"] { --g: #22c55e; }
:root .lb-tab[data-game="typeracer"] { --g: #38bdf8; }
:root .lb-tab[data-game="nexhero"] { --g: #a855f7; }

:root .lb-tab:hover { color: var(--g); }

:root .lb-tab.active {
  color: #fff;
  background: var(--g);
  border-color: transparent;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--g) 45%, transparent);
}

:root .lb-shell {
  border-radius: 28px;
  border-color: var(--nx-line);
  background: var(--nx-surface);
}

/* --- podium --- */
:root .lb-podium.lb-podium--visible {
  flex-wrap: nowrap;
  gap: 0.9rem;
  padding-top: 2.6rem;
  margin-bottom: 2rem;
}

:root .lb-podium-slot {
  --h: 70px;
  --tone: #94a3b8;
  flex: 1 1 0;
  max-width: 230px;
  margin-bottom: var(--h);
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent);
  background:
    radial-gradient(180px circle at 50% 0%, color-mix(in srgb, var(--tone) 22%, transparent), transparent 70%),
    var(--nx-surface-2);
  overflow: visible;
}

/* the pillar under each card */
:root .lb-podium-slot::after {
  content: attr(data-place);
  position: absolute;
  left: 6%;
  right: 6%;
  top: calc(100% + 8px);
  height: var(--h);
  display: grid;
  place-items: center;
  border-radius: 12px 12px 4px 4px;
  font-size: calc(var(--h) * 0.62);
  font-weight: 900;
  line-height: 1;
  color: color-mix(in srgb, var(--tone) 85%, #fff);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 35%, transparent), color-mix(in srgb, var(--tone) 6%, transparent));
  border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
  border-bottom: 0;
}

:root .lb-podium-slot--1 { --h: 120px; --tone: #fbbf24; box-shadow: 0 0 50px rgba(251, 191, 36, 0.25); }
:root .lb-podium-slot--2 { --h: 84px; --tone: #cbd5e1; }
:root .lb-podium-slot--3 { --h: 56px; --tone: #d97706; }

:root .lb-podium-slot--1::after { content: "1"; }
:root .lb-podium-slot--2::after { content: "2"; }
:root .lb-podium-slot--3::after { content: "3"; }

/* floating crown above #1 */
:root .lb-podium-slot--1::before {
  content: "👑";
  position: absolute;
  left: 50%;
  top: -1.9rem;
  translate: -50% 0;
  font-size: 2rem;
  filter: drop-shadow(0 4px 10px rgba(251, 191, 36, 0.6));
  animation: lb-crown 2.6s ease-in-out infinite;
}

@keyframes lb-crown {
  0%, 100% { translate: -50% 0; rotate: -6deg; }
  50% { translate: -50% -6px; rotate: 6deg; }
}

:root .lb-podium-slot--1 .lb-podium-name { font-size: 1.25rem; }
:root .lb-podium-slot--1 .lb-podium-score { font-size: 1.5rem; }

/* staggered entrance: bronze, silver, then gold */
:root .lb-podium--visible .lb-podium-slot { animation: lb-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
:root .lb-podium--visible .lb-podium-slot--3 { animation-delay: 0.05s; }
:root .lb-podium--visible .lb-podium-slot--2 { animation-delay: 0.2s; }
:root .lb-podium--visible .lb-podium-slot--1 { animation-delay: 0.38s; }

@keyframes lb-pop {
  from { opacity: 0; transform: translateY(40px) scale(0.85); }
  to { opacity: 1; transform: none; }
}

/* --- table --- */
:root .lb-table tbody tr { transition: background 0.2s ease; }
:root .lb-table tbody tr:hover { background: rgba(56, 189, 248, 0.07); }

@media (max-width: 600px) {
  :root .lb-podium.lb-podium--visible { gap: 0.4rem; }
  :root .lb-podium-slot { min-width: 0; padding: 0.8rem 0.4rem; }
  :root .lb-podium-slot--1 { --h: 90px; }
  :root .lb-podium-slot--2 { --h: 64px; }
  :root .lb-podium-slot--3 { --h: 44px; }
  :root .lb-podium-name { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  :root .lb-podium-slot--1::before,
  :root .lb-podium--visible .lb-podium-slot { animation: none; }
}

html[data-theme="light"] .lb-podium-slot::after { color: color-mix(in srgb, var(--tone) 70%, #000); }
html[data-theme="light"] .lb-podium-slot--2 { --tone: #64748b; }
