/* Bracket Placeholder and Loading */
.bracket-placeholder {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    color: #333;
    font-family: 'Arial', sans-serif;
}

.bracket-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.bracket-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    color: #333;
    font-family: 'Arial', sans-serif;
    /* CSS custom properties for dynamic round widths */
    --round-width: 180px;
    --round-gap: 40px;
}

.bracket-header {
    text-align: center;
    margin-bottom: 10px;
}

.bracket-title {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #333;
}

.bracket-shared-notice {
    color: #666;
    font-style: italic;
    margin: 0;
}

.bracket-shared-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.bracket-create-own-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    position: relative;
    overflow: hidden;
    min-width: 180px;
}

.bracket-create-own-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.bracket-create-own-btn:hover {
    background: linear-gradient(135deg, #005a87, #004066);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
    color: white;
    text-decoration: none;
}

.bracket-create-own-btn:hover:before {
    left: 100%;
}

.bracket-wrapper {
    overflow-x: auto;
    padding: 20px 0;
    /* Improve scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 transparent;
}

/* Custom scrollbar for webkit browsers */
.bracket-wrapper::-webkit-scrollbar {
    height: 6px;
}

.bracket-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.bracket-wrapper::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.bracket-wrapper::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.bracket {
    display: flex;
    gap: var(--round-gap);
    align-items: center;
    justify-content: center;
}

/* When horizontal scrolling is needed, align to start instead of center */
.bracket.scroll-needed {
    justify-content: flex-start;
}

.round {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: var(--round-width);
    width: var(--round-width);
    position: relative;
}



/* Round spacing adjustments */
.round-1 {
    gap: 20px;
}

.round-2 {
    gap: 120px; /* Gap to space matchups properly for bracket structure */
}

.round-3 {
    gap: 260px; /* Larger gap for fewer matchups */
}

.round-4 {
    gap: 540px; /* Even larger gap for bracket structure */
}

.round-5, .round-final {
    justify-content: center;
}

/* Desktop positioning adjustments for 32-team brackets (5 rounds) - ORIGINAL VALUES */
[data-total-rounds="5"] .round-2 .matchup:nth-child(1) {
    transform: translateY(-75px); /* Move first match up more */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(2) {
    transform: translateY(-50px); /* Move second match up */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(3) {
    transform: translateY(-15px); /* Move third match up slightly */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(4) {
    transform: translateY(-3px); /* Move fourth match up slightly */
}

/* 5th match stays in center - no adjustment needed */

[data-total-rounds="5"] .round-2 .matchup:nth-child(6) {
    transform: translateY(25px); /* Move sixth match down slightly */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(7) {
    transform: translateY(50px); /* Move seventh match down slightly */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(8) {
    transform: translateY(80px); /* Move eighth match down */
}

/* Desktop positioning adjustments for 32-team TWO-SIDED brackets (5 rounds) */
.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(1) {
    transform: translateY(-35px); /* Move first match up more (moved down 40px total) */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(2) {
    transform: translateY(-15px); /* Move second match up (moved down 35px total) */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(3) {
    transform: translateY(15px); /* Move third match up slightly (moved down 30px) */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(4) {
    transform: translateY(34px); /* Move fourth match up slightly (moved down 30px) */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(5) {
    transform: translateY(30px); /* 5th match moved down 30px from center */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(6) {
    transform: translateY(55px); /* Move sixth match down slightly (moved down 30px) */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(7) {
    transform: translateY(80px); /* Move seventh match down slightly (moved down 30px) */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(8) {
    transform: translateY(110px); /* Move eighth match down (moved down 30px) */
}

/* Desktop positioning adjustments for 32-team two-sided brackets Round 3 */
.bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(1) {
    transform: translateY(-60px); /* Move first match down 100px */
}

.bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(2) {
    transform: translateY(60px); /* Move second match down 60px */
}

/* Desktop vertical line adjustments for 32-team brackets */
[data-total-rounds="5"] .round-2 .matchup:nth-child(1)::after {
    height: 245px; /* Adjusted for repositioned first match (moved up more) */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(3)::after {
    height: 232px; /* Adjusted for repositioned third match */
}

/* Add vertical lines for additional matches in 32-team brackets */
[data-total-rounds="5"] .round-2 .matchup:nth-child(5)::after,
[data-total-rounds="5"] .round-2 .matchup:nth-child(7)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 245px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px);
}

/* Desktop positioning adjustments for round 3 in 32-team brackets (5 rounds) */
[data-total-rounds="5"] .round-3 .matchup:nth-child(1) {
    transform: translateY(-190px); /* Move first match up */
}

[data-total-rounds="5"] .round-3 .matchup:nth-child(2) {
    transform: translateY(-60px); /* Move second match up slightly */
}

/* 3rd and 4th matches stay closer to center */
[data-total-rounds="5"] .round-3 .matchup:nth-child(3) {
    transform: translateY(60px); /* Move third match down slightly */
}

[data-total-rounds="5"] .round-3 .matchup:nth-child(4) {
    transform: translateY(180px); /* Move fourth match down */
}

/* Desktop vertical line adjustments for round 3 in 32-team brackets */
[data-total-rounds="5"] .round-3 .matchup:nth-child(1)::after {
    height: 240px; /* Adjusted for repositioned first match in round 3 */
}

[data-total-rounds="5"] .round-3 .matchup:nth-child(3)::after {
    height: 480px; /* Adjusted for repositioned third match in round 3 */
    top: 288px;
}

/* Ensure OUT lines for matches 2 and 4 in round 3 for 32-team brackets */
[data-total-rounds="5"] .round-3 .matchup:nth-child(2)::after,
[data-total-rounds="5"] .round-3 .matchup:nth-child(4)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    width: 20px;
    height: 2px;
    background: #dee2e6;
    transform: translateY(-50%);
    z-index: 1;
}

[data-total-rounds="5"] .round-3 .matchup:nth-child(3)::before {
    box-shadow: 215px 0 0 0 #dee2e6;
}

/* Desktop positioning adjustments for round 4 in 32-team brackets (5 rounds) */
[data-total-rounds="5"] .round-4 .matchup:nth-child(1) {
    transform: translateY(-170px); /* Move first semifinal match up */
}

[data-total-rounds="5"] .round-4 .matchup:nth-child(2) {
    transform: translateY(165px); /* Move second semifinal match down */
}

/* Desktop vertical line adjustments for round 4 in 32-team brackets */
[data-total-rounds="5"] .round-4 .matchup:nth-child(1)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 975px; /* Connect the two semifinal matches (adjusted for positioning) */
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px);
}

/* Add IN lines for final round in 32-team brackets */
[data-total-rounds="5"] .round-5 .matchup::before,
[data-total-rounds="5"] .round-final .matchup::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 20px;
    height: 2px;
    background: #dee2e6;
    transform: translateY(-50%);
}

/* Vertical bracket connecting lines */
/* Connect pairs of matchups with vertical lines */

/* Round 1: Connect matchup pairs (1-2, 3-4, 5-6, 7-8) */
.round-1 .matchup:nth-child(odd)::before {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 122px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px); /* Start from center, extend down */
}

/* Round 2: Connect semifinal pairs - move vertical line to the right side */
.round-2 .matchup:nth-child(1)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 222px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px); /* Start from center */
}

/* Round 2: Connect semifinal pairs - vertical line only */
.round-2 .matchup:nth-child(1)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 222px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px);
}

/* Round 2: Connect second pair of semifinal matches - vertical line for 3rd and 4th matches */
.round-2 .matchup:nth-child(3)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 222px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px);
}



/* Round 3: Restore the incoming line to finals */
.round-3 .matchup::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    width: 20px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
}

/* Horizontal lines going INTO rounds from connection points */
/* Round 2: Lines coming from Round 1 connection points */
.round-2 .matchup:nth-child(1)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
    /* Add outgoing line using box-shadow */
    box-shadow: 236px 0 0 0 #dee2e6; /* Creates horizontal line going right */
}

.round-2 .matchup:nth-child(2)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
}

.round-2 .matchup:nth-child(3)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
    /* Add outgoing line using box-shadow */
    box-shadow: 236px 0 0 0 #dee2e6; /* Creates horizontal line going right */
}

.round-2 .matchup:nth-child(4)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
}

/* Add IN lines for matches 5, 6, 7, and 8 in 32-team brackets */
[data-total-rounds="5"] .round-2 .matchup:nth-child(5)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
    box-shadow: 215px 0 0 0 #dee2e6; /* Creates horizontal line going right */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(6)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(7)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
    /* Add outgoing line using box-shadow */
    box-shadow: 215px 0 0 0 #dee2e6; /* Creates horizontal line going right */
}

[data-total-rounds="5"] .round-2 .matchup:nth-child(8)::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
}

/* Round 3: Line coming from Round 2 connection point */
.round-3 .matchup::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
}

/* Specific rules for 16+ team brackets (4+ rounds) */
[data-total-rounds="4"] .round-2 .matchup:nth-child(1)::before,
[data-total-rounds="5"] .round-2 .matchup:nth-child(1)::before,
[data-total-rounds="4"] .round-3 .matchup:nth-child(1)::before,
[data-total-rounds="5"] .round-3 .matchup:nth-child(1)::before{
    box-shadow: 215px 0 0 0 #dee2e6; /* Shorter line for 16+ team brackets */
}

[data-total-rounds="4"] .round-2 .matchup:nth-child(3)::before,
[data-total-rounds="5"] .round-2 .matchup:nth-child(3)::before {
    box-shadow: 215px 0 0 0 #dee2e6; /* Shorter line for 16+ team brackets */
}

/* Round 3 connecting lines for 16+ team brackets (Round 3 is not final) */
/* Restore OUT lines for Round 3 in 16+ team brackets */
[data-total-rounds="4"] .round-3 .matchup::after {
    display: block !important;
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    width: 20px;
    height: 2px;
    background: #dee2e6;
    transform: translateY(-50%);
}

[data-total-rounds="5"] .round-3 .matchup::after {
    display: block !important;
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    width: 2px;
    height: 2px;
    background: #dee2e6;
    transform: translateY(-50%);
}

/* Add vertical connecting line between Round 3 matches for 16+ team brackets */
[data-total-rounds="4"] .round-3 .matchup:nth-child(1)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 360px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px);
}
[data-total-rounds="5"] .round-3 .matchup:nth-child(1)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 2px;
    height: 490px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(0px);
}

/* Add IN line to Round 4 (final) for 16+ team brackets */
[data-total-rounds="4"] .round-4 .matchup::before,
[data-total-rounds="5"] .round-4 .matchup::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 24px;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
    transform: translateY(-50%);
}

[data-total-rounds="5"] .round-4 .matchup::before {
    box-shadow: 215px 0 0 0 #dee2e6;
}

.matchup {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0;
    border: 2px solid #dee2e6;
    position: relative;
    min-height: 80px;
    width: var(--round-width);
    transition: all 0.3s ease;
}

/* Bracket connecting lines */
.matchup::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    width: 20px;
    height: 2px;
    background: #dee2e6;
    transform: translateY(-50%);
}

/* Remove line from final round */
.round-final .matchup::after,
.championship::after,
.round-2.round-final .matchup::after,
.round-3 .matchup::after,
.round-4.round-final .matchup::after,
.round-5.round-final .matchup::after {
    display: none !important;
}

/* Additional specific rule for round-2 final */
.round-2.round-final .matchup.championship::after {
    display: none !important;
}

/* Override specific round-2 vertical line rules when it's the final round */
.round-2.round-final .matchup:nth-child(1)::after {
    display: none !important;
}

/* Override the box-shadow horizontal line from round-2 when it's the final round */
.round-2.round-final .matchup:nth-child(1)::before {
    box-shadow: none !important;
}

.matchup:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.1);
}

.team {
    display: flex;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid #dee2e6;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
}

.team:last-child {
    border-bottom: none;
}

.team[data-clickable="1"] {
    cursor: pointer;
}

.team[data-clickable="1"]:hover {
    background: #e9ecef;
}

.team.selected {
    background: #007cba;
    color: white;
    font-weight: bold;
}

.team.selected:hover {
    background: #005a87;
}

.team-tbd {
    opacity: 0.6;
    font-style: italic;
    position: relative;
    cursor: help;
}

/* Hide TBD text but keep the space */
.team-tbd .team-name {
    color: transparent;
}

/* Tooltip for TBD teams */
.team-tbd::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    pointer-events: none;
}

/* Tooltip arrow */
.team-tbd::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    pointer-events: none;
}

/* Show tooltip on hover */
.team-tbd:hover::before,
.team-tbd:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Hide tooltips when bracket status is completed */
.bracket-container[data-status="completed"] .team-tbd:hover::before,
.bracket-container[data-status="completed"] .team-tbd:hover::after {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Change cursor for TBD teams in completed brackets since no tooltip is available */
.bracket-container[data-status="completed"] .team-tbd {
    cursor: default;
}

/* Ensure tooltip doesn't overflow on small screens */
@media (max-width: 768px) {
    .team-tbd::before {
        font-size: 11px;
        padding: 6px 10px;
        max-width: 200px;
        white-space: normal;
        text-align: center;
    }
}

.seed {
    font-weight: bold;
    margin-right: 5px;
    min-width: 20px;
    text-align: center;
    background: #333;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.team.selected .seed {
    background: rgba(255, 255, 255, 0.3);
}

.team-logo {
    width: 24px;
    height: 24px;
    margin-right: 5px;
    border-radius: 50%;
    object-fit: cover;
}

.team-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Allows flex item to shrink below content size */
}

/* Championship game styling */
.championship {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    border: 3px solid #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.championship .team {
    border-bottom-color: rgba(0, 0, 0, 0.1);
    color: #000;
}

.championship .team:hover {
    background: rgba(0, 0, 0, 0.1);
}

.championship .team.selected {
    background: rgba(0, 0, 0, 0.8);
    color: #FFD700;
}

.championship .seed {
    background: #000;
    color: #FFD700;
}

/* Actions */
.bracket-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.bracket-actions .button {
    padding: 5px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.bracket-actions .button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.bracket-actions .button:hover:before {
    left: 100%;
}

.bracket-share-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.bracket-share-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.bracket-reset-btn {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
}

.bracket-reset-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, #c82333, #dc2626);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.bracket-actions .button.disabled {
    background: #6c757d !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    transform: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.bracket-actions .button.disabled:hover {
    transform: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.bracket-actions .button.disabled:before {
    display: none;
}

/* Share Modal */
.bracket-share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.share-modal-content h3 {
    margin-top: 0;
    color: #333;
}

.share-url {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 15px 0;
    font-family: monospace;
    font-size: 12px;
}

.share-modal-actions {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.share-modal-actions .button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
}

.copy-share-url {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.copy-share-url:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: translateY(-1px);
}

.close-share-modal {
    background: #6c757d !important;
    color: white;
}

.close-share-modal:hover {
    background: #5a6268 !important;
    transform: translateY(-1px);
}

/* Validation Modal */
.bracket-validation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.validation-modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    text-align: left;
}

.validation-modal-content h3 {
    margin-top: 0;
    color: #dc3545;
    text-align: center;
}

.validation-modal-content p {
    margin-bottom: 15px;
    color: #333;
    line-height: 1.5;
}

.validation-modal-content ul {
    margin: 15px 0;
    padding-left: 20px;
}

.validation-modal-content li {
    margin-bottom: 8px;
    color: #555;
    line-height: 1.4;
}

.validation-modal-actions {
    margin-top: 25px;
    text-align: center;
}

.validation-modal-actions .button {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    background: #007cba;
    color: white;
    transition: all 0.3s ease;
}

.validation-modal-actions .button:hover {
    background: #005a87;
    transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 1024px) {
    .bracket-container {
        padding: 20px;
        /* Adjust widths for tablet screens */
        --round-width: 180px;
        --round-gap: 25px;
    }

    .bracket-wrapper {
        overflow-x: auto;
        padding: 20px 0;
        /* Enable smooth scrolling on mobile */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .bracket {
        /* Keep horizontal layout on mobile */
        display: flex;
        gap: var(--round-gap);
        align-items: center;
        justify-content: flex-start;
        /* Set minimum width to ensure horizontal scrolling */
        min-width: max-content;
    }

    .round {
        display: flex;
        flex-direction: column;
        gap: 20px;
        min-width: var(--round-width);
        width: var(--round-width);
        position: relative;
        flex-shrink: 0; /* Prevent rounds from shrinking */
    }

    .matchup {
        min-width: var(--round-width);
        width: var(--round-width);
    }

    /* Adjust round spacing for mobile */
    .round-1 {
        gap: 15px;
    }

    .round-2 {
        gap: 90px; /* Reduced gap for mobile */
    }

    .round-3 {
        gap: 200px; /* Reduced gap for mobile */
    }

    .round-4 {
        gap: 420px; /* Reduced gap for mobile */
    }

    .round-5, .round-final {
        justify-content: center;
    }

    /* Adjust connecting lines for mobile horizontal layout */
    /* Round 1: Adjust vertical lines for smaller gaps */
    .round-1 .matchup:nth-child(odd)::before {
        height: 92px; /* Reduced from 122px for mobile */
    }

    /* Round 2: Adjust vertical lines for mobile */
    .round-2 .matchup:nth-child(1)::after {
        height: 162px; /* Reduced from 222px for mobile */
    }

    .round-2 .matchup:nth-child(3)::after {
        height: 162px; /* Reduced from 222px for mobile */
    }

    /* Adjust horizontal connecting lines for mobile round widths */
    .round-2 .matchup:nth-child(1)::before {
        width: 20px; /* Reduced from 24px */
        left: -20px; /* Adjusted position */
        /* Adjust outgoing line for mobile gap */
        box-shadow: 185px 0 0 0 #dee2e6; /* Reduced from 236px for mobile gap */
    }

    .round-2 .matchup:nth-child(2)::before {
        width: 20px; /* Reduced from 24px */
        left: -20px; /* Adjusted position */
    }

    .round-2 .matchup:nth-child(3)::before {
        width: 20px; /* Reduced from 24px */
        left: -20px; /* Adjusted position */
        /* Adjust outgoing line for mobile gap */
        box-shadow: 185px 0 0 0 #dee2e6; /* Reduced from 236px for mobile gap */
    }

    .round-2 .matchup:nth-child(4)::before {
        width: 20px; /* Reduced from 24px */
        left: -20px; /* Adjusted position */
    }

    /* Add IN lines for matches 5, 6, 7, and 8 in 32-team brackets - tablet */
    [data-total-rounds="5"] .round-2 .matchup:nth-child(5)::before {
        content: '';
        position: absolute;
        left: -20px;
        top: 50%;
        width: 20px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(6)::before {
        content: '';
        position: absolute;
        left: -20px;
        top: 50%;
        width: 20px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(7)::before {
        content: '';
        position: absolute;
        left: -20px;
        top: 50%;
        width: 20px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
        /* Add outgoing line using box-shadow */
        box-shadow: 165px 0 0 0 #dee2e6; /* Shorter line for tablet */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(8)::before {
        content: '';
        position: absolute;
        left: -20px;
        top: 50%;
        width: 20px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
    }

    /* Round 3: Adjust incoming line for mobile */
    .round-3 .matchup::before {
        width: 20px; /* Reduced from 24px */
        left: -20px; /* Adjusted position */
    }

    /* Specific mobile tablet rules for 16+ team brackets (4+ rounds) */
    [data-total-rounds="4"] .round-2 .matchup:nth-child(1)::before,
    [data-total-rounds="5"] .round-2 .matchup:nth-child(1)::before,
    [data-total-rounds="4"] .round-3 .matchup:nth-child(1)::before,
    [data-total-rounds="5"] .round-3 .matchup:nth-child(1)::before{
        box-shadow: 165px 0 0 0 #dee2e6; /* Shorter line for 16+ team brackets on tablet */
    }

    [data-total-rounds="4"] .round-2 .matchup:nth-child(3)::before,
    [data-total-rounds="5"] .round-2 .matchup:nth-child(3)::before {
        box-shadow: 165px 0 0 0 #dee2e6; /* Shorter line for 16+ team brackets on tablet */
    }

    /* Round 3 connecting lines for 16+ team brackets on tablet */
    [data-total-rounds="4"] .round-3 .matchup::after,
    [data-total-rounds="5"] .round-3 .matchup::after {
        width: 15px; /* Reduced from 20px for tablet */
        right: -15px; /* Adjusted position */
    }

    [data-total-rounds="4"] .round-3 .matchup:nth-child(1)::after,
    [data-total-rounds="5"] .round-3 .matchup:nth-child(1)::after {
        height: 162px; /* Reduced from 222px for tablet */
        right: -15px; /* Adjusted position */
    }

    [data-total-rounds="4"] .round-4 .matchup::before,
    [data-total-rounds="5"] .round-4 .matchup::before {
        width: 15px; /* Reduced from 24px for tablet */
        left: -15px; /* Adjusted position */
    }

    /* General matchup connecting lines for mobile */
    .matchup::after {
        width: 15px; /* Reduced from 20px for mobile */
        right: -15px; /* Adjusted position */
    }
}

@media (max-width: 768px) {
    .bracket-container {
        padding: 15px;
        /* Smaller widths for mobile phones */
        --round-width: 160px;
        --round-gap: 15px;
    }

    .bracket-wrapper {
        /* Add padding for better mobile scrolling */
        margin: 0 -15px; /* Extend to container edges */
        padding: 15px;
    }

    .bracket {
        /* Ensure horizontal scrolling works on small screens */
        min-width: max-content;
        padding-right: 15px; /* Add some padding at the end */
    }

    .round {
        min-width: var(--round-width);
        width: var(--round-width);
    }

    .matchup {
        min-width: var(--round-width);
        width: var(--round-width);
    }

    /* Further reduce round spacing for mobile */
    .round-1 {
        gap: 12px;
    }

    .round-2 {
        gap: 70px; /* Further reduced for mobile */
    }

    /* Adjust vertical positioning of round-2 matches for better line alignment on mobile - only for 16+ team brackets */
    [data-total-rounds="4"] .round-2 .matchup:nth-child(1) {
        transform: translateY(-65px); /* Move first match up more */
    }

    [data-total-rounds="4"] .round-2 .matchup:nth-child(2) {
        transform: translateY(-20px); /* Move second match up slightly */
    }

    [data-total-rounds="4"] .round-2 .matchup:nth-child(3) {
        transform: translateY(20px); /* Move third match down slightly */
    }

    [data-total-rounds="4"] .round-2 .matchup:nth-child(4) {
        transform: translateY(65px); /* Move fourth match down more */
    }

    [data-total-rounds="4"] .round-3 .matchup:nth-child(1) {
        transform: translateY(-80px); /* Move first match up more */
    }

    [data-total-rounds="4"] .round-3 .matchup:nth-child(2) {
        transform: translateY(75px); /* Move first match up more */
    }

    /* Mobile positioning adjustments for additional matches in 32-team brackets */
    [data-total-rounds="5"] .round-2 .matchup:nth-child(1) {
        transform: translateY(-150px); /* Move first match up more */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(2) {
        transform: translateY(-108px); /* Move second match up slightly */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(3) {
        transform: translateY(-65px); /* Move third match down slightly */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(4) {
        transform: translateY(-20px); /* Move fourth match down more */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(5) {
        transform: translateY(23px); /* Keep fifth match centered */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(6) {
        transform: translateY(65px); /* Move sixth match down slightly */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(7) {
        transform: translateY(108px); /* Move seventh match down */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(8) {
        transform: translateY(150px); /* Move eighth match down more */
    }

    .round-3 {
        gap: 160px; /* Further reduced for mobile */
    }

    .round-4 {
        gap: 340px; /* Further reduced for mobile */
    }

    .bracket-title {
        font-size: 1.4rem;
        letter-spacing: 1px;
    }

    .team {
        padding: 10px 12px;
    }

    .team-name {
        font-size: 13px;
    }

    .team-logo {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }

    .seed {
        width: 20px;
        height: 20px;
        font-size: 11px;
        margin-right: 8px;
    }

    .bracket-actions {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .bracket-actions .button {
        min-width: 200px;
        padding: 14px 20px;
    }

    .share-modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .share-modal-actions .button {
        min-width: 150px;
    }

    .bracket-create-own-btn {
        min-width: 220px;
        padding: 14px 20px;
        font-size: 16px;
    }

    .bracket-shared-actions {
        margin-top: 15px;
        padding-top: 12px;
    }

    /* Further adjust connecting lines for small mobile screens */
    /* Round 1: Smaller vertical lines for mobile phones */
    .round-1 .matchup:nth-child(odd)::before {
        height: 102px; /* Further reduced for mobile phones */
        right: -10px; /* Adjusted position for smaller gap */
    }

    /* Round 2: Smaller vertical lines for mobile phones */
    .round-2 .matchup:nth-child(1)::after {
        height: 159px; /* Default height for mobile phones */
        right: -10px; /* Adjusted position */
    }

    .round-2 .matchup:nth-child(3)::after {
        height: 159px; /* Default height for mobile phones */
        right: -10px; /* Adjusted position */
    }

    /* Specific adjustments for 16+ team brackets */
    [data-total-rounds="4"] .round-2 .matchup:nth-child(1)::after,
    [data-total-rounds="5"] .round-2 .matchup:nth-child(1)::after,
    [data-total-rounds="4"] .round-2 .matchup:nth-child(3)::after,
    [data-total-rounds="5"] .round-2 .matchup:nth-child(3)::after {
        height: 203px; /* Adjusted for repositioned first match in 16+ team brackets */
    }

    /* Adjust horizontal connecting lines for mobile phone widths */
    .round-2 .matchup:nth-child(1)::before {
        width: 10px; /* Further reduced */
        left: -10px; /* Adjusted position */
        /* Adjust outgoing line for smaller mobile gap */
        box-shadow: 165px 0 0 0 #dee2e6; /* Further reduced for mobile phone gap */
    }

    .round-2 .matchup:nth-child(2)::before {
        width: 10px; /* Further reduced */
        left: -10px; /* Adjusted position */
    }

    .round-2 .matchup:nth-child(3)::before {
        width: 10px; /* Further reduced */
        left: -10px; /* Adjusted position */
        /* Adjust outgoing line for smaller mobile gap */
        box-shadow: 185px 0 0 0 #dee2e6; /* Default for mobile phone gap */
    }

    .round-2 .matchup:nth-child(4)::before {
        width: 10px; /* Further reduced */
        left: -10px; /* Adjusted position */
    }

    /* Add IN lines for matches 5, 6, 7, and 8 in 32-team brackets - mobile phone */
    [data-total-rounds="5"] .round-2 .matchup:nth-child(5)::before {
        content: '';
        position: absolute;
        left: -10px;
        top: 50%;
        width: 10px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
        box-shadow: 165px 0 0 0 #dee2e6;
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(6)::before {
        content: '';
        position: absolute;
        left: -10px;
        top: 50%;
        width: 10px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(7)::before {
        content: '';
        position: absolute;
        left: -10px;
        top: 50%;
        width: 10px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
        /* Add outgoing line using box-shadow */
        box-shadow: 165px 0 0 0 #dee2e6; /* Shorter line for mobile phone */
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(8)::before {
        content: '';
        position: absolute;
        left: -10px;
        top: 50%;
        width: 10px;
        height: 2px;
        background: #dee2e6;
        z-index: -1;
        transform: translateY(-50%);
    }

    /* Round 3: Adjust incoming line for mobile phones */
    .round-3 .matchup::before {
        width: 10px; /* Further reduced */
        left: -10px; /* Adjusted position */
    }

    /* Specific mobile phone rules for 16+ team brackets (4+ rounds) */
    [data-total-rounds="4"] .round-2 .matchup:nth-child(1)::before,
    [data-total-rounds="5"] .round-2 .matchup:nth-child(1)::before,
    [data-total-rounds="4"] .round-3 .matchup:nth-child(1)::before,
    [data-total-rounds="5"] .round-3 .matchup:nth-child(1)::before {
        box-shadow: 165px 0 0 0 #dee2e6; /* Shorter line for 16+ team brackets on mobile */
    }

    [data-total-rounds="4"] .round-2 .matchup:nth-child(3)::before,
    [data-total-rounds="5"] .round-2 .matchup:nth-child(3)::before {
        box-shadow: 165px 0 0 0 #dee2e6; /* Adjusted for repositioned matches in 16+ team brackets */
    }

    /* Round 3 connecting lines for 16+ team brackets on mobile phone */
    [data-total-rounds="4"] .round-3 .matchup::after,
    [data-total-rounds="5"] .round-3 .matchup::after {
        width: 10px; /* Further reduced for mobile phone */
        right: -10px; /* Adjusted position */
    }

    [data-total-rounds="4"] .round-3 .matchup:nth-child(1)::after {
        height: 404px; /* Further reduced for mobile phone */
        right: -10px; /* Adjusted position */
    }

    [data-total-rounds="4"] .round-4 .matchup::before,
    [data-total-rounds="5"] .round-4 .matchup::before {
        width: 10px; /* Further reduced for mobile phone */
        left: -10px; /* Adjusted position */
    }

    [data-total-rounds="5"] .round-3 .matchup:nth-child(1)::after {
        height: 400px; /* Further reduced for mobile phone */
        right: -10px; /* Adjusted position */
    }

    [data-total-rounds="5"] .round-3 .matchup:nth-child(1) {
        transform: translateY(-230px);
    }

    [data-total-rounds="5"] .round-3 .matchup:nth-child(2) {
        transform: translateY(-80px);
    }

    [data-total-rounds="5"] .round-3 .matchup:nth-child(4) {
        transform: translateY(235px);
    }

    [data-total-rounds="5"] .round-2 .matchup:nth-child(5)::after,
    [data-total-rounds="5"] .round-2 .matchup:nth-child(7)::after {
        right: -10px;
        height: 202px;
    }

    [data-total-rounds="5"] .round-3 .matchup:nth-child(2)::after,
    [data-total-rounds="5"] .round-3 .matchup:nth-child(4)::after {
        width: 10px;
        right: -10px;
    }

    [data-total-rounds="5"] .round-3 .matchup:nth-child(3)::after {
        width: 2px;
        height: 424px;
        top: 255px;
    }

    [data-total-rounds="5"] .round-3 .matchup:nth-child(3)::before {
        box-shadow: 166px 0 0 0 #dee2e6;
    }

    [data-total-rounds="5"] .round-4 .matchup::before {
        box-shadow: 166px 0 0 0 #dee2e6;
    }

    [data-total-rounds="5"] .round-4 .matchup:nth-child(1)::after {
        right: -10px;
        height: 764px;
    }

    [data-total-rounds="5"] .round-5 .matchup::before, [data-total-rounds="5"] .round-final .matchup::before {
        width: 10px;
        left: -10px;
    }

    /* General matchup connecting lines for mobile phones */
    .matchup::after {
        width: 10px; /* Further reduced for mobile phones */
        right: -10px; /* Adjusted position */
    }

    .team-logo {
        width: 20px;
        height: 20px;
    }
}

/* Two-sided bracket styles */
.bracket-container.two-sided {
    --conference-gap: 40px;
    --championship-gap: 60px;
}

.two-sided-bracket {
    display: flex;
    flex-direction: column;
    gap: var(--championship-gap);
    align-items: center;
}

.conference {
    width: 100%;
    max-width: 1000px;
}

.conference-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 20px 0;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.conference-bracket {
    display: flex;
    gap: var(--round-gap);
    align-items: center;
    justify-content: center;
}

.conference-bracket.scroll-needed {
    justify-content: flex-start;
}

.conference-b {
    margin-top: var(--conference-gap);
}

.championship-section {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.championship-title {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 0 0 20px 0;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.championship-bracket {
    display: flex;
    justify-content: center;
}

.championship-bracket .round {
    min-width: var(--round-width, 200px);
    width: var(--round-width, 200px);
}

.championship-bracket .matchup {
    min-width: var(--round-width, 200px);
    width: var(--round-width, 200px);
    border: 3px solid #007bff;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.championship-bracket .matchup:hover {
    border-color: #0056b3;
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.3);
}

/* Conference-specific styling */
.conference-a .matchup {
    border-left: 4px solid #28a745;
}

.conference-b .matchup {
    border-left: 4px solid #dc3545;
}

.conference-a .team.selected {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
}

.conference-b .team.selected {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #dc3545;
}

/* Mobile adjustments for two-sided brackets */
@media (max-width: 768px) {
    .bracket-container.two-sided {
        --conference-gap: 30px;
        --championship-gap: 40px;
    }

    .conference-title {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .championship-title {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .championship-bracket .round,
    .championship-bracket .matchup {
        min-width: var(--round-width, 160px);
        width: var(--round-width, 160px);
    }

    .conference-bracket {
        margin: 0 -15px;
        padding: 15px;
        min-width: max-content;
        padding-right: 15px;
    }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .bracket-container.two-sided {
        --conference-gap: 35px;
        --championship-gap: 50px;
    }

    .conference {
        max-width: 900px;
    }

    .championship-section {
        max-width: 350px;
    }

    .championship-bracket .round,
    .championship-bracket .matchup {
        min-width: var(--round-width, 180px);
        width: var(--round-width, 180px);
    }
}

/* Loading and error states */
.bracket-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.bracket-error {
    text-align: center;
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    margin: 20px 0;
}

/* Two-sided bracket line rules - only apply to two-sided tournaments */
/* These rules override the default line rules for two-sided brackets */

/* First, remove all default lines from two-sided brackets, then add back specific ones */
.bracket-container.two-sided .matchup::after,
.bracket-container.two-sided .matchup::before {
    display: none !important;
}

/* 4-team two-sided brackets: First round (conference finals) has NO lines at all */
/* No IN lines for first round, no OUT lines for conference finals */

/* 8-team two-sided brackets: First round has OUT lines and vertical lines, second round (conference finals) has IN lines only */
.bracket-container.two-sided[data-total-rounds="3"] .round-1 .matchup::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: -20px !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="3"] .round-1 .matchup:nth-child(odd)::before {
    content: '' !important;
    position: absolute !important;
    right: -20px !important;
    top: 50% !important;
    width: 2px !important;
    height: 122px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(0px) !important;
    display: block !important;
}

/* Round 2 (conference finals) - IN lines only, NO OUT lines */
.bracket-container.two-sided[data-total-rounds="3"] .round-2 .matchup::before {
    content: '' !important;
    position: absolute !important;
    left: -20px !important;
    top: 50% !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

/* Explicitly remove OUT lines from Round 2 (conference finals) */
.bracket-container.two-sided[data-total-rounds="3"] .round-2 .matchup::after {
    display: none !important;
}

/* Remove box-shadow OUT lines from Round 2 (conference finals) */
.bracket-container.two-sided[data-total-rounds="3"] .round-2 .matchup::before {
    box-shadow: none !important;
}

/* 16-team two-sided brackets: Lines up to conference finals, but conference finals have no OUT lines */
.bracket-container.two-sided[data-total-rounds="4"] .round-1 .matchup::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: -20px !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="4"] .round-1 .matchup:nth-child(odd)::before {
    content: '' !important;
    position: absolute !important;
    right: -20px !important;
    top: 50% !important;
    width: 2px !important;
    height: 122px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(0px) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: -20px !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(1)::after,
.bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(3)::after {
    content: '' !important;
    position: absolute !important;
    right: -20px !important;
    top: 50% !important;
    width: 2px !important;
    height: 222px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(0px) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup::before {
    content: '' !important;
    position: absolute !important;
    left: -20px !important;
    top: 50% !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

/* Round 3 (conference finals) - IN lines only, NO OUT lines */
.bracket-container.two-sided[data-total-rounds="4"] .round-3 .matchup::before {
    content: '' !important;
    position: absolute !important;
    left: -20px !important;
    top: 50% !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

/* Explicitly remove OUT lines from Round 3 (conference finals) */
.bracket-container.two-sided[data-total-rounds="4"] .round-3 .matchup::after {
    display: none !important;
}

/* Remove box-shadow OUT lines from Round 3 (conference finals) */
.bracket-container.two-sided[data-total-rounds="4"] .round-3 .matchup::before {
    box-shadow: none !important;
}

/* Override box-shadow for 16-team two-sided bracket round-2 */
.bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(1)::before,
.bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(3)::before {
    box-shadow: 233px 0 0 0 #dee2e6 !important;
}

/* Override box-shadow for 32-team two-sided bracket round-2 */
.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(1)::before,
.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(3)::before,
.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(5)::before,
.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(7)::before {
    box-shadow: 194px 0 0 0 #dee2e6 !important;
}

/* Override box-shadow for 32-team two-sided bracket round-3 */
.bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(1)::before,
.bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(3)::before {
    box-shadow: 194px 0 0 0 #dee2e6 !important;
}

/* 32-team two-sided brackets: Full lines up to conference finals, but conference finals have no OUT lines */
.bracket-container.two-sided[data-total-rounds="5"] .round-1 .matchup::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: -20px !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="5"] .round-1 .matchup:nth-child(odd)::before {
    content: '' !important;
    position: absolute !important;
    right: -20px !important;
    top: 50% !important;
    width: 2px !important;
    height: 122px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(0px) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: -20px !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(1)::after,
.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(3)::after {
    content: '' !important;
    position: absolute !important;
    right: -20px !important;
    top: 50% !important;
    width: 2px !important;
    height: 240px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(0px) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: -20px !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(1)::after {
    content: '' !important;
    position: absolute !important;
    right: -20px !important;
    top: 50% !important;
    width: 2px !important;
    height: 480px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(0px) !important;
    display: block !important;
}

.bracket-container.two-sided[data-total-rounds="5"] .round-4 .matchup:nth-child(1) {
    transform: translateY(0px) !important;
}

.bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup::before,
.bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup::before {
    content: '' !important;
    position: absolute !important;
    left: -20px !important;
    top: 50% !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

/* Round 4 (conference finals) - IN lines only, NO OUT lines */
.bracket-container.two-sided[data-total-rounds="5"] .round-4 .matchup::before {
    content: '' !important;
    position: absolute !important;
    left: -20px !important;
    top: 50% !important;
    width: 20px !important;
    height: 2px !important;
    background: #dee2e6 !important;
    z-index: -1 !important;
    transform: translateY(-50%) !important;
    display: block !important;
}

/* Explicitly remove OUT lines from Round 4 (conference finals) */
.bracket-container.two-sided[data-total-rounds="5"] .round-4 .matchup::after {
    display: none !important;
}

/* Remove box-shadow OUT lines from Round 4 (conference finals) */
.bracket-container.two-sided[data-total-rounds="5"] .round-4 .matchup::before {
    box-shadow: none !important;
}

/* Final round (championship) should never have IN lines for two-sided brackets only */
.bracket-container.two-sided .championship::before,
.bracket-container.two-sided .round-final .matchup::before {
    display: none !important;
}

/* Mobile adjustments for two-sided bracket lines */
@media (max-width: 1024px) {
    /* 8-team two-sided brackets - tablet */
    .bracket-container.two-sided[data-total-rounds="3"] .round-1 .matchup:nth-child(odd)::before {
        height: 92px !important;
        right: -15px !important;
    }

    .bracket-container.two-sided[data-total-rounds="3"] .round-2 .matchup::before {
        left: -15px !important;
        width: 15px !important;
    }

    /* 16-team two-sided brackets - tablet */
    .bracket-container.two-sided[data-total-rounds="4"] .round-1 .matchup:nth-child(odd)::before {
        height: 92px !important;
        right: -15px !important;
    }

    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(1)::after,
    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(3)::after {
        height: 162px !important;
        right: -15px !important;
    }

    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="4"] .round-3 .matchup::before {
        left: -15px !important;
        width: 15px !important;
    }
}

@media (max-width: 768px) {
    /* 4-team two-sided brackets - center first round like final */
    .bracket-container.two-sided[data-total-rounds="2"] .conference-bracket {
        justify-content: center !important;
    }

    .bracket-container.two-sided[data-total-rounds="2"] .round-1 {
        justify-content: center !important;
    }

    .bracket-container.two-sided[data-total-rounds="2"] .conference {
        display: flex !important;
        justify-content: center !important;
    }

    /* Mobile overrides for two-sided tournament lines - change width from 20px to 10px and right from -20px to -10px */

    /* 8-team two-sided brackets - mobile OUT lines */
    .bracket-container.two-sided[data-total-rounds="3"] .round-1 .matchup::after {
        width: 10px !important;
        right: -10px !important;
    }

    /* 16-team two-sided brackets - mobile OUT lines */
    .bracket-container.two-sided[data-total-rounds="4"] .round-1 .matchup::after,
    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup::after {
        width: 10px !important;
        right: -10px !important;
    }

    /* 32-team two-sided brackets - mobile OUT lines */
    .bracket-container.two-sided[data-total-rounds="5"] .round-1 .matchup::after,
    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup::after,
    .bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup::after {
        width: 10px !important;
        right: -10px !important;
    }

    /* Mobile IN lines - change width from 20px to 10px and left from -20px to -10px */
    .bracket-container.two-sided[data-total-rounds="3"] .round-2 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="4"] .round-3 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-4 .matchup::before {
        width: 10px !important;
        left: -10px !important;
    }

    /* 8-team two-sided brackets - mobile vertical lines */
    .bracket-container.two-sided[data-total-rounds="3"] .round-1 .matchup:nth-child(odd)::before {
        height: 102px !important;
        right: -10px !important;
    }

    /* 16-team two-sided brackets - mobile positioning */
    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(1) {
        transform: translateY(-20px) !important;
    }

    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(2) {
        transform: translateY(20px) !important;
    }

    .bracket-container.two-sided[data-total-rounds="4"] .round-3 .matchup:nth-child(1) {
        transform: translateY(0px) !important;
    }

    .bracket-container.two-sided[data-total-rounds="4"] .round-3 .matchup:nth-child(2) {
        transform: translateY(110px) !important; /* 60px + 50px down */
    }

    /* 16-team two-sided brackets - mobile vertical lines */
    .bracket-container.two-sided[data-total-rounds="4"] .round-1 .matchup:nth-child(odd)::before {
        height: 102px !important;
        right: -10px !important;
    }

    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(1)::after,
    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(3)::after {
        height: 199px !important;
        right: -10px !important;
    }

    /* 32-team two-sided brackets - mobile */
    .bracket-container.two-sided[data-total-rounds="5"] .round-1 .matchup:nth-child(odd)::before {
        height: 102px !important;
        right: -10px !important;
    }

    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(1)::after,
    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(3)::after {
        height: 179px !important;
        right: -10px !important;
    }

    .bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(1)::after {
        height: 368px !important;
        right: -10px !important;
    }

    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-4 .matchup::before {
        left: -10px !important;
        width: 10px !important;
    }

    /* Override box-shadow for 16-team two-sided bracket round-2 */
    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(1)::before,
    .bracket-container.two-sided[data-total-rounds="4"] .round-2 .matchup:nth-child(3)::before {
        box-shadow: 164px 0 0 0 #dee2e6 !important; /* Extended from 215px to 234px */
    }

    /* Override box-shadow for 32-team two-sided bracket round-2 */
    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(1)::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(3)::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(5)::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-2 .matchup:nth-child(7)::before {
        box-shadow: 164px 0 0 0 #dee2e6 !important;
    }

    /* Override box-shadow for 32-team two-sided bracket round-3 */
    .bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(1)::before,
    .bracket-container.two-sided[data-total-rounds="5"] .round-3 .matchup:nth-child(3)::before {
        box-shadow: 164px 0 0 0 #dee2e6 !important;
    }


}
