/* Shared season histories for scorecards and comparison columns. */
.fo-view .fo-histories-grid { container-type: inline-size; row-gap: 0; }
/* Layout containment on a subgrid prevents its rows from sharing intrinsic sizes. */
.fo-histories-grid .th-history-compact { container-type: normal; row-gap: 0; }
.th-history.th-history .th-average {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
  text-align: center;
}
.th-history :is(.th-summary-difficulty, .th-summary-rating) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-width: 0;
  padding: 10px 8px;
  background: var(--ui-soft);
  border: 1px solid var(--ui-rule);
  border-radius: var(--ui-radius-sm);
}
.th-history.th-history .th-average-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin: 0;
  font: 500 10px/1.35 var(--ui-font-body);
  color: var(--ui-ink);
}
.th-history .th-difficulty-value {
  font: 650 34px/1.15 var(--ui-font-display);
  letter-spacing: -.5px;
  color: var(--ui-accent);
}
.th-history .th-difficulty-label { font-size: 10px; font-style: italic; overflow-wrap: anywhere; }
.th-history.th-history .th-average-value {
  margin: 0;
  font: 650 26px/1.2 var(--ui-font-display);
  letter-spacing: 0;
  color: var(--ui-ink);
}
.th-history.th-history .th-average-unit {
  display: block;
  margin-top: 4px;
  font: 400 10px/1.4 var(--ui-font-body);
  color: var(--ui-muted);
  white-space: normal;
}
.th-history.th-history .th-average-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 10px;
  line-height: 1.4;
}
.th-history .th-difficulty-value.th-unavailable {
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--ui-muted);
}
.th-history.th-history .th-average-value.th-unavailable {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ui-muted);
}
.th-history.th-history .th-games {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--ui-rule);
  border-radius: var(--ui-radius-sm);
}
.th-history.th-history .th-game {
  grid-template-columns: minmax(52px, .8fr) minmax(0, 1.4fr) auto;
  grid-template-rows: auto;
  align-content: stretch;
  align-items: center;
  gap: 3px 8px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--ui-rule);
  border-radius: 0;
}
.th-history.th-history .th-game:first-child { border-radius: calc(var(--ui-radius-sm) - 1px) calc(var(--ui-radius-sm) - 1px) 0 0; }
.th-history.th-history .th-game:last-child { border-bottom: 0; border-radius: 0 0 calc(var(--ui-radius-sm) - 1px) calc(var(--ui-radius-sm) - 1px); }
.th-history.th-history .th-game:only-child { border-radius: calc(var(--ui-radius-sm) - 1px); }
.th-history.th-history .th-game-context {
  grid-column: 1;
  grid-row: 1;
  justify-content: start;
  gap: 3px 10px;
  font-size: 11px;
}
.th-history.th-history .th-game-date {
  align-items: baseline;
  gap: 2px 8px;
}
.th-history.th-history .th-game-date span {
  font-size: 14px;
  font-weight: 750;
  color: var(--ui-ink);
}
.th-history.th-history .th-opponent {
  display: flex;
  grid-column: 3;
  grid-row: 1 / -1;
  align-self: stretch;
  align-items: center;
  justify-content: center;
  margin-block: -8px;
  padding: 8px 0 8px 8px;
  border-left: 1px solid var(--ui-rule);
}
.th-history.th-history .th-result {
  width: 48px;
  flex: none;
  font-size: 28px;
}
.th-history.th-history .th-final {
  grid-column: 2;
  grid-row: 1;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  padding: 0;
  border: 0;
  gap: 4px;
}
.th-history.th-history .th-final-score {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
}
.th-history .th-score-team {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.th-history .th-score-logo {
  width: 28px;
  height: 28px;
  flex: none;
  object-fit: contain;
}
.th-history.th-history .th-result-t { background: #e2a62d; color: #30230a; }
.th-history.th-history :is(.th-result-pending, .th-result-unavailable, .th-result-canceled) {
  background: #dce0dc;
  color: #39453f;
  font-size: 13px;
  letter-spacing: -.3px;
}
.th-history.th-history .th-result-canceled { font-size: 8px; letter-spacing: -.4px; }
html[data-theme=dark] .th-history :is(.th-result-pending, .th-result-unavailable, .th-result-canceled) {
  background: #4e5952;
  color: #f1f3ec;
}
.th-history.th-history .th-alignment-slot {
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  text-align: center;
  color: var(--ui-muted);
}
.th-history .th-slot-week { font-size: 11px; font-weight: 650; }
.th-history .th-slot-label { font-size: 11px; line-height: 1.4; }
.th-history .th-score-separator { color: var(--ui-muted); }
.th-history .th-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
html[data-theme=dark] .th-history :is(img.th-score-logo, img.th-team-logo) {
  background: #eeeee6;
  padding: 2px;
  border-radius: 4px;
}
.th-history.th-history-compact .th-team-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font: 700 17px/1.3 var(--ui-font-display);
  color: var(--ui-ink);
  margin-bottom: 10px;
}
.th-history .th-team-logo { width: 64px; height: 64px; object-fit: contain; }
.th-history.th-history-compact .th-average {
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  padding: 10px 8px;
  margin-bottom: 10px;
  background: var(--ui-soft);
  border: 1px solid var(--ui-rule);
  border-radius: var(--ui-radius-sm);
}
.th-history-compact :is(.th-summary-difficulty, .th-summary-rating) { padding: 0; background: none; border: 0; border-radius: 0; }
.th-history.th-history-compact .th-average-label { font-size: 10px; }
.th-history.th-history-compact .th-difficulty-value { font-size: 30px; }
.th-history.th-history-compact .th-difficulty-value.th-unavailable { font-size: 15px; }
.th-history.th-history-compact .th-average-value { font: 650 13px/1.4 var(--ui-font-body); }
.th-history.th-history-compact .th-average-unit { font-size: 9px; }
.th-history.th-history-compact .th-average-value.th-unavailable { font-size: 11px; }
.th-history.th-history-compact .th-game { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; padding: 6px; gap: 3px 6px; }
.th-history.th-history-compact .th-game-context { display: flex; flex-wrap: wrap; font-size: 10px; gap: 2px 6px; }
.th-history.th-history-compact .th-game-date { gap: 2px 4px; }
.th-history.th-history-compact .th-game-date span { font-size: 13px; }
.th-history.th-history-compact .th-opponent { grid-column: 2; margin-block: -6px; padding: 6px 0 6px 6px; }
.th-history.th-history-compact .th-final { grid-column: 1; grid-row: 2; justify-content: start; }
.th-history.th-history-compact .th-final-score { justify-content: start; }
.th-history.th-history-compact .th-result { width: 42px; font-size: 26px; }
.th-history.th-history-compact .th-final-score { font-size: 12px; gap: 3px; }
.th-history.th-history-compact .th-score-team { gap: 2px; }
.th-history.th-history-compact .th-score-logo { width: 24px; height: 24px; }
.th-history.th-history-compact .th-alignment-slot { grid-template-columns: minmax(0, 1fr); }
/* The pair contains two 230px columns and a gap of up to 16px. */
@container (max-width: 476px) {
  .fo-histories-grid .th-history-compact .th-result { width: 40px; font-size: 25px; }
  .fo-histories-grid .th-history-compact .th-team-logo { width: 52px; height: 52px; }
}
@container (max-width: 340px) {
  .fo-histories-grid .th-history-compact .th-game { gap: 3px 4px; }
  .fo-histories-grid .th-history-compact .th-opponent { padding-left: 4px; }
  .fo-histories-grid .th-history-compact .th-result { width: 36px; font-size: 23px; }
  .fo-histories-grid .th-history-compact .th-score-logo { width: 20px; height: 20px; }
  .fo-histories-grid .th-history-compact .th-final-score { gap: 2px; }
}
.th-history.th-history-compact :is(.th-result-pending, .th-result-unavailable) { font-size: 11px; }
.th-history.th-history-compact .th-result-canceled { font-size: 7px; }
@container (max-width: 300px) {
  .th-history:not(.th-history-compact) .th-game {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    column-gap: 4px;
    padding-inline: 6px;
  }
  .th-history:not(.th-history-compact) .th-opponent { padding-left: 4px; }
  .th-history:not(.th-history-compact) .th-final-score { font-size: 12px; gap: 3px; }
  .th-history:not(.th-history-compact) .th-score-team { gap: 2px; }
}
