.team-link {
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    transition: transform 0.2s ease;
}

.team-link:hover {
    transform: translateY(-2px);
}

.team-link:hover .team {
    background: var(--hover);
}

/* Bracket Container */
.bracket-container {
    position: relative;
    width: 100%;
    min-height: 80dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: hidden;
}

.bracket-wrapper {
    padding: 2rem;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* SVG Bracket Lines */
.bracket-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.bracket-line {
    transition: stroke 0.3s ease;
}

/* GRID LAYOUT */
.single-elimination-bracket {
    display: grid;
    grid-template-columns: repeat(3, 260px);
    grid-template-rows: auto repeat(5, minmax(80px, auto));
    gap: 1.5rem 6rem;
    position: relative;
    z-index: 1;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

/* Grid Items */
.grid-title {
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-match {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Column Titles */
.column-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--txt-2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.5rem 0.75rem;
    background-color: var(--panel-3);
    border: 1px solid var(--borders);
    border-radius: var(--radius);
    text-align: center;
    width: 100%;
}

/* Match Container */
.match {
    background: var(--panel);
    border-radius: var(--radius);
    overflow: hidden;
    width: 100%;
    border: 1px solid var(--borders);
    position: relative;
    transition: all 0.3s ease;
}

.match:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.team {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    background: var(--panel-2);
    transition: all 0.2s ease;
    position: relative;
}

.team:first-child {
    border-bottom: 2px solid var(--borders);
}

.team:hover {
    background: var(--hover);
}

.team-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.team-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.team-logo.esperando {
    background: var(--panel-3);
}

.team-name {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-score {
    font-size: 1rem;
    font-weight: 700;
    color: var(--txt);
    text-align: center;
    font-variant-numeric: tabular-nums;
    min-width: 20px;
}

.team-winner {
    background: var(--panel);
    border-left: 3px solid var(--accent);
}

.team-winner .team-name {
    color: var(--txt);
    font-weight: 500;
}

.team-winner .team-score {
    color: var(--accent);
}

.team-winner .team-logo {
    border-color: var(--borders);
}

/* Final match - diseño especial */
.final-match {
    width: 280px;
    box-shadow: 0 2px 12px rgba(232, 0, 40, 0.15);
    border: 2px solid var(--accent);
}

.final-match .team {
    padding: 0.875rem 1rem;
}

.final-match .team-logo {
    width: 32px;
    height: 32px;
}

.final-match .team-name {
    font-size: 0.875rem;
}

.final-match .team-score {
    font-size: 1.125rem;
}

/* Conectores entre rounds */
.bracket-round::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 40px;
    height: 2px;
    background: var(--borders);
}

.bracket-round:last-child::after {
    display: none;
}

/* Responsive */
@media (max-width: 1400px) {
    .single-elimination-bracket {
        grid-template-columns: repeat(3, 235px);
        gap: 1.5rem 5rem;
    }
    
    .final-match {
        width: 260px;
    }
}

@media (max-width: 1200px) {
    .single-elimination-bracket {
        grid-template-columns: repeat(3, 220px);
        gap: 1.5rem 4.5rem;
    }
    
    .final-match {
        width: 245px;
    }
    
    .team {
        padding: 0.625rem 0.75rem;
        gap: 0.5rem;
    }
    
    .team-logo {
        width: 24px;
        height: 24px;
    }
    
    .team-name {
        font-size: 0.75rem;
    }
    
    .team-score {
        font-size: 0.875rem;
    }
}

@media (max-width: 1024px) {
    .single-elimination-bracket {
        grid-template-columns: repeat(3, 200px);
        gap: 1.5rem 4rem;
    }
    
    .final-match {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .bracket-wrapper {
        padding: 0.75rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .single-elimination-bracket {
        grid-template-columns: repeat(3, 185px);
        gap: 1.5rem 2.5rem;
    }
    
    .final-match {
        width: 200px;
    }
    
    .team {
        padding: 0.5rem 0.625rem;
    }
    
    .team-logo {
        width: 22px;
        height: 22px;
    }
    
    .team-name {
        font-size: 0.6875rem;
    }
    
    .team-score {
        font-size: 0.8125rem;
    }
    
    .column-title {
        font-size: 0.625rem;
        padding: 0.375rem 0.5rem;
    }
}

@media (max-width: 640px) {
    .single-elimination-bracket {
        grid-template-columns: repeat(3, 170px);
        gap: 1.5rem 2rem;
    }
    
    .final-match {
        width: 185px;
    }
    
    .team {
        gap: 0.375rem;
        padding: 0.5rem;
    }
    
    .team-logo {
        width: 20px;
        height: 20px;
    }
    
    .team-name {
        font-size: 0.625rem;
    }
    
    .team-score {
        font-size: 0.75rem;
        min-width: 16px;
    }
    
    .final-match .team-logo {
        width: 24px;
        height: 24px;
    }
    
    .column-title {
        font-size: 0.5625rem;
        padding: 0.25rem 0.375rem;
        letter-spacing: 0.05em;
    }
}

/* Scrollbar styling */
.bracket-wrapper::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

.bracket-wrapper::-webkit-scrollbar-track {
    background: var(--panel-2);
    border-radius: 5px;
}

.bracket-wrapper::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 5px;
}

.bracket-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

@media (max-width: 768px) {
    .bracket-wrapper::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }
}

/* Accessibility */
.match:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.team:focus {
    background: var(--hover);
    outline: none;
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .team {
        min-height: 44px;
    }
    
    .bracket-wrapper {
        -webkit-overflow-scrolling: touch;
    }
}