/* ============================================================
   Team page shell (js/teamPage.js). .tp-* only. Tokens only; the one
   inline value is --team, the team's color, which is data (DESIGN.md).
   ============================================================ */
.tp { display: contents; }

.tp-muted { color: var(--text-muted); }

/* Header: team color is identity, so it owns the top border. */
.tp-header { border-top: 3px solid var(--team, var(--accent)); }
.tp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-2); font-size: var(--text-sm); }
.tp-record { font-size: var(--text-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-chip { padding: var(--space-0-5) var(--space-2); border-radius: var(--radius-full); border: 1px solid var(--accent-border); background: var(--accent-subtle); color: var(--accent); font-size: var(--text-xs); font-weight: 700; }
.tp-chip--plain { border-color: var(--border-default); background: var(--bg-subtle); color: var(--text-secondary); }
.tp-form { display: inline-flex; gap: var(--space-1); }
.tp-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-disabled); }
.tp-dot--w { background: var(--color-win); }
.tp-dot--l { background: var(--color-loss); }
.tp-counts { margin-top: var(--space-3); }

.tp-logo { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: var(--radius); background: var(--bg-raised); border: 1px solid var(--border-default); overflow: hidden; }
.tp-logo img { width: 80%; height: 80%; object-fit: contain; }
.tp-logo--hero { width: 96px; height: 96px; }
.tp-logo--md { width: 52px; height: 52px; }
.tp-logo--sm { width: 22px; height: 22px; border-radius: 50%; }

.tp-live { display: inline-block; padding: var(--space-0-5) var(--space-2); border-radius: var(--radius-full); background: var(--color-live); color: var(--text-primary); font-size: var(--text-2xs); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }

/* Next Game hero */
.tp-hero { cursor: pointer; transition: border-color 140ms ease-out; }
.tp-hero:hover, .tp-hero:focus-visible { border-color: var(--border-accent); }
.tp-hero__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.tp-hero__match { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.tp-hero__opp { display: flex; flex-direction: column; min-width: 0; font-size: var(--text-sm); }
.tp-hero__name { font-size: var(--text-xl); font-weight: 800; color: var(--text-primary); overflow-wrap: anywhere; }
.tp-stakes { margin: var(--space-3) 0 0; font-weight: 600; color: var(--text-primary); }
.tp-edge { margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: var(--text-sm); }
.tp-edge .eyebrow { margin-right: var(--space-2); }

/* State of the Team: every value carries its rank and percentile bar. */
.tp-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: var(--space-3); margin-top: var(--space-2); }
.tp-metric { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3); background: var(--bg-subtle); border: 1px solid var(--border-default); border-radius: var(--radius); min-width: 0; }
.tp-metric__row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.tp-metric__val { font-size: var(--text-xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-metric__val--pos { color: var(--color-win); }
.tp-metric__val--neg { color: var(--color-loss); }
.tp-metric__rank { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); white-space: nowrap; }
.tp-bar { display: block; height: 4px; border-radius: var(--radius-full); background: var(--bg-raised); overflow: hidden; }
.tp-bar > span { display: block; height: 100%; background: var(--accent); }
.tp-receipt { margin-top: var(--space-3); }
.tp-caption { margin: calc(var(--space-2) * -1) 0 var(--space-3); }

/* Leaders */
.tp-leaders { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-3); margin-top: var(--space-2); }
.tp-leader { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); background: var(--bg-subtle); border: 1px solid var(--border-default); border-radius: var(--radius); min-width: 0; }
.tp-leader__av { position: relative; flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--bg-raised); color: var(--text-secondary); font-weight: 800; font-size: var(--text-sm); }
.tp-leader__av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.tp-leader__body { display: flex; flex-direction: column; min-width: 0; }
.tp-leader__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-leader__stat { font-size: var(--text-sm); }
.tp-leader__stat .tp-metric__val { font-size: var(--text-base); }

/* Schedule timeline */
.roster-row.tp-tl { grid-template-columns: 1.25rem 3.25rem 1.25rem 22px minmax(0, 1fr) auto; grid-template-rows: auto; grid-template-areas: none; gap: 0 var(--space-2); padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.tp-tl__res { font-weight: 900; color: var(--text-muted); }
.tp-tl--w .tp-tl__res, .tp-tl--w .tp-tl__score { color: var(--color-win); }
.tp-tl--l .tp-tl__res, .tp-tl--l .tp-tl__score { color: var(--color-loss); }
.tp-tl__date { color: var(--text-muted); font-size: var(--text-xs); }
.tp-tl__ha { font-size: var(--text-xs); }
.tp-tl__opp { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-tl__right { display: flex; align-items: baseline; gap: var(--space-2); justify-self: end; white-space: nowrap; }
.tp-tl__score { font-family: var(--font-mono); font-weight: 700; }
.tp-tl__diff { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); min-width: 2.25rem; text-align: right; }

/* Standings mini-table */
.tp-standings { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; margin-top: var(--space-2); }
.tp-standings th { text-align: left; font-size: var(--text-2xs); font-weight: 700; letter-spacing: 0.06em; color: var(--text-muted); padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border-mid); }
.tp-standings td { padding: var(--space-2); border-bottom: 1px solid var(--border-default); }
.tp-standings tbody tr { cursor: pointer; }
.tp-standings tbody tr:not(.tp-cut):hover { background: var(--bg-interactive); }
.tp-st__team { font-weight: 700; }
.tp-me { background: var(--accent-subtle); box-shadow: inset 3px 0 0 var(--accent); }
.tp-me .tp-st__team { color: var(--accent); }
.tp-cut td { padding: 0; border-bottom: 1px dashed var(--border-strong); }
.tp-cut span { display: inline-block; transform: translateY(50%); padding: 0 var(--space-2); margin-left: var(--space-2); background: var(--bg-card); color: var(--text-muted); font-size: var(--text-2xs); letter-spacing: 0.06em; text-transform: uppercase; }

/* Roster */
.tp-group { font-size: var(--text-base); margin-top: var(--space-4); }
.tp-avatar { background: color-mix(in srgb, var(--team, var(--accent)) 80%, transparent); }
.tp-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; z-index: 1; }
.tp-avatar span { position: relative; }
.tp-starter { color: var(--team, var(--accent)); }

@media (max-width: 480px) {
    .tp-logo--hero { width: 72px; height: 72px; }
    .tp-metric__val { font-size: var(--text-lg); }
    .roster-row.tp-tl { grid-template-columns: 1rem 2.75rem 1.1rem 20px minmax(0, 1fr) auto; }
}
