/* Footi score predictor: the predictor's own layout, and nothing else.

   Everything around it is the site's: src/scss/main.scss is imported first
   (src/main.js), the page is on the homepage's shell (body.night, as base.html
   gives every `type: page` page), and the header, menu, head, panels, tabs and
   buttons are the site's own markup and classes (hp-panel, hp-tabs, hp-btn,
   hp-more, pl-head, pg-title). The tokens below are the shell's --hp-* values.

   Rules here are namespaced `pr-` (as the site's pages are: mc-, pg-, nf-) and
   only add to the shared components the states the predictor has and the site
   does not: a tab that is the current *step*, a disabled button. The pitch is
   the one piece of special-purpose art - pixel art, on its own canvas. */

.pr [hidden] {
  display: none !important;
}

.pr {
  padding-block: clamp(0.25rem, 1.5vw, 1rem) clamp(2rem, 6vw, 4rem);
}

.pr-lead {
  max-width: 40rem;
  margin: 0;
  color: #d5daf5;
}

/* ---------------------------------------------------------------- layout */

.pr-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "notice"
    "received"
    "closed"
    "score"
    "steps"
    "instr"
    "stage"
    "share"
    "controls";
}

/* ------------------------------------------------- shared-link context */

.pr-notice {
  grid-area: notice;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--hp-live);
  background: var(--hp-panel);
  color: var(--hp-text);
}

/* Someone else's prediction: an hp-panel, quieter than the reader's own
   score below it (no volt numerals), and labelled as a prediction. */
.pr-received {
  grid-area: received;
  margin-bottom: 1rem;
}

/* The sender's scoreline, as a two-row fixture list: crest, name, goals for
   each club. Long names wrap between words and never run into the score. */
.pr-received__line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "home-crest home-name home-score" "away-crest away-name away-score";
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.5rem;
  margin: 0;
  padding: 0 1.125rem 0.75rem;
}

.pr-received__crest {
  width: 2rem;
  height: auto;
  max-height: 2.125rem;
  object-fit: contain;
}

.pr-received__crest[data-received-crest="home"] { grid-area: home-crest; }
.pr-received__crest[data-received-crest="away"] { grid-area: away-crest; }
.pr-received__team[data-received-name="home"] { grid-area: home-name; }
.pr-received__line [data-received-score="home"] { grid-area: home-score; }
.pr-received__line [data-received-score="away"] { grid-area: away-score; }

.pr-received__team {
  min-width: 0;
  overflow-wrap: break-word;
  font-weight: 500;
  line-height: 1.2;
  color: var(--hp-text);
}

.pr-received__team[data-received-name="away"] {
  grid-area: away-name;
}

/* The two goals take their own cells; the dash is not needed in a list. */
.pr-received__score {
  display: contents;
  font-family: var(--hp-display);
  font-style: italic;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #fff;
}

.pr-received__dash {
  display: none;
}

.pr-received__line [data-received-score] {
  min-width: 1ch;
  text-align: right;
}

.pr-received__note {
  margin: 0;
  padding: 0.75rem 1.125rem 1rem;
  border-top: 1px solid var(--hp-line-soft);
  font-size: 0.9375rem;
  color: var(--hp-mute);
}

.pr-received__clear {
  margin-left: 0.25rem;
}

/* ----------------------------------------------------------------- score */

.pr-score {
  grid-area: score;
}

/* The demo label carries the match date, so on a narrow phone it drops under
   a long fixture title instead of squeezing it. */
.pr-score > .hp-panel__head {
  flex-wrap: wrap;
  row-gap: 0.375rem;
}

/* The fixture's details beside its name: the date and kick-off kept on one
   line, and the ground (when known) on a line of its own under them, so a
   long ground wraps quietly instead of running out of the panel. */
.pr-score .hp-panel__head {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.pr-score .pr-demo {
  line-height: 1.35;
}

.pr-score .pr-demo > span:not(.pr-demo__venue) {
  white-space: nowrap;
}

.pr-score .pr-demo__venue:not([hidden]) {
  display: block;
  margin-top: 0.125em;
}

.pr-score .pr-demo__sep {
  display: none;
}

.pr-demo {
  font-family: var(--hp-display);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hp-mute);
}

.pr-score__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.125rem 1rem;
}

/* Phone: crest and goals side by side, the name on its own line under them,
   so a long name wraps between words at one size and clears the note. */
.pr-team {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "crest value" "name name" "note note";
  grid-template-rows: minmax(2.75rem, auto) auto auto;
  align-items: center;
  column-gap: 0.625rem;
  row-gap: 0.375rem;
  align-content: start;
}

.pr-team__crest {
  grid-area: crest;
  width: 2.25rem;
  height: auto;
  max-height: 2.5rem;
  object-fit: contain;
}

.pr-team__name {
  grid-area: name;
  min-width: 0;
  font-family: var(--hp-display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(1rem, 4.6vw, 1.375rem);
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: break-word;
  color: #fff;
}

.pr-team__value {
  grid-area: value;
  font-family: var(--hp-display);
  font-style: italic;
  font-weight: 800;
  font-size: 3rem;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
  color: var(--hp-text);
  transition: color 0.2s ease;
}

.pr-team.is-active .pr-team__value {
  color: var(--hp-volt);
}

.pr-team__value.is-unset {
  font-style: normal;
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--hp-mute);
}

.pr-team__note {
  grid-area: note;
  font-size: 0.8125rem;
  color: var(--hp-mute);
}

.pr-team__note:empty {
  display: none;
}

.pr-team[data-team="away"] .pr-team__value.is-unset {
  grid-row: 1 / 2;
}

.pr-team__value {
  justify-self: end;
}

.pr-score__divider {
  width: 1px;
  height: 2.75rem;
  background: var(--hp-line);
}

/* ----------------------------------------------------------------- steps */

/* The homepage's tabs. A tab here is a step: the current one takes the
   selected tab's volt, and steps not yet reachable are dimmed. */
.pr-steps {
  grid-area: steps;
  margin-top: 1.25rem;
}

.pr-steps .hp-tabs__item.tab-bar__item[aria-current] {
  color: var(--hp-ink);
  cursor: default;
}

.pr-steps .hp-tabs__item.tab-bar__item[aria-current]::before {
  background: var(--hp-volt);
}

.pr-steps .hp-tabs__item.tab-bar__item.is-done {
  color: var(--hp-text);
}

.pr-steps .hp-tabs__item.tab-bar__item[aria-disabled] {
  color: var(--hp-dim);
  cursor: not-allowed;
}

.pr-steps .hp-tabs__item.tab-bar__item[aria-disabled]::before {
  background: transparent;
}

.pr-instruction {
  grid-area: instr;
  margin-top: 1.25rem;
  font-size: 1.0625rem;
  text-align: center;
  color: var(--hp-text);
}

/* ----------------------------------------------------------------- stage */

/* An hp-panel; on a phone it runs to the screen edges so the pitch is as
   wide as it can be, and the instruction above stands in for its head. */
.pr-stage {
  grid-area: stage;
  margin: 1rem calc(var(--hp-gutter) * -1) 0;
  border-inline: 0;
  border-radius: 0;
}

.pr-stage > .hp-panel__head {
  display: none;
}

.pr-stage__count {
  font-family: var(--hp-display);
  font-style: italic;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  text-transform: uppercase;
  color: var(--hp-volt);
}

.pr-pitch {
  aspect-ratio: 1 / 0.92;
  overflow: hidden;
  background: #050c3c;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
}

.pr-pitch:not([role]) {
  cursor: default;
}

.pr-pitch.is-aiming {
  cursor: grabbing;
}

.pr-pitch[aria-disabled] {
  cursor: not-allowed;
}

body.night .pr-pitch:focus-visible {
  outline: 3px solid var(--hp-volt);
  outline-offset: -3px;
  border-radius: 0;
}

.pr-pitch__canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pr-summary {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 1.5rem;
  text-align: center;
  background: rgba(1, 8, 47, 0.74);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.pr-summary__score {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 1rem;
  font-family: var(--hp-display);
  font-style: italic;
  font-weight: 800;
  line-height: 0.9;
  text-transform: uppercase;
  color: #fff;
}

.pr-summary__team {
  font-size: clamp(1.5rem, 6vw, 2.25rem);
}

.pr-summary__num {
  font-size: clamp(4rem, 16vw, 7rem);
  font-variant-numeric: tabular-nums;
  color: var(--hp-volt);
}

.pr-summary__dash {
  font-size: clamp(2.5rem, 9vw, 4rem);
  color: var(--hp-mute);
}

.pr-summary__note {
  color: var(--hp-mute);
}

.pr-game[data-step="confirmed"] .pr-summary__note::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--hp-teal);
  vertical-align: 0.1em;
}

.pr-stage__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem var(--hp-gutter) 1rem;
  text-align: center;
  color: var(--hp-text);
}

.pr-stage__how strong {
  font-weight: 500;
}

.pr-stage__key {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}

.pr-stage__key kbd {
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 3px;
  font-family: var(--hp-display);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pr-coarse {
  display: none;
}

@media (pointer: coarse) {
  .pr-fine {
    display: none !important;
  }

  .pr-coarse {
    display: inline;
  }
}

/* ----------------------------------------------------------------- share */

.pr-share {
  grid-area: share;
  margin-top: 1.25rem;
}

.pr-share__body {
  display: grid;
  gap: 1rem;
  padding: 0 1.125rem 1.125rem;
}

/* The card is portrait (1080x1350, 4:5), as it is mostly made and shared on
   a phone: full width there, and held to a phone's width on bigger screens. */
.pr-share__card {
  display: grid;
  place-items: center;
  justify-self: center;
  width: min(100%, 24rem);
  margin: 0;
  aspect-ratio: 1080 / 1350;
  border: 1px solid var(--hp-line);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--hp-ink);
}

.pr-share__image {
  display: block;
  width: 100%;
  height: auto;
}

.pr-share__wait {
  padding: 1rem;
  text-align: center;
  color: var(--hp-mute);
}

/* Two to a row; the main action, and an odd last button, take a whole row
   (hidden buttons are display: none, so they never leave a gap). */
.pr-share__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pr-share__actions .hp-btn {
  flex: 1 1 calc(50% - 0.375rem);
  min-width: 0;
}

.pr-share__actions .pr-share__primary {
  flex-basis: 100%;
}

.pr-share .hp-btn[aria-disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}

.pr-share .hp-btn--ghost[aria-disabled]::before {
  background: transparent !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32) !important;
}

.pr-share__field {
  display: grid;
  gap: 0.375rem;
}

.pr-share__label {
  font-family: var(--hp-display);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hp-mute);
}

.pr-share__url {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--hp-line);
  border-radius: 0.375rem;
  background: rgba(1, 8, 47, 0.6);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--hp-text);
  text-overflow: ellipsis;
}

body.night .pr-share__url:focus-visible {
  outline: 2px solid var(--hp-volt);
  outline-offset: 2px;
}

.pr-share__status {
  margin: 0;
  color: var(--hp-text);
}

.pr-share__status:empty {
  display: none;
}

.pr-share__note {
  margin: 0;
  font-size: 0.875rem;
  color: var(--hp-mute);
}

/* -------------------------------------------------------------- controls */

.pr-controls {
  grid-area: controls;
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.pr-controls__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.pr-controls .hp-btn {
  width: 100%;
}

/* The site's buttons have no disabled state; these say "not now". */
.pr-controls .hp-btn[aria-disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}

.pr-controls .hp-btn--ghost[aria-disabled]::before {
  background: transparent !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32) !important;
}

.pr-reset {
  justify-self: center;
  min-height: 2.75rem;
}

.pr-reset[aria-disabled] {
  color: var(--hp-dim);
  cursor: not-allowed;
}

/* The saved prediction: one quiet line under the controls, and the one
   action that applies (back to it from a new draft, or clear it). */
.pr-saved {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 1rem;
  margin: -0.25rem 0 0;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--hp-mute);
}

.pr-saved__text {
  max-width: 34rem;
}

.pr-saved__action {
  min-height: 2.75rem;
}

/* --------------------------------------------------------------- desktop */

/* 62.5rem: where the site's tabs stop scrolling and sit in a row. */
@media (min-width: 62.5rem) {
  .pr-game {
    grid-template-columns: minmax(20rem, 25rem) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto auto 1fr;
    grid-template-areas:
      "notice notice"
      "received stage"
      "score stage"
      "steps stage"
      "instr stage"
      "share stage"
      "controls stage";
    column-gap: clamp(1.5rem, 2.6vw, 2.5rem);
    align-items: start;
  }

  .pr-score__row {
    padding: 0.25rem 1rem 1.25rem;
  }

  .pr-team {
    grid-template-columns: 1fr;
    grid-template-areas: "crest" "name" "value" "note";
    grid-template-rows: none;
    justify-items: center;
    row-gap: 0.5rem;
    align-content: start;
    min-height: 11rem;
  }

  .pr-team__crest {
    width: 4rem;
    max-height: 4.25rem;
  }

  .pr-team__name {
    font-family: inherit;
    font-style: normal;
    font-weight: 500;
    font-size: 1.0625rem;
    text-transform: none;
  }

  .pr-team__value {
    font-size: 4.5rem;
  }

  .pr-team__value.is-unset {
    font-size: 3rem;
    line-height: 1.2;
  }

  .pr-team[data-team="away"] .pr-team__value.is-unset {
    grid-row: auto;
  }

  .pr-team__value {
    justify-self: center;
  }

  .pr-score__divider {
    height: 8rem;
  }

  .pr-instruction {
    padding-top: 1.25rem;
    border-top: 1px solid var(--hp-line);
    text-align: left;
  }

  .pr-stage {
    margin: 0;
    border-inline: 1px solid var(--hp-line);
    border-radius: 0.875rem;
  }

  .pr-stage > .hp-panel__head {
    display: flex;
  }

  .pr-pitch {
    aspect-ratio: 16 / 10;
  }

  .pr-stage__foot {
    justify-content: space-between;
    padding: 1rem 1.125rem 1.125rem;
    text-align: left;
  }

  .pr-stage__how {
    display: flex;
    flex-direction: column;
    color: var(--hp-mute);
  }

  .pr-stage__how .pr-fine {
    display: contents;
  }

  .pr-stage__how strong {
    display: block;
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--hp-text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pr *,
  .pr *::before,
  .pr *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------- version switch */

/* Retro pitch or 3D stadium: the homepage's tabs as two links, the current
   page in the selected tab's volt. */
.pr-switch {
  margin-bottom: 1.25rem;
}

.pr-switch .hp-tabs__item.tab-bar__item[aria-current="page"] {
  color: var(--hp-ink);
}

.pr-switch .hp-tabs__item.tab-bar__item[aria-current="page"]::before {
  background: var(--hp-volt);
}

/* ======================================================= the retro page

   The retro page is the prediction page for one match: the match is the
   page's title, its date, kick-off and ground under it, then the reader's
   scoreboard, the steps and the pitch. These rules are scoped to its own
   markup (.pr-match, .pr-game--retro, .pr-score--board), so the 3D
   experiments, which share this stylesheet, keep their layout. */

/* The match: the head's display type, a size down from a section title so a
   long pairing (Brighton & Hove Albion v Wolverhampton Wanderers) stays two
   or three lines on a phone and the pitch starts near the top. */
.pr-match.pl-head {
  padding-block: clamp(1rem, 2.2vw, 2rem) clamp(0.875rem, 1.8vw, 1.5rem);
}

.pr-match .pr-match__title {
  margin: 0.375rem 0 0.625rem;
  font-size: clamp(2.25rem, 6.4vw, 4.5rem);
  line-height: 0.9;
  text-wrap: balance;
}

.pr-match__when {
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

/* Date and kick-off stay together; the ground wraps whole after them. */
.pr-match__when > span {
  white-space: nowrap;
}

.pr-match__when .pr-demo__venue {
  white-space: normal;
}

/* An undated fixture's ground follows the Beta tag with no separator. */
.pr-match__when [data-fixture-date][hidden] ~ [data-fixture-venue] .pr-demo__sep {
  display: none;
}

/* Beta: the site's beta note (src/_includes/match-view.html's notification,
   flask icon and "Beta"), set as the night match report sets it
   (src/scss/layouts/_match-report.scss, .mr-view .notification): a hairline
   tag in the display face, muted, no gradient. Here it leads the fixture
   line in place of a strap of its own, a size down and with its padding
   inside the line's own height, so the head is no taller than before and
   the tag stays on short phones, where the strap above the title is
   dropped. Screen readers hear the full sentence. */
.pr-match .pr-beta {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  width: auto;
  margin: 0 0.375rem 0 0;
  padding: 0.125rem 0.4375rem 0.125rem 0.375rem;
  border: 1px solid var(--hp-line);
  border-radius: 3px;
  background: none;
  vertical-align: top;
  font-family: var(--hp-display);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hp-mute);
}

.pr-match .pr-beta span {
  background: none;
  -webkit-text-fill-color: currentColor;
  font-weight: 600;
  color: inherit;
}

.pr-match .pr-beta .icon {
  flex: none;
  width: 0.8125rem;
  height: 0.8125rem;
}

.pr-match .pr-lead {
  font-size: 1rem;
  color: #d5daf5;
}

/* The scoreboard: the reader's own prediction, titled as theirs so it never
   reads as a result beside a shared one. Tighter than a section panel. */
.pr-score--board > .hp-panel__head {
  padding-block: 0.75rem 0.5rem;
}

/* "Not set" goes once the away side is picked; its line keeps its room so
   the pitch below does not move up as the reader moves on. */
.pr-game--retro .pr-team__note:empty {
  display: block;
  min-height: 1lh;
}

.pr-game--retro .pr-steps {
  margin-top: 1rem;
}

.pr-game--retro .pr-instruction {
  margin-top: 1rem;
}

.pr-game--retro .pr-stage {
  margin-top: 0.75rem;
}

.pr-game--retro .pr-controls {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 1rem;
}

/* Two equal buttons that never push past the page: a long club name
   ("Edit Wolverhampton Wanderers") wraps inside its button instead. */
.pr-game--retro .pr-controls__row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pr-game--retro .pr-controls__row .hp-btn {
  min-width: 0;
  white-space: normal;
  text-align: center;
}

.pr-game--retro .pr-controls__row .hp-btn > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The stage's own head ("Arsenal's goals, 0 goals") repeats the scoreboard
   and the line above the pitch; the retro page leaves it out at every size so
   the whole pitch fits on screen with the match above it. */
.pr-game--retro .pr-stage > .hp-panel__head {
  display: none !important;
}

/* On a phone the line above the pitch already says to swipe up, so the
   stage foot keeps only the keyboard hint (for a fine pointer). The lead and
   the scoreboard's title give way too, to bring the pitch up (its height and
   the bottom bar are handled below, "The pitch on a phone"): the match line
   says it is a demo fixture,
   and the confirm step says nothing is saved. The scoreboard keeps its title
   when a shared prediction is above it, to say which is the reader's. */
@media (max-width: 62.4375rem) {
  .pr-match .pr-lead {
    display: none;
  }

  .pr-match__when {
    margin-bottom: 0;
  }

  .pr-match.pl-head {
    padding-bottom: 0.5rem;
  }

  .pr-game--retro .pr-score--board > .hp-panel__head {
    display: none;
  }

  .pr-game--retro:has(.pr-received:not([hidden])) .pr-score--board > .hp-panel__head {
    display: flex;
  }

  .pr-game--retro .pr-score--board .pr-score__row {
    padding-top: 1rem;
  }

  .pr-game--retro .pr-steps,
  .pr-game--retro .pr-instruction {
    margin-top: 0.625rem;
  }

  .pr-game--retro .pr-stage {
    margin-top: 0.5rem;
  }

  .pr-game--retro .pr-stage__how {
    display: none;
  }

  .pr-game--retro .pr-stage__foot {
    padding-block: 0.625rem;
  }
}

@media (max-width: 62.4375rem) and (pointer: coarse) {
  .pr-game--retro .pr-stage__foot {
    display: none;
  }
}

/* The phone scoreboard: one row, read like a ground's board - crest, club
   code and goals for the home side, the goals and code then crest for the
   away side, the two scores meeting at the divider. The full names are the
   page's title just above it (and stay in the markup for screen readers, as
   does "Not set"), so the board is one line high and the pitch below it fits
   above the bottom bar. The codes are the step tabs' codes. */
.pr-team__code {
  display: none;
}

@media (max-width: 62.4375rem) {
  .pr-game--retro .pr-score--board .pr-score__row {
    padding-block: 0.75rem;
    column-gap: 0.5rem;
  }

  .pr-game--retro .pr-score--board .pr-team {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas: "crest code value";
    grid-template-rows: 2.75rem;
    column-gap: 0.5rem;
    row-gap: 0;
  }

  .pr-game--retro .pr-score--board .pr-team[data-team="away"] {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "value code crest";
  }

  .pr-game--retro .pr-score--board .pr-team__code {
    display: block;
    grid-area: code;
    font-family: var(--hp-display);
    font-style: italic;
    font-weight: 800;
    font-size: 1.375rem;
    line-height: 1;
    letter-spacing: 0.02em;
    color: #fff;
  }

  .pr-game--retro .pr-score--board .pr-team__crest {
    width: 2rem;
    max-height: 2.25rem;
  }

  .pr-game--retro .pr-score--board .pr-team__value,
  .pr-game--retro .pr-score--board .pr-team[data-team="away"] .pr-team__value.is-unset {
    grid-area: value;
    grid-row: auto;
  }

  .pr-game--retro .pr-score--board .pr-team[data-team="away"] .pr-team__value {
    justify-self: start;
  }

  .pr-game--retro .pr-score--board .pr-score__divider {
    height: 2rem;
  }

  /* Read out, not shown: the board's names and "Not set". */
  .pr-game--retro .pr-score--board .pr-team__name,
  .pr-game--retro .pr-score--board .pr-team__note,
  .pr-game--retro .pr-score--board .pr-team__note:empty {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* The pitch on a phone, with the site's bottom bar fixed over the page's
   foot. Its height follows the screen (the small viewport, so a browser's
   toolbars never cover it): up to the art's own 1 : 0.92 where there is
   room, so on a 360x740 or 390x844 phone the whole pitch, ball included,
   sits above the bar and its safe-area padding as the page opens.

   It is never cut below 102 of the scene's own pixel rows (the scene
   draws at a whole-number scale: 2 under 350px wide, 3 to 489px): the
   flattest view that keeps its depth - the spot at least 22 rows out from
   the goal line, the six-yard line between them, the keeper and stand
   whole - and still shows the faint aim path between the ball and the
   keeper (tested). On a 360px phone that is 1 : 0.85. --pr-above is how far down the default page the pitch
   starts: the fixed header, the match, the scoreboard, the steps and the
   one-line instruction. A longer page (a shared prediction, a long fixture
   name) starts the pitch lower and scrolls as any page does. */
@media (max-width: 47.9375rem) {
  .pr-game--retro {
    --pr-above: calc(64px + 19rem);
    --pr-bar: calc(61px + env(safe-area-inset-bottom, 0px));
    --pr-floor: 80vw;
  }

  .pr-game--retro .pr-pitch {
    aspect-ratio: auto;
    height: clamp(var(--pr-floor), 100svh - var(--pr-above) - var(--pr-bar) - 0.5rem, 92vw);
  }
}

/* 320px: the instruction a size down, so it stays one line. */
@media (max-width: 21.8125rem) {
  .pr-game--retro {
    --pr-floor: 204px;
  }

  .pr-game--retro .pr-instruction {
    font-size: 0.9375rem;
  }
}

@media (min-width: 21.875rem) and (max-width: 30.5625rem) {
  .pr-game--retro {
    --pr-floor: 306px;
  }
}

/* A phone on its side: no height fits the whole pitch above the bar, so it
   is kept to the fewest rows that hold its depth at these widths (the goal
   is bigger here, so 108 at scale 4), short enough to scroll the ball and
   most of the goal into view between the header and the bar together. */
@media (max-width: 47.9375rem) and (orientation: landscape) and (min-width: 30.625rem) {
  .pr-game--retro {
    --pr-floor: 432px;
  }
}

/* A short phone (375x667, or a tall one with its browser's toolbars
   showing): the match head drops its strap and ground and the gaps close
   up, so the ball and, on most, the whole pitch still open above the bar.
   The strap is the page's <title>, and the ground is on the share card. */
@media (max-width: 47.9375rem) and (max-height: 45rem) {
  .pr-game--retro {
    --pr-above: calc(64px + 15.5rem);
  }

  .pr-match.pl-head {
    padding-block: 0.625rem 0.5rem;
  }

  .pr-match .hp-strap,
  .pr-match .pr-demo__venue {
    display: none !important;
  }

  .pr-match .pr-match__title {
    margin: 0 0 0.375rem;
  }

  .pr-game--retro .pr-steps,
  .pr-game--retro .pr-instruction {
    margin-top: 0.5rem;
  }

  .pr-game--retro .pr-instruction {
    margin-bottom: 0;
  }

  .pr-game--retro .pr-stage {
    margin-top: 0.5rem;
  }
}

@media (min-width: 62.5rem) {
  /* One band: the match on the left, its details and the lead on the right,
     so the pitch starts high enough to be seen whole on a laptop. */
  .pr-match .hp-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 27rem);
    grid-template-areas: "strap when" "title lead";
    column-gap: clamp(1.5rem, 3vw, 3rem);
    align-items: end;
  }

  .pr-match .hp-strap { grid-area: strap; }
  .pr-match .pr-match__title { grid-area: title; margin-bottom: 0; font-size: clamp(2.5rem, 4.2vw, 4rem); }
  .pr-match .pr-match__when { grid-area: when; margin: 0; }
  .pr-match .pr-lead { grid-area: lead; align-self: end; }

  .pr-game--retro {
    row-gap: 0;
  }

  .pr-game--retro .pr-steps {
    margin-top: 1.25rem;
  }

  .pr-game--retro .pr-stage {
    margin-top: 0;
  }

  .pr-game--retro .pr-team {
    min-height: 0;
  }

  .pr-game--retro .pr-score__divider {
    height: 6.5rem;
  }

  .pr-game--retro .pr-team__value {
    font-size: 4rem;
  }

  .pr-game--retro .pr-team__value.is-unset {
    font-size: 2.75rem;
    line-height: 1.2;
  }

  .pr-game--retro .pr-stage__foot {
    padding-block: 0.75rem;
  }
}

/* ---------------------------------------------------------------- loading

   The styles are linked in the head, so the page is never painted unstyled.
   Two things can still be wrong before the app runs, and only those wait:

   - a shared link names another fixture, but the page's text is Arsenal v
     Chelsea until the app reads it. index.html's head script marks the root
     `pr-pending` for such a link only; the match's text and the game's
     panels (data-pr-fixture: the pitch too, as the link's longer names move
     it) keep their room but are not shown, and the shared panel keeps its
     room, until src/app.js clears the class (one task after the module runs).
     The header, menu and bottom bar are never held back and a clean URL never
     waits. If the app never starts, the pitch shows again after a few seconds
     with the notice below; the default fixture's names stay hidden, as they
     are not the link's.
   - if the app never starts at all, a notice on the pitch says so. It takes
     no room and only appears after a few seconds, so a normal load never
     shows it; the app hides it as it starts. */
html.pr-pending [data-pr-fixture] {
  visibility: hidden;
}

/* If the app never starts, the pitch comes back with its notice, but never
   the default fixture's names for someone else's link. */
html.pr-pending .pr-stage[data-pr-fixture] {
  animation: pr-reveal 0s 4s forwards;
}

/* A returning reader's saved prediction (index.html's head script found it
   for the default fixture): the game's panels wait the same way, so the
   default 0 is never shown first. The match above is already right, and if
   the app never starts the panels come back as they are. */
html.pr-restoring .pr-game [data-pr-fixture] {
  visibility: hidden;
  animation: pr-reveal 0s 4s forwards;
}

html.pr-pending .pr-received[hidden] {
  display: block !important;
  visibility: hidden;
}

html.pr-pending .pr-received[hidden] .pr-received__line {
  min-height: 5.5rem;
}

.pr-boot {
  position: absolute;
  inset: auto 1rem 1rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--hp-live);
  background: rgba(1, 8, 47, 0.92);
  color: var(--hp-text);
  visibility: hidden;
  animation: pr-reveal 0s 4s forwards;
}

.pr-boot.pr-boot--now {
  visibility: visible;
  animation: none;
}

@keyframes pr-reveal {
  to {
    visibility: visible;
  }
}

/* ------------------------------------------- a site fixture page (/predict/)

   The match's own preview or report, under its details. */
.pr-match__links {
  margin: 0.75rem 0 0;
}

/* After kick-off the page is read-only: the closed panel says so, the
   reader's saved prediction (if this browser has one) stays on the
   scoreboard, a friend's shared one stays in its panel, and the game itself
   (steps, pitch, controls, sharing) is gone. Not a lock: the clock and the
   cookie are the reader's own. */
.pr-closed {
  grid-area: closed;
  margin-bottom: 1rem;
}

.pr-closed__text {
  margin: 0;
  padding: 0.75rem 1.125rem 1rem;
  color: var(--hp-text);
}

.pr-game[data-closed] :is(.pr-steps, .pr-instruction, .pr-stage, .pr-controls, .pr-share) {
  display: none !important;
}

.pr-game[data-closed]:not([data-has-saved]) .pr-score {
  display: none;
}

.pr-game[data-closed] .pr-score--board > .hp-panel__head {
  display: flex;
}
