@charset "UTF-8";

/* ============================================================
   BACKSTICK -- Design System v4
   Teletext-heritage, modern sportsbook light theme
   Chrome: #0B3347  Yellow: #F5C400  Cyan: #00C4C4
   IBM Plex Mono (data) + Inter (prose)
   ============================================================ */

/* Fonts loaded via <link> in base.html */

/* --- TOKENS ------------------------------------------------ */
:root {
  /* Chrome -- nav, card headers, stepper buttons */
  --chrome:    #0B3347;
  --chrome-hi: #0F4060;
  --chrome-lo: #071E2E;

  /* Accent */
  --yellow:    #F5C400;
  --yellow-hi: #FFD740;
  --cyan:      #00C4C4;
  --cyan-dk:   #009A9A;
  --cyan-bg:   rgba(0, 196, 196, 0.08);

  /* Page field -- deep broadcast blue, slightly darker than chrome */
  --bg:       #071A28;
  --card:     #FFFFFF;
  --card-dim: #F4F7FA;

  /* Ink */
  --ink:   #111820;
  --ink-2: #3A4558;
  --ink-3: #6E7F9C;
  --ink-4: #A8B5C8;

  /* Semantic */
  --ok:      #007A47;
  --ok-bg:   #EDFAF3;
  --warn:    #7A4200;
  --warn-bg: #FFF8ED;
  --warn-bd: #FFD580;
  --err:     #C42B2B;
  --err-bg:  #FFF1F0;

  /* Structure */
  --bd:     #D4DAE6;
  --bd-md:  #B0BBCC;
  --r:      3px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4), 0 0 0 1px rgba(245,196,0,0.12);

  --mono: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  /* Deep broadcast blue field + scanlines */
  background-color: var(--bg);
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.09) 3px,
    rgba(0, 0, 0, 0.09) 4px
  );
  -webkit-font-smoothing: antialiased;
}

/* Pitch overlay — fixed behind all content */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url('../img/pitch.svg');
  background-size: 90vw auto;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0.07;
  pointer-events: none;
}

/* Ensure stacking context so content sits above the pitch */
.site-header,
main,
.messages,
.ad-slot,
.site-footer { position: relative; z-index: 1; }

/* Default links bright for dark field; overridden inside light cards */
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--yellow); text-decoration: none; }

/* Links inside light card surfaces */
.card a,
.narrow a,
.invite a,
.msg a { color: var(--cyan-dk); }
.card a:hover,
.narrow a:hover,
.invite a:hover { color: var(--cyan); text-decoration: underline; }

/* --- HEADER ----------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 1.5rem;
  background: var(--chrome);
  border-bottom: 3px solid var(--yellow);
  box-shadow: 0 2px 8px rgba(11,51,71,0.25);
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin-right: 2rem;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand:hover .brand-logo-nav { opacity: 0.82; }

/* Clip container: hides the strapline by limiting visible height.
   The image renders taller (40px) so the wordmark text fills the clip window;
   the strapline sits below the cut-off. Adjust .brand-logo-nav height to tune. */
.brand-clip {
  display: block;
  height: 26px;
  overflow: hidden;
  line-height: 0;
}

.brand-logo-nav {
  display: block;
  height: 40px;    /* render taller than the clip — strapline falls out of frame */
  width: auto;
  /* navy → white, green → green:
     invert()        navy (#1B2A4A) → warm cream; green → magenta
     brightness(1.5) cream blows out to white (clips); magenta brightens
     hue-rotate(180) white stays white; magenta rotates back to green       */
  filter: invert(1) brightness(1.5) hue-rotate(180deg);
  transition: opacity 0.1s;
}

/* Login / auth pages: full wordmark on white card surface (no filter needed) */
.card-logo-band {
  padding: 1.5rem 1.5rem 1.25rem;
  text-align: center;
  background: var(--card);
  border-bottom: 1px solid var(--bd);
}

.card-logo {
  max-width: 220px;
  width: 100%;
  height: auto;
  display: inline-block;
}

.site-header nav {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.site-header nav a {
  display: flex;
  align-items: center;
  padding: 0 0.8rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}
.site-header nav a:hover,
.site-header nav a.nav-active {
  color: #ffffff;
  border-bottom-color: var(--yellow);
  text-decoration: none;
}

/* P302 easter egg -- teletext page number wink */
.page-num {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.18);
  margin-left: auto;
  margin-right: 1.25rem;
  cursor: default;
  user-select: none;
  flex-shrink: 0;
}

.site-header .account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.account .who {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.04em;
}

.site-header .account a {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.site-header .account a:hover { color: var(--yellow); text-decoration: none; }

.linkbtn {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: var(--r);
  transition: border-color 0.1s, color 0.1s;
}
.linkbtn:hover { border-color: var(--yellow); color: var(--yellow); }

/* --- LAYOUT ----------------------------------------------- */
main {
  max-width: 1020px;
  margin: 1.75rem auto;
  padding: 0 1.5rem;
}

.narrow { max-width: 420px; }

/* --- AD SLOT ---------------------------------------------- */
.ad-slot {
  max-width: 1020px;
  margin: 0.4rem auto 0;
  padding: 0.25rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.18);
  text-align: right;
  letter-spacing: 0.04em;
}
.ad-slot a { color: rgba(255, 255, 255, 0.18); }
.ad-slot a:hover { color: var(--cyan); text-decoration: none; }

/* --- MESSAGES --------------------------------------------- */
.messages {
  list-style: none;
  max-width: 1020px;
  margin: 0.75rem auto 0;
  padding: 0 1.5rem;
}
.msg {
  padding: 0.55rem 1rem;
  border-radius: var(--r);
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-left: 3px solid;
}
.msg.success { background: var(--ok-bg);  color: var(--ok);  border-color: var(--ok); }
.msg.error   { background: var(--err-bg); color: var(--err); border-color: var(--err); }

/* --- TYPOGRAPHY -------------------------------------------- */
/* Page-level headings sit on the dark field -- light text */
h1 {
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.92);
  margin: 0 0 1.25rem;
}

h2 {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin: 2rem 0 0.6rem;
}

h3 {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin: 1.5rem 0 0.5rem;
}

/* Inside light card bodies, headings revert to ink */
.card h2, .card h3,
.narrow h2, .narrow h3 {
  color: var(--ink-3);
}

.muted { color: rgba(255, 255, 255, 0.6); }
p.muted { font-size: 0.82rem; }

/* Muted text inside cards stays dark */
.card .muted,
.card-foot .muted,
.narrow .muted { color: var(--ink-3); }

.total {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1.25rem;
}
.total strong {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--yellow);
  margin-left: 0.15rem;
}

/* --- CARD -------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Ceefax signature: chunky flat chrome header bar */
.card-head {
  background: var(--chrome);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 3px solid var(--yellow);
}

.card-head h1 {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0;
  line-height: 1;
}

.card-head .sub {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.card-foot {
  padding: 0.75rem 1.25rem;
  background: var(--card-dim);
  border-top: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* --- LOCK / STATUS BANNERS --------------------------------- */
.lock-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--cyan);
  color: #071A28;
  padding: 0.5rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- SHARED TABLE ------------------------------------------ */
table {
  border-collapse: collapse;
  width: 100%;
  background: var(--card);
  font-size: 0.875rem;
}

th {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--card-dim);
  padding: 0.55rem 0.85rem;
  border-bottom: 2px solid var(--bd);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--bd);
  text-align: left;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- FIXTURES TABLE ---------------------------------------- */
table.fixtures { border: none; }

table.fixtures th:first-child,
table.fixtures td:first-child { padding-left: 1.25rem; }
table.fixtures th:last-child,
table.fixtures td:last-child  { padding-right: 1.25rem; }

/* Match name -- Inter, prominent */
table.fixtures td:nth-child(1) {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  min-width: 180px;
}

/* Kickoff -- mono, muted */
table.fixtures td:nth-child(2) {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Hover rows */
table.fixtures tbody tr:hover td { background: var(--card-dim); }

/* Score cell */
.score-cell {
  white-space: nowrap;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

/* Score separator */
.score-cell .score-sep {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink-3);
  margin: 0 3px;
  vertical-align: middle;
  display: inline-block;
}

/* Stepper widget (JS-injected) */
.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid var(--chrome);
  border-radius: var(--r);
  overflow: hidden;
  vertical-align: middle;
  transition: border-color 0.12s, box-shadow 0.12s;
  background: var(--card);
}
.stepper:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-bg);
}

.stepper-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  padding: 0;
  background: var(--chrome);
  border: none;
  color: var(--yellow);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}
.stepper-btn:hover  { background: var(--chrome-hi); }
.stepper-btn:active { background: var(--chrome-lo); }
.stepper-btn:disabled {
  background: var(--card-dim);
  color: var(--ink-4);
  cursor: default;
}

input.score {
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
  width: 30px;
  height: 28px;
  padding: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--chrome);
  background: var(--card-dim);
  border: none;
  border-left: 1px solid var(--bd);
  border-right: 1px solid var(--bd);
  outline: none;
}
input.score:focus { background: var(--card); color: var(--chrome); }
input.score::-webkit-inner-spin-button,
input.score::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input.score[disabled], input.score[readonly] {
  background: var(--card-dim);
  color: var(--ink-3);
}

/* Bonus columns */
table.fixtures td:nth-child(4),
table.fixtures td:nth-child(5),
table.fixtures td:nth-child(6),
table.fixtures th:nth-child(4),
table.fixtures th:nth-child(5),
table.fixtures th:nth-child(6) {
  text-align: center;
  width: 48px;
  padding-left: 0;
  padding-right: 0;
}

input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--yellow);
  vertical-align: middle;
}

.field-error {
  color: var(--err);
  font-size: 0.75rem;
  font-family: var(--mono);
}

.fixture-hint {
  font-size: 0.75rem;
  color: var(--ink-3);
  margin: 0;
}

/* --- STANDINGS TABLE --------------------------------------- */

/* Base: all cells mono, clear row rules */
table.standings th,
table.standings td {
  border-bottom: 1px solid var(--bd);
  font-variant-numeric: tabular-nums;
}
table.standings tbody tr:last-child td { border-bottom: none; }

/* Rank column -- narrow, right-edged, centred number */
table.standings th:nth-child(1),
table.standings td:nth-child(1) {
  width: 3.2rem;
  padding-left: 1rem;
  padding-right: 0.5rem;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
  border-right: 1px solid var(--bd);
}
table.standings th:nth-child(1) {
  font-size: 0.62rem;
  color: var(--ink-3);
}

/* Player name column */
table.standings th:nth-child(2),
table.standings td:nth-child(2) {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Played column */
table.standings th:nth-child(3),
table.standings td:nth-child(3) {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-3);
  text-align: center;
  width: 5rem;
}

/* Points column -- large mono, right-aligned, separated */
table.standings th:nth-child(4),
table.standings td:nth-child(4) {
  text-align: right;
  padding-right: 1.25rem;
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--chrome);
  border-left: 1px solid var(--bd);
  width: 6rem;
}
table.standings th:nth-child(4) { font-size: 0.62rem; }

/* Alternating rows */
table.standings tbody tr:nth-child(even) td { background: var(--card-dim); }
table.standings tbody tr:hover td { background: rgba(0,196,196,0.06); }

/* #1 -- yellow rank, bold row, left gold rule */
table.standings tbody tr:nth-child(1) td {
  font-weight: 600;
  background: #FFFEF5;
}
table.standings tbody tr:nth-child(1) td:nth-child(1) {
  color: var(--yellow);
  box-shadow: inset 4px 0 0 var(--yellow);
}
table.standings tbody tr:nth-child(1) td:nth-child(4) { color: var(--chrome); }

/* #2 and #3 */
table.standings tbody tr:nth-child(2) td:nth-child(1) { color: var(--ink-2); }
table.standings tbody tr:nth-child(3) td:nth-child(1) { color: var(--ink-3); }

/* Logged-in user row -- cyan field, cyan rule */
table.standings tbody tr.my-row td {
  background: rgba(0, 196, 196, 0.1) !important;
}
table.standings tbody tr.my-row td:nth-child(1) {
  box-shadow: inset 4px 0 0 var(--cyan);
  color: var(--cyan-dk);
}
table.standings tbody tr.my-row td:nth-child(2) { color: var(--cyan-dk); }

/* --- STANDINGS GRID (per-matchweek) ----------------------- */
table.standings.grid th,
table.standings.grid td {
  text-align: center;
  padding: 0.5rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

table.standings.grid th:first-child,
table.standings.grid td:first-child {
  text-align: left;
  padding-left: 1.25rem;
  min-width: 130px;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  box-shadow: 2px 0 4px rgba(11,51,71,0.07);
}

table.standings.grid tbody tr:nth-child(even) td:first-child { background: var(--card-dim); }

table.standings.grid th:last-child,
table.standings.grid td:last-child {
  font-weight: 700;
  font-size: 0.9rem;
  padding-right: 1.25rem;
  color: var(--chrome);
  border-left: 2px solid var(--bd);
}

table.standings.grid tbody tr:nth-child(even) td { background: var(--card-dim); }
table.standings.grid tbody tr:hover td { background: var(--cyan-bg); }
table.standings.grid tbody tr:hover td:first-child { background: var(--cyan-bg); }
table.standings.grid tbody tr.my-row td { background: var(--cyan-bg) !important; }
table.standings.grid tbody tr.my-row td:first-child { background: var(--cyan-bg) !important; }

/* --- RESULTS TABLE ---------------------------------------- */
table.results th:first-child,
table.results td:first-child { padding-left: 1.25rem; }
table.results th:last-child,
table.results td:last-child  { padding-right: 1.25rem; }

table.results td:nth-child(1) {
  font-weight: 600;
}

table.results td:nth-child(2),
table.results td:nth-child(3) {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.hits {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ok);
}

table.results td:last-child {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--chrome);
}

/* Negative total — red weight to signal the hit */
table.results td.pts-neg {
  color: var(--err);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
}

/* Bonus detail chips in the Bonuses column */
.bonus-detail {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.bonus-hit {
  color: var(--ok);
  margin-right: 0.25rem;
}

.bonus-miss {
  color: var(--err);
  margin-right: 0.25rem;
}

table.results tbody tr:nth-child(even) td { background: var(--card-dim); }
table.results tbody tr:hover td { background: var(--cyan-bg); }

/* --- BUTTONS ---------------------------------------------- */
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 1.25rem;
  background: var(--yellow);
  color: var(--chrome);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.1s;
  box-shadow: 0 1px 3px rgba(11,51,71,0.2);
}
button[type="submit"]:hover  { background: var(--yellow-hi); }
button[type="submit"]:active { transform: translateY(1px); box-shadow: none; }

.narrow button[type="submit"] {
  width: 100%;
  height: 42px;
  margin-top: 1rem;
  font-size: 0.78rem;
}

/* --- AUTH FORMS ------------------------------------------- */
.narrow form {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1rem;
}

form p { margin: 0 0 1rem; }
form p:last-of-type { margin-bottom: 0; }

label {
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--bd-md);
  border-radius: var(--r);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--cyan-dk);
  box-shadow: 0 0 0 3px var(--cyan-bg);
}

/* --- LEAGUES ---------------------------------------------- */
.league-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.invite {
  background: var(--card-dim);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}
.invite p { margin: 0.3rem 0; }
.invite p:first-child { margin-top: 0; }
.invite p:last-child  { margin-bottom: 0; }

.invite code {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--chrome);
  color: var(--yellow);
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  letter-spacing: 0.08em;
}

/* Generic tables (leagues list etc.) */
table:not(.fixtures):not(.standings):not(.results):not(.archive-results) th:first-child,
table:not(.fixtures):not(.standings):not(.results):not(.archive-results) td:first-child { padding-left: 1.25rem; }
table:not(.fixtures):not(.standings):not(.results):not(.archive-results) th:last-child,
table:not(.fixtures):not(.standings):not(.results):not(.archive-results) td:last-child  { padding-right: 1.25rem; }
table:not(.fixtures):not(.standings):not(.results):not(.archive-results) tbody tr:nth-child(even) td { background: var(--card-dim); }
table:not(.fixtures):not(.standings):not(.results):not(.archive-results) tbody tr:hover td { background: var(--cyan-bg); }

/* --- SEASON ARCHIVE --------------------------------------- */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .archive-grid { grid-template-columns: 1fr; }
}

.archive-grid .card { margin-bottom: 0; }

table.archive-results {
  table-layout: fixed;
  font-size: 0.82rem;
}

table.archive-results td {
  padding: 0.38rem 0.75rem;
  border-bottom: 1px solid var(--bd);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.archive-results tbody tr:last-child td { border-bottom: none; }
table.archive-results tbody tr:hover td { background: var(--card-dim); }

table.archive-results td.home-name {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--ink-2);
  width: 42%;
}

table.archive-results td.score-col {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--chrome);
  white-space: nowrap;
  width: 16%;
  letter-spacing: 0.06em;
}

table.archive-results td.away-name {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--ink-2);
  width: 42%;
}

/* Bold the winning side; draw score goes muted */
table.archive-results tr.home-win td.home-name { color: var(--ink); font-weight: 700; }
table.archive-results tr.away-win td.away-name { color: var(--ink); font-weight: 700; }
table.archive-results tr.draw td.score-col     { color: var(--ink-3); }

/* --- HOW TO PLAY ------------------------------------------ */
.narrow ul { padding-left: 1.25rem; font-size: 0.9rem; color: var(--ink-2); line-height: 1.7; }
.narrow p  { font-size: 0.9rem; color: var(--ink-2); }

/* --- CRESTS ----------------------------------------------- */
.crest {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.crest--sm {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.crest--fallback {
  background: var(--bd);
  border-radius: 2px;
  opacity: 0.45;
}
.team-with-crest {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.match-teams {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.match-teams .team-with-crest {
  flex: 1;
  min-width: 0;
  background: var(--card-dim);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 0.2rem 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-teams .team-with-crest:first-child {
  justify-content: flex-end;
}
.match-teams .vs {
  color: var(--ink-4);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* --- FOOTER ----------------------------------------------- */
.site-footer {
  max-width: 1020px;
  margin: 2.5rem auto 1rem;
  padding: 0.85rem 1.5rem;
  color: rgba(255, 255, 255, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

/* ============================================================
   RESPONSIVE — mobile-first pass
   Breakpoints: 600 phablet | 768 tablet | 1020 desktop
   ============================================================ */

/* ── Hamburger / nav toggle ───────────────────────────────── */

.nav-toggle {
  display: none;            /* desktop: hidden */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  height: 52px;
  margin-left: auto;        /* push to right of nav links */
  margin-right: 0.25rem;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.65);
  border-radius: 2px;
  transition: background 0.1s, transform 0.2s, opacity 0.15s;
}
.nav-toggle:hover span { background: var(--yellow); }

/* X when open */
.site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 767px) {
  .nav-toggle { display: flex; }
  .page-num   { display: none; }

  .site-header        { padding: 0 0.75rem; }
  .brand              { margin-right: 0.75rem; }
  .account .who       { display: none; }    /* username hidden; sign-out stays */

  /* Nav collapses into dropdown */
  .site-header nav {
    display: none;
    position: absolute;
    top: 55px;           /* header height + border */
    left: 0; right: 0;
    background: var(--chrome-lo);
    border-bottom: 3px solid var(--yellow);
    flex-direction: column;
    padding: 0.25rem 0;
    z-index: 199;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  }
  .site-header.nav-open nav { display: flex; }

  .site-header nav a {
    height: auto;
    padding: 0.85rem 1.5rem;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 0.82rem;
    justify-content: flex-start;
    width: 100%;
  }
  .site-header nav a:hover,
  .site-header nav a.nav-active {
    border-bottom-color: transparent;
    border-left-color: var(--yellow);
    background: rgba(255,255,255,0.04);
  }
}

/* ── Global mobile layout ─────────────────────────────────── */

@media (max-width: 767px) {
  main         { margin: 0.75rem auto; padding: 0 0.75rem; }
  .narrow      { max-width: 100%; }
  .ad-slot     { padding: 0.25rem 0.75rem; }
  .messages    { padding: 0 0.75rem; }
  .site-footer { margin-top: 1.5rem; padding: 0.75rem 0.75rem; }
}

/* ── Match cards (fixtures) ──────────────────────────────────
   Desktop (≥ 768px): horizontal table-row layout
   Mobile  (< 768px): stacked card-per-match layout
   ─────────────────────────────────────────────────────────── */

.match-list { display: flex; flex-direction: column; }
.match-card { border-bottom: 1px solid var(--bd); }
.match-card:last-child { border-bottom: none; }

/* Shared team-name + vs + kickoff atoms */
.mc-home,
.mc-away {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
  min-width: 0;
}
.mc-home { justify-content: flex-end; }
.mc-away { justify-content: flex-start; }
.mc-home .tn,
.mc-away .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.mc-vs {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--ink-4);
  flex-shrink: 0;
}

.mc-kickoff {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--ink-3);
  white-space: nowrap;
  flex-shrink: 0;
  padding-left: 0.65rem;
  border-left: 1px solid var(--bd);
  margin-left: 0.15rem;
}

.mc-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.mc-score .sep {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-3);
}

.mc-bonuses {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Bonus toggle chip */
.bonus-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bd);
  border-radius: var(--r);
  background: var(--card-dim);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s, background 0.12s;
}
.bonus-toggle .bl {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  pointer-events: none;
}
.bonus-toggle input[type="checkbox"] { margin: 0; cursor: pointer; accent-color: var(--yellow); }
.bonus-toggle.is-checked { border-color: var(--yellow); background: rgba(245,196,0,0.09); }
.bonus-toggle.is-checked .bl { color: var(--chrome); }
.bonus-toggle.is-disabled { opacity: 0.5; cursor: default; pointer-events: none; }

/* ---- DESKTOP ROW LAYOUT (≥ 768px) ---- */

/* Column-header strip above the match rows */
.match-list-header {
  display: flex;
  align-items: center;
  padding: 0.4rem 1.25rem;
  background: var(--card-dim);
  border-bottom: 2px solid var(--bd);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mlh-match  { flex: 1; }
.mlh-score  { width: 168px; text-align: center; flex-shrink: 0; }
.mlh-bonus  { width: 188px; text-align: center; flex-shrink: 0; }

/* Each match card is a full-width horizontal row */
.match-card {
  display: flex;
  align-items: stretch;
}
.match-card:hover .match-card-head,
.match-card:hover .match-card-body { background: rgba(0,196,196,0.04); }

.match-card-head {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1.25rem;
  background: var(--card);
  border-right: 1px solid var(--bd);
}
.match-card:nth-child(even) .match-card-head { background: var(--card-dim); }

.match-card-body {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
  background: var(--card);
  padding: 0;
  gap: 0;
}
.match-card:nth-child(even) .match-card-body { background: var(--card-dim); }

/* Score cell: fixed width, right-bordered */
.mc-score {
  width: 168px;
  align-self: stretch;
  border-right: 1px solid var(--bd);
  padding: 0 0.5rem;
}

/* Bonus cell: fixed width */
.mc-bonuses {
  width: 188px;
  padding: 0 0.5rem;
  gap: 0.4rem;
}

/* Compact chips for mouse users */
.bonus-toggle {
  min-width: 44px;
  min-height: 34px;
  padding: 0.15rem 0.3rem;
  gap: 0.1rem;
}
.bonus-toggle .bl { font-size: 0.55rem; }
.bonus-toggle input[type="checkbox"] { width: 14px; height: 14px; }

/* ---- MOBILE CARD LAYOUT (< 768px) ---- */

@media (max-width: 767px) {
  .match-list-header { display: none; }

  /* Cards are vertical blocks */
  .match-card { display: block; }

  .match-card-head {
    border-right: none;
    border-bottom: 1px solid var(--bd);
    background: var(--card-dim);
    padding: 0.5rem 0.75rem;
  }
  .match-card:nth-child(even) .match-card-head { background: var(--card-dim); }

  .match-card-body {
    flex-direction: column;
    align-items: center;
    background: var(--card);
    padding: 0.75rem 0.75rem;
    gap: 0.65rem;
  }
  .match-card:nth-child(even) .match-card-body { background: var(--card); }

  /* Reset fixed widths and borders set for desktop */
  .mc-score   { width: auto; align-self: auto; border-right: none; padding: 0; }
  .mc-bonuses { width: auto; padding: 0; gap: 0.5rem; }

  /* Fat-finger touch targets */
  .bonus-toggle {
    min-width: 52px;
    min-height: 52px;
    padding: 0.3rem 0.45rem;
    gap: 0.15rem;
  }
  .bonus-toggle .bl { font-size: 0.58rem; }
  .bonus-toggle input[type="checkbox"] { width: 18px; height: 18px; }

  .stepper-btn { width: 40px; font-size: 1.1rem; }
  input.score  { width: 44px; height: 40px; font-size: 1.1rem; }
}

/* ── Results table: horizontal scroll on mobile ───────────── */

.results-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 600px) {
  /* Drop the "Score" (core-pts) column — Total is what matters */
  table.results th:nth-child(4),
  table.results td:nth-child(4) { display: none; }
}

/* ── Standings: drop Played on very narrow phones ─────────── */

@media (max-width: 480px) {
  table.standings:not(.grid) th:nth-child(3),
  table.standings:not(.grid) td:nth-child(3) { display: none; }
}
