/* ============================================================
   LEADERBOARD — top-3 podium + ranking table
   ============================================================ */

/* Podium for top 3 — center is tallest (#1) */
.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-5);
}

@media (max-width: 768px) {
  .podium {
    grid-template-columns: 1fr;
  }
}

.podium-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  position: relative;
}

/* The #1 card is taller and accent-bordered */
.podium-card--first {
  border-color: var(--color-warning);
  padding-top: var(--space-6);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-warning) 8%, var(--bg-surface)) 0%,
    var(--bg-surface) 60%);
}

.podium-card__rank {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.podium-card--first .podium-card__rank {
  color: var(--color-warning);
}

.podium-card__crown {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  background: var(--color-warning);
  color: white;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-card__crown svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  fill: white;
}

.podium-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans);
}

.podium-card__handle {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.podium-card__tier {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.podium-card__metric {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-success-text);
  letter-spacing: -0.02em;
  margin-top: var(--space-1);
}

.podium-card__metric-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* Toolbar above the table */
.lb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.lb-toolbar__filters {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.lb-toolbar__chip {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.lb-toolbar__chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.lb-toolbar__chip--active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-canvas);
}

.lb-toolbar__chip--active:hover {
  color: var(--bg-canvas);
}

.lb-toolbar__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.lb-toolbar__sort-select {
  padding: var(--space-2) var(--space-3);
  padding-right: calc(var(--space-3) + 18px);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  cursor: pointer;
}

.lb-toolbar__sort-select:hover {
  border-color: var(--border-strong);
}

.lb-toolbar__sort-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Trader cell — handle + tier badge inline */
.lb-trader {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.lb-trader__avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans);
  flex-shrink: 0;
}

.lb-trader__handle {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.lb-trader__you {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.lb-tier {
  display: inline-flex;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.lb-tier--starter { color: var(--text-secondary); }
.lb-tier--pro     { background: var(--color-primary-subtle); color: var(--color-primary); }
.lb-tier--elite   {
  background: color-mix(in srgb, var(--color-warning) 15%, var(--bg-surface));
  color: var(--color-warning-text);
}

/* Streak — W7 in green, L2 in red */
.lb-streak {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
}
.lb-streak--win  { color: var(--color-success-text); }
.lb-streak--loss { color: var(--color-danger-text); }

/* Highlight the user's row */
.lb-row--you {
  background: var(--color-primary-subtle) !important;
  position: relative;
}

[data-theme="dark"] .lb-row--you {
  background: rgba(30, 95, 255, 0.08) !important;
}

.lb-row--you td {
  border-top: 1px solid var(--color-primary);
  border-bottom: 1px solid var(--color-primary);
}
.lb-row--you td:first-child { border-left: 1px solid var(--color-primary); }
.lb-row--you td:last-child  { border-right: 1px solid var(--color-primary); }

/* Footer / show more */
.lb-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) 0 var(--space-3);
}

.lb-footer__hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
}
