.player-page {
  --profile-cream: #fff0d7;
  --profile-gold: #f7d598;
  --profile-blue: #9bd7dc;
  --profile-surface: #18242a;
  --profile-border: #37464a;
  --profile-track: #2b3f43;
  max-width: 1100px;
  padding-top: 12px;
}

.player-page:has(#profile-content) { padding-top:8px; }
#profile-back { min-height:30px; margin-bottom:5px; }

.profile-header {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  min-height: 104px;
  overflow: hidden;
  padding: 12px clamp(12px, 2vw, 20px);
  border: 1px solid #91816a91;
  border-radius: 12px;
  color: var(--profile-cream);
  background: radial-gradient(ellipse at 79% 20%, color-mix(in srgb, var(--hero-accent, var(--profile-blue)) 64%, #172831), transparent 69%),
              linear-gradient(100deg,#121b24 30%,#24404a);
  box-shadow: inset 0 1px #ffe0ab35,0 18px 34px #080b105c;
}
.profile-header::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(90deg,#121b24 6%,#121b24f0 26%,#121b243b 52%,transparent 76%),
              linear-gradient(0deg,#0d1921bb,transparent 48%);
}
.profile-header::after {
  position: absolute;
  z-index: -3;
  inset: -29% -4% auto auto;
  width: min(72%, 620px);
  height: 146%;
  border: 1px solid #ffe9b974;
  border-radius: 50%;
  box-shadow: inset 0 0 0 14px #ffe9b916,0 0 0 17px #ffe9b913,0 0 0 33px #ffe9b90a;
  transform: rotate(-13deg);
  pointer-events: none;
  content: "";
}
@media (prefers-reduced-motion:no-preference) {
  .profile-header::after { animation:profile-orbit-sway 18s ease-in-out infinite alternate; }
  @keyframes profile-orbit-sway { to { transform:translate(-23px,5px) rotate(-19deg); } }
}
.profile-cover {
  position: absolute;
  z-index: -2;
  width: clamp(174px, 21%, 237px);
  height: auto;
  right: 27%;
  bottom: clamp(-143px,-12vw,-101px);
  mask-image: linear-gradient(90deg, transparent, #000 15%);
  filter: drop-shadow(0 12px 26px #10171d) saturate(1.12);
  pointer-events: none;
}
.profile-identity { display:flex; align-items:center; gap:12px; min-width:0; }
.profile-identity > div:last-child { min-width:0; }
.profile-identity h1 { font-size:clamp(25px,3.5vw,39px); overflow-wrap:anywhere; text-shadow:0 2px 18px #0a101aed; }
.profile-avatar {
  display: block;
  width: 48px;
  height: 48px;
  border: 1px solid #ead1a2a1;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 5px 15px #0c121b8f;
  object-fit: cover;
}
.profile-meta:not([hidden]) { display:block; margin-top:4px; color:#dedfd4; font-size:11px; }
.summary-rank { display:flex; align-items:center; gap:7px; min-height:30px; padding:4px 10px; color:var(--muted); background:linear-gradient(105deg,#41372a75,transparent 64%); }
.summary-rank[data-ranked] { color:var(--profile-gold); }
.summary-rank-name { font-size:14px; font-weight:500; }
.profile-crest { display:block; width:27px; height:24px; object-fit:contain; }
.profile-actions { display:flex; gap:6px; flex-wrap:wrap; }
.profile-actions .button { min-height:35px; padding:6px 10px; font-size:12px; }
.profile-actions .button:not(.primary) { border-color:#7685848c; background:#12212be0; }
.profile-actions .button[aria-pressed="true"] { color:var(--profile-gold); border-color:#a38352; background:#473821; }
.profile-actions .button:hover:not(:disabled) { border-color:var(--profile-gold); }
.profile-actions a { display:inline-flex; align-items:center; }
.profile-actions a[hidden] { display:none; }
.compare-page { max-width:860px; }
.compare-page .page-heading { padding:18px 0 14px; }
.compare-page h1 { font-size:clamp(26px,3.2vw,38px); }
#compare-filters { margin-bottom:12px; }
.profile-toolbar { display:flex; align-items:end; justify-content:space-between; gap:7px 16px; margin:7px 0 9px; }
.view-tabs.profile-tabs { min-width:0; margin:0; gap:4px; overflow-x:auto; scrollbar-width:thin; }
.profile-tabs button { flex:none; }
#profile-filters select { min-height:35px; padding-block:5px; }

.profile-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  margin: 0;
  border-top: 1px solid var(--profile-border);
}
.profile-stat { padding:5px 10px; min-width:0; border-inline-end:1px solid var(--profile-border); }
.profile-stat:nth-child(4),.profile-stat:last-child { border-inline-end:0; }
.profile-stat dt { color:var(--muted); font-size:12px; white-space:nowrap; }
.profile-stat dd { margin:2px 0 0; font-size:20px; font-weight:500; line-height:1.15; font-variant-numeric:tabular-nums; }
.profile-stat:nth-child(2) dd { color:#b4e1c5; }
.profile-stat:nth-child(4) dd { color:var(--profile-gold); }
.profile-stat small { margin-top:2px; font-weight:400; }
.profile-stat .grade { vertical-align:middle; }
.profile-form-stat { grid-column:1/-1; display:flex; align-items:center; flex-wrap:wrap; gap:4px 10px; border-top:1px solid var(--profile-border); }
.profile-form-stat dd { margin:0; color:var(--muted); font-size:12px; }
.profile-form-stat .match-form { gap:3px; }
.profile-form-stat .match-form > span { width:15px; height:16px; }

.profile-overview-grid:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(272px,29%);
  align-items: start;
  gap: 12px;
}
.profile-main,.profile-rail { display:grid; gap:8px; min-width:0; }
#overview-history { min-width:0; }
.profile-panel {
  min-width:0;
  padding:10px 12px;
  border:1px solid var(--profile-border);
  border-radius:9px;
  background:linear-gradient(160deg,#203037,var(--profile-surface) 60%);
  box-shadow:inset 0 1px #ffffff08,0 9px 21px #080d113e;
}
.profile-panel.summary-panel { padding:0; }
.profile-panel-head { display:flex; align-items:baseline; justify-content:space-between; gap:4px 10px; flex-wrap:wrap; margin-bottom:5px; }
.profile-panel h2,.profile-history h2 { color:var(--profile-cream); font-size:16px; font-weight:500; }
.profile-history h2 { font-size:19px; }
.trend-panel { --trend-gutter:42px; }
.duration-panel { width:100%; }
.trend-head { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; }
.trend-modes,.history-results { display:flex; gap:2px; padding:2px; border:1px solid var(--profile-border); border-radius:6px; }
:is(.trend-modes,.history-results) label { position:relative; cursor:pointer; }
:is(.trend-modes,.history-results) input { position:absolute; width:1px; height:1px; margin:0; opacity:0; }
:is(.trend-modes,.history-results) span { display:grid; place-items:center; min-height:30px; padding:3px 8px; border-radius:4px; color:var(--muted); font-size:11px; white-space:nowrap; }
:is(.trend-modes,.history-results) input:checked + span { background:var(--profile-track); color:var(--profile-gold); }
:is(.trend-modes,.history-results) label:hover span { color:var(--profile-cream); }
:is(.trend-modes,.history-results) input:focus-visible + span { outline:2px solid var(--profile-gold); outline-offset:1px; }
.trend-readout { grid-column:1/-1; min-height:1.5em; color:var(--profile-blue); font-size:11px; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.trend-body { display:grid; grid-template-columns:calc(var(--trend-gutter) - 6px) minmax(0,1fr); gap:6px; height:103px; }
.trend-axis { position:relative; color:var(--muted); font-size:10px; line-height:1; font-variant-numeric:tabular-nums; }
.trend-tick { position:absolute; right:0; display:flex; align-items:baseline; gap:4px; white-space:nowrap; transform:translateY(-50%); }
.trend-tick b { color:var(--profile-cream); font-weight:500; }
.trend-tick b:is([data-grade="S"],[data-grade="A"]) { color:var(--profile-gold); }
.trend-tick b[data-grade="B"] { color:var(--green); }
.trend-tick b:is([data-grade="D"],[data-grade="F"]) { color:var(--red); }
.trend-plot { position:relative; min-width:0; }
.trend-plot svg { display:block; width:100%; height:100%; }
.trend-grid { stroke:var(--profile-border); stroke-width:1; vector-effect:non-scaling-stroke; }
.trend-threshold { stroke:#536b76; stroke-dasharray:3 4; }
.trend-area { fill:url(#trend-fill); }
.trend-fill-top { stop-color:var(--profile-blue); stop-opacity:.25; }
.trend-fill-bottom { stop-color:var(--profile-blue); stop-opacity:.025; }
.trend-line { fill:none; stroke:var(--profile-blue); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 4px #8bedea50); }
.trend-targets { position:absolute; inset:0; display:grid; grid-template-columns:repeat(var(--samples),minmax(0,1fr)); }
.trend-point { position:relative; padding:0; border:0; background:transparent; border-radius:3px; }
.trend-point::after {
  position: absolute;
  top: var(--point-y);
  left: 50%;
  transform: translate(-50%,-50%);
  width: 7px;
  height: 7px;
  border: 1px solid var(--profile-surface);
  border-radius: 50%;
  background: var(--profile-blue);
  content: "";
}
.trend-point:is([data-grade="S"],[data-grade="A"])::after { background:var(--profile-gold); }
.trend-point:is(:hover,:focus-visible) { background:#9bd7dc19; outline-offset:-1px; }
.trend-point:is(:hover,:focus-visible)::after { width:11px; height:11px; }
.trend-gap { display:flex; align-items:flex-end; justify-content:center; padding-bottom:3px; color:var(--muted); font-size:11px; line-height:1; }
.trend-range { display:flex; justify-content:space-between; padding-inline-start:var(--trend-gutter); margin-top:3px; color:var(--muted); font-size:10px; }

.frequent-head,.frequent-hero { display:grid; grid-template-columns:minmax(0,1fr) minmax(48px,.55fr) minmax(57px,.55fr) 9px; gap:11px; }
.frequent-head { margin-top:5px; padding-inline:6px; color:var(--muted); font-size:11px; }
.frequent-head[hidden] { display:none; }
.frequent-heroes,.profile-matches { margin:0; padding:0; list-style:none; }
.frequent-hero {
  width: 100%;
  min-height: 34px;
  align-items: center;
  padding: 3px 6px;
  border: 0;
  border-bottom: 1px solid var(--profile-border);
  text-align: left;
  background: transparent;
}
.frequent-heroes li:last-child .frequent-hero { border-bottom:0; }
.frequent-hero:hover,.frequent-hero:focus-visible { background:#ffffff08; }
.frequent-hero .hero span { overflow-wrap:anywhere; }
.frequent-player { min-width:0; display:flex; align-items:center; gap:8px; font-size:12px; }
.frequent-player .avatar { flex:none; width:24px; height:24px; }
.frequent-player > span:last-child { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.frequent-value { display:grid; gap:3px; font-size:12px; font-variant-numeric:tabular-nums; }
.frequent-value b,.duration-value { font-weight:500; }
.profile-track { display:block; height:4px; overflow:hidden; border-radius:4px; background:var(--profile-track); }
.profile-track > span { display:block; height:100%; border-radius:inherit; background:currentColor; }
.matches-track { color:var(--profile-blue); }
.duration-chart { display:grid; gap:5px; }
.duration-row { display:grid; grid-template-columns:67px minmax(0,1fr) 39px 53px; align-items:center; gap:6px; font-size:11px; font-variant-numeric:tabular-nums; }
.duration-track { height:6px; color:var(--green); background:#754c48; }
.duration-track[data-empty] { background:var(--profile-track); }
.duration-value,.duration-sample { text-align:right; }
.duration-sample { font-size:11px; color:var(--muted); }

.profile-table th:not(:first-child),.profile-table td:not(:first-child) { text-align:right; }
.profile-table td:first-child { width:52%; }
.profile-table .player-link { min-height:36px; }
.profile-table .avatar { width:28px; height:28px; }
.profile-table .hero { font-size:inherit; }
.profile-partner-filters { display:flex; gap:6px; margin-bottom:8px; }
.profile-partner-filters button[aria-pressed="true"] { border-color:var(--profile-gold); color:var(--profile-gold); }
.hero-filter-link { display:inline-flex; align-items:center; gap:8px; min-height:38px; padding:0; border:0; background:transparent; text-align:left; }
.hero-filter-link:hover { color:var(--profile-gold); }
.profile-hero-actions { display:flex; flex-wrap:wrap; align-items:center; gap:3px 10px; }
.hero-items-link { min-height:34px; padding:4px 8px; border:1px solid var(--profile-border); border-radius:5px; background:#202820; color:var(--profile-gold); font-size:12px; }
.hero-items-link:hover { border-color:var(--profile-gold); }
.profile-history { margin-top:15px; }
.profile-overview-grid .profile-history { margin-top:0; }
.profile-history-head { display:flex; align-items:center; justify-content:space-between; gap:5px 12px; flex-wrap:wrap; margin-bottom:7px; }
.profile-history-label { display:flex; align-items:baseline; gap:3px 9px; flex-wrap:wrap; }
.profile-history-controls { display:flex; align-items:center; flex-wrap:wrap; gap:7px; min-width:0; }
.history-results { flex:none; }
.history-results input { min-height:0; padding:0; border:0; }
.profile-history-label #history-hero-summary { font-variant-numeric:tabular-nums; }
.profile-history-label #history-hero-summary[hidden] { display:none; }
.profile-history-controls > label { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; }
.profile-history-head select { max-width:180px; min-height:33px; padding-block:4px; }
.profile-matches { display:grid; gap:5px; }
.match-card {
  --outcome: var(--green);
  min-width: 0;
  border: 1px solid var(--profile-border);
  border-inline-start: 3px solid var(--outcome);
  border-radius: 7px;
  background: linear-gradient(105deg, color-mix(in srgb, var(--outcome) 11%, #18242d), #19262d 48%, #152128);
  box-shadow: 0 5px 15px #060e1354;
}
.match-card[data-result="loss"] { --outcome:var(--red); }
.match-card:is(:hover,:focus-within,[data-expanded]) { border-color:color-mix(in srgb, var(--outcome) 55%, var(--profile-border)); border-inline-start-color:var(--outcome); }
.match-card-row {
  display:grid;
  grid-template-columns:minmax(94px,1fr) minmax(76px,.8fr) minmax(71px,.68fr) minmax(0,1.5fr) max-content auto;
  grid-template-areas:"meta meta meta meta team action" "hero kda souls items team action";
  align-items:center;
  gap:2px 9px;
  padding:5px 8px;
  cursor:pointer;
}
.match-card-meta { grid-area:meta; display:flex; align-items:baseline; flex-wrap:wrap; gap:1px 7px; color:var(--muted); font-size:11px; }
.match-card-result { color:var(--outcome); font-weight:500; }
.match-card-hero { grid-area:hero; min-width:0; font-weight:500; }
.match-card-hero .hero { gap:6px; font-size:12px; }
.match-card-hero .hero span { overflow-wrap:anywhere; }
.match-card-hero img { width:32px; height:32px; }
.match-card-kda { grid-area:kda; }
.match-card-souls { grid-area:souls; }
.match-card-stat { min-width:0; font-variant-numeric:tabular-nums; }
.match-card-stat b { font-size:13px; font-weight:500; }
.match-card-kda :is(.fine,.match-card-kp) { display:inline; }
.match-card-kda > b { display:block; }
.match-card-kp { margin-inline-start:4px; color:var(--profile-blue); font-size:10px; white-space:nowrap; }
.match-card-kda .match-card-kp[hidden] { display:none; }
.match-card-team { grid-area:team; min-width:0; }
.match-card-team-icons { display:grid; grid-template-columns:repeat(3,17px); gap:3px; }
.match-card-team-icons .hero { display:grid; place-items:center; background:#122028; color:var(--muted); font-size:9px; overflow:hidden; }
.match-card-team-icons :is(img,.hero) { width:17px; height:17px; border-radius:3px; }
.match-card-team-icons img { display:block; object-fit:cover; }
.match-card-team-icons .hero > span { max-width:17px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.match-card-team-icons .hero:has(img) > span { display:none; }
.match-inventory {
  grid-area: items;
  min-width: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  text-align: left;
  background: none;
}
.match-inventory:hover,.match-inventory:focus-visible { border-color:var(--profile-border); background:#ffffff0a; }
.match-inventory-icons { display:flex; gap:2px; flex-wrap:wrap; }
.match-inventory-icon { display:block; width:16px; height:16px; border-radius:3px; background:#131e26; object-fit:cover; }
.match-inventory-label { display:none; }
.match-score {
  grid-area: action;
  display: grid;
  min-width: 79px;
  min-height: 44px;
  padding: 3px 6px;
  border: 1px solid var(--score-border, var(--profile-border));
  border-radius: 6px;
  background: #243037;
  text-align: left;
}
.match-score[data-place="1"] { --score-border:#dfc489; }
.match-score[data-place="2"] { --score-border:#aebac7; }
.match-score[data-place="3"] { --score-border:#c98a61; }
.match-score:hover,.match-score:focus-visible { border-color:var(--score-border,var(--profile-gold)); background:#324148; }
.match-score-line,.match-score.match-build-link { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.match-score.match-build-link { color:var(--profile-gold); }
.match-score-arrow { color:var(--profile-gold); font-size:17px; line-height:1; transform:rotate(90deg); }
.match-card[data-expanded] .match-score-arrow { transform:rotate(-90deg); }
@media (prefers-reduced-motion:no-preference) {
  .match-score-arrow { transition:transform 160ms ease; }
}
.pagination { display:flex; justify-content:space-between; align-items:center; gap:9px; margin-top:13px; font-size:12px; color:var(--muted); }
.pagination[hidden] { display:none; }

@media (max-width:840px) {
  .profile-toolbar { flex-wrap:wrap; }
  .profile-tabs button { padding-inline:10px; }
  .profile-overview-grid:not([hidden]) { grid-template-columns:minmax(0,1fr); }
}

@media (min-width:621px) and (max-width:960px) {
  .match-card-kda :is(.fine,.match-card-kp) { display:block; margin-inline-start:0; }
}

@media (max-width:620px) {
  .profile-header { min-height:98px; padding:8px 11px; gap:7px; }
  .profile-cover { right:9%; bottom:-83px; width:166px; }
  .profile-header::before { background:linear-gradient(90deg,#121b24 5%,#121b24c9 42%,#121b242b 100%),linear-gradient(0deg,#0d1921b8,transparent); }
  .profile-avatar { width:38px; height:38px; }
  .profile-identity { gap:10px; }
  .profile-meta:not([hidden]) { font-size:11px; }
  .profile-actions { gap:3px; }
  .profile-actions .button { min-height:30px; font-size:11px; padding:3px 5px; }
  .profile-toolbar { display:grid; gap:4px; }
  #profile-filters .filters label { gap:0; font-size:0; }
  .profile-toolbar .filters select { min-height:35px; }
  #profile-tabs > button { min-height:38px; padding-inline:10px; font-size:12px; }
  .summary-rank-name { font-size:14px; }
  .profile-stat { padding:5px 6px; }
  .profile-stat dt { font-size:11px; white-space:normal; }
  .profile-stat:nth-child(4) dt { letter-spacing:-.03em; }
  .profile-stat dd { font-size:15px; }
  .profile-form-stat dd { font-size:11px; }
  .profile-stat .grade { min-width:16px; padding-inline:2px; margin-right:1px; }
  .profile-panel { padding:10px; }
  .frequent-head,.frequent-hero { grid-template-columns:minmax(0,1fr) 43px 51px 8px; gap:7px; padding-inline:2px; }
  .frequent-hero .hero img { width:24px; height:24px; }
  .duration-row { grid-template-columns:65px minmax(0,1fr) 40px 56px; gap:5px; font-size:11px; }
  .duration-sample { font-size:10px; }
  .profile-table th,.profile-table td { padding:8px 6px; font-size:11px; }
  .profile-table td:first-child { width:auto; }
  .profile-table .player-link { gap:6px; min-height:44px; }
  .profile-table .avatar,.profile-table .hero img { width:22px; height:22px; }
  .profile-history-controls { gap:5px; }
  .profile-history-controls > label { min-width:0; gap:0; font-size:0; }
  .profile-history-head select { max-width:min(160px,38vw); min-width:0; padding-inline:6px; font-size:12px; }
  .history-results { gap:0; }
  .history-results span { padding-inline:5px; }
  .match-card-row {
    grid-template-columns: repeat(2,minmax(0,1fr)) auto;
    grid-template-areas: "meta meta meta" "hero kda action" "items items action" "team team souls";
    gap: 2px 6px;
    padding: 5px 6px;
  }
  .match-card-hero img { width:27px; height:27px; }
  .match-card-stat b { font-size:12px; }
  .match-card-souls { justify-self:start; }
  .match-card-team-icons { grid-template-columns:repeat(6,17px); }
  .match-score { min-width:70px; padding-inline:4px; }
  .match-score .grade { min-width:17px; margin-right:3px; }
  .match-score-line { gap:3px; }
  .match-inventory-icon { width:18px; height:18px; }
}

@media (max-width:410px) {
  .view-tabs.profile-tabs { gap:3px; }
  #profile-tabs > button { padding-inline:5px; font-size:11px; }
  .profile-hero-actions { display:grid; justify-items:start; }
  .hero-items-link { min-height:28px; padding-block:2px; font-size:11px; }
  .profile-cover { right:-4px; bottom:-83px; }
  .profile-actions .button { padding-inline:4px; }
}
