/* ============ Quiniela Liguilla MX — retro cálido ============ */
:root {
  --cream: #F1E7D0;
  --cream-2: #E8DBBC;
  --paper: #FAF3E1;
  --ink: #1A1410;
  --ink-soft: #3D332A;
  --mute: #8B7B66;
  --line: #1A1410;
  --terra: #D64A1A;          /* naranja estadio / energia */
  --terra-dk: #9E3410;
  --ocre: #F2C230;           /* dorado trofeo */
  --olive: #0F6B3C;          /* verde cancha */
  --blue: #104E3C;           /* verde oscuro principal */
  --blue-dk: #0A382B;

  --bg: var(--cream);
  --fg: var(--ink);
  --card: var(--paper);
  --rule: var(--ink);

  --f-display: 'Nunito Sans', system-ui, sans-serif;
  --f-body: 'Nunito Sans', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #14100C;
  --fg: #F1E7D0;
  --card: #1F1915;
  --cream-2: #2A2320;
  --rule: #F1E7D0;
  --ink: #F1E7D0;
  --ink-soft: #CBB994;
  --mute: #8B7B66;
  --paper: #1F1915;
  --cream: #14100C;
}

* { box-sizing: border-box; }

[x-cloak] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

/* Noise / grain overlay for retro print feel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.04; }

h1, h2, h3, .display {
  font-family: var(--f-display);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 0.96;
  margin: 0;
  text-transform: uppercase;
}

.mono { font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; color: inherit; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------- Chrome / header ------------- */
.chrome {
  border-bottom: 2px solid var(--rule);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg);
  position: relative;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-title { font-family: var(--f-display); font-weight: 900; font-size: 20px; line-height: 1; text-transform: uppercase; letter-spacing: 0; }
.brand-sub { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; color: var(--blue); }

.chrome-right { display: flex; align-items: center; gap: 16px; }
.screen-switcher {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.screen-switcher a,
.screen-switcher button {
  min-height: auto;
}
.screen-switcher a,
.screen-switcher button {
  padding: 4px 0;
  color: var(--fg);
  border: none;
  opacity: 0.62;
  position: relative;
  transition: opacity 0.16s ease, color 0.16s ease;
}
.screen-switcher a:hover,
.screen-switcher button:hover,
.screen-switcher a.active,
.screen-switcher button.active {
  opacity: 1;
  color: var(--fg);
}
.screen-switcher a.active::after,
.screen-switcher button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--terra);
}

.site-footer {
  margin-top: 0;
  border-top: 2px solid var(--rule);
  background: color-mix(in srgb, var(--card) 88%, var(--cream));
  padding: 20px 24px 24px;
  text-align: center;
}
.footer-link {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
  opacity: 0.75;
  border-bottom: 1px solid transparent;
  transition: opacity 0.16s ease, border-color 0.16s ease;
}
.footer-link:hover {
  opacity: 1;
  border-color: currentColor;
}

/* ------------- Screens ------------- */
.screen { display: none; flex: 1; }
.screen.active { display: block; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.container-sm {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.legal-page {
  padding-top: 18px;
}
.legal-head {
  margin-bottom: 28px;
}
.legal-head h2 {
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.94;
  margin-top: 8px;
}
.legal-head h2 em {
  color: var(--blue);
  font-style: normal;
}
.legal-page .lede {
  margin-top: 14px;
  max-width: 720px;
  color: var(--ink-soft);
}
.legal-card {
  border: 2px solid var(--rule);
  background: var(--card);
  padding: 28px;
  box-shadow: 8px 8px 0 var(--rule);
  display: grid;
  gap: 22px;
}
.legal-block h3 {
  margin: 0 0 10px;
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
}
.legal-block p {
  margin: 0 0 10px;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* ------------- SCREEN 1 : Form ------------- */
.form-hero {
  display: grid;
  grid-template-columns: minmax(0, 50%) minmax(0, 50%);
  gap: 48px;
  align-items: start;
}
@media (max-width: 820px) { .form-hero { grid-template-columns: 1fr; gap: 28px; } }

.hero-side,
.ticket {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.hero-side .kicker {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--blue);
}
.hero-side h1 {
  font-size: clamp(48px, 7vw, 88px);
  margin-top: 14px;
  line-height: 0.92;
  font-weight: 900;
}
.hero-side h1 em {
  font-style: normal;
  color: var(--blue);
  -webkit-text-stroke: 0;
}
.hero-side h1 em.red {
  color: var(--terra);
}
.hero-side .lede {
  margin-top: 20px;
  max-width: 100%;
  font-size: 15px;
  color: var(--ink-soft);
}
.hero-meta {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.hero-meta .cell .label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; color: var(--mute); }
.hero-meta .cell .val { font-family: var(--f-display); font-weight: 900; font-size: 32px; margin-top: 2px; }

/* Ticket-style form card */
.ticket {
  background: var(--card);
  border: 2px solid var(--rule);
  padding: 28px 28px 24px;
  position: relative;
  box-shadow: 8px 8px 0 var(--rule);
}
[data-theme="dark"] .ticket { box-shadow: 8px 8px 0 var(--blue); }
.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  background: var(--bg);
  border: 2px solid var(--rule);
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}
.ticket::before { left: -11px; }
.ticket::after { right: -11px; }

.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.ticket-head .t-title { font-family: var(--f-display); font-weight: 900; font-size: 32px; text-transform: uppercase; letter-spacing: -0.01em; }
.ticket-head .t-num { font-family: var(--f-mono); font-size: 11px; color: var(--mute); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.field input {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--rule);
  background: transparent;
  padding: 10px 2px;
  font-size: 17px;
  outline: none;
  border-radius: 0;
}
.field input:focus {
  border-bottom-color: var(--blue);
}
.field.invalid input { border-bottom-color: var(--terra-dk); }
.field .err { font-family: var(--f-mono); font-size: 10px; color: var(--terra-dk); margin-top: 4px; display: none; }
.field.invalid .err { display: block; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.folio-wrap { position: relative; }
.folio-wrap .folio-tag {
  position: absolute;
  top: 0; right: 0;
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--paper);
  background: var(--blue);
  letter-spacing: 0.14em;
  border: 1px solid var(--blue);
  padding: 2px 6px;
  border-radius: 3px;
}

.folio-help-toggle {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 0 0;
  border-top: 1px dashed color-mix(in srgb, var(--rule) 55%, transparent);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  text-align: left;
}

.folio-help-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--blue);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.folio-help {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1.5px dashed var(--rule);
  background: color-mix(in srgb, var(--cream-2) 55%, var(--paper));
}

.folio-help-copy strong {
  display: block;
  margin: 4px 0 6px;
  font-family: var(--f-display);
  font-size: 18px;
  line-height: 1.05;
  text-transform: uppercase;
}

.folio-help-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.folio-help-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1.5px solid var(--rule);
  background: #fff;
}

.folio-help.is-hidden {
  display: none;
}

.ticket-foot {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.disclaimer {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--mute);
  max-width: 220px;
  line-height: 1.5;
}

/* Primary button */
.btn { background: var(--blue); color: var(--paper); border-color: var(--blue); }
.btn.dark {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border-style: solid;
  border-width: 2px;
  transition: transform 0.12s, background 0.12s;
}
.btn:hover { transform: translate(-2px, -2px); }
.btn:active { transform: translate(0, 0); }
.btn.primary { background: var(--terra); border-color: var(--terra); color: var(--paper); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--rule); }
.btn .arrow { transition: transform 0.12s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ------------- SCREEN 2 : Matches ------------- */
.matches-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 18px;
  margin-bottom: 26px;
}
.matches-head h2 { font-size: clamp(36px, 5vw, 60px); }
.matches-head h2 em { color: var(--blue); font-style: normal; }
.matches-head .kicker-blue { color: var(--blue); }
.matches-head .sub { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--mute); margin-top: 6px; }

.progress-card {
  min-width: 0;
  width: 100%;
  max-width: 320px;
  border: 2px solid var(--rule);
  padding: 14px 16px;
  background: var(--card);
  justify-self: end;
}
.progress-top {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.progress-big {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 40px;
  line-height: 1;
  margin: 6px 0 10px;
}
.progress-big span.total { color: var(--mute); font-size: 24px; }
.progress-bar {
  height: 6px;
  background: var(--cream-2);
  border: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  background: var(--terra);
  transition: width 0.3s ease;
}

/* Group tabs */
.group-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 24px;
  padding-bottom: 0;
  scrollbar-width: none;
}
.group-tabs::-webkit-scrollbar { display: none; }
.group-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 18px 12px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 4px solid transparent;
  margin-bottom: -2px;
  flex-shrink: 0;
  color: var(--ink-soft);
  position: relative;
}
.group-tab .gm { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em; color: var(--mute); line-height: 1; margin-top: 3px; }
.group-tab.active { color: var(--fg); border-bottom-color: var(--blue); }
.group-tab.complete::after {
  content: "✓";
  position: absolute;
  top: 6px; right: 8px;
  font-size: 10px;
  color: var(--olive);
  font-family: var(--f-body);
}

/* Match list */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) { .match-grid { grid-template-columns: 1fr; } }

.match {
  border: 2px solid var(--rule);
  background: var(--card);
  padding: 18px 18px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}
.match.filled { border-color: var(--olive); }
.match.filled::before {
  content: "PRONOSTICADO";
  position: absolute;
  top: -9px; left: 14px;
  background: var(--olive);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 2px 8px;
}

.match-meta {
  position: absolute;
  top: -9px;
  right: 14px;
  background: var(--card);
  padding: 0 8px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--mute);
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.team.right { order: 0; }
.flag {
  width: 44px; height: 30px;
  border-radius: 3px;
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), inset 0 0 0 1px rgba(255,255,255,0.12);
  background-color: var(--cream-2);
  background-size: cover !important;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
  overflow: hidden;
}
.flag-lg {
  width: 88px;
  height: 60px;
  border-radius: 4px;
}
.flag-sm {
  width: 36px;
  height: 24px;
  border-radius: 2px;
}
.team-name { font-family: var(--f-display); font-weight: 700; font-size: 14px; letter-spacing: 0.02em; text-transform: uppercase; }

.score-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.step-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--cream-2);
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-size: 18px;
  color: var(--ink-soft);
  transition: background 0.1s, transform 0.1s;
  user-select: none;
}
.step-btn:hover { background: var(--ocre); color: var(--ink); }
.step-btn:active { transform: scale(0.9); }
.step-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.score-val {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-size: 22px;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  /* input reset */
  border: 2px solid transparent;
  padding: 0;
  margin: 0;
  text-align: center;
  font-weight: 700;
  line-height: 1;
  appearance: none;
  -moz-appearance: textfield;
  cursor: text;
  caret-color: var(--ocre);
}
.score-val::-webkit-outer-spin-button,
.score-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-val::placeholder { color: color-mix(in oklab, var(--cream) 55%, transparent); }
.score-stepper.empty .score-val {
  background: var(--cream-2);
  color: var(--mute);
}
.score-val:hover {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ocre) 35%, transparent);
}
.score-val:focus {
  outline: none;
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ocre);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--ocre) 45%, transparent);
  transform: scale(1.08);
}
.score-stepper.editing .score-val::placeholder { color: var(--mute); }
.match.filled .score-val { background: var(--olive); }
[data-theme="dark"] .score-val { background: var(--cream); color: var(--ink); }
[data-theme="dark"] .match.filled .score-val { background: var(--olive); color: var(--paper); }

.team-stepper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Outcome tags — show GANADOR / EMPATE / PERDEDOR under each team's score */
.outcome-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.14em;
  padding: 4px 9px 3px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  min-height: 20px;
  transition: transform .18s ease, opacity .18s ease;
  transform-origin: center;
}
.outcome-tag.placeholder {
  color: var(--mute);
  border-color: var(--rule);
  border-style: dashed;
  background: transparent;
  font-size: 11px;
  letter-spacing: 0;
  padding: 3px 9px;
  opacity: 0.55;
}
.outcome-tag.winner {
  background: #1E6B3A;
  color: #FFFFFF !important;
  border-color: #1E6B3A;
  font-weight: 900;
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
  text-shadow: 0 1px 0 rgba(0,0,0,0.18);
}
.outcome-tag.draw {
  color: #FFFFFF !important;
  background: #C7452F;
  border-color: #C7452F;
}
.outcome-tag.loser {
  color: #FFFFFF !important;
  background: color-mix(in oklab, var(--mute) 80%, var(--ink));
  border-color: transparent;
  opacity: 1;
}
.outcome-tag.winner::before {
  content: '★';
  margin-right: 5px;
  font-size: 10px;
  transform: translateY(-0.5px);
}
.outcome-tag.loser {
  background: color-mix(in oklab, var(--mute) 80%, var(--ink));
  color: #FFFFFF !important;
  border-color: transparent;
}
.outcome-tag.draw {
  background: var(--terra);
  color: #FFFFFF !important;
  border-color: var(--terra);
}
.outcome-tag.animate.winner,
.outcome-tag.animate.draw,
.outcome-tag.animate.loser {
  animation: tagPop .24s ease-out;
}
.outcome-tag.draw::before {
  content: '=';
  margin-right: 5px;
  font-weight: 900;
}
@keyframes tagPop {
  from { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  to   { transform: scale(1); opacity: 1; }
}

/* Tint the whole team stack by outcome for extra legibility */
.team-stepper .outcome-tag { margin-top: 2px; }

.match.out-home .team-stepper:first-of-type .team-name,
.match.out-away .team-stepper:last-of-type .team-name {
  color: var(--olive);
}
.match.out-home .team-stepper:last-of-type,
.match.out-away .team-stepper:first-of-type {
  opacity: 0.72;
}
.match.out-draw .team-name { color: color-mix(in oklab, var(--ocre) 70%, var(--ink)); }

/* LIST layout — inline outcome + winning-row emphasis */
.match-row .outcome-tag {
  font-size: 10px;
  padding: 3px 8px 2px;
  min-height: 18px;
  letter-spacing: 0.12em;
}
.match-row .row-team {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 3px;
  align-items: center;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  justify-self: center;
}

.match-row .row-team .team-mark {
  grid-row: 1;
  grid-column: 1;
  align-self: start;
  margin-top: 1px;
}

.match-row .row-team .flag-sm {
  grid-row: 1;
  grid-column: 1;
  align-self: start;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  width: auto;
  min-width: 0;
  height: auto;
  border-radius: 0;
  font-size: 30px;
  line-height: 1;
  margin-top: 1px;
}

.match-row .row-team .team-logo.flag-sm {
  width: 38px;
  height: 38px;
  margin-top: 0;
}

.match-row .row-team .team-badge-fallback.flag-sm {
  width: 36px;
  height: 36px;
  font-size: 10px;
}
.match-row .row-team .team-name-inline {
  grid-row: 1;
  grid-column: 2;
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-top: 1px;
  justify-self: start;
  text-align: left;
}
.match-row .row-team .outcome-tag { grid-row: 2; grid-column: 1 / span 2; justify-self: center; }
.match-row .row-team.right {
  grid-template-columns: auto auto;
}
.match-row .row-team.right .flag-sm { grid-column: 1; }
.match-row .row-team.right .team-name-inline { grid-column: 2; text-align: left; justify-self: start; }
.match-row .row-team.right .outcome-tag { grid-column: 1 / span 2; justify-self: center; }
.match-row .row-team.is-winner .team-name-inline { color: var(--olive); font-weight: 800; }
.match-row .row-team.is-loser  { opacity: 0.62; }
.match-row .row-team.is-loser .team-name-inline { text-decoration: line-through; text-decoration-color: color-mix(in oklab, var(--terra) 55%, transparent); text-decoration-thickness: 1.5px; }
.match-row .row-team.is-draw .team-name-inline { color: color-mix(in oklab, var(--ocre) 70%, var(--ink)); }
.match-row.out-draw { background: color-mix(in oklab, var(--ocre) 10%, var(--card)); }


.vs {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 2px solid var(--rule);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.08em;
  align-self: center;
  justify-self: center;
  padding: 0;
  line-height: 1;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 35%, transparent);
  z-index: 1;
}

/* Variation B — single-row condensed list */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.match-row {
  border: 2px solid var(--rule);
  background: var(--card);
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 108px minmax(180px, 1fr) auto minmax(180px, 1fr);
  gap: 18px;
  align-items: center;
  min-width: 720px;
}
.match-row.filled {
  border-color: var(--olive);
}
.match-row.pending-entry:not(.filled) {
  border-color: color-mix(in oklab, var(--terra) 45%, var(--rule));
  background: color-mix(in oklab, var(--terra) 7%, var(--card));
}
.match-row .row-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--mute);
  text-transform: uppercase;
}
.match-row .row-meta strong {
  font-family: var(--f-display);
  font-size: 12px;
  line-height: 1.1;
  letter-spacing: 0.06em;
  color: var(--fg);
}
.match-row .flag-sm {
  width: 36px; height: 24px;
  border-radius: 2px;
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
}
.match-row .row-score {
  display: flex;
  align-items: center;
  gap: 6px;
}
.match-row .row-score .score-stepper {
  gap: 5px;
}
.match-row .row-score .score-val {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex: 0 0 36px;
  aspect-ratio: 1 / 1;
  font-size: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.match-row .row-score .step-btn {
  width: 28px;
  height: 28px;
  font-size: 16px;
}
.match-row .row-score .vs {
  width: 34px;
  height: 34px;
  min-width: 34px;
  font-size: 10px;
  background: var(--blue);
  color: var(--paper);
  border-color: var(--blue);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--blue) 38%, transparent);
}

/* Variation C — stadium card (big focus) */
.stadium-card {
  border: 2px solid var(--rule);
  background: var(--card);
  padding: 36px 28px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.stadium-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(199,69,47,0.08), transparent 60%);
  pointer-events: none;
}
[data-theme="dark"] .stadium-card::before { background: radial-gradient(ellipse at top, rgba(217,154,43,0.12), transparent 60%); }
.stadium-top {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--mute);
  margin-bottom: 22px;
}
.stadium-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 28px;
  align-items: center;
}
.stadium-team { text-align: center; }
.stadium-team .flag-lg {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 2.5px solid var(--rule);
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-size: 30px;
  background: var(--cream-2);
  margin: 0 auto 12px;
}
.stadium-team .tn { font-family: var(--f-display); font-weight: 900; font-size: 24px; text-transform: uppercase; }
.stadium-team .steppers {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}
.stadium-team .big-score {
  display: inline-grid;
  place-items: center;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--f-display);
  font-size: 48px;
  line-height: 1;
}
[data-theme="dark"] .stadium-team .big-score { background: var(--cream); color: var(--ink); }
.stadium-vs {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 40px;
  color: var(--blue);
}
.stadium-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  border-top: 1.5px dashed var(--rule);
  padding-top: 18px;
}
.stadium-nav .nav-btn {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  padding: 8px 16px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
}
.stadium-nav .nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.stadium-dots { display: flex; gap: 5px; }
.stadium-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cream-2);
  border: 1px solid var(--rule);
}
.stadium-dots span.done { background: var(--olive); border-color: var(--olive); }
.stadium-dots span.cur { background: var(--blue); border-color: var(--blue); transform: scale(1.4); }

/* Footer CTA bar */
.cta-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 2px solid var(--rule);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  z-index: 20;
}
.cta-bar .left { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--ink-soft); }
.cta-bar .left strong { color: var(--fg); font-family: var(--f-display); font-weight: 900; font-size: 20px; letter-spacing: 0; }

/* ------------- SCREEN 3 : Thanks ------------- */
.thanks {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 40px 24px;
  overflow-x: hidden;
}
.thanks > div { max-width: 720px; width: 100%; }
.thanks .star-ticker { width: 100%; }
.thanks-card {
  max-width: 640px;
  width: 100%;
  border: 2px solid var(--rule);
  background: var(--card);
  padding: 44px 40px 36px;
  position: relative;
  box-shadow: 10px 10px 0 var(--rule);
}
[data-theme="dark"] .thanks-card { box-shadow: 10px 10px 0 var(--blue); }
.thanks-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--rule);
  pointer-events: none;
}
.thanks-stamp {
  position: absolute;
  top: -18px; right: 24px;
  background: var(--terra);
  color: var(--paper);
  padding: 6px 14px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  transform: rotate(3deg);
  border: 2px solid var(--ink);
}
.thanks-card h2 {
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.94;
  margin-top: 6px;
}
.thanks-card .lede { margin-top: 14px; font-size: 16px; color: var(--ink-soft); max-width: 480px; }
.thanks-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1.5px dashed var(--rule);
}
.thanks-meta .label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; color: var(--mute); }
.thanks-meta .val { font-family: var(--f-display); font-weight: 800; font-size: 20px; margin-top: 2px; text-transform: uppercase; }
.thanks-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

.countdown-strip {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 640px;
  width: 100%;
}
.cd-cell {
  border: 2px solid var(--rule);
  padding: 14px 10px;
  text-align: center;
  background: var(--card);
}
.cd-cell .num { font-family: var(--f-display); font-weight: 900; font-size: 44px; line-height: 1; }
.cd-cell .lab { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em; color: var(--mute); margin-top: 4px; }

/* ------------- SCREEN 4 : Ranking (cards stack) ------------- */
.rank-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 18px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
}
.rank-head h2 { font-size: clamp(44px, 6vw, 72px); }
.rank-head h2 em { color: var(--blue); font-style: normal; }
.rank-head .sub { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--mute); margin-top: 8px; }
.rank-live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--terra);
}
.rank-live .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--terra);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Podium */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 14px;
  align-items: end;
  margin-bottom: 36px;
}
@media (max-width: 720px) { .podium { grid-template-columns: 1fr; align-items: stretch; } }
.podium-card {
  border: 2px solid var(--rule);
  background: var(--card);
  padding: 22px 18px;
  text-align: center;
  position: relative;
}
.podium-card.p1 { background: var(--terra); color: var(--paper); }
.podium-card.p1 .place, .podium-card.p1 .nm { color: var(--paper); }
.podium-card.p1 .avatar { background: var(--paper); border-color: var(--paper); color: var(--terra-dk); }
.podium-card.p1 .pts { color: rgba(255,255,255,0.85); }
.podium-card.p1 .crown { background: var(--ocre); color: var(--ink); border-color: var(--ink); }
.podium-card.p2 { background: var(--blue); color: var(--paper); }
.podium-card.p2 .place, .podium-card.p2 .nm { color: var(--paper); }
.podium-card.p2 .avatar { background: var(--paper); border-color: var(--paper); color: var(--blue-dk); }
.podium-card.p2 .pts { color: rgba(255,255,255,0.85); }
.podium-card.p3 { background: var(--card); }
[data-theme="dark"] .podium-card.p1 { background: var(--ocre); color: var(--ink); }
[data-theme="dark"] .podium-card.p2 { background: var(--cream-2); color: var(--ink); }

.podium-card .place {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 72px;
  line-height: 0.86;
  color: var(--ink);
}
.podium-card.p1 .place { font-size: 96px; }
.podium-card .avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  margin: 10px auto 8px;
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
}
.podium-card .nm { font-family: var(--f-display); font-weight: 800; font-size: 16px; color: var(--ink); margin-top: 4px; letter-spacing: 0; text-transform: uppercase; }
.podium-card .pts { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--ink-soft); margin-top: 6px; }
.podium-card .pts b { font-family: var(--f-display); font-weight: 900; font-size: 18px; letter-spacing: 0; }
.podium-card .podium-stats,
.podium-card .podium-meta {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-top: 6px;
}
.podium-card .podium-stats { color: var(--ink-soft); }
.podium-card .podium-meta { color: var(--mute); }
.rank-progress {
  width: 100%;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  overflow: hidden;
}
.rank-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--terra), var(--blue));
}
.rank-progress-bar.is-low {
  background: linear-gradient(90deg, #c84b31, #e27d60);
}
.rank-progress-bar.is-mid {
  background: linear-gradient(90deg, #d9a404, #f0c34a);
}
.rank-progress-bar.is-high {
  background: linear-gradient(90deg, #2d8f5b, #5ecb89);
}
.rank-progress-label {
  margin-top: 6px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--mute);
}
.podium-card .crown {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--terra);
  color: var(--paper);
  padding: 4px 12px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  border: 2px solid var(--ink);
}

/* Rank list (cards) */
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  border: 1.5px solid var(--rule);
  background: var(--card);
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 48px auto 1fr auto auto;
  gap: 16px;
  align-items: center;
  transition: background 0.15s, transform 0.15s;
}
.rank-row:hover { background: var(--cream-2); transform: translateX(3px); }
.rank-row.me { border-width: 2.5px; border-color: var(--terra); background: color-mix(in srgb, var(--terra) 8%, var(--card)); }
.rank-row.me::before {
  content: "TÚ";
  position: absolute;
  /* inline badge handled elsewhere */
}
.rank-pos {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 22px;
  color: var(--ink-soft);
  line-height: 1;
}
.rank-row.me .rank-pos { color: var(--terra); }
.rank-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--cream-2);
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-size: 16px;
  color: var(--ink);
  border: 1.5px solid var(--rule);
}
.rank-name { font-family: var(--f-display); font-weight: 700; font-size: 15px; letter-spacing: 0; text-transform: uppercase; }
.rank-name-block {
  min-width: 0;
}
.rank-meta {
  margin-top: 4px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--mute);
}
.rank-name-block .rank-progress {
  max-width: 220px;
}
.rank-name .you-badge {
  display: inline-block;
  background: var(--terra);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: middle;
}
.rank-acc {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--mute);
}
.rank-acc b {
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--fg);
  letter-spacing: 0;
  margin-right: 4px;
}
.rank-pts {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 24px;
  color: var(--fg);
  line-height: 1;
}
.rank-pts .u { font-family: var(--f-mono); font-size: 10px; color: var(--mute); letter-spacing: 0.16em; margin-left: 4px; }

.rank-row .trend {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 3px;
}
.trend.up { color: var(--olive); border-color: var(--olive); }
.trend.down { color: var(--terra-dk); border-color: var(--terra-dk); }
.trend.flat { color: var(--mute); border-color: var(--mute); }

/* ------------- Tweaks panel ------------- */
.tweaks-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 260px;
  background: var(--card);
  border: 2px solid var(--rule);
  padding: 16px;
  z-index: 200;
  box-shadow: 6px 6px 0 var(--rule);
  font-family: var(--f-body);
  display: none;
}
.tweaks-panel.open { display: block; }
.tweaks-panel h4 {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 16px;
  text-transform: uppercase;
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tweaks-panel h4 button {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.1em;
}
.tweak-row { margin-bottom: 14px; }
.tweak-row .lab { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--mute); margin-bottom: 6px; }
.seg {
  display: flex;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
}
.seg button {
  flex: 1;
  padding: 7px 6px;
  color: var(--fg);
  border-right: 1px solid var(--rule);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--ink); color: var(--cream); }
[data-theme="dark"] .seg button.active { background: var(--cream); color: var(--ink); }

/* ============ Liguilla decorations ============ */
.stitch {
  position: relative;
}
.stitch::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed rgba(0,0,0,0.25);
  pointer-events: none;
  border-radius: inherit;
}

/* Soccer ball decoration */
.ball {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 3px #fff;
}
.ball::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  background: var(--ink);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.ball::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 20% 20%, var(--ink) 0 4px, transparent 5px),
    radial-gradient(circle at 80% 20%, var(--ink) 0 4px, transparent 5px),
    radial-gradient(circle at 20% 80%, var(--ink) 0 4px, transparent 5px),
    radial-gradient(circle at 80% 80%, var(--ink) 0 4px, transparent 5px);
  pointer-events: none;
}

/* Country banner strip — DEPRECATED (kept for compat) */
.banner-strip { display: none; }

/* Progress Stepper — shows user where they are in the 2-step flow */
.prog-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 22px 0 32px;
  padding: 10px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  position: relative;
}
.prog-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  flex: 1 1 0;
  min-width: 0;
}
.prog-step .prog-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--paper);
  color: var(--ink);
  transition: background .2s, color .2s, transform .2s;
  flex-shrink: 0;
}
.prog-step.pending .prog-dot {
  background: var(--paper);
  color: var(--mute);
  border-color: var(--rule);
  border-style: dashed;
}
.prog-step.current .prog-dot {
  background: var(--blue);
  color: var(--paper);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--blue) 22%, transparent);
}
.prog-step.done .prog-dot {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.prog-step .prog-title {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
}
.prog-step.pending .prog-title { color: var(--mute); }
.prog-step.current .prog-title { color: var(--blue); }
.prog-step .prog-text {
  min-width: 0;
  flex: 1 1 auto;
}
.prog-step .prog-sub {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--mute);
  text-transform: uppercase;
  margin-top: 3px;
  white-space: nowrap;
}
.prog-connector {
  flex: 0 0 42px;
  min-width: 42px;
  height: 2px;
  align-self: center;
  background: repeating-linear-gradient(
    90deg,
    var(--rule) 0 6px,
    transparent 6px 10px
  );
  margin: 0 10px;
  position: relative;
}
.prog-connector.done {
  background: var(--ink);
}
.prog-connector::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--rule);
  border-right: 2px solid var(--rule);
  transform: translateY(-50%) rotate(45deg);
}
.prog-connector.done::after {
  border-color: var(--ink);
}
@media (max-width: 720px) {
  .prog-stepper {
    padding: 8px 10px;
    margin: 18px 0 24px;
  }

  .prog-step {
    min-width: 0;
    padding: 0 2px;
    gap: 8px;
  }

  .prog-step .prog-dot {
    width: 30px;
    height: 30px;
    font-size: 10px;
  }

  .prog-step .prog-title {
    font-size: 10px;
    line-height: 1.05;
    letter-spacing: 0.05em;
    white-space: normal;
  }

  .prog-step .prog-sub {
    font-size: 8px;
    line-height: 1.1;
    letter-spacing: 0.08em;
    white-space: normal;
  }

  .prog-connector {
    flex: 0 0 24px;
    min-width: 24px;
    height: 2px;
    margin: 0 6px;
    align-self: center;
    background: repeating-linear-gradient(
      90deg,
      var(--rule) 0 6px,
      transparent 6px 10px
    );
  }

  .prog-connector::after {
    right: -6px;
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%) rotate(45deg);
  }
}
.banner-strip .seg {
  flex: 1;
  padding: 10px 14px;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  border-right: 1.5px solid var(--rule);
  color: var(--paper);
  line-height: 1;
}
.banner-strip .seg:last-child { border-right: none; }
.banner-strip .seg.red { background: var(--terra); }
.banner-strip .seg.blue { background: var(--blue); }
.banner-strip .seg.cream { background: var(--cream-2); color: var(--ink); }
.banner-strip .seg.ink { background: var(--ink); color: var(--cream); }
.banner-strip .seg.white { background: var(--paper); color: var(--ink); }

/* Pitch lines (decorative field) */
.pitch {
  margin: 28px 0;
  height: 120px;
  border: 2px solid var(--rule);
  background:
    linear-gradient(90deg, transparent 49.7%, var(--rule) 49.7%, var(--rule) 50.3%, transparent 50.3%),
    repeating-linear-gradient(90deg, rgba(14,122,60,0.10) 0 24px, rgba(14,122,60,0.18) 24px 48px);
  position: relative;
  overflow: hidden;
}
.pitch::before,
.pitch::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 60px; height: 60px;
  transform: translateY(-50%);
  border: 2px solid var(--rule);
  border-radius: 50%;
}
.pitch::before { left: -30px; }
.pitch::after { right: -30px; }
.pitch .center {
  position: absolute;
  top: 50%; left: 50%;
  width: 60px; height: 60px;
  border: 2px solid var(--rule);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.pitch .center::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  background: var(--rule);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Trophy silhouette */
.trophy {
  width: 28px; height: 36px;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  color: currentColor;
}
.trophy svg { width: 100%; height: 100%; display: block; }

/* Retro star ticker */
.star-ticker {
  display: flex;
  gap: 14px;
  overflow: hidden;
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
  padding: 10px 0;
  background: var(--card);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  margin: 16px 0 0;
}
.star-ticker .track {
  display: inline-flex;
  gap: 24px;
  animation: ticker 40s linear infinite;
}
.star-ticker .track > span { display: inline-flex; align-items: center; gap: 10px; }
.star-ticker .track .dot { color: var(--terra); }
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.inline-predictions-shell {
  padding-top: 26px;
  padding-bottom: 20px;
  scroll-margin-top: 96px;
}

/* Scoreboard strip */
.scoreboard {
  background: var(--ink);
  color: var(--cream);
  padding: 10px 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
  border: 2px solid var(--rule);
  margin-top: 10px;
}
[data-theme="dark"] .scoreboard { background: var(--cream); color: var(--ink); }
.scoreboard .live-dot {
  width: 8px; height: 8px;
  background: var(--terra);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}
.scoreboard .sep { opacity: 0.3; }

/* ---------- PHP integration layer ---------- */
a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.screen-switcher a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  color: var(--fg);
  border-right: none;
  text-transform: uppercase;
}

.screen-switcher a.active {
  background: transparent;
  color: var(--fg);
}

[data-theme="dark"] .screen-switcher a.active { background: transparent; color: var(--fg); }

.ticket-links {
  margin-top: 14px;
}

.field .field-error {
  display: none;
}

.field.invalid .field-error {
  display: block;
}

.ticket .btn,
.thanks-actions .btn {
  text-decoration: none;
}

.participant-bar {
  margin: 18px 0 18px;
}

.match-loading {
  grid-column: 1 / -1;
}

.flag-emoji {
  width: 44px;
  height: 30px;
  border-radius: 3px;
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), inset 0 0 0 1px rgba(255,255,255,0.12);
  background: var(--cream-2);
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}

.team-mark {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
}

.team-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.14));
}

.team-badge-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in oklab, var(--blue) 84%, white);
  color: var(--cream);
  border: 2px solid color-mix(in oklab, var(--ocre) 42%, var(--blue));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rank-empty {
  margin-bottom: 24px;
}

.rank-row {
  position: relative;
  grid-template-columns: 48px auto 1fr auto auto auto;
}

.confirmation-strip {
  max-width: 640px;
}

@media (max-width: 980px) {
  .chrome {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .chrome-right {
    width: 100%;
  }

  .screen-switcher {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .screen-switcher a,
  .screen-switcher button {
    flex: 0 0 auto;
    padding-inline: 0;
    text-align: left;
  }

  .hero-side h1 {
    font-size: clamp(42px, 9vw, 72px);
  }

  .hero-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .matches-head {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .progress-card {
    max-width: 280px;
  }

  .match-row {
    min-width: 680px;
    grid-template-columns: 92px minmax(170px, 1fr) auto minmax(170px, 1fr);
    gap: 14px;
  }

  .match-row .row-meta {
    gap: 2px;
  }

  .match-row .row-team {
    min-width: 0;
  }

  .match-row .row-score {
    justify-content: center;
  }

  .thanks-card {
    padding: 36px 28px 30px;
  }

  .thanks-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .progress-card {
    max-width: none;
    width: 100%;
    justify-self: stretch;
    padding: 12px 14px;
  }

  .progress-top {
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  .progress-big {
    font-size: clamp(30px, 8vw, 38px);
    margin: 4px 0 8px;
  }

  .progress-big span.total {
    font-size: 18px;
  }

  .progress-bar {
    height: 5px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .chrome {
    padding: 12px 14px;
    gap: 12px;
  }

  .chrome-right {
    width: 100%;
  }

  .screen-switcher {
    width: 100%;
    justify-content: flex-start;
    gap: 8px 16px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 54px;
    height: 54px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-sub {
    font-size: 8px;
    letter-spacing: 0.14em;
  }

  .site-footer {
    padding: 22px 14px 26px;
  }

  .hero-meta {
    grid-template-columns: 1fr 1fr;
  }

  .matches-head {
    grid-template-columns: 1fr;
  }

  .ticket-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .ticket-foot .btn,
  .ticket-links .btn,
  .thanks-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .rank-row {
    grid-template-columns: 42px auto 1fr;
  }

  .rank-name-block,
  .rank-acc,
  .rank-pts,
  .rank-row .trend {
    grid-column: 3;
  }

  .rank-name-block .rank-progress {
    max-width: none;
  }

  .match-row {
    min-width: 520px;
    grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .match-row .row-meta {
    display: none;
  }

  .match-row .row-team.right .team-name-inline {
    justify-self: start;
    text-align: left;
  }

  .match-row .row-score {
    justify-content: center;
    flex-wrap: nowrap;
  }

  .thanks-card {
    padding: 32px 22px 26px;
    box-shadow: 6px 6px 0 var(--rule);
  }

  .thanks-stamp {
    right: 14px;
    font-size: 9px;
    letter-spacing: 0.16em;
  }

  .thanks-meta,
  .countdown-strip {
    grid-template-columns: 1fr 1fr;
  }

  .cta-bar {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
  }

  .cta-bar .btn {
    width: 100%;
    justify-content: center;
  }

  .scoreboard {
    gap: 10px;
    padding: 10px 12px;
    font-size: 10px;
    letter-spacing: 0.12em;
  }
}

@media (max-width: 560px) {
  .container,
  .container-sm {
    padding-inline: 16px;
  }

  .legal-page {
    padding-top: 12px;
  }

  .legal-card {
    padding: 20px 18px;
  }

  .brand {
    width: 100%;
  }

  .brand-title {
    font-size: 15px;
  }

  .brand-sub {
    font-size: 7px;
    letter-spacing: 0.12em;
  }

  .screen-switcher {
    flex-wrap: wrap;
    overflow: visible;
    gap: 8px 14px;
  }

  .screen-switcher a,
  .screen-switcher button {
    flex: 0 0 auto;
    border: none;
    min-height: auto;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .prog-stepper {
    margin: 16px 0 22px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .prog-step {
    gap: 6px;
    padding: 0;
  }

  .prog-step .prog-dot {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .prog-step .prog-title {
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .prog-step .prog-sub {
    font-size: 7px;
    letter-spacing: 0.06em;
    margin-top: 2px;
  }

  .prog-connector {
    flex: 0 0 16px;
    min-width: 16px;
    margin: 0 6px;
  }

  .group-tab {
    padding: 10px 14px 12px;
    font-size: 12px;
  }

  .progress-card {
    padding: 10px 12px;
  }

  .progress-top {
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .progress-big {
    font-size: 28px;
    margin: 4px 0 8px;
  }

  .progress-big span.total {
    font-size: 16px;
  }

  .match-list {
    overflow-x: visible;
  }

  .match-row .row-team .team-name-inline {
    font-size: 14px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    min-height: 2.25em;
  }

  .match-row .row-team .flag-sm {
    display: block;
    width: 28px;
    height: 20px;
  }

  .match-row .row-team .team-mark {
    width: 56px;
    height: 56px;
    margin: 0;
    flex: 0 0 56px;
  }

  .match-row .row-team,
  .match-row .row-team.right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 96px;
    gap: 6px;
  }

  .match-row .row-team {
    text-align: center;
  }

  .match-row .row-team.right {
    text-align: center;
  }

  .match-row .row-team .flag-sm {
    width: 56px;
    height: 40px;
    margin: 0;
    flex: 0 0 40px;
    font-size: 34px;
    border: none;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
  }

  .match-row .row-team .team-logo.flag-sm {
    width: 56px;
    height: 56px;
  }

  .match-row .row-team .team-badge-fallback.flag-sm {
    width: 56px;
    height: 56px;
    font-size: 12px;
  }

  .match-row .row-team .team-name-inline {
    width: 100%;
    min-height: 2.4em;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
  }

  .match-row .row-team.right .team-name-inline {
    justify-self: center;
    text-align: center;
  }

  .match-row {
    min-width: 0;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
    align-items: start;
  }

  .match-row .row-score {
    justify-content: center;
    align-self: center;
    align-items: center;
    gap: 8px;
  }

  .match-row .row-score .score-stepper {
    flex-direction: column;
    gap: 4px;
  }

  .match-row .row-score .score-stepper .step-btn:first-child {
    order: 3;
  }

  .match-row .row-score .score-stepper .score-val {
    order: 2;
  }

  .match-row .row-score .score-stepper .step-btn:last-child {
    order: 1;
  }

  .match-row .row-team .outcome-tag {
    justify-self: auto;
    align-self: center;
  }

  .match-row .row-team.right .outcome-tag {
    justify-self: center;
    text-align: center;
  }

  .match-row .row-score .score-val {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    flex-basis: 34px;
    font-size: 16px;
  }

  .match-row .row-score .step-btn,
  .match-row .row-score .vs {
    width: 26px;
    height: 26px;
    min-width: 26px;
    font-size: 9px;
  }

  .match-row .row-meta strong {
    font-size: 11px;
  }

  .rank-row {
    padding: 12px 14px;
    gap: 12px;
  }

  .thanks-meta,
  .countdown-strip {
    grid-template-columns: 1fr;
  }
}

/* Corner flags for screens */
.corner-flag {
  position: absolute;
  top: 0;
  width: 16px; height: 22px;
  background: var(--terra);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.corner-flag.r { right: 0; background: var(--blue); clip-path: polygon(100% 0, 100% 100%, 0 0); }

/* Tournament bracket mini */
.mini-bracket {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 2px solid var(--rule);
  background: var(--card);
  margin-top: 20px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--mute);
}
.mini-bracket .stage {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mini-bracket .stage .s {
  padding: 6px 10px;
  border: 1.5px solid var(--rule);
  text-align: center;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg);
  background: var(--bg);
}
.mini-bracket .stage .s.cur { background: var(--blue); color: var(--paper); border-color: var(--blue); }
.mini-bracket .final {
  padding: 10px 14px;
  background: var(--terra);
  color: var(--paper);
  border: 1.5px solid var(--ink);
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
