/* bracket.css — Match-Karten und Bracket-Grid */

.bracket-wrapper {
  overflow-x: auto;
  padding: var(--space-3) 0;
}
.bracket {
  --bracket-gap: 24px;
  display: flex;
  gap: var(--bracket-gap);
  min-width: max-content;
}
.bracket-col {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  gap: 10px;
}
.bracket-col-title {
  flex: 0 0 auto;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--deep);
  font-weight: 900;
  letter-spacing: 1.5px;
  opacity: 0.55;
  margin-bottom: 2px;
}

/* Bracket tree: connects rounds with bridge lines instead of floating cards.
   .bracket-tree fills the column's remaining height; each .bracket-pair holds the
   matches that feed one match in the next round and draws the bridge via ::after.
   flex: 1 1 auto (NOT 1 1 0) — a 0 basis stops the pairs contributing height and the
   bracket collapses. */
.bracket-tree {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.bracket-pair {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  position: relative;
}
.bracket-pair::after {
  content: '';
  position: absolute;
  top: 25%;
  bottom: 25%;
  right: calc(-1 * var(--bracket-gap));
  width: var(--bracket-gap);
  border: 2px solid rgba(29,53,87,0.25);
  border-left: none;
  border-radius: 0 8px 8px 0;
  pointer-events: none;
}
.bracket-section-label {
  font-weight: 900;
  margin: 18px 0 8px;
  color: var(--coral);
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Match-Card Basis */
.match-card {
  background: white;
  border: 3px solid var(--deep);
  border-radius: var(--radius-card);
  padding: 10px 12px;
  min-width: 180px;
  position: relative;
  box-shadow: 4px 4px 0 var(--sun);
  transition: transform 0.05s;
}
.match-card:hover { transform: translate(-1px, -1px); }

/* States */
.match-card.confirmed { border-color: var(--deep); box-shadow: 4px 4px 0 var(--sun); }
.match-card.reported { border-color: var(--sun); border-width: 4px; box-shadow: 4px 4px 0 var(--coral); }
.match-card.pending  { border-color: var(--deep); }
.match-card.waiting  {
  border-color: var(--sand);
  border-style: dashed;
  background: rgba(244,241,222,0.5);
  box-shadow: none;
}
.match-card.cancelled { opacity: 0.4; border-color: var(--sand); box-shadow: none; }

/* AKTUELL-Badge (zuletzt gemeldetes Match) */
.match-card .latest-badge {
  position: absolute;
  top: -10px;
  right: 8px;
  background: var(--coral);
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.match-card .round-mini {
  position: absolute;
  top: -10px;
  left: 8px;
  background: var(--deep);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
}

/* FELD-Badge (welches Spielfeld) — spiegelt latest-badge auf der linken Ecke, damit man
   eine Live-Karte auf einen Blick dem physischen Feld zuordnen kann. Jede Feldnummer hat
   eine feste Akzentfarbe (auch im Ticker), sodass "Feld 2" überall gleich aussieht. */
.match-card .field-badge {
  position: absolute;
  top: -10px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--deep);
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.match-card .field-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  background: currentColor;
}
.field-badge.field-1 { background: var(--ocean); }
.field-badge.field-2 { background: var(--coral); }
.field-badge.field-3 { background: var(--sun); color: var(--deep); }
.field-badge.field-4 { background: var(--deep); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.45); }
/* Spielfeld-Zuweisung */
.match-card .spielfeld-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.match-card .spielfeld-badge,
.group-match .spielfeld-badge,
.ko-match .spielfeld-badge {
  background: var(--sun);
  color: var(--deep);
  font-size: 10px;
  font-weight: 900;
  border-radius: 3px;
  padding: 1px 6px;
  letter-spacing: 0.5px;
}

/* Match-Team-Zeilen */
.match-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px;
  font-weight: 800;
  color: var(--deep);
  font-size: 14px;
}
.match-team + .match-team { border-top: 1px dashed rgba(29,53,87,0.1); margin-top: 2px; }
.match-team.winner { font-weight: 900; }
.match-team.winner .team-score { color: var(--coral); font-size: 18px; font-weight: 900; }
.match-team.loser { opacity: 0.6; }
.match-team.empty { color: rgba(29,53,87,0.3); font-style: italic; font-weight: 600; }
.match-team.mine { background: rgba(230, 57, 70, 0.12); border-radius: 4px; }
.match-team.mine .team-name { font-weight: 900; color: var(--coral); }
.match-team .team-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.match-team .team-score {
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 900;
}

/* === Grand Final Hervorhebung === */
.match-card.grand-final {
  border-color: var(--sun);
  border-width: 4px;
  box-shadow: 5px 5px 0 var(--coral);
  background: linear-gradient(180deg, #FFFBEC 0%, white 100%);
}
.match-card.grand-final .gf-label {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sun);
  color: var(--deep);
  padding: 3px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 2px solid var(--deep);
}
.match-card.grand-final.confirmed .match-team.winner .team-score { color: var(--coral); }
.match-card.grand-final.cancelled .gf-label { background: var(--sand); border-color: var(--sand); color: rgba(29,53,87,0.5); }

/* TV-Mode: Grand Final noch fetter */
body.tv-mode .match-card.grand-final {
  border-color: var(--sun);
  border-width: 5px;
  box-shadow: 8px 8px 0 var(--coral);
  background: linear-gradient(180deg, #FFF8DC 0%, white 100%);
  transform: scale(1.05);
}
body.tv-mode .match-card.grand-final .gf-label {
  font-size: 15px;
  padding: 4px 16px;
  top: -18px;
  letter-spacing: 2px;
}

/* Finals-focused layout (single-elim + double-elim GF slide) */
.finals-focus { display: flex; align-items: center; justify-content: center; gap: 28px; }
.ff-col { display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.ff-col-title { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; opacity: 0.55; text-align: center; }
.ff-col--early { --ff-w: 150px; }
.ff-col--semi  { --ff-w: 190px; }
.ff-col--final { --ff-w: 240px; }
.ff-col .match-card { width: var(--ff-w); }
.ff-col--final .ff-col-title { color: var(--coral); opacity: 1; font-size: 13px; }
.ff-col--final .match-card { border-color: var(--sun); border-width: 4px; box-shadow: 5px 5px 0 var(--coral); }
.ff-col--final .match-team .team-name { font-size: 17px; }
