/* Shared Boxscore and BoxscorePreview tuning. Desktop values; smaller screens override some below. */
.boxscore-preview {
  /* Game information width and score banner minimum height. */
  --preview-meta-width: 620px;
  --preview-banner-height: 96px;
  /* Colored end panels, team logos/names, and final score. */
  --preview-accent-width: 85px;
  --preview-logo-size: 60px;
  --preview-team-font-size: 28px;
  --preview-score-font-size: 48px;
  /* Game information above the banner. */
  --preview-meta-title-size: 15px;
  --preview-meta-detail-size: 13px;
  /* Color mark inside each team row of the quarter-score table. */
  --preview-period-mark-width: 7px;
  --preview-period-mark-height: 15px;
  --preview-period-mark-radius: 2px;
  --preview-period-mark-gap: 5px;
  /* Team heading above each player table. */
  --preview-heading-height: 50px;
  --preview-heading-mark-width: 70px;
}

.boxscore-preview .boxscore-game-crumb {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
  width: min(100%, var(--preview-meta-width));
  margin: 8px 0 8px;
  gap: 5px;
  padding: 0;
  color: #737373;
  line-height: 1.15;
  text-align: left;
}

.boxscore-preview-competition {
  color: #161616;
  font-size: var(--preview-meta-title-size);
  font-weight: 800;
  text-transform: uppercase;
}

a.boxscore-preview-competition {
  text-decoration: none;
}

a.boxscore-preview-competition:hover,
a.boxscore-preview-competition:focus-visible {
  color: #273754;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.boxscore-preview-game-details {
  font-size: var(--preview-meta-detail-size);
  font-weight: 700;
}

.boxscore-preview-banner {
  position: relative;
  display: grid;
  grid-template-areas: "home result away";
  grid-template-columns: max-content auto max-content;
  column-gap: 8px;
  align-items: center;
  isolation: isolate;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  min-height: var(--preview-banner-height);
  margin-top: 0;
  overflow: hidden;
  border: 1px solid #e4e7ed;
  border-radius: 0.5rem;
  background-color: #fff;
  background-image: linear-gradient(90deg,
    color-mix(in srgb, var(--preview-home-color) 12%, white) 0%,
    #fff 35%,
    #fff 65%,
    color-mix(in srgb, var(--preview-away-color) 12%, white) 100%);
  box-shadow: 0 0.35rem 1.25rem rgb(25 38 60 / 8%);
  color: #202c40;
}

.boxscore-preview-banner::before,
.boxscore-preview-banner::after {
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  width: var(--preview-accent-width);
  content: "";
  pointer-events: none;
}

.boxscore-preview-banner::before {
  left: 0;
  background: linear-gradient(62deg,
    color-mix(in srgb, var(--preview-home-color) 65%, white) 0 31%,
    color-mix(in srgb, var(--preview-home-color) 28%, white) 31% 61%,
    transparent 61%);
}

.boxscore-preview-banner::after {
  right: 0;
  background: linear-gradient(298deg,
    color-mix(in srgb, var(--preview-away-color) 65%, white) 0 31%,
    color-mix(in srgb, var(--preview-away-color) 28%, white) 31% 61%,
    transparent 61%);
}

.boxscore-preview-side {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  gap: 10px;
  padding: 0 12px;
}

.boxscore-preview-side-home {
  grid-area: home;
}

.boxscore-preview-side-away {
  grid-area: away;
  justify-content: flex-end;
}

.boxscore-preview-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--preview-logo-size);
  box-sizing: border-box;
  width: var(--preview-logo-size);
  height: var(--preview-logo-size);
  overflow: hidden;
}

.boxscore-preview-logo img {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.boxscore-preview-national .boxscore-preview-logo img,
.boxscore-preview-national .boxscore-preview-heading-mark img {
  filter: drop-shadow(0 0 1px rgb(25 38 60 / 55%));
}

.boxscore-preview-team {
  min-width: 0;
  font-size: var(--preview-team-font-size);
  font-weight: 700;
  line-height: 1.12;
  overflow-wrap: normal;
}

.boxscore-preview-side-away .boxscore-preview-team {
  text-align: right;
}

.boxscore-preview-result {
  position: relative;
  z-index: 1;
  grid-area: result;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 2px;
  white-space: nowrap;
  font-size: var(--preview-score-font-size);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.boxscore-preview-points-home { color: var(--preview-home-score); }
.boxscore-preview-points-away { color: var(--preview-away-score); }

.boxscore-preview-separator {
  align-self: center;
  color: #263249;
  font-size: 0.54em;
  font-weight: 700;
  line-height: 1;
}

.boxscore-preview .boxscore-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  width: 100%;
  max-width: 100%;
  gap: 0.75rem 1rem;
  margin: 22px 0 24px;
  overflow: visible;
}

.boxscore-preview-period-scroll {
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}

.boxscore-preview .boxscore-top .boxscore-score {
  flex: 0 0 auto;
  width: max-content;
}

.boxscore-preview .boxscore-sort-switch {
  display: none;
}

.boxscore-preview-starters-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.25rem;
  color: #344054;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.boxscore-preview-starters-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.boxscore-preview-toggle-track {
  position: relative;
  width: 2.15rem;
  height: 1.2rem;
  border-radius: 999px;
  background: #9da8b9;
  transition: background-color 0.15s ease;
}

.boxscore-preview-toggle-track::after {
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 0.15s ease;
}

.boxscore-preview-starters-toggle input:checked + .boxscore-preview-toggle-track {
  background: #483d8b;
}

.boxscore-preview-starters-toggle input:checked + .boxscore-preview-toggle-track::after {
  transform: translateX(0.95rem);
}

.boxscore-preview-starters-toggle input:focus-visible + .boxscore-preview-toggle-track {
  outline: 2px solid #1f4e79;
  outline-offset: 2px;
}

.boxscore-preview .boxscore-score tbody tr.boxscore-preview-period-home {
  --preview-period-mark-color: var(--preview-home-color);
}

.boxscore-preview .boxscore-score tbody tr.boxscore-preview-period-away {
  --preview-period-mark-color: var(--preview-away-color);
}

.boxscore-preview .boxscore-score tbody tr > th:first-child {
  white-space: nowrap;
}

.boxscore-preview .boxscore-score tbody tr > th:first-child::before {
  display: inline-block;
  width: var(--preview-period-mark-width);
  height: var(--preview-period-mark-height);
  margin-right: var(--preview-period-mark-gap);
  border-radius: var(--preview-period-mark-radius);
  background: var(--preview-period-mark-color);
  vertical-align: -4px;
  content: "";
}

.boxscore-preview .boxscore-team thead th {
  padding: 0;
}

.boxscore-preview-sort-button {
  display: block;
  width: 100%;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.boxscore-preview .boxscore-team thead th.left .boxscore-preview-sort-button {
  text-align: left;
}

.boxscore-preview-sort-button:hover,
.boxscore-preview-sort-button:focus-visible {
  background: rgb(255 255 255 / 15%);
}

.boxscore-preview-sort-button[data-sort-direction]::after {
  margin-left: 0.25rem;
  font-size: 0.6em;
  vertical-align: 0.12em;
}

.boxscore-preview-sort-button[data-sort-direction="asc"]::after {
  content: "▲";
}

.boxscore-preview-sort-button[data-sort-direction="desc"]::after {
  content: "▼";
}

.boxscore-preview .boxscore-pair {
  width: max-content;
  max-width: 100%;
  gap: 0;
}

.boxscore-preview .boxscore-preview-team-heading {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--preview-heading-height);
  gap: 0;
  padding: 0;
  border: 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--preview-heading-color) 11%, white),
    #fff 195px);
}

.boxscore-preview-team-heading-home {
  --preview-heading-color: var(--preview-home-color);
}

.boxscore-preview-team-heading-away {
  --preview-heading-color: var(--preview-away-color);
}

.boxscore-preview-heading-mark {
  display: grid;
  place-items: center;
  flex: 0 0 var(--preview-heading-mark-width);
  box-sizing: border-box;
  width: var(--preview-heading-mark-width);
  height: var(--preview-heading-height);
  overflow: hidden;
  border-radius: 4px 0 0 0;
  background: linear-gradient(62deg,
    color-mix(in srgb, var(--preview-heading-color) 58%, white) 0 24%,
    color-mix(in srgb, var(--preview-heading-color) 27%, white) 24% 54%,
    color-mix(in srgb, var(--preview-heading-color) 9%, white) 54%);
}

.boxscore-preview-heading-mark img {
  display: block;
  width: 34px;
  height: 36px;
  object-fit: contain;
}

.boxscore-preview-team-heading > span:last-child {
  font-size: 21px;
  font-weight: 700;
}

.boxscore-preview-team-scroll-home {
  border-top: 4px solid var(--preview-home-color);
  margin-bottom: 18px;
}

.boxscore-preview-team-scroll-away {
  border-top: 4px solid var(--preview-away-color);
}

.boxscore-preview .boxscore-referees {
  margin-top: 12px;
}

.boxscore-preview-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.boxscore-preview-admin-actions a {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid #483d8b;
  border-radius: 3px;
  background: #7ba4e3;
  color: #000;
  font-weight: 700;
}

@media (max-width: 700px) {
  .boxscore-preview {
    --preview-accent-width: 72px;
    --preview-logo-size: 48px;
    --preview-team-font-size: clamp(16px, 4vw, 23px);
    --preview-score-font-size: clamp(38px, 10vw, 50px);
  }

  .boxscore-preview-banner {
    width: 100%;
    min-width: 0;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "home away" "result result";
    grid-template-rows: auto auto;
  }

  .boxscore-preview .boxscore-game-crumb { width: 100%; padding: 0; }
  .boxscore-preview-competition { font-size: clamp(15px, 4vw, 19px); }
  .boxscore-preview-game-details { font-size: clamp(13px, 3.3vw, 16px); }
  .boxscore-preview-side { min-height: 64px; gap: 6px; padding: 7px 10px; }
  .boxscore-preview-team { overflow-wrap: anywhere; }
  .boxscore-preview-result { justify-content: center; padding: 0 8px 10px; }
  .boxscore-preview-team-heading > span:last-child { font-size: 20px; }
}
