/* Tournament Container */
#tournament-viewport {
    overflow: auto;
    background-color: #0a1118;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #333;
}

#tournament-bracket {
    display: flex;
    gap: 50px;
    align-items: flex-start;
    min-width: fit-content;
    position: relative;
    --match-height: 110px;
    --match-gap: 50px;
}

/* Round */
.round {
    display: flex;
    flex-direction: column;
    gap: var(--match-gap, 50px);
    min-width: 220px;
}

/* This wrapper is for matches in round 2+ */
.match-wrapper {
    display: flex;
    align-items: center; /* This centers the match vertically */
}

.round-title {
    color: #ECE8E1;
    font-size: 1.5rem;
    text-align: center;
    text-transform: uppercase;
}

/* Match */
.match {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #1a2838;
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    width: 100%; /* Make match fill its wrapper */
    height: var(--match-height);
}

/* Add incoming connector line for later rounds */
.round-later .match::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 25px; /* Same as the horizontal part of the outgoing connector */
    height: 2px;
    background-color: #333;
}
/* Highlight incoming line if source match has a winner */
.round-later .match.from-top-winner::before,
.round-later .match.from-bottom-winner::before {
    background-color: #FD4556;
}


.match-body {
    position: relative;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow this to fill the available space in .match */
    justify-content: center; /* Center the teams vertically */
    gap: 5px; /* Add a small gap between teams */
}

.match-id {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    margin-bottom: 5px;
}

.team {
    padding: 8px 12px;
    background-color: #0F1923;
    color: #ECE8E1;
    border-radius: 2px;
    transition: background-color 0.2s;
    min-height: 40px;
    display: flex;
    align-items: center;
    font-family: sans-serif;
    position: relative; /* For edit button positioning */
    cursor: pointer; /* Add back for better UX */
}

.team.winner {
    background-color: #FD4556;
    font-weight: bold;
}

.team:first-child {
    /* This margin is no longer needed with justify-content */
}

.team:hover:not(.winner) {
    background-color: #2c3e50;
}

.team-name-input {
    background: transparent;
    border: none;
    color: inherit;
    width: 100%;
    height: 100%;
    padding: 0;
    font-size: 1rem;
    padding-right: 25px; /* Space for edit button */
}

.team-name-input[readonly] {
    cursor: pointer;
}

.team-name-input:focus {
    outline: 1px solid #FD4556;
}

.edit-team-name-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
}
.edit-team-name-btn:hover {
    color: #ECE8E1;
}

/* --- New Connector Styles (JS-driven) --- */
#connector-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.connector-line {
    position: absolute;
    background-color: #333;
}

.connector-line.winner-line {
    background-color: #FD4556;
    z-index: 1;
} 