.results-panel {
  --results-detail-accent: #d63d7b;
}

.profile-tabs {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-tab {
  position: relative;
  min-height: 3.25rem;
  padding: 0.9rem 0.5rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: color-mix(in srgb, var(--muted) 75%, transparent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 160ms ease;
}

.profile-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--results-detail-accent);
  opacity: 0;
  transition: opacity 160ms ease;
}

.profile-tab:hover {
  color: #fff7f9;
}

.profile-tab[aria-selected="true"] {
  color: #fff7f9;
}

.profile-tab[aria-selected="true"]::after {
  opacity: 1;
}

.profile-tab:focus-visible,
.profile-tab-panel:focus-visible {
  outline: 2px solid var(--results-detail-accent);
  outline-offset: 3px;
}

.profile-tab-panel {
  min-width: 0;
  margin-top: 1.4rem;
}

/* The main grid also has display rules managed by the profile renderer. */
.profile-tabs.hidden,
.profile-tab-panel[hidden] {
  display: none !important;
}

.profile-replays-panel {
  padding: 1.35rem;
  border: 1px solid color-mix(in srgb, var(--results-detail-accent) 28%, transparent);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, color-mix(in srgb, var(--results-detail-accent) 10%, transparent), transparent 65%), rgba(13, 13, 17, 0.92);
}

#profile-replays-content {
  margin-top: 1.3rem;
}

#profile-replays-content .more-replays-extras + .more-replays-section-label {
  position: relative;
  padding-top: 1.4rem;
}

#profile-replays-content .more-replays-extras + .more-replays-section-label::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(214, 61, 123, 0.55) 18%, rgba(214, 61, 123, 0.55) 82%, transparent);
  opacity: 0.85;
  pointer-events: none;
}

.profile-replays-panel .more-replays-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

.profile-replays-panel .more-replays-list + .more-replays-list {
  margin-top: 0.85rem;
}

.profile-replays-panel .replay-history-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md, 12px);
}

.rh-header,
.rh-meta,
.rh-identity,
.rh-stats {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.rh-header {
  flex-wrap: wrap;
  justify-content: center;
  padding-bottom: 0.8rem;
}

.rh-meta { flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
.rh-pill {
  max-width: 100%;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #c3cedd;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.rh-positive { color: #8ce6b0; background: rgba(34, 197, 94, 0.14); }
.rh-scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1.2rem;
  padding-top: 0.8rem;
}
.rh-team { display: grid; gap: 0.35rem; min-width: 0; }
/* Center the score on the player rows below the team labels. */
.rh-scoreboard > .rp-score-row { padding-top: 1.3rem; }
.rh-blue { border-left: 2px solid #559cff; padding-left: 0.7rem; }
.rh-orange { border-right: 2px solid #ff974b; padding-right: 0.7rem; }
.rh-team-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rh-orange .rh-team-label { text-align: right; }
.rh-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  min-width: 0;
  min-height: 1.65rem;
}
.rh-blue .rh-player-row,
.rh-orange .rh-identity { flex-direction: row-reverse; }
.rh-orange .rh-mvp { order: -2; }
.rh-orange .rh-stat-score { order: -1; }
.rh-player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 700;
}
.rh-blue .rh-identity { justify-content: flex-end; }
.rh-blue .rh-player-name { color: #2a8cff; }
.rh-orange .rh-player-name { color: #ff8c2a; }
.rh-blue .rh-searched .rh-player-name { color: #87ceeb; }
.rh-orange .rh-searched .rh-player-name { color: #ffdcb5; }
.rh-platform {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  object-fit: contain;
  filter: invert(1);
  opacity: 0.75;
  flex-shrink: 0;
}
.rh-stats { flex-shrink: 0; gap: 0.55rem; font-variant-numeric: tabular-nums; }
.rh-stat { display: inline-flex; align-items: baseline; gap: 0.18rem; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.rh-stat small { color: var(--muted); font-size: 0.6rem; font-weight: 600; }
.rh-mvp { padding: 0.15rem 0.4rem; border-radius: 999px; color: #fff; background: #079d75; font-size: 0.65rem; font-weight: 700; }
.rh-empty { color: var(--muted); font-size: 0.85rem; }
.replay-history-card .rp-score-num { font-size: 2.4rem; }
.replay-history-card .rp-watch-dash { font-size: 1.8rem; }

@media (max-width: 1200px) {
  .rh-player-row,
  .rh-blue .rh-player-row { flex-direction: column; align-items: stretch; gap: 0.25rem; }
  .rh-blue .rh-stats { justify-content: flex-end; }
  .rh-orange .rh-stats { justify-content: flex-start; }
  .rh-orange .rh-identity { justify-content: flex-end; }
  .rh-team { gap: 0.65rem; }
}

@media (max-width: 600px) {
  .profile-replays-panel .replay-history-card { padding: 0.8rem; }
  .rh-scoreboard { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
  .rh-scoreboard > .rp-score-row { grid-row: 1; padding-top: 0; }
  .rh-player-row,
  .rh-blue .rh-player-row { flex-direction: column; align-items: stretch; gap: 0.25rem; }
  .rh-blue .rh-identity { justify-content: flex-start; }
  .rh-orange .rh-identity { justify-content: flex-start; }
  .rh-blue .rh-stats { justify-content: flex-start; }
  .rh-orange .rh-stats { justify-content: flex-end; }
  .rh-stats { gap: 0.4rem; }
  .rh-team { gap: 0.4rem; }
  .rh-player-name { font-size: 0.85rem; }
}

.profile-replays-panel .more-replays-load-more {
  border-color: color-mix(in srgb, var(--results-detail-accent) 40%, transparent);
  background: color-mix(in srgb, var(--results-detail-accent) 14%, #0f0f13);
}

@media (max-width: 720px) {
  .profile-tabs {
    gap: 0.75rem;
  }

  .profile-tab {
    flex: 1;
    min-width: 0;
    padding-inline: 0.6rem;
  }

  .profile-replays-panel {
    padding: 0;
    border: 0;
    background: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-tab,
  .profile-tab::after {
    transition: none;
  }
}
