/* ───────── Shared eSports Leaderboard styles ───────── */

:root {
  --bg-0: #07080b;
  --bg-1: #0a0a0c;
  --bg-2: #101116;
  --bg-3: #16181f;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #e8eaf0;
  --text-dim: #8a8f9c;
  --text-mute: #5a5f6b;

  /* Default accent: electric green. Overridden via Tweaks. */
  --accent: #00ff9f;
  --accent-rgb: 0, 255, 159;
  --accent-2: #00f0ff;
  --accent-2-rgb: 0, 240, 255;

  --gold: #ffd166;
  --silver: #c9d1d9;
  --bronze: #e08a4a;

  --font-display: "Chakra Petch", "Rajdhani", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle grid background — accent-tinted so it stays visible with any theme color */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at 50% 30%, black 0%, transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ─────────── Top Nav ─────────── */
.nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 48px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  background: rgba(8, 9, 12, 0.6);
  flex-wrap: wrap;
  gap: 12px;
  row-gap: 10px;
}
@media (max-width: 1100px) {
  .nav { padding: 14px 24px; }
  .nav-left { gap: 18px; }
  .nav-links { gap: 14px; font-size: 11px; }
}
@media (max-width: 920px) {
  .nav-links { display: none; }
  .nav-right .btn-ghost { display: none; }
}
.nav-left {
  display: flex;
  align-items: center;
  gap: 36px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.18em;
}
.logo-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-family: var(--font-display);
  clip-path: polygon(15% 0, 100% 0, 85% 100%, 0 100%);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.6);
}
.nav-links {
  display: flex;
  gap: 28px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.18em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
}
.nav-links a {
  position: relative;
  padding: 6px 0;
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -23px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.btn-primary {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 18px;
  background: var(--accent);
  color: #000;
  border: none;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  transition: filter 0.15s, transform 0.15s;
}
.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* ─────────── Footer ─────────── */
.footer {
  position: relative;
  z-index: 1;
  padding: 32px 48px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.footer-links a { color: var(--text-mute); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }
@media (max-width: 640px) {
  .footer { padding: 16px; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 24px; }
  .footer-links { gap: 14px; }
}

/* ─────────── Avatar ─────────── */
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.avatar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, var(--av-c1, #444), var(--av-c2, #222) 70%);
  opacity: 0.95;
}
.avatar-initials {
  position: relative;
  z-index: 1;
  letter-spacing: 0.04em;
}

.flag {
  font-size: 14px;
  line-height: 1;
}

/* Reusable button — outline */
.btn-ghost {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 600;
  text-transform: uppercase;
  padding: 9px 16px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  transition: all 0.15s;
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Section header */
.section-eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.section-title {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 8px 0 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.rank-diff {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  animation: rank-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.rank-diff.up   { color: #00ff9f; background: rgba(0, 255, 159, 0.12); }
.rank-diff.down { color: #ff5c5c; background: rgba(255, 92, 92, 0.12); }
.star-card .rank-diff { top: 2px; right: 4px; font-size: 9px; }
.podium-card { position: relative; }
.star-card { position: relative; }

@keyframes rank-pop {
  from { transform: translateY(-4px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.refresh-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin-left: auto;
}

/* ─── Logo as link (no underline, inherits layout) ───────────────────────── */
a.logo {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.logo:hover .logo-mark { opacity: 0.85; }

/* ─── Main sponsor wordmark as link ──────────────────────────────────────── */
a.ms-name {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.15s;
}
a.ms-name:hover { opacity: 0.85; }

/* ─── Social icons in nav-right ──────────────────────────────────────────── */
.socials {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--text-mute);
  transition: color 0.15s, background 0.15s;
}
.social:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}
.social svg { width: 16px; height: 16px; }
@media (max-width: 920px) { .socials { display: none; } }

/* ─── Live-dot pulse ─────────────────────────────────────────────────────── */
@keyframes lb-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  box-shadow: 0 0 8px var(--accent);
  animation: lb-pulse 1.6s ease-in-out infinite;
}

/* ─── Stagger fade-in on first paint ─────────────────────────────────────── */
@keyframes lb-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.podium-card        { animation: lb-fade-up 0.5s ease-out both; }
.podium-card.r2     { animation-delay: 0.05s; }
.podium-card.r1     { animation-delay: 0.15s; }
.podium-card.r3     { animation-delay: 0.10s; }
.star-card          { animation: lb-fade-up 0.4s ease-out both; }
.star-card:nth-child(1) { animation-delay: 0.25s; }
.star-card:nth-child(2) { animation-delay: 0.30s; }
.star-card:nth-child(3) { animation-delay: 0.35s; }
.star-card:nth-child(4) { animation-delay: 0.40s; }

/* ─── #1 champion subtle float ───────────────────────────────────────────── */
@keyframes lb-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.podium-card.r1 .champ-art {
  animation: lb-float 3s ease-in-out infinite;
}

/* ─── Hover glow on podium cards ─────────────────────────────────────────── */
.podium-card {
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.podium-card:hover {
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.18);
}

/* ─── Reduced motion: kill everything that moves ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .live-dot,
  .podium-card,
  .star-card,
  .podium-card.r1 .champ-art,
  .rank-diff {
    animation: none !important;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
