﻿/* ── Board ──────────────────────────────────────────────────────────── */
.tableau-board {
    width: 100%;
    max-width: 100%;
    min-height: 360px;
    overflow: auto;
    padding: 12px 12px 28px;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.tableau-view-pills {
    flex-wrap: wrap;
}

.tableau-view-pill {
    min-width: 92px;
    text-transform: none;
    font-weight: 600;
}

/* ── Bracket ──────────────────────────────────────────────────────────── */
.tableau-bracket-wrap {
    min-width: max-content;
    padding: 8px 12px 24px;
    overflow-x: auto;
}

.tableau-bracket {
    --line-color: var(--mud-palette-dark-lighten);
    --line-width: 2px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: var(--round-gap);
    min-width: max-content;
    min-height: var(--board-min-height);
    position: relative;
}

.tableau-round {
    display: flex;
    flex-direction: column;
    min-height: var(--round-min-height);
    min-width: var(--match-width);
}

.tableau-round-header {
    height: 34px;
    color: var(--mud-palette-primary-lighten);
    font-size: .92rem;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.tableau-round-matches {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: var(--match-gap);
}

.tableau-match-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: var(--match-width);
    height: var(--match-height);
    flex: 0 0 var(--match-height);
}

/* ── Match card ──────────────────────────────────────────────────────────── */
.tableau-match-card {
    position: relative;
    z-index: 2;
    width: var(--match-width);
    height: var(--match-height);
    overflow: hidden;
    border: 1px solid var(--mud-palette-primary-lighten);
    border-radius: 0;
    background: var(--mud-palette-primary-lighten);
    color: #e3e8ef;
    box-shadow: 0 0px 12px rgba(0, 0, 0, .28);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.tableau-match-card--clickable {
    cursor: pointer;
}

    .tableau-match-card--clickable:hover {
        transform: translateY(-2px);
        border: 2px solid var(--mud-palette-info-lighten);
        box-shadow: 0px 0px 12px rgba(0, 0, 0, .38);
    }

    .tableau-match-card--clickable:active {
        transform: translateY(0);
    }

.tableau-match-card--played {
    outline: var(--mud-palette-info-lighten);
    outline-offset: -2px;
}

.tableau-match-card--empty {
    opacity: .38;
}

/* ── Team rows ───────────────────────────────────────────────────────────── */
.tableau-team-row {
    display: grid;
    grid-template-columns: 45px 1fr;
    align-items: center;
    height: 50%;
    min-width: 0;
}

.tableau-team-row--top {
    border-bottom: 1px solid rgba(13, 18, 24, .52);
}

.tableau-team-row--winner {
    background: var(--mud-palette-info-darken);
}

    .tableau-team-row--winner .tableau-team-name {
        color: #ffffff;
        font-weight: 900;
    }

.tableau-team-row--freilos {
    opacity: .35;
    background: repeating-linear-gradient( -45deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .025) 6px, rgba(255, 255, 255, .055) 6px, rgba(255, 255, 255, .055) 12px );
}

.tableau-match-label {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--mud-palette-primary);
    color: #aeb8c7;
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.tableau-team-name {
    min-width: 0;
    padding: 0 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tableau-winner-icon {
    font-size: .86rem;
    flex-shrink: 0;
}

.tableau-match-status {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    color: #8fa0b5;
    font-size: .72rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

/* ── Flexbox-Connectoren ───────────────────────────────────────────────────
   Connector-Prinzip pro Match:
   - nach rechts immer nur bis zur Mitte des Rundenabstands
   - nach links immer von der Mitte des Rundenabstands bis zur Card
   - eine senkrechte Join-Linie wird nur gezeichnet, wenn die nächste Runde
     weniger Matches hat (typisch: halb so viele). */

.tableau-match-lines {
    position: absolute;
    top: 50%;
    width: var(--round-gap);
    pointer-events: none;
    z-index: 1;
}

.tableau-match-lines--right {
    right: calc(var(--round-gap) * -1);
}

.tableau-match-lines--left {
    left: calc(var(--round-gap) * -1);
}

.tableau-line {
    position: absolute;
    display: block;
    background: var(--line-color);
    opacity: .9;
}

.tableau-line--horizontal {
    top: 0;
    height: var(--line-width);
    transform: translateY(-50%);
}

/* Card → Mitte des Abstands */
.tableau-match-lines--right .tableau-line--horizontal {
    left: 0;
    width: 50%;
}

/* Mitte des Abstands → Card */
.tableau-match-lines--left .tableau-line--horizontal {
    left: 50%;
    width: 50%;
}

/* Join exakt in der Mitte zwischen zwei Runden */
.tableau-line--vertical {
    left: calc(50% - (var(--line-width) / 2));
    width: var(--line-width);
    height: var(--connector-height);
}

.tableau-match-shell--branch-down .tableau-match-lines--right .tableau-line--vertical {
    top: 0;
}

.tableau-match-shell--branch-up .tableau-match-lines--right .tableau-line--vertical {
    bottom: 0;
}

.tableau-match-shell--freilos-only .tableau-match-lines,
.tableau-match-card--empty + .tableau-match-status {
    display: none;
}

@media (max-width: 900px) {
    .tableau-bracket {
        --round-gap: 46px;
    }

    .tableau-round {
        min-width: 250px;
    }

    .tableau-match-shell,
    .tableau-match-card {
        width: 250px;
    }
}

