:root {
  --ink: #182018;
  --muted: #627064;
  --line: #dce6dc;
  --grass: #0f6b3b;
  --grass-dark: #083d25;
  --paper: #fbfdf9;
  --panel: #ffffff;
  --gold: #d8a22a;
  --silver: #aeb7c1;
  --bronze: #b87842;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(10, 35, 24, 0.06), transparent 22rem),
    var(--paper);
}

.hero {
  min-height: 340px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 4rem clamp(1rem, 5vw, 5rem) 3rem;
  color: white;
  background:
    linear-gradient(90deg, rgba(4, 25, 18, 0.88), rgba(4, 25, 18, 0.54) 48%, rgba(4, 25, 18, 0.2)),
    linear-gradient(180deg, transparent 68%, var(--paper) 100%),
    url("./assets/stadium-hero.png") center / cover;
}

.hero__content {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: #cbe8cb;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(3rem, 9vw, 6.7rem);
  line-height: 0.9;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.hero__summary {
  max-width: 560px;
  margin: 1.2rem 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.1rem;
  line-height: 1.55;
}

.hero-live {
  width: min(360px, 38vw);
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(4, 25, 18, 0.68);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.hero-live__label {
  display: inline-flex;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  color: #dcf7e3;
  background: rgba(15, 107, 59, 0.78);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-live__teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
}

.hero-live__teams span {
  display: flex;
  align-items: center;
}

.hero-live__teams span:last-child {
  justify-content: end;
}

.hero-live__teams strong {
  min-width: 5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  color: white;
  background: var(--grass-dark);
  text-align: center;
  font-size: 1.25rem;
}

.hero-live small {
  display: block;
  margin-top: 0.75rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: -2rem auto 4rem;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: var(--line);
  box-shadow: 0 18px 45px rgba(15, 40, 25, 0.14);
}

.summary > div {
  min-width: 0;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.94);
}

.summary__label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.35rem;
}

.leaderboard,
.rules,
.matches {
  margin-top: 1.25rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0 1rem;
}

.section-heading .eyebrow {
  color: var(--grass);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-size: 0.8rem;
  font-weight: 800;
}

.status-pill--ok {
  color: var(--grass-dark);
  border-color: #b9dbc2;
  background: #edf8ef;
}

.status-pill--error {
  color: #8c271d;
  border-color: #efc5be;
  background: #fff0ed;
}

.status-pill--warning {
  color: #6a4400;
  border-color: #f0d187;
  background: #fff6d9;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(15, 40, 25, 0.08);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.92rem;
}

.col-rank {
  width: 6.5rem;
}

.col-player {
  width: 11.5rem;
}

.col-points {
  width: 6rem;
}

.col-short {
  width: 6.5rem;
}

.col-form {
  width: 10.5rem;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  background: #f4f8f2;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  background: white;
}

tbody tr:nth-child(even) {
  background: #fbfdf9;
}

tbody tr.rank-1 {
  background: linear-gradient(90deg, rgba(216, 162, 42, 0.24), rgba(255, 248, 222, 0.72) 44%, white 82%);
}

tbody tr.rank-2 {
  background:
    linear-gradient(90deg, rgba(117, 132, 149, 0.34), rgba(220, 227, 234, 0.78) 46%, white 84%),
    white;
}

tbody tr.rank-3 {
  background: linear-gradient(90deg, rgba(184, 120, 66, 0.22), rgba(255, 237, 222, 0.7) 44%, white 82%);
}

tbody tr.rank-last {
  background:
    linear-gradient(90deg, rgba(211, 65, 48, 0.3), rgba(255, 220, 214, 0.78) 46%, white 84%),
    white;
}

.rank-last .rank-badge {
  color: #6d1f17;
  border-color: #f09c90;
  background: linear-gradient(135deg, #fff4f1, #ffb3a8);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: white;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.rank-badge--gold {
  color: #412f00;
  border-color: #efcf6f;
  background: linear-gradient(135deg, #ffe89a, var(--gold));
}

.rank-badge--silver {
  color: #26313b;
  border-color: #b9c2cc;
  background: linear-gradient(135deg, #ffffff, #c5ced8 58%, #9faab5);
}

.rank-badge--bronze {
  color: #3b1f0b;
  border-color: #d9a178;
  background: linear-gradient(135deg, #ffd8b8, var(--bronze));
}

.player-name {
  font-weight: 900;
}

.player-button {
  max-width: 8.5rem;
  overflow: hidden;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(15, 107, 59, 0.35);
  text-underline-offset: 0.25rem;
}

.player-button:hover {
  color: var(--grass);
}

.movement {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  min-height: 1.2rem;
  margin-left: 0.35rem;
  padding: 0.1rem 0.28rem;
  border-radius: 999px;
  color: var(--muted);
  background: #f4f8f2;
  font-size: 0.68rem;
  font-weight: 900;
}

.movement--up {
  color: var(--grass-dark);
  background: #dff3e4;
}

.movement--down {
  color: #8c271d;
  background: #ffe9e5;
}

.form-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 6.4rem;
}

.form-strip--empty {
  color: var(--muted);
  font-weight: 900;
}

.form-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.18rem;
  height: 1.18rem;
  border-radius: 999px;
  color: white;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

.form-dot--exact {
  background: var(--grass);
}

.form-dot--correct {
  color: #4a3200;
  background: #f4c54a;
}

.form-dot--miss {
  background: #c84d3d;
}

.table-message {
  min-height: 1.5rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-left-width: 0.45rem;
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 24px rgba(15, 40, 25, 0.06);
}

.rule-item span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rule-item strong {
  font-size: 2rem;
}

.rule-item--exact {
  border-left-color: var(--grass);
}

.rule-item--correct {
  border-left-color: var(--gold);
}

.rule-item--miss {
  border-left-color: #c84d3d;
}

.match-list {
  display: grid;
  gap: 1rem;
}

.match-group h3 {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.match-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--match-bg, white);
  box-shadow: 0 10px 24px rgba(15, 40, 25, 0.06);
  overflow: hidden;
}

.match-card__button {
  display: grid;
  gap: 0.8rem;
  width: 100%;
  min-height: 8rem;
  padding: 1rem;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.match-card__button:hover {
  background: rgba(255, 255, 255, 0.42);
}

.match-card--live {
  border-color: #9fd8b3;
  box-shadow: 0 12px 28px rgba(15, 107, 59, 0.14);
}

.match-card--group-a {
  --match-bg: #eef8ee;
}

.match-card--group-b {
  --match-bg: #fff5d9;
}

.match-card--group-c {
  --match-bg: #eaf3ff;
}

.match-card--group-d {
  --match-bg: #f5edff;
}

.match-card--group-e {
  --match-bg: #ffeef2;
}

.match-card--group-f {
  --match-bg: #e8f8f6;
}

.match-card--group-g {
  --match-bg: #fff0e5;
}

.match-card--group-h {
  --match-bg: #eef0ff;
}

.match-card__meta,
.match-card__score {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.match-card__meta span,
.match-card__date {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.match-card__meta strong {
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  color: var(--grass-dark);
  background: #edf8ef;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.match-card__score {
  grid-template-columns: 1fr auto 1fr;
}

.match-card__score span {
  display: flex;
  align-items: center;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.match-card__score span:last-child {
  justify-content: end;
  text-align: right;
}

.match-card__score strong {
  min-width: 4.4rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  color: white;
  background: var(--grass-dark);
  text-align: center;
}

.player-dialog {
  width: min(680px, calc(100% - 2rem));
  max-height: min(760px, calc(100vh - 2rem));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(6, 29, 19, 0.32);
}

.player-dialog::backdrop {
  background: rgba(5, 24, 16, 0.62);
}

.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.dialog-header .eyebrow {
  color: var(--grass);
}

.dialog-header h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.dialog-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #f4f8f2;
}

.dialog-score span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dialog-score strong {
  font-size: 2rem;
}

.dialog-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1.25rem 0;
  border-bottom: 1px solid var(--line);
  background: white;
}

.dialog-tab {
  padding: 0.55rem 0.8rem;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.dialog-tab--active {
  color: var(--grass-dark);
  border-color: var(--line);
  background: #f4f8f2;
}

.dialog-panel[hidden] {
  display: none;
}

.recent-list {
  display: grid;
  gap: 0.8rem;
  padding: 1.25rem;
}

.recent-card {
  border: 1px solid var(--line);
  border-left-width: 0.45rem;
  border-radius: 8px;
  padding: 1rem;
  background: white;
}

.recent-card--exact {
  border-left-color: var(--grass);
  background: linear-gradient(90deg, rgba(15, 107, 59, 0.1), white 38%);
}

.recent-card--correct {
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(216, 162, 42, 0.16), white 38%);
}

.recent-card--miss {
  border-left-color: #c84d3d;
  background: linear-gradient(90deg, rgba(200, 77, 61, 0.14), white 38%);
}

.upcoming-card {
  border: 1px solid var(--line);
  border-left-width: 0.45rem;
  border-left-color: var(--grass);
  border-radius: 8px;
  padding: 1rem;
  background: linear-gradient(90deg, rgba(15, 107, 59, 0.08), white 38%);
}

.recent-card__teams,
.recent-card__meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.recent-card__teams strong {
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  color: white;
  background: var(--grass-dark);
  white-space: nowrap;
}

.recent-card__teams span:last-child {
  text-align: right;
}

.flag-img {
  display: inline-block;
  width: 1.6rem;
  height: 1.1rem;
  flex: 0 0 auto;
  border: 1px solid rgba(24, 32, 24, 0.12);
  border-radius: 3px;
  object-fit: cover;
  vertical-align: -0.15rem;
  box-shadow: 0 2px 5px rgba(15, 40, 25, 0.12);
}

.flag-img--large {
  width: 2.25rem;
  height: 1.55rem;
}

.recent-card__meta {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.upcoming-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.recent-card__meta strong {
  color: var(--ink);
  text-align: right;
}

.recent-card__meta span:nth-child(2),
.prediction-card span:nth-of-type(2) {
  justify-self: center;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  color: var(--ink);
  background: #f4f8f2;
  font-weight: 900;
  white-space: nowrap;
}

.recent-card--exact .recent-card__meta span:nth-child(2),
.prediction-card--exact span:nth-of-type(2) {
  color: white;
  background: var(--grass);
}

.recent-card--correct .recent-card__meta span:nth-child(2),
.prediction-card--correct span:nth-of-type(2) {
  color: #4a3200;
  background: #f4c54a;
}

.recent-card--miss .recent-card__meta span:nth-child(2),
.prediction-card--miss span:nth-of-type(2) {
  color: white;
  background: #c84d3d;
}

.prediction-card {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-left-width: 0.45rem;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: white;
}

.prediction-card--exact {
  border-left-color: var(--grass);
  background: linear-gradient(90deg, rgba(15, 107, 59, 0.1), white 36%);
}

.prediction-card--correct {
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(216, 162, 42, 0.16), white 36%);
}

.prediction-card--miss {
  border-left-color: #c84d3d;
  background: linear-gradient(90deg, rgba(200, 77, 61, 0.14), white 36%);
}

.prediction-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.prediction-card b {
  text-align: right;
}

@media (max-width: 760px) {
  .hero {
    min-height: 420px;
    align-items: start;
    flex-direction: column;
    justify-content: end;
    padding: 3rem 1rem 4.5rem;
  }

  .hero-live {
    width: 100%;
  }

  h1 {
    font-size: clamp(3rem, 17vw, 5.8rem);
  }

  main {
    margin-top: -3.4rem;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .rules-grid,
  .match-grid {
    grid-template-columns: 1fr;
  }

  .prediction-card,
  .recent-card__teams,
  .recent-card__meta {
    grid-template-columns: 1fr;
  }

  .upcoming-card__meta {
    flex-direction: column;
    gap: 0.35rem;
  }

  .recent-card__teams span:last-child,
  .recent-card__meta strong {
    text-align: left;
  }
}
