/* Round spacing follows the field size; the 32-team layout keeps its geometry. */
.bracket-tree.bracket-size-16 {
  grid-template-columns: repeat(7, 178px);
  width: 1246px;
}

.bracket-size-16 .bracket-round-1 .bracket-round-games {
  grid-template-rows: repeat(4, 1fr);
}

.bracket-size-16 .bracket-round-2 .bracket-round-games {
  grid-template-rows: repeat(2, 1fr);
}

.bracket-size-16 .bracket-round-3 .bracket-round-games,
.bracket-size-16 .bracket-championship .bracket-round-games {
  grid-template-rows: 1fr;
}

.bracket-size-16 .bracket-round-1 {
  --connector-height: 180px;
}

.bracket-size-16 .bracket-round-2 {
  --connector-height: 360px;
}

/* The semifinal feeds the championship directly, without a paired game. */
.bracket-tree .bracket-semifinal .tree-game:nth-child(odd)::before {
  content: none;
}

.bracket-tree .bracket-semifinal .tree-game::after {
  background: linear-gradient(90deg, var(--cyan), var(--gold), var(--green));
}

/* Championship styling cannot depend on a fixed round number. */
.bracket-championship .bracket-round-title {
  justify-content: center;
  gap: 7px;
  margin: 0 8px;
  border-color: var(--gold);
  background: linear-gradient(180deg, #372d17, #16130b);
  color: #fff0bd;
  text-align: center;
  box-shadow: 0 8px 24px rgba(255, 202, 87, .1);
}

.bracket-championship .tree-game {
  border-color: var(--gold);
  background: linear-gradient(145deg, #2d2717, #15130c);
  box-shadow: 0 0 35px rgba(255, 202, 87, .18);
}

.bracket-championship .tree-seed {
  border-color: rgba(255, 202, 87, .35);
  color: var(--gold);
}

.bracket-championship .final-match {
  width: 170px;
  margin-left: -4px;
  border: 2px solid var(--gold);
  border-radius: 13px;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 202, 87, .22), transparent 55%),
    linear-gradient(145deg, #342b16, #14110a);
  box-shadow:
    0 0 0 4px rgba(255, 202, 87, .06),
    0 0 42px rgba(255, 202, 87, .28),
    0 15px 30px rgba(0, 0, 0, .45);
}

.bracket-championship .final-match .tree-team {
  min-height: 38px;
  padding-inline: 9px;
}

.bracket-championship .final-match .tree-name {
  font-size: 11px;
}

.bracket-championship .final-match .tree-game-number {
  top: -10px;
  right: 50%;
  transform: translateX(50%);
  border-color: rgba(255, 202, 87, .28);
  color: var(--gold);
}

.scoring-grid.bracket-scoring-16 {
  grid-template-columns: repeat(4, 1fr);
}

@media (orientation: landscape) and (max-height: 600px) {
  .bracket-tree.bracket-size-16 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
  }

  .bracket-size-16 .bracket-round-1 {
    --connector-height: 125px;
  }

  .bracket-size-16 .bracket-round-2 {
    --connector-height: 250px;
  }

  .bracket-championship .bracket-round-title {
    gap: 2px;
    margin-inline: 3px;
  }

  .bracket-championship .final-match {
    width: calc(100% - 2px);
    margin-left: 1px;
    border-width: 1px;
    border-radius: 7px;
    box-shadow: 0 0 15px rgba(255, 202, 87, .22);
  }

  .bracket-championship .final-match .tree-team {
    min-height: 25px;
    padding-inline: 3px;
  }

  .bracket-championship .final-match .tree-name {
    font-size: 6px;
  }
}
