/* Season matchup matrix (epic 0032 PR3, spec §6.4). Namespace guard: this
   feature owns .matchup-matrix* exclusively — .schedule-matrix* belongs to
   the games-page cards view (epic 0030) and must never appear here. */

/* Backdrop for the games-page modal-frame launch. */
.matchup-matrix-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.matchup-matrix-card {
  display: flex;
  flex-direction: column;
  width: min(1500px, 96vw);
  max-height: 92vh;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.25);
  overflow: hidden;
  outline: none;
}

.matchup-matrix-card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.matchup-matrix-card__title {
  font-weight: 800;
}
.matchup-matrix-card__subtitle {
  color: var(--ink-3);
  font-size: 0.85rem;
}
.matchup-matrix-card__stats {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}
.matchup-matrix-pill {
  background: var(--bg-2);
  color: var(--ink-3);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.matchup-matrix-card__close {
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.matchup-matrix-scroll {
  overflow: auto;
  flex: 1;
}

.matchup-matrix {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.matchup-matrix th,
.matchup-matrix td {
  border-bottom: 1px solid var(--line-2, var(--bg-2));
  border-right: 1px solid var(--line-2, var(--bg-2));
}

.matchup-matrix__corner {
  width: 230px;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 3;
  background: var(--table-header-bg, var(--surface-2));
}

/* Column headers: icon, name, and elo chip flow as one run of wrapping
   text — no separate icon/chip rows, no gap between name and chip. */
.matchup-matrix__col {
  width: 132px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-header-bg, var(--surface-2));
  color: var(--ink-3);
  padding: 8px 6px;
  vertical-align: bottom;
  font-weight: 600;
  font-size: 0.78rem;
}
.matchup-matrix__col-inner {
  display: block;
  text-align: center;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.matchup-matrix__col-inner .matchup-matrix__avatar {
  vertical-align: middle;
  margin-right: 3px;
}
.matchup-matrix__col-inner .stat-badge {
  vertical-align: middle;
  margin-left: 3px;
}

.matchup-matrix__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 0.7rem;
  object-fit: cover;
}

/* Row headers: icon + wrapping name + elo chip; sticky first column. */
.matchup-matrix__row {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--table-header-bg, var(--surface-2));
  color: var(--ink-2);
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 4px 10px;
}
.matchup-matrix__row-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}
.matchup-matrix__row-name {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Cells: height acts as a MINIMUM in table layout — each row grows to its
   own tallest cell, so a one-badge row stays short next to a four-badge row. */
.matchup-matrix__cell {
  height: 35px;
  padding: 3px;
  text-align: center;
  vertical-align: middle;
  background: var(--surface);
}
.matchup-matrix__cell--self {
  background: var(--bg-3, var(--bg-2));
}
.matchup-matrix__cell--mirror {
  background: var(--bg);
  border-color: transparent;
}

.matchup-matrix__badge {
  display: block;
  width: fit-content;
  margin: 2px auto;
  border-radius: var(--r-pill);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 8px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.matchup-matrix__badge--past {
  background: var(--bg-2);
  color: var(--ink-3);
}
.matchup-matrix__badge--next {
  background: var(--accent);
  color: var(--white);
}

/* Hover/focus trace. */
.matchup-matrix--hl {
  background: var(--accent-subtle, rgba(37, 99, 235, 0.06));
}
th.matchup-matrix--hl-head {
  background: var(--bg-3, var(--bg-2));
}
.matchup-matrix--hl-cell {
  background: var(--accent-light);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.matchup-matrix-card__footnote {
  color: var(--ink-3);
  font-size: 0.78rem;
  padding: 10px 20px;
  margin: 0;
  border-top: 1px solid var(--line-2, var(--bg-2));
}
