:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #607084;
  --line: #d9e0e8;
  --panel: #ffffff;
  --surface: #f4f7fa;
  --accent: #0c7c59;
  --accent-strong: #075f45;
  --selection: #b9152a;
  --selection-strong: #861020;
  --selection-soft: #ffdce2;
  --gold: #c18f1b;
  --coral: #cf554c;
  --shadow: 0 16px 42px rgba(27, 46, 73, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #eaf0f5 0, #f8fafc 260px, #f8fafc 100%);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 48px) 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.75rem);
}

.tabs {
  display: flex;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tab {
  min-width: 96px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab.active {
  color: #fff;
  background: var(--accent);
}

main {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: 22px clamp(10px, 2vw, 32px) 48px;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

.player-filter {
  display: grid;
  gap: 4px;
  min-width: 148px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 24px rgba(27, 46, 73, 0.06);
  cursor: pointer;
}

.player-filter.active {
  border-color: var(--selection);
  background: var(--selection-soft);
  box-shadow: 0 10px 28px rgba(215, 38, 61, 0.16);
}

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

.player-filter-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.status-pill,
.match-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--accent-strong);
  background: #dff4ea;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: capitalize;
}

.match-status {
  white-space: nowrap;
  text-transform: none;
}

.match-status.live {
  color: #8b1020;
  background: #ffe0e5;
}

.bracket {
  display: grid;
  grid-template-columns: 1.45fr 1.25fr 1.08fr 0.96fr 0.9fr 0.9fr;
  gap: 12px;
  overflow-x: visible;
  padding-bottom: 12px;
}

.round {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.round-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.match-list {
  display: grid;
  align-content: space-around;
  gap: 10px;
  min-height: 620px;
}

.match {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 9px 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.team {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

.team:last-child {
  border-bottom: 0;
}

.team.winner {
  background: #c9eadb;
}

.team.selected-owner {
  background: var(--selection-soft);
  box-shadow: inset 4px 0 0 var(--selection);
}

.team.selected-owner .team-name {
  color: var(--selection-strong);
}

.team.winner.selected-owner {
  background: linear-gradient(90deg, var(--selection-soft) 0, #c9eadb 100%);
}

.flag {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.15rem;
  object-fit: contain;
  padding: 3px;
}

.team-name {
  display: block;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-code {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score {
  min-width: 20px;
  text-align: right;
  font-size: 1.05rem;
  font-weight: 950;
}

.empty {
  color: var(--muted);
  font-weight: 800;
}

.player-grid,
.country-grid,
.visit-log {
  display: grid;
  gap: 14px;
}

.player-grid,
.country-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.player-card,
.country-card {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(27, 46, 73, 0.08);
}

.player-card h3,
.country-card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid #cbd8e3;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--surface);
  font-weight: 800;
}

.chip.eliminated {
  border-color: #d1d5db;
  color: #7a8491;
  background: #eef1f4;
}

.chip.eliminated .flag,
.chip.eliminated .chip-name {
  opacity: 0.58;
}

.chip.eliminated .chip-name {
  text-decoration: line-through;
}

.chip-mark {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #8c1d2e;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
}

.country-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  min-height: 88px;
}

.country-card .flag {
  width: 38px;
  height: 38px;
}

.country-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.visit-log {
  gap: 8px;
}

.visit-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(140px, 0.7fr) minmax(120px, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  font-weight: 750;
}

.visit-head {
  color: var(--muted);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    min-width: 0;
    padding-inline: 8px;
  }

  .summary {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .player-filter {
    flex: 0 0 152px;
  }

  .bracket {
    grid-template-columns: repeat(6, 280px);
    overflow-x: auto;
  }

  .visit-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
