:root {
  --bg: #0b0c10;
  --card: #111218;
  --muted: #9aa3b2;
  --fg: #e6e9ef;
  --acc: #6ea8fe;
  --border: #1b1e27;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.2px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #18202e;
  color: #bcd2ff;
  font-size: 12px;
  border: 1px solid #24304a;
}
nav {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.tab {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #10131b;
  color: #cbd4e1;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.tab:hover {
  border-color: #2a2f3a;
}
.tab[aria-current="page"] {
  background: #18202e;
  color: #dbe7ff;
  border-color: #24304a;
}
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0;
}
.card > .controls:first-child {
  margin-top: 0;
}
.controls-chart {
  justify-content: space-between;
  gap: 16px;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rolling-inline {
  flex: 1;
  justify-content: flex-end;
}
button,
input[type="date"],
input[type="number"],
select {
  background: #1a1c23;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 36px;
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
}
button:hover,
select:hover,
input[type="date"]:hover {
  border-color: #2a2f3a;
}
input[type="number"] {
  width: 80px;
  cursor: text;
}
select {
  min-width: 140px;
}
input[type="range"] {
  accent-color: var(--acc);
}
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
main .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.card-title {
  font-weight: 600;
  font-size: 15px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 18px;
}
th.sortable::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--muted);
}
th.sortable[data-sort-dir="asc"]::after {
  content: '▲';
}
th.sortable[data-sort-dir="desc"]::after {
  content: '▼';
}
.rank {
  width: 56px;
  text-align: right;
  color: var(--muted);
}
.score {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.username {
  font-weight: 600;
}
.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.err {
  color: #ffb4b4;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f1117;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.legend-item:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.legend-item.is-highlighted {
  border-color: var(--acc);
  background: rgba(110, 168, 254, 0.12);
  color: var(--fg);
}
.legend-item.is-disabled {
  opacity: 0.45;
  color: var(--muted);
  filter: grayscale(0.2);
}
.legend-item.is-disabled .swatch {
  opacity: 0.6;
}
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.chart-wrap {
  overflow: auto;
  padding: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(11, 12, 16, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--fg);
  font-size: 12px;
  min-width: 150px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 2;
  left: 0;
  top: 0;
}
.chart-tooltip.visible {
  opacity: 1;
}
.chart-tooltip .tooltip-date {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 12px;
}
.chart-tooltip .tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
}
.chart-tooltip .tooltip-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-tooltip .tooltip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.chart-tooltip .tooltip-value {
  font-variant-numeric: tabular-nums;
}
.chart-tooltip .tooltip-empty {
  color: var(--muted);
  font-style: italic;
}
svg {
  width: 100%;
  height: 320px;
  display: block;
}
.chart-series .base-line,
.chart-series .rolling-line {
  transition: stroke-width 0.15s ease;
}
.chart-series.is-highlighted .base-line {
  stroke-width: 4px;
}
.chart-series.is-highlighted .rolling-line {
  stroke-width: 3px;
}
.chart-series .points circle {
  transition: r 0.15s ease, stroke-width 0.15s ease;
}
.chart-series.is-highlighted .points circle {
  r: 5px;
  stroke-width: 1;
}
.inspector-line {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1;
  pointer-events: none;
}
.inspector-dot {
  pointer-events: none;
  stroke: #05060a;
  stroke-width: 1.4;
}
.axis text {
  fill: var(--muted);
  font-size: 10px;
}
.axis .tick line {
  stroke: #2a2f3a;
}
.grid-lines line {
  stroke: #1d2130;
}
footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  background: #0f1117;
  border: 1px solid #1d2130;
  border-bottom-color: #171b28;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: #c6cbd3;
}
.link {
  color: #bcd2ff;
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}
.label-muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.muted-text {
  color: var(--muted);
  font-size: 12px;
}
.chart-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.grid {
  margin-top: 16px;
}

.podium {
  margin: 16px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: visible;
  isolation: isolate;
}

.podium-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  position: relative;
  z-index: 1;
}

.podium-searchlights {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.podium-beam {
  position: absolute;
  bottom: 40px;
  left: 50%;
  width: 0;
  height: 0;
  transform-origin: 50% 100%;
  opacity: 0.85;
  transform: translateX(-50%) rotate(0deg);
}

.podium-beam::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 90px solid transparent;
  border-right: 90px solid transparent;
  border-top: 720px solid rgba(255, 239, 205, 0.15);
  filter: blur(5px);
  mix-blend-mode: screen;
}

.podium-beam--left {
  left: 45%;
  animation: podium-beam-left 18s ease-in-out infinite alternate;
}

.podium-beam--right {
  left: 55%;
  animation: podium-beam-right 26s ease-in-out infinite alternate;
}

.podium-haze {
  position: absolute;
  inset: -20% 5% 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 253, 236, 0.15), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0.8;
}

.podium-slot {
  --podium-color: #4b5569;
  --name-glow: 0.45;
  --glow-strength: 0.4;
  --beam-strength: 0.35;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  position: relative;
}

.podium-card {
  width: 100%;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 22px 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 150px;
  background-image:
    linear-gradient(145deg, var(--podium-color), rgba(6, 7, 12, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -20px 30px rgba(0, 0, 0, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.podium-card::before {
  content: '';
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 70%);
  opacity: 0.75;
  pointer-events: none;
  animation: podium-shimmer 9s linear infinite;
}

.podium-card::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.2;
  pointer-events: none;
}

.podium-first .podium-card {
  min-height: 210px;
}

.podium-second .podium-card {
  min-height: 180px;
}

.podium-third .podium-card {
  min-height: 160px;
}

.podium-rank {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.podium-user {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  position: relative;
  z-index: 2;
}

.podium-score {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.podium-date {
  font-size: 13px;
  color: var(--muted);
}

.podium-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.podium-empty {
  padding: 36px 16px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.podium-slot.is-empty .podium-card {
  background-image: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.55));
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.podium-slot.is-empty .podium-user,
.podium-slot.is-empty .podium-score {
  color: var(--muted);
}

@media (max-width: 720px) {
  .podium-stage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .podium-card {
    padding: 18px 12px 20px;
  }
}

@media (max-width: 540px) {
  .podium-stage {
    grid-template-columns: 1fr;
  }
}

@keyframes podium-beam-left {
  0% {
    transform: translateX(-56%) rotate(-18deg) scaleY(0.85);
    opacity: 0.5;
  }
  35% {
    transform: translateX(-50%) rotate(-6deg) scaleY(1);
    opacity: 0.9;
  }
  70% {
    transform: translateX(-58%) rotate(-42deg) scaleY(0.95);
    opacity: 0.65;
  }
  100% {
    transform: translateX(-52%) rotate(-4deg) scaleY(1.05);
    opacity: 0.85;
  }
}

@keyframes podium-beam-right {
  0% {
    transform: translateX(-44%) rotate(24deg) scaleY(0.9);
    opacity: 0.55;
  }
  30% {
    transform: translateX(-48%) rotate(4deg) scaleY(1.05);
    opacity: 0.95;
  }
  65% {
    transform: translateX(-42%) rotate(36deg) scaleY(0.92);
    opacity: 0.7;
  }
  100% {
    transform: translateX(-46%) rotate(2deg) scaleY(1.08);
    opacity: 0.88;
  }
}
