:root {
  color-scheme: dark;
  --bg: #0d0f13;
  --surface: #171a21;
  --surface-strong: #1d212a;
  --line: #303641;
  --line-soft: #252a33;
  --text: #f5f2ea;
  --muted: #aaa79f;
  --gold: #e9bd66;
  --cyan: #74b9d6;
  --red: #c96f68;
  --green: #7eb782;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  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;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.public-preview-banner {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(233, 189, 102, 0.25);
  background: #211f19;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.public-preview-banner strong {
  color: var(--gold);
  text-transform: uppercase;
}

.cup-header,
.cup-layout,
.source-details,
.related-nav,
.cup-footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.cup-header {
  padding: 30px 0 24px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs a:hover {
  color: var(--gold);
}

.cup-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  gap: 40px;
  align-items: end;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.summary {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-field {
  display: grid;
  gap: 7px;
}

.control-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.control-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.hub-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.hub-status p {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hub-status strong {
  color: var(--text);
}

.phase-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 16px;
  align-items: center;
  padding: 14px 0 2px;
}

.phase-control label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.phase-control select {
  width: 100%;
  min-height: 48px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.sr-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cup-layout {
  display: grid;
  gap: 18px;
  padding: 6px 0 34px;
}

.cup-layout > * {
  min-width: 0;
}

.team-directory > summary {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  cursor: pointer;
  list-style: none;
}

.team-directory > summary::-webkit-details-marker {
  display: none;
}

.team-directory > summary span {
  display: grid;
  gap: 3px;
}

.team-directory > summary small {
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.team-directory > summary strong {
  font-size: 24px;
}

.team-directory > summary em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 750;
}

.team-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid var(--line);
}

.team-link-grid a {
  display: grid;
  min-width: 0;
  min-height: 56px;
  align-content: center;
  gap: 3px;
  padding: 10px 14px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  text-decoration: none;
}

.team-link-grid a:hover,
.team-link-grid a:focus-visible {
  background: rgba(233, 189, 102, 0.08);
}

.team-link-grid strong {
  overflow-wrap: anywhere;
}

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

.competition-map-controls {
  padding-top: 4px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.panel-head {
  display: flex;
  min-height: 82px;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.match-list {
  display: grid;
}

.match-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 98px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.match-row-hitbox {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: 6px;
}

.match-row-hitbox span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.match-row:has(.match-row-hitbox:hover),
.match-row:has(.match-row-hitbox:focus-visible) {
  background: rgba(233, 189, 102, 0.06);
}

.match-row-hitbox:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -5px;
}

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

.match-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.match-copy > span,
.match-row time,
.tbc-time {
  color: var(--muted);
  font-size: 13px;
}

.match-copy strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.match-copy strong small,
.tie-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.match-copy a {
  text-decoration-color: rgba(233, 189, 102, 0.45);
  text-underline-offset: 3px;
}

.match-row time,
.tbc-time {
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.tbc-time {
  color: var(--gold);
}

.compact .match-row {
  min-height: 82px;
}

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

.tie-row {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 18px 22px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.tie-row:nth-child(2n) {
  border-right: 0;
}

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

.tie-row strong {
  font-size: 17px;
}

.table-wrap {
  overflow-x: hidden;
}

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

th,
td {
  height: 48px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
}

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

.col-team {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-pos {
  width: 58px;
}

.col-points,
.col-played,
.col-detail {
  width: 56px;
}

.band-direct td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
}

.band-playoff td:first-child {
  box-shadow: inset 3px 0 0 var(--cyan);
}

.band-eliminated td:first-child {
  box-shadow: inset 3px 0 0 var(--red);
}

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

.path-list article {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 18px 22px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.path-list span {
  color: var(--muted);
}

.round-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.round-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 22px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.round-list li[aria-current="step"] {
  box-shadow: inset 3px 0 0 var(--gold);
}

.round-list span,
.round-list small {
  color: var(--muted);
}

.empty-state {
  margin: 0;
  padding: 24px 22px;
  color: var(--muted);
}

[data-cup-row][hidden] {
  display: none;
}

.source-details {
  margin-bottom: 22px;
  border-block: 1px solid var(--line);
  padding: 16px 0;
  color: var(--muted);
}

.source-details summary {
  min-height: 44px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.source-details dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.source-details dl div {
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.source-details dt {
  font-size: 11px;
  text-transform: uppercase;
}

.source-details dd {
  margin: 6px 0 0;
  color: var(--text);
}

.related-nav {
  display: flex;
  gap: 10px 24px;
  flex-wrap: wrap;
  padding: 18px 0;
  border-block: 1px solid var(--line);
}

.related-nav a,
.cup-footer a {
  color: var(--gold);
}

.cup-footer {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 22px 0 38px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  .cup-header,
  .cup-layout,
  .source-details,
  .related-nav,
  .cup-footer {
    width: min(100% - 24px, 620px);
  }

  .cup-header {
    padding-top: 12px;
  }

  .breadcrumbs {
    margin-bottom: 18px;
  }

  .cup-heading {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  h1 {
    font-size: 36px;
  }

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

  .hub-status {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hub-status p span {
    display: none;
  }

  .panel-head,
  .match-row {
    padding-inline: 14px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .panel-head p:last-child {
    max-width: 120px;
  }

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

  .tie-grid,
  .path-list,
  .round-list {
    grid-template-columns: 1fr;
  }

  .tie-row,
  .path-list article,
  .round-list li {
    border-right: 0;
  }

  .source-details dl {
    grid-template-columns: 1fr 1fr;
  }

  .cup-footer {
    flex-direction: column;
  }

  .phase-control {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 32px;
  }

  .summary {
    font-size: 15px;
  }

  .source-details dl {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding-inline: 7px;
  }

  .col-detail {
    display: none;
  }

  .col-pos {
    width: 42px;
  }

  .col-points,
  .col-played {
    width: 46px;
  }
}

@media (max-width: 340px) {
  .controls {
    grid-template-columns: 1fr;
  }
}
