.th-history {
  margin: 0 0 24px;
  min-width: 0;
  container-type: inline-size;
}

.th-average {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.th-average-label {
  font: 600 13px/1.4 var(--font);
  color: var(--ink);
}

.th-average-value {
  font-family: "Space Grotesk", var(--font);
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -1.5px;
  line-height: 1.2;
  color: var(--accent);
  margin: 4px 0;
  font-variant-numeric: tabular-nums;
}

.th-average-unit {
  font: 500 15px/1.4 var(--font);
  letter-spacing: 0;
  color: var(--muted);
  white-space: nowrap;
}

.th-average-value.th-unavailable {
  font-size: 23px;
  letter-spacing: -.5px;
  line-height: 1.35;
  margin: 8px 0;
}

.th-average-note,
.th-ratings-note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.th-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 22px 0 6px;
}

.th-heading h3 {
  font-size: 16px;
  letter-spacing: 0;
  font-weight: 600;
}

.th-game-count {
  font-size: 11px;
  color: var(--muted);
}

.th-ratings-note {
  margin-bottom: 14px;
  max-width: 70ch;
}

.th-games {
  padding: 0;
  margin: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.th-game {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  min-width: 0;
}

.th-game-context {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.th-game-date {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
}

.th-game-date span {
  font-weight: 650;
  color: var(--ink);
}

.th-opponent {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 3px 0 5px;
}

.th-logo {
  height: 46px;
  width: 46px;
  object-fit: contain;
}

html[data-theme=dark] .th-history img.th-logo {
  background: #eeeee6;
  padding: 3px;
  border-radius: 6px;
}

.th-logo-missing {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-weight: 700;
  color: var(--muted);
}

.th-result {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 7px;
  font: 750 22px/1 var(--font);
  color: #fff;
}

.th-result-w {
  background: #167343;
}

.th-result-l {
  background: #bd3539;
}

.th-result-t {
  background: #e2a62d;
  color: #30230a;
}

.th-final {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 8px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.th-final-score {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.th-empty {
  padding: 15px 0;
  font-size: 12px;
  color: var(--muted);
}

.th-team-heading {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  overflow-wrap: anywhere;
  align-self: start;
}

.th-history-compact {
  margin: 0;
}

.th-history-compact .th-average {
  padding: 11px 12px;
  border-radius: 9px;
}

.th-history-compact .th-average-label {
  font-size: 11px;
}

.th-history-compact .th-average-value {
  font-size: 30px;
  letter-spacing: -1px;
  margin: 4px 0 2px;
}

.th-history-compact .th-average-unit {
  font-size: 11px;
}

.th-history-compact .th-average-value.th-unavailable {
  font-size: 16px;
  letter-spacing: 0;
}

.th-history-compact .th-average-note {
  font-size: 10px;
  line-height: 1.5;
}

.th-history-compact .th-games {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.th-history-compact .th-game {
  padding: 12px;
  gap: 8px;
  border-radius: 10px;
}

.th-history-compact .th-game-context {
  font-size: 10px;
  gap: 3px 8px;
}

.th-history-compact .th-opponent {
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  gap: 7px;
}

.th-history-compact .th-logo {
  height: 36px;
  width: 36px;
}

.th-history-compact .th-result {
  width: 34px;
  font-size: 19px;
  border-radius: 6px;
}

.th-history-compact .th-final-score {
  font-size: 14px;
}

@container (max-width: 470px) {
  .th-games {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container (min-width: 280px) {
  .th-history-compact .th-game {
    grid-template-columns: minmax(0, 1fr) 152px;
    grid-template-rows: auto auto auto;
    gap: 6px 14px;
  }

  .th-history-compact .th-game-context {
    grid-column: 1;
    grid-row: 1;
    justify-content: flex-start;
  }

  .th-history-compact .th-opponent {
    grid-column: 2;
    grid-row: 1/3;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 7px;
    padding: 0;
    align-self: center;
  }

  .th-history-compact .th-logo {
    width: 34px;
    height: 34px;
  }

  .th-history-compact .th-final {
    grid-column: 1/-1;
    grid-row: 3;
    padding-top: 7px;
  }
}

@container (min-width: 280px) and (max-width: 470px) {
  .th-history:not(.th-history-compact) .th-game {
    grid-template-columns: minmax(0, 1fr) 140px;
    grid-template-rows: auto auto auto;
    gap: 6px 10px;
    padding: 12px;
  }

  .th-history:not(.th-history-compact) .th-game-context {
    grid-column: 1;
    grid-row: 1;
    justify-content: flex-start;
    gap: 3px 7px;
    font-size: 10px;
  }

  .th-history:not(.th-history-compact) .th-opponent {
    grid-column: 2;
    grid-row: 1/3;
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 6px;
    padding: 0;
    align-self: center;
  }

  .th-history:not(.th-history-compact) .th-logo {
    height: 32px;
    width: 32px;
  }

  .th-history:not(.th-history-compact) .th-result {
    width: 32px;
    font-size: 19px;
    border-radius: 6px;
  }

  .th-history:not(.th-history-compact) .th-final {
    grid-column: 1/-1;
    grid-row: 3;
    padding-top: 7px;
  }
}

@container (max-width: 210px) {
  .th-history-compact .th-game {
    padding: 10px;
    gap: 8px;
  }

  .th-history-compact .th-opponent {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 5px;
  }

  .th-history-compact .th-logo {
    height: 30px;
    width: 30px;
  }

  .th-history-compact .th-result {
    width: 30px;
    font-size: 18px;
  }

  .th-history-compact .th-game-context {
    display: grid;
    gap: 3px;
  }

  .th-history-compact .th-game-date {
    gap: 3px 7px;
  }
}

@container (max-width: 150px) {
  .th-history-compact .th-game {
    padding: 8px;
  }

  .th-history-compact .th-opponent {
    grid-template-columns: 25px minmax(0, 1fr) 28px;
    gap: 4px;
  }

  .th-history-compact .th-logo {
    height: 25px;
    width: 25px;
  }

  .th-history-compact .th-result {
    width: 28px;
    font-size: 17px;
  }

  .th-history-compact .th-average {
    padding: 10px;
  }
}
