/* ============================================================
   LEADERBOARDS — Styles
   ============================================================ */

.page-leaderboards {
  padding-bottom: 4rem;
}

/* --- Live gameweek pulsing dot --- */
.lb-live-dot {
  color: #22c55e;
  animation: lb-pulse 1.5s ease-in-out infinite;
}

@keyframes lb-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- Unfinished lineups toggle --- */
.lb-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  user-select: none;
  min-width: 64px;
}

.lb-toggle:hover {
  border-color: #ffffff;
  color: #ffffff;
}

.lb-toggle:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 2px;
}

.lb-toggle--on {
  border-color: #ffffff;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
  .lb-toggle {
    width: 100%;
  }
}

/* --- Completion summary box --- */
.lb-completion-box {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}

.lb-completion-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
}

.lb-completion-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.lb-completion-bar-track {
  height: 6px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.lb-completion-bar-fill {
  height: 100%;
  background: #f97316;
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 2px;
}

/* --- Rankings list --- */
.lb-rankings-count {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lb-rankings-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.lb-ranking-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  padding: 1.1rem 1rem;
  border-radius: 8px;
}

.lb-ranking-row--gold {
  background: linear-gradient(105deg, #2a2000 0%, #3d2f00 40%, #2a2000 100%);
  border: 1px solid #b8860b;
}

.lb-ranking-row--silver {
  background: linear-gradient(105deg, #1a1a1e 0%, #2a2a30 40%, #1a1a1e 100%);
  border: 1px solid #808090;
}

.lb-ranking-row--bronze {
  background: linear-gradient(105deg, #221200 0%, #3a1e00 40%, #221200 100%);
  border: 1px solid #8b5a2b;
}

.lb-ranking-pos {
  font-size: 1rem;
  font-weight: 800;
  color: var(--muted);
  min-width: 3.5ch;
  text-align: right;
  flex-shrink: 0;
}

.lb-manager-avatar-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--hover-bg);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-manager-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.lb-manager-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 0 0 150px;
}

.lb-manager-name {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-manager-club {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Lineup player circles --- */
.lb-lineup {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.lb-player-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  gap: 0.25rem;
  outline: none;
}

.lb-player-col:hover,
.lb-player-col:focus {
  outline: none;
  box-shadow: none;
  text-decoration: none;
  color: inherit;
  background: none;
}

.lb-player-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.10rem 0.55rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 25px;
}

.lb-player-score-empty {
  background: var(--badge-bg, rgba(255,255,255,0.08));
  color: var(--muted);
}

.lb-captain-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 50%;
  width: 1.4em;
  height: 1.4em;
  font-size: 0.7em;
  font-weight: 900;
  vertical-align: middle;
  margin-left: 0.3em;
}

.lb-player-avatar-wrap {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.lb-player-avatar-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

@media (max-width: 640px) {
  .lb-ranking-row {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.75rem 0.75rem;
    align-items: center;
  }

  /* Top row: rank + avatar + name + totals */
  .lb-ranking-pos {
    font-size: 0.8rem;
    min-width: 2.8ch;
  }

  .lb-manager-avatar-wrap {
    width: 40px;
    height: 40px;
  }

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

  .lb-row-totals {
    margin-left: 0;
    align-items: flex-end;
  }

  .lb-total-score {
    font-size: 0.9rem;
  }

  .lb-total-meta {
    font-size: 0.6rem;
  }

  /* Bottom row: lineup spans full width */
  .lb-lineup {
    order: 10;
    flex: 0 0 100%;
    gap: 0.4rem;
    justify-content: center;
  }

  .lb-player-avatar-wrap {
    width: 34px;
    height: 34px;
  }

  .lb-player-score {
    font-size: 0.65rem;
    padding: 0.08rem 0.1rem;
    min-width: 30px;
  }

  .lb-captain-badge {
    width: 1.2em;
    height: 1.2em;
    font-size: 0.65em;
    margin-left: 0.1em;
  }
}

/* --- Row totals (right-hand side) --- */
.lb-row-totals {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 0.2rem;
  margin-left: auto;
}

.lb-total-score {
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb-total-meta {
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
