/* Box score styling, shared by the home page and the game page.
   Below 700px each table row becomes a card of labeled stats — see the
   comment on the media query for why. */
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.score-row .team {
  font-weight: 500;
  color: #a0a0a8;
}
.score-row .team.winner {
  font-weight: 700;
  color: #f2f2f2;
}
.box-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
table.box-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: auto;
}
table.box-table th,
table.box-table td {
  padding: 0.35rem 0.45rem;
  text-align: right;
  border-bottom: 1px solid #232328;
  white-space: nowrap;
}
table.box-table th:first-child,
table.box-table td:first-child {
  text-align: left;
}
table.box-table th {
  color: #a0a0a8;
  font-weight: 500;
  font-size: 0.75rem;
}
/* The Grizzlies and Rockets box scores are two separate <table>s with
   identical columns, so with table-layout:auto each sizes its columns
   from its own content and the two can drift out of alignment. Fixing
   the layout and giving both the same first-column width forces every
   other column to split the remaining space identically in both.
   Scoped above the card-mode breakpoint, since below it these cells
   switch to display:block at width:100% and this would fight that. */
@media (min-width: 701px) {
  table.player-table {
    table-layout: fixed;
  }
  table.player-table th:first-child,
  table.player-table td:first-child {
    width: 150px;
  }
}
table.box-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.035);
}
/* Below this width, a 10-15 column table has no comfortable size — so
   instead of scrolling sideways, each row becomes its own card and
   each cell becomes a labeled line (label from data-label via ::before).
   Adapted from a "responsive table" pattern (codepen.io/jonobot_/pen/amKweL):
   here the label comes from data-label rather than aria-label, since
   reusing aria-label for this overrides what a screen reader announces
   for the cell; the first column becomes an unlabeled card heading
   instead of just another labeled row. */
@media (max-width: 700px) {
  .box-wrapper {
    overflow-x: hidden;
  }
  table.box-table thead {
    display: none;
  }
  table.box-table,
  table.box-table tbody,
  table.box-table tr,
  table.box-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  table.box-table tr {
    margin-bottom: 0.75rem;
    border: 1px solid #232328;
    border-radius: 8px;
    overflow: hidden;
  }
  table.box-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 0.75rem;
    border-bottom: 1px solid #1c1c20;
    text-align: right;
    white-space: normal;
  }
  table.box-table td:last-child {
    border-bottom: none;
  }
  table.box-table td:nth-of-type(even) {
    background: rgba(255, 255, 255, 0.035);
  }
  table.box-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #a0a0a8;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    text-align: left;
  }
  table.box-table td:first-child {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #f2f2f2;
    text-align: left;
    border-bottom: 1px solid #333;
    padding: 0.5rem 0.75rem;
  }
  table.box-table td:first-child::before {
    content: none;
  }

  /* Player box scores specifically (not the 2-row team-stats table)
     get a 2-column stat grid instead of one stat per line — 14 stats
     stacked one-per-row makes each player's card absurdly tall. */
  table.box-table.player-table tr {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  table.box-table.player-table td:first-child {
    grid-column: 1 / -1;
  }
  table.box-table.player-table td:nth-of-type(even) {
    background: none;
  }
  table.box-table.player-table td:nth-of-type(4n + 2),
  table.box-table.player-table td:nth-of-type(4n + 3) {
    background: rgba(255, 255, 255, 0.035);
  }
  table.box-table.player-table td:nth-last-of-type(-n + 2) {
    border-bottom: none;
  }
}
.player-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted #55555c;
}
.player-link:hover {
  border-bottom-color: currentColor;
}
.player-team-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin: 1rem 0 0.35rem;
}
.starter {
  color: #f2f2f2;
}
.bench {
  color: #a0a0a8;
}
