*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold: #FFD166;
  --gold-bright: #FFE599;
  --gold-deep: #C8960C;
  --dark: #0f1117;
  --dark-card: #161b27;
  --white: #FFFFFF;
  --green: #5CDB5C;
}

body {
  background-color: var(--dark);
  font-family: 'Barlow', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 80px;
}

/* ── LOGO (banner) ── */
.logo-wrap {
  width: 100%;
  max-width: 900px;
  margin-bottom: 10px;
  animation: fadeDown 0.8s ease both;
}

.logo-wrap img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* ── LEADERBOARD CONTAINER ── */
.leaderboard {
  position: relative;
  width: 100%;
  max-width: 900px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(200, 150, 12, 0.35), 0 0 0 1px rgba(255, 209, 102, 0.15);
  animation: fadeUp 0.9s 0.2s ease both;
}

/* Stage background image */
.leaderboard-bg {
  position: absolute;
  inset: 0;
  background-image: url('../images/Gold_OpenLineBackground.jpeg');
  background-size: cover;
  background-position: center top;
  filter: brightness(0.8) saturate(1.15);
  z-index: 0;
}

/* Dark gradient overlay for readability */
.leaderboard-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
      rgba(10, 8, 4, 0.30) 0%,
      rgba(10, 8, 4, 0.45) 40%,
      rgba(10, 8, 4, 0.65) 100%);
  z-index: 1;
}

.leaderboard-inner {
  position: relative;
  z-index: 2;
  padding: 48px 40px 52px;
}

/* ── HEADER ── */
.lb-header {
  text-align: center;
  margin-bottom: 36px;
}

.lb-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(64px, 10vw, 110px);
  letter-spacing: 0.06em;
  line-height: 0.9;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 24px rgba(255, 209, 102, 0.4));
}

.lb-subtitle {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(18px, 4vw, 28px);
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--white);
  opacity: 0.85;
  margin-top: 4px;
}

.lb-divider {
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 16px auto 0;
  border-radius: 2px;
}

/* ── ROWS ── */
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: grid;
  grid-template-columns: 56px 1fr 72px 70px;
  align-items: center;
  gap: 12px 16px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.08);
  transition: background 0.2s, transform 0.2s;
  animation: slideIn 0.5s ease both;

  /* Default: most indented (ranks 4–10) */
  margin-left: 36px;
  margin-right: 36px;
}

.lb-row:hover {
  background: rgba(255, 209, 102, 0.12);
  transform: translateX(4px);
}

/* ── TOP 3 PODIUM STYLES ── */

/* Rank 1 — Gold: full width + flare sweeping around the border */
.lb-row.rank-1 {
  position: relative;
  padding: 20px 22px;
  background: rgba(255, 209, 102, 0.18);
  border: 2px solid rgba(255, 209, 102, 0.5);
  border-radius: 12px;
  box-shadow: 0 0 32px rgba(255, 209, 102, 0.30), 0 4px 20px rgba(0,0,0,0.3);
  transform: scale(1.03);
  z-index: 2;
  margin-left: 0;
  margin-right: 0;
}

/* Ensure card content sits above the flare layer */
.lb-row.rank-1 > * {
  position: relative;
  z-index: 1;
}

/* Flare sweeping around the border — masked to only the 2px ring */
.lb-row.rank-1::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 13px;
  padding: 2px;
  background: conic-gradient(
    from var(--angle, 0deg),
    transparent 0%,
    transparent 70%,
    rgba(255, 229, 153, 0.2) 80%,
    rgba(255, 255, 230, 0.95) 90%,
    rgba(255, 229, 153, 0.2) 97%,
    transparent 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 0;
  pointer-events: none;
  animation: spinBorder 2.5s linear infinite;
}

/* Rank 2 — Silver: slightly inset */
.lb-row.rank-2 {
  padding: 18px 20px;
  border-color: rgba(216, 216, 216, 0.85);
  border-width: 1.5px;
  background: rgba(216, 216, 216, 0.14);
  box-shadow: 0 0 20px rgba(216, 216, 216, 0.18), 0 4px 16px rgba(0,0,0,0.25);
  transform: scale(1.015);
  z-index: 1;
  margin-left: 14px;
  margin-right: 14px;
}

/* Rank 3 — Bronze: more inset */
.lb-row.rank-3 {
  padding: 16px 20px;
  border-color: rgba(205, 139, 90, 0.9);
  border-width: 1.5px;
  background: rgba(205, 139, 90, 0.14);
  box-shadow: 0 0 18px rgba(205, 139, 90, 0.18), 0 4px 14px rgba(0,0,0,0.2);
  transform: scale(1.007);
  margin-left: 24px;
  margin-right: 24px;
}

/* Stagger animations */
.lb-row:nth-child(1) {
  animation-delay: 0.3s;
}

.lb-row:nth-child(2) {
  animation-delay: 0.38s;
}

.lb-row:nth-child(3) {
  animation-delay: 0.46s;
}

.lb-row:nth-child(4) {
  animation-delay: 0.54s;
}

.lb-row:nth-child(5) {
  animation-delay: 0.62s;
}

.lb-row:nth-child(6) {
  animation-delay: 0.70s;
}

.lb-row:nth-child(7) {
  animation-delay: 0.78s;
}

.lb-row:nth-child(8) {
  animation-delay: 0.86s;
}

.lb-row:nth-child(9) {
  animation-delay: 0.94s;
}

.lb-row:nth-child(10) {
  animation-delay: 1.02s;
}

.lb-rank {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  text-align: center;
  line-height: 1;
}

.rank-1 .lb-rank {
  color: var(--gold-bright);
  text-shadow: 0 0 20px rgba(255, 229, 153, 0.7);
}

.rank-2 .lb-rank {
  color: #D8D8D8;
}

.rank-3 .lb-rank {
  color: #CD8B5A;
}

.lb-row:not(.rank-1):not(.rank-2):not(.rank-3) .lb-rank {
  color: rgba(255, 255, 255, 0.45);
}

.lb-name {
  font-family: 'Barlow', sans-serif;
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rank-1 .lb-name {
  color: var(--gold-bright);
}

.lb-country {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.lb-points {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.02em;
  text-align: right;
  white-space: nowrap;
}

.lb-points::after {
  content: ' PTS';
  font-size: 0.55em;
  font-weight: 700;
  color: rgba(255, 209, 102, 0.55);
  letter-spacing: 0.1em;
}

.rank-1 .lb-points {
  color: var(--gold-bright);
  filter: drop-shadow(0 0 6px rgba(255, 229, 153, 0.35));
}

/* Crown / medal badges */
.lb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-size: 22px;
  line-height: 1;
  vertical-align: middle;
}

.rank-1 .lb-badge {
  filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.35));
}

.rank-2 .lb-badge {
  filter: drop-shadow(0 0 4px rgba(216, 216, 216, 0.25));
}

.rank-3 .lb-badge {
  filter: drop-shadow(0 0 4px rgba(205, 139, 90, 0.25));
}

/* ── FOOTER GLOW ── */
.lb-footer {
  text-align: center;
  margin-top: 28px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 209, 102, 0.35);
}

.lb-last-updated {
  text-align: center;
  margin-top: 8px;
  font-family: 'Barlow', sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* ── ANIMATIONS ── */
@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spinBorder {
  from {
    --angle: 0deg;
  }
  to {
    --angle: 360deg;
  }
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .leaderboard-inner {
    padding: 24px 12px 32px;
  }

  .lb-header {
    margin-bottom: 24px;
  }

  .lb-row {
    grid-template-columns: 30px 1fr 38px 60px;
    gap: 8px;
    padding: 10px 10px;
  }

  .lb-rank {
    font-size: 20px;
  }

  .lb-name {
    font-size: 13px;
    line-height: 1.2;
  }

  .lb-badge {
    font-size: 18px;
    margin-right: 4px;
  }

  .lb-country {
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .lb-points {
    font-size: 18px;
  }

  .lb-points::after {
    font-size: 9px;
    letter-spacing: 0.05em;
  }
}