/* One column, like the in-game scoreboard. Only the Elo change is loud: a solid block in the win or loss color. */
:root {
  --ground: #1b2430;
  --raised: #263241;
  --line: rgb(150 175 205 / 0.27);
  --text: #eef2f6;
  --quiet: #a9b6c5;
  --sand: #e9b765;
  --win: #4ccb88;
  --loss: #f0645a;
  --ink: #10161e;
  --display: 'Sofia Sans Extra Condensed', 'Arial Narrow', Impact, sans-serif;
  --body: 'Sofia Sans', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}

*, ::before, ::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, p, dl, dd { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; }
h2 { font-size: 1.125rem; font-weight: 700; }

html { background: var(--ground); }
/* Takes only light and shadow from the picture, so the page stays blue. More opacity shows more of it. */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: url(background.jpg) center / cover #3f5f86; background-blend-mode: luminosity; opacity: 0.25; pointer-events: none; }
body {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 62rem;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  font: 1.0625rem/1.45 var(--body);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Search: large and alone at first, then a bar above the result. */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
.site { font: 900 1.75rem/1 var(--display); text-decoration: none; }
form { flex: 1 1 18rem; min-width: 0; }
.field { display: flex; border-radius: 6px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
input, button { font: inherit; color: inherit; border: 0; background: none; }
input { flex: 1; min-width: 0; padding: 0.7rem 1rem; }
input:focus-visible { outline: none; }
input::placeholder { color: var(--quiet); opacity: 1; }
button { margin: 4px; padding: 0 1.1rem; border-radius: 4px; background: var(--sand); color: var(--ink); font-weight: 700; cursor: pointer; }
button:hover { background: #f4ca83; }
.players { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--quiet); }
.player { padding: 0.25rem 0.7rem; border-radius: 4px; background: var(--raised); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.player:hover { background: var(--line); }
#recent { flex-basis: 100%; font-size: 0.9375rem; }
.recent-player { display: flex; min-width: 0; border-radius: 4px; background: var(--raised); }
.recent-player .player { padding-right: 0.3rem; background: none; }
.recent-player .player:hover { text-decoration: underline; }
.recent-player button { flex: none; width: 1.75rem; margin: 0; padding: 0; background: none; color: var(--quiet); font-size: 1.125rem; font-weight: 400; line-height: 1; }
.recent-player button:hover { background: var(--line); color: var(--text); }

/* Still there for screen readers. */
body:not(.home) label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.home .top { flex-flow: column; align-items: stretch; gap: 1.5rem; margin-top: clamp(1rem, 14vh, 9rem); }
.home form, .home #recent { flex: none; }
.home label { display: block; margin-bottom: 1.25rem; font: 900 clamp(3.25rem, 12vw, 7rem)/0.9 var(--display); text-wrap: balance; }
.home .site { color: var(--sand); }
.home .field { font-size: 1.375rem; }

main { flex: 1; min-width: 0; }
#status { color: var(--quiet); }
#status:not(:empty) { margin-bottom: 1.5rem; }

/* While a player is looked up: each map icon in turn, in the center of the screen. */
#loading { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; }
#loading .map-icon {
  grid-area: 1 / 1; width: 7rem; height: 7rem; opacity: 0;
  animation: turn 2s calc(var(--index) * 0.2s) linear infinite;
}
#loading:not([hidden]) + #status {
  position: fixed; inset: calc(50% + 4.5rem) 1rem auto; margin: 0; text-align: center; overflow-wrap: anywhere;
}
/* Ten icons, so each has a tenth of the time. */
@keyframes turn {
  0% { opacity: 0; }
  2%, 9% { opacity: 1; }
  11%, 100% { opacity: 0; }
}
@keyframes pop {
  0% { scale: 0.5; animation-timing-function: cubic-bezier(0.2, 1.6, 0.4, 1); }
  5%, 9% { scale: 1; }
  11%, 100% { scale: 1.15; }
}
@media (prefers-reduced-motion: no-preference) {
  #loading .map-icon { animation-name: turn, pop; }
}
#status p + p { margin-top: 0.75rem; }
#result { display: flex; flex-direction: column; gap: 2.5rem; }
#result[aria-busy] { opacity: 0.45; }
#result > * { min-width: 0; }

.profile { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; }
/* As tall as the picture, so they line up with it and not with the links below it. */
.who, .level, .change { min-height: 5rem; align-self: flex-start; }
.avatar { display: grid; place-items: center; width: 5rem; height: 5rem; border-radius: 6px; background: var(--raised); object-fit: cover; font: 900 3rem/1 var(--display); }
/* Pulled left by the space around each icon, so the first one lines up with the picture. */
.links { display: flex; margin: 0.25rem 0 0 -0.375rem; }
.links a { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; color: var(--quiet); }
.links a:hover { color: var(--text); }
.links a::before { content: ''; width: 1rem; height: 1rem; background: currentColor; mask: var(--icon) center / contain no-repeat; }
.links .steam { --icon: url('assets/links/steam.svg'); }
.links .faceit { --icon: url('assets/links/faceit.svg'); }
.who { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.who h1 { font: 900 clamp(2.5rem, 8vw, 3.75rem)/0.95 var(--display); overflow-wrap: anywhere; }
.who a { text-decoration: none; }
.who a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.12em; }
.who p, .next { color: var(--quiet); }
.change { display: flex; align-items: center; gap: 0.9rem; }
.cat { flex: none; width: 5rem; height: 5rem; border-radius: 6px; object-fit: cover; }
.when, .estimate { font-size: 0.875rem; line-height: 1.3; color: var(--quiet); }
.amount { display: flex; align-items: baseline; gap: 0.75rem; }
.number { font: 900 3rem/0.9 var(--display); }
.up .number { color: var(--win); }
.down .number { color: var(--loss); }
.from-to { font: 700 1.375rem/1 var(--display); }
.level { display: flex; align-items: center; gap: 0.9rem; margin-inline: auto; }
.level:last-child { margin-right: 0; }
.level > div { width: 10.5rem; }
.elo { font: 900 2rem/1 var(--display); }
.elo span { font-size: 1.25rem; color: var(--quiet); }
.level-bar, .share { display: block; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.level-bar { margin: 0.35rem 0 0.2rem; }
.level-bar span, .share span { display: block; height: 100%; width: calc(var(--share) * 100%); background: var(--sand); }
.next { font-size: 0.9375rem; }

.periods { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-bottom: -1.5rem; }
.periods a { padding: 0.4rem 0; color: var(--quiet); text-decoration: none; border-bottom: 3px solid transparent; }
.periods a:hover { color: var(--text); }
.periods [aria-current] { color: var(--text); font-weight: 700; border-color: var(--sand); }

.nothing { padding: 1.5rem 1.25rem; border-radius: 6px; background: var(--raised); font: 700 1.5rem/1 var(--display); }

.totals { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.25rem 1rem; }
.totals dt { color: var(--quiet); font-size: 0.9375rem; }
.totals dd { font: 900 2.5rem/1 var(--display); }

.chart { display: flex; gap: 0.75rem; margin-top: 0.75rem; }
.axis { display: flex; flex-direction: column; justify-content: space-between; height: 11rem; padding-block: 0.6rem; text-align: right; font-size: 0.8125rem; line-height: 1; color: var(--quiet); }
/* The padding leaves room for a number that grows under the mouse. */
.chart-scroll { flex: 1; min-width: 0; overflow-x: auto; margin: -0.75rem -4px 0; padding: 0.75rem 4px 0; }
.rounds { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(17px, 1fr); min-width: min-content; background: linear-gradient(var(--line), var(--line)) 0 5.5rem / 100% 1px no-repeat; }
.rounds a { position: relative; padding: 11.4rem 1px 0.2rem; container-type: inline-size; color: inherit; text-decoration: none; }
.rounds .map-icon { width: 100%; max-width: 1.75rem; height: auto; aspect-ratio: 1; margin: 0 auto; }
.rounds a:hover, .rounds a:focus-visible { background: rgb(238 242 246 / 0.1); }
.rounds a:focus-visible { outline-offset: -2px; }
/* The number stands past the end of the bar, so it also fits on the shortest ones. */
.bar { position: absolute; inset-inline: min(12%, 4px); height: calc(var(--size) * 4.5rem); min-height: 3px; display: flex; justify-content: center; font: 700 0.9375rem/1rem var(--display); white-space: nowrap; }
.won .bar { bottom: calc(100% - 5.5rem); background: var(--win); border-radius: 2px 2px 0 0; }
.lost .bar { top: 5.5rem; background: var(--loss); border-radius: 0 0 2px 2px; }
.bar span { position: absolute; }
.won .bar span { bottom: 100%; }
.lost .bar span { top: 100%; }
.bar span { text-align: center; transform-origin: 50% 100%; }
.lost .bar span { transform-origin: 50% 0; }
.rounds:has(a:hover) a:not(:hover) .bar span { opacity: 0.35; }
.rounds a:is(:hover, :focus-visible) .bar span { transform: scale(1.6); z-index: 1; }
/* Rounds won and lost: above each other, or side by side where the bars are wide. */
.score { display: flex; flex-direction: column; align-items: center; margin-top: 0.25rem; font: 700 0.9375rem/1.1 var(--display); }
.score span:first-child { color: var(--win); }
.score span:last-child { color: var(--loss); }
@container (min-width: 2.75rem) {
  .score { flex-direction: row; justify-content: center; gap: 0.4rem; font-size: 1.0625rem; }
}
.number { transform-origin: 0 50%; }
.number:hover { transform: scale(1.08); }
.totals div:hover dd { transform: translateY(-3px); color: var(--sand); }
@media (prefers-reduced-motion: no-preference) {
  .bar { animation: grow var(--grow) cubic-bezier(0.2, 0.8, 0.3, 1) var(--delay) backwards; }
  .bar span, .number, .totals dd { transition: transform 0.25s cubic-bezier(0.3, 1.8, 0.5, 1), opacity 0.15s, color 0.15s; }
}
@keyframes grow { from { height: 0; } }
.caption { min-height: 1.45em; margin-top: 0.6rem; font-size: 0.9375rem; color: var(--quiet); }

table { width: 100%; margin-top: 0.5rem; border-collapse: collapse; }
th, td { padding: 0.45rem 0.5rem; text-align: right; white-space: nowrap; }
th { font-size: 0.875rem; font-weight: 400; color: var(--quiet); }
td { border-top: 1px solid var(--line); }
.left { text-align: left; }
.map { display: inline-flex; align-items: center; gap: 0.6rem; vertical-align: middle; }
.map-cell { display: flex; align-items: center; gap: 0.25rem 0.75rem; }
.matches .map { min-width: 7.75rem; }
.maps .map { min-width: 9.5rem; }
/* Above the link that covers the row. */
.friends { position: relative; z-index: 1; display: flex; gap: 0.35rem; }
.friends a { display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; color: var(--quiet); text-decoration: none; }
.friends img, .friends span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); object-fit: cover; }
.friends a:hover img { outline: 2px solid var(--sand); }
.times { color: var(--quiet); }
.map-icon { display: block; flex: none; width: 28px; height: 28px; }
.kda { display: inline-grid; grid-template-columns: 1.4rem auto 1.4rem auto 1.4rem; column-gap: 0.4rem; text-align: center; }
.kda i { font-style: normal; color: var(--quiet); opacity: 0.6; }
.win-rate { display: inline-grid; grid-template-columns: 8rem 2.75rem; align-items: center; gap: 0.6rem; }
/* The whole row opens the match. */
.matches tbody tr { position: relative; }
.matches tbody tr:hover { background: var(--raised); }
.result { text-decoration: none; }
.result::after { content: ''; position: absolute; inset: 0; }
.result b { display: inline-block; width: 2.9em; margin-right: 0.35rem; padding: 0.1rem 0; border-radius: 3px; text-align: center; font-size: 0.875rem; color: var(--ink); }
.result.won b { background: var(--win); }
.result.lost b { background: var(--loss); }

/* One match, over the page. */
html { scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }
.match { width: min(68rem, 100vw - 2rem); max-width: none; max-height: min(56rem, 100dvh - 2rem); padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--ground); color: inherit; box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 0.5); overflow: hidden; }
.match[open] { display: flex; flex-direction: column; }
.match::backdrop { background: rgb(10 14 20 / 0.75); }
.match-top { display: flex; align-items: center; gap: 1rem; padding: 0.5rem 0.5rem 0.5rem 1.25rem; border-bottom: 1px solid var(--line); font-size: 0.9375rem; color: var(--quiet); }
.match-top a:hover { color: var(--text); }
.info { flex: 1; min-width: 0; }
.close { width: 2.5rem; height: 2.5rem; margin: 0; padding: 0; background: none; color: var(--quiet); font-size: 1.75rem; font-weight: 400; line-height: 1; }
.close:hover { background: var(--raised); color: var(--text); }
.close:focus-visible { outline-offset: -2px; }
.content { display: flex; flex-direction: column; gap: 1.5rem; min-height: 12rem; padding: 1.25rem; overflow-y: auto; }
.content > [role='status'] { margin: auto; color: var(--quiet); }
.outcome { display: flex; align-items: center; gap: 0.9rem; }
.outcome .map-icon { width: 3rem; height: 3rem; }
.outcome > div { flex: 1; min-width: 0; }
.outcome h2 { font: 900 2rem/1 var(--display); }
.outcome div p, .average { color: var(--quiet); font-size: 0.9375rem; }
.final { font: 900 3rem/1 var(--display); white-space: nowrap; }
.final b { margin-right: 0.15em; }
.outcome.won b { color: var(--win); }
.outcome.lost b { color: var(--loss); }
.average { margin-left: 0.75rem; font-weight: 400; }
.scoreboard { table-layout: auto; }
.scoreboard .left { width: 100%; max-width: 0; }
.scoreboard abbr { text-decoration: none; cursor: help; }
.scoreboard tr:has(.friend) { background: rgb(84 160 230 / 0.2); }
.scoreboard tr:has(.shown) { background: rgb(233 183 101 / 0.16); }
.scorer { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.scorer img { flex: none; }
.scorer:hover .nickname { text-decoration: underline; }
.shown .nickname { font-weight: 700; color: var(--sand); }
.nickname { overflow: hidden; text-overflow: ellipsis; }
.face { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 4px; background: var(--line); object-fit: cover; }
@media (prefers-reduced-motion: no-preference) {
  .match[open] { animation: appear 0.18s ease-out; }
}
@keyframes appear { from { opacity: 0; transform: translateY(12px); } }

footer { font-size: 0.875rem; color: var(--quiet); text-align: center; text-wrap: balance; }

@media (max-width: 60rem) {
  .extra { display: none; }
  .change { flex-basis: 100%; }
  .level { margin-right: 0; }
}
@media (max-width: 50rem) {
  .share { display: none; }
  .win-rate { display: inline; }
  .rounds { grid-auto-columns: minmax(24px, 1fr); }
  .rounds a { padding-bottom: 0.6rem; }
}
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .wide { display: none; }
  .kda { grid-template-columns: 1.1rem auto 1.1rem auto 1.1rem; column-gap: 0.1rem; }
  .result b { width: 2.5em; margin-right: 0.15rem; }
  th, td { padding-inline: 0.2rem; }
  .matches td { font-size: 0.9375rem; }
  .map { gap: 0.35rem; }
  .map-cell { flex-direction: column; align-items: start; }
  .matches .map, .maps .map { min-width: 0; }
  .friends:empty { display: none; }
  .friends img, .friends span { width: 22px; height: 22px; }
  .map .map-icon { width: 22px; height: 22px; }
  .match { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
  .match-top { padding-left: 0.75rem; font-size: 0.875rem; }
  .content { padding: 1rem 0.75rem; }
  .outcome .map-icon { width: 2.5rem; height: 2.5rem; }
  .outcome h2 { font-size: 1.625rem; }
  .outcome div p { font-size: 0.875rem; }
  .final { font-size: 2.25rem; }
  .average { display: block; margin: 0; }
  .scorer { gap: 0.4rem; }
  .level { flex-basis: 100%; min-height: 0; }
  .level > div { flex: 1; }
  .totals { grid-template-columns: repeat(3, 1fr); }
  .totals dd { font-size: 2.125rem; }
}

/* The smallest phones have less room for tables. */
@media (max-width: 23rem) {
  body { padding-inline: 0.75rem; }
  .matches .map-icon { display: none; }
}
