/* ═══════════════════════════════════════
   TOKENS — DARK (default)
═══════════════════════════════════════ */
:root {
  --bg:        #050a18;
  --bg-2:      #080f20;
  --bg-3:      #0c1530;
  --bg-4:      #101d3e;
  --border:    rgba(28, 52, 108, 0.55);
  --border-hi: rgba(6, 182, 212, 0.28);

  --cyan:        #06b6d4;
  --cyan-bright: #22d3ee;
  --cyan-dim:    rgba(6, 182, 212, 0.12);

  --gold:    #f59e0b;
  --silver:  #94a3b8;
  --bronze:  #b97c3b;
  --green:   #10b981;
  --red:     #f43f5e;
  --orange:  #fb923c;

  --text:   #dde4f0;
  --text-2: #7a90b8;
  --text-3: #3e5070;

  --navbar-bg:   rgba(5, 10, 24, .85);
  --star-color:  rgba(180, 210, 255, 1);
}

/* ═══════════════════════════════════════
   TOKENS — LIGHT
═══════════════════════════════════════ */
[data-theme="light"] {
  --bg:        #f0f4ff;
  --bg-2:      #e6ecf8;
  --bg-3:      #dce4f5;
  --bg-4:      #cdd8ef;
  --border:    rgba(100, 140, 220, 0.3);
  --border-hi: rgba(6, 182, 212, 0.4);

  --cyan:        #0891b2;
  --cyan-bright: #06b6d4;
  --cyan-dim:    rgba(6, 182, 212, 0.1);

  --gold:    #d97706;
  --silver:  #64748b;
  --bronze:  #92400e;
  --green:   #059669;
  --red:     #e11d48;
  --orange:  #ea580c;

  --text:   #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --navbar-bg:   rgba(240, 244, 255, .88);
  --star-color:  rgba(80, 120, 200, 1);
}

/* ═══════════════════════════════════════
   RESET
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s ease, color .3s ease;
}

/* ═══════════════════════════════════════
   BACKGROUND LAYERS
═══════════════════════════════════════ */
#star-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.bg-nebula {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(100px);
}
.nebula-1 {
  width: 700px; height: 700px;
  top: -250px; left: -200px;
  background: radial-gradient(circle, rgba(6,182,212,.07) 0%, transparent 70%);
}
.nebula-2 {
  width: 500px; height: 500px;
  bottom: -80px; right: -120px;
  background: radial-gradient(circle, rgba(245,158,11,.05) 0%, transparent 70%);
}
.nebula-3 {
  width: 400px; height: 400px;
  top: 55%; left: 55%;
  background: radial-gradient(circle, rgba(99,102,241,.04) 0%, transparent 70%);
}

/* Scanlines */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.025) 2px,
    rgba(0,0,0,.025) 4px
  );
}

.wrapper { position: relative; z-index: 2; }

/* ═══════════════════════════════════════
   NAVBAR
═══════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 48px;
  background: var(--navbar-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .1em;
  color: var(--text);
  text-decoration: none;
}
.logo-hex {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--cyan), #6366f1);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  box-shadow: 0 0 18px rgba(6,182,212,.45);
  animation: hex-pulse 3s ease-in-out infinite;
}
@keyframes hex-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(6,182,212,.45); }
  50%       { box-shadow: 0 0 28px rgba(6,182,212,.7); }
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .6rem;
  letter-spacing: .18em;
  color: var(--green);
  padding: 4px 12px;
  border: 1px solid rgba(16,185,129,.3);
  border-radius: 100px;
  background: rgba(16,185,129,.06);
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: blink 1.4s step-start infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .2; }
}

.day-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .6rem;
  letter-spacing: .14em;
  color: var(--text-2);
}
.day-dots { display: flex; gap: 5px; }
.day-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}
.day-dot.done { background: var(--cyan); box-shadow: 0 0 5px var(--cyan); }
.day-dot.active {
  background: var(--gold);
  box-shadow: 0 0 7px var(--gold);
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.4); opacity: .75; }
}

/* Theme toggle */
.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  transition: background .2s, border-color .2s, transform .15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--bg-4);
  border-color: var(--border-hi);
  transform: scale(1.1);
}

/* ═══════════════════════════════════════
   HERO
═══════════════════════════════════════ */
.hero {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 40px 60px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .6rem;
  letter-spacing: .22em;
  color: var(--cyan);
  padding: 5px 16px;
  border: 1px solid rgba(6,182,212,.3);
  border-radius: 100px;
  background: var(--cyan-dim);
  margin-bottom: 28px;
  animation: fade-up .6s ease both;
}
.hero-eyebrow::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: blink 1.4s step-start infinite;
}

.hero-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 7rem);
  line-height: .92;
  letter-spacing: -.025em;
  margin-bottom: 28px;
  animation: fade-up .65s .08s ease both;
}
.hero-title .ln1 { display: block; color: var(--text); }
.hero-title .ln2 {
  display: block;
  background: linear-gradient(90deg, var(--cyan-bright) 0%, #818cf8 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: fade-up .65s .08s ease both, gradient-slide 6s linear infinite;
}
@keyframes gradient-slide {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.hero-sub {
  font-size: .82rem;
  color: var(--text-2);
  line-height: 1.75;
  max-width: 440px;
  margin-bottom: 52px;
  animation: fade-up .65s .16s ease both;
}

/* ── Countdown ── */
.countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 64px;
  animation: fade-up .65s .24s ease both;
}
.cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.cd-card {
  width: 78px; height: 78px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: background .3s, border-color .3s;
}
.cd-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.04) 0%, transparent 50%);
  pointer-events: none;
}
.cd-card .cd-num {
  position: relative;
  z-index: 1;
  min-width: 2ch;
  text-align: center;
}
.cd-card.flip .cd-num { animation: flip .28s ease; }
@keyframes flip {
  0%  { transform: translateY(0);    opacity: 1; }
  45% { transform: translateY(-10px); opacity: 0; }
  55% { transform: translateY(10px);  opacity: 0; }
  100%{ transform: translateY(0);    opacity: 1; }
}
.cd-sep {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-3);
  padding-bottom: 22px;
  animation: blink 1s step-start infinite;
}
.cd-label {
  font-size: .5rem;
  letter-spacing: .16em;
  color: var(--text-3);
}

/* ── Hero Stats ── */
.hero-stats {
  display: flex;
  align-items: center;
  gap: 44px;
  animation: fade-up .65s .32s ease both;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.stat-val {
  font-family: 'Syne', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text);
}
.stat-lbl {
  font-size: .55rem;
  letter-spacing: .16em;
  color: var(--text-3);
}
.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* ═══════════════════════════════════════
   SECTION DIVIDER LABEL
═══════════════════════════════════════ */
.section-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: .58rem;
  letter-spacing: .22em;
  color: var(--text-3);
  margin-bottom: 52px;
}
.section-label::before,
.section-label::after {
  content: '';
  flex: 1;
  max-width: 140px;
  height: 1px;
}
.section-label::before { background: linear-gradient(90deg, transparent, var(--border)); }
.section-label::after  { background: linear-gradient(90deg, var(--border), transparent); }

/* ═══════════════════════════════════════
   PODIUM
═══════════════════════════════════════ */
.section-podium {
  padding: 40px 40px 80px;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  max-width: 740px;
  margin: 0 auto;
}

.podium-card {
  flex: 1;
  max-width: 230px;
  border-radius: 20px;
  padding: 28px 22px 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(40px) scale(.97);
}
.podium-card.in { animation: card-in .65s ease forwards; }
@keyframes card-in {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.podium-card[data-rank="1"] {
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg) 100%);
  border: 1px solid rgba(245,158,11,.4);
  box-shadow: 0 0 48px rgba(245,158,11,.12), inset 0 1px 0 rgba(245,158,11,.12);
  padding-top: 38px;
}
.podium-card[data-rank="2"] {
  background: linear-gradient(160deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid rgba(148,163,184,.3);
  box-shadow: 0 0 28px rgba(148,163,184,.08);
}
.podium-card[data-rank="3"] {
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg) 100%);
  border: 1px solid rgba(185,124,59,.3);
  box-shadow: 0 0 28px rgba(185,124,59,.08);
}

/* Shimmer */
.card-shimmer {
  position: absolute;
  top: -60%; left: -60%;
  width: 220%; height: 220%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255,255,255,.025) 40deg,
    transparent 80deg
  );
  animation: shimmer-rot 10s linear infinite;
  pointer-events: none;
}
@keyframes shimmer-rot { to { transform: rotate(360deg); } }

.podium-icon {
  font-size: 1.7rem;
  display: block;
  margin-bottom: 14px;
}
[data-rank="1"] .podium-icon { animation: crown-sway 2.5s ease-in-out infinite; }
@keyframes crown-sway {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50%       { transform: rotate(6deg) translateY(-5px); }
}

.podium-avatar {
  width: 62px; height: 62px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  position: relative;
}
[data-rank="1"] .podium-avatar {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1a0a00;
  box-shadow: 0 0 22px rgba(245,158,11,.55);
}
[data-rank="2"] .podium-avatar {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #0c1222;
  box-shadow: 0 0 16px rgba(148,163,184,.3);
}
[data-rank="3"] .podium-avatar {
  background: linear-gradient(135deg, #b97c3b, #8a5a18);
  color: #1a0a00;
  box-shadow: 0 0 16px rgba(185,124,59,.3);
}

.rank-badge {
  position: absolute;
  bottom: -3px; right: -3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 700;
}
[data-rank="1"] .rank-badge { background: var(--gold);   color: #1a0a00; }
[data-rank="2"] .rank-badge { background: var(--silver); color: #0c1222; }
[data-rank="3"] .rank-badge { background: var(--bronze); color: #1a0a00; }

.p-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  margin-bottom: 10px;
}

.p-score {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 2px;
}
[data-rank="1"] .p-score { color: var(--gold); }
[data-rank="2"] .p-score { color: var(--silver); }
[data-rank="3"] .p-score { color: var(--bronze); }

.p-pts-label {
  font-size: .5rem;
  letter-spacing: .14em;
  color: var(--text-3);
  margin-bottom: 16px;
}

.p-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.05);
  overflow: hidden;
}
.p-bar-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 1.4s cubic-bezier(.25,.46,.45,.94);
}
[data-rank="1"] .p-bar-fill { background: linear-gradient(90deg, var(--gold),   #fde68a); }
[data-rank="2"] .p-bar-fill { background: linear-gradient(90deg, var(--silver), #cbd5e1); }
[data-rank="3"] .p-bar-fill { background: linear-gradient(90deg, var(--bronze), #d4a05a); }

/* ═══════════════════════════════════════
   LEADERBOARD TABLE
═══════════════════════════════════════ */
.section-lb {
  padding: 20px 40px 100px;
  max-width: 920px;
  margin: 0 auto;
}

.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.lb-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text);
}
.lb-badge {
  font-size: .58rem;
  letter-spacing: .1em;
  color: var(--cyan);
  padding: 4px 12px;
  border: 1px solid rgba(6,182,212,.28);
  border-radius: 100px;
  background: var(--cyan-dim);
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
}
.lb-table thead th {
  font-size: .52rem;
  letter-spacing: .18em;
  color: var(--text-3);
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.lb-table thead th.r { text-align: right; }
.lb-table thead th.c { text-align: center; }

.lb-row {
  opacity: 0;
  transform: translateX(-18px);
  border-bottom: 1px solid rgba(28, 52, 108, .28);
  cursor: default;
  transition: background .18s ease;
}
.lb-row.in {
  opacity: 1;
  transform: translateX(0);
  transition: opacity .45s ease, transform .45s ease;
}
.lb-row:hover { background: var(--bg-3); }

.lb-row td {
  padding: 13px 16px;
  border-left: 2px solid transparent;
  transition: border-color .2s;
}
.lb-row:hover td:first-child { border-left-color: var(--cyan); }
.lb-row.gold   td:first-child { border-left-color: var(--gold); }
.lb-row.silver td:first-child { border-left-color: var(--silver); }
.lb-row.bronze td:first-child { border-left-color: var(--bronze); }

/* rank cell */
.rank-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.rank-num {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  min-width: 22px;
  text-align: center;
}
.gold   .rank-num { color: var(--gold); }
.silver .rank-num { color: var(--silver); }
.bronze .rank-num { color: var(--bronze); }

.delta {
  font-size: .58rem;
  font-weight: 600;
  width: 20px;
  text-align: center;
}
.delta.up   { color: var(--green); }
.delta.down { color: var(--red); }
.delta.same { color: var(--text-3); }

/* user cell */
.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-av {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: .75rem;
  flex-shrink: 0;
  border: 1px solid;
}
.user-info-name {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: .88rem;
  color: var(--text);
}
.user-info-streak {
  font-size: .6rem;
  color: var(--text-3);
  margin-top: 2px;
}
.fire { color: var(--orange); }

/* score */
.score-cell {
  text-align: right;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}

/* tasks */
.tasks-cell {
  text-align: center;
  color: var(--text-2);
  font-size: .82rem;
}

/* today bar */
.today-cell { text-align: right; }
.today-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.today-pct {
  font-size: .68rem;
  color: var(--text-2);
  min-width: 36px;
  text-align: right;
}
.today-bar {
  width: 72px; height: 3px;
  background: var(--bg-4);
  border-radius: 2px;
  overflow: hidden;
}
.today-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), #818cf8);
  width: 0%;
  transition: width 1.1s cubic-bezier(.25,.46,.45,.94);
}

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .58rem;
  letter-spacing: .1em;
  color: var(--text-3);
  position: relative;
  z-index: 2;
}

/* Light theme nebula adjustments */
[data-theme="light"] .nebula-1 {
  background: radial-gradient(circle, rgba(6,182,212,.12) 0%, transparent 70%);
}
[data-theme="light"] .nebula-2 {
  background: radial-gradient(circle, rgba(245,158,11,.08) 0%, transparent 70%);
}
[data-theme="light"] .nebula-3 {
  background: radial-gradient(circle, rgba(99,102,241,.07) 0%, transparent 70%);
}
[data-theme="light"] .scanlines {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.012) 2px,
    rgba(0,0,0,.012) 4px
  );
}

/* ═══════════════════════════════════════
   SHARED ANIMATIONS
═══════════════════════════════════════ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 700px) {
  .navbar         { padding: 12px 20px; }
  .live-badge     { display: none; }
  .hero           { padding: 60px 20px 40px; min-height: auto; }
  .cd-card        { width: 62px; height: 62px; font-size: 1.5rem; }
  .hero-stats     { gap: 22px; }
  .section-podium { padding: 32px 16px 60px; }
  .podium         { gap: 8px; }
  .section-lb     { padding: 16px 16px 60px; }
  .today-cell     { display: none; }
  footer          { flex-direction: column; gap: 8px; text-align: center; padding: 20px; }
}
