:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090b10;
  color: #f5f7fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(95, 80, 255, 0.16), transparent 36rem),
    #090b10;
}

.stats-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.stats-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #a69cff;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.6rem); }
h2 { margin-bottom: 16px; font-size: 1.05rem; }
.muted, .privacy-note { color: #9ca6b8; }

.range-control {
  display: grid;
  gap: 8px;
  color: #bac3d3;
  font-size: 0.85rem;
}

select {
  min-width: 140px;
  border: 1px solid #30394a;
  border-radius: 10px;
  padding: 10px 12px;
  background: #121722;
  color: inherit;
}

.metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.metric, .panel {
  border: 1px solid #252d3b;
  border-radius: 16px;
  background: rgba(18, 23, 34, 0.9);
}

.metric { padding: 18px; }
.metric span { display: block; color: #9ca6b8; font-size: 0.82rem; }
.metric strong { display: block; margin-top: 7px; font-size: 1.65rem; }

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel { padding: 20px; }
.recent-panel { margin-top: 14px; }

.ranking { display: grid; gap: 10px; }
.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { color: #a69cff; font-variant-numeric: tabular-nums; }
.rank-bar {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #252d3b;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #786cff;
}

.recent { display: grid; gap: 10px; }
.recent-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #252d3b;
}
.recent-row:last-child { border-bottom: 0; }
.recent-time, .recent-meta { color: #9ca6b8; font-size: 0.82rem; }
.recent-error { color: #ff9a9a; }

.empty { color: #9ca6b8; }
.error {
  margin-top: 14px;
  border: 1px solid #7c3434;
  border-radius: 12px;
  padding: 14px;
  background: #321b1b;
  color: #ffd0d0;
}
.privacy-note { margin: 16px 2px 0; font-size: 0.8rem; }

@media (max-width: 760px) {
  .stats-header { align-items: stretch; flex-direction: column; }
  .metrics, .grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recent-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 460px) {
  .stats-shell { width: min(100% - 20px, 1080px); padding-top: 20px; }
  .metrics, .grid-two { grid-template-columns: 1fr; }
}


.stats-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.back-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #30394a;
  border-radius: 10px;
  padding: 9px 14px;
  background: #121722;
  color: #f5f7fb;
  font-weight: 750;
  text-decoration: none;
}
.back-link:hover { border-color: #786cff; background: #1a2030; }

@media (max-width: 760px) {
  .stats-actions { align-items: stretch; flex-direction: column-reverse; }
  .back-link { width: 100%; }
}
