/* Championship page — mobile layout (RTL/LTR, dark + light) */

@media (max-width: 991px) {
    .profile-header-wrapper.club.auto-height-header {
        min-height: 0 !important;
        padding: 16px 0 0 !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .profile-header-wrapper.club.auto-height-header .club-profile-info {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
    }

    .profile-header-wrapper.club.auto-height-header .club-profile-info .season-dropdown-wrap {
        margin: 0 !important;
    }

    /* Logo + season row */
    .profile-header-wrapper.club.auto-height-header .champ-header-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        padding: 0 4px 14px;
        box-sizing: border-box;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo img {
        flex: 0 0 52px;
        width: 52px;
        height: 52px;
        object-fit: contain;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo h3 {
        margin: 0;
        font-size: 15px;
        font-weight: 800;
        line-height: 1.35;
        color: #fff;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-top .champ-header-actions,
    .profile-header-wrapper.club.auto-height-header .champ-header-top .season-dropdown-wrap {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        flex: 0 0 auto;
        width: auto !important;
        max-width: none !important;
        position: relative;
        margin: 0 !important;
        text-align: initial !important;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: #fff;
        line-height: 0;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ svg {
        display: block;
        width: 20px;
        height: 20px;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-btn {
        flex: 0 0 auto;
        min-width: 72px;
        max-width: 118px;
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        background: #191d2d;
        border: 1px solid #2a3048;
        color: #d8dbe8;
        border-radius: 10px;
        margin: 0 !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        inset-inline-end: 0;
        inset-inline-start: auto;
        left: auto;
        right: 0;
        transform: none !important;
        min-width: 200px;
        width: min(260px, calc(100vw - 32px));
        padding: 8px;
        z-index: 1000;
        box-sizing: border-box;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel.active,
    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel.season-dropdown-panel--mobile-fixed {
        display: block !important;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .settings-item-content {
        display: flex;
        flex-direction: column;
        gap: 4px;
        max-height: min(320px, 50vh);
        overflow-y: auto;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item {
        margin: 0;
        padding: 0;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label {
        display: flex !important;
        align-items: center;
        width: 100%;
        padding: 10px 12px;
        margin: 0;
        border-radius: 8px;
        border: 1px solid transparent;
        box-sizing: border-box;
        cursor: pointer;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label span {
        display: block;
        font-size: 13px;
        font-weight: 700;
        color: inherit;
        line-height: 1.3;
        opacity: 1;
        visibility: visible;
    }

    /* Override global style.css / responsive.css season dropdown mobile rules */
    .profile-header-wrapper.club.auto-height-header .season-dropdown-btn {
        margin: 0 !important;
        margin-inline-start: 0 !important;
    }

    .profile-header-wrapper.club.auto-height-header .season-dropdown-panel {
        left: auto !important;
        right: 0 !important;
        transform: none !important;
    }

    .profile-header-wrapper.club.auto-height-header .season-dropdown-panel.season-dropdown-panel--mobile-fixed {
        position: fixed !important;
        transform: none !important;
    }

    /* Scrollable tabs */
    .profile-header-wrapper.club.auto-height-header .match-links-scroll {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        padding-top: 2px;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll::-webkit-scrollbar {
        display: none;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap {
        display: inline-flex;
        flex-wrap: nowrap;
        align-items: flex-end;
        justify-content: flex-start;
        gap: 4px;
        width: max-content;
        min-width: 100%;
        padding: 0 4px;
        box-sizing: border-box;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item,
    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item {
        margin: 0 !important;
        padding: 12px 14px 14px;
        font-size: 13px;
        font-weight: 700;
        color: #8b90a5;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item:before,
    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item:before {
        display: none;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item.active,
    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item.active {
        color: #fff;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item.active::after,
    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item.active::after {
        content: '';
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: 0;
        height: 3px;
        border-radius: 3px 3px 0 0;
        background: #39dbbf;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown {
        display: inline-flex;
        align-items: flex-end;
        gap: 2px;
        margin: 0 !important;
        padding-bottom: 0;
        position: relative;
        vertical-align: bottom;
    }

    .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown:has(> a.active)::before {
        display: none;
    }

    /* ── Page content ── */
    .profile-page-header + section.inner-page-content .club-page-inner .main-row {
        margin-left: 0;
        margin-right: 0;
    }

    .profile-page-header + section.inner-page-content #match_list_conf.col-lg-5 {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .profile-page-header + section.inner-page-content .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    #match_list_conf .matches-top-title.text-center {
        text-align: right !important;
    }

    /* Live matches — compact horizontal teams on small screens */
    #match_list_conf .inline-match-item.active-match {
        flex-wrap: wrap;
        padding: 10px 8px 28px;
        gap: 4px;
    }

    #match_list_conf .inline-match-item.active-match .match-team-item {
        flex: 1 1 0;
        min-width: 0;
    }

    #match_list_conf .inline-match-item.active-match .match-team-item .team---item {
        flex-direction: row;
        align-items: center;
        gap: 5px;
        text-align: right;
    }

    #match_list_conf .inline-match-item.active-match .match-team-item.first-team .team---item {
        justify-content: flex-end;
    }

    #match_list_conf .inline-match-item.active-match .match-team-item.second-team .team---item {
        justify-content: flex-start;
    }

    #match_list_conf .inline-match-item.active-match .match-team-item .team---item b {
        max-width: none;
        font-size: 10px;
        line-height: 1.2;
    }

    #match_list_conf .inline-match-item.active-match .match-team-item .img {
        width: 24px;
        height: 24px;
        flex: 0 0 24px;
    }

    #match_list_conf .inline-match-item.active-match .team-result {
        font-size: 15px;
        min-width: 16px;
    }

    #match_list_conf .inline-match-item.active-match .active-match-progress {
        flex: 0 0 100%;
        order: 3;
        margin: 4px 0 0;
        display: flex;
        justify-content: center;
    }
}

@media (max-width: 767px) {
    .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo h3 {
        font-size: 14px;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-top .champ-header-actions,
    .profile-header-wrapper.club.auto-height-header .champ-header-top .season-dropdown-wrap {
        gap: 6px;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-btn {
        max-width: 104px;
        font-size: 11px;
        padding: 7px 10px;
    }

    .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    #match_list_conf .inline-match-item .first-team .team---item b,
    #match_list_conf .inline-match-item .second-team .team---item b {
        font-size: 11px;
    }
}

/* ── Light mode ── */
@media (max-width: 991px) {
    html.light .profile-page-header:has(.profile-header-wrapper.club.auto-height-header) {
        background: url("../images/champ-light-bg.svg") no-repeat center center #e3e5f0;
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo h3 {
        color: #131521;
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-btn {
        background: #fff;
        border-color: #e8ebf2;
        color: #2a3142;
        box-shadow: 0 1px 4px rgba(19, 21, 33, 0.06);
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ {
        background: #fff;
        border-color: #e8ebf2;
        color: #505668;
        box-shadow: 0 1px 4px rgba(19, 21, 33, 0.06);
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ.active {
        color: #1a9e88;
        border-color: rgba(57, 219, 191, 0.45);
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel {
        background: #fff;
        border: 1px solid #e8ebf2;
        box-shadow: 0 12px 30px rgba(19, 21, 33, 0.12);
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label {
        color: #2a3142;
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label:hover {
        background: #f4f6fb;
    }

    html.light .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .select_row {
        background: rgba(57, 219, 191, 0.12) !important;
        border-color: rgba(57, 219, 191, 0.45) !important;
        color: #1a9e88;
    }

    html.light .profile-header-wrapper.club.auto-height-header .match-links-scroll {
        border-top-color: #d8dce8;
        background: rgba(255, 255, 255, 0.35);
    }

    html.light .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item,
    html.light .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item {
        color: #707488;
    }

    html.light .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item.active,
    html.light .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item.active {
        color: #131521;
    }

    html.light .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown .rank-scope-toggle {
        color: #707488;
        border-color: #d8dce8;
        background: #fff;
    }

    html.light .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown:has(> a.active) .rank-scope-toggle {
        color: #131521;
        border-color: #c5cad8;
    }

    html.light .profile-page-header + section.inner-page-content:has(#match_list_conf) {
        background: #e3e5f0;
    }

    html.light #match_list_conf .inline-match-item.active-match .active-match-quick-link {
        background: #fff;
        border-color: #e0e4ef;
    }
}

/* ── Dark mode ── */
@media (max-width: 991px) {
    html.dark .profile-page-header:has(.profile-header-wrapper.club.auto-height-header),
    html:not(.light) .profile-page-header:has(.profile-header-wrapper.club.auto-height-header) {
        background: #131521;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo h3,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo h3 {
        color: #fff;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-btn,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-btn {
        background: #191d2d;
        border-color: #2a3048;
        color: #d8dbe8;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.08);
        color: #fff;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ.active,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-actions .add-fav-champ.active {
        color: #39dbbf;
        border-color: rgba(57, 219, 191, 0.45);
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel {
        background: #151823;
        border: 1px solid #2b3140;
        box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label {
        color: #e9ecf3;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label:hover,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .checkbox-settings-item label:hover {
        background: #202636;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .select_row,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel .select_row {
        background: #1f3d3a !important;
        border-color: rgba(57, 219, 191, 0.45) !important;
        color: #39dbbf;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .match-links-scroll,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .match-links-scroll {
        border-top-color: rgba(255, 255, 255, 0.06);
        background: rgba(0, 0, 0, 0.12);
    }

    html.dark .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item,
    html.dark .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item {
        color: #8b90a5;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item.active,
    html.dark .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item.active,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap > a.filter-cat-item.active,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown > a.filter-cat-item.active {
        color: #fff;
    }

    html.dark .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown .rank-scope-toggle,
    html:not(.light) .profile-header-wrapper.club.auto-height-header .match-links-scroll .filter-categories-wrap .rank-tab-with-dropdown .rank-scope-toggle {
        color: #8b90a5;
        border-color: #2a3048;
        background: #191d2d;
    }

    html.dark .profile-page-header + section.inner-page-content:has(#match_list_conf),
    html:not(.light) .profile-page-header + section.inner-page-content:has(#match_list_conf) {
        background: #131521;
    }
}

/* ── LTR ── */
@media (max-width: 991px) {
    html[dir="ltr"] .profile-header-wrapper.club.auto-height-header .champ-header-top .club-logo {
        text-align: left;
    }

    html[dir="ltr"] #match_list_conf .matches-top-title.text-center {
        text-align: left !important;
    }

    html[dir="ltr"] #match_list_conf .inline-match-item.active-match .match-team-item .team---item {
        text-align: left;
    }

    html[dir="ltr"] .profile-header-wrapper.club.auto-height-header .champ-header-actions .season-dropdown-panel {
        left: 0;
        right: auto;
        inset-inline-start: 0;
        inset-inline-end: auto;
    }
}

/* Desktop championship template on narrow screens (mini club) */
@media (max-width: 991px) {
    .profile-header-wrapper.mini.club {
        min-height: 0 !important;
        padding: 16px 15px 0 !important;
        margin-bottom: 0 !important;
        justify-content: flex-start !important;
    }

    .profile-header-wrapper.mini.club .club-profile-info {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .profile-header-wrapper.mini.club .club-logo-header,
    .profile-header-wrapper.mini.club .club-logo-header .club-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        margin: 0 0 12px !important;
        text-align: right;
    }

    .profile-header-wrapper.mini.club .club-logo-header .club-logo img {
        flex: 0 0 52px;
        width: 52px;
        height: 52px;
        margin: 0 !important;
        object-fit: contain;
    }

    .profile-header-wrapper.mini.club .club-logo-header .club-logo h3 {
        margin: 0 !important;
        font-size: 15px;
        font-weight: 800;
        line-height: 1.35;
        text-align: right;
    }

    .profile-header-wrapper.mini.club .season-dropdown-wrap {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end !important;
        gap: 8px;
        width: auto !important;
        max-width: none !important;
        margin: 0 0 12px !important;
        padding: 0 4px;
        position: relative;
        text-align: initial !important;
        align-self: flex-end;
    }

    .profile-header-wrapper.mini.club .season-dropdown-wrap .profile-actions {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        margin: 0 !important;
        display: flex;
        align-items: center;
    }

    .profile-header-wrapper.mini.club .season-dropdown-wrap .profile-actions a {
        margin: 0 !important;
    }

    .profile-header-wrapper.mini.club .season-dropdown-wrap .add-fav-champ {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        line-height: 0;
    }

    .profile-header-wrapper.mini.club .season-dropdown-wrap .add-fav-champ svg {
        display: block;
        width: 20px;
        height: 20px;
    }

    .profile-header-wrapper.mini.club .season-dropdown-btn {
        flex: 0 1 auto;
        max-width: min(132px, 34vw);
        margin: 0 !important;
        display: inline-flex;
        align-items: center;
        background: #191d2d;
        border: 1px solid #2a3048;
        color: #d8dbe8;
        border-radius: 10px;
        font-size: 12px;
        font-weight: 700;
        padding: 8px 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .profile-header-wrapper.mini.club .season-dropdown-panel {
        right: 0;
        left: auto;
        transform: none !important;
        z-index: 1000;
    }

    html.light .profile-header-wrapper.mini.club .season-dropdown-wrap .add-fav-champ {
        background: #fff;
        border-color: #e8ebf2;
    }

    html.light .profile-header-wrapper.mini.club .season-dropdown-wrap .add-fav-champ svg path {
        fill: #505668 !important;
    }

    html.light .profile-header-wrapper.mini.club .season-dropdown-btn {
        background: #fff;
        border-color: #e8ebf2;
        color: #2a3142;
    }

    html[dir="ltr"] .profile-header-wrapper.mini.club .season-dropdown-panel {
        left: 0;
        right: auto;
    }
}
