/* ─── /players: the player search and the player pages ─── */

/* One accent per game, for the chip, the block titles, the chart and the bars. */
.game-overwatch { --game: #f99e1a; }
.game-valorant { --game: #ff4655; }
.game-marvel-rivals { --game: #ffd23f; }

/* One colour per tier - the same as /ranked (public/ranked.css); a new tier goes into both. */
.tier-unranked { --tier: var(--muted); }
.tier-copper { --tier: #b4643c; }
.tier-bronze { --tier: #c79b5d; }
.tier-silver { --tier: #b8c2cc; }
.tier-gold { --tier: #e6c25a; }
.tier-platinum { --tier: #43c6c9; }
.tier-emerald { --tier: #3ccf8e; }
.tier-diamond { --tier: #b48cff; }
.tier-champions { --tier: #ff4a8d; }
.tier-iron { --tier: #8f8f8f; }
.tier-rookie { --tier: #9a8f86; }
.tier-ascendant { --tier: #4fd08a; }
.tier-immortal { --tier: #e0485f; }
.tier-radiant { --tier: #fff0a0; }
.tier-master { --tier: #d59cff; }
.tier-grandmaster { --tier: #ff6b5e; }
.tier-celestial { --tier: #ff9d4a; }
.tier-eternity { --tier: #ff6fae; }
.tier-one_above_all { --tier: #ffd76a; }
.tier-ultimate { --tier: #ff4a8d; }
.tier-predator { --tier: #ff3b3b; }

.pl-page {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 7rem 1.5rem 5rem;
}

.pl-label,
.pl-chip,
.pl-block-title,
.pl-back,
.pl-meta,
.pl-formats,
.pl-source,
.pl-rank-label,
.pl-rank-season,
.pl-tile-label,
.pl-info-name,
.pl-role-stats dt {
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pl-label {
  font-size: 0.65rem;
  color: var(--accent);
}

.pl-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  letter-spacing: 0.04em;
  line-height: 1;
  margin: 0.5rem 0 0.8rem;
}

.pl-lead {
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.pl-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.62rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1.6rem;
  min-height: 44px;
  cursor: none;
  transition: color 0.2s;
}

.pl-back:hover,
.pl-back:focus-visible {
  color: var(--accent);
}

.pl-search-page .pl-back {
  margin: 3rem 0 0;
}

/* ─── SEARCH ─── */

.pl-search {
  margin-top: 2rem;
  max-width: 720px;
}

.pl-games {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border: none;
  padding: 0;
  margin: 0 0 0.8rem;
}

/* The radio sits under its label, still focusable and still a radio for screen readers. */
.pl-game {
  position: relative;
  cursor: none;
}

.pl-game input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: none;
}

.pl-game span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg2);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.pl-game:hover span {
  color: var(--text);
}

.pl-game input:checked + span {
  color: var(--bg);
  background: var(--game);
  border-color: var(--game);
}

.pl-game input:focus-visible + span {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.pl-search-row {
  display: flex;
  gap: 0;
}

.pl-search-row input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-right: none;
  padding: 0 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.pl-search-row input:focus {
  border-color: var(--accent);
}

.pl-search-row input::placeholder {
  color: var(--muted);
}

.pl-search-go {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  cursor: none;
  transition: background 0.2s;
}

.pl-search-go:hover {
  background: var(--text);
}

.pl-search-go:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.pl-search-go .icon {
  width: 1.1em;
  height: 1.1em;
}

.pl-formats {
  margin-top: 0.7rem;
  font-size: 0.6rem;
  line-height: 1.8;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: none;
}

.pl-results-box {
  margin-top: 2.2rem;
  max-width: 720px;
}

.pl-results {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.pl-result {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 56px;
  padding: 0.8rem 1.1rem;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  cursor: none;
  transition: background 0.2s;
}

.pl-result:hover,
.pl-result:focus-visible {
  background: var(--surface);
}

.pl-result-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}

.pl-result-detail {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-result-arrow {
  margin-left: auto;
  flex: none;
  color: var(--game);
}

.pl-message {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.pl-message.is-warning {
  color: #e6c25a;
}

/* "No rank this season" in place of the rank cards. */
.pl-head + .pl-message {
  margin-top: 2rem;
}

.pl-message .icon {
  flex: none;
  margin-top: 0.25rem;
}

.pl-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin-top: 3rem;
}

.pl-info-card {
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.3rem 1.2rem;
  border-top: 2px solid var(--game);
}

.pl-info-name {
  font-size: 0.65rem;
  color: var(--game);
  margin-bottom: 0.6rem;
}

.pl-info-card p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}

.pl-info-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  min-height: 44px;
  cursor: none;
}

.pl-info-link:hover,
.pl-info-link:focus-visible {
  color: var(--text);
}

/* ─── PROFILE: HEADER ─── */

.pl-chip {
  display: inline-block;
  font-size: 0.62rem;
  color: var(--game);
  border: 1px solid color-mix(in srgb, var(--game) 50%, transparent);
  padding: 0.35rem 0.7rem;
}

.pl-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 5.2rem);
  letter-spacing: 0.03em;
  line-height: 1;
  margin: 0.8rem 0 0.4rem;
  overflow-wrap: anywhere;
}

.pl-tag {
  color: var(--muted);
  font-size: 0.5em;
  margin-left: 0.3rem;
}

.pl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-size: 0.62rem;
  color: var(--muted);
}

.pl-meta span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 1.2rem 0.15rem -0.7rem;
  background: var(--game);
  vertical-align: middle;
}

/* ─── PROFILE: RANKS ─── */

.pl-ranks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin: 2.2rem 0 0;
}

.pl-rank {
  position: relative;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.3rem 1.2rem 1.2rem;
  overflow: hidden;
}

.pl-rank::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--tier);
}

.pl-rank-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6rem;
  color: var(--muted);
}

.pl-rank-label .icon {
  width: 1.1em;
  height: 1.1em;
  color: var(--game);
}

.pl-rank-name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.6rem);
  letter-spacing: 0.03em;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--tier);
  margin-top: 0.5rem;
}

.pl-rank-points {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

.pl-rank-peak {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.pl-rank-peak span {
  color: var(--tier);
}

.pl-rank-season {
  font-size: 0.58rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

/* ─── PROFILE: BLOCKS ─── */

.pl-block {
  margin-top: 2.6rem;
  min-width: 0;
}

.pl-block-title {
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--game);
  margin-bottom: 0.9rem;
}

.pl-block-title span {
  color: var(--muted);
  margin-left: 0.5rem;
  letter-spacing: 0.1em;
}

.pl-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.pl-tile {
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1rem 0.9rem;
}

.pl-tile-num {
  font-family: var(--font-display);
  font-size: 1.75rem;
  letter-spacing: 0.03em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-tile-label {
  font-size: 0.56rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ─── PROFILE: RANK HISTORY ─── */

.pl-chart {
  position: relative;
  height: 190px;
  border: 1px solid var(--border);
  background:
    repeating-linear-gradient(to bottom, transparent 0 46px, rgba(255, 255, 255, 0.035) 46px 47px),
    var(--bg2);
  color: var(--game);
}

.pl-chart svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pl-chart-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

.pl-chart-scale {
  position: absolute;
  inset: 0.5rem 0.6rem auto auto;
  bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  pointer-events: none;
}

/* Readable where the line runs through them. */
.pl-chart-scale span {
  background: color-mix(in srgb, var(--bg2) 85%, transparent);
  padding: 0.1rem 0.35rem;
}

.pl-chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ─── PROFILE: HEROES AND MATCHES ─── */

.pl-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 0 2.5rem;
}

.pl-heroes,
.pl-matches {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Without a match list next to it (Overwatch shares none), the hero list takes the whole
   width, in two columns. */
.pl-columns > :only-child {
  grid-column: 1 / -1;
}

.pl-columns > :only-child .pl-heroes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.5rem;
}

.pl-hero {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.pl-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.pl-hero-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.pl-hero-share {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--game);
}

/* An <svg>: the bar's length is the width attribute of its <rect> (see
   profile.html), the gradient runs along that rect. */
.pl-hero-bar {
  display: block;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0.45rem 0;
}

.pl-hero-bar-from {
  stop-color: color-mix(in srgb, var(--game) 55%, transparent);
}

.pl-hero-bar-to {
  stop-color: var(--game);
}

.pl-hero-stats {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
}

.pl-match {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem 0.65rem 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, var(--result-tint, transparent), transparent 45%);
}

.pl-match.is-win { --result: var(--positive); --result-tint: rgba(var(--positive-rgb), 0.08); }
.pl-match.is-loss { --result: var(--accent2); --result-tint: rgba(var(--accent2-rgb), 0.08); }
.pl-match.is-draw { --result: var(--muted); }

.pl-match-result {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--result);
  border-left: 3px solid var(--result);
}

.pl-match-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pl-match-hero {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-match-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-match-kda {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
}

.pl-match-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.pl-match-score {
  color: var(--muted);
}

.pl-match-change.up {
  color: var(--positive);
}

.pl-match-change.down {
  color: var(--accent2);
}

/* ─── PROFILE: ROLES ─── */

.pl-roles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.pl-role {
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 1.1rem 1rem;
}

.pl-role-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}

.pl-role-name .icon {
  color: var(--game);
  width: 1em;
  height: 1em;
}

.pl-role-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
  margin: 0.8rem 0 0;
}

.pl-role-stats dt {
  font-size: 0.55rem;
  color: var(--muted);
}

.pl-role-stats dd {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

.pl-source {
  margin-top: 2.6rem;
  font-size: 0.58rem;
  line-height: 1.8;
  color: var(--muted);
  letter-spacing: 0.1em;
}

/* ─── PROFILE: STATES (loading, private, not found ...) ─── */

.pl-state {
  margin-top: 2.4rem;
  max-width: 60ch;
  border: 1px solid var(--border);
  border-left: 3px solid var(--game);
  background: var(--bg2);
  padding: 1.5rem 1.4rem;
}

.pl-state p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}

.pl-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--game);
  border-radius: 50%;
  margin-bottom: 1rem;
  animation: pl-spin 0.9s linear infinite;
}

@keyframes pl-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pl-spinner {
    animation: none;
  }
}

/* ─── NARROW SCREENS ─── */

@media (max-width: 900px) {
  .pl-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .pl-page {
    padding: 6.5rem 1.25rem 4rem;
  }

  .pl-columns > :only-child .pl-heroes {
    grid-template-columns: minmax(0, 1fr);
  }

  /* One per line: a wrapped line began with a lone separator. */
  .pl-meta {
    flex-direction: column;
    gap: 0.25rem;
  }

  .pl-meta span + span::before {
    display: none;
  }

  .pl-search-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .pl-search-row input {
    border-right: 1px solid var(--border);
  }

  .pl-search-go {
    justify-content: center;
  }

  .pl-match {
    grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  }

  /* The score and RR move under the K/D/A on a phone. */
  .pl-match-end {
    grid-column: 2 / -1;
    flex-direction: row;
    gap: 0.8rem;
    justify-content: flex-start;
  }
}

/* ─── PHONES: 12PX TEXT FLOOR ───
   This page's text under 0.75rem, lifted to it on phones - see the block of
   the same name at the end of base/shared.css. */
@media (max-width: 600px) {
  .pl-label,
  .pl-back,
  .pl-game span,
  .pl-search-go,
  .pl-formats,
  .pl-result-detail,
  .pl-info-name,
  .pl-info-link,
  .pl-chip,
  .pl-meta,
  .pl-rank-label,
  .pl-rank-season,
  .pl-block-title,
  .pl-tile-label,
  .pl-chart-scale,
  .pl-chart-axis,
  .pl-hero-share,
  .pl-hero-stats,
  .pl-match-sub,
  .pl-match-end,
  .pl-role-stats dt,
  .pl-source {
    font-size: 0.75rem;
  }
}
