/* Ludicrous Display (SPEC.md §4), in the "amber terminal" look (Revision 17, 10 Oct 2026). Every
   colour is one of the tokens in :root, apart from these, written as rgba: the scanlines and the
   heading glow (--accent at 3.5% and 35%), the pressed tile shadow's fallback for browsers without
   color-mix (--paper at 60%), and the tip pop-up's glow (--accent at 15%) and backdrop (black at
   70%). --paper is also the manifest's theme_color and background_color, and the theme-color meta
   tag. The fonts are self-hosted in fonts/ (SIL OFL 1.1, see fonts/OFL.txt).

   VT323 is small for its size (each character is 0.4em wide, capitals about 0.6em tall), so it's set
   about 1.5 times larger than Oswald was. IBM Plex Mono characters are 0.6em wide. */

/* VT323 (headings, labels, codes, buttons). Team codes and labels are ASCII, but the team name and
   score box can show any club name, so it has a latin-ext file too. */
@font-face {
  font-family: "VT323";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/vt323-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "VT323";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/vt323-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono carries the body text and the model's lines, which can name players with letters
   outside Latin-1 (e.g. Šeško), so it has a latin-ext file for each style as well. */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #0B0806;
  --ink: #F6E3BF;
  --accent: #F5A54A;
  --accent-pressed: #C9832F;
  --muted: #B39272;
  --rule: #3B2717;
  --card: #140E09;
  --tile: #140E09;
  --tile-edge: #3B2717;
  --tile-hover: #F5A54A;
  --tile-pressed: #C9832F;
  --banter: #E8D7B4;
  --stat: #9CCB7A;

  --display: "VT323", "Courier New", monospace;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --glow: 0 0 10px rgba(245, 165, 74, 0.35); /* --accent at 35% */
  --gutter: 16px;
  --measure: 40rem;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* The scanlines sit on top of --paper. body's background fills the whole viewport. */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, rgba(245, 165, 74, 0.035) 0 1px, transparent 1px 3px);
  color: var(--ink);
  font: 400 15px/1.5 var(--mono);
}

a { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

h1, h2 { margin: 0; }

/* The masthead, page, install area and footer share one column. */
.masthead, .page, .install, .footer {
  width: calc(100% - 2 * var(--gutter));
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  margin-top: calc(env(safe-area-inset-top, 0px) + 14px);
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--rule);
}

.masthead__prompt {
  margin: 0 0 10px;
  color: var(--muted);
  font: 400 12px/1.3 var(--mono);
  overflow-wrap: anywhere;
}

.masthead__title {
  display: block;
  color: var(--accent);
  font: 400 44px/0.95 var(--display);
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: var(--glow);
}

/* VT323 has no italic, so "ludicrous" leans with a skew. At 86px "LUDICROUS" is 310px wide and the
   lean adds about 15px, so below 360px wide the size follows the column (3.9px of width per px of
   font size), and it never overflows at 320px. */
.masthead__title em {
  display: block;
  width: max-content;
  margin: 6px 0 4px;
  font-size: min(86px, calc((100vw - 2 * var(--gutter)) / 3.9));
  font-style: normal;
  line-height: 0.95;
  transform: skewX(-12deg);
  transform-origin: left bottom;
}

/* "night?" and the cursor wrap together, so the cursor is never alone on a line. */
.masthead__end { white-space: nowrap; }

/* A blinking block cursor after "night?". It stays lit, without blinking, under reduced motion. */
.cursor {
  display: inline-block;
  width: 18px;
  height: 34px;
  margin-left: 6px;
  vertical-align: -4px;
  background: var(--accent);
  box-shadow: var(--glow);
  animation: cursor-blink 1.1s steps(1) infinite;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

/* Team pages (and loading or failing ones opened with ?team=) get the compact masthead. */
body[data-masthead="compact"] .masthead { padding: 10px 0 10px; }
body[data-masthead="compact"] .masthead__prompt,
body[data-masthead="compact"] .cursor { display: none; }

body[data-masthead="compact"] .masthead__title {
  font-size: 24px;
  line-height: 1.1;
  text-wrap: balance;
}

body[data-masthead="compact"] .masthead__title em {
  display: inline-block;
  width: auto;
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

/* ---------------------------------------------------------------- page */

.page {
  flex: 1;
  padding: 20px 0 36px;
}

body[data-masthead="compact"] .page { padding-top: 4px; }

.intro {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.6;
}

.status {
  margin: 8px 0 0;
  color: var(--muted);
  font-style: italic;
}

.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-left-width: 6px;
  background: var(--card);
  font: 600 15px/1.45 var(--mono);
}

/* The error page has no back link above its notice. */
body[data-masthead="compact"] .notice:first-child { margin-top: 16px; }

.notice--offline {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--muted);
  color: var(--muted);
  font: italic 400 13px/1.45 var(--mono);
}

.empty {
  margin: 8px 0 0;
  padding: 18px 16px;
  border: 1px solid var(--rule);
  background: var(--card);
  font: 400 15px/1.6 var(--mono);
}

.retry, .copy {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  color: var(--paper);
  font: 400 22px/1 var(--display);
  text-transform: uppercase;
  cursor: pointer;
}

.retry:hover, .copy:hover,
.retry:active, .copy:active { background: var(--accent-pressed); }

/* ---------------------------------------------------------------- picker */

.picker + .picker { margin-top: 30px; }

/* "> Recent", "> Premier League teams". The "> " is decoration, hidden from screen readers where the
   browser supports alt text for generated content. */
.picker h2 {
  margin-bottom: 12px;
  color: var(--accent);
  font: 400 24px/1.1 var(--display);
  text-shadow: var(--glow);
}

.picker h2::before {
  content: "> ";
  content: "> " / "";
}

.team-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.team-link {
  color: var(--ink);
  font: 400 14px/1.2 var(--mono);
  text-decoration: none;
}

.team-link:hover { color: var(--accent); }

/* Recent: square-cornered outlined buttons. */
.team-list--pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.team-list--pills .team-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: transparent;
}

/* Every team: tiles in two columns, filled top to bottom, then left to right (Revision 11). */
.team-list--columns {
  columns: 2;
  column-gap: 12px;
}

.team-list--columns li {
  break-inside: avoid;
  margin-bottom: 8px;
}

.team-list--columns .team-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 8px 6px 10px;
  border: 1px solid var(--tile-edge);
  border-radius: 0;
  background: var(--tile);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

/* Three VT323 capitals at 22px are 26.4px wide. */
.team-link__code {
  flex: 0 0 28px;
  color: var(--accent);
  font: 400 22px/1 var(--display);
}

/* Long names ("Crystal Palace", "Brighton Hove") wrap at the space inside the tile on narrow
   phones. overflow-wrap is only a last resort, so a name never spills out of its tile. */
.team-list--columns .team-link__name {
  min-width: 0;
  color: var(--ink);
  font: 400 14px/1.25 var(--mono);
  overflow-wrap: break-word;
}

/* "Bournemouth" is 92.4px at 14px. Below 360px a tile leaves the name under 92px (82px at 320px),
   so it drops to 12px (79.2px). */
@media (max-width: 359px) {
  .team-list--columns .team-link__name { font-size: 12px; }
}

/* Mouse only, so a phone never keeps a stuck hover colour after a tap. */
@media (hover: hover) and (pointer: fine) {
  .team-list--columns .team-link:hover {
    background: var(--tile-hover);
    border-color: var(--tile-hover);
  }

  .team-list--columns .team-link:hover .team-link__code,
  .team-list--columns .team-link:hover .team-link__name { color: var(--paper); }
}

/* After the hover rules, so a press wins over hover. iPhone Safari needs app.js's touchstart
   listener to show it. */
.team-list--columns .team-link:active {
  background: var(--tile-pressed);
  border-color: var(--tile-pressed);
  box-shadow: inset 0 2px 4px rgba(11, 8, 6, 0.6); /* --paper at 60%, for browsers without color-mix */
  box-shadow: inset 0 2px 4px color-mix(in srgb, var(--paper) 60%, transparent);
}

.team-list--columns .team-link:active .team-link__code,
.team-list--columns .team-link:active .team-link__name { color: var(--paper); }

.team-list--columns .team-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- team view */

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font: 400 14px/1 var(--mono);
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.match__label {
  margin: 12px 0 2px;
  color: var(--muted);
  font: 400 12px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* "BOURNEMOUTH" is 290px at 66px, so below 360px wide the size follows the column. */
.team-name {
  margin: 6px 0 18px;
  color: var(--accent);
  font: 400 min(66px, calc((100vw - 2 * var(--gutter)) / 4.6))/0.95 var(--display);
  text-transform: uppercase;
  text-shadow: var(--glow);
  overflow-wrap: break-word;
}

.match__label + .team-name { margin-top: 0; }

.match {
  margin-bottom: 12px;
  padding: 8px 16px 12px;
  border: 1px solid var(--accent);
}

.match__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  min-height: 52px;
  color: var(--ink);
}

.match__row--own { color: var(--accent); }

.match__team {
  min-width: 0;
  font: 400 16px/1.25 var(--mono);
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.match__goals {
  font: 400 56px/0.9 var(--display);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.match__meta {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
  color: var(--muted);
  font: 400 13px/1.45 var(--mono);
}

.opponent-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 8px;
  color: var(--accent);
  font: italic 400 14px/1.4 var(--mono);
}

.match + .cards { margin-top: 14px; }

/* ---------------------------------------------------------------- comment cards */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  padding: 14px 16px 16px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--card);
}

.card + .card { margin-top: 12px; }

/* "> HOT TAKE", "> BANTER", "> STAT". app.js writes only the type; the "> " is decoration. */
.tag {
  display: block;
  font: 400 22px/1.1 var(--display);
  text-transform: uppercase;
}

.tag::before {
  content: "> ";
  content: "> " / "";
}

.tag--hot-take { color: var(--accent); }
.tag--banter { color: var(--banter); }
.tag--stat { color: var(--stat); }

.card__text {
  margin: 10px 0 8px;
  font: 400 15px/1.6 var(--mono);
  overflow-wrap: anywhere;
}

.card__note {
  margin: 0 0 14px;
  color: var(--muted);
  font: italic 400 13px/1.5 var(--mono);
  overflow-wrap: anywhere;
}

.card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.thumbs { display: flex; gap: 8px; }

.thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.thumb svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thumb[aria-pressed="true"] {
  background: var(--accent);
  color: var(--paper);
}

/* ---------------------------------------------------------------- install (Revision 14) */

/* Bookmark + Install web app, below the team list on the pages that show it. app.js hides the whole
   area on other pages and in the installed app. The footer, with its data credit, always follows it
   and clears the home bar. */
.install {
  margin-top: 8px;
  margin-bottom: 24px;
  text-align: center;
}

.install[hidden], .install [hidden] { display: none; }

.install__buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
  max-width: 360px;
  margin: 0 auto;
}

/* Install web app is the primary (filled) button; Bookmark is the outlined secondary one. Both have
   the same 1px border, so they're the same size. Labels never wrap. "INSTALL WEB APP" is 15
   characters, 6em wide in VT323, and a button's label space is half the column, less 4px of the
   gap, 12px of padding and 2px of border: 50vw - 34px on a phone. So the label is 24px from 360px
   wide up, and shrinks with the screen below that (20.8px at 320px). */
.install__button {
  min-width: 0;
  min-height: 48px;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: var(--paper);
  font: 400 min(24px, calc((50vw - 34px) / 6.05))/1 var(--display);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.install__button--secondary {
  background: transparent;
  color: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .install__button:hover { background: var(--accent-pressed); border-color: var(--accent-pressed); }
  .install__button--secondary:hover { background: var(--tile-pressed); border-color: var(--tile-pressed); color: var(--paper); }
}

/* After the hover rules, so a press wins over hover. iPhone Safari needs app.js's touchstart
   listener to show it. */
.install__button:active { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.install__button--secondary:active { background: var(--tile-pressed); border-color: var(--tile-pressed); color: var(--paper); }

.install__button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.install__reassure {
  margin: 10px 0 0;
  color: var(--muted);
  font: 400 13px/1.4 var(--mono);
}

/* ---------------------------------------------------------------- tip pop-up (Revision 15) */

/* A native <dialog>, opened with showModal() and centred by the browser. The padding is on
   .tip-dialog__body, so the dialog's own box is the card's edge: app.js treats a click whose target
   is the dialog itself as a tap on the backdrop. */
/* 100% rather than 100vw: on desktop, 100vw includes the scrollbar, which can leave a narrow window's
   card under 16px from the edge. */
.tip-dialog {
  width: min(320px, calc(100% - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 0 24px rgba(245, 165, 74, 0.15); /* --accent at 15% */
}

/* Written out, because older browsers don't pass custom properties to ::backdrop. */
.tip-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }

.tip-dialog__body { padding: 22px 20px 20px; }

.tip-dialog__title {
  margin: 0 0 12px;
  color: var(--accent);
  font: 400 26px/1.1 var(--display);
  text-transform: uppercase;
  text-align: center;
  text-shadow: var(--glow);
}

/* Balanced, so a two-line tip doesn't leave one word ("star.") alone on the second line. */
.tip-dialog__text {
  margin: 0;
  font: 400 15px/1.55 var(--mono);
  text-align: center;
  text-wrap: balance;
}

/* ⋮, ☆ and ⌘: IBM Plex Mono hasn't got them, so they come from the system font, larger. */
.tip-sym {
  color: var(--accent);
  font: 700 20px/1 system-ui, sans-serif;
  vertical-align: -2px;
}

/* "Got it" is a primary .install__button, full width, always at 24px. */
.tip-dialog__close {
  display: block;
  width: 100%;
  margin-top: 20px;
  font-size: 24px;
}

/* The page behind the card doesn't scroll. No scrollbar-gutter: the backdrop doesn't cover a reserved
   gutter, which left an undimmed strip down the right on desktop. */
html:has(dialog[open]) { overflow: hidden; }

.tip-dialog[open] { animation: tip-in 150ms ease-out; }
.tip-dialog[open]::backdrop { animation: tip-fade 150ms ease-out; }

@keyframes tip-in {
  from { opacity: 0; transform: scale(0.96); }
}

@keyframes tip-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tip-dialog[open], .tip-dialog[open]::backdrop { animation: none; }
}

/* ---------------------------------------------------------------- footer and toast */

.footer {
  padding: 14px 0 calc(env(safe-area-inset-bottom, 0px) + 24px);
  border-top: 1px solid var(--rule);
  text-align: center;
  color: var(--muted);
  font: 400 12px/1.6 var(--mono);
}

/* Always shown: the data credit is on every page, even when app.js hides the iPhone line. */
.footer p { margin: 2px 0; }

.footer a { color: inherit; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translateX(-50%);
  max-width: calc(100% - 2 * var(--gutter));
  padding: 10px 18px;
  border: 1px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  font: 400 22px/1.1 var(--display);
  text-transform: uppercase;
}

.toast[hidden] { display: none; }
