/* ============================================================
   Jeanfield Swifts — World Cup Score Bonanza
   Black / gold / white. Design language borrowed from the main
   Grassroots.Games build: paper cards, mono eyebrows, dashed
   "stitch" dividers, tabular scoreline numerals, rounded tables.
   ============================================================ */

:root {
  --ink:        #111113;
  --ink-2:      #1b1b1f;
  --ink-soft:   rgba(17,17,19,0.64);
  --ink-faint:  rgba(17,17,19,0.40);
  --gold:       #D7A93B;
  --gold-soft:  #F1D27A;
  --gold-deep:  #B0842A;
  --paper:      #ffffff;
  --bg:         #F7F4EC;
  --line:       rgba(17,17,19,0.12);
  --line-gold:  rgba(215,169,59,0.35);
  --chalk:      rgba(241,210,122,0.85);
  --chalk-20:   rgba(241,210,122,0.20);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --pill: 999px;

  --shadow-card: 0 4px 16px rgba(17,17,19,0.07);
  --shadow-hero: 0 24px 60px rgba(17,17,19,0.30);
  --shadow-gold: 0 14px 34px rgba(215,169,59,0.35);

  --font-display: 'Bricolage Grotesque', 'Fraunces', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
}

::selection { background: var(--gold); color: var(--ink); }

a { color: inherit; }

img { max-width: 100%; display: block; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

.stack > * + * { margin-top: 16px; }

/* ── Typography helpers ─────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  font-weight: 500;
}
.eyebrow-gold { color: var(--gold); }
.eyebrow-chalk { color: var(--chalk); }

.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 0.98;
  margin: 0;
}
.display-xl { font-size: clamp(40px, 7vw, 76px); }
.display-lg { font-size: clamp(30px, 5vw, 48px); }
.display-md { font-size: clamp(24px, 4vw, 32px); }
.italic-gold { font-style: italic; color: var(--gold); }

.scoreline {
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.lede { font-size: 18px; color: var(--ink-soft); max-width: 56ch; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }

/* ── Pills / chips ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--pill);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.pill-gold  { background: var(--gold); color: var(--ink); }
.pill-ink   { background: var(--ink); color: var(--gold-soft); }
.pill-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.pill-ghost-dark { background: transparent; color: var(--chalk); border: 1px solid var(--chalk-20); }
.pill-live { background: #d2342b; color: #fff; animation: livepulse 1.4s ease-in-out infinite; }
.pill-ft   { background: var(--ink); color: #fff; }
@keyframes livepulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
/* leaderboard live-refresh: smooth row movement + a brief highlight on change */
tr.lb-row { transition: transform .55s cubic-bezier(.22,.61,.36,1); }
tr.lb-bump { animation: lbbump 1.1s ease; }
@keyframes lbbump { 0% { background: rgba(215,169,59,0.34); } 100% { background: transparent; } }
.pill-live  { background: #18a558; color: #fff; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--pill); cursor: pointer;
  font-family: var(--font-sans); font-weight: 600; text-decoration: none;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-md { padding: 11px 22px; font-size: 14px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-gold  { background: var(--gold); color: var(--ink); box-shadow: var(--shadow-gold); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ink   { background: var(--ink); color: var(--gold-soft); }
.btn-ink:hover { background: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: rgba(17,17,19,0.05); }
.btn-ghost-dark { background: transparent; color: var(--chalk); border: 1px solid var(--chalk-20); }
.btn-ghost-dark:hover { background: var(--chalk-20); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.card-pad { padding: 22px; }
.card-ink {
  background: var(--ink); color: #fff;
  border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.06);
}
.card-gold-edge { border-top: 3px solid var(--gold); }

/* ── Stitched divider ───────────────────────────────────────── */
.stitch { border: 0; border-top: 1.5px dashed var(--line); margin: 22px 0; }
.stitch-dark { border: 0; border-top: 1.5px dashed var(--chalk-20); margin: 22px 0; }

/* ── Header / nav ───────────────────────────────────────────── */
.site-header {
  background: var(--ink); color: #fff;
  border-bottom: 2px solid var(--gold);
}
.nav {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0;
}
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.nav-brand img { width: 42px; height: 42px; border-radius: 8px; }
.nav-brand .club { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1; }
.nav-brand .sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-links a {
  text-decoration: none; color: rgba(255,255,255,0.82); font-size: 14px; font-weight: 500;
  padding: 7px 12px; border-radius: var(--pill);
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-links a.nav-admin { color: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.18); }
.nav-links a.nav-admin:hover { color: var(--ink); background: var(--gold); border-color: var(--gold); }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(215,169,59,0.22), transparent 60%),
    var(--ink);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: clamp(28px, 5vw, 56px);
  box-shadow: var(--shadow-hero);
  position: relative; overflow: hidden;
}
.hero .pill { margin-bottom: 18px; }
.hero h1 { color: #fff; }
.hero .lede { color: rgba(255,255,255,0.78); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* ── Stat / prize tiles ─────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; }
.tile .k { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); }
.tile .v { font-family: var(--font-display); font-weight: 700; font-size: 30px; margin-top: 6px; letter-spacing: -0.02em; }
.tile-gold { background: var(--gold); border-color: var(--gold-deep); }
.tile-gold .k, .tile-gold .v { color: var(--ink); }
.tile-ink { background: var(--ink); }
.tile-ink .k { color: var(--gold-soft); }
.tile-ink .v { color: #fff; }

/* ── Section heading ────────────────────────────────────────── */
.section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── "How it works" steps ───────────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.step { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 20px; }
.step .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--pill);
  background: var(--ink); color: var(--gold-soft);
  font-family: var(--font-display); font-weight: 700; font-size: 17px; margin-bottom: 12px;
}
.step h3 { margin: 0 0 6px; font-size: 16px; }
.step p { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* ── Fixtures list (predict form) ───────────────────────────── */
.day-head {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-soft); margin: 22px 0 10px;
}
.day-head::after { content: ""; flex: 1; border-top: 1.5px dashed var(--line); }

.fixture {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 10px 12px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 14px 16px;
}
.fixture.is-double { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.fixture + .fixture { margin-top: 8px; }
.fixture .team { font-weight: 600; font-size: 15px; }
.fixture .team.home { text-align: right; }
.fixture .team.away { text-align: left; }
/* time + venue, centred on its own row beneath the teams */
.fixture .fixture-meta {
  grid-column: 1 / -1; order: 99;
  text-align: center; font-family: var(--font-mono);
  font-size: 10px; color: var(--ink-faint); letter-spacing: 0.08em;
  margin-top: 2px; padding-top: 9px; border-top: 1px dashed var(--line);
}

/* country flags */
.flag {
  display: inline-block; width: 21px; height: 15px;
  border-radius: 2px; object-fit: cover; vertical-align: -2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.10); background: var(--line);
}
.fixture .team.home .flag { margin-left: 7px; }
.fixture .team.away .flag { margin-right: 7px; }
.fixture .vs { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }

/* score stepper inputs */
.score-pick { display: flex; align-items: center; justify-content: center; gap: 8px; }
.score-pick .sep { color: var(--ink-faint); font-weight: 700; }
.score-input {
  width: 52px; height: 48px; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink);
  -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(215,169,59,0.25); background: #fff; }

/* double-points toggle (per fixture) */
.dbl-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink-soft);
  border-radius: var(--pill); padding: 6px 12px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  white-space: nowrap; transition: all .12s ease;
}
.dbl-toggle:hover { border-color: var(--gold); color: var(--ink); }
.dbl-toggle .star { font-size: 13px; line-height: 1; }
.dbl-toggle.on {
  background: var(--gold); border-color: var(--gold-deep); color: var(--ink); box-shadow: var(--shadow-gold);
}
.dbl-toggle.locked { opacity: .4; cursor: not-allowed; }
.dbl-toggle.locked:hover { border-color: var(--line); color: var(--ink-soft); }

/* sticky counter while picking doubles */
.dbl-counter {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: #fff; border-radius: var(--radius-md);
  padding: 11px 16px; margin: 14px 0; box-shadow: var(--shadow-card);
}
.dbl-counter .label-txt { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold-soft); }
.dbl-counter .count { font-family: var(--font-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.dbl-counter.full .count { color: var(--gold-soft); }

/* "2×" badge used on confirmation + summaries */
.dbl-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gold); color: var(--ink); border-radius: var(--pill);
  padding: 2px 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
}

/* ── Forms ──────────────────────────────────────────────────── */
.label { display: block; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font-family: var(--font-sans); font-size: 15px;
}
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(215,169,59,0.2); }
.field + .field { margin-top: 14px; }
.help { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
/* fields inside a grid sit in their own column — cancel the stacked-field margin */
.grid-2 .field + .field { margin-top: 0; }
/* short inputs (e.g. phone) shouldn't stretch the full card width on desktop */
.field-narrow .input { max-width: 280px; }

/* ── Tables (leaderboard + admin) ───────────────────────────── */
.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-soft); font-weight: 600; padding: 13px 16px; background: rgba(17,17,19,0.03);
  border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: rgba(215,169,59,0.06); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.col-pts { font-family: var(--font-display); font-weight: 700; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }

/* rank badges */
.rank { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--pill); font-family: var(--font-display); font-weight: 700; font-size: 14px; background: rgba(17,17,19,0.06); }
tr.r1 .rank { background: var(--gold); color: var(--ink); }
tr.r2 .rank { background: #c9ccd1; color: var(--ink); }
tr.r3 .rank { background: #d9a16a; color: var(--ink); }
tr.r1 { background: linear-gradient(90deg, rgba(215,169,59,0.14), transparent 70%); }
tr.me { box-shadow: inset 3px 0 0 var(--gold); }

.prize-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-deep); }
.lb-standings { max-width: 720px; margin: 0 auto; }
.fixture-add-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.view-picks { display: inline-flex; vertical-align: middle; margin-left: 8px; color: var(--ink-faint); }
.view-picks:hover { color: var(--gold-deep); }
.view-picks svg { display: block; }
button.view-picks { background: none; border: 0; padding: 0; cursor: pointer; }
/* fixed popup shown when an eye is tapped before kickoff (escapes table overflow) */
.lock-pop {
  position: fixed; z-index: 60; max-width: 240px; text-align: center;
  background: var(--ink); color: #fff; font-family: var(--font-sans); font-weight: 500;
  font-size: 12px; line-height: 1.4; padding: 10px 13px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(17,17,19,0.28);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease; pointer-events: none;
}
.lock-pop.show { opacity: 1; visibility: visible; transform: translateY(0); }
/* per-game points on the predictions view */
.pk-exact { color: var(--gold-deep); }
.pk-miss  { color: var(--ink-faint); }

/* ── Bank details box ───────────────────────────────────────── */
.bank-box { background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 24px; }
.bank-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1.5px dashed var(--chalk-20); }
.bank-row:last-child { border-bottom: 0; }
.bank-row .k { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold-soft); }
.bank-row .v { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: #fff; letter-spacing: 0.02em; }
.ref-chip { display: inline-block; font-family: var(--font-mono); font-weight: 700; font-size: 22px; letter-spacing: 0.08em; color: var(--ink); background: var(--gold); padding: 8px 16px; border-radius: var(--radius-sm); }

/* ── Alerts / flash ─────────────────────────────────────────── */
.alert { border-radius: var(--radius-md); padding: 13px 16px; font-size: 14px; border: 1px solid; }
.alert + .alert { margin-top: 10px; }
.alert-ok    { background: #eafaf0; border-color: #bfe6cd; color: #1c6b3f; }
.alert-err   { background: #fdecec; border-color: #f3c2c2; color: #a32626; }
.alert-info  { background: #fff8e6; border-color: var(--line-gold); color: var(--gold-deep); }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer { margin-top: 64px; background: var(--ink); color: rgba(255,255,255,0.7); padding: 32px 0; border-top: 2px solid var(--gold); }
.site-footer a { color: var(--gold-soft); text-decoration: none; }
.site-footer .small { font-size: 12.5px; }

/* ── Admin specifics ────────────────────────────────────────── */
.admin-bar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom: 22px; }
.admin-bar .tabs { display:flex; gap:6px; flex-wrap:wrap; }
.admin-bar .tabs a { text-decoration:none; font-size:13px; font-weight:600; padding:8px 14px; border-radius:var(--pill); border:1px solid var(--line); color:var(--ink); }
.admin-bar .tabs a.active { background: var(--ink); color: var(--gold-soft); border-color: var(--ink); }
.inline-form { display:inline; }
.tiny-input { width:46px; padding:5px; text-align:center; border:1px solid var(--line); border-radius:6px; font-family:var(--font-mono); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .field-narrow .input { max-width: none; }
  /* responsive header: brand row, then centred links row */
  .nav { flex-wrap: wrap; justify-content: center; gap: 10px; }
  .nav-brand .club, .nav-brand .sub { white-space: nowrap; }
  .nav-links { margin-left: 0; width: 100%; justify-content: center; flex-wrap: wrap; gap: 6px; }
  .nav-links a { padding: 6px 10px; font-size: 13px; }
  /* keep the horizontal Home [score] Away layout on mobile — just compact it */
  .fixture { gap: 5px 6px; padding: 12px 8px; }
  .fixture .team { font-size: 13px; }
  .fixture .flag { width: 16px; height: 12px; }
  .fixture .team.home .flag { margin-left: 4px; }
  .fixture .team.away .flag { margin-right: 4px; }
  .score-pick { gap: 4px; }
  .score-input { width: 36px; height: 40px; font-size: 17px; }
  .hide-sm { display: none; }

  /* admin tables → stacked cards on mobile so the action buttons are never clipped */
  .tbl-stack thead { display: none; }
  .tbl-stack tbody tr { display: flex; flex-direction: column; gap: 7px; padding: 14px; }
  .tbl-stack tbody tr + tr { border-top: 1px solid var(--line); }
  .tbl-stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0; border: 0; text-align: right; font-size: 14px; }
  .tbl-stack td::before { content: attr(data-label); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
  .tbl-stack td.col-pts { font-size: 16px; }
  /* fixture name as the card title */
  .tbl-stack td[data-label="Fixture"] { order: -1; display: block; text-align: left; font-size: 15px; padding-bottom: 4px; }
  .tbl-stack td[data-label="Fixture"]::before { display: none; }
  /* actions: label on its own line, buttons below, full-size tap targets */
  .tbl-stack td[data-label="Actions"] { display: block; text-align: left; margin-top: 4px; }
  .tbl-stack td[data-label="Actions"]::before { display: block; margin-bottom: 6px; }
  .tbl-stack td[data-label="Actions"] .inline-form { display: inline-block; margin: 0 6px 6px 0; }
  .tbl-stack td .btn { min-height: 40px; }
  .tbl-stack td[data-label="Result"] { flex-wrap: wrap; }
  .fixture-add-form { grid-template-columns: 1fr; }
}
