/* cup page — a full-height knockout bracket with a single scroll/pan region */

/* the cup takes the whole content column (no max-width, no page scroll) so the
   bracket viewport is the only thing that scrolls — no nested scrollbars. */
main#page.cup-full {
  max-width: none;
  height: 100vh;
  padding: var(--s4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cup-page {
  --bk-row-h: 46px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.cup-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.cup-head-info { min-width: 0; }

.cup-head-title {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.cup-head-sub {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
}

.cup-head-winner { color: var(--gold); font-weight: 600; }

.cup-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bk-zoom {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: 0 0 auto;
}

.bk-zoom-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.bk-zoom-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.bk-zoom-fit {
  font-size: var(--fs-sm);
}

.bk-zoom-level {
  min-width: 44px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* the single scroll/pan region — fills the height left under the slim header */
.cup-bracket-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.015);
  scrollbar-width: thin;
}

.cup-bracket {
  position: relative;
  display: flex;
  align-items: stretch;
  width: max-content;
  transform-origin: top left;
  background: radial-gradient(120% 80% at 50% 46%, rgba(227, 183, 101, 0.07), transparent 60%);
}

/* connector lines + hover trace live behind the cards, showing in the gaps */
.bk-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.bk-link {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.4;
  opacity: 0.55;
}

.bk-trace {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(227, 183, 101, 0.6));
}

.bk-col {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  max-width: 168px;
}

.bk-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  min-height: 48px; /* equal across columns so every round shares a baseline */
  padding: var(--s2) var(--s2) var(--s3);
  text-align: center;
}

.bk-col-stage {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-2);
  text-transform: uppercase;
}

.bk-col-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}

/* even leaf rows per wing → parents land exactly between their children */
.bk-ties {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 0;
  min-height: calc(var(--bk-rows, 1) * var(--bk-row-h));
}

.final-col {
  min-width: 188px;
  max-width: 200px;
}

.final-col .bk-col-stage {
  color: var(--gold);
  font-size: var(--fs-body);
}

.bk-final-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.final-col .bk-ties {
  flex: 0 0 auto;
  min-height: 0;
  justify-content: center;
}

.bk-trophy {
  margin: 0 auto var(--s3);
  font-size: 40px;
  line-height: 1;
  text-align: center;
  filter: grayscale(0.4) opacity(0.55);
}

.bk-trophy.won {
  filter: none;
  text-shadow: 0 0 18px rgba(227, 183, 101, 0.6);
}

.bk-champion {
  margin-top: var(--s3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.bk-champion-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.bk-champion b {
  color: var(--gold);
  font-size: var(--fs-body);
}

/* --------------------------------------------------------------------- tie -- */

.bk-tie {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 3px var(--s2);
  padding: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface, rgba(20, 22, 28, 0.92));
  background: linear-gradient(rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03)), rgba(14, 16, 22, 0.96);
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease, opacity 0.15s ease;
}

.final-col .bk-tie {
  border-color: rgba(227, 183, 101, 0.35);
  background: linear-gradient(rgba(227, 183, 101, 0.06), rgba(227, 183, 101, 0.06)), rgba(14, 16, 22, 0.96);
}

/* games still to be played read brighter than the dark bracket behind them */
.bk-tie.upcoming {
  background: linear-gradient(rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.085)), rgba(24, 27, 35, 0.96);
  border-color: var(--line-strong);
}

.final-col .bk-tie.upcoming {
  background: linear-gradient(rgba(227, 183, 101, 0.15), rgba(227, 183, 101, 0.15)), rgba(24, 27, 35, 0.96);
  border-color: rgba(227, 183, 101, 0.5);
}

.bk-tie.clickable { cursor: pointer; }

.bk-tie.clickable:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.bk-tie.mine {
  border-color: rgba(227, 183, 101, 0.55);
  box-shadow: inset 2px 0 0 var(--gold);
}

.bk-tie.bk-tbd {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.012);
  opacity: 0.5;
}

.bk-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}

/* the link covers only the crest + name, so the rest of the card (gap + score)
   stays a click target for opening the match. */
.bk-team-link {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 1px 3px;
  margin: -1px -3px;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: inherit;
}

.bk-team-link:hover {
  background: rgba(255, 255, 255, 0.07);
}

.bk-crest {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-flex;
}

.bk-crest canvas { width: 16px; height: 16px; }

.bk-team {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.bk-score {
  flex: 0 0 auto;
  margin-left: auto; /* push right; the gap it opens up is match-click area */
  padding-left: var(--s3);
  min-width: 14px;
  text-align: right;
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* shootout score in brackets, e.g. 0 (4) — same font metrics as the goals
   tally (size, weight, tabular numerals) so the two line up; only the colour
   differs, to mark it as the penalty result. */
.bk-pens {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.bk-row.win .bk-team,
.bk-row.win .bk-score { color: var(--text); font-weight: 700; }

.bk-row.lost .bk-team,
.bk-row.lost .bk-score { color: var(--text-3); }

.bk-bye-tag .bk-team {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* tracing one club's run: its ties pop, the rest fade back */
.cup-bracket.tracing .bk-tie { opacity: 0.3; }
.cup-bracket.tracing .bk-tie.hl { opacity: 1; border-color: rgba(227, 183, 101, 0.7); }
.bk-team-link.hl .bk-team { color: var(--gold); }

@media (max-width: 720px) {
  main#page.cup-full { padding-top: calc(56px + var(--s3)); } /* clear the fixed mobile topbar */
  .bk-col { min-width: 132px; }
  .final-col { min-width: 156px; }
}
