html, body {
    scrollbar-width: none;
    -ms-overflow-style: none;
    overflow-x: hidden;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.sponsors-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    pointer-events: none;
}

.sponsors-bar * {
    pointer-events: auto;
}

.bracket-container {
    padding: 40px 20px 100px;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    min-height: 60vh;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.bracket-container::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.bracket-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
}

.bracket-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.bracket {
    display: flex;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 200px;
    flex-shrink: 0;
    position: relative;
}

.round:not(:last-child) {
    margin-right: 60px;
}

.match-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
}

.match-group:last-child {
    margin-bottom: 0;
}

.format-badge {
    position: absolute;
    top: 10px;
    right: -40px;
    background: var(--primary, #ff3333);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(255, 51, 51, 0.3);
}

.team-card {
    background: linear-gradient(145deg, #1e222a, #181b21);
    border: 1px solid #2a2f3a;
    border-radius: 4px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
    height: 36px;
    transition: all 0.2s ease;
    cursor: default;
    position: relative;
}

.team-card:hover {
    border-color: #3a4050;
    background: linear-gradient(145deg, #242830, #1c2026);
}

.team-card.admin-edit {
    cursor: pointer;
}

.team-card.admin-edit:hover {
    border-color: var(--primary, #ff3333);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.2);
}

.team-icon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2f3a;
    color: #555;
    font-size: 10px;
}

.team-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-name {
    font-size: 11px;
    font-weight: 600;
    color: #b8c0cf;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.team-card.tbd .team-name {
    color: #4a5060;
    font-style: italic;
}

.team-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #4a5060;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 3px;
    min-width: 22px;
    text-align: center;
}

.team-card.winner {
    border-color: rgba(255, 193, 7, 0.5);
    background: linear-gradient(145deg, #252a32, #1e2228);
}

.team-card.winner .team-name {
    color: #fff;
}

.team-card.winner .team-score {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.team-card.loser {
    opacity: 0.5;
}

.champion-card {
    background: linear-gradient(145deg, #2a2820, #1f1c18);
    border: 2px solid rgba(255, 193, 7, 0.6);
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    box-shadow: 0 0 25px rgba(255, 193, 7, 0.2);
}

.champion-card .team-icon {
    width: 24px;
    height: 24px;
}

.champion-card .team-name {
    font-size: 13px;
    color: #ffc107;
}

.champion-card .champion-crown {
    color: #ffc107;
    font-size: 12px;
    margin-left: auto;
}

.third-place-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: end;
    gap: 12px;
}

.third-place-title {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.third-place-match {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
}

.third-place-match .format-badge {
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
}

.third-place-match .team-card.winner {
    border-color: rgba(205, 127, 50, 0.5);
}

.third-place-match .team-card.winner .team-score {
    background: rgba(205, 127, 50, 0.2);
    color: #cd7f32;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999;
    display: none;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: block;
}

.score-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: linear-gradient(145deg, #15171d, #0f1115);
    border: 1px solid #2a2f3a;
    padding: 0;
    border-radius: 12px;
    z-index: 1000;
    display: none;
    min-width: 360px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.score-modal.active {
    display: block;
    transform: translate(-50%, -50%) scale(1);
    animation: modalIn 0.3s ease forwards;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 24px;
}

.format-select-container {
    margin-bottom: 20px;
}

.format-select {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 6px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.format-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.format-select:focus {
    outline: none;
    border-color: var(--primary);
}

.score-editor-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.score-input {
    width: 70px;
    height: 70px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #2a2f3a;
    color: white;
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    border-radius: 10px;
    transition: all 0.2s;
}

.score-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.2);
}

.vs-badge {
    color: #3a4050;
    font-style: italic;
    font-weight: 900;
    font-size: 16px;
}

.btn-save {
    width: 100%;
    padding: 12px;
    background: var(--primary, #ff3333);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.btn-save:hover {
    background: #d42020;
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.4);
}

.custom-select-container {
    position: relative;
    user-select: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.select-trigger {
    background: rgba(20, 22, 28, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.select-trigger:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.custom-select-container.open .select-trigger {
    border-color: var(--primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #14161c;
    border: 1px solid var(--primary);
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    z-index: 200;
    display: none;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    max-height: 280px;
    overflow-y: auto;
}

.custom-select-container.open .select-options {
    display: block;
}

.option {
    padding: 12px 16px;
    cursor: pointer;
    color: #888;
    transition: 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.option:hover {
    background: rgba(255, 51, 51, 0.1);
    color: #fff;
}

.option.selected {
    background: rgba(255, 51, 51, 0.15);
    color: #fff;
    font-weight: 700;
}

.arrow {
    transition: transform 0.3s;
    font-size: 11px;
    color: #666;
}

.custom-select-container.open .arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.team-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.team-card.drag-over {
    border-color: var(--primary) !important;
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.3);
}

.loading {
    color: #4a5060;
    font-size: 13px;
    padding: 50px;
    text-align: center;
}

@media (min-width: 1200px) {
    .bracket-container {
        padding: 50px 40px 100px;
    }
}

@media (max-width: 768px) {
    .round {
        min-width: 160px;
    }

    .round:not(:last-child) {
        margin-right: 50px;
    }

    .team-card {
        min-width: 150px;
        padding: 6px 10px;
    }

    .bracket-container {
        justify-content: flex-start;
        padding-left: 20px;
    }

    .bracket {
        min-width: max-content;
    }
}

@media (max-width: 500px) {
    .score-modal {
        min-width: 90%;
        width: 90%;
    }

    .score-input {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}

.team-info-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: linear-gradient(145deg, #15171d, #0f1115);
    border: 1px solid #2a2f3a;
    padding: 0;
    border-radius: 12px;
    z-index: 1000;
    display: none;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.team-info-modal.active {
    display: block;
    transform: translate(-50%, -50%) scale(1);
    animation: modalIn 0.3s ease forwards;
}

.team-info-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

.team-info-modal .modal-header h3 {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    margin: 0;
}

.team-roster {
    padding: 8px 0;
}

.team-roster-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

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

.team-roster-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.player-nickname {
    font-size: 13px;
    font-weight: 500;
    color: #b8c0cf;
    flex: 1;
}

.player-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.player-badge.captain {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.player-badge.reserve {
    background: rgba(100, 100, 100, 0.2);
    color: #888;
}

.team-roster-empty {
    padding: 20px;
    text-align: center;
    color: #4a5060;
    font-size: 12px;
}

.team-card.clickable {
    cursor: pointer;
}

.team-card.clickable:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, #242830, #1c2026);
}

.admin-team-roster-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-team-roster-header {
    font-size: 10px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-align: center;
}

.admin-team-roster {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 6px 0;
}

.admin-team-roster .team-roster-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.admin-team-roster .player-nickname {
    font-size: 12px;
    font-weight: 500;
    color: #b8c0cf;
    flex: 1;
}

.admin-team-roster .player-badge {
    font-size: 8px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
}

.admin-team-roster .loading {
    padding: 15px;
    text-align: center;
    color: #4a5060;
    font-size: 11px;
}