/* =========================================================================
   World Cup 2026 Sweepstake — clean & sporty theme
   Host-nation palette (USA navy/red, Mexico green) + gold accent.
   Hand-written, zero build step, no external fonts/CDN.
   ========================================================================= */

:root {
  --navy:      #0a3161;   /* USA blue   */
  --navy-700:  #0b2545;
  --navy-900:  #071a33;
  --red:       #d7263d;
  --green:     #00843d;   /* Mexico green */
  --gold:      #ffc72c;
  --ink:       #0e1726;
  --muted:     #5b6b82;
  --line:      #e6ecf3;
  --bg:        #f3f6fb;
  --card:      #ffffff;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 10px 30px rgba(11, 37, 69, 0.10), 0 2px 6px rgba(11, 37, 69, 0.06);
  --shadow-lg: 0 24px 60px rgba(7, 26, 51, 0.22);
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);

  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle pitch backdrop ---------------------------------------------------- */
.pitch {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 540px at 50% -10%, rgba(0, 132, 61, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(215, 38, 61, 0.07), transparent 55%),
    var(--bg);
}
.pitch::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg, rgba(11, 37, 69, 0.022) 0 2px, transparent 2px 96px);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 80%, transparent);
}

h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
kbd {
  font: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.82em;
  color: var(--navy);
}

/* Buttons ------------------------------------------------------------------ */
.btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
  letter-spacing: 0.02em;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--ghost {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.btn--ghost:hover:not(:disabled) { border-color: #cdd8e6; }

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--red), #b3132f);
  box-shadow: 0 12px 26px rgba(215, 38, 61, 0.36);
}
.btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 18px 34px rgba(215, 38, 61, 0.44); }

.btn--spin {
  font-size: 1.32rem;
  text-transform: uppercase;
  padding: 16px 54px;
  letter-spacing: 0.14em;
}
.btn--spin .btn__label { position: relative; }
.btn--spin:not(:disabled) { animation: breathe 2.4s var(--ease) infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 12px 26px rgba(215, 38, 61, 0.36); }
  50%      { box-shadow: 0 16px 34px rgba(215, 38, 61, 0.52); }
}

/* Topbar ------------------------------------------------------------------- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px 10px;
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex-wrap: wrap;
}
.topbar__right { display: flex; align-items: baseline; gap: 12px; margin-left: auto; }
.topbar__actions { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; align-self: center; }
.topbar__actions .btn { padding: 5px 12px; font-size: 0.75rem; white-space: nowrap; }
/* Wide screens: keep the title on one line and the progress + stacked buttons
   flush on the header row (the progress bar shrinks to make room). */
@media (min-width: 1080px) {
  .topbar { flex-wrap: nowrap; }
  .brand__title { white-space: nowrap; }
  .progress { min-width: 0; flex-basis: 220px; }
}
.brand { display: flex; align-items: baseline; gap: 14px; flex: 1 1 auto; }
.brand__badge {
  align-self: center;
  position: relative;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--navy), var(--navy-900));
  color: var(--gold);
  font-weight: 800;
  font-size: 1.35rem;
  font-style: italic;
  letter-spacing: -0.04em;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.brand__badge > * { grid-area: 1 / 1; }          /* stack the number and the logo */
.brand__logo { width: 100%; height: 100%; object-fit: contain; opacity: 0; }
/* When a real logo image has loaded, show it on a clean white chip. */
.brand__badge.has-logo { background: #fff; padding: 5px; border-color: var(--line); }
.brand__badge.has-logo .brand__logo { opacity: 1; }
.brand__badge.has-logo .brand__badge-num { display: none; }
.brand__title {
  font-size: 1.5rem;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.05;
  background: linear-gradient(120deg, var(--navy), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand__sub { margin: 2px 0 0; font-size: 0.86rem; color: var(--muted); }

.progress { min-width: 220px; flex: 0 1 280px; }
.progress__meta { font-size: 1rem; color: var(--muted); margin-bottom: 6px; }
.progress__meta strong { color: var(--navy); font-size: 1.1rem; }
.progress__bar {
  height: 10px;
  border-radius: 999px;
  background: #e3eaf3;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(11, 37, 69, 0.12);
}
.progress__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--gold) 70%, var(--red));
  transition: width 0.6s var(--ease);
}

/* Layout ------------------------------------------------------------------- */
.layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
}

.home-left {
  display: grid; gap: 26px; align-content: start; min-width: 0;
  position: relative; overflow: clip; overflow-clip-margin: 24px;   /* hard-contain the slot box + shadow within the 500px column so it can't paint over the roster */
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

/* Stage / slot machine ----------------------------------------------------- */
.stage {
  padding: 26px;
  text-align: center;
  background:
    radial-gradient(700px 240px at 50% -40%, rgba(0, 132, 61, 0.10), transparent),
    var(--card);
}
.stage__label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
.stage__name {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 800;
  font-style: italic;
  color: var(--navy);
  min-height: 1.2em;
  margin-top: 2px;
}

.slot {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 22px auto 4px;
  padding: 16px;
  width: 100%;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--navy), var(--navy-900));
  box-shadow: 0 16px 24px -8px rgba(7, 26, 51, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.reel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 132px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #eef3f9);
  box-shadow: inset 0 12px 18px -12px rgba(7, 26, 51, 0.5),
              inset 0 -12px 18px -12px rgba(7, 26, 51, 0.5);
}
.reel-strip {
  display: flex;
  flex-direction: column;
}
.reel-strip.blur { filter: blur(2.4px); }

.tile {
  height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px;
}
.tile img {
  width: 78px;
  max-width: 84%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 3px 8px rgba(7, 26, 51, 0.28);
  border: 1px solid rgba(7, 26, 51, 0.10);
}
.tile span {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--navy-700);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* center landing line across the reels */
.slot__line {
  position: absolute;
  left: 16px; right: 16px;
  top: 50%;
  height: 132px;
  transform: translateY(-50%);
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(255, 199, 44, 0.45);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.slot.landed .slot__line { opacity: 1; }

.stage__actions { margin-top: 20px; }
.stage__hint { margin: 14px 0 0; font-size: 0.9rem; color: var(--muted); min-height: 1.2em; }
.stage.is-complete .stage__name { color: var(--green); }

/* Prizes ------------------------------------------------------------------- */
.prizes { padding: 20px 24px; }
.prizes__title {
  font-size: 1.2rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--navy); margin: 0 0 12px;
}
.prizes__list { list-style: none; margin: 0; padding: 0; }
.prizes__row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.prizes__row:first-child { border-top: 0; }
.prizes__label { font-weight: 600; color: var(--ink); }
.prizes__qual { font-size: 0.85em; }
.prizes__amt { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Roster ------------------------------------------------------------------- */
.roster { position: relative; }
.roster__head { margin-bottom: 14px; }
.roster__head h2 {
  font-size: 1.2rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--navy);
}
.roster__head p { margin: 2px 0 0; font-size: 0.9rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.pcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 11px 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s;
}
.pcard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy), var(--green), var(--gold), var(--red));
  opacity: 0.85;
}
.pcard.is-current {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), var(--shadow);
  transform: translateY(-2px);
}
.pcard.is-complete::before { opacity: 1; }

.pcard__top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}
.pcard__num {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: #eef3fa;
  color: var(--navy);
  font-weight: 800;
  font-size: 0.74rem;
}
.pcard__name {
  flex: 1 1 auto;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.86rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
  cursor: text;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcard__name:hover { background: #f5f8fc; }
.pcard__name:focus { border-color: var(--navy); background: #fff; }
/* Locked once every team is drawn — no edit affordance. */
.pcard__name[contenteditable="false"] { cursor: default; }
.pcard__name[contenteditable="false"]:hover { background: transparent; }
.pcard__count {
  flex: 0 0 auto;
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--muted);
  background: #f1f5fa;
  border-radius: 999px;
  padding: 2px 7px;
}
.pcard.is-complete .pcard__count { color: var(--green); background: rgba(0, 132, 61, 0.12); }

.pcard__slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.slot-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}
.slot-cell img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(7, 26, 51, 0.18);
  border: 1px solid rgba(7, 26, 51, 0.08);
}
.slot-cell span {
  font-size: 0.56rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.15;
  width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.slot-cell.empty {
  border: 1.5px dashed #d4deea;
  border-radius: 6px;
  aspect-ratio: 4 / 3;
  min-height: 26px;
}
.slot-cell.pop { animation: pop 0.5s var(--ease) both; }
@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* Footer ------------------------------------------------------------------- */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 24px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Password modal ----------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 26, 51, 0.45);
}
.modal[hidden] { display: none; }
.modal__card {
  width: 100%;
  max-width: 340px;
  padding: 22px;
  display: grid;
  gap: 14px;
}
.modal__title { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--navy); }
.modal__input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.modal__input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(10, 49, 97, 0.15);
}
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Wider screens: stage beside roster -------------------------------------- */
@media (min-width: 920px) {
  .layout {
    grid-template-columns: 500px minmax(0, 1fr);
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn--spin:not(:disabled) { animation: none; }
  .slot-cell.pop { animation: none; }
}

/* =========================================================================
   Tabs + Scores page
   ========================================================================= */

/* Tab bar (top-left, under the header) ------------------------------------- */
.tabs {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4px 24px 0;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}
.tab {
  font: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.tab:hover { color: var(--navy); }
.tab.is-active { color: var(--navy); border-bottom-color: var(--red); }

/* Page switching: the inactive tab's page is hidden (keeps .layout's grid
   on the active home page, since :not(.is-active) wins over .layout). */
.page:not(.is-active) { display: none; }

/* The draw progress + reset/upload belong to Home only. */
body.on-scores .topbar__right,
body.on-leaderboard .topbar__right,
body.on-live .topbar__right { display: none; }

/* Scores container --------------------------------------------------------- */
.scores {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 24px 40px;
}
.scores__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.scores__head--meta-only { justify-content: flex-end; }
.scores__title {
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
}
.scores__meta { display: flex; align-items: center; gap: 14px; }
.scores__updated { font-size: 0.8rem; color: var(--muted); }
.scores__countdown { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.scores__empty,
.scores__stale {
  padding: 16px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
}
.scores__stale {
  color: var(--red);
  background: rgba(215, 38, 61, 0.06);
  border-color: rgba(215, 38, 61, 0.2);
  margin-bottom: 16px;
}

/* Day groups --------------------------------------------------------------- */
.match-day { margin-bottom: 24px; }
.match-day__title {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
  padding: 6px 2px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.match-day__list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Match row ---------------------------------------------------------------- */
.match-row { padding: 11px 16px; }
.match-row + .match-row { border-top: 1px solid var(--line); }
.match-row.is-live { background: rgba(215, 38, 61, 0.04); }
.match-row__main {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 78px;
  align-items: center;
  gap: 12px;
}
.match-row__zones {
  margin-top: 6px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.match-row__time { display: flex; flex-direction: column; gap: 2px; }
.match-row__clock { font-weight: 800; color: var(--navy); font-size: 0.95rem; white-space: nowrap; }
.match-row__tz { font-size: 0.6rem; font-weight: 700; color: var(--muted); margin-left: 3px; }
.match-row__stage {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.match-row__teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team--home { justify-content: flex-end; text-align: right; }
.team--away { justify-content: flex-start; text-align: left; }
.team__name {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team__flag {
  flex: 0 0 auto;
  width: 30px;
  height: 22px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(7, 26, 51, 0.18);
  border: 1px solid rgba(7, 26, 51, 0.08);
}
.team__flag--none {
  flex: 0 0 auto;
  display: inline-block;
  width: 30px;
  height: 22px;
  border: 1.5px dashed #d4deea;
  border-radius: 4px;
}
.owner-chip {
  flex: 0 0 auto;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--navy);
  background: #eef3fa;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.match-row__score {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--navy);
}
.score__sep { color: var(--muted); }
.score__vs { color: var(--muted); font-weight: 700; font-size: 0.82rem; }

.match-row__status { text-align: right; }
.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge--ft { background: #eef1f5; color: var(--muted); }
.badge--upcoming { background: rgba(0, 132, 61, 0.10); color: var(--green); }
.badge--live {
  background: rgba(215, 38, 61, 0.12);
  color: var(--red);
  position: relative;
  padding-left: 19px;
}
.badge--live::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: livePulse 1.2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

/* Narrow screens: stack teams below the time/status row -------------------- */
@media (max-width: 600px) {
  .match-row__main { grid-template-columns: 1fr auto; }
  .match-row__time { flex-direction: row; gap: 8px; align-items: baseline; }
  .match-row__status { order: 2; }
  .match-row__teams { grid-column: 1 / -1; order: 3; margin-top: 6px; }
  .owner-chip { display: none; }
}

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

/* =========================================================================
   Leaderboard page
   ========================================================================= */
.leaderboard {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 24px 40px;
}
.leaderboard__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.leaderboard__title {
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
}
.leaderboard__sub { margin: 3px 0 0; font-size: 0.88rem; max-width: 56ch; }
.leaderboard__updated { font-size: 0.8rem; color: var(--muted); }

.leaderboard__list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lb-row {
  display: grid;
  grid-template-columns: 46px minmax(110px, 1.3fr) minmax(132px, 1fr) 120px 92px;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
}
.lb-row + .lb-row { border-top: 1px solid var(--line); }

.lb-row--head {
  background: #f6f9fc;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.lb-row--head .lb-row__rank,
.lb-row--head .lb-row__points { color: var(--muted); font-size: 0.68rem; }
.lb-row--head .lb-row__points { text-align: right; }

.lb-row__rank {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--navy);
  text-align: center;
}
.lb-row__name {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-row__flags { display: flex; gap: 5px; flex-wrap: wrap; }
.lb-row__flags .team__flag { width: 27px; height: 20px; }

.lb-row__wdl { display: flex; gap: 6px; }
.wdl {
  min-width: 26px;
  text-align: center;
  font-weight: 800;
  font-size: 0.8rem;
  border-radius: 6px;
  padding: 2px 6px;
  font-variant-numeric: tabular-nums;
}
.wdl--w { color: var(--green); background: rgba(0, 132, 61, 0.10); }
.wdl--d { color: var(--muted); background: #eef1f5; }
.wdl--l { color: var(--red); background: rgba(215, 38, 61, 0.10); }

.lb-row__points {
  text-align: right;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.lb-row__pts-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted);
  margin-left: 3px;
  text-transform: uppercase;
}

/* Podium accents for the top three */
.lb-row.is-top-1 { background: rgba(255, 199, 44, 0.12); }
.lb-row.is-top-1 .lb-row__rank { color: #b8860b; }
.lb-row.is-top-2 { background: rgba(120, 144, 168, 0.12); }
.lb-row.is-top-3 { background: rgba(205, 127, 50, 0.12); }

/* Legend */
.lb-legend { margin-top: 16px; font-size: 0.86rem; }
.lb-legend summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.8rem;
  padding: 6px 0;
}
.lb-legend p { margin: 6px 0 0; max-width: 70ch; }
.lb-legend__table {
  border-collapse: collapse;
  margin-top: 10px;
  width: 100%;
  max-width: 420px;
}
.lb-legend__table th,
.lb-legend__table td {
  text-align: left;
  padding: 5px 14px 5px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.lb-legend__table th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 600px) {
  .lb-row {
    grid-template-columns: 34px minmax(0, 1fr) 76px;
    gap: 6px 10px;
  }
  .lb-row__flags,
  .lb-row__wdl { grid-column: 2 / -1; }
  .lb-row--head { display: none; }
}

/* =========================================================================
   Live page  (current matches with goal scorers + cards)
   ========================================================================= */
.live-list { display: grid; gap: 16px; }
.live-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px 18px;
  --live-mid: 116px; /* shared centre-column width so events line up under flags */
}
.live-card__top { display: flex; justify-content: flex-end; min-height: 22px; }

/* Header: home (flag+name) | big score | away (flag+name) */
.live-card__head {
  display: grid;
  grid-template-columns: 1fr var(--live-mid) 1fr;
  align-items: start;
  gap: 14px;
  padding: 2px 0 14px;
}
.live-card__team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  text-align: center;
}
.live-card__flag { width: 52px; height: 37px; }
.live-card__name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.15;
}
.live-card__score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 6px;
  font-weight: 800;
  font-size: 2rem;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.live-card__sep { color: var(--muted); font-weight: 700; }

/* Event rows: home | centered type icon | away — each centred under its team */
.live-section {
  display: grid;
  grid-template-columns: 1fr var(--live-mid) 1fr;
  align-items: start;
  gap: 8px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.live-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  text-align: center;
}
.live-mid { display: flex; justify-content: center; padding-top: 1px; }
.live-event { font-size: 0.9rem; color: var(--ink); line-height: 1.3; }
.live-event__min { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Centered event-type icons: football for goals, tilted cards for bookings */
.ev-icon--goal { display: block; }
.ev-icon--card {
  display: inline-block;
  width: 12px;
  height: 16px;
  border-radius: 2px;
  transform: rotate(9deg);
  box-shadow: 0 1px 2px rgba(7, 26, 51, 0.28);
}
.ev-icon--red { background: var(--red); }
.ev-icon--yellow { background: var(--gold); }

@media (max-width: 600px) {
  .live-card { --live-mid: 88px; }
  .live-card__head { gap: 8px; }
  .live-card__flag { width: 44px; height: 31px; }
  .live-card__name { font-size: 0.95rem; }
  .live-card__score { font-size: 1.6rem; gap: 7px; }
  .live-event { font-size: 0.84rem; }
}
