/**
 * Roster page — slim identity header, underline tabs, refined tables
 * Layout rebuilt by modern.js (rebuildRosterPage).
 */

.content-card.roster-page {
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--sh-2);
}

/* ========== HEADER ========== */
.roster-header {
    padding: 26px 32px 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,.035), transparent 80%),
        rgba(0,0,0,.22);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 1;
}

.roster-header::before {
    content: "";
    position: absolute;
    left: 0; top: 0; right: 0;
    height: 2px;
    background: var(--team-primary, var(--red));
}

.roster-identity {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.roster-team-name {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: clamp(28px, 3.5vw, 40px);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .01em;
    color: var(--white);
    margin: 0;
    line-height: 1;
    background: none;
    -webkit-text-fill-color: initial;
}

.roster-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: stretch;
    justify-content: flex-end;
    max-width: min(100%, 720px);
}

.roster-meta-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 11px;
    background: rgba(0,0,0,.28);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    min-width: 88px;
    flex: 0 1 auto;
}

.roster-meta-chip .lab {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted-2);
    white-space: nowrap;
}

.roster-meta-chip .val {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--white);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    white-space: nowrap;
}

.roster-meta-chip.neg .val { color: var(--grade-bad); }
.roster-meta-chip.pos .val { color: var(--ok, #3dd68c); }

html[data-theme="light"] .roster-meta-chip {
    background: rgba(15, 30, 60, .05);
}
html[data-theme="light"] .roster-meta-chip .val {
    color: var(--text-strong, #0f1e3c);
}
html[data-theme="light"] .roster-meta-chip.pos .val {
    color: #0f9f6e;
}

/* ========== UNDERLINE TABS ========== */
.roster-nav-tabs {
    display: flex;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -32px;
    padding: 0 32px;
}
.roster-nav-tabs::-webkit-scrollbar { display: none; }

.roster-tab {
    flex: 0 0 auto;
    padding: 12px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: color .16s var(--ease), border-color .16s var(--ease);
    white-space: nowrap;
    box-shadow: none;
}

.roster-tab:hover {
    color: var(--white);
    background: transparent;
    border-color: transparent;
}

.roster-tab.active {
    color: var(--white);
    background: transparent;
    border-bottom-color: var(--red-hot);
    box-shadow: none;
}

/* ========== CONTENT ========== */
.roster-content-area {
    padding: 24px 32px 32px;
    position: relative;
    z-index: 1;
}

.roster-tabs-container { position: relative; z-index: 1; }

.roster-tab-content {
    display: none !important;
    animation: rosterFade .22s var(--ease);
}
.roster-tab-content.active { display: block !important; }

@keyframes rosterFade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.roster-empty-state {
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* Yearly stats — compact metric strip */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
}

.stat-item {
    background: rgba(0,0,0,.22);
    border: none;
    border-left: none;
    padding: 16px 18px;
    border-radius: 0;
    transition: background .16s var(--ease);
}
.stat-item:hover { background: rgba(0,0,0,.32); }

.stat-label {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 4px;
}

.stat-value {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--white);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}

.roster-yearly-wrap {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.roster-yearly-heading {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-strong, var(--white));
    margin: 0 0 12px;
}

.roster-yearly-heading span {
    display: inline;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.roster-yearly-note {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.roster-yearly-note a {
    color: var(--text);
    border-bottom: 1px dotted var(--line-strong);
}

.roster-yearly-note a:hover {
    color: var(--red-hot, #e11d48);
}

.stat-item-net .stat-value.bsl-pos { color: var(--pos-good, #22c55e); }
.stat-item-net .stat-value.bsl-neg { color: var(--grade-bad, #ef4444); }

.stat-rank {
    margin-top: 4px;
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.stat-rank span {
    font-weight: 600;
    opacity: .75;
}

/* ========== TABLES ========== */
.roster-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--card);
    max-width: 100%;
}

.content-card.roster-page .roster-modern-table,
.roster-modern-table {
    width: 100%;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    background: transparent !important;
    font-size: 13px;
    table-layout: fixed !important;
    min-width: 640px;
}

.content-card.roster-page .roster-modern-table td,
.content-card.roster-page .roster-modern-table th,
.content-card.roster-page .roster-modern-table td *,
.content-card.roster-page .roster-modern-table th * {
    word-break: keep-all !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
}

.roster-modern-table thead {
    background: rgba(0,0,0,.45) !important;
}
.roster-modern-table thead tr {
    background: rgba(0,0,0,.45) !important;
    border-bottom: 1px solid var(--line-strong) !important;
}

.roster-modern-table th {
    padding: 11px 12px;
    text-align: left;
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-weight: 700;
    color: var(--muted) !important;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .1em;
    white-space: nowrap;
    background: transparent !important;
    border: none !important;
}

.roster-modern-table td {
    padding: 10px 12px;
    color: var(--text);
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.roster-modern-table tbody tr:last-child td { border-bottom: none; }
.roster-modern-table tbody tr:hover td { background: var(--surface-2); }

/*
 * Freeze ID + Name while other columns scroll underneath.
 * Backgrounds match normal header/row cells so sticky cols don’t look like a
 * different panel. --roster-id-w is measured in JS (0 when ID is hidden).
 */
.roster-modern-table {
    --roster-id-w: 48px;
    --roster-row-even: var(--card);
    --roster-row-odd: color-mix(in srgb, var(--card) 92%, #ffffff 8%);
    --roster-head-bg: rgba(0, 0, 0, .45);
}
html[data-theme="light"] .roster-modern-table {
    --roster-row-odd: color-mix(in srgb, var(--card) 94%, #0f1c37 6%);
    --roster-head-bg: rgba(15, 28, 55, .12);
}

.roster-modern-table tr.even-row td { background: var(--roster-row-even); }
.roster-modern-table tr.odd-row td { background: var(--roster-row-odd); }

.content-card.roster-page .roster-modern-table th:nth-child(1),
.content-card.roster-page .roster-modern-table td:nth-child(1),
.content-card.roster-page .roster-modern-table th:nth-child(2),
.content-card.roster-page .roster-modern-table td:nth-child(2),
.roster-modern-table th:nth-child(1),
.roster-modern-table td:nth-child(1),
.roster-modern-table th:nth-child(2),
.roster-modern-table td:nth-child(2) {
    position: sticky;
    z-index: 3;
    box-sizing: border-box;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: none;
}
.content-card.roster-page .roster-modern-table th:nth-child(1) *,
.content-card.roster-page .roster-modern-table td:nth-child(1) *,
.content-card.roster-page .roster-modern-table th:nth-child(2) *,
.content-card.roster-page .roster-modern-table td:nth-child(2) *,
.roster-modern-table th:nth-child(1) *,
.roster-modern-table td:nth-child(1) *,
.roster-modern-table th:nth-child(2) *,
.roster-modern-table td:nth-child(2) * {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
}
.roster-modern-table th:nth-child(1),
.roster-modern-table td:nth-child(1) {
    left: 0;
    z-index: 4;
}
.roster-modern-table th:nth-child(2),
.roster-modern-table td:nth-child(2) {
    left: var(--roster-id-w);
    z-index: 3;
    box-shadow: 1px 0 0 var(--line);
}
.roster-modern-table thead th:nth-child(1),
.roster-modern-table thead th:nth-child(2) {
    z-index: 6;
    background: var(--roster-head-bg) !important;
    background-color: var(--roster-head-bg) !important;
}
.roster-modern-table tbody tr.even-row td:nth-child(1),
.roster-modern-table tbody tr.even-row td:nth-child(2) {
    background: var(--roster-row-even) !important;
    background-color: var(--roster-row-even) !important;
}
.roster-modern-table tbody tr.odd-row td:nth-child(1),
.roster-modern-table tbody tr.odd-row td:nth-child(2) {
    background: var(--roster-row-odd) !important;
    background-color: var(--roster-row-odd) !important;
}
.roster-modern-table tbody tr:hover td:nth-child(1),
.roster-modern-table tbody tr:hover td:nth-child(2) {
    background: var(--surface-2) !important;
    background-color: var(--surface-2) !important;
}

.roster-modern-table a {
    color: var(--white);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
}
.roster-modern-table a:hover {
    color: var(--red-hot);
    border-bottom-color: var(--red-hot);
}

/* Column widths */
.roster-modern-table th:nth-child(1),
.roster-modern-table td:nth-child(1) {
    width: 48px;
    min-width: 48px;
    text-align: center !important;
    color: var(--muted-2);
    padding-left: 10px !important;
    padding-right: 6px !important;
}

.roster-modern-table th:nth-child(2),
.roster-modern-table td:nth-child(2) {
    width: 180px !important;
    min-width: 160px !important;
    max-width: 200px !important;
}

/* Salaries / wide sheets: don't crush columns into 640px — scroll instead */
.roster-table-salaries.roster-modern-table,
.roster-table-stats.roster-modern-table,
.roster-table-abilities.roster-modern-table {
    min-width: 1100px !important;
    width: max-content !important;
    table-layout: fixed !important;
}

.roster-modern-table th:nth-child(3),
.roster-modern-table td:nth-child(3) {
    width: 48px;
    text-align: center;
}

.roster-table-abilities th:nth-child(n+7),
.roster-table-abilities td:nth-child(n+7) {
    text-align: center;
    width: 48px;
}

.roster-table-abilities th:nth-child(4),
.roster-table-abilities td:nth-child(4),
.roster-table-abilities th:nth-child(5),
.roster-table-abilities td:nth-child(5),
.roster-table-abilities th:nth-child(6),
.roster-table-abilities td:nth-child(6) {
    text-align: center;
}

.roster-table-stats th:nth-child(n+4),
.roster-table-stats td:nth-child(n+4) {
    text-align: right;
}

.roster-table-salaries th:nth-child(n+5),
.roster-table-salaries td:nth-child(n+5) {
    text-align: right;
}

/* Grade cells in abilities */
.roster-table-abilities td:nth-child(n+7) {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-weight: 700;
    font-size: 14px;
}

/* Draft picks */
.draft-picks-container { display: grid; gap: 12px; }
.draft-owed-meta {
    margin: 0 0 4px;
    font-size: 12.5px;
    color: var(--muted-2);
}
.draft-owed-meta a { color: var(--blue, #4d8bff); }
.draft-picks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.draft-pick-card {
    background: rgba(0,0,0,.22);
    border: 1px solid var(--line);
    border-left: 2px solid var(--team-primary, var(--red));
    border-radius: var(--r-md);
    padding: 14px;
    box-shadow: none;
}
.draft-year-card { display: flex; flex-direction: column; gap: 4px; }

.draft-year-section { display: flex; flex-direction: column; gap: 8px; }

.draft-year-header {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .1em;
    text-align: left;
    padding: 0 0 8px;
    background: transparent;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    border-radius: 0;
    text-transform: uppercase;
}

.draft-year-picks { display: flex; flex-direction: column; gap: 0; }

.draft-pick-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    padding: 10px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}
.draft-pick-item:last-child { border-bottom: none; padding-bottom: 0; }
.draft-pick-top { display: flex; flex-direction: column; gap: 2px; }

.draft-round {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.draft-team {
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
}
.draft-own { color: var(--white); }
.draft-via { color: #b8f0d4; }
.draft-notes { display: flex; flex-direction: column; gap: 3px; }
.draft-note {
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--muted);
    padding: 4px 7px;
    border-radius: 6px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
}
.draft-note-chain { color: #b8f0d4; border-color: rgba(61,214,140,.25); background: rgba(61,214,140,.06); }
.draft-pick-item.draft-pick-locked .draft-note-chain {
    color: #ffd89a;
    border-color: rgba(245,166,35,.3);
    background: rgba(245,166,35,.08);
}
.draft-pick-item.draft-pick-termed,
.draft-pick-item.draft-pick-locked {
    border-radius: 8px;
    margin: 4px 0;
    padding: 8px;
}
.draft-pick-item.draft-pick-termed { background: rgba(61,214,140,.05); }
.draft-pick-item.draft-pick-locked { background: rgba(245,166,35,.06); }

.draft-year { color: var(--team-primary, var(--red-hot)); font-weight: 700; font-size: 14px; }
.draft-info { color: var(--text); font-size: 13px; }

/* Injuries */
.injuries-container { display: grid; gap: 8px; }

.injury-item {
    display: grid;
    grid-template-columns: 180px 1fr 100px;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(239,68,68,.06);
    border: 1px solid rgba(239,68,68,.18);
    border-left: 2px solid var(--bad);
    border-radius: var(--r-sm);
    align-items: center;
}

/* History / schedule — embedded as roster tabs */
.roster-aux-panel {
    min-height: 120px;
}
.roster-aux-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}
.roster-aux-inner > table,
.roster-history-panel table.roster-history-table,
.roster-history-panel table.modern-table,
.roster-schedule-panel table.roster-schedule-table,
.roster-schedule-panel table.modern-table {
    width: 100%;
    border-collapse: collapse;
}
.roster-history-panel table.roster-hist-records {
    max-width: 960px;
    margin: 0 auto;
}
.roster-schedule-panel table.roster-schedule-table,
.roster-schedule-panel table.modern-table {
    max-width: 820px;
    margin: 0 auto;
}

/* Schedule — rebuilt day/game list */
.roster-sched-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}
@media (min-width: 769px) {
    .roster-sched-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px 16px;
    }
}
.roster-sched-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: rgba(0,0,0,.14);
    min-width: 0;
}
html[data-theme="light"] .roster-sched-row {
    background: rgba(15, 30, 60, .03);
}
.roster-sched-row.is-bye {
    opacity: .72;
}
.roster-sched-day {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    color: var(--text, #e8eefb);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
html[data-theme="light"] .roster-sched-day {
    color: var(--text-strong, #0f1e3c);
}
.roster-sched-game {
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text, #e8eefb);
    overflow-wrap: anywhere;
    word-break: break-word;
}
html[data-theme="light"] .roster-sched-game {
    color: var(--text-strong, #0f1e3c);
}
.roster-sched-game a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.roster-sched-game a:hover {
    border-bottom-color: var(--red-hot);
    color: var(--red-hot);
}
.roster-sched-game .team-logo-inline {
    width: 18px !important;
    height: 18px !important;
    margin: 0 3px 0 0 !important;
}
.roster-sched-record .roster-hist-info-chips {
    justify-content: center;
}
.roster-sched-postseason-wrap {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.roster-sched-postseason {
    width: 100% !important;
    min-width: 420px;
    margin: 0 !important;
    background: transparent !important;
}
.roster-sched-postseason td,
.roster-sched-postseason th {
    padding: 8px 10px;
    font-size: 12.5px;
    white-space: nowrap;
}
.roster-aux-panel .roster-empty-state a {
    color: var(--red-hot);
}

/* History — Team Information chips */
.roster-hist-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    padding: 4px 0 2px;
}
.roster-hist-info-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.roster-hist-info-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
}
.roster-hist-chip {
    min-width: 110px;
    text-align: center;
    align-items: center;
}
.roster-hist-chip .lab {
    text-align: center;
}
.roster-hist-chip .val {
    text-align: center;
    font-size: 22px;
}

/* History — records: two blocks, stacked on mobile */
.roster-hist-records-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}
@media (min-width: 769px) {
    .roster-hist-records-stack {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: start;
    }
}
.roster-hist-records-block {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: transparent;
}
.roster-hist-records-title {
    margin: 0;
    padding: 10px 12px 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted-2);
    border-bottom: 1px solid var(--line);
}
.roster-hist-records.modern-table,
.roster-hist-records {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.roster-hist-records thead th {
    padding: 8px 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: left;
    color: var(--muted-2) !important;
    background: rgba(0,0,0,.12) !important;
    white-space: nowrap;
}
html[data-theme="light"] .roster-hist-records thead th {
    background: rgba(15, 30, 60, .05) !important;
    color: rgba(15, 30, 60, .55) !important;
}
.roster-hist-records td {
    padding: 7px 10px;
    vertical-align: middle;
    white-space: nowrap;
    color: var(--text, #e8eefb) !important;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
html[data-theme="light"] .roster-hist-records td {
    color: var(--text-strong, #0f1e3c) !important;
    border-bottom-color: rgba(15, 30, 60, .06);
}
.roster-hist-records td font,
.roster-hist-records th font,
.roster-hist-records td *,
.roster-hist-records th * {
    color: inherit !important;
}
.roster-hist-records .roster-hist-label {
    font-weight: 700;
    white-space: normal;
}
.roster-hist-records .roster-hist-num {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-align: right;
}
.roster-hist-records tr.is-alt td {
    background: rgba(255,255,255,.04);
}
html[data-theme="light"] .roster-hist-records tr.is-alt td {
    background: rgba(15, 30, 60, .04);
}

/* legacy scroll shell (unused after split, keep harmless) */
.roster-hist-scroll {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* History / schedule standalone embed pages (fetch target) */
.content-card.roster-page font[size="6"].roster-team-name,
.content-card.roster-page h1.roster-team-name {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--white) !important;
}

.content-card.roster-schedule-page table.roster-schedule-table,
.content-card.roster-schedule-page table.modern-table,
.content-card.roster-history-page table.roster-history-table,
.content-card.roster-history-page table.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.content-card.roster-page table td[bgcolor],
.content-card.roster-page table th[bgcolor],
.roster-aux-panel table td[bgcolor],
.roster-aux-panel table th[bgcolor] {
    background: rgba(0,0,0,.4) !important;
}

.content-card.roster-page table td font,
.content-card.roster-page table th font {
    color: inherit !important;
}

@media (max-width: 768px) {
    .roster-header { padding: 20px 16px 0; }
    .roster-nav-tabs {
        margin: 0 -16px;
        padding: 0 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    .roster-tab { flex-shrink: 0; }
    .roster-content-area { padding: 16px; }
    .roster-team-name { font-size: 26px; }
    .roster-meta-chip { min-width: 80px; padding: 6px 10px; }
    .roster-meta-chip .val { font-size: 15px; }
    .injury-item { grid-template-columns: 1fr; gap: 4px; }
    .roster-identity { flex-direction: column; align-items: flex-start; }

    .roster-hist-info-chips {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }
    .roster-hist-chip {
        min-width: 0;
        width: 100%;
        padding: 8px 6px;
    }
    .roster-hist-chip .lab {
        white-space: normal;
        letter-spacing: .06em;
        font-size: 9px;
        line-height: 1.25;
    }
    .roster-hist-chip .val {
        font-size: 18px;
    }
    .roster-hist-records-stack {
        gap: 12px;
    }
    .roster-hist-records td,
    .roster-hist-records th {
        padding: 6px 8px;
        font-size: 13px;
    }
    .roster-hist-records .roster-hist-label {
        max-width: 7.5rem;
    }
    .roster-sched-row {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 8px;
        padding: 8px;
    }
    .roster-sched-day {
        font-size: 16px;
    }
    .roster-sched-game {
        font-size: 12.5px;
    }
    .roster-sched-record .roster-hist-info-chips {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ========== DEPTH CHART EDITOR ========== */
.dc-root { min-height: 120px; }

.dc-editor { display: flex; flex-direction: column; gap: 22px; }

.dc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.dc-status {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-1);
    color: var(--muted);
}
.dc-status.ok { color: var(--grade-a); border-color: var(--status-ok-border); background: var(--status-ok-bg); }
.dc-status.warn { color: var(--status-warn); border-color: var(--status-warn-border); background: var(--status-warn-bg); }

.dc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.dc-btn {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 8px 16px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--surface-1);
    color: var(--text);
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.dc-btn:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--text-strong); }
.dc-btn.primary { background: var(--red); border-color: var(--red-hot); color: var(--on-accent); }
.dc-btn.primary:hover { background: var(--red-hot); }
.dc-btn.ghost { background: transparent; }
.dc-btn:disabled,
.dc-btn:disabled:hover {
    opacity: .45;
    cursor: not-allowed;
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--muted);
}
.dc-hint-warn {
    color: var(--status-warn, #e8b84a);
}
.dc-copy-box:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.dc-save-msg {
    font-size: 12px;
    color: var(--muted-2);
    min-width: 64px;
}

.dc-section-title {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.dc-section-title span {
    font-family: 'Barlow', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted-2);
    margin-left: 8px;
}

.dc-hint {
    font-size: 12.5px;
    color: var(--muted-2);
    margin: -4px 0 12px;
}

.dc-ir-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dc-ir-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-1);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.dc-ir-chip span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.dc-ir-chip:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-3); }
.dc-ir-chip.on {
    background: var(--grade-bad-bg);
    border-color: var(--grade-bad-border);
    color: var(--ir-soft);
}
.dc-ir-chip.on span { color: var(--grade-bad); }
.dc-ir-chip:disabled { opacity: .35; cursor: not-allowed; }

.dc-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
@media (max-width: 1000px) { .dc-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
    .dc-grid { grid-template-columns: 1fr; }
    .dc-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .dc-actions { flex-wrap: wrap; }
}

.dc-pos-col {
    background: rgba(0,0,0,.22);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px;
    min-width: 0;
}

.dc-pos-head {
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .14em;
    color: var(--red-hot);
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

.dc-depth-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.dc-depth-row:last-child { margin-bottom: 0; }

.dc-depth-lab {
    flex: 0 0 28px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.dc-select,
.dc-gp-field select {
    flex: 1;
    min-width: 0;
    width: 100%;
    background: rgba(0,0,0,.35);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 12.5px;
    padding: 7px 8px;
    outline: none;
}
.dc-select:focus,
.dc-gp-field select:focus {
    border-color: var(--line-strong);
}

/* Typeahead + dropdown player pickers */
.dc-combo {
    position: relative;
    flex: 1;
    min-width: 0;
}
.dc-combo-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0,0,0,.35);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 12.5px;
    padding: 7px 34px 7px 8px;
    outline: none;
    cursor: text;
}
.dc-combo.has-clear .dc-combo-input {
    padding-right: 56px;
}
.dc-combo.open .dc-combo-input,
.dc-combo-input:focus {
    border-color: var(--line-strong);
}
.dc-combo-actions {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    z-index: 2;
    pointer-events: none;
}
/* Beat .content-card button pill styles (border-radius 999px / padding 6px 14px) */
.content-card .dc-combo-actions > button.dc-combo-toggle,
.content-card .dc-combo-actions > button.dc-combo-clear {
    pointer-events: auto;
    position: static;
    transform: none;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 22px;
    min-width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted-2);
    font-family: inherit;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color .12s ease, background .12s ease;
}
.content-card .dc-combo-actions > button.dc-combo-clear { font-size: 15px; }
.content-card .dc-combo-actions > button.dc-combo-toggle:hover,
.content-card .dc-combo-actions > button.dc-combo-clear:hover {
    color: var(--text);
    background: rgba(255,255,255,.08);
    border-color: transparent;
}
.content-card .dc-combo.open .dc-combo-toggle { color: var(--text); }
.dc-combo-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 3px);
    max-height: 240px;
    overflow-y: auto;
    background: var(--navy-2, #12203a);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    box-shadow: 0 10px 28px rgba(0,0,0,.45);
    z-index: 50;
}
.dc-combo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    padding: 8px 10px;
    cursor: pointer;
}
.dc-combo-item:hover,
.dc-combo-item.active {
    background: rgba(255,255,255,.08);
    color: var(--text-strong);
}
.dc-combo-item.selected {
    color: var(--text-strong);
    font-weight: 600;
}
.dc-combo-check {
    color: var(--grade-a, #4ade80);
    font-size: 11px;
}
.dc-combo-empty {
    padding: 10px;
    font-size: 12px;
    color: var(--muted-2);
}

html[data-theme="light"] .dc-combo-list {
    background: #fff;
    border-color: var(--line-strong);
    box-shadow: 0 10px 24px rgba(0,0,0,.12);
}
.dc-editor.dc-readonly .dc-combo-input {
    cursor: default;
    opacity: .92;
}
.dc-forum-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 14px;
    margin-top: 10px;
}
.dc-forum-row .dc-gp-field { flex: 1; min-width: 200px; }
.dc-forum-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.dc-copy-box {
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(0,0,0,.35);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    resize: vertical;
}
html[data-theme="light"] .dc-copy-box {
    background: #fff;
}

html[data-theme="light"] .dc-combo-item:hover,
html[data-theme="light"] .dc-combo-item.active {
    background: rgba(0,0,0,.06);
}

.dc-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 800px) { .dc-options { grid-template-columns: 1fr; } }

.dc-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dc-option-lab {
    flex: 0 0 18px;
    font-family: 'Barlow Condensed', 'Barlow', sans-serif;
    font-weight: 800;
    font-size: 14px;
    color: var(--muted);
}

.dc-gameplan {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
@media (max-width: 800px) { .dc-gameplan { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .dc-gameplan { grid-template-columns: 1fr; } }

.dc-gp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dc-gp-field span {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted-2);
}

/* ==========================================================================
   EXPERIMENT (2026-07): FBB-dense roster tables on mobile
   ---------------------------------------------------------------------------
   Observation: the old FBB roster HTML is easier to scan on phones because it
   uses font size="2", ~25px attribute columns, and almost no cell padding —
   more of the sheet fits before horizontal scroll. Our modern tables use
   10–12px padding and ~44–52px grade/stat columns, so the same data feels
   sparse and requires more sideways panning.

   This block only tightens density under 768px. Desktop layout is unchanged.
   REVERT: delete from "EXPERIMENT (2026-07)" through "END EXPERIMENT".
   ========================================================================== */
@media (max-width: 768px) {
    .roster-content-area {
        padding-left: 10px;
        padding-right: 10px;
    }

    .roster-table-container {
        border-radius: 6px;
    }

    .content-card.roster-page .roster-modern-table,
    .roster-modern-table {
        font-size: 11px !important;
        min-width: 0 !important;
        width: max-content !important;
        max-width: none !important;
        table-layout: auto !important;
    }

    /* Neutralize JS colgroup widths so cells can pack like old FBB */
    .roster-modern-table col {
        width: auto !important;
        min-width: 0 !important;
    }

    .roster-modern-table th {
        padding: 5px 4px !important;
        font-size: 9.5px !important;
        letter-spacing: .04em !important;
    }

    .roster-modern-table td {
        padding: 4px 4px !important;
    }

    /* ID — hide on mobile to reclaim horizontal space (desktop keeps it) */
    .roster-modern-table col:first-child,
    .roster-modern-table th:nth-child(1),
    .roster-modern-table td:nth-child(1) {
        display: none !important;
    }

    /* Name — freeze as first visible column (ID hidden → offset 0) */
    .roster-modern-table {
        --roster-id-w: 0px;
    }
    .roster-modern-table th:nth-child(2),
    .roster-modern-table td:nth-child(2) {
        width: auto !important;
        min-width: 108px !important;
        max-width: 140px !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
        left: 0 !important;
        z-index: 6 !important;
        /* Same hairline as desktop — not a darker “panel” edge */
        box-shadow: 1px 0 0 var(--line);
    }

    /* Pos / Age / Height / Weight / grades / short stats — old ~25–40px */
    .roster-modern-table th:nth-child(n+3),
    .roster-modern-table td:nth-child(n+3) {
        width: auto !important;
        min-width: 0 !important;
        padding-left: 3px !important;
        padding-right: 3px !important;
        text-align: center !important;
    }

    .roster-table-abilities th:nth-child(n+7),
    .roster-table-abilities td:nth-child(n+7),
    .roster-table-stats th:nth-child(n+4),
    .roster-table-stats td:nth-child(n+4) {
        width: auto !important;
        min-width: 22px !important;
    }

    /* Salary years need a bit more room than grade letters */
    .roster-table-salaries th:nth-child(n+5),
    .roster-table-salaries td:nth-child(n+5) {
        min-width: 52px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
        text-align: right !important;
    }
}
/* === END EXPERIMENT (2026-07): FBB-dense roster tables on mobile === */
