:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --ink: #101418;
  --muted: #5c6870;
  --line: #d9e1df;
  --teal: #00843d;
  --teal-dark: #006b35;
  --red: #c8102e;
  --gold: #b89445;
  --blue: #005eb8;
  --navy: #10243e;
  --shadow: 0 18px 45px rgba(17, 24, 32, 0.09);
  color-scheme: light;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(200, 16, 46, 0.1), rgba(0, 132, 61, 0.1) 50%, rgba(0, 94, 184, 0.1)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 330px),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.site-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 32px) 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-emblem {
  display: grid;
  place-items: center;
  flex: 0 0 92px;
  width: 92px;
  height: 142px;
  aspect-ratio: 227 / 351;
  border-radius: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.brand-emblem img {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  padding: 0;
}

.brand h1,
.brand p,
.section-heading h2,
.section-heading p {
  margin: 0;
}

.brand h1 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: 0;
}

.brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.source-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.icon-button,
.modal-close {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.icon-button:hover,
.modal-close:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 16px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(244, 247, 246, 0));
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
  display: none;
}

.section-nav a {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.section-nav a:hover {
  color: var(--teal);
  border-color: rgba(0, 124, 104, 0.4);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 4px 0 20px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(17, 24, 32, 0.05);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--teal);
}

.metric-card:nth-child(1)::before {
  background: var(--red);
}

.metric-card:nth-child(3)::before {
  background: var(--blue);
}

.metric-card:nth-child(4)::before {
  background: var(--gold);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

.live-card {
  border-color: rgba(216, 58, 74, 0.32);
}

.content-section {
  margin-top: 18px;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 32px rgba(17, 24, 32, 0.06);
}

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

.section-heading h2 {
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.15;
  letter-spacing: 0;
}

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

.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  width: min(320px, 100%);
  min-width: min(260px, 100%);
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  gap: 8px;
}

.search-box span {
  flex: 0 0 auto;
  display: inline-block;
  min-width: 2.25em;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.segmented,
.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.segmented {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented button,
.filter-row button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.segmented button {
  padding: 6px 9px;
}

.filter-row {
  margin-bottom: 14px;
}

.filter-row button {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 7px 11px;
}

.segmented button.is-active,
.filter-row button.is-active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.schedule-list {
  display: grid;
  gap: 14px;
}

.date-group {
  display: grid;
  gap: 8px;
}

.date-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  color: var(--muted);
  font-weight: 900;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(92px, 120px) minmax(0, 1fr) minmax(78px, 98px) minmax(0, 1fr) minmax(160px, 240px);
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.match-time {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.match-time strong {
  color: var(--ink);
  font-size: 16px;
}

.team-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 9px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.team-button:hover {
  border-color: rgba(0, 124, 104, 0.35);
  background: rgba(0, 124, 104, 0.06);
}

.team-button.away {
  justify-content: flex-end;
  text-align: right;
}

.team-button.away .team-text {
  align-items: flex-end;
}

.flag {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}

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

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

.team-abbr {
  color: var(--muted);
  font-size: 12px;
}

.score-button {
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 132, 61, 0.08), rgba(0, 94, 184, 0.08));
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0;
}

.score-button:hover {
  border-color: var(--teal);
}

.match-meta {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  width: fit-content;
  min-height: 26px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.status-finished {
  border-color: rgba(0, 124, 104, 0.25);
  color: var(--teal-dark);
  background: rgba(0, 124, 104, 0.08);
}

.status-live {
  border-color: rgba(216, 58, 74, 0.28);
  color: var(--red);
  background: rgba(216, 58, 74, 0.08);
}

.status-upcoming {
  border-color: rgba(35, 104, 162, 0.24);
  color: var(--blue);
  background: rgba(35, 104, 162, 0.08);
}

.venue-text,
.stage-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(292px, 1fr));
  gap: 10px;
}

.group-card,
.leader-panel,
.team-group-card,
.round-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.group-card {
  overflow: hidden;
}

.group-card h3,
.team-group-card h3,
.round-column h3 {
  margin: 0;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-rank {
  width: 27px;
}

.col-team {
  width: auto;
}

.col-stat {
  width: 29px;
}

.col-points {
  width: 34px;
}

th,
td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 13px;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

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

.rank-cell {
  color: var(--muted);
  font-weight: 900;
}

.table-team {
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

.table-team span {
  display: block;
  flex: 0 1 7.4em;
  min-width: 0;
  max-width: 7.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-team .flag {
  width: 22px;
  height: 22px;
}

.leader-panel {
  overflow: hidden;
}

.leader-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 82px 92px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

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

.leader-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-weight: 950;
}

.leader-player {
  min-width: 0;
}

.leader-player strong,
.leader-player span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-player span {
  color: var(--muted);
  font-size: 12px;
}

.leader-stat {
  text-align: right;
  font-weight: 950;
  font-size: 22px;
}

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

.team-list {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.team-list .team-button {
  border-color: var(--line);
  background: var(--surface);
}

.bracket-board {
  overflow: visible;
}

.bracket-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, 0.42fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  min-height: 520px;
}

.bracket-side {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.bracket-column,
.bracket-center,
.bracket-center-match {
  min-width: 0;
}

.bracket-column {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
}

.bracket-column h3,
.bracket-center-match h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-align: center;
}

.bracket-stack {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 5px;
  min-height: 0;
}

.bracket-center {
  display: grid;
  align-content: center;
  gap: 12px;
}

.bracket-center-match {
  display: grid;
  gap: 6px;
}

.bracket-center-match.is-final .bracket-match {
  border-color: rgba(184, 148, 69, 0.72);
  background: linear-gradient(135deg, rgba(184, 148, 69, 0.14), rgba(255, 255, 255, 0.8));
}

.bracket-match {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 45px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.bracket-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 17px;
  font-weight: 850;
  min-width: 0;
}

.bracket-match:hover {
  border-color: rgba(0, 132, 61, 0.42);
  background: var(--surface-soft);
}

.bracket-team span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.bracket-score {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 24, 0.54);
}

.modal-panel {
  position: relative;
  width: min(980px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.26);
}

.modal-close {
  position: sticky;
  top: 12px;
  float: right;
  margin: 12px 12px 0 0;
  z-index: 2;
}

.modal-body {
  padding: 24px;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-title h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

.info-grid,
.squad-grid,
.match-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.info-tile,
.squad-card,
.event-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.stats-compare {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.stats-head,
.stat-row {
  display: grid;
  grid-template-columns: minmax(54px, 1fr) minmax(96px, 1.3fr) minmax(54px, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 13px;
  border-bottom: 1px solid rgba(16, 20, 24, 0.08);
  text-align: center;
}

.stats-head {
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 12px;
}

.stats-head strong {
  color: var(--ink);
}

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

.stat-row span {
  color: var(--muted);
  font-size: 13px;
}

.stat-row strong {
  font-size: 18px;
}

.info-tile span,
.event-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.info-tile strong,
.event-card strong {
  display: block;
  margin-top: 4px;
}

.squad-card h3,
.events-section h3 {
  margin: 0 0 10px;
}

.player-list,
.coach-list,
.event-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-item,
.coach-item,
.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(16, 20, 24, 0.08);
}

.player-item:last-child,
.coach-item:last-child,
.event-item:last-child {
  border-bottom: 0;
}

.shirt {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal-dark);
  font-weight: 950;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-notes,
.footer-credit {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.footer-notes {
  max-width: 820px;
}

.footer a {
  color: var(--teal-dark);
  font-weight: 900;
}

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

  .top-actions,
  .controls {
    justify-content: flex-start;
  }

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

  .match-row {
    grid-template-columns: 84px minmax(0, 1fr) 72px minmax(0, 1fr);
  }

  .match-meta {
    grid-column: 2 / -1;
  }

  .bracket-map {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .bracket-side {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bracket-center {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: stretch;
  }
}

@media (max-width: 620px) {
  .site-shell {
    padding-inline: 10px;
  }

  .brand-emblem {
    flex-basis: 70px;
    width: 70px;
    height: 108px;
  }

  .overview-grid,
  .standings-grid,
  .teams-grid,
  .info-grid,
  .squad-grid,
  .match-detail-grid {
    grid-template-columns: 1fr;
  }

  .content-section {
    padding: 13px;
  }

  .match-row {
    grid-template-columns: 1fr 76px 1fr;
    gap: 7px;
  }

  .match-time {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .match-meta {
    grid-column: 1 / -1;
  }

  .team-button {
    padding: 5px;
  }

  .team-name {
    white-space: normal;
  }

  .leader-row {
    grid-template-columns: 34px minmax(0, 1fr) 58px;
  }

  th,
  td {
    padding: 7px 5px;
    font-size: 12px;
  }

  .table-team {
    max-width: 100%;
    gap: 4px;
  }

  .flag {
    width: 24px;
    height: 24px;
  }

  .leader-row .status-pill {
    display: none;
  }

  .modal {
    padding: 10px;
  }

  .modal-body {
    padding: 18px;
  }

  .bracket-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bracket-center {
    grid-template-columns: 1fr;
  }

  .bracket-match {
    min-height: 42px;
  }
}
