:root {
  --bg: #f4f6fb;
  --ink: #14141a;
  --card: #2b0e3a;
  --card-2: #3a1550;

  --win: #acacac;
  --line: #acacac;

  --match-block: 64px;

  --gap-r16: 110px;
  --gap-qf: 285px;
  --gap-sf: 665px;
  --gap-final: 1170px;
  --gap-mobile: 88px;

  --conn-r16: 114px;
  --conn-qf: 350px;
  --conn-sf: 730px;
  --conn-final: 0px;

  --conn-r16-offset: 100px;
  --conn-qf-offset: 190px;
  --conn-sf-offset: 375px;
  --conn-final-offset: 0px;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, sans-serif;
  background: #fff;
  color: var(--ink);
}

.bracket {
  padding: 28px 16px 44px;
  max-width: 1280px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin: 0 0 24px;
  font-weight: 800;
  letter-spacing: .5px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.round {
  display: flex;
  flex-direction: column;
}

.round-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .7;
  margin: 0 0 70px;
}

/* gaps per columna */
.matches {
  display: flex;
  flex-direction: column;
  gap: var(--gap-r16);
}

.round.quarter .matches {
  gap: var(--gap-qf);
}

.round.semifinal .matches {
  gap: var(--gap-sf);
}

.round.final .matches {
  gap: var(--gap-final);
}

.match {
  position: relative;
  padding-right: 26px;
  height: var(--match-block);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.match-info {
  font-weight: 600;
  font-size: 12px;
  margin-left: 12px;
}

.team {
  background: #bdbdbd;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  margin: 4px 0px 4px 10px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.team.winner {
  background: #f4d905;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff2;
  display: inline-block;
}

.logo img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 50%;
}

/* connectors */
.connector {
  position: absolute;
  right: 0;
  top: calc(50% + var(--conn-r16-offset));
  width: 26px;
  height: 1px;
  background: var(--line);
}

.connector:after {
  content: "";
  position: absolute;
  right: -26px;
  top: calc(var(--conn-r16) / -2);
  width: 26px;
  height: var(--conn-r16);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.round.quarter .connector {
  top: calc(50% + var(--conn-qf-offset));
}

.round.quarter .connector:after {
  top: calc(var(--conn-qf) / -2);
  height: var(--conn-qf);
}

.round.semifinal .connector {
  top: calc(50% + var(--conn-sf-offset));
}

.round.semifinal .connector:after {
  top: calc(var(--conn-sf) / -2);
  height: var(--conn-sf);
}

.round.final .connector {
  display: none;
}

/* amaga un connector de cada dos */
.matches .match:nth-child(even) .connector {
  display: none;
}

/* offsets per columna (aplicat als partits, no al títol) */
.round.quarter .matches {
  margin-top: calc((var(--match-block) + var(--gap-r16)) / 2);
}

.round.semifinal .matches {
  margin-top: calc((var(--match-block) + var(--gap-sf)) / 3);
}

.round.final .matches {
  margin-top: calc((var(--match-block) + var(--gap-final)) / 2);
}

/* Responsive */
@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .round.quarter .matches,
  .round.semifinal .matches,
  .round.final .matches {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns:1fr;
    gap: 16px;
  }

  .matches {
    gap: var(--gap-mobile);
  }

  .round.quarter .matches,
  .round.semifinal .matches,
  .round.final .matches {
    gap: var(--gap-mobile);
  }

  .connector, .connector:after {
    display: none;
  }

  /* separació de fases en mòbil */
  .round-title {
    margin-top: 24px;
  }

  .round:first-child .round-title {
    margin-top: 0;
  }
}