/* Leaderboard page - reuses the site tokens, buttons and avatars from style.css. */
.lb-page {
  --ac: var(--violet);
  --ac-rgb: 167, 139, 250;
  min-height: 100vh;
  padding-bottom: 90px;
  background:
    radial-gradient(900px 520px at 80% -10%, rgba(var(--ac-rgb), 0.22), transparent 70%),
    radial-gradient(700px 500px at 0% 110%, rgba(255, 122, 217, 0.12), transparent 70%),
    var(--bg);
  transition: background 0.6s;
}
.lb-page[data-board='mafia'] { --ac: var(--mafia); --ac-rgb: 255, 61, 110; }
.lb-page[data-board='detective'] { --ac: var(--detective); --ac-rgb: 255, 200, 87; }
.lb-page[data-board='doctor'] { --ac: var(--doctor); --ac-rgb: 46, 240, 176; }

.lb-nav,
.lb-main { position: relative; z-index: 2; max-width: 880px; margin: 0 auto; padding-inline: 16px; }
.lb-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px; }

.lb-head { margin: 14px 0 24px; text-align: center; }
.lb-head h1 { margin: 8px 0 8px; font-family: var(--display); font-weight: 400; font-size: clamp(38px, 7vw, 60px); line-height: 1.1; }
.lb-head h1 em { font-style: normal; background: var(--iri); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-head p { margin: 0; color: var(--muted); }
.lb-muted { color: var(--muted); text-align: center; }

/* Controls */
.lb-controls { display: grid; justify-items: center; gap: 12px; margin-bottom: 10px; }
.lb-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  scrollbar-width: none;
}
.lb-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 13px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.lb-tab svg { width: 20px; height: 20px; }
.lb-tab:hover { color: var(--text); }
.lb-tab.is-on { color: var(--text); background: rgba(var(--ac-rgb), 0.16); box-shadow: inset 0 0 0 1px rgba(var(--ac-rgb), 0.55); }
.lb-tab.is-on svg { color: var(--ac); }

.lb-period { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); box-shadow: inset 0 0 0 1px var(--line); }
.lb-period button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  cursor: pointer;
}
.lb-period button.is-on { color: #0b0918; font-weight: 700; background: var(--ac); }

.lb-rule { margin: 6px 0 26px; font-size: 13px; color: var(--dim); text-align: center; }

/* Podium: 2nd, 1st, 3rd */
.lb-podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 12px; margin-bottom: 18px; }
.lb-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 10px 18px;
  border: 0;
  border-radius: 22px;
  font: inherit;
  color: var(--text);
  text-align: center;
  background: linear-gradient(170deg, rgba(var(--ac-rgb), 0.12), rgba(12, 10, 26, 0.85) 70%);
  box-shadow: inset 0 0 0 1px rgba(var(--ac-rgb), 0.3), 0 30px 60px -30px rgba(0, 0, 0, 0.9);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
}
.lb-step:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px rgba(var(--ac-rgb), 0.6), 0 30px 60px -24px rgba(var(--ac-rgb), 0.5); }
.lb-step.is-1 { padding-top: 34px; min-height: 250px; }
.lb-step.is-2,
.lb-step.is-3 { min-height: 212px; }
.lb-step.is-empty { visibility: hidden; }
.lb-step .avatar { box-shadow: 0 0 0 4px var(--medal), 0 12px 36px -10px var(--medal); }
.lb-step.is-1 { --medal: #ffc857; }
.lb-step.is-2 { --medal: #cfd6e6; }
.lb-step.is-3 { --medal: #e0925a; }
.lb-medal {
  position: absolute;
  top: -14px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 14px;
  color: #0b0918;
  background: var(--medal);
  box-shadow: 0 6px 18px -4px var(--medal);
}
.lb-step.is-1 .lb-medal { width: 36px; height: 36px; font-size: 17px; top: -18px; }
.lb-name { max-width: 100%; margin-top: 6px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-step .lb-value { font-family: var(--display); font-size: 30px; line-height: 1; color: var(--ac); }
.lb-step.is-1 .lb-value { font-size: 38px; }
.lb-value small { font-family: var(--font); font-size: 12px; color: var(--muted); }
.lb-detail { font-size: 12px; color: var(--muted); }
.lb-step.is-me,
.lb-row.is-me { box-shadow: inset 0 0 0 2px var(--cyan), 0 0 30px -10px var(--cyan); }

/* Rest of the list */
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  color: var(--text);
  text-align: start;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.lb-row:hover { background: rgba(var(--ac-rgb), 0.08); box-shadow: inset 0 0 0 1px rgba(var(--ac-rgb), 0.35); }
.lb-rank { min-width: 28px; font-family: var(--display); font-size: 20px; color: var(--dim); text-align: center; }
.lb-who { flex: 1; min-width: 0; display: grid; gap: 2px; }
.lb-who b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-who small { font-size: 12px; color: var(--muted); }
.lb-row .lb-value { font-family: var(--display); font-size: 22px; color: var(--ac); white-space: nowrap; }

.lb-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 44px 20px;
  border-radius: 22px;
  text-align: center;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.lb-empty .i { width: 40px; height: 40px; color: var(--ac); margin-bottom: 6px; }
.lb-empty b { font-size: 18px; }
.lb-empty p { margin: 0; max-width: 420px; color: var(--muted); line-height: 1.7; }

/* Where you stand */
.lb-me {
  position: fixed;
  bottom: 16px;
  left: 50%;
  translate: -50% 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(840px, calc(100% - 32px));
  padding: 10px 12px 10px 16px;
  border-radius: 18px;
  font-size: 14px;
  background: rgba(16, 13, 34, 0.92);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(125, 249, 255, 0.35);
}
.lb-me > span:not(.lb-me-rank) { flex: 1; color: var(--muted); }
.lb-me b { color: var(--text); }
.lb-me-rank { font-family: var(--display); font-size: 26px; color: var(--cyan); }

/* Player card */
.lb-layer { z-index: 70; }
.dialog.lb-card { position: relative; width: min(480px, 100%); padding: 30px 24px 24px; text-align: start; }
.lb-close { position: absolute; top: 14px; left: 14px; }
.lb-card-head { display: grid; justify-items: center; gap: 10px; margin-bottom: 18px; }
.lb-card-head h3 { margin: 0; }
.lb-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.lb-tiles div { display: grid; gap: 2px; padding: 12px 6px; border-radius: 14px; text-align: center; background: rgba(0, 0, 0, 0.3); box-shadow: inset 0 0 0 1px var(--line); }
.lb-tiles b { font-family: var(--display); font-size: 24px; line-height: 1.1; }
.lb-tiles small { font-size: 11px; color: var(--muted); }
.lb-roles,
.lb-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb-roles li {
  --rc: var(--muted);
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
}
.lb-roles li[data-role='mafia'],
.lb-recent li[data-role='mafia'] { --rc: var(--mafia); }
.lb-roles li[data-role='detective'],
.lb-recent li[data-role='detective'] { --rc: var(--detective); }
.lb-roles li[data-role='doctor'],
.lb-recent li[data-role='doctor'] { --rc: var(--doctor); }
.lb-roles li[data-role='citizen'],
.lb-recent li[data-role='citizen'] { --rc: var(--citizen); }
.lb-roles svg { width: 28px; height: 28px; color: var(--rc); grid-row: span 2; }
.lb-roles span { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lb-roles small { color: var(--muted); font-size: 12px; }
.lb-bar { display: block; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.lb-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--rc); }
.lb-card h4 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }
.lb-recent li {
  --rc: var(--muted);
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.22);
}
.lb-recent svg { width: 20px; height: 20px; color: var(--rc); }
.lb-recent small { color: var(--dim); }
.lb-recent b { min-width: 52px; font-size: 12px; text-align: center; padding: 3px 8px; border-radius: 999px; }
.lb-recent .is-win b { color: var(--ok); background: rgba(46, 240, 176, 0.12); }
.lb-recent .is-loss b { color: #ff9fb3; background: rgba(255, 77, 109, 0.12); }

@media (max-width: 600px) {
  .lb-tab span { display: none; }
  .lb-tab.is-on span { display: inline; }
  .lb-podium { gap: 8px; }
  .lb-step { padding: 22px 6px 14px; border-radius: 18px; }
  .lb-step.is-1 { min-height: 214px; }
  .lb-step.is-2,
  .lb-step.is-3 { min-height: 184px; }
  .lb-step .avatar { --size: 58px !important; }
  .lb-step.is-1 .avatar { --size: 72px !important; }
  .lb-step .lb-value { font-size: 24px; }
  .lb-step.is-1 .lb-value { font-size: 30px; }
  .lb-detail { font-size: 11px; }
  .lb-tiles { grid-template-columns: repeat(2, 1fr); }
  .lb-me { font-size: 13px; }
}

/* Achievement badges (used on the leaderboard cards and in the profile) */
.bdg-count { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.bdg-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.bdg {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 10px 4px 8px;
  border-radius: 14px;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px var(--line);
}
.bdg img { width: 46px; height: 46px; }
.bdg b { font-size: 11px; font-weight: 600; line-height: 1.3; }
.bdg small { font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.bdg:not(.is-on) { opacity: 0.55; }
.bdg:not(.is-on) img { filter: grayscale(1) brightness(0.75); }
.bdg.is-on { background: rgba(167, 139, 250, 0.09); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.28); }
.bdg.is-on small { color: var(--ok); }

/* Seasons */
.lb-season {
  max-width: 640px;
  margin: 0 auto 4px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  text-align: center;
}
.lb-season b { color: var(--text); }

.lb-champs { margin-bottom: 22px; }
.lb-champs h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--muted); text-align: center; }
.lb-champs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lb-champ {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 14px 8px 10px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  color: var(--text);
  text-align: start;
  background: linear-gradient(100deg, rgba(255, 200, 87, 0.1), rgba(12, 10, 26, 0.6) 60%);
  box-shadow: inset 0 0 0 1px rgba(255, 200, 87, 0.28);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}
.lb-champ:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(255, 200, 87, 0.6); }
.lb-medal-img { width: 42px; height: 46px; flex: none; }
.lb-champ .lb-value { font-family: var(--display); font-size: 20px; color: var(--detective); white-space: nowrap; }

.lb-medals { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 8px; }
.lb-medals li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 200, 87, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 200, 87, 0.25);
}
.lb-medals img { width: 38px; height: 42px; flex: none; }
.lb-medals span { display: grid; gap: 2px; }
.lb-medals b { font-size: 14px; }
.lb-medals small { font-size: 12px; color: var(--muted); }
