:root {
  --purple: #38003c;
  --purple-deep: #240028;
  --purple-soft: #4b0b52;
  --gold: #ffc107;
  --gold-soft: #ffe9a8;
  --green: #00c676;
  --red: #ff4d5a;
  --ink: #1d1d2b;
  --muted: #6f6f85;
  --card: #ffffff;
  --row-line: #eeeaf1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, var(--purple-deep), var(--purple) 55%, var(--purple-soft));
  min-height: 100vh;
  color: var(--ink);
  padding-bottom: 3rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0.75rem;
}

/* ---------- header ---------- */

.hero {
  text-align: center;
  color: #fff;
  padding: 2rem 1rem 1.25rem;
}

.hero h1 {
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.05;
}

.hero h1 span {
  display: block;
  color: var(--gold);
}

.strapline {
  margin-top: 0.5rem;
  font-weight: 700;
  color: var(--gold-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.updated {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.updated .live-dot {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--green);
  margin-right: 0.35em;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- leader card ---------- */

.leader-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: linear-gradient(135deg, #fff8e1, #ffedb3);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.leader-crown { font-size: 1.6rem; }

.leader-badge img,
.badge img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.leader-text { flex: 1; min-width: 0; }

.leader-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8a6d00;
  font-weight: 700;
}

.leader-name {
  font-size: 1.15rem;
  font-weight: 900;
}

.leader-detail {
  font-size: 0.78rem;
  color: #6b5d20;
}

.leader-points {
  text-align: center;
  line-height: 1;
}

.leader-points span {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--purple);
}

.leader-points small {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a6d00;
  margin-top: 0.2rem;
}

/* pre-season variant: neutral, no winner implied */

.leader-card.preseason {
  background: linear-gradient(135deg, #faf7ff, #efe7f7);
  border-color: #7a4b86;
}

.leader-card.preseason .leader-label { color: #7a4b86; }
.leader-card.preseason .leader-detail { color: #6f5b78; }

/* ---------- error banner ---------- */

.error-banner {
  background: #fff3f4;
  border: 1px solid var(--red);
  color: #a1222c;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  margin-bottom: 0.9rem;
}

/* ---------- match-day strip ---------- */

.matches { margin-bottom: 1rem; }

.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.5rem;
}

.match-chip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.15rem 0.45rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  color: #fff;
  font-size: 0.82rem;
}

.match-chip .match-team {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-chip .home { text-align: right; }

.match-chip .match-score {
  font-weight: 900;
  color: var(--gold);
  white-space: nowrap;
}

.match-chip .match-status {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.6);
}

.match-chip.is-live { border-color: var(--green); }

.match-live {
  color: var(--green);
  font-weight: 800;
}

/* ---------- table ---------- */

.table-heading {
  color: var(--gold-soft);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  margin: 0 0 0.5rem;
}

.table-wrap {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.league-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.league-table thead th {
  background: var(--purple);
  color: #fff;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.league-table thead th.col-team { text-align: left; }

.league-table td {
  padding: 0.55rem 0.5rem;
  border-top: 1px solid var(--row-line);
  text-align: center;
  white-space: nowrap;
}

.col-pos { width: 3.4rem; }

td.col-pos {
  font-weight: 800;
  color: var(--muted);
}

.mover {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  margin-left: 0.15rem;
  vertical-align: 0.08em;
}

.mover.up   { color: var(--green); }
.mover.down { color: var(--red); }
.mover.same { color: #c9c9d6; }

td.col-team { text-align: left; }

.team-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.badge {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1eef4;
  font-weight: 900;
  font-size: 0.8rem;
  color: #fff;
}

.badge img {
  width: 85%;
  height: 85%;
}

.team-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.team-name {
  display: block;
  font-weight: 800;
  line-height: 1.15;
}

.team-sub:empty { display: none; }

.team-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.col-num { font-variant-numeric: tabular-nums; }

td.col-adj {
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--purple);
}

/* prize-zone tints */

tr.pos-1 td { background: #fff7dd; }
tr.pos-2 td { background: #f4f4f8; }
tr.pos-3 td { background: #fdeedd; }
tr.pos-bottom td { background: #f2ecf6; }

tr.pos-1 td.col-adj { color: #a97b00; }

.prize-tag {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.5rem;
  vertical-align: 0.1em;
}

tr.pos-1 .prize-tag      { background: var(--gold); color: #4a3600; }
tr.pos-2 .prize-tag      { background: #c8c8d2; color: #33333d; }
tr.pos-3 .prize-tag      { background: #e5a35c; color: #4d2c05; }
tr.pos-bottom .prize-tag { background: var(--purple); color: #fff; }

/* ---------- prizes strip ---------- */

.prizes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 1rem;
}

.prize-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  text-align: center;
  color: #fff;
  padding: 0.6rem 0.3rem;
}

.prize-chip .amount {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--gold);
}

.prize-chip .label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0.15rem;
}

.footnote {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.74rem;
  text-align: center;
  margin-top: 1.1rem;
  line-height: 1.5;
}

/* ---------- small screens ---------- */

@media (max-width: 480px) {
  .col-opt { display: none; }

  .league-table { font-size: 0.88rem; }
  .league-table td { padding: 0.5rem 0.35rem; }

  .badge, .leader-badge img { width: 32px; height: 32px; }
  .badge { font-size: 0.68rem; }

  .prizes { grid-template-columns: repeat(2, 1fr); }
}
