/* Section "bracket": Der Weg zum Titel. Prefix: .bk- */

.bk-head { max-width: 46rem; }
.bk-lead { margin: 0; }
.bk-lead strong { color: var(--gold); font-weight: 700; }

/* ---------- Flow: 16 → 8 → 4 → 2 → 1 ---------- */
.bk-flow {
  list-style: none; margin: clamp(2rem, 5vw, 3rem) 0 clamp(2.5rem, 6vw, 4rem); padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem;
  max-width: 58rem;
}
.bk-flow-step {
  position: relative; display: grid; justify-items: start; align-content: start; gap: .35rem;
  padding: .9rem .15rem 0; border-top: 2px solid var(--line2); min-width: 0;
}
.bk-flow-step:not(:last-child)::after {
  /* chevron towards the next step */
  content: ''; position: absolute; top: -6px; right: .3rem; width: 10px; height: 10px;
  border-top: 2px solid var(--line2); border-right: 2px solid var(--line2); transform: rotate(45deg);
}
.bk-flow-n { font: 900 clamp(1.8rem, 6.5vw, 3.6rem)/1 var(--font-display); color: var(--ink); letter-spacing: -.02em; }
.bk-flow-l { font: 700 clamp(.56rem, 1.7vw, .74rem)/1.25 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); hyphens: manual; overflow-wrap: anywhere; }
.bk-flow-step--champ { border-top-color: var(--gold); }
.bk-flow-step--champ .bk-flow-n { color: var(--gold); text-shadow: 0 0 24px rgb(var(--gold-rgb) / .3); }
.bk-flow-step:nth-child(4) { border-top-color: color-mix(in srgb, var(--primary) 60%, var(--line2)); }

/* ---------- Tree (mobile first: rounds stacked) ---------- */
.bk-tree {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "qf" "semi" "final" "champ" "third";
  row-gap: 2.6rem;
}
.bk-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.bk-col { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; }
.bk-col--qf { grid-area: qf; }
.bk-col--semi { grid-area: semi; }
.bk-col--final { grid-area: final; }
.bk-col--champ { grid-area: champ; }
.bk-col--third { grid-area: third; margin-top: .4rem; }
.bk-slot { display: grid; justify-items: center; min-width: 0; }

.bk-round {
  margin: 0 0 .8rem; font: 700 .72rem/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.bk-col--final .bk-round { color: var(--gold); }
.bk-col--final .bk-round, .bk-col--third .bk-round { text-align: center; }

/* Mobile: the two quarter-finals that feed one semi stack in one column. */
.bk-qfs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto; grid-auto-flow: column; gap: .6rem; }
.bk-semis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }

.bk-match {
  padding: .6rem; border-radius: var(--r); min-width: 0;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color .5s, box-shadow .5s, opacity .3s;
}
.bk-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem .6rem;
  margin: 0 .15rem .5rem; font-size: .64rem; letter-spacing: .05em; color: var(--dim);
}
.bk-meta span:first-child { color: var(--muted); font-weight: 700; }
.bk-teams { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.bk-team {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .45rem;
  padding: .45rem .5rem; border-radius: .6rem; background: var(--panel);
  transition: background .5s, box-shadow .3s;
}
.bk-g {
  display: grid; place-items: center; min-width: 1.6rem; height: 1.35rem; padding: 0 .2rem; border-radius: .4rem;
  background: var(--c); color: var(--on-group); font: 800 .64rem/1 var(--font);
}
.bk-name {
  padding: 0; border: 0; background: none; cursor: pointer; text-align: left; min-width: 0;
  font: 600 .84rem/1.2 var(--font); color: var(--text); overflow-wrap: anywhere;
  text-decoration: underline 1px transparent; text-underline-offset: .2em; transition: text-decoration-color .2s, color .3s;
}
.bk-name:hover, .bk-name[aria-pressed="true"] { text-decoration-color: var(--c); }
.bk-score { font-size: .95rem; font-weight: 500; color: var(--muted); min-width: 1ch; text-align: right; font-variant-numeric: tabular-nums; }
.bk-team.is-win { background: rgb(var(--primary-rgb) / .07); box-shadow: inset 0 0 0 1px rgb(var(--primary-rgb) / .22); }
.bk-team.is-win .bk-name { color: var(--ink); font-weight: 800; }
.bk-team.is-win .bk-score { color: var(--primary); font-weight: 800; }

/* Champion's path in gold. */
.bk-match.is-path { border-color: rgb(var(--gold-rgb) / .35); }
.bk-team.is-champ .bk-name { color: var(--gold); }
.bk-team.is-champ.is-win { background: rgb(var(--gold-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--gold-rgb) / .3); }
.bk-team.is-champ.is-win .bk-score { color: var(--gold); }

.bk-match--final { border-color: rgb(var(--gold-rgb) / .45); box-shadow: 0 0 50px -20px rgb(var(--gold-rgb) / .35); }
.bk-match--third .bk-team.is-win { background: rgb(var(--bronze-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--bronze-rgb) / .28); }
.bk-match--third .bk-team.is-win .bk-score { color: var(--bronze); }
.bk-round--small { color: var(--bronze) !important; }

.bk-champ {
  position: relative; text-align: center; padding: 1.3rem 1.1rem 1.2rem; border-radius: var(--r-lg);
  border: 1px solid rgb(var(--gold-rgb) / .4);
  background: radial-gradient(120% 90% at 50% 0%, rgb(var(--gold-rgb) / .12), var(--bg2) 70%);
  box-shadow: 0 0 60px -16px rgb(var(--gold-rgb) / .3);
  transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease), box-shadow .8s;
}
.bk-champ-icon { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: rgb(var(--gold-rgb) / .12); color: var(--gold); margin-bottom: .55rem; }
.bk-champ-icon svg { margin: 0 auto; }
.bk-champ-k { margin: 0; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.bk-champ-name { margin: .35rem 0 .3rem; font: 900 clamp(1.45rem, 2.6vw, 1.9rem)/1.08 var(--font-display); color: var(--gold); text-shadow: 0 0 20px rgb(var(--gold-rgb) / .25); }
.bk-champ-sub { margin: 0; font-size: .85rem; color: var(--muted); }

/* Mobile sizing */
.bk-slot > .bk-match { width: min(100%, 24rem); }
.bk-slot > .bk-champ { width: min(100%, 20rem); }

@media (min-width: 560px) {
  .bk-match { padding: .75rem; }
  .bk-name { font-size: .9rem; }
  .bk-qfs, .bk-semis { gap: .8rem; }
}

/* ---------- Desktop: four columns left to right, Platz 3 under the final ---------- */
@media (min-width: 960px) {
  .bk-tree {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .82fr);
    grid-template-areas: "qf semi final champ" ". . third .";
    column-gap: clamp(2.2rem, 4vw, 4rem); row-gap: 1.4rem;
  }
  .bk-qfs { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; gap: 1.1rem; }
  /* A little more air between the two pairs that feed different semis. */
  .bk-qfs > :nth-child(2) { margin-bottom: .9rem; }
  .bk-semis { flex: 1; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr 1fr; gap: 0; }
  .bk-semis > .bk-match { align-self: center; }
  .bk-col--final > .bk-slot, .bk-col--champ > .bk-slot { flex: 1; align-content: center; }
  .bk-col--champ { padding-top: 1.52rem; } /* = height of the round labels */
  .bk-col--final .bk-round, .bk-col--third .bk-round { text-align: left; }
  .bk-slot { justify-items: stretch; }
  .bk-slot > .bk-match, .bk-slot > .bk-champ { width: 100%; }
  .bk-col--third { margin-top: .6rem; }
}

/* SVG connectors: geometry by js/bracket.js. */
.bk-track { fill: none; stroke: var(--line2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bk-path { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.bk-path--accent { stroke: var(--primary); filter: drop-shadow(0 0 4px rgb(var(--primary-rgb) / .5)); }
.bk-path--gold { stroke: var(--gold); stroke-width: 3; filter: drop-shadow(0 0 5px rgb(var(--gold-rgb) / .5)); }

/* Scroll choreography: only once JS armed the tree (never without JS / reduced motion). */
.bk-armed .bk-champ:not(.is-lit) { opacity: .35; filter: saturate(.3); transform: scale(.96); box-shadow: none; }
.bk-armed .bk-match--final:not(.is-lit) { border-color: var(--line); box-shadow: none; }
.bk-armed .bk-match:not(.bk-match--third) .bk-team.is-win:not(.is-lit) { background: var(--panel); box-shadow: none; }

/* Team highlight (sp:team) */
.bk-has-sel .bk-match:not(.has-sel) { opacity: .45; }
.bk-team.is-sel { box-shadow: 0 0 0 2px var(--c) !important; }
.bk-champ.is-sel { outline: 2px solid var(--primary); outline-offset: 4px; }

.bk-note { margin: 2rem 0 0; font-size: .82rem; color: var(--dim); max-width: 40rem; }
