:root {
  color-scheme: dark;
  --background: #080808;
  --panel: #111;
  --raised: #181818;
  --border: #303030;
  --text: #f2f2f2;
  --muted: #adadad;
  --white: #f4f4f4;
  --black: #0a0a0a;
  --sans: Inter, system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, monospace;
  --card-art: none;
  --feedback-duration: 150ms;
  --reveal-duration: 120ms;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 70% 0%, #202020 0%, transparent 52%) 0 0 / 100% 660px no-repeat,
    var(--background);
  font: 1rem/1.5 var(--sans);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, #80808035 1px, transparent 1.5px);
  background-size: 24px 24px;
  mask-image: linear-gradient(#000, transparent 88%);
}

body { isolation: isolate; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:is(a, button, input, select, canvas, .table-shell):focus-visible {
  outline: 2px solid #939393;
  outline-offset: -2px;
}
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.wordmark { display: inline-flex; gap: 11px; align-items: center; margin-right: auto; text-decoration: none; font-weight: 700; }
.wordmark img { display: block; border-radius: 5px; }
.header-links { display: flex; gap: 8px; }
.lang-button { cursor: pointer; }

.header-link, .lang-button, .profile-actions a, .profile-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}

.header-link:hover, .lang-button:hover, .profile-actions a:hover, .profile-actions button:hover { background: var(--raised); }

.hero {
  text-align: center;
  padding-block: clamp(52px, 8vw, 110px) 52px;
}

h1, h2, p, figure { margin: 0; }
h1 { font-size: clamp(2.4rem, 5vw, 4.65rem); font-weight: 800; line-height: 1.02; letter-spacing: -.075em; }
h2 { font-size: clamp(1.2rem, 2.5vw, 1.7rem); font-weight: 700; letter-spacing: -.04em; }
.hero-copy { max-width: 530px; color: var(--muted); margin: 18px auto 24px; }

.search-panel { display: flex; align-items: center; max-width: 510px; min-height: 52px; margin-inline: auto; padding: 4px 4px 4px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }
.search-panel:focus-within { border-color: #666; }
.at-symbol { color: var(--muted); font-family: var(--mono); }
.search-panel input { flex: 1; min-width: 0; padding: 6px 9px; border: 0; background: transparent; color: var(--text); }
.search-panel input:focus { outline: none; }
.search-panel button { align-self: stretch; padding: 0 16px; border: 0; border-radius: 4px; background: var(--white); color: var(--black); font-weight: 700; }
.search-panel button:hover { background: #d6d6d6; }
.hint { min-height: 1.5em; margin-top: 7px; color: var(--muted); font-size: .875rem; }
.hint:empty { display: none; }

.refresh-status {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  max-width: 100%;
  margin-top: 20px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  color: var(--muted);
  font: .875rem/1.45 var(--mono);
}
.refresh-status span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.refresh-status span:first-child::before {
  content: '';
  flex: 0 0 6px;
  height: 6px;
  border-radius: 50%;
  background: #888;
}
.refresh-status span + span { border-inline-start: 1px solid #464646; padding-inline-start: 12px; }

@media (max-width: 680px) {
  .refresh-status { display: grid; justify-items: center; border-radius: 12px; }
  .refresh-status span + span { border: 0; padding-inline-start: 0; }
}

.scan-result { max-width: 720px; margin-block: 0 46px; }
.result-card { position: relative; isolation: isolate; overflow: hidden; border: 1px solid #414141; border-radius: 12px; background: linear-gradient(150deg, #151515, #080808); }
.result-card::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, #0a0a0a 0%, #0a0a0ab3 30%, #0a0a0a1a 75%),
    linear-gradient(0deg, #080808 0%, transparent 55%),
    var(--card-art) right top / auto 100% no-repeat;
}

.profile .result-card::before {
  background:
    linear-gradient(90deg, #0a0a0a 0%, #0a0a0ab3 30%, #0a0a0a1a 75%),
    linear-gradient(0deg, #080808 0%, transparent 36%),
    var(--card-art) center 30% / auto 90% no-repeat #080808;
}

.card-cover { display: flex; padding: 16px 22px 0; }
.card-brand { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid #3d3d3d; border-radius: 4px; color: var(--white); background: #090909; font: .875rem/1.4 var(--mono); }
.card-brand img { border-radius: 2px; }
.card-content { padding: 24px 22px 22px; }
.result-card .profile-top { flex-wrap: nowrap; margin-bottom: 16px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.card-actions a, .card-actions button { flex: 0 0 auto; min-height: 36px; padding: 6px 12px; }
.score-line { margin-top: 14px; color: var(--text); font: 700 clamp(1.125rem, 2.5vw, 1.25rem)/1.2 var(--sans); font-variant-numeric: tabular-nums; }
.card-actions .primary-action { color: var(--black); background: var(--white); border-color: var(--white); }
.card-actions .primary-action:hover { color: var(--black); background: #d6d6d6; }
.activity-chart { margin-top: 16px; }
.activity-chart canvas { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; background: #0808086e; }
.activity-dates { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; color: var(--muted); font: .8125rem/1.5 var(--mono); }
.chart-plot { position: relative; border-radius: 6px; }
.chart-readout {
  position: absolute;
  inset: 8px 8px auto auto;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #0c0c0c;
  color: var(--text);
  font-size: .875rem;
  pointer-events: none;
}
.chart-readout:empty { display: none; }
.card-result-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.card-result-metrics article { min-width: 0; padding: 12px 15px; border: 1px solid #ffffff32; border-radius: 8px; background: #0808085c; }
.card-result-metrics span { display: block; color: var(--muted); font: .75rem/1.3 var(--mono); overflow-wrap: anywhere; }
.card-result-metrics strong { display: block; margin-top: 6px; font: 700 clamp(1.1rem, 4.4vw, 2rem)/1.15 var(--sans); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.profile-details { margin-block: 26px 0; }
.profile-details h3 { margin: 0 0 12px; }
.profile-details .mention-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border: 0;
  background: transparent;
}
.mention-grid article { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.mention-grid article:last-child { border-inline-end: 1px solid var(--border); }
.mention-grid span { color: var(--text); font-weight: 600; }
.mention-grid p { margin-top: 5px; color: var(--muted); font-size: .875rem; }
.top-posts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.post-card { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); overflow-wrap: anywhere; }
.post-card > p {
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
}
.post-link { text-decoration: none; }
.post-link:is(:hover, :focus-visible, :active) { border-color: #727272; background: #222; }
.post-metadata { display: flex; gap: 8px 16px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: .875rem; }

.summary-heading { margin-bottom: 14px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }

.stats, .profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.stats article, .profile-grid article { padding: 16px 20px 19px; border-inline-end: 1px solid var(--border); }
.stats article:last-child, .profile-grid article:last-child { border-inline-end: 0; }
.stats span, .profile-grid span { display: block; color: var(--muted); font-size: .875rem; }
.stats strong, .profile-grid strong { display: block; margin-top: 6px; font: 700 clamp(1.45rem, 4vw, 2.2rem)/1.2 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.05em; }

.definition { margin-top: 14px; padding: 18px 22px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.definition h2 { font-size: 1.0625rem; letter-spacing: 0; }
.definition p { margin-top: 6px; color: var(--muted); }
.definition strong { color: var(--text); }
.definition code {
  padding: .1em .35em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--raised);
  color: var(--text);
  font: .875em var(--mono);
  white-space: nowrap;
}

.leaderboard { margin-block: 42px 48px; scroll-margin-top: 16px; }
.table-controls { display: flex; gap: 9px; align-items: center; }
.table-controls input, .sort-tabs {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
}

.table-controls input { width: 175px; padding: 0 9px; color: var(--text); font-size: .875rem; }
input::placeholder { color: #999; }
.sort-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 3px; }
.sort-tabs button { min-height: 34px; padding: 3px 10px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.sort-tabs button:hover { color: var(--white); }
.sort-tabs button[aria-pressed="true"] { background: var(--white); color: var(--black); }
.sort-tabs button[data-sort="overall"][aria-pressed="true"] { background: #252525; color: var(--text); box-shadow: inset 0 0 0 1px #4a4a4a; }
.ranking-method { margin-bottom: 12px; color: var(--muted); font-size: .875rem; }

.table-shell {
  --leaderboard-height: min(620px, 68svh);
  height: var(--leaderboard-height);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #5a5a5a var(--panel);
  scrollbar-width: thin;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.table-shell[data-filtered] { height: auto; max-height: var(--leaderboard-height); scrollbar-gutter: auto; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead { position: sticky; z-index: 1; top: 0; }
th, td { padding: 10px 16px; text-align: right; }
th { background: var(--raised); color: var(--muted); font-size: .875rem; font-weight: 600; }
th:first-child { width: 7%; }
th:nth-child(2) { width: 39%; }
th:first-child, td:first-child { text-align: center; color: var(--muted); }
th:nth-child(2), td:nth-child(2) { text-align: left; }
td:nth-child(n+3) { white-space: nowrap; }
td { border-top: 1px solid var(--border); background: var(--panel); font-size: .875rem; }
tbody tr:hover td { background: var(--raised); }
tr[data-handle] { cursor: pointer; }
tr[data-selected] td { background: #1c1c1c; }
.account-cell { display: inline-flex; max-width: 100%; gap: 10px; align-items: center; color: var(--text); text-decoration: none; }
.account-cell:hover { text-decoration: underline; }
.account-cell:focus-visible { outline-offset: 2px; }
.avatar, .profile-avatar { position: relative; overflow: hidden; display: grid; place-items: center; background: #242424; color: var(--white); font-weight: 700; border: 1px solid #3f3f3f; border-radius: 5px; }
.avatar img, .profile-avatar img, .holder-badge img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar { width: 30px; height: 30px; flex: 0 0 auto; }
.account-handle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holder-badge { position: relative; display: inline-grid; flex: 0 0 auto; place-items: center; width: 18px; height: 18px; border-radius: 3px; overflow: hidden; vertical-align: .1em; color: #3035a1; background: #eee; font: 700 10px/1 var(--sans); }
.profile-identity .holder-badge { width: 22px; height: 22px; }
td.empty-row { text-align: center; }
.table-metric-label { display: none; }

.profile { max-width: 1032px; margin-block: 28px 48px; }
.profile-loading { padding: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--muted); }
.profile-top { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.profile-avatar { width: 54px; height: 54px; flex: 0 0 auto; font-size: 1.5rem; }
.profile-identity { min-width: 0; overflow-wrap: anywhere; }
.profile-identity p, .profile-foot { color: var(--muted); }
.profile-identity p a { color: inherit; text-underline-offset: .16em; }
.profile-identity p a:hover { color: var(--text); }
.account-ranks { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.account-ranks li { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border: 1px solid #444; border-radius: 100px; background: #101010dd; color: var(--muted); font: .875rem/1.3 var(--mono); }
.account-ranks strong { color: var(--text); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--background); }
.profile-foot { margin-top: 15px; font-size: .875rem; }
.profile-return { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: .875rem; }
footer { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); padding-block: 17px 22px; color: var(--muted); font-size: .875rem; }

@media (max-width: 720px) {
  .wrap { width: calc(100% - 32px); }
  .site-header { min-height: 62px; gap: 8px; }
  .site-header { flex-wrap: wrap; padding-block: 10px; }
  .header-links { flex-wrap: wrap; }
  .hero { padding-block: 48px 34px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .table-controls { display: grid; width: 100%; }
  .table-controls input { width: 100%; min-height: 44px; font-size: 1rem; }
  .table-shell { --leaderboard-height: min(520px, 62svh); }
  .sort-tabs button { min-height: 44px; padding-inline: 3px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats article { padding: 12px 14px; }
  .stats article:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .stats article:nth-child(2) { border-inline-end: 0; }
  th, td { padding-inline: 6px; }
  th { overflow-wrap: anywhere; }
  th:first-child { width: 9%; }
  th:nth-child(2) { width: 33%; }
  th.score-column { width: 18%; }
  .account-cell { gap: 5px; }
  .table-shell .account-handle { white-space: normal; overflow-wrap: anywhere; }
  .avatar { width: 22px; height: 22px; }
  .account-cell .holder-badge { width: 15px; height: 15px; }
  .profile-top { flex-wrap: wrap; }
  .profile-actions { width: 100%; margin-left: 0; }
  .profile-details .mention-grid { grid-template-columns: 1fr; }
  .profile-grid article { padding: 12px 14px; }
  .profile-grid strong { font-size: clamp(1.1rem, 5vw, 1.55rem); overflow-wrap: anywhere; }
  .card-result-metrics { gap: 6px; }
  .card-result-metrics article { padding: 9px 8px; }
  .card-cover { padding: 14px 14px 0; }
  .card-content { padding: 14px; }
  .card-actions a, .card-actions button { min-height: 44px; }
  .profile-return { display: inline-flex; align-items: center; min-height: 44px; }
  .activity-chart canvas { min-height: 116px; }
}

@media (max-width: 600px) {
  .table-shell { overscroll-behavior-y: auto; }
  .table-shell table, .table-shell thead, .table-shell tbody { display: block; }
  .table-shell thead { background: var(--raised); }
  .table-shell tr {
    display: grid;
    grid-template-columns: 4ch repeat(3, minmax(0, 1fr));
    align-items: center;
    padding: 10px 12px;
  }
  .table-shell tbody tr { border-top: 1px solid var(--border); background: var(--panel); }
  .table-shell tbody tr:hover { background: var(--raised); }
  .table-shell tr[data-selected] { background: #1c1c1c; }
  .table-shell :is(th, td), .table-shell tbody tr:hover td, .table-shell tr[data-selected] td {
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .table-shell tr > :nth-child(2) { grid-column: span 2; padding-inline-end: 6px; }
  .table-shell .metric-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .table-shell .table-metric { margin-top: 5px; padding-inline-end: 4px; text-align: left; }
  .table-shell .table-metric:nth-child(4) { grid-column: 2; }
  .table-metric-label {
    display: block;
    color: var(--muted);
    font-size: .75rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table-shell .empty-row { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .header-links { flex-basis: 100%; }
  .header-link, .lang-button { min-height: 44px; }
  .hero { padding-top: 38px; }
  .sort-tabs button, th, td { font-size: .8125rem; }
  .result-card::before, .profile .result-card::before {
    background-size: auto, auto, auto 65%;
    background-position: center, center, right top;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .result-card { animation: reveal-panel var(--reveal-duration) ease-out both; }
  button, .profile-actions a, .header-link, .post-link { transition: background-color var(--feedback-duration) ease, border-color var(--feedback-duration) ease, color var(--feedback-duration) ease; }
}

@keyframes reveal-panel {
  from { opacity: 0; }
  to { opacity: 1; }
}
