[hidden] {
    display: none !important;
}

#ifl-cup-view {
    max-width: 1500px;
    margin: 20px auto;
    padding: 0 15px;
}

.ifl-cup h2 {
    text-align: center;
    margin: 12px 0 24px;
}

.ifl-bracket-scroll {
    overflow-x: auto;
    padding: 8px 4px 20px;
}

.ifl-bracket {
    display: flex;
    gap: 24px;
    min-width: max-content;
    justify-content: center;
    align-items: stretch;
}

.ifl-cup-round {
    width: 245px;
    display: flex;
    flex-direction: column;
}

.ifl-cup-round h3 {
    text-align: center;
    font-size: 15px;
    margin: 0 0 14px;
}

.ifl-cup-matches {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 16px;
}

.ifl-cup-match {
    border: 1px solid var(--border-color);
    border-radius: 9px;
    overflow: hidden;
}

.ifl-cup-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    min-height: 40px;
}

.ifl-cup-player + .ifl-cup-player {
    border-top: 1px solid var(--border-color);
}

.ifl-cup-name {
    min-width: 0;
    overflow: hidden;
}

.ifl-cup-score {
    flex-shrink: 0;
    min-width: 20px;
    text-align: center;
}

.ifl-cup-winner {
    background: rgba(22, 163, 74, .14);
    color: #15803d;
    font-weight: 700;
}

[data-theme="dark"] .ifl-cup-winner {
    color: #86efac;
}

.ifl-cup-unknown {
    opacity: .55;
    font-style: italic;
}

.ifl-cup-notice,
.ifl-cup-marker {
    font-size: 12px;
    text-align: center;
    padding: 8px;
    opacity: .8;
}

.ifl-cup-marker {
    border-top: 1px solid var(--border-color);
}

.ifl-cup-champion {
    margin: 20px auto;
    max-width: 320px;
    padding: 18px;
    border: 1px solid #ca8a04;
    border-radius: 10px;
    text-align: center;
    background: rgba(234, 179, 8, .12);
}

.ifl-cup-champion .team-cell {
    justify-content: center;
    margin-top: 12px;
}

@media (max-width: 700px) {
    .ifl-bracket {
        justify-content: flex-start;
        gap: 16px;
    }

    .ifl-cup-round {
        width: 220px;
    }
}

/* Przewijanie widoku pucharowego */
body.ifl-cup-mode {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

body.ifl-cup-mode > * {
    flex-shrink: 0;
}

#ifl-cup-view {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
    padding-bottom: 24px;
}

#ifl-cup-view .card {
    min-width: 0;
}

.ifl-bracket-scroll {
    width: 100%;
    max-width: 100%;
}

/* IFL Classic - responsywny uklad portalu */

body:not(.ifl-cup-mode):not(.ifl-rules-mode) {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

body > .sync-bar {
    flex-shrink: 0;
}

#ifl-main-view {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

#ifl-main-view .column-left {
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
}

#ifl-main-view .column-right {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 12px;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* Portret */
@media (max-width: 991px) {
    #ifl-main-view {
        flex-direction: column;
    }

    #ifl-main-view .column-left {
        flex: 0 0 auto;
        max-height: 50%;
    }

    #ifl-main-view .column-right {
        flex: 1 1 0;
        height: auto;
    }
}

/* Landscape */
@media (min-width: 992px) {
    #ifl-main-view {
        align-items: stretch;
    }

    #ifl-main-view .column-right {
        height: auto;
    }
}

/* Regulamin i drabinka przewijane niezaleznie od ligi */
body.ifl-rules-mode,
body.ifl-cup-mode {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
}

body.ifl-rules-mode > *,
body.ifl-cup-mode > * {
    flex-shrink: 0;
}

/* IFL Classic - finalna korekta przewijania */

#ifl-main-view .column-left,
#ifl-main-view .column-right,
#ifl-main-view .table-container {
    overflow-x: hidden;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

#ifl-main-view .table-container,
#ifl-main-view table {
    width: 100%;
    box-sizing: border-box;
}

#ifl-main-view .card {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

@media (min-width: 992px) {
    #ifl-main-view .column-left,
    #ifl-main-view .column-right {
        width: auto;
    }
}

/* IFL Classic - stale naglowki i mobile landscape */

#ifl-main-view .column-left,
#ifl-main-view .column-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    padding-bottom: 0;
    min-height: 0;
}

#ifl-main-view .section-title {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding: 5px 8px;
    background: var(--card-bg);
    border-radius: 8px 8px 0 0;
    color: var(--text-color);
}

#ifl-main-view .card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
}

#ifl-main-view .table-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

#ifl-main-view table {
    border-collapse: separate;
    border-spacing: 0;
}

#ifl-main-view thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

#ifl-main-view table > tbody > tr:first-child > th,
#ifl-main-view table > tr:first-child > th {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Telefon w orientacji poziomej */

@media (orientation: landscape) and (max-height: 600px) {
    body {
        padding: 4px 8px !important;
    }

    body .header {
        padding: 4px 8px !important;
        margin-bottom: 3px !important;
        box-sizing: border-box;
    }

    body .header h1 {
        font-size: 1.05rem !important;
        margin: 0 0 2px !important;
    }

    body .header .sync-bar {
        margin: 3px 0 !important;
        gap: 5px;
    }

    body > .sync-bar {
        margin: 4px auto !important;
        gap: 5px;
    }

    body .sync-btn {
        font-size: .72rem;
        padding: 3px 8px;
    }

    body .header .badge {
        padding: 2px 6px;
        font-size: .65rem;
        margin: 2px 0;
    }

    #ifl-main-view {
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    #ifl-main-view .column-left {
        flex: 1 1 0;
        width: auto;
        height: auto;
        max-height: 100%;
    }

    #ifl-main-view .column-right {
        flex: 1.1 1 0;
        width: auto;
        height: auto;
        max-height: 100%;
    }

    #ifl-main-view table {
        font-size: .68rem;
    }

    #ifl-main-view th,
    #ifl-main-view td {
        padding: 5px 3px;
    }

    #ifl-main-view th {
        font-size: .58rem;
    }

    #ifl-main-view .team-logo {
        width: 14px;
        height: 14px;
    }

    #ifl-main-view .section-title {
        font-size: .75rem;
        padding: 4px 6px;
    }
}

/* Na bardzo waskich ekranach nie obcinamy statystyk */

@media (orientation: landscape) and (max-height: 600px) {
    #league-table-box {
        overflow-x: auto;
    }
}

/* IFL Classic - dynamiczna wysokosc tabeli */

@media (min-width: 992px),
       (orientation: landscape) and (max-height: 600px) {

    #ifl-main-view .column-left {
        align-self: flex-start;
        height: auto;
        max-height: 100%;
    }

    #ifl-main-view .column-left .card {
        flex: 0 1 auto;
        min-height: 0;
    }

    #ifl-main-view .column-left .table-container {
        flex: 0 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    #ifl-main-view .column-right {
        align-self: stretch;
    }
}
