.standings-page-filters {
  display: flex;
  margin: 0 0 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.standings-filter-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.standings-filter-field label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  white-space: nowrap;
  text-transform: uppercase;
}

.standings-filter-field select {
  width: 7.25rem;
  min-height: 2rem;
  padding-block: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.standings-filter-field:first-child select {
  width: 7.25rem;
}

.admin-survivor-week-selector {
  display: flex;
  margin: 0;
  padding: 0.75rem;
  align-items: end;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0.2rem solid var(--gold);
  border-radius: 0.75rem;
  box-shadow: 0 0.5rem 1.5rem rgb(11 31 51 / 6%);
}

.standings-card {
  border-top: 0.3rem solid var(--navy);
  box-shadow: 0 1rem 3rem rgb(11 31 51 / 8%);
}

.standings-table {
  min-width: 42rem;
  width: max(100%, 42rem);
  table-layout: fixed;
  /* Keep borders attached to sticky cells, with no half-border joins at Rank. */
  border-collapse: separate;
  border-spacing: 0;
}

/* Opaque row backgrounds keep horizontally scrolling values behind usernames. */
.standings-table tbody tr { background-color: var(--surface); }

.standings-table > thead > tr > th:nth-child(2),
.standings-table > tbody > tr > td:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 4;
  box-shadow: var(--standings-divider, none);
}

.standings-table > tbody > tr > td:nth-child(2) { background: inherit; }
.standings-table > thead > tr > th:nth-child(2) { z-index: 5; }
.standings-table > tbody > tr.is-current-username > td:nth-child(2) {
  background: linear-gradient(var(--current-username-background), var(--current-username-background)), #ffffff;
  box-shadow: var(--standings-divider, none);
}

.standings-table > thead > tr > th { line-height: 1.25; vertical-align: middle; }

.standings-rank-column {
  width: 10%;
}

.standings-username-column {
  width: 34%;
}

.standings-points-column,
.standings-record-column {
  width: 14%;
}

.standings-diff-column {
  width: 12%;
}

.standings-prize-column {
  width: 16%;
}

.standings-card th,
.standings-card td {
  padding: 0.95rem 1.25rem;
  vertical-align: middle;
}

.standings-card .standings-table:not(.what-if-standings-table) > tbody > tr > td {
  height: 2.75rem;
  padding-block: 0.4rem;
}

.standings-card td:first-child,
.standings-card th:first-child,
.standings-card td:nth-child(3),
.standings-card td:nth-child(4),
.standings-card td:nth-child(5),
.standings-card td:nth-child(6),
.standings-card th:nth-child(3),
.standings-card th:nth-child(4),
.standings-card th:nth-child(5),
.standings-card th:nth-child(6) {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.standings-card tbody tr:last-child td {
  border-bottom: 0;
}

.standings-card tbody tr.has-projected-prize:not(.is-first-place) {
  background: #ffffff;
}

.standings-card tbody tr.has-projected-prize:not(.is-first-place):hover {
  background: var(--gold-soft);
}

.standings-card tbody tr.has-projected-prize:not(.is-first-place) td:first-child {
  box-shadow: inset 0.3rem 0 var(--green);
}

.standings-card tbody tr.is-first-place {
  background: linear-gradient(90deg, #e4edf5, #f5f8fb 58%, #ffffff);
}

.standings-card tbody tr.is-first-place.has-projected-prize {
  background: #ffffff;
}

.standings-card tbody tr.is-first-place:hover {
  background: var(--gold-soft);
}

.standings-card tbody tr.is-first-place:not(.is-prize-winner) td:first-child {
  box-shadow: inset 0.35rem 0 var(--gold);
}

.standings-card tbody tr.is-prize-winner:not(.is-first-place) {
  background: var(--green-soft);
}

.standings-card tbody tr.is-prize-winner:not(.is-first-place):hover {
  background: var(--gold-soft);
}

.standings-card tbody tr.is-prize-winner:not(.is-first-place) td:first-child {
  box-shadow: inset 0.3rem 0 var(--green);
}

.standings-rank {
  display: inline-flex;
  min-width: 2.15rem;
  min-height: 2.15rem;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  line-height: 1;
}

.standings-card tbody tr.is-first-place.is-prize-winner {
  background: linear-gradient(90deg, #ffe9b2, var(--gold-soft) 58%, #fffdf8);
}

.standings-card tbody tr.is-first-place.is-prize-winner:hover {
  background: var(--gold-soft);
}

.standings-card tbody tr.is-first-place.is-prize-winner:not(.is-standings-champion) td:first-child {
  box-shadow: inset 0.35rem 0 var(--gold);
}

.standings-card tbody tr:hover {
  background: var(--gold-soft);
}

.standings-card tbody tr.is-current-username,
.standings-card tbody tr.is-current-username:hover,
.standings-card tbody tr.is-current-username:is(.is-first-place, .has-projected-prize, .is-prize-winner),
.standings-card tbody tr.is-current-username:is(.is-first-place, .has-projected-prize, .is-prize-winner):hover {
  color: #ffffff;
  background: var(--current-username-background);
}

.standings-card tbody tr.is-current-username td {
  border-top: 1px solid var(--current-username-border);
  border-bottom: 1px solid var(--current-username-border);
}

.standings-card tbody tr.is-current-username td:first-child,
.standings-card tbody tr.is-current-username:is(.is-first-place, .has-projected-prize, .is-prize-winner) td:first-child {
  box-shadow: inset 0.3rem 0 var(--gold);
}

.standings-card tbody tr.is-current-username td:last-child {
  box-shadow: inset -1px 0 var(--current-username-border);
}

.standings-username-link {
  color: var(--navy);
  font-weight: 700;
}

.standings-username-link:hover {
  color: var(--green-dark);
}

.standings-card tbody tr.is-current-username .standings-username-link {
  color: #ffffff;
}

.standings-card tbody tr.is-current-username .standings-username-link:hover,
.standings-card tbody tr.is-current-username .standings-username-link:focus-visible {
  color: var(--gold);
}

.standings-prize {
  display: inline-grid;
  min-width: 4.75rem;
  min-height: 2.45rem;
  padding: 0.25rem 0.6rem;
  place-items: center;
  gap: 0.05rem;
  color: var(--navy);
  line-height: 1;
  background: #ffe8aa;
  border: 1px solid #e2a82f;
  border-radius: 0.55rem;
}

.standings-prize.is-projected {
  background: #ffffff;
  border-color: #af8a39;
  border-style: dashed;
}

.standings-card tbody tr.has-projected-prize:not(.is-first-place) .standings-prize {
  border-color: var(--green);
}

.standings-card tbody tr.is-prize-winner:not(.is-first-place) .standings-prize {
  background: var(--green-prize-fill);
  border-color: var(--green);
}

.standings-prize-value {
  font-size: 0.9rem;
  font-weight: 850;
}

.standings-prize-status {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.standings-card tbody tr.is-prize-winner .standings-prize-status {
  color: var(--navy);
}

@keyframes standings-champion-sheen {
  0%,
  72.1667% {
    background-position: calc(var(--standings-sheen-width) * -1 - var(--standings-cell-offset)) 0;
  }

  100% {
    background-position: calc(var(--standings-sheen-width) - var(--standings-cell-offset)) 0;
  }
}

.standings-card tbody tr.is-first-place.is-standings-champion,
.standings-card tbody tr.is-first-place.is-standings-champion:hover {
  background: #ffffff;
}

.standings-card tbody tr.is-current-username.is-first-place.is-standings-champion,
.standings-card tbody tr.is-current-username.is-first-place.is-standings-champion:hover {
  background: var(--current-username-background);
}

/* Current leaders retain their colored edges on white rows. */
.standings-card tbody tr:is(.is-first-place, .has-projected-prize):not(.is-current-username):not(.is-prize-winner):not(.is-standings-champion):not(:hover) {
  background: #ffffff;
}

/* Final prize fades end within Username instead of restarting in later cells. */
.standings-card tbody tr:is(.is-prize-winner, .is-standings-champion):not(.is-current-username),
.standings-card tbody tr:is(.is-prize-winner, .is-standings-champion):not(.is-current-username):hover {
  --standing-fade-color: #cfead9;
  background: #ffffff;
}

.standings-card tbody tr.is-first-place:is(.is-prize-winner, .is-standings-champion):not(.is-current-username) {
  --standing-fade-color: #ffe9b2;
}

.standings-card tbody tr:is(.is-prize-winner, .is-standings-champion):not(.is-current-username) > td:first-child {
  background: var(--standing-fade-color);
}

.standings-card tbody tr:is(.is-prize-winner, .is-standings-champion):not(.is-current-username) > td:nth-child(2) {
  background: linear-gradient(90deg, var(--standing-fade-color), #ffffff 72%);
}

/* Hover must paint above prize fills, including the opaque sticky Username. */
.standings-card tbody tr:is(.is-first-place, .has-projected-prize, .is-prize-winner, .is-standings-champion):not(.is-current-username):hover,
.standings-card tbody tr:is(.is-first-place, .has-projected-prize, .is-prize-winner, .is-standings-champion):not(.is-current-username):hover > td:first-child,
.standings-card tbody tr:is(.is-first-place, .has-projected-prize, .is-prize-winner, .is-standings-champion):not(.is-current-username):hover > td:nth-child(2) {
  background: var(--gold-soft);
}

/* Cell containing blocks keep Safari's sheen inside the champion row. Each
   cell shows the corresponding slice of the same table-wide animation. */
.standings-card tbody tr.is-standings-champion > td {
  position: relative;
}

.standings-card tbody tr.is-standings-champion > td:nth-child(2) {
  position: sticky;
}

.standings-card tbody tr.is-standings-champion > td::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: linear-gradient(110deg, transparent 0 44%, rgb(255 255 255 / 40%) 48%, rgb(242 177 52 / 18%) 52%, transparent 56% 100%);
  background-repeat: no-repeat;
  background-size: var(--standings-sheen-width) 100%;
  animation: standings-champion-sheen 6s ease-in-out infinite;
}

.standings-card tbody tr.is-standings-champion > td {
  font-weight: 700;
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  box-shadow: none;
}

.standings-card tbody tr.is-standings-champion > td:first-child,
.standings-card tbody tr.is-current-username.is-standings-champion > td:first-child {
  padding-inline: 0.65rem;
  border-left: 0;
  box-shadow: inset 0.3rem 0 var(--gold);
}

.standings-card tbody tr.is-standings-champion > td:last-child,
.standings-card tbody tr.is-current-username.is-standings-champion > td:last-child {
  border-right: 2px solid var(--gold);
  box-shadow: none;
}

.standings-card tbody tr.is-standings-champion .standings-rank {
  position: relative;
  min-width: 3.15rem;
  min-height: 2.25rem;
  padding: 0.3rem 0.45rem;
  overflow: hidden;
  gap: 0.22rem;
  color: var(--navy);
  background: linear-gradient(135deg, #fff7d7 0%, #f9ca67 38%, var(--gold) 62%, #d69212 100%);
  border: 1px solid #b97908;
  border-radius: 999px;
  box-shadow:
    inset 0 1px rgb(255 255 255 / 72%),
    0 0.2rem 0.55rem rgb(11 31 51 / 22%),
    0 0 0 0.2rem rgb(242 177 52 / 20%);
}

.standings-card tbody tr.is-standings-champion .standings-rank::after {
  position: absolute;
  inset: -35% auto -35% 47%;
  width: 28%;
  transform: skewX(-18deg);
  background: rgb(255 255 255 / 42%);
  content: "";
}

.standings-champion-trophy,
.standings-rank-value {
  position: relative;
  z-index: 1;
}

.standings-champion-trophy {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.standings-card tbody tr.is-standings-champion .standings-prize {
  background: linear-gradient(135deg, #fff4c9 0%, #f8c75e 48%, var(--gold) 100%);
  border-color: var(--navy);
  box-shadow:
    inset 0 1px rgb(255 255 255 / 72%),
    0 0 0 0.18rem rgb(242 177 52 / 28%),
    0 0.25rem 0.6rem rgb(11 31 51 / 16%);
}

.standings-modal {
  width: min(calc(100% - 2rem), 44rem);
  max-height: min(48rem, calc(100vh - 2rem));
  padding: 0;
  overflow: visible;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.standings-modal::backdrop {
  background: rgb(11 31 51 / 68%);
  backdrop-filter: blur(0.15rem);
}

.standings-modal-panel {
  position: relative;
  max-height: min(48rem, calc(100vh - 2rem));
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0.35rem solid var(--gold);
  border-radius: 1rem;
  box-shadow: 0 2rem 5rem rgb(0 0 0 / 30%);
}

.standings-modal-close {
  position: absolute;
  z-index: 1;
  top: 0.8rem;
  right: 0.8rem;
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  place-items: center;
  color: var(--navy);
  font: inherit;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.standings-modal-close::before,
.standings-modal-close::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 0.125rem;
  content: "";
  background: currentcolor;
  border-radius: 999px;
}

.standings-modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.standings-modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.standings-modal-close:hover {
  color: #ffffff;
  background: var(--navy);
  border-color: var(--navy);
}

.standings-modal turbo-frame {
  display: block;
}

.standings-modal-loading {
  margin: 0;
  padding: 4rem 2rem;
  color: var(--muted);
  text-align: center;
}

.standing-results-heading {
  padding: 1.5rem 4rem 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.standing-results-heading h2 {
  margin: 0.1rem 0 0;
  color: var(--navy);
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.standing-results-heading > p:last-child {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.standing-results-table-wrap {
  overflow-x: auto;
}

.standing-results-table {
  table-layout: fixed;
}

.standing-results-table th,
.standing-results-table td {
  padding: 0.8rem 1rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.standing-results-table th:first-child,
.standing-results-table td:first-child {
  width: 24%;
  text-align: left;
}

.standing-results-table tbody tr:last-child td {
  border-bottom: 0;
}

.standing-results-table tbody tr:nth-child(even) {
  background: var(--background);
}

.standing-results-row {
  cursor: pointer;
}

.standing-results-table tbody tr.standing-results-row:hover {
  background: var(--green-soft);
}

.standing-results-row:hover .standing-results-week-link {
  color: var(--navy);
}

.standing-results-week-link {
  color: var(--green-dark);
  font-weight: 700;
}

.standing-results-week-link:hover {
  color: var(--navy);
}

.standing-pick-sheet-back {
  display: inline-flex;
  margin-bottom: 1rem;
  color: var(--green-dark);
  font-weight: 700;
}

.game-status.forfeited,
.game-status.missed {
  color: var(--danger-dark);
  background: var(--danger-soft);
  border: 1px solid #f3aaaa;
}

.game-status.picks-hidden {
  color: #6f4c06;
  background: var(--gold-soft);
  border: 1px solid #e8c46f;
}

.read-only-confidence {
  display: grid;
  width: 100%;
  place-items: center;
  border: 1px solid #b9c3cc;
  border-radius: 0.45rem;
}

.read-only-tiebreak-label {
  font-size: 0.86rem;
  font-weight: 700;
}

.read-only-tiebreak {
  display: grid;
  min-height: 2.25rem;
  place-items: center;
  background: #e9eef3;
  border: 1px solid #b9c3cc;
  border-radius: 0.4rem;
}

@media (max-width: 48rem) {
  .admin-survivor-week-selector {
    align-self: flex-start;
  }

  .standings-card th,
  .standings-card td {
    padding: 0.8rem 0.9rem;
  }
}

@media (max-width: 38rem) {
  .admin-survivor-week-selector {
    width: 100%;
  }

  .standings-modal {
    width: calc(100% - 1rem);
    max-height: calc(100vh - 1rem);
  }

  .standings-modal-panel {
    max-height: calc(100vh - 1rem);
    border-radius: 0.8rem;
  }

  .standing-results-heading {
    padding: 1.25rem 3.75rem 1rem 1rem;
  }

  .standing-results-table th,
  .standing-results-table td {
    padding: 0.75rem 0.45rem;
    font-size: 0.82rem;
  }
}

.standings-page-filters .entry-table-jump {
  margin-left: auto;
}

@media (max-width: 40rem) {
  .standings-page-filters.has-week-filter .standings-filter-field:first-child {
    flex-basis: 100%;
  }

  .standings-page-filters .entry-table-jump {
    gap: 0.3rem;
    padding-inline: 0.5rem;
    font-size: 0.72rem;
  }

  .standings-page-filters .entry-table-jump-icon {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* Apply the divider after prize/champion rules, only when values can scroll. */
.standings-card.is-scrollable {
  --standings-divider: 1px 0 var(--border), 0.5rem 0 0.65rem -0.3rem rgb(11 31 51 / 22%);
}

.standings-card .standings-table > tbody > tr > td:nth-child(2) {
  box-shadow: var(--standings-divider, none);
}

@media (prefers-reduced-motion: reduce) {
  .standings-card tbody tr.is-standings-champion > td::after { animation: none; background-image: none; }
}
