/* ═══════════════════════════════════════════════════════════════════
   Leaderboard · Signal — Community Contributors & Reputation Engine
   Scoped to .sg / .lb- to follow the Signal Design System.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Hero Section ─── */
.lb-hero {
  text-align: center;
  max-width: 52rem;
  margin-inline: auto;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.lb-hero .sg-eyebrow {
  justify-content: center;
}
.lb-hero h1 {
  font-size: clamp(2.6rem, 5.5vw, 4.8rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.035em;
  color: #fff;
  margin-bottom: 1.2rem;
  text-wrap: balance;
}
.lb-hero h1 .tv {
  background: linear-gradient(180deg, #fff 30%, var(--green-2) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lb-hero p.lb-sub {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
  margin-inline: auto;
  max-width: 42rem;
}

/* ─── Telemetry Summary Strip ─── */
.lb-telemetry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: clamp(3rem, 6vw, 4.5rem);
}
.lb-tele-item {
  position: relative;
  padding: 1.25rem 1.4rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: border-color .25s, transform .25s;
}
.lb-tele-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green), transparent 75%);
  opacity: .4;
  transition: opacity .25s;
}
.lb-tele-item:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
}
.lb-tele-item:hover::before {
  opacity: 1;
}
.lb-tele-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--dim);
  font: 600 .62rem/1 var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-bottom: .6rem;
}
.lb-tele-label i {
  color: var(--green);
  font-size: .75rem;
}
.lb-tele-val {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: #fff;
}
.lb-tele-desc {
  margin-top: .4rem;
  color: var(--muted);
  font-size: .78rem;
}

/* ─── Podium: Top 3 Contributors ─── */
.lb-podium-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.lb-podium-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: clamp(3.5rem, 6vw, 5rem);
}
.lb-podium-card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.8rem 1.6rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.lb-podium-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(var(--accent-rgb, 52, 211, 153), .12), transparent 50%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.lb-podium-card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--accent-rgb, 52, 211, 153), .5);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
}
.lb-podium-card:hover::before {
  opacity: 1;
}

/* Champion #1 Spotlight */
.lb-podium-card.is-champ {
  --accent: #f5c451;
  --accent-rgb: 245, 196, 81;
  background: linear-gradient(160deg, rgba(245, 196, 81, .09), var(--panel) 55%);
  border-color: rgba(245, 196, 81, .4);
  box-shadow: 0 25px 60px -25px rgba(245, 196, 81, .2);
}
.lb-podium-card.is-champ:hover {
  border-color: rgba(245, 196, 81, .75);
}

/* Runner Up #2 */
.lb-podium-card.is-silver {
  --accent: #e2e8f0;
  --accent-rgb: 226, 232, 240;
  background: linear-gradient(160deg, rgba(226, 232, 240, .05), var(--panel) 55%);
  border-color: rgba(226, 232, 240, .25);
}

/* 3rd Place */
.lb-podium-card.is-bronze {
  --accent: #f97316;
  --accent-rgb: 249, 115, 22;
  background: linear-gradient(160deg, rgba(249, 115, 22, .05), var(--panel) 55%);
  border-color: rgba(249, 115, 22, .25);
}

.lb-badge-ribbon {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  font: 700 .62rem/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
  align-self: flex-start;
  border: 1px solid rgba(var(--accent-rgb, 52, 211, 153), .35);
  background: rgba(var(--accent-rgb, 52, 211, 153), .1);
  color: var(--accent);
}

.lb-podium-top {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.4rem;
}
.lb-podium-av-wrap {
  position: relative;
  flex: none;
}
.lb-podium-av {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(var(--accent-rgb, 52, 211, 153), .6);
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 25px rgba(var(--accent-rgb, 52, 211, 153), .2);
}
.lb-podium-rank-tag {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #04070c;
  display: grid;
  place-items: center;
  font: 800 .75rem/1 var(--display);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5);
}

.lb-podium-user h3 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .25rem;
}
.lb-podium-user h3 a {
  color: #fff;
  text-decoration: none;
  transition: color .2s;
}
.lb-podium-user h3 a:hover {
  color: var(--accent);
}
.lb-podium-title {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.3;
}
.lb-staff-flag {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: rgba(52, 211, 153, .14);
  border: 1px solid rgba(52, 211, 153, .4);
  color: var(--green);
  font: 700 .54rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-left: .35rem;
  vertical-align: middle;
}

.lb-podium-score {
  display: flex;
  align-items: baseline;
  gap: .35rem;
  margin: .4rem 0 1.2rem;
  padding: .75rem 1rem;
  border-radius: .9rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
}
.lb-podium-score b {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}
.lb-podium-score span {
  color: var(--accent);
  font: 600 .68rem/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.lb-podium-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  margin-top: auto;
}
.lb-p-metric {
  padding: .65rem .8rem;
  border-radius: .75rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .2);
  text-align: center;
}
.lb-p-metric b {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}
.lb-p-metric span {
  color: var(--dim);
  font: 600 .58rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ─── Contributors Table Console ─── */
.lb-console {
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .04);
  overflow: hidden;
  margin-bottom: clamp(3.5rem, 6vw, 5rem);
}
.lb-console-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.1rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 12, 20, .6);
}
.lb-console-title {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.lb-console-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
}
.lb-live-dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}
.lb-console-meta {
  color: var(--dim);
  font: 600 .62rem/1 var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.lb-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.lb-table th {
  padding: .95rem 1.4rem;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font: 600 .62rem/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  background: rgba(7, 12, 20, .4);
  white-space: nowrap;
}
.lb-table td {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  transition: background .2s;
  white-space: nowrap;
}
.lb-table tr:last-child td {
  border-bottom: 0;
}
.lb-table tr {
  transition: background .2s;
}
.lb-table tbody tr:hover {
  background: rgba(255, 255, 255, .03);
}
.lb-table tbody tr.is-you {
  background: rgba(52, 211, 153, .06);
}
.lb-table tbody tr.is-you td:first-child {
  border-left: 3px solid var(--green);
}

/* Rank digits */
.lb-rank-num {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--dim);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.lb-table tr:nth-child(1) .lb-rank-num {
  color: #f5c451;
}
.lb-table tr:nth-child(2) .lb-rank-num {
  color: #e2e8f0;
}
.lb-table tr:nth-child(3) .lb-rank-num {
  color: #f97316;
}

/* User identity in table */
.lb-user-cell {
  display: flex;
  align-items: center;
  gap: .85rem;
}
.lb-user-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: .95rem;
  color: var(--green);
  flex: none;
}
.lb-user-name {
  font-weight: 600;
  font-size: .95rem;
  color: #fff;
  text-decoration: none;
  transition: color .2s;
}
.lb-user-name:hover {
  color: var(--green-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lb-user-sub {
  color: var(--dim);
  font-size: .78rem;
  margin-top: .15rem;
}

/* Rank Tier Badges */
.lb-tier-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font: 600 .62rem/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.lb-tier-diamond { border-color: rgba(103, 232, 249, .4); color: var(--cyan); background: rgba(103, 232, 249, .08); }
.lb-tier-platinum { border-color: rgba(196, 181, 253, .4); color: #c4b5fd; background: rgba(196, 181, 253, .08); }
.lb-tier-gold { border-color: rgba(245, 196, 81, .4); color: #f5c451; background: rgba(245, 196, 81, .08); }
.lb-tier-silver { border-color: rgba(226, 232, 240, .35); color: #e2e8f0; background: rgba(226, 232, 240, .06); }
.lb-tier-bronze { border-color: rgba(249, 115, 22, .35); color: #f97316; background: rgba(249, 115, 22, .06); }
.lb-tier-newbie { border-color: var(--line); color: var(--dim); background: transparent; }

/* Rep score in table */
.lb-rep-cell b {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--green-2);
}
.lb-rep-cell span {
  display: block;
  color: var(--dim);
  font: 600 .55rem/1 var(--mono);
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-top: .15rem;
}

.lb-num-cell {
  color: var(--ink);
  font-weight: 600;
  font-size: .92rem;
}
.lb-num-cell small {
  color: var(--dim);
  font: 500 .68rem/1 var(--mono);
  margin-left: .25rem;
}

.lb-date-cell {
  color: var(--dim);
  font: 500 .78rem/1 var(--mono);
}

/* ─── How Points are Earned Bento Grid ─── */
.lb-rules-head {
  text-align: center;
  max-width: 44rem;
  margin-inline: auto;
  margin-bottom: 2.8rem;
}
.lb-rules-head h2 {
  font-size: clamp(2rem, 3.8vw, 3rem);
  font-weight: 800;
  letter-spacing: -.03em;
  color: #fff;
  margin-bottom: .8rem;
}
.lb-rules-head p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.lb-rules-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2rem;
  margin-bottom: clamp(3.5rem, 6vw, 5rem);
}
.lb-rule-card {
  padding: 1.6rem 1.4rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  transition: border-color .25s, transform .25s;
}
.lb-rule-card:hover {
  border-color: rgba(52, 211, 153, .45);
  transform: translateY(-3px);
}
.lb-rule-icon {
  width: 46px;
  height: 46px;
  border-radius: .85rem;
  border: 1px solid rgba(52, 211, 153, .35);
  background: rgba(52, 211, 153, .1);
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}
.lb-rule-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}
.lb-rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .8rem;
}
.lb-rule-list li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: .65rem;
  align-items: start;
  font-size: .84rem;
  line-height: 1.45;
  color: var(--muted);
}
.lb-pts {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: .2rem .4rem;
  border-radius: .4rem;
  background: rgba(52, 211, 153, .12);
  border: 1px solid rgba(52, 211, 153, .3);
  color: var(--green);
  font: 700 .65rem/1 var(--mono);
}

/* ─── Community CTA Banner ─── */
.lb-cta-box {
  position: relative;
  border-radius: var(--r);
  border: 1px solid rgba(52, 211, 153, .3);
  background: linear-gradient(150deg, rgba(52, 211, 153, .12), var(--panel) 65%);
  padding: clamp(2.5rem, 5vw, 3.5rem);
  text-align: center;
  overflow: hidden;
}
.lb-cta-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
}
.lb-cta-box h2 {
  font-size: clamp(2rem, 3.8vw, 3rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -.03em;
  margin-bottom: .8rem;
}
.lb-cta-box p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 36rem;
  margin: 0 auto 1.8rem;
}
.lb-cta-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ─── Responsive Adjustments ─── */
@media (max-width: 1024px) {
  .lb-podium-grid {
    grid-template-columns: 1fr;
  }
  .lb-podium-card.is-champ {
    order: -1;
  }
  .lb-rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lb-telemetry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .lb-telemetry {
    grid-template-columns: 1fr;
  }
  .lb-rules-grid {
    grid-template-columns: 1fr;
  }
  .lb-podium-card {
    padding: 1.4rem 1.2rem;
  }
  .lb-table th, .lb-table td {
    padding: .85rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lb-podium-card, .lb-tele-item, .lb-rule-card {
    transition: none !important;
  }
  .lb-podium-card:hover, .lb-tele-item:hover, .lb-rule-card:hover {
    transform: none !important;
  }
}
