/* ========================================================================
   World Cup Bench — "Matchday Programme" theme
   Warm newsprint, chalk pitch lines, jersey/poster type.
   ======================================================================== */

:root {
  --paper: #ece2cc;
  --paper-2: #f5eedd;
  --card: #fbf6ea;
  --ink: #1a1611;
  --ink-soft: #4f463a;
  --ink-faint: #8a7d68;
  --line: #d8cbac;
  --line-strong: #c2b48f;

  --pitch: #1f6b43;
  --pitch-dark: #134e30;
  --pitch-light: #2f8b57;
  --red: #c5402f;
  --gold: #c79433;
  --gold-bright: #e0ac3f;

  --shadow: 0 2px 0 var(--line-strong), 0 14px 30px -18px rgba(26, 22, 17, 0.5);

  --font-display: "Anton", "Archivo", sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --font-body: "Archivo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background-color: var(--paper);
  /* layered paper grain + warm vignette */
  background-image:
    radial-gradient(1100px 700px at 50% -180px, rgba(31, 107, 67, 0.16), transparent 70%),
    repeating-linear-gradient(0deg, rgba(26, 22, 17, 0.022) 0 2px, transparent 2px 4px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

.wrap {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 22px;
  position: relative;
  z-index: 1;
}

/* faint chalk pitch behind the page */
.pitch-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgba(31, 107, 67, 0.09);
  z-index: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- masthead */
.masthead {
  text-align: center;
  padding: 40px 0 30px;
  border-bottom: 4px double var(--ink);
  margin-bottom: 8px;
}
.masthead-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  padding-bottom: 22px;
}
.masthead-strip .dot {
  color: var(--red);
  font-size: 7px;
}
.masthead-strip .hosts {
  letter-spacing: normal;
  font-size: 14px;
}
.masthead-title {
  font-family: var(--font-display);
  margin: 0;
  line-height: 0.82;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.masthead-title .line1 {
  font-size: clamp(46px, 13vw, 130px);
  color: var(--ink);
}
.masthead-title .line2 {
  font-size: clamp(58px, 17vw, 170px);
  color: var(--pitch);
  position: relative;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--gold);
}
.masthead-title .ball {
  -webkit-text-stroke: 0;
  text-shadow: none;
  font-size: 0.42em;
  vertical-align: super;
  margin-left: 0.1em;
  animation: spin 9s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.masthead-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(15px, 2.4vw, 20px);
  color: var(--ink-soft);
  max-width: 600px;
  margin: 22px auto 0;
  line-height: 1.5;
}

/* ----------------------------------------------------------------- section */
.section {
  margin: 52px 0;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.section-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(26px, 5vw, 40px);
  margin: 0;
  letter-spacing: 0.01em;
  line-height: 1;
}
.section-head::after {
  content: "";
  flex: 1;
  height: 3px;
  background:
    linear-gradient(90deg, var(--ink) 0 60%, transparent 60%) 0 / 8px 100% repeat-x;
  opacity: 0.25;
}
.section-tag {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-2);
  background: var(--red);
  padding: 6px 12px;
  border-radius: 3px;
  white-space: nowrap;
  transform: rotate(-1.5deg);
}

/* --------------------------------------------------------------- standings */
.table-card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.standings-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--pitch);
  color: var(--paper-2);
  padding: 13px 20px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.01em;
}
.standings-banner .pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 0 0 var(--gold-bright);
  animation: pulse 2s infinite;
  flex: none;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(224, 172, 63, 0.6); }
  70% { box-shadow: 0 0 0 9px rgba(224, 172, 63, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 172, 63, 0); }
}

table.standings {
  width: 100%;
  border-collapse: collapse;
}
table.standings thead th {
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 14px 10px;
  border-bottom: 2px solid var(--line-strong);
  text-align: center;
}
table.standings thead th.col-club {
  text-align: left;
  padding-left: 20px;
}
table.standings tbody td {
  padding: 14px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
table.standings tbody tr:last-child td {
  border-bottom: none;
}
table.standings tbody tr:nth-child(even) {
  background: rgba(216, 203, 172, 0.18);
}
table.standings tbody tr.is-leader {
  background: linear-gradient(90deg, rgba(199, 148, 51, 0.18), rgba(199, 148, 51, 0.04));
}
.st-pos {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink-faint);
  width: 46px;
}
tr.is-leader .st-pos {
  color: var(--gold);
}
.st-club {
  text-align: left !important;
  padding-left: 20px !important;
}
.club-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}
.crest {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  box-shadow: inset 0 0 0 3px var(--card);
  position: relative;
}
.crest svg {
  width: 58%;
  height: 58%;
}
.club-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  text-align: left;
}
.club-name {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.01em;
}
.club-sub {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin-top: 2px;
}
.st-num {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-soft);
}
.st-pts {
  font-family: var(--font-display);
  font-size: 26px;
}
td.st-pts {
  background: rgba(26, 22, 17, 0.03);
}
.st-pending {
  color: var(--ink-faint);
}

/* ------------------------------------------------------------------- rules */
.rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.rule {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.rule::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--bar, var(--ink));
}
.rule-pts {
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 0.9;
  color: var(--bar, var(--ink));
}
.rule-pts small {
  font-size: 17px;
  color: var(--ink-faint);
  margin-left: 4px;
}
.rule-name {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 21px;
  margin: 10px 0 6px;
}
.rule-desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- fixtures */
.matchday-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-2);
  background: var(--ink);
  padding: 8px 16px;
  border-radius: 3px;
  margin-bottom: 18px;
}
.matchday-label .md-count {
  color: var(--gold-bright);
}

.fixture {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  overflow: hidden;
}

/* scoreboard header */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 22px 24px;
  background:
    linear-gradient(180deg, var(--pitch) 0%, var(--pitch-dark) 100%);
  color: var(--paper-2);
  position: relative;
}
.scoreboard::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 30px);
  pointer-events: none;
}
.sb-team {
  font-family: var(--font-display);
  font-size: clamp(18px, 3.6vw, 30px);
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: 0.01em;
}
.sb-team.home {
  text-align: right;
}
.sb-team.away {
  text-align: left;
}
.sb-center {
  text-align: center;
  z-index: 1;
}
.sb-score {
  font-family: var(--font-display);
  font-size: clamp(28px, 7vw, 46px);
  line-height: 0.9;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 6px;
  padding: 4px 14px;
  display: inline-block;
  min-width: 92px;
  color: #fff;
}
.sb-score.pending {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  padding: 9px 14px;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.22);
}
.sb-vs {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  opacity: 0.8;
}
.sb-status {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}
.sb-status.final {
  color: var(--gold-bright);
}

/* predictions table inside fixture */
.preds-head,
.pred-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) 1.1fr 96px 130px 56px;
  align-items: center;
  gap: 14px;
  padding: 13px 24px;
}
.preds-head {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  border-bottom: 2px solid var(--line-strong);
  background: var(--paper-2);
}
.preds-head .ph-right {
  text-align: center;
}
.pred-row {
  border-bottom: 1px solid var(--line);
  border-left: 5px solid var(--c, var(--ink));
}
.pred-row:last-child {
  border-bottom: none;
}
.pred-row:nth-child(even) {
  background: rgba(216, 203, 172, 0.16);
}

.pred-club {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.pred-club .crest {
  width: 36px;
  height: 36px;
}
.pred-club .crest svg {
  width: 56%;
  height: 56%;
}
.pred-club-name {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1;
}
.pred-club-sub {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin-top: 2px;
}
.pred-call {
  font-weight: 600;
  font-size: 14.5px;
}
.pred-call .reason {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.35;
}
.pred-score-chip {
  font-family: var(--font-display);
  font-size: 22px;
  text-align: center;
  background: var(--ink);
  color: var(--paper-2);
  border-radius: 5px;
  padding: 5px 4px;
  letter-spacing: 0.04em;
}
.pred-score-chip.right {
  background: var(--pitch);
}
.pred-score-chip.wrong {
  background: var(--ink-faint);
}

/* confidence pips */
.conf {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conf-pips {
  display: flex;
  gap: 2px;
}
.conf-pips i {
  flex: 1;
  height: 8px;
  border-radius: 1px;
  background: var(--line-strong);
}
.conf-pips i.on {
  background: var(--c, var(--ink));
}
.conf-label {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}

.pts-chip {
  font-family: var(--font-display);
  font-size: 22px;
  text-align: center;
  border-radius: 6px;
  padding: 7px 0;
  border: 2px solid var(--ink);
}
.pts-3 { background: var(--pitch); color: #fff; border-color: var(--pitch-dark); }
.pts-1 { background: var(--gold); color: var(--ink); border-color: #a87c22; }
.pts-0 { background: transparent; color: var(--ink-faint); border-style: dashed; }
.pts-pending {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink-faint);
  border-color: var(--line-strong);
  border-style: dashed;
}

.pred-missing {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 13px;
}

/* ------------------------------------------------------------------ footer */
.footer {
  text-align: center;
  padding: 40px 22px 60px;
  border-top: 4px double var(--ink);
  margin-top: 40px;
}
.footer-crest {
  font-size: 26px;
}
.footer p {
  margin: 8px 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.footer-note {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-faint) !important;
  letter-spacing: 0 !important;
}

/* ----------------------------------------------------------- reveal motion */
.section,
.fixture {
  animation: rise 0.6s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 720px) {
  .preds-head {
    display: none;
  }
  .pred-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "club pts"
      "call call"
      "score conf";
    gap: 10px 14px;
    padding: 16px 18px;
  }
  .pred-club { grid-area: club; }
  .pred-call { grid-area: call; }
  .pred-score-chip { grid-area: score; justify-self: start; min-width: 84px; }
  .conf { grid-area: conf; justify-self: end; min-width: 120px; }
  .pts-chip, .pts-pending { grid-area: pts; min-width: 54px; align-self: start; }
  .rules {
    grid-template-columns: 1fr;
  }
  .standings-scroll {
    overflow-x: auto;
  }
  table.standings {
    min-width: 540px;
  }
  .scoreboard {
    padding: 18px 16px;
  }
}
