.competition-floor {
  --rank-ink: #121924;
  --rank-muted: #657083;
  --rank-line: #dfe4e2;
  --rank-paper: #f5f7f4;
  --rank-green: #087f68;
  --rank-red: #df3658;
  --rank-gold: #f0b925;
  min-height: min(820px, calc(100dvh - 175px));
  border-top: 1px solid var(--rank-line);
  background: var(--rank-paper);
  color: var(--rank-ink);
}

.competition-floor button,
.competition-floor select {
  font: inherit;
}

body.tournament-balance-active .top-balance {
  border-color: #f0b925;
  background: #111a23;
  color: #fff;
}

body.tournament-balance-active .top-balance small {
  color: #f5ca48;
}

.competition-masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px clamp(20px, 3vw, 46px) 24px;
  border-bottom: 1px solid var(--rank-line);
  background: #fff;
}

.competition-masthead .eyebrow,
.cup-heading .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  color: var(--rank-green);
  font-size: 11px;
  font-weight: 900;
}

.competition-masthead h2,
.cup-heading h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1;
}

.competition-masthead > div > p:last-child {
  margin: 9px 0 0;
  color: var(--rank-muted);
  font-size: 13px;
  font-weight: 700;
}

.live-beacon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rank-red);
  box-shadow: 0 0 0 0 rgba(223, 54, 88, 0.28);
  animation: ranking-pulse 1.6s ease-out infinite;
}

@keyframes ranking-pulse {
  0% { box-shadow: 0 0 0 0 rgba(223, 54, 88, 0.3); }
  70% { box-shadow: 0 0 0 8px rgba(223, 54, 88, 0); }
  100% { box-shadow: 0 0 0 8px rgba(223, 54, 88, 0); }
}

.ranking-freshness {
  display: grid;
  justify-items: end;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.ranking-freshness span {
  color: var(--rank-green);
  font-size: 10px;
  font-weight: 900;
}

.ranking-freshness strong {
  font-size: 20px;
}

.ranking-freshness.is-loading span {
  color: #a66d00;
}

.ranking-freshness.is-error span {
  color: var(--rank-red);
}

.ranking-toolbar {
  position: sticky;
  z-index: 8;
  top: 64px;
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) 42px;
  align-items: center;
  gap: 12px;
  padding: 13px clamp(20px, 3vw, 46px);
  border-bottom: 1px solid var(--rank-line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.ranking-segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(66px, 1fr);
  overflow: hidden;
  border: 1px solid var(--rank-line);
  border-radius: 6px;
  background: #fff;
}

.ranking-segments button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--rank-line);
  background: transparent;
  color: var(--rank-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ranking-segments button:last-child {
  border-right: 0;
}

.ranking-segments button.active {
  background: var(--rank-ink);
  color: #fff;
}

.metric-segments {
  grid-auto-columns: minmax(74px, 1fr);
}

.ranking-game-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--rank-line);
  border-radius: 6px;
  background: #fff;
}

.ranking-game-filter span {
  padding: 0 10px;
  color: var(--rank-green);
  font-size: 10px;
  font-weight: 900;
}

.ranking-game-filter select {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 30px 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--rank-ink);
  font-size: 12px;
  font-weight: 800;
}

.ranking-refresh {
  width: 42px;
  height: 42px;
  border-color: var(--rank-line) !important;
  background: #fff !important;
}

.ranking-refresh.is-spinning {
  animation: ranking-spin 700ms linear infinite;
}

@keyframes ranking-spin {
  to { transform: rotate(360deg); }
}

.podium-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 188px;
  border-bottom: 1px solid var(--rank-line);
  background: #fff;
}

.podium-place {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 28px clamp(18px, 2.5vw, 36px);
  border-right: 1px solid var(--rank-line);
  overflow: hidden;
}

.podium-place:last-child {
  border-right: 0;
}

.podium-place[data-place="1"] {
  background: #fff8dd;
}

.podium-rank {
  display: grid;
  place-items: center;
  width: 64px;
  height: 76px;
  border: 2px solid var(--rank-ink);
  border-radius: 6px;
  background: #fff;
  box-shadow: 6px 6px 0 var(--rank-gold);
  font-size: 29px;
  font-weight: 950;
}

.podium-place[data-place="2"] .podium-rank {
  box-shadow: 6px 6px 0 #bcc5cc;
}

.podium-place[data-place="3"] .podium-rank {
  box-shadow: 6px 6px 0 #cb8964;
}

.podium-copy {
  min-width: 0;
}

.podium-copy span {
  display: block;
  margin-bottom: 7px;
  color: var(--rank-muted);
  font-size: 10px;
  font-weight: 900;
}

.podium-copy strong {
  display: block;
  overflow: hidden;
  font-size: 20px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-copy b {
  display: block;
  margin-top: 10px;
  color: var(--rank-green);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.ranking-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.7fr);
  border-bottom: 1px solid var(--rank-line);
}

.leaderboard-panel {
  min-width: 0;
  border-right: 1px solid var(--rank-line);
  background: #fff;
}

.competition-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--rank-line);
}

.competition-section-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.competition-section-head strong {
  font-size: 13px;
  font-weight: 950;
}

.competition-section-head span {
  color: var(--rank-muted);
  font-size: 10px;
  font-weight: 800;
}

.competition-section-head.compact {
  min-height: 48px;
  padding: 0;
}

.leaderboard-columns,
.leaderboard-row {
  display: grid;
  grid-template-columns: 62px minmax(150px, 1fr) 70px 72px minmax(110px, auto);
  align-items: center;
  gap: 10px;
  min-width: 620px;
}

.leaderboard-columns {
  min-height: 32px;
  padding: 0 20px;
  border-bottom: 1px solid var(--rank-line);
  background: #f5f7f7;
  color: var(--rank-muted);
  font-size: 9px;
  font-weight: 900;
}

.leaderboard-list {
  max-height: 650px;
  overflow: auto;
}

.leaderboard-row {
  position: relative;
  min-height: 66px;
  padding: 0 20px;
  border-bottom: 1px solid #edf0ef;
  background: #fff;
  transition: background 160ms ease, transform 220ms ease;
}

.leaderboard-row:hover {
  background: #f8faf8;
}

.leaderboard-row.is-you {
  background: #fff8d9;
}

.leaderboard-row.is-you::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--rank-gold);
}

.rank-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.rank-cell strong {
  font-size: 18px;
}

.rank-move {
  color: var(--rank-muted);
  font-size: 9px;
  font-weight: 900;
}

.rank-move.up {
  color: var(--rank-green);
}

.rank-move.down {
  color: var(--rank-red);
}

.ranking-player {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ranking-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #cdd4d2;
  border-radius: 50%;
  background: #eff4f2;
  color: var(--rank-green);
  font-size: 9px;
  font-weight: 950;
}

.ranking-player div {
  min-width: 0;
}

.ranking-player strong,
.ranking-player small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-player strong {
  font-size: 13px;
}

.ranking-player small {
  margin-top: 2px;
  color: var(--rank-muted);
  font-size: 9px;
}

.ranking-player .ranking-mobile-meta {
  display: none;
}

.ranking-stat-cell {
  color: var(--rank-muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ranking-score {
  justify-self: end;
  font-size: 16px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.ranking-score.positive {
  color: var(--rank-green);
}

.ranking-score.negative {
  color: var(--rank-red);
}

.personal-standing {
  min-width: 0;
  padding: 24px;
  background: #f8faf8;
}

.your-rank {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 4px 12px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--rank-ink);
}

.your-rank span {
  color: var(--rank-green);
  font-size: 10px;
  font-weight: 950;
}

.your-rank strong {
  grid-row: span 2;
  font-size: 44px;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.your-rank small {
  color: var(--rank-muted);
  font-size: 11px;
}

.personal-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0 10px;
  border-top: 1px solid var(--rank-line);
  border-left: 1px solid var(--rank-line);
}

.personal-metrics div {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--rank-line);
  border-bottom: 1px solid var(--rank-line);
  background: #fff;
}

.personal-metrics span,
.personal-metrics strong {
  display: block;
}

.personal-metrics span {
  margin-bottom: 6px;
  color: var(--rank-muted);
  font-size: 9px;
  font-weight: 800;
}

.personal-metrics strong {
  overflow: hidden;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.game-breakdown {
  display: grid;
  max-height: 300px;
  overflow: auto;
}

.game-breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rank-line);
}

.game-breakdown-row strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-breakdown-row b {
  color: var(--rank-green);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.game-breakdown-row small {
  color: var(--rank-muted);
  font-size: 9px;
}

.game-breakdown-row .breakdown-bar {
  grid-column: 1 / -1;
  height: 3px;
  overflow: hidden;
  background: #e6eae8;
}

.game-breakdown-row .breakdown-bar span {
  display: block;
  height: 100%;
  background: var(--rank-green);
}

.cup-band {
  border-bottom: 1px solid var(--rank-line);
  background: #111a23;
  color: #fff;
}

.cup-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(20px, 3vw, 46px) 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.cup-heading .eyebrow {
  color: #f5ca48;
}

.cup-heading h2 {
  font-size: 36px;
}

.cup-status {
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 4px;
  color: #cad1d7;
  font-size: 10px;
  font-weight: 900;
}

.cup-status.live {
  border-color: var(--rank-red);
  background: var(--rank-red);
  color: #fff;
}

.cup-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 130px;
  padding: 24px;
  color: #aeb8c0;
}

.cup-empty strong {
  color: #f5ca48;
}

.cup-live.hidden,
.cup-empty.hidden,
.cup-player-strip .hidden {
  display: none !important;
}

.team-versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr);
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.team-score {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  min-height: 128px;
  padding: 24px clamp(18px, 3vw, 44px);
  overflow: hidden;
}

.team-score::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--team-color, var(--rank-red));
}

.team-score.team-a::before {
  left: 0;
}

.team-score.team-b::before {
  right: 0;
}

.team-score span {
  font-size: 13px;
  font-weight: 950;
}

.team-score strong {
  grid-row: span 2;
  color: #fff;
  font-size: 35px;
  font-variant-numeric: tabular-nums;
}

.team-score small {
  color: #8d9aa5;
  font-size: 9px;
}

.versus-mark {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.13);
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.versus-mark b {
  color: #f5ca48;
  font-size: 24px;
}

.versus-mark span {
  color: #8d9aa5;
  font-size: 9px;
  font-weight: 900;
}

.cup-blocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.cup-block {
  min-width: 0;
  padding: 22px clamp(16px, 2.5vw, 30px);
  border-right: 1px solid rgba(255, 255, 255, 0.13);
}

.cup-block:last-child {
  border-right: 0;
}

.cup-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.cup-block-head strong {
  font-size: 18px;
}

.cup-block-head span {
  color: #8d9aa5;
  font-size: 9px;
  font-weight: 900;
}

.cup-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  min-height: 64px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cup-event:first-of-type {
  border-top: 0;
}

.cup-event strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cup-event span {
  color: #aab4bd;
  font-size: 9px;
}

.cup-event b {
  grid-row: span 2;
  align-self: center;
  padding: 5px 7px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
  color: #d7dde1;
  font-size: 8px;
}

.cup-event.live b {
  background: var(--rank-red);
  color: #fff;
}

.cup-player-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr)) auto;
  align-items: stretch;
  gap: 0;
  background: #fff;
  color: var(--rank-ink);
}

.cup-player-strip > div {
  min-width: 0;
  padding: 15px 18px;
  border-right: 1px solid var(--rank-line);
}

.cup-player-strip span,
.cup-player-strip strong {
  display: block;
}

.cup-player-strip span {
  margin-bottom: 5px;
  color: var(--rank-muted);
  font-size: 8px;
  font-weight: 900;
}

.cup-player-strip strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cup-player-strip button {
  min-width: 110px;
  margin: 9px;
  border-radius: 5px;
}

.ranking-activity-band {
  background: #fff;
}

.ranking-activity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 0 24px;
  border-right: 1px solid var(--rank-line);
  border-bottom: 1px solid var(--rank-line);
}

.activity-row:nth-child(even) {
  border-right: 0;
}

.activity-row div {
  min-width: 0;
}

.activity-row strong,
.activity-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-row strong {
  font-size: 12px;
}

.activity-row small {
  margin-top: 3px;
  color: var(--rank-muted);
  font-size: 9px;
}

.activity-row b {
  color: var(--rank-green);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.activity-row b.negative {
  color: var(--rank-red);
}

.competition-empty {
  align-self: center;
  justify-self: center;
  margin: 0;
  color: var(--rank-muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .ranking-toolbar {
    grid-template-columns: auto minmax(180px, 1fr) 42px;
  }

  .metric-segments {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .ranking-workspace {
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  }
}

@media (max-width: 900px) {
  .competition-floor {
    min-height: calc(100dvh - 112px);
    border-top: 0;
  }

  .competition-masthead {
    padding: 22px 16px 18px;
  }

  .competition-masthead h2 {
    font-size: 34px;
  }

  .ranking-toolbar {
    top: 0;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    padding: 10px 12px;
  }

  .ranking-segments,
  .metric-segments {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .ranking-game-filter {
    grid-column: 1;
  }

  .podium-band {
    grid-template-columns: minmax(0, 1fr);
  }

  .podium-place {
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 92px;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--rank-line);
  }

  .podium-place:last-child {
    border-bottom: 0;
  }

  .podium-rank {
    width: 46px;
    height: 52px;
    box-shadow: 4px 4px 0 var(--rank-gold);
    font-size: 20px;
  }

  .podium-place[data-place="2"] .podium-rank {
    box-shadow: 4px 4px 0 #bcc5cc;
  }

  .podium-place[data-place="3"] .podium-rank {
    box-shadow: 4px 4px 0 #cb8964;
  }

  .podium-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 10px;
  }

  .podium-copy span,
  .podium-copy strong {
    grid-column: 1;
  }

  .podium-copy b {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
  }

  .ranking-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .leaderboard-panel {
    border-right: 0;
  }

  .leaderboard-list {
    overflow-x: auto;
  }

  .personal-standing {
    border-top: 1px solid var(--rank-line);
  }

  .team-versus {
    grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  }

  .team-score {
    grid-template-columns: minmax(0, 1fr);
    min-height: 112px;
    padding: 18px;
  }

  .team-score strong {
    grid-row: auto;
    font-size: 25px;
  }

  .cup-blocks {
    grid-template-columns: minmax(0, 1fr);
  }

  .cup-block {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  }

  .cup-block:last-child {
    border-bottom: 0;
  }

  .cup-player-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cup-player-strip button {
    grid-column: 1 / -1;
  }

  .ranking-activity {
    grid-template-columns: minmax(0, 1fr);
  }

  .activity-row,
  .activity-row:nth-child(even) {
    border-right: 0;
  }

  .mobile-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .mobile-tabs .tab {
    min-width: 0;
    padding: 0 2px;
    font-size: 10px;
  }
}

@media (max-width: 700px) {
  .competition-masthead {
    align-items: flex-start;
  }

  .ranking-freshness strong {
    font-size: 14px;
  }

  .ranking-segments {
    grid-auto-columns: minmax(0, 1fr);
  }

  .ranking-segments button {
    min-width: 0;
    padding: 0 5px;
    font-size: 10px;
  }

  .leaderboard-columns,
  .leaderboard-row {
    grid-template-columns: 44px minmax(0, 1fr) minmax(76px, auto);
    gap: 6px;
    width: 100%;
    min-width: 0;
    padding-right: 12px;
    padding-left: 12px;
  }

  .leaderboard-columns > :nth-child(3),
  .leaderboard-columns > :nth-child(4),
  .leaderboard-row > .ranking-stat-cell {
    display: none;
  }

  .leaderboard-list {
    overflow-x: hidden;
  }

  .leaderboard-row {
    min-height: 72px;
  }

  .ranking-player {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
  }

  .ranking-avatar {
    width: 30px;
    height: 30px;
  }

  .ranking-player small:not(.ranking-mobile-meta) {
    display: none;
  }

  .ranking-player .ranking-mobile-meta {
    display: block;
    font-size: 8px;
  }

  .ranking-score {
    max-width: 100%;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .personal-standing {
    padding: 20px 16px;
  }

  .team-versus {
    grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  }

  .team-score {
    padding: 16px 12px;
  }

  .team-score span {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .team-score strong {
    font-size: 21px;
  }

  .versus-mark b {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-beacon,
  .ranking-refresh.is-spinning {
    animation: none;
  }
}
