/* ---------- Fantasy: a player on the pitch or the bench ---------- */

/* One token for every place a fantasy player is drawn: the club's crest
   where the shirt would be, a short name on a plate, and the points or the
   next opponent under it. Captaincy, a flagged status and an automatic
   substitution sit on the crest as small badges. */
.pitch-site--app .fantasy-token {
  --token-kit: 44px;
  --token-width: 104px;

  align-items: center;
  color: var(--ps-ink);
  display: flex;
  flex-direction: column;
  inline-size: var(--token-width);
  max-inline-size: 100%;
  position: relative;
  text-decoration: none;
}

.pitch-site--app .fantasy-token__kit {
  align-items: center;
  background: var(--ps-paper-raised);
  border: 2px solid var(--ps-ink);
  border-radius: 50%;
  block-size: var(--token-kit);
  box-shadow: 0 2px 0 rgba(6, 20, 11, 0.45);
  display: flex;
  flex: none;
  inline-size: var(--token-kit);
  justify-content: center;
  margin-block-end: -6px;
  position: relative;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  z-index: 1;
}

.pitch-site--app .fantasy-kit--crest {
  block-size: 66%;
  inline-size: 66%;
  object-fit: contain;
}

.pitch-site--app .fantasy-kit--code {
  color: var(--ps-ink);
  font-family: var(--font-mono);
  font-size: calc(var(--token-kit) * 0.26);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pitch-site--app .fantasy-token__name {
  background: var(--ps-paper);
  border: 2px solid var(--ps-ink);
  border-radius: 6px 6px 0 0;
  border-block-end: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  inline-size: 100%;
  line-height: 1.25;
  overflow: hidden;
  padding: 6px 6px 2px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-site--app .fantasy-token__points {
  background: var(--ps-ink);
  border-radius: 0 0 6px 6px;
  color: var(--ps-cream);
  font-family: var(--font-sans);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  inline-size: 100%;
  line-height: 1.35;
  overflow: hidden;
  padding: 1px 6px 2px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-site--app .fantasy-token__armband {
  background: var(--ps-yellow);
  border: 1.5px solid var(--ps-ink);
  border-radius: 999px;
  color: var(--ps-ink);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  inset-block-start: -5px;
  inset-inline-start: calc(100% - 10px);
  line-height: 1;
  padding: 2px 5px;
  position: absolute;
  white-space: nowrap;
}

.pitch-site--app .fantasy-token__flag {
  align-items: center;
  background: var(--ps-red-bright);
  border: 1.5px solid var(--ps-ink);
  border-radius: 50%;
  block-size: 17px;
  color: var(--ps-cream);
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  inline-size: 17px;
  justify-content: center;
  line-height: 1;
}

.pitch-site--app .fantasy-token__flag--doubtful {
  background: var(--ps-yellow);
  color: var(--ps-ink);
}

.pitch-site--app .fantasy-token__kit .fantasy-token__flag {
  inset-block-start: -5px;
  inset-inline-end: calc(100% - 10px);
  position: absolute;
}

.pitch-site--app .fantasy-token__sub {
  background: var(--ps-ink);
  border-radius: 999px;
  color: var(--ps-live);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  inset-block-end: 2px;
  inset-inline-end: calc(100% - 8px);
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 2px 4px;
  position: absolute;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-token.is-subbed-off .fantasy-token__sub {
  color: var(--ps-red-bright);
}

.pitch-site--app .fantasy-token__place {
  color: var(--ps-cream-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 600;
  line-height: 1;
  margin-block-end: 4px;
}

.pitch-site--app .fantasy-token:hover .fantasy-token__kit,
.pitch-site--app .fantasy-token:focus-visible .fantasy-token__kit,
.pitch-site--app .fantasy-token.is-selected .fantasy-token__kit {
  box-shadow: 0 0 0 3px var(--ps-yellow);
  transform: translateY(-1px);
}

.pitch-site--app .fantasy-token:focus-visible .fantasy-token__name,
.pitch-site--app .fantasy-token.is-selected .fantasy-token__name {
  background: var(--ps-yellow);
}

/* The places the selected player may change with are ringed; the buttons
   beside the pitch are what change them. */
.pitch-site--app .fantasy-token.is-swappable .fantasy-token__kit {
  outline: 2px dashed var(--ps-yellow);
  outline-offset: 3px;
}

.pitch-site--app .fantasy-token.is-subbed-off .fantasy-token__kit {
  opacity: 0.55;
}

.pitch-site--app .fantasy-token.is-subbed-off .fantasy-token__name {
  color: var(--ps-ink-soft);
}

.pitch-site--app .fantasy-token.is-subbed-off .fantasy-token__points {
  color: var(--ps-cream-soft);
}

.pitch-site--app .fantasy-token.is-empty .fantasy-token__name {
  border-block-end: 2px solid var(--ps-ink);
  border-radius: 6px;
  font-style: italic;
  font-weight: 500;
}

/* ---------- Fantasy: the eleven in their lines ---------- */

.pitch-site--app .fantasy-formation {
  display: flex;
  margin: 0;
}

.pitch-site--app .fantasy-formation__line {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pitch-site--app .fantasy-formation__line > li {
  display: flex;
  justify-content: center;
  min-inline-size: 0;
}

/* In a window the pitch stands upright, the goalkeeper at the top, the way
   a fantasy team is read. */
.pitch-site--app .fantasy-formation--window {
  flex-direction: column;
  gap: 18px;
}

.pitch-site--app .fantasy-formation--window .fantasy-formation__line {
  gap: 6px;
  justify-content: space-evenly;
}

.pitch-site--app .fantasy-formation--window .fantasy-formation__line > li {
  flex: 0 1 96px;
}

.pitch-site--app .fantasy-formation--window .fantasy-token {
  --token-kit: 38px;
  --token-width: 96px;
}

.pitch-site--app .fantasy-formation--window .fantasy-token__name,
.pitch-site--app .fantasy-formation--window .fantasy-token__points {
  font-size: 12px;
}

/* On the stage the lines follow the pitch drawn behind them: across it,
   goal to goal, on a landscape screen, and down it on a portrait one. */
.pitch-site--app .fantasy-formation--stage {
  block-size: 100%;
  flex-direction: column;
  gap: 14px;
  justify-content: space-evenly;
}

.pitch-site--app .fantasy-formation--stage .fantasy-formation__line {
  gap: 6px;
  justify-content: space-evenly;
}

.pitch-site--app .fantasy-formation--stage .fantasy-formation__line > li {
  flex: 0 1 104px;
}

@media (orientation: landscape) and (min-width: 50rem) {
  .pitch-site--app .fantasy-formation--stage {
    flex-direction: row;
    gap: 12px;
  }

  .pitch-site--app .fantasy-formation--stage .fantasy-formation__line {
    flex: 1 1 0;
    flex-direction: column;
    gap: 8px;
  }

  .pitch-site--app .fantasy-formation--stage .fantasy-formation__line > li {
    flex: 0 1 auto;
  }
}

/* ---------- Fantasy: the team on the stage ---------- */

/* The eleven fill the turf; the bench and the gameweek's score stand in a
   column on the right, clear of the view links on the left. Below the full
   stage they stack: the eleven, the bench, the score. */
.pitch-site--app .fantasy-stage {
  display: grid;
  flex: 1 1 auto;
  gap: 18px;
  grid-template-areas: "pitch" "bench" "score";
  grid-template-columns: minmax(0, 1fr);
  inline-size: 100%;
  min-block-size: 0;
  position: relative;
}

.pitch-site--app .fantasy-stage--empty {
  align-content: end;
}

.pitch-site--app .fantasy-stage__pitch {
  grid-area: pitch;
  min-block-size: 0;
}

.pitch-site--app .fantasy-stage__bench {
  grid-area: bench;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-stage__score {
  grid-area: score;
}

.pitch-site--app #stage_view[busy] .fantasy-stage {
  opacity: 0.5;
  transition: opacity 0.15s ease 0.15s;
}

@media (min-width: 50rem) and (max-width: 74.999rem) {
  .pitch-site--app .fantasy-stage {
    grid-template-areas: "pitch pitch" "score bench";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pitch-site--app .fantasy-stage__pitch {
    min-block-size: 30rem;
  }
}

@media (min-width: 75rem) {
  .pitch-site--app .fantasy-stage {
    grid-template-areas: ". pitch bench" ". pitch score";
    grid-template-columns: clamp(9rem, 13vw, 13rem) minmax(0, 1fr) 19rem;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .pitch-site--app .fantasy-stage--empty {
    grid-template-areas: ". . score";
    grid-template-rows: auto;
  }

  .pitch-site--app .fantasy-stage__score {
    align-self: start;
    max-block-size: 100%;
    overflow-y: auto;
  }
}

.pitch-site--app .fantasy-bench,
.pitch-site--app .fantasy-score {
  backdrop-filter: blur(6px);
  background: var(--ps-chrome);
  border: 2px solid var(--ps-ink);
  border-radius: 12px;
  box-shadow: var(--ps-chrome-shadow);
  color: var(--ps-cream);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
}

.pitch-site--app .fantasy-bench__title,
.pitch-site--app .fantasy-score__title {
  align-items: baseline;
  color: var(--ps-cream);
  display: flex;
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  gap: 8px;
  justify-content: space-between;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-bench__points,
.pitch-site--app .fantasy-score__formation {
  color: var(--ps-cream-soft);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.pitch-site--app .fantasy-bench__players {
  display: flex;
  gap: 10px;
  list-style: none;
  margin: 0;
  overflow-x: auto;
  padding: 4px 2px 2px;
}

.pitch-site--app .fantasy-bench__players > li {
  flex: 0 0 auto;
}

.pitch-site--app .fantasy-bench .fantasy-token {
  --token-kit: 38px;
  --token-width: 92px;
}

.pitch-site--app .fantasy-bench .fantasy-token__name,
.pitch-site--app .fantasy-bench .fantasy-token__points {
  font-size: 12px;
}

@media (min-width: 75rem) {
  .pitch-site--app .fantasy-bench__players {
    display: grid;
    gap: 12px 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: center;
    overflow: visible;
  }

  .pitch-site--app .fantasy-bench .fantasy-token {
    --token-kit: 36px;
  }
}

@media (max-width: 49.999rem) {
  .pitch-site--app .fantasy-formation--stage .fantasy-token {
    --token-kit: 38px;
  }

  .pitch-site--app .fantasy-formation--stage .fantasy-token__name,
  .pitch-site--app .fantasy-formation--stage .fantasy-token__points {
    font-size: 11.5px;
    padding-inline: 3px;
  }

  .pitch-site--app .fantasy-bench__players {
    justify-content: space-between;
  }

  .pitch-site--app .fantasy-bench .fantasy-token {
    --token-width: 76px;
  }
}

.pitch-site--app .fantasy-score__headline {
  display: grid;
  gap: 0 10px;
  grid-template-columns: auto 1fr;
  margin: 0;
}

.pitch-site--app .fantasy-score__label {
  color: var(--ps-cream-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  grid-column: 1 / -1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-score__value {
  color: var(--ps-cream);
  font-size: clamp(34px, 3.2vw, 46px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.pitch-site--app .fantasy-score__value--text {
  font-size: clamp(20px, 1.7vw, 26px);
  letter-spacing: -0.01em;
}

.pitch-site--app .fantasy-score__note {
  align-self: center;
  color: var(--ps-yellow);
  font-size: 12px;
  font-weight: 600;
}

.pitch-site--app .fantasy-facts {
  border-block-start: 1px solid var(--ps-line);
  display: grid;
  gap: 10px 14px;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  margin: 0;
  padding-block-start: 12px;
}

.pitch-site--app .fantasy-facts__fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-facts__fact dt {
  color: var(--ps-cream-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-facts__fact dd {
  color: var(--ps-cream);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin: 0;
}

.pitch-site--app .fantasy-facts__note {
  color: var(--ps-cream-soft);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  max-inline-size: 48ch;
}

.pitch-site--app .fantasy-legend {
  color: var(--ps-cream-soft);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 4px 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pitch-site--app .fantasy-legend li {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.pitch-site--app .fantasy-score .fantasy-attribution {
  color: var(--ps-cream-soft);
  font-size: var(--text-xx-small);
}

/* ---------- Fantasy: the gameweek steps and badges ---------- */


.pitch-site--app .fantasy-gameweeks {
  align-items: flex-start;
  display: flex;
  gap: 8px;
}

.pitch-site--app .fantasy-gameweeks__step {
  border: 1px solid var(--ps-line);
  border-radius: 6px;
  color: var(--ps-cream-soft);
  font-family: var(--font-mono);
  line-height: 1;
  padding: 6px 9px;
  text-decoration: none;
}

.pitch-site--app .fantasy-gameweeks__step:hover,
.pitch-site--app .fantasy-gameweeks__step:focus-visible {
  border-color: var(--ps-yellow);
  color: var(--ps-yellow);
}

.pitch-site--app .fantasy-badge {
  border: 1px solid currentColor;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  margin-inline-start: 4px;
  padding: 0 4px;
}

/* ---------- Fantasy: the season's overall rank in the window ---------- */

.pitch-site--app .fantasy-rank-line svg {
  display: block;
  inline-size: 100%;
  overflow: visible;
}

.pitch-site--app .fantasy-rank-line__path {
  fill: none;
  stroke: var(--color-ink);
  stroke-linejoin: round;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

.pitch-site--app .fantasy-rank-line__dot {
  fill: var(--theme-primary);
  stroke: var(--color-ink);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

/* ---------- Fantasy: the viewer's own rows in a league table ---------- */

.pitch-site--app .fantasy-league-table tr.is-followed td {
  background: var(--color-sun);
  font-weight: 600;
}

/* ---------- Fantasy: Playmaker's fixture difficulty grade ---------- */

.pitch-site--app .fantasy-difficulty {
  background: color-mix(in oklab, var(--ps-red-bright) calc((var(--difficulty) - 1) * 25%), var(--ps-live));
  border-radius: 4px;
  color: var(--ps-ink);
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 6px;
  white-space: nowrap;
}

.pitch-site--app .fantasy-difficulty--ungraded {
  background: var(--color-shade);
}

.pitch-site--app .fantasy-ticker__name {
  background: var(--color-surface);
  inset-inline-start: 0;
  position: sticky;
  text-align: start;
  z-index: 1;
}

.pitch-site--app .fantasy-difficulty--blank {
  background: var(--color-shade);
  font-style: italic;
}

/* ---------- Fantasy: the squad builder ---------- */

.pitch-site--app .fantasy-builder__bar {
  background: var(--color-surface);
  border-block-end: 1px solid var(--color-border-subtle);
  padding-block: var(--space-xs);
}

/* Above 75rem the window body scrolls, so the count, the money left and the
   save stay in view over the search; below it the page scrolls and the bar
   sits in the flow. */
@media (min-width: 75rem) {
  .pitch-site--app .fantasy-builder__bar:not(.fantasy-builder__bar--flow) {
    inset-block-start: 0;
    position: sticky;
    z-index: 2;
  }
}

.pitch-site--app .fantasy-search__form {
  align-items: flex-end;
}

.pitch-site--app .fantasy-search__filters {
  align-items: flex-end;
  margin-block-start: var(--space-xs);
}

.pitch-site--app .fantasy-search__name {
  flex: 1 1 12rem;
}

.pitch-site--app .fantasy-search__name input {
  inline-size: 100%;
}

/* The filters past the name sit behind a disclosure on a narrow screen;
   on a wide one the filter-disclosure controller keeps it open and the
   summary goes. */
.pitch-site--app .fantasy-search__more {
  flex: 1 1 100%;
}

.pitch-site--app .fantasy-search__more > summary {
  list-style: none;
  min-width: auto;
}

.pitch-site--app .fantasy-search__more > summary::-webkit-details-marker {
  display: none;
}

@media (min-width: 40rem) {
  .pitch-site--app .fantasy-search__more[open] > summary {
    display: none;
  }

  .pitch-site--app .fantasy-search__more[open] > .fantasy-search__filters {
    margin-block-start: 0;
  }
}

.pitch-site--app .fantasy-search td {
  vertical-align: middle;
}

.pitch-site--app .fantasy-search__player {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-search__meta {
  align-items: center;
  color: var(--ps-ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
}

.pitch-site--app .fantasy-search__refusal {
  color: var(--ps-ink-soft);
  font-style: italic;
}

.pitch-site--app .fantasy-search tr.is-refused td {
  color: var(--ps-ink-soft);
}

.pitch-site--app .fantasy-search__action {
  inline-size: 44px;
  min-inline-size: 44px;
  padding-inline: 4px;
  text-align: center;
}

/* The small round plus that brings a player in and minus that takes one
   out, on the picker's rows and beside a place on the pitch. */
.pitch-site--app .fantasy-pick-button {
  align-items: center;
  background: var(--ps-paper-raised);
  block-size: 28px;
  border: 2px solid var(--ps-ink);
  border-radius: 50%;
  color: var(--ps-ink);
  display: inline-flex;
  flex: none;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  inline-size: 28px;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
}

.pitch-site--app .fantasy-pick-button--add {
  background: var(--ps-yellow);
}

.pitch-site--app .fantasy-pick-button:hover {
  box-shadow: 0 2px 0 var(--ps-ink);
  transform: translateY(-1px);
}

/* ---------- Fantasy: the fifteen places on a pitch ---------- */

.pitch-site--app .fantasy-market .fantasy-formation__line > li {
  position: relative;
}

.pitch-site--app .fantasy-market .fantasy-pick-button {
  block-size: 22px;
  font-size: 15px;
  inline-size: 22px;
  inset-block-start: -4px;
  inset-inline-end: calc(50% - 34px);
  position: absolute;
  z-index: 2;
}

.pitch-site--app .fantasy-market__slot--empty .fantasy-token__kit {
  background: rgba(255, 255, 255, 0.18);
  border-style: dashed;
}

.pitch-site--app .fantasy-market__slot--empty .fantasy-kit--code {
  color: var(--ps-cream);
  font-size: 20px;
}

.pitch-site--app .fantasy-market__slot--out .fantasy-token__kit {
  opacity: 0.5;
}

.pitch-site--app .fantasy-market__slot--out .fantasy-token__name {
  color: var(--ps-ink-soft);
  text-decoration: line-through;
}

.pitch-site--app .fantasy-market__slot--incoming .fantasy-token__kit {
  box-shadow: 0 0 0 3px var(--ps-yellow);
}

/* ---------- Fantasy: the transfers about to be confirmed ---------- */

.pitch-site--app .fantasy-transfer-cards {
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.pitch-site--app .fantasy-transfer-card {
  align-items: center;
  background: var(--ps-paper-raised);
  border: 2px solid var(--ps-ink);
  border-radius: 10px;
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  padding: 8px 10px;
}

.pitch-site--app .fantasy-transfer-card__side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-transfer-card__label {
  color: var(--ps-ink-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-transfer-card__side--in .fantasy-transfer-card__label {
  color: var(--ps-ink);
}

.pitch-site--app .fantasy-transfer-card__player {
  align-items: center;
  display: flex;
  gap: 6px;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-transfer-card__crest {
  align-items: center;
  block-size: 30px;
  border: 1.5px solid var(--ps-ink);
  border-radius: 50%;
  display: inline-flex;
  flex: none;
  inline-size: 30px;
  justify-content: center;
}

.pitch-site--app .fantasy-transfer-card__crest .fantasy-kit--crest {
  block-size: 70%;
  inline-size: 70%;
}

.pitch-site--app .fantasy-transfer-card__crest .fantasy-kit--code {
  font-size: var(--text-xx-small);
}

.pitch-site--app .fantasy-transfer-card__text {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-transfer-card__name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pitch-site--app .fantasy-transfer-card__meta {
  color: var(--ps-ink-soft);
  font-size: var(--text-xx-small);
}

.pitch-site--app .fantasy-transfer-card__side--out .fantasy-transfer-card__name {
  color: var(--ps-ink-soft);
  text-decoration: line-through;
}

.pitch-site--app .fantasy-transfer-card__arrow {
  color: var(--ps-ink-soft);
  font-size: 18px;
}

/* On a phone a card stands upright: out above in, the undo beside them. */
@media (max-width: 30rem) {
  .pitch-site--app .fantasy-transfer-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pitch-site--app .fantasy-transfer-card__arrow {
    grid-column: 1;
    line-height: 1;
    transform: rotate(90deg);
    justify-self: start;
    margin-inline-start: 8px;
  }

  .pitch-site--app .fantasy-transfer-card .fantasy-pick-button {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

/* ---------- Fantasy: the player picker ---------- */

.pitch-site--app .fantasy-dialog {
  background: var(--ps-paper-raised);
  border: 2px solid var(--ps-ink);
  border-radius: 12px;
  box-shadow: var(--ps-hard-shadow);
  color: var(--ps-ink);
  inline-size: 52rem;
  max-block-size: 86vh;
  max-inline-size: calc(100vw - 32px);
  overflow-y: auto;
  padding: 0;
}

.pitch-site--app .fantasy-dialog:modal {
  margin: 7vh auto auto;
}

.pitch-site--app .fantasy-dialog:not(:modal) {
  margin: 0;
  position: static;
}

.pitch-site--app .fantasy-dialog::backdrop {
  background: rgba(12, 46, 25, 0.6);
}

.pitch-site--app .fantasy-dialog__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding: var(--space-l);
}

.pitch-site--app .fantasy-dialog__head {
  align-items: flex-start;
  flex-wrap: nowrap;
}

.pitch-site--app .fantasy-dialog__head > :first-child {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-dialog__head > :last-child {
  flex: none;
}

/* reset.css gives .btn a 220px minimum, too wide for a dialog's small
   buttons. */
.pitch-site--app .fantasy-dialog .btn {
  min-width: auto;
}

/* As a modal the picker keeps its title and filters in place and scrolls
   the results alone. */
.pitch-site--app .fantasy-dialog--picker:modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pitch-site--app .fantasy-dialog--picker:modal .fantasy-dialog__body {
  flex: 1 1 auto;
  min-block-size: 0;
  padding-block-end: 0;
}

.pitch-site--app .fantasy-search__panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  min-block-size: 0;
}

.pitch-site--app .fantasy-dialog--picker:modal .fantasy-search__panel {
  flex: 1 1 auto;
}

.pitch-site--app .fantasy-dialog--picker:modal .fantasy-search__results {
  flex: 1 1 auto;
  margin-inline: calc(var(--space-l) * -1);
  min-block-size: 0;
  overflow-y: auto;
  padding: 0 var(--space-l) var(--space-l);
}

@media (max-width: 40rem) {
  .pitch-site--app .fantasy-dialog:modal {
    margin-block-start: 16px;
    max-block-size: calc(100dvh - 32px);
  }

  .pitch-site--app .fantasy-dialog__body {
    padding: var(--space-s);
  }

  .pitch-site--app .fantasy-dialog--picker:modal .fantasy-search__results {
    margin-inline: calc(var(--space-s) * -1);
    padding: 0 var(--space-s) var(--space-s);
  }
}

/* ---------- Fantasy: the Team page, where the lineup is changed ---------- */

.pitch-site--app .fantasy-lineup {
  max-width: 48ch;
}

.pitch-site--app .fantasy-lineup__place {
  color: var(--ps-cream-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0;
  text-transform: uppercase;
}

/* reset.css gives .btn a 220px minimum, which would put every swap on a line
   of its own. */
.pitch-site--app :is(.fantasy-lineup, .fantasy-lineup-dialog) .btn {
  min-width: auto;
}

.pitch-site--app .fantasy-lineup__problems {
  color: var(--ps-yellow);
  font-size: 12px;
  font-weight: 600;
  margin: 0;
  padding-inline-start: 1.2em;
}

/* The player pressed on the Team page, in a dialog over the pitch. */
.pitch-site--app .fantasy-dialog--compact {
  inline-size: 34rem;
}

.pitch-site--app .fantasy-lineup-dialog__title {
  display: flex;
  flex-direction: column;
  font-size: 18px;
  gap: 2px;
}

.pitch-site--app .fantasy-lineup-dialog__place {
  color: var(--ps-ink-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-lineup-dialog__armband {
  inset: auto;
  position: static;
}

/* ---------- Fantasy: the player card in the Team page's dialog ---------- */

.pitch-site--app .fantasy-card__club {
  align-items: center;
  display: flex;
  gap: var(--space-s);
}

.pitch-site--app .fantasy-card__crest {
  align-items: center;
  block-size: 44px;
  border: 2px solid var(--ps-ink);
  border-radius: 50%;
  display: inline-flex;
  flex: none;
  inline-size: 44px;
  justify-content: center;
}

.pitch-site--app .fantasy-card__crest .fantasy-kit--crest {
  block-size: 70%;
  inline-size: 70%;
}

.pitch-site--app .fantasy-card__meta {
  color: var(--ps-ink-soft);
}

.pitch-site--app .fantasy-card__numbers {
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  margin: 0;
}

.pitch-site--app .fantasy-card__number {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 8px;
}

.pitch-site--app .fantasy-card__number dt {
  color: var(--ps-ink-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-card__number dd {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin: 0;
}

.pitch-site--app .fantasy-card__label {
  color: var(--ps-ink-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-card__rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pitch-site--app .fantasy-card__rows > li {
  align-items: center;
  border-block-end: 1px solid var(--color-border-subtle);
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: 7.5rem minmax(0, 1fr) auto;
  padding-block: 4px;
}

.pitch-site--app .fantasy-card__gameweek {
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  text-transform: uppercase;
}

@media (max-width: 30rem) {
  .pitch-site--app .fantasy-card__rows > li {
    grid-template-columns: 6rem minmax(0, 1fr);
  }

  .pitch-site--app .fantasy-card__rows > li > :last-child {
    grid-column: 2;
  }
}

/* ---------- Fantasy: the team chips on the Team page ---------- */

.pitch-site--app .fantasy-chips__on {
  color: var(--ps-yellow);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

/* ---------- Fantasy: the season hub ---------- */

/* The wide window stays centred and narrows to keep clear of the view links
   in the top-left corner. */
@media (min-width: 75rem) {
  .pitch-site--app .stage__main:has(.fantasy-page) .pitch-window--wide {
    margin-inline: auto;
    max-inline-size: min(80rem, 100% - 28rem);
  }
}

.pitch-site--app .fantasy-heading {
  color: var(--ps-ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pitch-site--app .fantasy-note {
  align-items: center;
  background: var(--ps-paper-shade);
  border-radius: 999px;
  color: var(--ps-ink-soft);
  display: inline-flex;
  font-size: 13px;
  gap: 8px;
  inline-size: fit-content;
  max-inline-size: 100%;
  padding: 5px 12px;
}

.pitch-site--app .fantasy-note::before {
  background: var(--ps-ink-soft);
  block-size: 7px;
  border-radius: 50%;
  content: "";
  flex: none;
  inline-size: 7px;
}

/* Your team: the season's numbers big, the way into the team beside them. */
.pitch-site--app .fantasy-hero {
  align-items: center;
  background: var(--ps-paper-raised);
  border: 2px solid var(--ps-ink);
  border-radius: 14px;
  box-shadow: var(--ps-hard-shadow);
  display: grid;
  gap: 18px 32px;
  grid-template-columns: minmax(0, 1fr);
  padding: 20px 22px;
}

@media (min-width: 60rem) {
  .pitch-site--app .fantasy-hero {
    grid-template-columns: minmax(12rem, 1fr) auto auto;
  }
}

.pitch-site--app .fantasy-hero__name {
  color: var(--ps-ink);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  overflow-wrap: anywhere;
}

.pitch-site--app .fantasy-hero__numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 0;
}

.pitch-site--app .fantasy-hero__number {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.pitch-site--app .fantasy-hero__number dt {
  color: var(--ps-ink-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pitch-site--app .fantasy-hero__number dd {
  color: var(--ps-ink);
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}

.pitch-site--app .fantasy-hero__number small {
  color: var(--ps-ink-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.pitch-site--app .fantasy-hero__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.pitch-site--app .fantasy-hero__actions .btn {
  min-width: auto;
}

/* The gameweek: the team of the week on its own pitch, the numbers and the
   top scorers beside it. */
.pitch-site--app .fantasy-highlights {
  align-items: start;
  display: grid;
  gap: 24px 32px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 60rem) {
  .pitch-site--app .fantasy-highlights:has(.fantasy-highlights__team) {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
}

.pitch-site--app .fantasy-pitch {
  background:
    linear-gradient(var(--ps-line), var(--ps-line)) 50% 100% / 34% 2px no-repeat,
    repeating-linear-gradient(180deg, var(--ps-turf) 0 44px, var(--ps-turf-stripe) 44px 88px);
  border: 2px solid var(--ps-ink);
  border-radius: 14px;
  box-shadow: var(--ps-hard-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 14px 10px 22px;
  position: relative;
}

/* The penalty area the goalkeeper stands in. */
.pitch-site--app .fantasy-pitch::before {
  block-size: 64px;
  border: 2px solid var(--ps-line);
  border-block-start: none;
  content: "";
  inline-size: 44%;
  inset-block-start: 0;
  inset-inline-start: 28%;
  pointer-events: none;
  position: absolute;
}

.pitch-site--app .fantasy-pitch__caption {
  color: var(--ps-cream-soft);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  letter-spacing: 0.04em;
  position: relative;
  text-align: end;
}

.pitch-site--app .fantasy-club {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  white-space: nowrap;
}

.pitch-site--app .fantasy-club__crest {
  block-size: 16px;
  inline-size: 16px;
  object-fit: contain;
}

.pitch-site--app .fantasy-club__code {
  color: var(--ps-ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.pitch-site--app .fantasy-status {
  align-items: center;
  color: var(--ps-ink-soft);
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
  white-space: nowrap;
}

.pitch-site--app .fantasy-status::before {
  background: var(--ps-red-bright);
  block-size: 7px;
  border-radius: 50%;
  content: "";
  flex: none;
  inline-size: 7px;
}

.pitch-site--app .fantasy-status--doubtful::before {
  background: #d9a400;
}

.pitch-site--app .fantasy-lists {
  --minimum: 16rem;
}

.pitch-site--app .fantasy-step {
  min-width: auto;
}

.pitch-site--app .fantasy-ranked {
  inline-size: 100%;
  table-layout: fixed;
}

.pitch-site--app .fantasy-ranked__rank {
  color: var(--ps-ink-soft);
  font-variant-numeric: tabular-nums;
  inline-size: 2.25rem;
  text-align: end;
}

.pitch-site--app .fantasy-ranked__player {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-inline-size: 0;
}

.pitch-site--app .fantasy-ranked__name {
  overflow-wrap: anywhere;
}

.pitch-site--app .fantasy-ranked__value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  inline-size: 5rem;
  text-align: end;
}

.pitch-site--app th.fantasy-ranked__value {
  font-weight: inherit;
}

.pitch-site--app turbo-frame#fantasy_players[busy] .fantasy-standings {
  opacity: 0.55;
  transition: opacity 0.15s ease 0.1s;
}

.pitch-site--app .fantasy-standings__number {
  font-variant-numeric: tabular-nums;
  text-align: end;
  white-space: nowrap;
}

.pitch-site--app .fantasy-standings td.is-sorted {
  font-weight: 700;
}

.pitch-site--app .fantasy-standings__position {
  font-family: var(--font-mono);
  font-size: 12px;
}

.pitch-site--app .fantasy-standings__player {
  display: inline-block;
  max-inline-size: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.pitch-site--app .fantasy-standings tr.is-ruled-out td:not(:last-child) {
  color: var(--ps-ink-soft);
}

.pitch-site--app .fantasy-sort {
  align-items: center;
  color: inherit;
  display: inline-flex;
  gap: 4px;
  text-decoration: none;
  white-space: nowrap;
}

/* Every sortable heading keeps room for the arrow, ahead of the label, so
   the label lines up with the numbers under it whichever column sorts. */
.pitch-site--app .fantasy-sort::before {
  content: "↓";
  inline-size: 1ch;
  opacity: 0;
}

.pitch-site--app .fantasy-sort:hover,
.pitch-site--app .fantasy-sort:focus-visible {
  text-decoration: underline;
}

.pitch-site--app .fantasy-sort:hover::before {
  opacity: 0.35;
}

.pitch-site--app .fantasy-sort.is-active {
  color: var(--ps-ink);
  font-weight: 700;
}

.pitch-site--app th[aria-sort] .fantasy-sort::before {
  opacity: 1;
}

.pitch-site--app th[aria-sort="ascending"] .fantasy-sort::before {
  content: "↑";
}

/* ---------- Fantasy: the schedule of rounds ---------- */

.pitch-site--app .fantasy-schedule__kickoff {
  white-space: nowrap;
}

.pitch-site--app .fantasy-schedule__table td {
  vertical-align: middle;
}

.pitch-site--app .fantasy-invite__rows {
  display: grid;
  gap: var(--space-xs);
  margin: 0;
}

.pitch-site--app .fantasy-invite__row {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  align-items: center;
  gap: var(--space-xs);
}

.pitch-site--app .fantasy-invite__row dt {
  font-weight: 600;
}

.pitch-site--app .fantasy-invite__row dd {
  margin: 0;
  min-width: 0;
}

.pitch-site--app .fantasy-invite__value {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.pitch-site--app .fantasy-invite__code {
  letter-spacing: 0.08em;
}

@media (max-width: 40rem) {
  .pitch-site--app .fantasy-invite__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* reset.css gives .btn a 220px minimum, too wide for a row's Leave or a
   copy button. */
.pitch-site--app :is(.fantasy-league-table, .fantasy-invite, .fantasy-league-head, .fantasy-league-actions) .btn {
  min-width: auto;
}
