/* ── THEME VARIABLES ── */
[data-theme="dark"] {
  --keep: #22c55e;
  --skip: #ef4444;
  --bg: #07070c;
  --surface: rgba(255,255,255,.05);
  --card-bg: rgba(255,255,255,.07);
  --border: rgba(255,255,255,.09);
  --text: #f5f5ff;
  --muted: rgba(255,255,255,.5);
  --header-bg: rgba(7,7,12,.75);
  --input-bg: rgba(255,255,255,.05);
  --shadow: 0 24px 64px rgba(0,0,0,.55);
  --radius: 22px;
  --glow-keep: rgba(34,197,94,.18);
}
[data-theme="light"] {
  --keep: #16a34a;
  --skip: #dc2626;
  --bg: #f0f0f5;
  --surface: rgba(0,0,0,.04);
  --card-bg: #ffffff;
  --border: rgba(0,0,0,.1);
  --text: #0f0f1a;
  --muted: rgba(0,0,0,.45);
  --header-bg: rgba(240,240,245,.85);
  --input-bg: rgba(0,0,0,.04);
  --shadow: 0 24px 64px rgba(0,0,0,.12);
  --radius: 22px;
  --glow-keep: rgba(22,163,74,.12);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}
[data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% 0%, rgba(99,102,241,.13), transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(34,197,94,.1), transparent 45%),
    var(--bg);
}

/* ── HEADER ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.logo { font-family:'Syne',sans-serif; font-weight:800; font-size:1.35rem; letter-spacing:-.04em; }
.logo span { color: var(--keep); }
.header-right { display:flex; align-items:center; gap:1.2rem; }
.back-link { 
  color: var(--muted); 
  text-decoration: none; 
  font-size: .85rem;
  transition: color .2s;
}
.back-link:hover { color: var(--text); }
.theme-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; transition: all .2s;
}
.theme-btn:hover { transform: rotate(20deg) scale(1.1); }

/* ── MAIN ── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-title {
  text-align: center;
  margin-bottom: 3rem;
}
.page-title h1 {
  font-family: 'Syne', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: .5rem;
}
.page-title p {
  font-size: 1rem;
  color: var(--muted);
}

/* ── LEADERBOARD SECTIONS ── */
.lb-section {
  margin-bottom: 3rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.lb-section-title {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  margin-bottom: 1.8rem;
}

.lb-section-title .emoji {
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: var(--glow-keep);
  border: 2px solid var(--keep);
  border-radius: 12px;
  flex-shrink: 0;
}

.lb-section-title h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: .3rem;
}

.lb-section-title p {
  font-size: .9rem;
  color: var(--muted);
}

/* ── LEADERBOARD TABLE ── */
.lb-table {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all .2s;
  cursor: default;
}

.lb-row:hover {
  background: rgba(34,197,94,.1);
  border-color: rgba(34,197,94,.3);
  transform: translateX(4px);
}

.lb-rank {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--keep);
  min-width: 50px;
  text-align: center;
}

.lb-rank.first { font-size: 1.6rem; }
.lb-rank.first::before { content: "🥇 "; }
.lb-rank.second::before { content: "🥈 "; font-size: 1.2rem; }
.lb-rank.third::before { content: "🥉 "; font-size: 1.2rem; }

.lb-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--glow-keep);
  border: 2px solid var(--keep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--keep);
  flex-shrink: 0;
}

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .2rem;
}

.lb-email {
  font-size: .8rem;
  color: var(--muted);
}

.lb-stat {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .8rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 90px;
  text-align: center;
  flex-direction: column;
}

.lb-stat-val {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--keep);
}

.lb-stat-label {
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: .9rem;
}

/* ── THEME TOGGLE ── */
.theme-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all .2s;
}

.theme-btn:hover {
  transform: rotate(20deg) scale(1.1);
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .main { padding: 1.5rem 1rem; }
  .page-title h1 { font-size: 1.6rem; }
  .lb-section { padding: 1.5rem; }
  .lb-section-title { gap: .8rem; }
  .lb-section-title .emoji { width: 50px; height: 50px; font-size: 2rem; }
  .lb-row { flex-direction: column; gap: .8rem; }
  .lb-info { text-align: center; }
  .lb-stats { justify-content: center; flex-wrap: wrap; }
  .lb-stat { min-width: auto; flex: 0 1 calc(50% - .5rem); }
}

@media (max-width: 480px) {
  header { padding: .75rem 1rem; }
  .logo { font-size: 1.1rem; }
  .header-right { gap: .8rem; }
  .back-link { font-size: .75rem; }
  .main { padding: 1rem .75rem; }
  .page-title h1 { font-size: 1.4rem; }
  .lb-section { padding: 1rem; margin-bottom: 2rem; }
  .lb-section-title .emoji { width: 45px; height: 45px; font-size: 1.5rem; }
  .lb-row { padding: .75rem; }
  .lb-avatar { width: 40px; height: 40px; font-size: .9rem; }
}
