/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 1200px) {
    .match-team-sheet--compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .squad-stats-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    #page-match-info .squad-stats-hero {
        grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr);
    }

    .match-team-sheet--compact .match-team-sheet-panel--replacements {
        grid-column: 1 / -1;
        border-left: none;
        border-top: 1px solid #dbe2f4;
    }
}



@media (max-width: 768px) {

    .table > :not(caption) > * > * {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    #page-squad-stats .page-shell,
    #page-player-stats .page-shell,
    #page-league-tables .page-shell {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    #page-squad-stats .squad-stats-layout,
    #page-player-stats .squad-stats-layout,
    #page-league-tables .squad-stats-layout {
        gap: 0.45rem;
    }

    #page-squad-stats .squad-stats-main,
    #page-player-stats .squad-stats-main,
    #page-league-tables .squad-stats-main {
        gap: 0.55rem;
    }

    /* Page header: stack title/desc above filters on narrow screens */
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-filters {
        padding-top: 0;
    }

    #page-player-stats .player-stats-hero-head {
        align-items: stretch;
    }

    #page-player-stats .player-stats-main .chart-section-head {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.6rem;
    }

    #page-player-stats .player-stats-main .chart-panel-filters {
        width: 100%;
    }

    #page-player-stats .player-stats-main .chart-section-content--split {
        display: block;
    }

    #page-player-stats .player-stats-main .chart-section-meta {
        margin-bottom: 0.55rem;
    }

    #page-player-stats .position-picker__top-row {
        width: 100%;
    }

    #page-player-stats .position-picker__columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.3rem;
    }

    #page-player-stats .position-picker__group-btn {
        font-size: 0.78rem;
        letter-spacing: 0.03em;
    }

    #page-player-stats .position-picker__pos-btn {
        font-size: 0.74rem;
        padding-top: 0.24rem;
        padding-bottom: 0.24rem;
    }

    #page-player-stats .squad-stats-active-filters {
        margin-bottom: 0.7rem;
        gap: 0.35rem;
    }

    #page-player-stats .squad-stats-filter-chip {
        font-size: 0.8rem;
        padding: 0.24rem 0.42rem;
    }

    #page-player-stats .player-stats-hero-metric--appearances .desktop-label {
        display: none;
    }

    #page-player-stats .player-stats-hero-metric--appearances .mobile-label {
        display: inline !important;
    }

    .player-profiles-controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .player-profiles-sort-action {
        width: 100%;
        min-width: 0;
    }

    .squad-stats-hero {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    #page-match-info .squad-stats-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .ux-hero-title {
        font-size: clamp(1.75rem, 8vw, 2.4rem);
    }

    .ux-hero-description {
        font-size: 0.93rem;
        max-width: 100%;
    }

    .ux-hero-metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.35rem;
    }

    .ux-hero-metric {
        padding: 0.35rem 0.3rem;
    }

    .ux-hero-metric-value {
        font-size: clamp(1.5rem, 6.6vw, 2rem);
    }

    .ux-hero-metric-note {
        font-size: 0.72rem;
    }

    .squad-stats-active-filters {
        margin-top: -0.2rem;
        margin-bottom: 0.8rem;
        gap: 0.35rem;
    }

    .squad-stats-filter-chip {
        font-size: 0.78rem;
        padding: 0.18rem 0.45rem;
    }

    #page-squad-stats .squad-filter-segment {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #page-squad-stats .squad-filter-segment-btn {
        font-size: 0.86rem;
        min-height: 2.25rem;
    }

    #page-squad-stats .chart-section-content--split {
        display: block;
        gap: 0.65rem;
    }

    #page-squad-stats .chart-section {
        margin: 1.2rem 0;
    }

    #page-squad-stats .chart-section-block {
        margin-bottom: 0.85rem;
    }

    #page-squad-stats .chart-section-block--panel {
        padding: 0.6rem;
        border-radius: 0.65rem;
    }

    #page-squad-stats .chart-section-title {
        margin-bottom: 0.55rem;
    }

    #page-squad-stats .chart-section-head {
        flex-wrap: wrap;
        gap: 0.55rem;
        margin-bottom: 0.55rem;
    }

    #page-squad-stats .squad-filter-control--trend-view {
        width: 100%;
        align-items: stretch;
        margin-left: 0;
    }

    #page-squad-stats .squad-filter-control--trend-view .squad-filter-segment {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* #page-squad-stats .chart-section-head--position-count .squad-filter-control--panel-head {
        width: 100%;
        align-items: stretch;
        margin-left: 0;
    } */

    #page-squad-stats .chart-section-hint {
        margin-bottom: 0.4rem;
        line-height: 1.3;
    }

    #page-squad-stats .chart-section-content--split .chart-section-hint {
        flex: 1 1 auto;
    }

    #page-squad-stats .league-context-section-head {
        margin-bottom: 0.65rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #page-squad-stats .league-context-section-head .squad-stats-active-filters {
        width: 100%;
        flex: 1 1 100%;
    }

    #page-squad-stats .league-context-section-head .squad-filter-control--unit {
        width: 100%;
        flex: 1 1 100%;
    }

    #page-squad-stats .squad-filter-control--unit .squad-filter-segment {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #page-squad-stats .chart-host--intrinsic {
        width: 100%;
        padding: 0;
        background: none;
        border: none;
    }

    #page-squad-stats #squadOverlapChart,
    #page-squad-stats #leagueSquadSizeContextChart,
    #page-squad-stats #leagueContinuityContextChart {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        -webkit-overflow-scrolling: auto;
    }

    #page-squad-stats #squadOverlapChart .chart-embed-host,
    #page-squad-stats #leagueSquadSizeContextChart .chart-embed-host,
    #page-squad-stats #leagueContinuityContextChart .chart-embed-host {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
    }

    #page-squad-stats #squadOverlapChart .vega-embed,
    #page-squad-stats #leagueSquadSizeContextChart .vega-embed,
    #page-squad-stats #leagueContinuityContextChart .vega-embed,
    #page-squad-stats #squadOverlapChart .vega-embed > div,
    #page-squad-stats #leagueSquadSizeContextChart .vega-embed > div,
    #page-squad-stats #leagueContinuityContextChart .vega-embed > div {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }

    #page-squad-stats .chart-section-content--split > .chart-host--intrinsic {
        margin-top: 0.55rem;
    }

    #page-squad-stats .analysis-rail,
    #page-player-stats .analysis-rail,
    #page-league-tables .analysis-rail,
    #page-opposition-profile .analysis-rail {
        gap: 0.2rem;
        padding: 0.3rem;
        margin-bottom: 0.25rem;
    }

    #page-squad-stats .analysis-rail .rail-link,
    #page-player-stats .analysis-rail .rail-link,
    #page-league-tables .analysis-rail .rail-link,
    #page-opposition-profile .analysis-rail .rail-link {
        gap: 0.26rem;
        padding: 0.22rem 0.4rem;
        font-size: 0.78rem;
        border-radius: 0.5rem;
        line-height: 1.1;
        white-space: nowrap;
    }

    #page-squad-stats .analysis-rail .rail-link i,
    #page-player-stats .analysis-rail .rail-link i,
    #page-league-tables .analysis-rail .rail-link i,
    #page-opposition-profile .analysis-rail .rail-link i {
        font-size: 0.78rem;
    }

    #page-squad-stats .analysis-rail .rail-link .rail-link-label,
    #page-player-stats .analysis-rail .rail-link .rail-link-label,
    #page-league-tables .analysis-rail .rail-link .rail-link-label,
    #page-opposition-profile .analysis-rail .rail-link .rail-link-label {
        display: none;
    }

    #page-squad-stats .analysis-rail .rail-link::after,
    #page-player-stats .analysis-rail .rail-link::after,
    #page-league-tables .analysis-rail .rail-link::after,
    #page-opposition-profile .analysis-rail .rail-link::after {
        content: attr(data-short);
    }

    #page-squad-stats .analysis-rail-title,
    #page-player-stats .analysis-rail-title,
    #page-league-tables .analysis-rail-title,
    #page-opposition-profile .analysis-rail-title {
        display: inline-flex;
        align-items: center;
        margin: 0 0.12rem 0 0.08rem;
        font-size: 0.66rem;
        letter-spacing: 0.04em;
    }

    .chart-panel-filters {
        gap: 0.4rem;
        padding: 0.75rem 0.75rem 0.5rem 0.75rem;
    }

    .chart-panel-filters .input-group-text {
        width: auto !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        padding-left: 0.4rem !important;
        padding-right: 0.4rem !important;
        font-size: 0.75rem !important;
    }

    .chart-panel-filters .bootstrap-select {
        min-width: 0 !important;
        width: fit-content !important;
    }

    .chart-panel-filters .bootstrap-select .dropdown-toggle {
        min-width: 0 !important;
        padding: 0.3rem 0.4rem !important;
        font-size: 0.8rem !important;
    }

    .chart-panel-filters input.form-control {
        min-width: 2rem !important;
        max-width: 3rem !important;
        width: 3rem !important;
        flex: 0 0 3rem !important;
        font-size: 0.8rem;
    }

    /* Compact Squad Metrics cards */
    .squad-metric-card .card-header {
        line-height: 1.15;
    }

    .squad-metric-card .card-body {
        padding: 0.2rem 0.15rem;
    }

    .squad-metric-value {
        margin-bottom: 0.15rem;
    }

    .squad-metric-card .card-text {
        min-height: 2em;
    }

    .squad-position-panel {
        min-width: 100%;
        flex-basis: 100%;
    }

    .squad-position-cards-row {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.4rem;
    }

    .squad-position-card-title {
        padding: 0.3rem 0.2rem;
    }

    .squad-position-card-value {
        padding: 0.4rem 0.15rem;
    }

    .input-group {
        min-width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .input-group-text {
        min-width: 72px;
        flex: 0 0 auto;
        width: auto;
        padding-top: 0.2rem;
        padding-bottom: 0.2rem;
        line-height: 1.2;
        border-radius: 0.375rem 0 0 0.375rem !important;
    }

    .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.2rem;
    }

    .bootstrap-select .dropdown-toggle {
        font-size: 0.8rem !important;
        padding: 0.3rem 0.5rem !important;
        border-radius: 0 0.375rem 0.375rem 0 !important;
        border-left: none !important;
    }

    .league-season-picker .input-group {
        flex-direction: row;
        min-width: 0;
    }

    .league-season-picker .input-group-text {
        width: auto;
        min-width: 72px;
        border-radius: 0.375rem 0 0 0.375rem !important;
    }

    .league-season-picker .bootstrap-select .dropdown-toggle {
        border-radius: 0 0.375rem 0.375rem 0 !important;
        border-left: none !important;
        min-height: 34px;
        line-height: 1.1;
        white-space: nowrap !important;
    }

    /* Compact W/D/L/P cells on Season Summary while keeping one-row layout */
    #seasonSummary1stResults .squad-metric-card-header,
    #seasonSummary2ndResults .squad-metric-card-header {
        padding: 0.2rem 0.1rem;
        line-height: 1.1;
    }

    #seasonSummary1stResults .season-result-cell-body,
    #seasonSummary2ndResults .season-result-cell-body {
        padding: 0.2rem 0.1rem;
    }

    #seasonSummary1stResults .squad-metric-value,
    #seasonSummary2ndResults .squad-metric-value {
        line-height: 1;
    }

    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .col-md-4, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-6 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    #squadStatsCards .col-4 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card {
        margin-bottom: 0.5rem;
    }

    table {
        font-size: 0.8rem;
    }

    /* Navbar adjustments */
    .navbar {
        padding: 0.5rem 0.75rem !important;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .navbar-nav .nav-link {
        font-size: 0.95rem;
        padding: 0.5rem !important;
    }

    #squadSizeTrendChart,
    #squadContinuityTrendChart {
        width: 100%;
    }

    #squadSizeTrendChart .vega-embed,
    #squadContinuityTrendChart .vega-embed {
        transform: none !important;
        width: 100% !important;
        height: auto !important;
    }

    #squadSizeTrendChart .vega-embed > div,
    #squadContinuityTrendChart .vega-embed > div {
        width: 100% !important;
    }

    #squadSizeTrendChart .vega-embed svg,
    #squadContinuityTrendChart .vega-embed svg {
        width: 100% !important;
        height: auto !important;
        display: block;
    }
}

@media (max-width: 480px) {
    #page-squad-stats .page-shell,
    #page-player-stats .page-shell,
    #page-league-tables .page-shell,
    #page-opposition-profile .page-shell {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    #page-squad-stats .chart-section,
    #page-player-stats .chart-section,
    #page-league-tables .chart-section,
    #page-opposition-profile .chart-section {
        margin: 1rem 0;
    }

    #page-squad-stats .chart-section-block--panel,
    #page-player-stats .chart-section-block--panel,
    #page-league-tables .chart-section-block--panel,
    #page-opposition-profile .chart-section-block--panel {
        padding: 0.5rem;
    }

    #page-squad-stats .squad-stats-active-filters {
        margin-bottom: 0.6rem;
    }
}

@media (max-width: 767.98px) {
    .opposition-top-table thead th {
        font-size: 0.78rem !important;
        padding: 0.32rem 0.16rem;
    }

    .opposition-table-sort-button {
        gap: 0.18rem;
    }

    .opposition-top-table tbody td {
        padding: 0.32rem 0.16rem;
    }

    .opposition-top-table thead th:nth-child(n+3),
    .opposition-top-table tbody td:nth-child(n+3) {
        font-size: 0.88rem;
    }

    .opposition-table-rank {
        width: 1.5rem;
        font-size: 0.82rem;
    }

    .opposition-table-logo {
        width: 1.15rem;
        height: 1.15rem;
    }

    .opposition-table-opposition-content {
        gap: 0.28rem;
    }

    .opposition-table-opposition-content strong {
        font-size: 0.84rem;
        line-height: 1.1;
    }

    .opposition-table-games-1st,
    .opposition-table-games-2nd,
    .opposition-table-games-total {
        min-width: 2.1rem;
    }

    .opposition-table-result {
        min-width: 1.65rem;
    }

    .opposition-table-action {
        width: 1.95rem;
        min-width: 1.95rem;
    }

    #oppositionTopTableWrap .match-open-btn {
        width: 1.45rem;
        height: 1.45rem;
        --bs-btn-font-size: 0.72rem;
    }

    .opposition-profile-hero-metrics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .opposition-top-table thead th {
        font-size: 0.72rem !important;
        padding: 0.28rem 0.12rem;
    }

    .opposition-top-table tbody td {
        padding: 0.28rem 0.12rem;
    }

    .opposition-top-table thead th:nth-child(n+3),
    .opposition-top-table tbody td:nth-child(n+3) {
        font-size: 0.8rem;
    }

    .opposition-table-opposition-content strong {
        font-size: 0.78rem;
    }

    .opposition-table-games-1st,
    .opposition-table-games-2nd,
    .opposition-table-games-total {
        min-width: 1.9rem;
    }

    .opposition-table-result {
        min-width: 1.5rem;
    }

    .opposition-top-pagination-bar {
        gap: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .match-info-hero-grid {
        grid-template-columns: 1fr;
        /* Mobile: rows stack as home -> score -> away (roughly equal thirds).
           Gradient runs top-to-bottom with stops mirroring the desktop proportions. */
        background: linear-gradient(to bottom,
            var(--eg-color)     0%,
            var(--eg-color)     28%,
            var(--result-color) 38%,
            var(--result-color) 62%,
            var(--opp-color)    72%,
            var(--opp-color)    100%
        );
    }
    
    .match-detail-picker-row .match-detail-picker-item {
        width: 100%;
        min-width: 0;
    }

    .match-detail-picker-row .input-group,
    .match-detail-picker-row .input-group .bootstrap-select,
    .match-detail-picker-row .input-group .bootstrap-select .dropdown-toggle {
        width: 100% !important;
        min-width: 0;
    }

    /* Away on mobile: EG row is at the bottom */
    .match-info-hero--eg-away .match-info-hero-grid {
        background: linear-gradient(to bottom,
            var(--opp-color)    0%,
            var(--opp-color)    28%,
            var(--result-color) 38%,
            var(--result-color) 62%,
            var(--eg-color)     72%,
            var(--eg-color)     100%
        );
    }

    .match-info-team,
    .match-info-team--away,
    .match-info-score-wrap {
        text-align: center;
    }

    .match-info-team-shell {
        display: block;
    }

    .match-info-team-text {
        text-align: center;
    }

    .match-info-team-logo-wrap {
        display: none;
    }

    .match-info-score-line {
        display: grid;
        grid-template-columns: minmax(4.25rem, 5rem) auto minmax(4.25rem, 5rem);
        align-items: center;
        gap: 0.5rem;
    }

    .match-info-score-logo-wrap {
        display: flex;
        width: min(100%, 4.75rem);
    }

    .match-info-score-logo-wrap--home {
        justify-self: start;
    }

    .match-info-score-logo-wrap--away {
        justify-self: end;
    }

    .match-info-score-logo-wrap--empty {
        display: flex;
        visibility: hidden;
    }

    .match-info-team--away {
        text-align: center;
    }

    .match-info-meta {
        gap: 0.7rem;
    }

    .match-info-meta-row {
        flex-direction: column;
        gap: 0.7rem;
    }

    .match-info-meta-row--paired {
        display: flex;
        justify-content: center;
    }

    .match-info-meta-row--scoring {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.42rem;
    }

    .match-info-meta-row--scoring .match-info-meta-item {
        min-width: 0;
    }

    .match-info-meta-row--scoring .match-info-meta-label {
        font-size: 0.68rem;
    }

    .match-info-meta-row--scoring .match-info-meta-value {
        font-size: 0.82rem;
    }

    .match-info-meta-row--scoring .match-info-meta-divider {
        width: 1px;
        height: auto;
        align-self: stretch;
    }

    /* Keep Opposition Profile summary hero styling distinct from match-info hero on mobile. */
    .opposition-profile-hero-grid {
        grid-template-columns: 1fr;
        background: linear-gradient(to right,
            color-mix(in srgb, var(--primary-color) 24%, white) 0%,
            color-mix(in srgb, var(--primary-color) 12%, white) 46%,
            color-mix(in srgb, var(--accent-color) 10%, white) 74%,
            color-mix(in srgb, var(--accent-color) 18%, white) 100%
        );
    }

    .opposition-profile-team .match-info-team-name {
        color: var(--primary-color);
    }

    .opposition-profile-team .match-info-team-label {
        color: #5d6780;
    }

    .opposition-profile-team {
        padding: 0.7rem 0.85rem;
    }

    .opposition-profile-team-shell {
        display: flex;
        align-items: center;
        gap: 0.55rem;
    }

    .opposition-profile-team .match-info-team-text {
        text-align: left;
    }

    .opposition-profile-team .match-info-team-logo-wrap {
        display: inline-flex;
        width: clamp(2.35rem, 14vw, 2.9rem);
    }

    .match-info-scorers {
        padding: 0.8rem 0.85rem 0.9rem;
    }

    .match-info-scorers-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .match-info-meta-divider {
        width: 100%;
        height: 1px;
    }

    .match-team-sheet-top-grid {
        grid-template-columns: 1fr;
    }

    .match-team-sheet-header {
        padding: 0.72rem 0.9rem;
        font-size: 0.92rem;
    }

    .match-team-sheet-mode-toggle {
        font-size: 0.68rem;
        padding: 0 0.62rem;
        min-width: 6.6rem;
    }

    .match-team-sheet-starting-header {
        padding: 0.66rem 0.85rem 0.08rem;
    }

    .match-team-sheet-panel {
        padding: 0.78rem 0.85rem 0.88rem;
    }

    .match-team-sheet-title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .match-team-sheet-subtitle {
        margin-bottom: 0.48rem;
        font-size: 0.82rem;
    }

    .match-team-sheet-item {
        grid-template-columns: 4.35rem minmax(0, 1fr);
        gap: 0.5rem;
        padding: 0.1rem 0;
    }

    .match-team-sheet-number-wrap {
        width: 4.35rem;
        min-height: 3.85rem;
    }

    .match-team-sheet-number {
        font-size: clamp(42px, 12vw, 50px);
    }

    .match-team-sheet-avatar,
    .match-team-sheet-avatar-placeholder {
        width: 3.25rem;
        height: 3.25rem;
    }

    .match-team-sheet-player-wrap {
        gap: 0.5rem;
    }

    .match-team-sheet-player-link,
    .match-team-sheet-player-name {
        font-size: 1.03rem;
    }

    .match-team-sheet-badge {
        font-size: 0.62rem;
        padding: 0.07rem 0.35rem;
    }

    .match-team-sheet-badge-label-full {
        display: none;
    }

    .match-team-sheet-badge-label-short {
        display: inline;
    }

    .match-team-sheet--compact {
        grid-template-columns: 1fr;
    }

    .match-team-sheet--compact .match-team-sheet-header {
        font-size: 0.82rem;
        padding: 0.58rem 0.7rem;
    }

    .match-team-sheet--compact .match-team-sheet-mode-toggle {
        font-size: 0.63rem;
        padding: 0 0.52rem;
    }

    .match-team-sheet--compact .match-team-sheet-panel {
        padding: 0.56rem 0.66rem 0.65rem;
    }

    .match-team-sheet--compact .match-team-sheet-starting-header {
        padding: 0.5rem 0.66rem 0.05rem;
    }

    .match-team-sheet--compact .match-team-sheet-item {
        grid-template-columns: 2.9rem minmax(0, 1fr);
    }

    .match-team-sheet--compact .match-team-sheet-number-wrap {
        width: 2.9rem;
    }

    .match-team-sheet--compact .match-team-sheet-number {
        font-size: 31px;
    }

    .match-team-sheet--compact .match-team-sheet-player-link,
    .match-team-sheet--compact .match-team-sheet-player-name {
        font-size: 0.9rem;
    }

    .match-team-sheet-top-grid > .match-team-sheet-panel + .match-team-sheet-panel {
        border-left: none;
        border-top: 1px solid #dbe2f4;
    }
}

@media (max-width: 420px) {
    .match-team-sheet-panel {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    .match-team-sheet-starting-header {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    .match-team-sheet-item {
        grid-template-columns: 3.7rem minmax(0, 1fr);
        gap: 0.2rem;
    }

    .match-team-sheet-number-wrap {
        width: 3.7rem;
        min-height: 3rem;
    }

    .match-team-sheet-number {
        font-size: 2rem;
    }

    .match-team-sheet-avatar,
    .match-team-sheet-avatar-placeholder {
        width: 2.7rem;
        height: 2.7rem;
    }

    .match-team-sheet-player-link,
    .match-team-sheet-player-name {
        font-size: 0.95rem;
    }

    .match-team-sheet--compact .match-team-sheet-item {
        grid-template-columns: 2.55rem minmax(0, 1fr);
    }

    .match-team-sheet--compact .match-team-sheet-number-wrap {
        width: 2.55rem;
    }

    .match-team-sheet--compact .match-team-sheet-number {
        font-size: 28px;
    }

    .match-team-sheet--compact .match-team-sheet-player-link,
    .match-team-sheet--compact .match-team-sheet-player-name {
        font-size: 0.84rem;
    }
}

/* Very narrow screens */
@media (max-width: 480px) {

    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-nav .nav-link {
        font-size: 0.85rem;
        padding: 0.25rem !important;
    }

    h1 {
        font-size: 1.35rem;
    }

    /* Even more compact Squad Metrics cards on very small screens */
    .squad-metric-card .card-header {
        font-size: 1rem;
        line-height: 1.1;
    }

    .squad-metric-card .card-body {
        padding: 0.2rem 0.1rem;
    }

    .squad-metric-value {
        font-size: 2rem;
    }

    .squad-metric-card .card-text {
        font-size: 0.65rem;
    }

    .squad-position-cards-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    .card-body {
        padding: 0.25rem;
    }

    table {
        font-size: 0.75rem;
    }

    .input-group-text {
        font-size: 0.7rem;
    }

    .btn-group .btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.1rem;
    }

    .league-season-picker {
        min-width: 180px !important;
        max-width: 240px !important;
    }

    #seasonSummary1stResults .squad-metric-card-header,
    #seasonSummary2ndResults .squad-metric-card-header {
        font-size: 1.5rem;
        padding: 0.15rem 0.05rem;
        line-height: 1.05;
    }

    #seasonSummary1stResults .squad-metric-value,
    #seasonSummary2ndResults .squad-metric-value {
        font-size: 2rem;
    }
}

/* Squad Stats Page Responsive Refinements */
@media (max-width: 1200px) {
    .squad-stats-filters {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .squad-stats-filters .filter-item {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .squad-stats-filters {
        gap: 0.4rem;
        flex-direction: column;
    }

    .squad-stats-filters .filter-item {
        width: 100%;
        min-width: 0;
    }

    .squad-stats-filters .filter-item .input-group {
        width: 100%;
    }

    .card-filters {
        gap: 0.4rem;
        padding: 0.5rem 0;
    }

    .card-filters .filter-item {
        min-width: 140px;
    }

    .chart-section-title {
        font-size: 1.2rem;
    }

    .chart-section-hint {
        font-size: 0.85rem;
    }
}
/* Squad Stats Page Responsive Refinements */
@media (max-width: 1200px) {
    .squad-stats-layout {
        grid-template-columns: 1fr;
    }

    .squad-stats-layout .analysis-rail {
        display: flex;
    }
}

@media (max-width: 768px) {
    .squad-stats-filters {
        gap: 0.4rem;
        flex-direction: column;
    }

    .squad-stats-filters .filter-item {
        width: 100%;
        min-width: 0;
    }

    .squad-stats-filters .filter-item .input-group {
        width: 100%;
    }

    .card-filters {
        gap: 0.4rem;
        padding: 0.5rem 0;
    }

    .card-filters .filter-item {
        min-width: 140px;
    }

    .analysis-section-head h2 {
        font-size: 1.25rem;
    }
}
