/* Team stats panel — embedded on season page */

/* Line icons standing in for the old emoji markers - same conventions
   as the season page match grid. */
.match-icon {
    font-size: 0.8rem;
    color: #9aa3ad;
    vertical-align: -0.05em;
}

svg.match-icon {
    width: 0.95em;
    height: 0.95em;
    vertical-align: -0.15em;
}

/* Goals + assists reads as one mark, so the pair sits tight */
.match-icon-pair {
    display: inline-flex;
    align-items: center;
    gap: 0.15em;
}

/* .stats-header {
    background: #000000;
    color: #ffffff;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 4px solid #000000;
    text-align: center;
}

.stats-header h1 {
    font-family: 'Inter', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.stats-header .team-info {
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 1px;
    opacity: 0.9;
} */

.container {
    max-width: none !important;
    width: 100% !important;
}

.stats-container {

    width: 100%;

    margin: 0 auto;
    overflow-x: hidden;
    margin-top: 1rem;
    margin-bottom: 4rem
        /* Debug border to see container */
}

.table-container {
    width: 100% !important;
    overflow-x: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.mobile-table {
    width: 100% !important;
    max-width: 700px !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    margin: auto;
}

.stats-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 2px solid #000000;
    padding-bottom: 1rem;
}

.stats-title {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Squad Stats Table Styles - Override any external CSS */
.squad_stats {
    width: 100% !important;
    border-collapse: collapse !important;
    background: #ffffff !important;

    /* Hairline grid closed off on all four sides, as on the league table */
    border-top: 1px solid #e6e8eb;
    border-left: 1px solid #e6e8eb;

    margin-bottom: 2rem !important;
    table-layout: fixed !important;
    /* Use fixed layout for better control */
    overflow-x: hidden !important;
    max-width: 800px !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
}

/* Force override any external squad_stats styles */
body .squad_stats,
html .squad_stats,
.container .squad_stats,
.stats-container .squad_stats,
.mobile-table .squad_stats,
.table-container .squad_stats {
    max-width: 800px !important;
    width: 100% !important;
    margin: 0 !important;
    margin-bottom: 2rem !important;
}

/* Override external column width styles - only on desktop */
@media (min-width: 769px) {

    body .squad_stats td:first-child,
    body .squad_stats td:nth-child(3),
    body .squad_stats td:nth-child(4),
    body .squad_stats td:nth-child(5),
    body .squad_stats td:nth-child(6),
    body .squad_stats td:nth-child(7),
    body .squad_stats td:nth-child(8) {
        width: auto;
    }
}

/* Nuclear option - override any max-width: 100vw */
.squad_stats[style*="max-width: 100vw"],
.squad_stats[style*="max-width:100vw"] {
    max-width: 800px !important;
}

/* Override specific external CSS rules from styles.css */
.squad_stats {
    margin: 0 !important;
    margin-bottom: 50px !important;
    margin-top: 0 !important;
}

.squad_stats th:nth-child(2),
.squad_stats td:first-child {
    text-align: center !important;
}

.squad_stats td:nth-child(3),
.squad_stats td:nth-child(4),
.squad_stats td:nth-child(5),
.squad_stats td:nth-child(6),
.squad_stats td:nth-child(7),
.squad_stats td:nth-child(8) {
    width: auto !important;
}

.squad_stats td:first-child {
    width: auto !important;
}

/* Desktop column widths - Total: 100% (11 columns) */
.squad_stats th:nth-child(1),
.squad_stats td:nth-child(1) {
    width: 5% !important;
    min-width: 25px !important;
    text-align: center !important;
}

.squad_stats th:nth-child(2),
.squad_stats td:nth-child(2) {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

.squad_stats th:nth-child(3),
.squad_stats td:nth-child(3) {
    width: 25% !important;
    min-width: 100px !important;
    text-align: left !important;
    padding-left: 0.5rem !important;
}

.squad_stats th:nth-child(4),
.squad_stats th:nth-child(5),
.squad_stats th:nth-child(6),
.squad_stats th:nth-child(7),
.squad_stats th:nth-child(8),
.squad_stats th:nth-child(9),
.squad_stats th:nth-child(10),
.squad_stats th:nth-child(11),
.squad_stats td:nth-child(4),
.squad_stats td:nth-child(5),
.squad_stats td:nth-child(6),
.squad_stats td:nth-child(7),
.squad_stats td:nth-child(8),
.squad_stats td:nth-child(9),
.squad_stats td:nth-child(10),
.squad_stats td:nth-child(11) {
    width: 7% !important;
    min-width: 30px !important;
    text-align: center !important;
}

/* Keep all stat columns (rank/flag/player are columns 1-3) the same width */
.squad_stats th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]),
.squad_stats td[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
    width: 7% !important;
    min-width: 30px !important;
    text-align: center !important;
}

.squad_stats th {
    color: #9aa3ad;
    padding: 0.7rem 0.3rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border-right: 1px solid #e6e8eb;
    border-bottom: 1px solid #e6e8eb;
    cursor: pointer;
}

/* Icon-only header sizing */
.squad_stats thead th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
    line-height: 1;
    padding: 0.8rem 0.15rem;
}

.squad_stats th .match-icon {
    font-size: 0.95rem;
    margin: 0;
    vertical-align: 0;
    display: inline-block;
}

.squad_stats th .match-icon-pair {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15em;
}

.squad_stats th .match-icon-pair .match-icon {
    display: block;
}

.squad_stats td {
    padding: 0.5rem 0.2rem;
    border-right: 1px solid #e6e8eb;
    border-bottom: 1px solid #e6e8eb;
    font-size: 0.9rem;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.squad_stats tbody tr {
    transition: background 0.15s ease;
}

.squad_stats tbody tr:hover {
    background: #fafbfc;
}


/* Player name styling */
.first-name {
    font-weight: 600;
    color: #000000;
    font-size: 0.8rem;

    line-height: 1.2;
}

.last-name {
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
    line-height: 1.6;
}

/* Flag styling */
.squad_stats img {
    border-radius: 2px;
}

/* Enhanced table styling */
.squad_stats th {
    font-weight: 600;
    white-space: normal;
    word-wrap: break-word;
}

.squad_stats td {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

/* Player name column text handling */
.squad_stats td:nth-child(3) {
    white-space: normal;
    word-wrap: break-word;
}

/* Number column styling */
.squad_stats td:nth-child(1) {
    font-weight: 600;
    color: #666;
    font-family: var(--font-mono);
}

/* Flag column centering */
.squad_stats td:nth-child(2) {
    text-align: center;
}

/* Mobile table overflow handling - same as table.php */
.mobile-table {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
}

/* Responsive table adjustments */
@media (max-width: 768px) {
    .table-container {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .squad_stats {
        font-size: 0.8rem;
        table-layout: fixed;
        width: 100%;
    }

    .squad_stats th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]),
    .squad_stats td[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
        width: 6% !important;
        min-width: 0 !important;
    }

    .squad_stats thead th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
        font-size: 0.72rem;
        line-height: 1;
        padding: 0.8rem 0.12rem;
    }

    .squad_stats th,
    .squad_stats td {
        padding: 0.6rem 0.2rem;
    }

    .squad_stats th:nth-child(1),
    .squad_stats td:nth-child(1) {
        width: 6%;
    }

    .squad_stats th:nth-child(2),
    .squad_stats td:nth-child(2) {
        width: 6% !important;
    }

    .squad_stats th:nth-child(3),
    .squad_stats td:nth-child(3) {
        width: 28%;
    }

    .squad_stats th:nth-child(4),
    .squad_stats th:nth-child(5),
    .squad_stats th:nth-child(6),
    .squad_stats th:nth-child(7),
    .squad_stats th:nth-child(8),
    .squad_stats th:nth-child(9),
    .squad_stats th:nth-child(10),
    .squad_stats th:nth-child(11),
    .squad_stats td:nth-child(4),
    .squad_stats td:nth-child(5),
    .squad_stats td:nth-child(6),
    .squad_stats td:nth-child(7),
    .squad_stats td:nth-child(8),
    .squad_stats td:nth-child(9),
    .squad_stats td:nth-child(10),
    .squad_stats td:nth-child(11) {
        width: 6%;
    }
}

@media (max-width: 480px) {
    .squad_stats {
        font-size: 0.7rem;
        width: 100%;
    }

    .squad_stats th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]),
    .squad_stats td[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
        width: 6.5% !important;
        min-width: 0 !important;
    }

    .squad_stats thead th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
        font-size: 0.66rem;
        line-height: 1;
        padding: 0.8rem 0.3rem;
    }

    .squad_stats th,
    .squad_stats td {
        padding: 0.5rem 0.1rem;
    }

    .last-name {
        font-size: 0.6rem;
    }

    .first-name {
        font-size: 0.8rem;
    }

    .squad_stats img {
        width: 15px !important;
        height: 15px !important;
    }

    /* Target flag column specifically */
    .squad_stats td:nth-child(2) img {
        width: 15px !important;
        height: 15px !important;
    }

    /* Hide rank column on very small screens */
    .squad_stats th:nth-child(1),
    .squad_stats td:nth-child(1) {
        display: none;
    }

    /* Hide less important columns on small screens */
    .squad_stats th:nth-child(10),
    .squad_stats th:nth-child(11),
    .squad_stats td:nth-child(10),
    .squad_stats td:nth-child(11) {
        display: none;
    }

    .squad_stats th:nth-child(2),
    .squad_stats td:nth-child(2) {
        width: 8% !important;
    }

    .squad_stats th:nth-child(3),
    .squad_stats td:nth-child(3) {
        width: 40%;
    }

    .squad_stats th:nth-child(4),
    .squad_stats th:nth-child(5),
    .squad_stats th:nth-child(6),
    .squad_stats th:nth-child(7),
    .squad_stats th:nth-child(8),
    .squad_stats th:nth-child(9),
    .squad_stats td:nth-child(4),
    .squad_stats td:nth-child(5),
    .squad_stats td:nth-child(6),
    .squad_stats td:nth-child(7),
    .squad_stats td:nth-child(8),
    .squad_stats td:nth-child(9) {
        width: 6.5%;
    }
}

@media (max-width: 320px) {
    .squad_stats {
        font-size: 0.6rem;
        width: 100%;
    }

    .squad_stats th,
    .squad_stats td {
        padding: 0.2rem 0.05rem;
    }

    .squad_stats th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]),
    .squad_stats td[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
        width: 4.3% !important;
        min-width: 12px !important;
        text-align: center !important;
    }

    /* Hide rank column */
    .squad_stats th:nth-child(1),
    .squad_stats td:nth-child(1) {
        display: none;
    }

    /* Hide substitution columns */
    .squad_stats th:nth-child(10),
    .squad_stats th:nth-child(11),
    .squad_stats td:nth-child(10),
    .squad_stats td:nth-child(11) {
        display: none;
    }

    .squad_stats th:nth-child(2),
    .squad_stats td:nth-child(2) {
        width: 10% !important;
    }

    .squad_stats th:nth-child(3),
    .squad_stats td:nth-child(3) {
        width: 45%;
    }

    .squad_stats th:nth-child(4),
    .squad_stats th:nth-child(5),
    .squad_stats th:nth-child(6),
    .squad_stats th:nth-child(7),
    .squad_stats th:nth-child(8),
    .squad_stats th:nth-child(9),
    .squad_stats td:nth-child(4),
    .squad_stats td:nth-child(5),
    .squad_stats td:nth-child(6),
    .squad_stats td:nth-child(7),
    .squad_stats td:nth-child(8),
    .squad_stats td:nth-child(9) {
        width: 7.5%;
        min-width: 20px;
        padding-left: 0.1rem;
    }

    .squad_stats th:nth-child(4),
    .squad_stats th:nth-child(5),
    .squad_stats th:nth-child(6),
    .squad_stats th:nth-child(7),
    .squad_stats th:nth-child(8),
    .squad_stats th:nth-child(9),
    .squad_stats th:nth-child(10),
    .squad_stats td:nth-child(4),
    .squad_stats td:nth-child(5),
    .squad_stats td:nth-child(6),
    .squad_stats td:nth-child(7),
    .squad_stats td:nth-child(8),
    .squad_stats td:nth-child(9),
    .squad_stats td:nth-child(10) {
        width: 4.3%;
        min-width: 12px;
    }
}

@media (max-width: 280px) {
    .squad_stats {
        font-size: 0.55rem;
    }

    .squad_stats th,
    .squad_stats td {
        padding: 0.15rem 0.02rem;
    }

    .squad_stats th[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]),
    .squad_stats td[data-col]:not([data-col="rank"]):not([data-col="flag"]):not([data-col="player"]) {
        width: 3.7% !important;
        min-width: 8px !important;
        text-align: center !important;
    }

    .squad_stats th:nth-child(1),
    .squad_stats td:nth-child(1) {
        width: 4%;
        min-width: 8px;
    }

    .squad_stats th:nth-child(2),
    .squad_stats td:nth-child(2) {
        width: 4%;
        min-width: 10px;
    }

    .squad_stats th:nth-child(3),
    .squad_stats td:nth-child(3) {
        width: 55%;
        min-width: 30px;
        padding-left: 0.05rem;
    }

    .squad_stats th:nth-child(4),
    .squad_stats th:nth-child(5),
    .squad_stats th:nth-child(6),
    .squad_stats th:nth-child(7),
    .squad_stats th:nth-child(8),
    .squad_stats th:nth-child(9),
    .squad_stats th:nth-child(10),
    .squad_stats td:nth-child(4),
    .squad_stats td:nth-child(5),
    .squad_stats td:nth-child(6),
    .squad_stats td:nth-child(7),
    .squad_stats td:nth-child(8),
    .squad_stats td:nth-child(9),
    .squad_stats td:nth-child(10) {
        width: 3.7%;
        min-width: 8px;
    }
}

/* Desktop optimization - ensure table fits container */
@media (min-width: 901px) {
    .stats-container {
        width: 800px !important;
        max-width: 800px !important;
    }

    .team-stats-layout .stats-container {
        width: 100% !important;
        max-width: none !important;
    }

    .squad_stats {
        max-width: 800px !important;
        width: 100% !important;
        margin: 0 auto;
    }

    .team-stats-layout .squad_stats {
        max-width: none !important;
        margin: 0;
    }

    .squad_stats th:nth-child(1),
    .squad_stats td:nth-child(1) {
        width: 4%;
        min-width: 20px;
    }

    .squad_stats th:nth-child(2),
    .squad_stats td:nth-child(2) {
        width: 4%;
        min-width: 20px;
    }

    .squad_stats th:nth-child(3),
    .squad_stats td:nth-child(3) {
        width: 28%;
        min-width: 60px;
    }

    .squad_stats th:nth-child(4),
    .squad_stats th:nth-child(5),
    .squad_stats th:nth-child(6),
    .squad_stats th:nth-child(7),
    .squad_stats th:nth-child(8),
    .squad_stats th:nth-child(9),
    .squad_stats th:nth-child(10),
    .squad_stats td:nth-child(4),
    .squad_stats td:nth-child(5),
    .squad_stats td:nth-child(6),
    .squad_stats td:nth-child(7),
    .squad_stats td:nth-child(8),
    .squad_stats td:nth-child(9),
    .squad_stats td:nth-child(10) {
        width: 6%;
        min-width: 30px;
    }
}

/* ------------------------------------------------------------------
   Two-column layout: player table left, team summary right
   ------------------------------------------------------------------ */
.team-stats-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 1.5rem 1.75rem;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto 4rem auto;
    padding: 1rem;
}

.team-stats-layout__players {
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
}

.team-stats-layout__team {
    min-width: 0;
    position: sticky;
    top: 4.5rem;
    grid-column: 2;
    grid-row: 1 / -1;
}

.team-stats-layout > .division-history-card {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
}

.team-stats-layout .stats-container {
    width: 100%;
    margin: 0;
    overflow-x: hidden;
}

.team-stats-layout .mobile-table {
    max-width: none !important;
    margin: 0;
}

.team-stats-layout .squad_stats,
.team-stats-layout body .squad_stats,
.team-stats-layout .stats-container .squad_stats,
.team-stats-layout .mobile-table .squad_stats,
.team-stats-layout .table-container .squad_stats {
    max-width: none !important;
    width: 100% !important;
    margin-bottom: 0 !important;
}

.team-stats-layout .team-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    max-width: none;
    margin: 0;
}

@media (max-width: 900px) {
    .team-stats-layout {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }

    .team-stats-layout__players,
    .team-stats-layout__team,
    .team-stats-layout > .division-history-card {
        grid-column: auto;
        grid-row: auto;
    }

    .team-stats-layout__team {
        position: static;
    }

    .team-stats-layout .team-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .team-stats-layout .team-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------------
   Season summary panels - the hairline grid used for matches on the
   season page, so the two pages read as one layout.
   ------------------------------------------------------------------ */
.team-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    max-width: 800px;
    margin: 0 auto 4rem auto;
    background: #ffffff;
    border-top: 1px solid #e6e8eb;
    border-left: 1px solid #e6e8eb;
}

.stat-panel {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1.15rem 1.2rem;
    border-right: 1px solid #e6e8eb;
    border-bottom: 1px solid #e6e8eb;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #9aa3ad;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stat-icon .match-icon {
    font-size: 0.85rem;
}

.stat-title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #9aa3ad;
}

.stat-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.main-stat {
    text-align: center;
    padding: 0.75rem 0.5rem;
    border: 1px solid #e6e8eb;
    border-radius: 6px;
}

.stat-number {
    font-size: 1.35rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.stat-secondary {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: #9aa3ad;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: auto;
}

.goals-card .stat-grid {
    grid-template-columns: repeat(2, 1fr);
}

.stat-item {
    text-align: center;
    padding: 0.5rem 0.3rem;
    border: 1px solid #e6e8eb;
    border-radius: 6px;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: #9aa3ad;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    line-height: 1.3;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
}

.form-indicator {
    margin-top: auto;
}

.form-badges {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Tinted rather than filled, matching the season page score badges */
.result-badge {
    padding: 0.12rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.result-win {
    background-color: #eef8f3;
    border-color: #d5ebe1;
    color: #2f7d5f;
}

.result-draw {
    background-color: #fff5e8;
    border-color: #fbe3c7;
    color: #a05a00;
}

.result-loss {
    background-color: #fdeef2;
    border-color: #f6d9e1;
    color: #a8123b;
}

@media (max-width: 900px) {
    .team-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .team-stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-panel {
        padding: 1rem;
    }
}

/* Table view toggle buttons - match index.php stats-toggle-btn styles */
.stats-view-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    margin: 0 0 2rem 0;
    padding: 0;
    flex-wrap: wrap;
}

.stats-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e6e8eb;
    box-shadow: none;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #111111;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    line-height: 1;
    margin: 0;
}

.stats-view-btn .match-icon {
    font-size: 1rem;
    line-height: 1;
    vertical-align: 0;
    display: block;
    margin: 0;
}

.stats-view-btn svg.match-icon {
    width: 1rem;
    height: 1rem;
    vertical-align: 0;
    display: block;
}

.stats-view-btn .match-icon-pair {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15em;
    line-height: 1;
}

.stats-view-btn .match-icon-pair .match-icon {
    display: block;
}

.stats-view-btn:hover {
    background: #fafbfc;
    border-color: #d3d8dd;
    color: #111111;
}

.stats-view-btn.active {
    background: #ffffff;
    border-color: #111111;
}

.stats-view-btn.active .match-icon {
    color: #111111;
}

@media (max-width: 767px) {
    .stats-view-buttons {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .stats-view-btn {
        width: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
        padding: 0;
        font-size: 0.8rem;
        flex: 0 0 auto;
    }
}

@media (max-width: 480px) {
    .stat-item {
        padding: 0.5rem 0.25rem;
    }

    .stat-value {
        font-size: 0.9rem;
    }

    .stat-label {
        font-size: 0.55rem;
    }
}

/* Override season-page flex layout when stats panel is embedded */
#teamPanelStats .stats-container {
    flex: none;
    min-width: 0;
    width: 100%;
    margin: 0;
    overflow-x: hidden;
}

#teamPanelStats .team-stats-layout {
    margin-bottom: 4rem;
}

/* League finish history chart — under player stats on desktop, under team stats on mobile */
.team-stats-layout > .division-history-card {
    border: 1px solid #e6e8eb;
    background: #ffffff;
}

.division-history-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.division-history-title-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.division-history-title-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-width: 4.5rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid #e6e8eb;
    border-radius: 6px;
    background: #f8f9fa;
    box-sizing: border-box;
    text-align: center;
}

.division-history-title-chip__season {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111111;
    line-height: 1.1;
}

.division-history-title-chip__div {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9aa3ad;
}

.division-history-chart-wrap {
    position: relative;
    width: 100%;
    height: 18rem;
    margin-top: 0;
    min-width: 0;
}

.division-history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    list-style: none;
    margin: 0.15rem 0 0;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9aa3ad;
}

.division-history-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.division-history-swatch {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #111111;
    flex-shrink: 0;
}

.division-history-swatch.is-champions {
    background: #c9a227;
}

.division-history-swatch.is-promoted {
    background: #2f9e44;
}

.division-history-swatch.is-relegated {
    background: #c92a2a;
}

@media (max-width: 700px) {
    .division-history-chart-wrap {
        height: 12rem;
    }
}
