:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-strong: #f0eee7;
  --text: #171717;
  --muted: #64625d;
  --line: #d9d4ca;
  --accent: #0f766e;
  --accent-soft: #d9f3ee;
  --wiki-green: #bbf3bb;
  --gold: #b7791f;
  --gold-soft: #f7ebcc;
  --danger: #a33b2f;
  --danger-soft: #f7ded8;
  --shadow: 0 10px 24px rgba(39, 37, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

main,
.app-header {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  padding: 30px 0 22px;
}

.app-header > div,
.section-heading > div {
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.lede {
  color: var(--muted);
  max-width: 760px;
  margin-top: 8px;
  overflow-wrap: break-word;
}

.source-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

section {
  margin: 26px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.section-note {
  color: var(--muted);
  font-size: 14px;
  max-width: 720px;
  overflow-wrap: break-word;
  text-align: right;
}

.third-summary {
  display: grid;
  gap: 3px;
}

.third-summary span {
  display: block;
}

.third-summary a {
  font-weight: 700;
}

.third-summary em {
  font-style: italic;
}

.third-groups {
  white-space: nowrap;
}

.team-jump {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.third-summary .team-jump-label {
  display: inline;
  flex: 0 0 auto;
  white-space: nowrap;
}

.team-jump select {
  max-width: 100%;
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  min-height: 36px;
  padding: 6px 8px;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 12px;
}

.match-card,
.round-card,
.group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.match-card {
  min-height: 236px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  scroll-margin-top: 16px;
}

.match-card.is-jump-highlighted {
  animation: match-jump-highlight 1.8s ease-out;
}

@keyframes match-jump-highlight {
  0% {
    border-color: #d9a400;
    box-shadow:
      0 0 0 4px rgba(246, 213, 92, 0.72),
      var(--shadow);
  }

  100% {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
}

.match-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
}

.match-location {
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.teams {
  display: grid;
  gap: 0;
}

.team-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

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

.flag {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
}

.team-name {
  display: block;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.team-note {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
}

.seed {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  min-width: 34px;
  padding: 4px 6px;
  text-align: center;
}

.match-foot {
  min-height: 44px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

.future-rounds {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
}

.round-card {
  padding: 14px;
}

.round-card h3 {
  margin-bottom: 10px;
}

.path-list {
  display: grid;
  gap: 8px;
}

.path-match {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #fbfaf7;
}

.path-match strong {
  display: block;
  font-size: 13px;
}

.path-match span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.team-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 180px;
}

.qualifies {
  background: var(--wiki-green);
}

.cutline td,
.cutline th {
  border-bottom: 3px solid var(--gold);
}

.misses {
  background: var(--danger-soft);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 12px;
}

.group-card {
  overflow: hidden;
}

.group-card h3 {
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.mini-standings {
  width: 100%;
  font-size: 13px;
}

.mini-standings th,
.mini-standings td {
  padding: 8px 9px;
}

.mini-standings .team-cell {
  min-width: 0;
}

.mini-standings .team-cell span {
  overflow-wrap: anywhere;
  white-space: normal;
}

.warnings {
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: var(--danger-soft);
  padding: 16px;
}

.warnings ul {
  margin: 0;
  padding-left: 20px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 20px;
}

@media (max-width: 1180px) {
  .match-grid,
  .future-rounds,
  .group-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 720px) {
  main,
  .app-header {
    width: calc(100% - 20px);
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

  h1 {
    font-size: 28px;
  }

  .lede,
  .section-note {
    max-width: 34ch;
  }

  .section-note {
    text-align: left;
  }

  .team-jump {
    justify-content: start;
    width: 100%;
  }

  .team-jump select {
    flex: 1 1 auto;
    min-width: 0;
  }

  .match-grid,
  .future-rounds,
  .group-grid {
    grid-template-columns: 1fr;
  }

  .team-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }
}
