/* SVG Bracket — high-performance alternative renderer */

/* ───── shell (scroll container) ───── */
.svg-bracket-shell {
  position: relative;
  width: 100%;
  /* JS sets exact height in svgBracket.initialize();
     this is a safe fallback if JS hasn't run yet */
  height: calc(100vh - 270px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: none;
  cursor: grab;
  background: #f8fafc;
}

.svg-bracket-shell.grabbing {
  cursor: grabbing;
}

/* ───── the <svg> itself ───── */
#svgBracket {
  display: block;
}

/* ═══════════════════════════════════════
   MATCH CARD (inside foreignObject)
   ═══════════════════════════════════════ */
.svg-match-card {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: .45rem .65rem;
  border-radius: .6rem;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: .78rem;
  user-select: none;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  transition: box-shadow .15s ease;
}

.svg-match-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.08);
}

/* ── Bracket color themes ── */
.svg-match-card.bracket-winner {
  background: #eff6ff;
  border: 2px solid #93c5fd;
}
.svg-match-card.bracket-loser {
  background: #fef2f2;
  border: 2px solid #fca5a5;
}
.svg-match-card.bracket-final {
  background: #fffbeb;
  border: 2px solid #fcd34d;
}

/* ── State modifiers ── */
.svg-match-card.state-finished {
  opacity: .75;
}
.svg-match-card.state-finished:hover {
  opacity: 1;
}
.svg-match-card.state-bye {
  opacity: .55;
  border-style: dashed;
}
.svg-match-card.state-ready {
  box-shadow: 0 0 0 2px rgba(37,99,235,.25), 0 1px 3px rgba(0,0,0,.08);
}

/* ═══════════════════════════════════════
   CARD INTERNALS
   ═══════════════════════════════════════ */

/* ── Header ── */
.svg-match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  margin-bottom: .25rem;
  flex-shrink: 0;
}

.svg-clickable {
  cursor: pointer;
  border-radius: .25rem;
  padding: .15rem .25rem;
  margin: -.15rem -.25rem .25rem;
  transition: background .15s;
}
.svg-clickable:hover {
  background: rgba(0,0,0,.06);
}

.svg-match-label {
  font-weight: 700;
  font-size: .72rem;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svg-bracket-badge {
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .1rem .35rem;
  border-radius: .25rem;
  text-transform: uppercase;
  flex-shrink: 0;
  line-height: 1.3;
}
.svg-bracket-badge.bracket-winner {
  background: #2563eb;
  color: #fff;
}
.svg-bracket-badge.bracket-loser {
  background: #dc2626;
  color: #fff;
}
.svg-bracket-badge.bracket-final {
  background: #d97706;
  color: #fff;
}

/* ── Source labels ── */
.svg-match-sources {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .6rem;
  color: #9ca3af;
  margin-bottom: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.svg-match-sources span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.svg-source-sep {
  color: #d1d5db;
}

/* ── Players ── */
.svg-match-players {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1;
  justify-content: center;
  min-height: 0;
}

.svg-player-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 500;
  padding: .2rem .5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .3rem;
  line-height: 1.3;
}

.svg-player-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svg-score {
  font-weight: 700;
  font-size: .72rem;
  color: #374151;
  flex-shrink: 0;
}

.svg-win-btn {
  font-size: .6rem;
  font-weight: 700;
  padding: .1rem .4rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: .25rem;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.svg-win-btn:hover {
  background: #1d4ed8;
}

.svg-player-row.slot-winner {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  font-weight: 700;
}
.svg-player-row.slot-loser {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
  opacity: .65;
  text-decoration: line-through;
}

.svg-vs-text {
  font-size: .55rem;
  color: #9ca3af;
  font-weight: 600;
  text-align: center;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Bye ── */
.svg-match-bye {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  flex: 1;
}
.svg-bye-player {
  font-size: .72rem;
  font-weight: 600;
  color: #374151;
}
.svg-bye-label {
  font-size: .6rem;
  font-weight: 700;
  color: #9ca3af;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── Trophy ── */
.svg-trophy {
  font-size: .65rem;
  margin-right: .2rem;
}

/* ── Destinations ── */
.svg-match-destinations {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  font-size: .55rem;
  margin-top: auto;
  padding-top: .15rem;
  border-top: 1px solid rgba(0,0,0,.06);
  flex-shrink: 0;
}

.svg-dest-winner {
  color: #2563eb;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.svg-dest-loser {
  color: #dc2626;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ───── zoom slider ───── */
.svg-zoom-ui {
  position: fixed;
  top: .5rem;
  right: .5rem;
  z-index: 1000;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  font: 13px/1 "Segoe UI", system-ui, sans-serif;
  padding: .35rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #6b7280;
}

.svg-zoom-ui input {
  width: 7rem;
  accent-color: #2563eb;
}

.svg-zoom-ui span {
  min-width: 3.5ch;
  text-align: right;
  font-weight: 600;
  color: #374151;
}

/* ───── state pill ───── */
.svg-state-pill {
  font-size: .5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .08rem .3rem;
  border-radius: .75rem;
  line-height: 1;
  white-space: nowrap;
}
.svg-state-pending  { background: #f3f4f6; color: #6b7280; }
.svg-state-ready    { background: #dbeafe; color: #1d4ed8; }
.svg-state-inprogress,
.svg-state-in\ progress { background: #fef3c7; color: #92400e; }
.svg-state-finished { background: #d1fae5; color: #065f46; }

/* ───── review badge ───── */
.svg-review-badge {
  font-size: .6rem;
  color: #d97706;
  cursor: help;
  flex-shrink: 0;
}

/* ───── slot label ───── */
.svg-slot-label {
  font-size: .5rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #9ca3af;
  margin-right: .2rem;
}

/* ───── score summary ───── */
.svg-score-summary {
  font-size: .55rem;
  color: #6b7280;
  text-align: center;
  padding-top: .15rem;
  border-top: 1px dashed #e5e7eb;
  margin-top: .1rem;
}
