/* Tournament bracket */

/* ── Viewport / scroll container ── */
.bracket-viewport {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
    padding: 1rem 24px;
}

.bracket-scroll {
    overflow-x: auto;
    padding: 1.5rem 0.5rem;
}

/* ── Bracket layout ── */
.bracket {
    display: inline-flex;
    align-items: flex-start;
}

.bracket-split {
    display: inline-flex;
    align-items: flex-start;
    transform-origin: top left;
}

.bracket-mirrored { transform: scaleX(-1); }
.bracket-mirrored .match-card,
.bracket-mirrored .round-header { transform: scaleX(-1); }

/* ── Round column ── */
.round-col {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.round-header {
    text-align: center;
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.05em;
    height: 24px;
    line-height: 24px;
}

.round-header.finals-header {
    color: #d4af37;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

/* ── Match slot ── */
.match-slot {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ── Match card ── */
.match-card {
    border: 1px solid #242430;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #12121a;
    width: var(--card-w, 170px);
    flex-shrink: 0;
}

.match-card.has-winner { border-color: #374151; }

.match-card.finals-card {
    border: 1.5px solid #b8860b;
    background: linear-gradient(165deg, #1a1714 0%, #12121a 40%, #1a1714 100%);
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.12), inset 0 0 30px rgba(212, 175, 55, 0.03);
}

.match-card.finals-card .match-team {
    font-size: 0.82rem;
    padding: 0.4rem 0.6rem;
}

.match-card.finals-card .match-status.final {
    color: #d4af37;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
}

/* ── Match team row ── */
.match-team {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
}

.match-team + .match-team { border-top: 1px solid #242430; }
.match-team.winner { background: rgba(34, 197, 94, 0.08); }
.match-team.winner .team-name { color: #fff; font-weight: 600; }
.match-team.loser { opacity: 0.45; }

/* ── Team elements ── */
.team-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.team-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #d1d5db;
}

.team-score {
    font-family: 'Oswald', sans-serif;
    font-size: 0.82rem;
    color: #9ca3af;
    min-width: 1.4rem;
    text-align: right;
    flex-shrink: 0;
}

.match-team.winner .team-score { color: #4ade80; }

/* ── Match status ── */
.match-status {
    text-align: center;
    padding: 0.12rem;
    font-size: 0.52rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Oswald', sans-serif;
}

.match-status.final   { color: #4ade80; }
.match-status.pending { color: #4b5563; }

/* ── Finals label ── */
.finals-label {
    text-align: center;
    font-family: 'Oswald', sans-serif;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #d4af37;
    margin-bottom: 4px;
    opacity: 0.7;
}

/* ── Clickable match card links ── */
a.match-card-link { text-decoration: none; color: inherit; display: block; flex-shrink: 0; }
a.match-card-link .match-card { cursor: pointer; transition: border-color 0.15s; }
a.match-card-link:hover .match-card { border-color: #f97316; }

/* ── Connector lines ── */
.conn {
    flex-shrink: 0;
    position: relative;
    width: var(--conn-w, 16px);
    min-width: var(--conn-w, 16px);
}

.conn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 2px solid #374151;
}

/* ── Merge column ── */
.merge-col { display: flex; flex-direction: column; flex-shrink: 0; }

.merge-unit { position: relative; flex-shrink: 0; width: var(--merge-w, 18px); }

.merge-unit::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    border-left: 2px solid #374151;
}

.merge-unit::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 2px solid #374151;
}

/* ── Champion banner ── */
.champion-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}

/* ── View toggle ── */
.view-toggle {
    display: inline-flex;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #242430;
}

.view-toggle button {
    padding: 0.3rem 0.7rem;
    font-size: 0.7rem;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
    color: #6b7280;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.view-toggle button.active { background: #242430; color: #fff; }
.view-toggle button:hover:not(.active) { color: #9ca3af; }

/* ── Mobile ── */
@media (max-width: 640px) {
    .bracket-viewport { padding: 0.5rem 8px; }
    .round-header { font-size: 0.6rem; }
    .match-team { font-size: 0.65rem; padding: 0.25rem 0.35rem; }
    .team-score { font-size: 0.7rem; }
    .match-status { font-size: 0.45rem; }
}
