:root {
  color-scheme: dark;
  --bg: rgba(3, 10, 24, 0.36);
  --panel: rgba(6, 18, 38, 0.34);
  --line: rgba(110, 172, 255, 0.12);
  --text: #f7f7fb;
  --muted: #a8bdd8;
  --accent: #2f7dff;
  --accent-2: #65d8ff;
  --warning: #f7bf4f;
  --bad: #ff6674;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.rank-card {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  min-height: 176px;
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(47, 125, 255, 0.12), transparent 36%),
    linear-gradient(290deg, rgba(101, 216, 255, 0.07), transparent 42%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 54px rgba(0, 0, 0, 0.18), 0 0 34px rgba(47, 125, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px) saturate(1.25);
}

.rank-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 4px solid var(--accent);
  pointer-events: none;
}

.rank-card::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 16px;
  width: 86px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65));
}

.scanline {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background: repeating-linear-gradient(180deg, transparent 0, transparent 7px, rgba(255, 255, 255, 0.35) 8px);
  mix-blend-mode: overlay;
  pointer-events: none;
}

.rank-media {
  position: relative;
  width: 128px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.rank-orbit {
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.04), rgba(47, 125, 255, 0.08) 58%, transparent 60%);
  animation: pulse 2.8s ease-in-out infinite;
}

.rank-icon {
  position: relative;
  width: 104px;
  height: 104px;
  object-fit: contain;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.46)) drop-shadow(0 0 18px rgba(101, 216, 255, 0.22));
}

.rank-fallback {
  position: relative;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  font-size: 54px;
  font-weight: 900;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(47, 125, 255, 0.46), rgba(101, 216, 255, 0.18));
}

.rank-copy {
  min-width: 0;
  position: relative;
}

.player-row,
.stats {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player {
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

.state-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 18px currentColor;
}

.state-dot.online {
  background: var(--accent-2);
}

.state-dot.stale {
  background: var(--warning);
}

.state-dot.offline {
  background: var(--bad);
}

h1 {
  margin: 4px 0 14px;
  max-width: 100%;
  font-size: clamp(34px, 7vw, 58px);
  line-height: 0.94;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  text-shadow: 0 10px 32px rgba(0, 0, 0, 0.34);
}

.meter {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 480ms ease;
}

.stats {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  flex-wrap: wrap;
}

.stats strong {
  color: var(--text);
  font-size: 18px;
}

.positive {
  color: var(--accent-2);
}

.negative {
  color: var(--bad);
}

.rank-change {
  animation: rankPop 900ms ease;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.74;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes rankPop {
  0% {
    transform: scale(1);
  }

  34% {
    transform: scale(1.035);
  }

  100% {
    transform: scale(1);
  }
}

@media (max-width: 560px) {
  .overlay {
    padding: 16px;
  }

  .rank-card {
    grid-template-columns: 96px minmax(0, 1fr);
    min-height: 132px;
    gap: 14px;
    padding: 16px 18px;
  }

  .rank-media {
    width: 88px;
  }

  .rank-icon,
  .rank-fallback {
    width: 74px;
    height: 74px;
  }

  .rank-fallback {
    font-size: 40px;
  }

  h1 {
    font-size: 34px;
  }
}
