/* CFP bracket components use the existing Matrix palette and type scale. */
.cfp-home,
.cfp-page {
  --cfp-ink: #071426;
  --cfp-panel: #0b2038;
  --cfp-card: #0c233d;
  --cfp-border: #2d4964;
  --cfp-copy: #b7c9d9;
  --cfp-white: #f4f7fa;
  color: var(--cfp-white);
  font-family: var(--ui);
}

.cfp-home {
  position: relative;
  margin: 18px 0;
  padding: clamp(16px, 2.3vw, 28px);
  border: 1px solid var(--cfp-border);
  border-top: 2px solid var(--gold);
  border-radius: 14px;
  background: linear-gradient(126deg, #102941, #0a1c31 72%);
}

.cfp-page {
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 40px);
}

.cfp-layout .skip-link:not(:focus) { clip-path: inset(50%); }

.cfp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(205px, 285px);
  gap: 30px;
  align-items: end;
  margin-bottom: 24px;
  padding: clamp(22px, 4vw, 52px);
  background-color: var(--cfp-panel);
  border: 1px solid var(--cfp-border);
  border-top: 2px solid var(--gold);
  border-radius: 16px;
}

.cfp-eyebrow,
.cfp-stage-date,
.cfp-label {
  color: var(--ice);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1.5;
  text-transform: uppercase;
}

.cfp-home h2,
.cfp-page h1,
.cfp-page h2,
.cfp-page h3 {
  margin: 0;
  color: var(--cfp-white);
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.08;
}

.cfp-page h1 {
  margin: 8px 0 12px;
  font-size: clamp(40px, 6.2vw, 86px);
  letter-spacing: -.025em;
}

.cfp-home h2 { font-size: clamp(26px, 3.8vw, 40px); }
.cfp-page h2 { font-size: clamp(23px, 3vw, 31px); }
.cfp-page h3 { font-size: 21px; }

.cfp-hero p,
.cfp-home p,
.cfp-page p,
.cfp-page li {
  color: var(--cfp-copy);
  font-size: 14px;
  line-height: 1.6;
}

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

.cfp-home-head p { margin: 5px 0 0; }
.cfp-page .cfp-hero p { max-width: 65ch; margin: 0; }
.cfp-home .cfp-footnote { margin: 14px 0 0; font-size: 12px; }

.cfp-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid #58728a;
  border-radius: 8px;
  color: var(--cfp-white);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.cfp-link:hover { background: #1b3750; }
.cfp-link:focus-visible,
.cfp-team a:focus-visible,
.cfp-page summary:focus-visible,
.cfp-page .cfp-source a:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 3px;
}

.cfp-dates {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 15px 17px;
  border: 1px solid var(--cfp-border);
  border-radius: 12px;
  background: #081a2d;
}

.cfp-dates div { display: grid; gap: 2px; }
.cfp-dates dt { color: var(--cfp-copy); font-size: 12px; }
.cfp-dates dd { margin: 0; color: var(--cfp-white); font-weight: 800; font-size: 14px; }

.cfp-home-matches,
.cfp-byes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.cfp-byes { margin-top: 8px; }
.cfp-home-matches { margin-bottom: 14px; }

.cfp-bye-card,
.cfp-game {
  position: relative;
  min-width: 0;
  border: 1px solid var(--cfp-border);
  border-radius: 10px;
  background: var(--cfp-card);
}

.cfp-game-head {
  display: flex;
  gap: 4px 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 11px 7px;
  border-bottom: 1px solid var(--cfp-border);
  color: var(--cfp-copy);
  font-size: 11px;
  line-height: 1.4;
}

.cfp-game-head b { color: var(--ice); font-weight: 800; }
.cfp-game-head span { overflow-wrap: anywhere; }

.cfp-team {
  display: grid;
  grid-template-columns: 22px 29px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 46px;
  padding: 6px 10px;
}

.cfp-team + .cfp-team { border-top: 1px solid #1e3a53; }

.cfp-seed {
  display: grid;
  width: 22px;
  height: 24px;
  place-items: center;
  background: #183753;
  border-radius: 5px;
  color: #e0effa;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cfp-seed-bye { color: #ffe5b3; background: #463422; }

.cfp-logo {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 3px;
  border-radius: 6px;
  background: #e1eaf2;
  color: #193750;
}

.cfp-logo .fallback { position: absolute; font-size: 9px; font-weight: 800; }
.cfp-logo.logo-loaded .fallback { visibility: hidden; }
.cfp-logo img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.cfp-logo img[hidden] { display: none; }

.cfp-team-name,
.cfp-slot strong {
  display: block;
  color: var(--cfp-white);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.cfp-team-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.cfp-team small,
.cfp-slot small {
  display: block;
  margin-top: 3px;
  color: var(--cfp-copy);
  font-size: 11px;
  line-height: 1.22;
}

.cfp-mpr { text-align: right; white-space: nowrap; }
.cfp-mpr b { color: #ffdea4; font-size: 13px; font-variant-numeric: tabular-nums; }
.cfp-mpr small { margin-top: 1px; font-size: 9px; }

.cfp-game-note {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 7px 10px 9px;
  border-top: 1px solid var(--cfp-border);
  color: var(--cfp-copy);
  font-size: 11px;
  line-height: 1.45;
}

.cfp-game-note b { color: var(--cfp-white); }
.cfp-slot { min-height: 46px; padding: 8px 11px; }
.cfp-slot + .cfp-slot { border-top: 1px solid #1e3a53; }

.cfp-bracket-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 26px 0 14px;
}

.cfp-bracket-head p { margin: 4px 0 0; }

.cfp-tree {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

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

.cfp-round-body {
  display: grid;
  grid-template-rows: repeat(4, minmax(162px, auto));
  gap: 12px;
}

.cfp-round-body > .cfp-game { align-self: center; }
.cfp-round-semi .cfp-game { grid-row: span 2; }
.cfp-round-title .cfp-game { grid-row: span 4; }
.cfp-round-title .cfp-game { border-color: #9f7c49; }

.cfp-round-first .cfp-game::after,
.cfp-round-quarter .cfp-game::after,
.cfp-round-semi .cfp-game::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 12px;
  height: 1px;
  background: #7290a8;
}

.cfp-round-first .cfp-game::after { width: 24px; }
.cfp-round-semi .cfp-game::before,
.cfp-round-title .cfp-game::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 12px;
  height: 1px;
  background: #7290a8;
}

.cfp-round-quarter,
.cfp-round-semi { position: relative; }
.cfp-connector {
  position: absolute;
  top: 58px;
  left: calc(100% + 12px);
  width: 1px;
  height: calc(100% - 58px);
  overflow: visible;
  pointer-events: none;
}

.cfp-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 26px;
}

.cfp-note-card {
  min-width: 0;
  padding: 17px 19px;
  border: 1px solid var(--cfp-border);
  border-radius: 12px;
  background: var(--cfp-panel);
}

.cfp-note-card p { margin: 7px 0 0; }
.cfp-note-card ul { padding-left: 18px; margin: 9px 0 0; }
.cfp-source a { color: var(--ice); text-decoration: underline; text-underline-offset: 3px; }
.cfp-bubble .cfp-team { padding-left: 0; padding-right: 0; }
.cfp-bubble .cfp-seed { background: #22384a; }
.cfp-source { margin-top: 15px; }
.cfp-notes .cfp-source { margin-top: 0; }
.cfp-source summary { cursor: pointer; color: var(--ice); font-weight: 800; }

@media (max-width: 1040px) {
  .cfp-tree { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .cfp-round { display: block; }
  .cfp-round-body { margin-top: 9px; grid-template-rows: none; }
  .cfp-round-semi .cfp-game, .cfp-round-title .cfp-game { grid-row: auto; }
  .cfp-connector,
  .cfp-game::before,
  .cfp-game::after { display: none; }
  .cfp-home-matches, .cfp-byes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .cfp-hero, .cfp-tree, .cfp-notes, .cfp-home-matches { grid-template-columns: minmax(0, 1fr); }
  .cfp-hero { gap: 18px; }
  .cfp-home-head, .cfp-bracket-head { flex-direction: column; align-items: flex-start; }
  .cfp-byes { gap: 7px; }
  .cfp-byes .cfp-team { grid-template-columns: 19px 23px minmax(0,1fr); padding: 6px; gap: 4px; }
  .cfp-byes .cfp-mpr { grid-column: 3; text-align: left; }
  .cfp-byes .cfp-mpr small { display: inline; margin-left: 3px; }
  .cfp-byes .cfp-logo { width: 22px; height: 22px; }
  .cfp-byes .cfp-seed { width: 19px; }
}
