.team-history-page .team-history-period {
    color: var(--team-muted);
    font-size: 0.84rem;
    margin: 0.55rem 0 0;
}

.team-history-page .team-history-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.team-history-content {
    color: var(--team-text);
    margin: 3rem auto 4rem;
    max-width: 1128px;
    width: 100%;
}

.team-history-section + .team-history-section {
    margin-top: 3rem;
}

.team-history-heading {
    align-items: baseline;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.team-history-heading h2 {
    color: var(--team-text);
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0;
}

.team-history-heading span,
.team-history-note {
    color: var(--team-muted);
    font-size: 0.78rem;
}

.team-history-note {
    margin: 0.7rem 0 0;
}

.team-history-table-wrap {
    background: var(--team-surface);
    border: 1px solid var(--team-border);
    border-radius: 6px;
    overflow-x: auto;
}

.team-history-page .team-history-table {
    background: var(--team-surface);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0;
    box-shadow: none;
    font-variant-numeric: tabular-nums;
    margin: 0;
    min-width: 620px;
    overflow: visible;
    width: 100%;
}

.team-history-table th,
.team-history-table td {
    border-bottom: 1px solid var(--team-table-line);
    padding: 0.72rem 0.9rem;
}

.team-history-table tr:last-child th,
.team-history-table tr:last-child td {
    border-bottom: 0;
}

.team-history-table thead {
    background: var(--team-surface-soft);
    color: var(--team-text);
}

.team-history-table thead th {
    background: var(--team-surface-soft);
    border-bottom: 2px solid var(--team-border-strong);
    color: var(--team-text);
    font-size: 0.75rem;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.team-history-table thead th:first-child,
.team-history-table tbody th {
    text-align: left;
}

.team-history-table tbody th {
    background: var(--team-surface);
    color: var(--team-text);
    font-weight: 700;
    white-space: nowrap;
}

.team-history-table tbody td {
    text-align: right;
}

.team-history-table tbody tr:nth-child(even) {
    background: var(--team-row-alt);
}

.team-history-table tbody tr:nth-child(even) > th {
    background: var(--team-row-alt);
}

.team-history-table tbody .team-history-subrow {
    background: var(--team-surface-soft);
}

.team-history-table tbody .team-history-subrow > th {
    background: var(--team-surface-soft);
}

.team-history-table thead th:first-child,
.team-history-table tbody th[scope='row'] {
    box-shadow: 1px 0 0 var(--team-border);
    left: 0;
    position: sticky;
    z-index: 1;
}

.team-history-table thead th:first-child {
    z-index: 2;
}

.team-history-table a {
    color: var(--team-accent);
    text-decoration: none;
}

.team-history-table a:hover,
.team-history-table a:focus-visible {
    color: var(--team-accent-strong);
    text-decoration: none;
}

.team-history-name-short {
    display: none;
}

.team-history-sort-note {
    color: var(--team-muted);
    font-size: 0.78rem;
    margin: 0 0 0.7rem;
}

.team-history-matchup-heading {
    color: var(--team-text);
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 0.7rem;
}

.team-history-defunct {
    border-top: 1px solid var(--team-border);
    margin-top: 1.5rem;
}

.team-history-defunct summary {
    cursor: pointer;
    font-weight: 800;
    min-height: 44px;
    padding: 0.7rem 0;
}

.team-history-defunct[open] summary {
    margin-bottom: 0.7rem;
}

.team-history-table th.team-history-sort-heading {
    padding: 0;
}

.team-history-sort {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    min-height: 44px;
    padding: 0.72rem 0.9rem;
    text-align: right;
    white-space: nowrap;
    width: 100%;
}

.team-history-sort::after {
    color: var(--team-muted);
    content: '↕';
    margin-left: 0.3rem;
}

.team-history-sort-heading[aria-sort='ascending'] .team-history-sort::after {
    color: var(--team-accent);
    content: '↑';
}

.team-history-sort-heading[aria-sort='descending'] .team-history-sort::after {
    color: var(--team-accent);
    content: '↓';
}

.team-history-sort:focus-visible,
.team-history-title-toggle:focus-visible {
    outline: 2px solid var(--team-accent);
    outline-offset: -3px;
}

.team-history-title-grid {
    background: var(--team-surface);
    border: 1px solid var(--team-border);
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
}

.team-history-title-grid > div {
    padding: 1rem;
    text-align: center;
}

.team-history-title-grid > div + div {
    border-left: 1px solid var(--team-border);
}

.team-history-title-grid dt {
    color: var(--team-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.team-history-title-grid dd {
    font-size: 1.6rem;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    margin: 0.3rem 0 0;
}

.team-history-title-toggle {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: block;
    font: inherit;
    min-height: 44px;
    padding: 0;
    width: 100%;
}

.team-history-title-toggle span {
    color: var(--team-accent);
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    margin-top: 0.25rem;
}

.team-history-title-toggle span::after {
    content: ' ▸';
}

.team-history-title-toggle[aria-expanded='true'] span::after {
    content: ' ▾';
}

.team-history-title-years {
    border-top: 1px solid var(--team-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.team-history-title-years h3 {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 0.7rem;
}

.team-history-title-years ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-variant-numeric: tabular-nums;
    list-style: none;
    margin: 0;
    padding: 0;
}

.team-history-title-years li {
    white-space: nowrap;
}

.team-history-year-table thead th:first-child,
.team-history-year-table tbody th {
    text-align: center;
    width: 8rem;
}

.team-history-postseason-years {
    margin-top: 1.5rem;
}

.team-history-table .team-history-stage {
    text-align: center;
}

@media (max-width: 767px) {
    .team-history-name-full {
        display: none;
    }

    .team-history-name-short {
        display: inline;
    }

    .team-history-matchups th:first-child {
        width: 7.5rem;
    }

    .team-history-page .team-history-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-history-page .team-history-summary > div:nth-child(odd) {
        border-left: 0;
    }

    .team-history-page .team-history-summary > div:nth-child(even) {
        border-left: 1px solid var(--team-border);
    }

    .team-history-page .team-history-summary > div:nth-child(n + 3) {
        border-top: 1px solid var(--team-border);
    }

    .team-history-page .team-history-summary > div:last-child {
        grid-column: 1 / -1;
    }

    .team-history-content {
        margin-top: 2rem;
    }

    .team-history-section + .team-history-section {
        margin-top: 2.25rem;
    }

    .team-history-title-grid dd {
        font-size: 1.2rem;
    }

    .team-history-title-grid > div {
        padding: 0.8rem 0.3rem;
    }
}
