/*
  Leaderboards tab. Mirrors Assets/Prefabs/UI/Leaderboards/LeaderboardsScreen.prefab and LeaderboardRow.prefab
  (values from the prefab dump; colours from CategoryPreviewTheme). --lu is one canvas unit: the phone uses the
  prefab's own scale (--u), the wide layout scales the same composition up so type stays readable at 1440 px.
*/
.lb {
  --lu: var(--u);
  --lb-ink: #031c26; /* CategoryPreviewTheme.Ink */
  --lb-muted: #808890; /* CategoryPreviewTheme.Muted */
  --lb-neutral: #ececef; /* NeutralFill: idle tab, rank pill */
  --lb-card: #fefefe; /* CardSurface */
  --lb-line: #e6e6e7; /* CardOutline */
  --lb-paper: #f9f7f3; /* the panel body */
  --lb-green: var(--brand-green); /* the one selected-chip green */
  --lb-accent: #3c82c8;
  --lb-tint: #ccdff1; /* Lerp(white, accent, 0.26): own row */
  --lb-soft: #e8f0f8; /* Lerp(white, accent, 0.14): jump pulse */
  --lb-row-shadow: 0 calc(10 * var(--lu)) calc(10 * var(--lu)) rgba(0, 0, 0, 0.0667);
  --lb-edge: max(1px, calc(2 * var(--lu)));
  --lb-row-h: calc(88 * var(--lu));
  --lb-country-w: max(calc(96 * var(--lu)), 92px); /* the Country caption and every row's flag share it */
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(20 * var(--lu)) calc(20 * var(--lu)) calc(16 * var(--lu));
}

/* ---- panel ------------------------------------------------------------------------------------------------ */
.lb__panel {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: calc(48 * var(--lu));
  background: var(--lb-paper);
  box-shadow: 0 calc(10 * var(--lu)) calc(24 * var(--lu)) rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

/* ---- hero (HubTabBanner) ---------------------------------------------------------------------------------- */
.lb-banner {
  position: relative;
  flex: none;
  height: calc(300 * var(--lu));
  overflow: hidden;
  background: #bfe3f5;
}
.lb-banner__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}
.lb-banner__copy,
.lb-banner__meta {
  display: contents;
}
.lb-banner__title,
.lb-banner__subtitle {
  position: absolute;
  display: flex;
  align-items: center;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
}
.lb-banner__title {
  left: calc(44 * var(--lu));
  top: calc(48 * var(--lu));
  width: calc(620 * var(--lu));
  height: calc(66 * var(--lu));
  font-weight: var(--w-black);
  font-size: calc(52 * var(--lu));
  line-height: 1.2;
  letter-spacing: -0.01em; /* TMP character spacing -1 */
  color: #1e2a44;
  text-transform: uppercase;
}
.lb-banner__subtitle {
  left: calc(46 * var(--lu));
  top: calc(118 * var(--lu));
  width: calc(560 * var(--lu));
  height: calc(36 * var(--lu));
  font-weight: var(--w-semibold);
  font-size: calc(27 * var(--lu));
  line-height: 1.2;
  color: #1f5a99; /* BrandPalette.BannerSubtitle */
}
.lb-banner__chip {
  position: absolute;
  left: calc(44 * var(--lu));
  top: calc(172 * var(--lu));
  display: inline-flex;
  align-items: center;
  max-width: calc(560 * var(--lu));
  height: calc(60 * var(--lu));
  padding: 0 calc(22 * var(--lu));
  border-radius: calc(30 * var(--lu));
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--lb-row-shadow);
  font-weight: var(--w-bold);
  font-size: calc(26 * var(--lu));
  letter-spacing: var(--tmp-bold); /* the chip label is TMP style Bold */
  color: var(--lb-ink);
}
.lb-banner__chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- tabs (LeaderboardTabButton) -------------------------------------------------------------------------- */
.lb-tabs {
  flex: none;
  display: flex;
  gap: calc(10 * var(--lu));
  padding: calc(24 * var(--lu)) calc(24 * var(--lu)) 0;
}
.lb-tab {
  flex: 1 1 0;
  min-width: 0;
  height: calc(78 * var(--lu));
  padding: 0 calc(8 * var(--lu));
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(34 * var(--lu));
  background: var(--lb-neutral);
  color: var(--lb-muted);
  font-weight: var(--w-semibold);
  font-size: calc(26 * var(--lu));
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  transition:
    background var(--t-fast),
    color var(--t-fast);
}
.lb-tab__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (hover: hover) {
  .lb-tab:hover:not(.is-selected) {
    background: #e2e2e8;
  }
}
.lb-tab.is-selected {
  background: var(--lb-green);
  color: #fff;
  text-shadow: var(--on-colour-shadow);
}

/* ---- league strip ------------------------------------------------------------------------------------------ */
.lb-league {
  flex: none;
  padding: calc(24 * var(--lu)) calc(24 * var(--lu)) calc(10 * var(--lu));
}
.lb-league__inner {
  display: flex;
  flex-direction: column;
  gap: calc(2 * var(--lu));
  padding: calc(14 * var(--lu)) calc(28 * var(--lu));
  border-radius: calc(32 * var(--lu));
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--lb-row-shadow);
}
.lb-league__label {
  font-weight: var(--w-semibold);
  font-size: calc(30 * var(--lu));
  line-height: 1.25;
  color: var(--lb-ink);
  white-space: pre-wrap;
}
.lb-league__hint {
  font-weight: var(--w-medium);
  font-size: calc(24 * var(--lu));
  line-height: 1.25;
  color: var(--lb-muted);
  white-space: pre-wrap;
}

/* ---- offline / failed / pending banners ------------------------------------------------------------------- */
.lb-note-wrap {
  flex: none;
  padding: 0 calc(24 * var(--lu)) calc(10 * var(--lu));
}
.lb-note {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: calc(76 * var(--lu));
  padding: calc(12 * var(--lu)) calc(26 * var(--lu));
  border: var(--lb-edge) solid;
  border-radius: calc(30 * var(--lu));
  font-weight: var(--w-semibold);
  font-size: calc(26 * var(--lu));
  line-height: 1.25;
  color: var(--lb-ink);
  text-align: center;
}
.lb-note--offline,
.lb-note--failed {
  background: #fdece9;
  border-color: #e0443a;
}
.lb-note--pending {
  background: #fff4d8;
  border-color: #feb90b;
}
button.lb-note {
  cursor: pointer;
}
@media (hover: hover) {
  button.lb-note:hover {
    filter: brightness(0.98);
  }
}

/* ---- list ---------------------------------------------------------------------------------------------------- */
/* Unity keeps two empty banner wrappers (10u each) above the list even when no banner shows */
.lb-body-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: calc(20 * var(--lu));
}
.lb-note-wrap ~ .lb-body-wrap {
  margin-top: calc(10 * var(--lu));
}
.lb-note-wrap ~ .lb-note-wrap ~ .lb-body-wrap {
  margin-top: 0;
}
.lb-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: calc(10 * var(--lu));
  padding: calc(4 * var(--lu)) calc(24 * var(--lu)) calc(40 * var(--lu));
}
.lb-rows {
  display: flex;
  flex-direction: column;
  gap: calc(10 * var(--lu));
  flex: none;
}

.lb-row {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: calc(14 * var(--lu));
  /* --lb-row-extra: the list's spare height shared out so only whole rows show (Leaderboards.js fitRows) */
  min-height: calc(var(--lb-row-h) + var(--lb-row-extra, 0px));
  padding: 0 calc(22 * var(--lu)) 0 calc(18 * var(--lu));
  border: var(--lb-edge) solid var(--lb-line);
  border-radius: calc(36 * var(--lu));
  background: var(--row-fill, var(--lb-card));
  box-shadow: var(--lb-row-shadow);
  transition: background 320ms var(--ease-out);
}
.lb-row.is-self {
  --row-fill: var(--lb-tint);
}
.lb-row.is-pulse {
  --row-fill: var(--lb-soft);
}
.lb-row.is-action {
  padding: 0;
}
.lb-row__hit {
  flex: 1;
  align-self: stretch;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: calc(14 * var(--lu));
  padding: 0 calc(22 * var(--lu)) 0 calc(18 * var(--lu));
  border-radius: inherit;
  text-align: left;
  transition:
    background var(--t-fast),
    transform var(--t-fast) var(--ease-out);
}
@media (hover: hover) {
  .lb-row__hit:hover {
    background: rgba(27, 37, 89, 0.04);
  }
}
.lb-row__hit:active {
  background: rgba(27, 37, 89, 0.08);
  transform: scale(0.992);
}

.lb-medal {
  flex: none;
  display: grid;
  place-items: center;
  min-width: calc(76 * var(--lu));
  height: calc(48 * var(--lu));
  padding: 0 calc(10 * var(--lu));
  border-radius: 999px;
  background: var(--lb-neutral);
  font-weight: var(--w-bold);
  font-size: calc(26 * var(--lu));
  line-height: 1;
  color: var(--lb-ink);
  font-variant-numeric: tabular-nums;
}
.lb-medal--gold {
  background: #f5c242;
}
.lb-medal--silver {
  background: #c7ced6;
}
.lb-medal--bronze {
  background: #d98e51;
}

.lb-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: calc(56 * var(--lu));
  height: calc(56 * var(--lu));
  border-radius: 50%;
  object-fit: cover;
  overflow: hidden;
  font-weight: var(--w-bold);
  font-size: calc(30 * var(--lu));
  line-height: 1;
  user-select: none;
}
/* a blocked player's picture is never shown: a plain disc holds its place so the columns stay aligned */
.lb-avatar--hidden {
  background: var(--lb-neutral);
}
.lb-avatar--lg {
  width: calc(96 * var(--lu));
  height: calc(96 * var(--lu));
  font-size: calc(46 * var(--lu));
}

.lb-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--w-semibold);
  font-size: calc(28 * var(--lu));
  line-height: 1.3;
  color: var(--lb-ink);
}
.lb-row__score {
  flex: none;
  min-width: calc(160 * var(--lu));
  text-align: right;
  font-weight: var(--w-bold);
  font-size: calc(30 * var(--lu));
  line-height: 1.2;
  color: var(--lb-ink);
  font-variant-numeric: tabular-nums;
}
.lb-row__country {
  flex: none;
  width: var(--lb-country-w);
  display: flex;
  justify-content: center;
}

.lb-flag {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: calc(60 * var(--lu));
  height: calc(40 * var(--lu));
  border-radius: calc(8 * var(--lu));
  overflow: hidden;
  background: var(--lb-neutral);
  box-shadow: 0 0 0 1px rgba(3, 28, 38, 0.12);
}
.lb-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lb-flag--code {
  font-weight: var(--w-bold);
  font-size: calc(20 * var(--lu));
  letter-spacing: 0.04em;
  color: var(--lb-muted);
}
.lb-flag--tab {
  width: calc(44 * var(--lu));
  height: calc(30 * var(--lu));
  margin-right: calc(12 * var(--lu));
  border-radius: calc(6 * var(--lu));
}

.lb-more {
  flex: none;
  min-height: calc(58 * var(--lu));
  display: grid;
  place-items: center;
  font-weight: var(--w-medium);
  font-size: calc(24 * var(--lu));
  color: var(--lb-muted);
}

/* ---- sparse board (SparseCard) ------------------------------------------------------------------------------ */
.lb-sparse {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(14 * var(--lu));
  padding: calc(30 * var(--lu)) calc(40 * var(--lu)) calc(34 * var(--lu));
  border: var(--lb-edge) solid var(--lb-line);
  border-radius: calc(26 * var(--lu));
  background: var(--lb-card);
}
.lb-sparse__trophy {
  width: calc(110 * var(--lu));
  height: calc(110 * var(--lu));
  object-fit: contain;
}
.lb-sparse__text {
  min-height: calc(44 * var(--lu));
  text-align: center;
  font-weight: var(--w-medium);
  font-size: calc(30 * var(--lu));
  line-height: 1.3;
  color: var(--lb-muted);
}

/* ---- loading, offline and failed boards ------------------------------------------------------------------- */
.lb-state {
  flex: 1;
  min-height: calc(560 * var(--lu));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(22 * var(--lu));
  padding: calc(40 * var(--lu)) calc(60 * var(--lu));
  text-align: center;
}
.lb-state__robot {
  width: calc(250 * var(--lu));
  height: calc(320 * var(--lu));
}
.lb-state__text {
  max-width: calc(760 * var(--lu));
  font-weight: var(--w-medium);
  font-size: calc(28 * var(--lu));
  line-height: 1.35;
  color: var(--lb-muted);
}

/* pull down at the top of the list to reload it (touch) */
.lb-pull {
  position: absolute;
  top: calc(6 * var(--lu));
  left: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}
.lb-pull .spinner {
  width: calc(52 * var(--lu));
  height: calc(52 * var(--lu));
  border-width: calc(6 * var(--lu));
}

/* ---- footer (pinned own row, jump to me, freshness) -------------------------------------------------------- */
/* The prefab's 20 bottom units put the freshness line's last letters on the hub's raised tab circle (its dome
   rises higher than the native one): 36 keep them clear of it and about 12 px above the panel's edge. */
.lb-footer {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(8 * var(--lu));
  padding: calc(10 * var(--lu)) calc(24 * var(--lu)) calc(26 * var(--lu)); /* clear of the native-height tab dome */
}
.lb-self {
  display: flex;
  align-items: center;
  gap: calc(14 * var(--lu));
  max-width: 100%;
  min-height: calc(92 * var(--lu));
  padding: 0 calc(22 * var(--lu)) 0 calc(18 * var(--lu));
  border: var(--lb-edge) solid var(--lb-line);
  border-radius: calc(46 * var(--lu));
  background: var(--lb-tint);
  box-shadow: var(--lb-row-shadow);
}
.lb-self.is-ranked {
  align-self: stretch;
}
/* Jump to me gets clear air under the pinned row (its drop shadow alone is about 10 units deep), about as much as
   it leaves above the freshness line */
.lb-self + .btn {
  margin-top: calc(8 * var(--lu));
}
.lb-footer .btn + .lb-fresh {
  margin-top: calc(4 * var(--lu));
}
.lb-self__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
  font-weight: var(--w-semibold);
  font-size: calc(30 * var(--lu));
  line-height: 1.3;
  color: var(--lb-ink);
}
.lb-self.is-ranked .lb-self__name {
  flex: 1;
}
.lb-self__score {
  flex: none;
  min-width: calc(160 * var(--lu));
  text-align: right;
  font-weight: var(--w-semibold);
  font-size: calc(30 * var(--lu));
  color: var(--lb-ink);
  font-variant-numeric: tabular-nums;
}
.lb-fresh {
  min-height: calc(65 * var(--lu));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre-line;
  font-weight: var(--w-medium);
  font-size: calc(24 * var(--lu));
  line-height: 1.2;
  color: var(--lb-muted);
}

/* ---- report / block sheet ---------------------------------------------------------------------------------- */
/* button labels read as authored ("Jump to me", "PLAY"), as the Unity labels do */
.lb .btn {
  text-transform: none;
}
/* the Unity compact button measures about 84 units from rim to lip (the shared component draws 88) */
.lb--phone .btn--compact {
  --btn-h: calc(84 * var(--lu));
}

.lb-sheet__text {
  font-size: calc(32 * var(--u));
  line-height: 1.4;
  color: var(--ink);
}

/* ======================================================================================================== wide */
/* Desktop: the board panel (hero, tabs, list) beside a side column (the player's standing, the league, and the
   climb through the league tiers when the window is tall enough). The panel's edges line up with the hub header. */
.lb--wide {
  --lu: calc(var(--u) * 1.25);
  --lb-row-h: calc(84 * var(--lu));
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 24px;
  padding: 16px 24px 24px;
}
.lb--wide .lb__panel {
  flex: 1 1 0;
  min-width: 0;
}

/* compact hero: the title block centred on the left, the whole trophy on the right. Unity draws the art whole (an
   Image stretched over a 1040x300 band, the art's own 1536x443 proportions), so the wide band does too: the art is
   drawn at the band's height with its own proportions, right-aligned, cup clear of the top and its base on the
   mound. The band is as tall as the art would be at the panel's width, or, on a short window, about 130-250 px
   (--lb-hero-h); where the art is then narrower than the panel, its left edge (cloud and bush) fades into the sky
   the band is painted with, which carries the title. */
.lb--wide .lb__panel {
  container-type: inline-size;
}
.lb--wide .lb-banner {
  --lb-hero-h: min(calc(100cqw * 443 / 1536), max(132px, calc(30vh - 74px)));
  --lb-art-w: calc(var(--lb-hero-h) * 1536 / 443);
  /* the art's left fifth always fades (the title sits there); the fade deepens to a third where the art leaves room */
  --lb-fade: max(calc(var(--lb-art-w) * 0.2), min(calc(var(--lb-art-w) * 0.34), calc((100cqw - var(--lb-art-w)) * 40)));
  height: var(--lb-hero-h);
  /* the art's own sky, sampled down its left third */
  background: linear-gradient(180deg, #85e8fb 0%, #9eecf7 30%, #bef0ef 62%, #d3f3e9 100%);
}
.lb--wide .lb-banner__art {
  inset: auto;
  top: 0; /* the art's own sky above the cup (11% of the band) */
  right: 0;
  width: var(--lb-art-w);
  height: var(--lb-hero-h);
  max-width: none;
  object-fit: fill;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--lb-fade));
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--lb-fade));
}
.lb--wide .lb-banner__copy {
  /* the title block ends a little before the trophy's handle (36% of the art's width from its right edge) */
  position: absolute;
  top: 0;
  bottom: 0;
  left: 28px;
  right: calc(var(--lb-art-w) * 0.36 + 14px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.lb--wide .lb-banner__title,
.lb--wide .lb-banner__subtitle {
  position: static;
  width: auto;
  height: auto;
}
.lb--wide .lb-banner__title {
  font-size: calc(50 * var(--lu));
  line-height: 1.15;
}
.lb--wide .lb-banner__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.lb--wide .lb-banner__subtitle {
  flex: 0 1 auto;
  min-width: 0;
  font-size: calc(28 * var(--lu));
}
.lb--wide .lb-banner__chip {
  position: static;
  flex: 0 1 auto;
  min-width: 0;
  max-width: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  font-size: 16px;
}

.lb--wide .lb-tabs {
  padding-top: calc(20 * var(--lu));
}
.lb--wide .lb-tab {
  flex: 1 1 auto;
  padding: 0 calc(22 * var(--lu));
}
/* a Topic board adds a fifth tab: five equal columns whose labels wrap to a second line at their full size
   (never "Leag…" beside a long topic name) */
@media (min-width: 1200px) {
  .lb--wide .lb-tabs:has(.lb-tab:nth-child(5)) {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .lb--wide .lb-tabs:has(.lb-tab:nth-child(5)) .lb-tab {
    min-width: 0 !important;
    height: auto;
    min-height: calc(66 * var(--lu));
    padding: 8px 10px;
  }
  .lb--wide .lb-tabs:has(.lb-tab:nth-child(5)) .lb-tab__label {
    font-size: inherit !important;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: break-word;
    text-overflow: clip;
    text-align: center;
  }
}

/* column captions over the rows: rank, player, country, points */
.lb--wide .lb-cols {
  display: flex;
  align-items: center;
  gap: calc(14 * var(--lu));
  flex: none;
  padding: calc(16 * var(--lu)) calc(24 * var(--lu) + 22 * var(--lu) + var(--lb-edge)) calc(10 * var(--lu)) calc(24 * var(--lu) + 18 * var(--lu) + var(--lb-edge));
  border-bottom: var(--lb-edge) solid var(--lb-line);
  font-weight: var(--w-semibold);
  font-size: max(15px, calc(21 * var(--lu)));
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-grey);
}
.lb-cols__rank {
  flex: none;
  min-width: calc(76 * var(--lu));
  text-align: center;
}
.lb-cols__player {
  flex: 1;
  padding-left: calc(56 * var(--lu) + 14 * var(--lu));
}
.lb-cols__country {
  flex: none;
  width: var(--lb-country-w);
  text-align: center;
}
.lb-cols__score {
  flex: none;
  min-width: calc(160 * var(--lu));
  text-align: right;
}
.lb--wide .lb-body-wrap,
.lb--wide .lb-note-wrap ~ .lb-body-wrap {
  margin-top: 0;
}
.lb--wide .lb-body {
  padding-top: calc(14 * var(--lu));
}
.lb--wide .lb-cols ~ .lb-body-wrap .lb-body {
  padding-top: calc(12 * var(--lu));
}
.lb--wide .lb-row__name {
  font-size: calc(29 * var(--lu));
}
/* promotion and demotion zones are marked on the rank pill */
.lb--wide .lb-row--promote .lb-medal {
  box-shadow: 0 0 0 calc(3 * var(--lu)) var(--home-green);
}
.lb--wide .lb-row--demote .lb-medal {
  box-shadow: 0 0 0 calc(3 * var(--lu)) var(--danger);
}
.lb-fresh--inline {
  flex: none;
  min-height: 0;
  padding: calc(14 * var(--lu)) calc(24 * var(--lu)) calc(18 * var(--lu));
  border-top: var(--lb-edge) solid var(--lb-line);
  font-size: max(15px, calc(24 * var(--lu)));
  white-space: pre-wrap;
}
/* one compact row under the list (trophy, message, PLAY): a short board and its call to action fit a window that
   a stacked card would run out of */
.lb--wide .lb-sparse {
  flex-direction: row;
  gap: 18px;
  padding: 10px 14px 10px 22px;
}
.lb--wide .lb-sparse__trophy {
  width: 50px;
  height: 50px;
}
.lb--wide .lb-sparse__text {
  flex: 1;
  min-width: 0;
  min-height: 0;
  text-align: left;
  font-size: calc(28 * var(--lu));
}
.lb--wide .lb-sparse .btn {
  --btn-h: calc(84 * var(--lu));
  flex: none;
}
/* a short phone (a 640-700 px tall viewport): the stacked card is tighter so PLAY ends clear of the footer */
@media (max-height: 700px) {
  .lb--phone .lb-sparse {
    gap: calc(8 * var(--lu));
    padding: calc(18 * var(--lu)) calc(40 * var(--lu)) calc(20 * var(--lu));
  }
  .lb--phone .lb-sparse__trophy {
    width: calc(72 * var(--lu));
    height: calc(72 * var(--lu));
  }
  .lb--phone .lb-sparse__text {
    min-height: 0;
  }
}
/* the card steps aside when the list has no room for it whole (Leaderboards.js measureSparse); the side panel's
   PLAY stands in for it */
.lb-sparse.is-tight {
  display: none;
}

/* ---- side column ---------------------------------------------------------------------------------------- */
.lb__aside {
  flex: 0 0 clamp(290px, 27vw, 350px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: none;
}
/* a large monitor: the hub column (and its header) grows past 1160 px, so the board panel takes the width the side
   column does not, and the side column widens a little with it; the two always fill the header's measure */
@media (min-width: 1600px) {
  .lb__aside {
    flex-basis: clamp(350px, 22vw, 420px);
  }
}
.lb-card {
  flex: none;
  padding: calc(30 * var(--lu));
  border-radius: calc(44 * var(--lu));
  background: var(--lb-paper);
  box-shadow: 0 calc(10 * var(--lu)) calc(24 * var(--lu)) rgba(0, 0, 0, 0.14);
}
.lb-standing {
  display: flex;
  flex-direction: column;
  gap: calc(26 * var(--lu));
  background: var(--lb-tint);
}
.lb-standing__who {
  display: flex;
  align-items: center;
  gap: calc(24 * var(--lu));
}
.lb-standing__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: calc(10 * var(--lu));
}
.lb-standing__name {
  font-weight: var(--w-bold);
  font-size: calc(38 * var(--lu));
  line-height: 1.15;
  color: var(--lb-ink);
}
.lb-standing__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(8 * var(--lu)) calc(14 * var(--lu));
}
.lb-standing__score {
  font-weight: var(--w-bold);
  font-size: calc(34 * var(--lu));
  line-height: 1;
  color: var(--lb-ink);
  font-variant-numeric: tabular-nums;
}
.lb-standing__unit {
  font-weight: var(--w-semibold);
  font-size: max(15px, calc(22 * var(--lu)));
  letter-spacing: 0.08em;
  color: var(--section-grey);
}
.lb-standing__invite {
  font-weight: var(--w-medium);
  font-size: calc(28 * var(--lu));
  line-height: 1.3;
  color: var(--lb-ink);
  text-wrap: balance;
}
.lb-standing__action {
  display: flex;
}
.lb-standing__action .btn {
  flex: 1;
}
/* a short board has its own PLAY card under the list; the side panel's PLAY only stands in for it where that card
   does not fit (see the short-window rule by the sparse card) */
.lb-standing__play.is-sparse {
  display: none;
}
.lb-leaguecard .lb-league {
  padding: 0;
}
.lb-leaguecard .lb-league__inner {
  padding: 0;
  background: transparent;
  box-shadow: none;
  gap: calc(8 * var(--lu));
}
.lb-leaguecard .lb-league__label {
  font-weight: var(--w-bold);
  font-size: calc(32 * var(--lu));
}
.lb-leaguecard .lb-league__hint {
  font-size: calc(26 * var(--lu));
}
.lb-league__points {
  font-weight: var(--w-semibold);
  font-size: calc(28 * var(--lu));
  line-height: 1.25;
  color: var(--lb-ink);
}
.lb-ladder {
  margin-top: calc(30 * var(--lu));
}
.lb-ladder__bar {
  position: relative;
  height: calc(22 * var(--lu));
  border-radius: 999px;
  background: #dcdee6;
}
.lb-ladder__zone {
  position: absolute;
  top: 0;
  bottom: 0;
}
.lb-ladder__zone--promote {
  border-radius: 999px 0 0 999px;
  background: var(--home-green);
}
.lb-ladder__zone--demote {
  border-radius: 0 999px 999px 0;
  background: var(--danger);
}
.lb-ladder__you {
  position: absolute;
  top: 50%;
  width: calc(38 * var(--lu));
  height: calc(38 * var(--lu));
  border-radius: 50%;
  background: #fff;
  border: calc(7 * var(--lu)) solid var(--lb-ink);
  transform: translate(-50%, -50%);
  box-shadow: 0 calc(3 * var(--lu)) calc(6 * var(--lu)) rgba(0, 0, 0, 0.25);
}
.lb-ladder__legend {
  display: flex;
  flex-wrap: wrap;
  gap: calc(10 * var(--lu)) calc(26 * var(--lu));
  margin-top: calc(22 * var(--lu));
  font-weight: var(--w-medium);
  font-size: max(15px, calc(23 * var(--lu)));
  color: var(--lb-muted);
}
.lb-ladder__legend li {
  display: inline-flex;
  align-items: center;
  gap: calc(10 * var(--lu));
}
/* the band the player is in reads as their status */
.lb-ladder__legend li.is-current {
  font-weight: var(--w-semibold);
  color: var(--lb-ink);
}
.lb-ladder__legend li::before {
  content: '';
  flex: none;
  width: calc(18 * var(--lu));
  height: calc(18 * var(--lu));
  border-radius: 50%;
  background: var(--lb-neutral);
}
.lb-ladder__legend .is-promote::before {
  background: var(--home-green);
}
.lb-ladder__legend .is-demote::before {
  background: var(--danger);
}

/* the league tiers: the whole path when the side column has room for it, the player's tier and its neighbours
   when it has less, nothing when it has none (the slot is a size container) */
.lb-tiers-slot {
  flex: 1 1 0;
  min-height: 0;
  container-type: size;
}
.lb-tierscard {
  --lb-tiers-pad: 20px;
  display: none;
  height: 100%;
  flex-direction: column;
  padding: var(--lb-tiers-pad) 24px;
}
@container (min-height: 120px) {
  .lb-tierscard {
    display: flex;
  }
  /* the short path is one compact group in the middle of the card, not two dots pushed to its edges */
  .lb-tierscard .lb-tiers {
    --lb-tier-n: var(--lb-tier-near-count);
    --lb-tier-f: var(--lb-tier-near-at);
    --lb-tier-step: 40px;
    flex: none;
    margin-block: auto;
    gap: 16px;
  }
  .lb-tiers__step:not(.is-near) {
    display: none;
  }
}
@container (min-height: 250px) {
  .lb-tierscard .lb-tiers {
    --lb-tier-n: var(--lb-tier-count);
    --lb-tier-f: var(--lb-tier-at);
    --lb-tier-step: clamp(28px, (100cqh - 2 * var(--lb-tiers-pad)) / var(--lb-tier-n, 7), 48px);
    flex: 1;
    margin-block: 0;
    gap: 0;
  }
  .lb-tiers__step:not(.is-near) {
    display: flex;
  }
}
.lb-tiers {
  --lb-tier-dot: 20px;
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* the path through the dots: grey above the player's tier, green from it down */
.lb-tiers::before,
.lb-tiers::after {
  content: '';
  position: absolute;
  left: calc(var(--lb-tier-dot) / 2 - 2px);
  width: 4px;
  border-radius: 2px;
}
.lb-tiers::before {
  top: calc(var(--lb-tier-step) / 2);
  bottom: calc(var(--lb-tier-step) / 2);
  background: #dcdee6;
}
.lb-tiers::after {
  top: calc((100% - var(--lb-tier-step)) * var(--lb-tier-f, 1) + var(--lb-tier-step) / 2);
  bottom: calc(var(--lb-tier-step) / 2);
  background: var(--home-green);
}
.lb-tiers__step {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--lb-tier-step);
}
.lb-tiers__dot {
  flex: none;
  box-sizing: border-box;
  width: var(--lb-tier-dot);
  height: var(--lb-tier-dot);
  border-radius: 50%;
  background: var(--lb-paper);
  border: 4px solid #c9ccd6;
}
.lb-tiers__step.is-past .lb-tiers__dot,
.lb-tiers__step.is-current .lb-tiers__dot {
  background: var(--home-green);
  border-color: var(--home-green);
}
.lb-tiers__step.is-current .lb-tiers__dot {
  box-shadow: 0 0 0 5px rgba(47, 203, 106, 0.28);
}
.lb-tiers__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--w-medium);
  font-size: calc(28 * var(--lu));
  line-height: 1.2;
  color: var(--lb-muted);
}
.lb-tiers__step.is-past .lb-tiers__name {
  color: var(--lb-ink);
}
.lb-tiers__step.is-current .lb-tiers__name {
  font-weight: var(--w-bold);
  font-size: calc(32 * var(--lu));
  color: var(--lb-ink);
}
.lb-avatar--tier {
  width: calc(56 * var(--lu));
  height: calc(56 * var(--lu));
  font-size: calc(30 * var(--lu));
}

/* short desktop windows (a 720 px laptop): slimmer tabs, captions and rows so the list still shows five rows */
@media (min-width: 1200px) and (max-height: 780px) {
  .lb--wide {
    --lb-row-h: calc(74 * var(--lu));
  }
  .lb--wide .lb-tabs {
    padding-top: calc(16 * var(--lu));
  }
  .lb--wide .lb-tab {
    height: calc(66 * var(--lu));
  }
  .lb--wide .lb-cols {
    padding-top: calc(12 * var(--lu));
    padding-bottom: calc(8 * var(--lu));
  }
  .lb--wide .lb-cols ~ .lb-body-wrap .lb-body {
    padding-top: calc(10 * var(--lu));
  }
  .lb-fresh--inline {
    padding-top: calc(11 * var(--lu));
    padding-bottom: calc(14 * var(--lu));
  }
}

/* ---- tablets (760-1199 px) --------------------------------------------------------------------------------- */
/* Fixed type for a held screen; landscape keeps the desktop's panel and side column, portrait stacks them. */
@media (min-width: 760px) and (max-width: 1199px) {
  .lb--wide {
    --lu: 0.62px;
    --lb-row-h: 52px;
    gap: 16px;
    padding: 16px 24px 24px;
  }
  .lb--wide .lb__panel {
    max-width: none;
  }
  .lb--wide .lb-banner__copy {
    left: 24px;
    right: calc(var(--lb-art-w) * 0.36 + 26px);
  }
  .lb--wide .lb-banner__title {
    font-size: 28px;
  }
  .lb--wide .lb-banner__subtitle {
    font-size: 18px;
  }
  .lb--wide .lb-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px 0;
  }
  .lb--wide .lb-tabs:has(.lb-tab:nth-child(5)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .lb--wide .lb-tab {
    /* tablet labels wrap at their readable size rather than losing words to the single-line fitter or its
       inline minimum width */
    min-width: 0 !important;
    min-height: 42px;
    height: auto;
    padding: 9px 10px;
    font-size: 16px;
  }
  .lb--wide .lb-tab__label {
    font-size: inherit !important;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
  .lb--wide .lb-flag--tab {
    width: 24px;
    height: 17px;
    margin-right: 7px;
  }
  .lb--wide .lb-cols {
    padding-top: 12px;
    padding-bottom: 8px;
    font-size: 14px;
  }
  .lb--wide .lb-body {
    padding-bottom: 12px;
  }
  .lb--wide .lb-row,
  .lb--wide .lb-row__hit {
    gap: 9px;
  }
  .lb--wide .lb-row__name {
    font-size: 17px;
  }
  .lb--wide .lb-row__score,
  .lb--wide .lb-cols__score {
    min-width: 64px;
  }
  .lb--wide .lb-row__country,
  .lb--wide .lb-cols__country {
    width: 76px; /* wide enough for the caption "COUNTRY" at 14 px */
  }
  .lb--wide .lb-fresh--inline {
    padding: 10px 16px 12px;
    font-size: 14px;
    line-height: 1.35;
  }
  .lb--wide .lb__aside {
    flex-basis: clamp(270px, 29vw, 330px);
    gap: 14px;
  }
  .lb--wide .lb-card {
    min-width: 0;
    padding: 16px;
    border-radius: 24px;
  }
  .lb--wide .lb-standing {
    gap: 14px;
  }
  .lb--wide .lb-standing__who {
    gap: 12px;
  }
  .lb--wide .lb-avatar--lg {
    width: 48px;
    height: 48px;
    font-size: 26px;
  }
  .lb--wide .lb-standing__name {
    font-size: 21px;
  }
  .lb--wide .lb-standing__score {
    font-size: 20px;
  }
  .lb--wide .lb-standing__unit {
    font-size: 14px;
  }
  .lb--wide .lb-standing__action .btn {
    --btn-h: 44px;
    font-size: 16px;
  }
  .lb--wide .lb-leaguecard .lb-league__label {
    font-size: 19px;
  }
  .lb--wide .lb-league__points {
    font-size: 17px;
  }
  .lb--wide .lb-leaguecard .lb-league__hint {
    font-size: 15px;
    line-height: 1.4;
  }
  .lb--wide .lb-ladder {
    margin-top: 18px;
  }
  .lb--wide .lb-ladder__legend {
    margin-top: 14px;
    font-size: 15px;
  }
  .lb--wide .lb-tierscard {
    --lb-tiers-pad: 16px;
    padding: 16px;
  }
  .lb--wide .lb-tiers {
    --lb-tier-dot: 16px;
  }
  .lb--wide .lb-tiers__dot {
    border-width: 3px;
  }
  .lb--wide .lb-tiers__step.is-current .lb-tiers__dot {
    box-shadow: 0 0 0 4px rgba(47, 203, 106, 0.28);
  }
  .lb--wide .lb-tiers__name {
    font-size: 16px;
  }
  .lb--wide .lb-tiers__step.is-current .lb-tiers__name {
    font-size: 17px;
  }
  .lb--wide .lb-avatar--tier {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
}

/* portrait tablets and narrow windows: the board on top filling the height, the two cards side by side below */
@media (min-width: 760px) and (max-width: 1199px) and (orientation: portrait), (min-width: 760px) and (max-width: 959px) {
  .lb--wide {
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .lb--wide .lb__panel {
    flex: 1 1 0;
    min-height: 460px;
  }
  .lb--wide .lb__aside {
    flex: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
    gap: 14px;
    overflow: visible;
  }
  /* the two cards share a row height: the standing's button sits on the card's lower edge like the ladder's legend */
  .lb--wide .lb-standing {
    justify-content: space-between;
  }
  .lb--wide .lb-tiers-slot {
    display: none;
  }
}

/* a held portrait tablet has the height for the whole hero: the art at its own proportions, the title block where
   the prefab puts it (over the sky) */
@media (min-width: 760px) and (max-width: 1199px) and (orientation: portrait) {
  .lb--wide .lb-banner {
    height: auto;
    aspect-ratio: 1536 / 443;
  }
  .lb--wide .lb-banner__art {
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .lb--wide .lb-banner__copy {
    --lb-art-w: 100%;
    top: 16%;
    bottom: auto;
    justify-content: flex-start;
  }
  .lb--wide .lb-banner__title {
    font-size: 32px;
  }
  .lb--wide .lb-banner__subtitle {
    font-size: 20px;
  }
}
