.match-history {
  --history-accent: #285a72;
  --history-accent-dark: #204b61;
  --history-accent-soft: #eaf1f5;
  --history-border: #dce4e9;
  --history-heading: #26343d;
  --history-muted: #65737c;
  background: #f5f8fa;
  color: var(--history-heading);
  margin: 91px -12px 0;
  min-height: 70vh;
  padding: 3rem 1rem 4rem;
}

.match-history *,
.match-history *::before,
.match-history *::after { box-sizing: border-box; }

.match-history__container { margin: 0 auto; max-width: 1056px; }

.match-history__hero,
.match-history__panel {
  background: #fff;
  border: 1px solid var(--history-border);
  border-radius: 13px;
  box-shadow: 0 10px 28px rgba(35, 57, 69, .06);
}

.match-history__hero {
  align-items: center;
  display: grid;
  gap: 1.35rem;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  margin-bottom: 1.5rem;
  padding: 1.6rem 2rem;
}

.match-history__avatar-link,
.match-history__avatar {
  border-radius: 50%;
  display: block;
  height: 104px;
  width: 104px;
}

.match-history__avatar {
  background: var(--history-accent-soft);
  border: 2px solid #d5e2e9;
  object-fit: cover;
}

.match-history__identity { min-width: 0; }

.match-history__eyebrow {
  color: var(--history-accent);
  font-family: Montserrat, Arial, sans-serif;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0 0 .3rem;
  text-transform: uppercase;
}

.match-history h1,
.match-history h2,
.match-history h3,
.match-history h4,
.match-history h5 {
  color: var(--history-heading);
  font-family: Montserrat, Arial, sans-serif;
  font-weight: 700;
}

.match-history h1 {
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1.15;
  margin: 0;
}

.match-history__identity > p:last-child {
  color: var(--history-muted);
  margin: .55rem 0 0;
}

.match-history__identity a,
.match-history__player,
.match-history__back-link {
  color: var(--history-accent);
  text-decoration: none;
}

.match-history__identity a:hover,
.match-history__player:hover span,
.match-history__back-link:hover {
  color: var(--history-accent-dark);
  text-decoration: underline;
}

.match-history__count {
  align-items: center;
  background: var(--history-accent-soft);
  border: 1px solid #d5e2e9;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  min-width: 112px;
  padding: .85rem 1rem;
}

.match-history__count strong {
  color: var(--history-accent-dark);
  font-family: Montserrat, Arial, sans-serif;
  font-size: 1.8rem;
  line-height: 1;
}

.match-history__count span {
  color: var(--history-muted);
  font-size: .78rem;
  font-weight: 700;
  margin-top: .35rem;
  text-transform: uppercase;
}

.match-history__panel { padding: 1.5rem; }

.match-history__section-heading {
  align-items: center;
  border-bottom: 1px solid #e6ecef;
  display: flex;
  gap: .85rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
}

.match-history__section-heading h2 { font-size: 1.15rem; margin: 0; }

.match-history__section-icon {
  align-items: center;
  background: var(--history-accent-soft);
  border-radius: 9px;
  color: var(--history-accent);
  display: flex;
  flex: 0 0 44px;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.match-history__tournaments,
.match-history__categories { display: flex; flex-direction: column; }
.match-history__tournaments { gap: 1.25rem; }
.match-history__categories { gap: 1rem; padding: 1rem; }

.match-history__tournament {
  border: 1px solid var(--history-border);
  border-radius: 11px;
  overflow: hidden;
}

.match-history__tournament-header {
  align-items: center;
  background: #f1f6f8;
  border-bottom: 1px solid var(--history-border);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem 1.15rem;
}

.match-history__tournament-header time {
  color: var(--history-muted);
  display: block;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: .2rem;
}

.match-history__tournament-header h3 { font-size: 1rem; margin: 0; }
.match-history__tournament-header > i { color: #b48b20; font-size: 1.15rem; }

.match-history__category + .match-history__category {
  border-top: 1px solid #e6ecef;
  padding-top: 1rem;
}

.match-history__category-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: .8rem;
}

.match-history__category-header h4 { font-size: .95rem; margin: 0; }

.match-history__balance,
.match-history__final-badge,
.match-history__final-meta span,
.match-history__stage h5 span {
  background: var(--history-accent-soft);
  border-radius: 999px;
  color: var(--history-accent-dark);
  font-size: .72rem;
  font-weight: 700;
  padding: .4rem .65rem;
}

.match-history__balance strong { font-size: .84rem; margin-left: .25rem; }
.match-history__stage + .match-history__stage { margin-top: 1rem; }

.match-history__stage h5 {
  align-items: center;
  color: var(--history-muted);
  display: flex;
  font-size: .79rem;
  gap: .45rem;
  margin: 0 0 .55rem;
  text-transform: uppercase;
}

.match-history__stage h5 i { color: var(--history-accent); }

.match-history__match-card {
  border: 1px solid #e1e8ec;
  border-radius: 9px;
  overflow: hidden;
}

.match-history__match-card + .match-history__match-card { margin-top: .7rem; }

.match-history__table-wrap {
  contain: inline-size paint;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.match-history__table {
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 830px;
  width: 100%;
}

.match-history__table th,
.match-history__table td {
  border-bottom: 1px solid #e6ecef;
  font-variant-numeric: tabular-nums;
  padding: .58rem .48rem;
  text-align: right;
  white-space: nowrap;
}

.match-history__table thead th {
  background: #f7f9fa;
  color: var(--history-muted);
  font-size: .69rem;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.match-history__table th:first-child {
  left: 0;
  min-width: 184px;
  position: sticky;
  text-align: left;
  z-index: 1;
}

.match-history__table thead th:first-child { background: #f7f9fa; z-index: 2; }
.match-history__table tbody th:first-child { background: #fff; }
.match-history__table tbody tr:last-child > * { border-bottom: 0; }
.match-history__table tbody tr:hover > * { background: #f8fafb; }
.match-history__table tbody tr.match-history__current-player > * { background: #f1f6f8; }
.match-history__table tbody tr.match-history__current-player:hover > * { background: #e9f1f5; }

.match-history__player {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  gap: .55rem;
  max-width: 210px;
}

.match-history__player img {
  background: var(--history-accent-soft);
  border: 1px solid #d5e2e9;
  border-radius: 50%;
  flex: 0 0 30px;
  height: 30px;
  object-fit: cover;
  width: 30px;
}

.match-history__player span { overflow: hidden; text-overflow: ellipsis; }
.match-history__result,
.match-history__bonus { font-weight: 700; }

.match-history__versus-link {
  align-items: center;
  border: 1px solid #c9d8df;
  border-radius: 7px;
  color: var(--history-accent);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  text-decoration: none;
  width: 30px;
}

.match-history__versus-link:hover {
  background: var(--history-accent);
  border-color: var(--history-accent);
  color: #fff;
}

.match-history__final-badge {
  display: inline-flex;
  gap: .4rem;
  white-space: nowrap;
}

.match-history__final-badge i { color: #b48b20; }
.match-history__final-meta { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1rem 0; }
.match-history__tournament > .match-history__match-card { margin: 1rem; }

.match-history__empty-state {
  color: var(--history-muted);
  padding: 2.5rem 1rem;
  text-align: center;
}

.match-history__empty-state > i { color: #9badb7; font-size: 2rem; }
.match-history__empty-state h3 { font-size: 1rem; margin: .8rem 0 .35rem; }
.match-history__empty-state p { margin: 0; }

.match-history__back-link {
  display: inline-flex;
  font-weight: 700;
  gap: .45rem;
  margin-top: 1.25rem;
}

@media (max-width: 700px) {
  .match-history { margin-inline: 0; padding: 1.5rem .5rem 3rem; }
  .match-history__hero { grid-template-columns: 72px minmax(0, 1fr); padding: 1.2rem; }
  .match-history__avatar-link,
  .match-history__avatar { height: 72px; width: 72px; }
  .match-history__count {
    align-items: baseline;
    flex-direction: row;
    gap: .45rem;
    grid-column: 1 / -1;
    justify-content: center;
    min-width: 0;
    width: 100%;
  }
  .match-history__count span { margin-top: 0; }
  .match-history__panel { padding: .75rem; }
  .match-history__categories { padding: .5rem; }
  .match-history__tournament > .match-history__match-card { margin: .5rem; }
  .match-history__table th:first-child { position: static; }
  .match-history__category-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 430px) {
  .match-history__hero {
    align-items: flex-start;
    gap: 1rem;
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .match-history__avatar-link,
  .match-history__avatar { height: 58px; width: 58px; }
  .match-history h1 { font-size: 1.45rem; }
  .match-history__identity > p:last-child { font-size: .88rem; }
  .match-history__tournament-header { align-items: flex-start; }
}
