:root {
  color-scheme: dark;
  --bg: #080b12;
  --surface: #0e131d;
  --surface-2: #121925;
  --line: #202a38;
  --text: #f5f7fb;
  --muted: #c2c8d2;
  --green: #a78bfa;
  --green-soft: #8b5cf6;
  --purple: #c4b5fd;
  --cyan: #c4b5fd;
  --danger: #ff6b81;
  --radius: 18px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
html {
  max-width: 100%;
  background:
    radial-gradient(circle at 50% -20%, #251d3d 0, transparent 38%), var(--bg);
  scroll-behavior: smooth;
  overflow-x: hidden;
}
body {
  max-width: 100%;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}
.site-header {
  height: 72px;
  display: flex;
  align-items: center;
  max-width: 1440px;
  margin: auto;
  padding: 0 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.brand b {
  color: var(--green);
}
.brand-mark {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 6px;
  border: 1px solid #344052;
  border-radius: 9px;
  background: #121926;
}
.brand-mark i {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: var(--green);
}
.brand-mark i:nth-child(1) {
  height: 8px;
}
.brand-mark i:nth-child(2) {
  height: 16px;
  background: #d8b4fe;
}
.brand-mark i:nth-child(3) {
  height: 12px;
}
main {
  width: min(1368px, calc(100% - 48px));
  margin: auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0 22px;
}
.metric {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--surface), #0b1018);
  padding: 25px 26px;
  min-height: 155px;
}
.metric:after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: transparent;
}
.metric-primary:after,
.metric-accent:after {
  background: linear-gradient(90deg, var(--green), transparent);
}
.metric p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.metric strong {
  display: block;
  font: 750 clamp(25px, 2.7vw, 38px)/1 var(--mono);
  letter-spacing: -0.04em;
}
.metric-primary strong {
  color: var(--green);
}
.metric-accent strong {
  color: var(--text);
}
.metric span {
  display: block;
  color: #aeb7c5;
  font-size: 11px;
  margin-top: 13px;
}
.panel {
  min-width: 0;
  background: linear-gradient(
    145deg,
    rgba(16, 22, 33, 0.96),
    rgba(11, 16, 24, 0.96)
  );
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.chart-panel {
  padding: 28px;
  margin-bottom: 22px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.panel-heading h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.025em;
}
.range-control {
  display: flex;
  padding: 4px;
  background: #090d14;
  border: 1px solid #222d3c;
  border-radius: 10px;
}
.range-control button {
  border: 0;
  background: transparent;
  color: #b1b9c7;
  font: 700 11px var(--mono);
  padding: 8px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.range-control button:hover {
  color: #cbd3de;
}
.range-control button.active {
  color: #0a0e13;
  background: var(--green);
}
.chart-legend {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 11px;
  margin: 24px 0 4px;
}
.chart-legend i {
  display: inline-block;
  width: 16px;
  height: 2px;
  vertical-align: middle;
  margin-right: 7px;
}
.chart-legend .avg {
  background: var(--green);
}
.chart-legend .peak {
  background: #c4b5fd;
}
.chart-wrap {
  position: relative;
  height: 300px;
  margin-top: 8px;
}
.chart-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.chart-grid {
  stroke: #202938;
  stroke-width: 1;
}
.chart-area {
  fill: url(#areaGradient);
}
.chart-line {
  fill: none;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.chart-line.avg {
  stroke: var(--green);
}
.chart-line.peak {
  stroke: #c4b5fd;
}
.chart-dot {
  stroke: var(--surface);
  stroke-width: 2;
}
.chart-label {
  fill: #a3adbd;
  font: 10px var(--mono);
}
.empty-chart {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: #aab3c1;
  font-size: 13px;
  border: 1px dashed #263143;
  border-radius: 12px;
}
.distribution-grid {
  display: block;
  margin-bottom: 22px;
}
.distribution-panel {
  padding: 26px;
}
.distribution {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  align-items: center;
  gap: 42px;
  margin-top: 20px;
  padding: 8px 10px 4px;
}
.dist-pie {
  width: 100%;
  max-width: 300px;
  margin: auto;
}
.dist-pie svg {
  display: block;
  width: 100%;
  overflow: visible;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.24));
}
.dist-pie path {
  stroke: var(--surface);
  stroke-width: 2.5;
  transition:
    opacity 0.15s,
    filter 0.15s;
}
.dist-pie path:hover {
  filter: brightness(1.15);
}
.dist-pie:has(path:hover) path:not(:hover) {
  opacity: 0.55;
}
.dist-pie-center {
  fill: #0d131d;
}
.dist-legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid #202a38;
  border-left: 1px solid #202a38;
}
.dist-legend-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 9px;
  row-gap: 7px;
  padding: 20px 16px;
  border-right: 1px solid #202a38;
  border-bottom: 1px solid #202a38;
}
.dist-legend-item i {
  grid-row: 1 / 4;
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.dist-legend-item span {
  min-width: 0;
  color: var(--muted);
  font: 700 10px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.dist-legend-item strong {
  grid-column: 2;
  color: var(--text);
  font: 750 24px/1 var(--mono);
}
.dist-legend-item small {
  grid-column: 2;
  color: #aeb7c5;
  font: 12px var(--mono);
}
.games-panel {
  padding: 24px;
  margin-bottom: 16px;
}
.games-heading {
  align-items: flex-end;
}
.ranking-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font: 11px/1.5 var(--mono);
}
.change-up {
  color: #c4b5fd !important;
}
.change-down {
  color: #d4a3a3 !important;
}
.change-flat {
  color: #b9c0ca !important;
}
.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.search {
  height: 38px;
  min-width: 250px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #090d14;
  border: 1px solid #252f3d;
  border-radius: 9px;
  color: #aab3c1;
}
.search:focus-within {
  border-color: #7963bb;
}
.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: 12px var(--sans);
}
.search input::placeholder {
  color: #98a2b1;
}
.select-label {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #090d14;
  border: 1px solid #252f3d;
  border-radius: 9px;
  padding: 0 9px;
  color: #aab3c1;
  font-size: 10px;
  text-transform: uppercase;
}
.select-label select {
  border: 0;
  outline: 0;
  background: #090d14;
  color: #cbd3de;
  font: 11px var(--sans);
}
.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #bac1cc;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}
.toggle input {
  position: absolute;
  opacity: 0;
}
.toggle span {
  width: 30px;
  height: 17px;
  border-radius: 10px;
  background: #252e3b;
  position: relative;
  transition: 0.2s;
}
.toggle span:after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  background: #6a7585;
  transition: 0.2s;
}
.toggle input:checked + span {
  background: rgba(167, 139, 250, 0.3);
}
.toggle input:checked + span:after {
  left: 16px;
  background: var(--green);
}
.table-scroll {
  overflow-x: auto;
  margin-top: 25px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}
th {
  padding: 12px 14px;
  border-bottom: 1px solid #27313e;
  color: #a5afbd;
  font: 700 10px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}
th.number,
td.number {
  text-align: right;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(37, 47, 61, 0.65);
  font: 12px var(--mono);
  color: #bdc6d2;
}
tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
tbody tr:hover {
  background: rgba(167, 139, 250, 0.045);
}
tbody tr:last-child td {
  border-bottom: 0;
}
.rank {
  color: #99a3b2;
  width: 48px;
}
.game-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-weight: 650;
  color: #f1f4f8;
}
.game-cell img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  background: #161d28;
}
.game-cell span {
  line-height: 1.3;
}
.ccu {
  color: var(--green) !important;
  font-weight: 700 !important;
}
.peak-value {
  color: #c5cad1 !important;
}
.loading-row {
  text-align: center !important;
  color: var(--muted);
  padding: 70px !important;
  font-family: var(--sans);
}
.loader {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 10px;
  vertical-align: -3px;
  border: 2px solid #313b49;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.load-more {
  display: block;
  margin: 20px auto 0;
  border: 1px solid #303b49;
  background: #111823;
  color: #c4ccd7;
  border-radius: 9px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
}
.load-more:hover {
  border-color: var(--green);
  color: var(--green);
}
footer {
  min-height: 110px;
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 30px 4px;
  color: #a3adba;
  font-size: 11px;
}
footer a {
  color: #c2c8d2;
  text-decoration: none;
}
dialog {
  width: min(920px, calc(100% - 30px));
  max-height: min(820px, calc(100vh - 30px));
  padding: 0;
  border: 1px solid #303b4c;
  border-radius: 20px;
  background: #0d131d;
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
  overflow: auto;
}
dialog::backdrop {
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(6px);
}
.dialog-close {
  position: sticky;
  z-index: 5;
  float: right;
  top: 16px;
  margin: 16px 16px 0 0;
  width: 35px;
  height: 35px;
  border: 1px solid #344052;
  border-radius: 50%;
  background: #111925;
  color: #9aa5b5;
  font-size: 21px;
  cursor: pointer;
}
.detail {
  padding: 34px;
}
.detail-head {
  display: flex;
  align-items: center;
  gap: 17px;
  padding-right: 45px;
}
.detail-head img {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  object-fit: cover;
}
.detail-head h2 {
  font-size: 29px;
  margin: 0 0 7px;
  letter-spacing: -0.04em;
}
.detail-head p {
  color: var(--muted);
  font: 11px var(--mono);
  margin: 0;
}
.detail-head a {
  color: var(--green);
  text-decoration: none;
}
.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 28px 0;
}
.detail-metric {
  background: #090e16;
  border: 1px solid #202b3a;
  border-radius: 12px;
  padding: 16px;
}
.detail-metric span {
  display: block;
  color: #6f7b8d;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.detail-metric strong {
  display: block;
  margin-top: 9px;
  font: 700 20px var(--mono);
}
.detail-chart {
  height: 330px;
  margin-top: 20px;
}
#toast {
  position: fixed;
  z-index: 20;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 25px);
  padding: 11px 16px;
  border: 1px solid #3b4554;
  border-radius: 9px;
  background: #121a26;
  color: #d9dfe7;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
}
#toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
@media (max-width: 1000px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .games-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .table-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .search {
    flex: 1;
  }
  .distribution {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 24px;
  }
  .dist-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .site-header {
    height: 62px;
    padding: 0 16px;
  }
  main {
    width: min(100% - 24px, 1368px);
  }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric {
    padding: 18px 16px;
    min-height: 132px;
  }
  .metric strong {
    font-size: 23px;
  }
  .chart-panel,
  .distribution-panel,
  .games-panel {
    padding: 19px;
  }
  .panel-heading {
    width: 100%;
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
  }
  .range-control {
    width: 100%;
    justify-content: space-between;
  }
  .range-control button {
    flex: 1;
    padding: 8px 4px;
  }
  .chart-wrap {
    height: 240px;
  }
  .distribution {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-inline: 0;
  }
  .dist-pie {
    max-width: 230px;
  }
  .dist-legend {
    grid-template-columns: 1fr 1fr;
  }
  .dist-legend-item {
    padding: 13px 11px;
  }
  .table-actions {
    align-items: flex-start;
  }
  .search {
    width: 100%;
    flex-basis: 100%;
    min-width: 0;
  }
  .select-label {
    flex: 1;
  }
  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 30px 4px;
  }
  .detail {
    padding: 22px;
  }
  .detail-head img {
    width: 56px;
    height: 56px;
  }
  .detail-head h2 {
    font-size: 22px;
  }
  .detail-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .detail-chart {
    height: 250px;
  }
}
