/* Arcade leaderboard — matches EndOfGame / score screen: #120820, HUD, accent panels */

.root {
  --arcade-accent: #d946ef;
  --arcade-highlight: #f0abfc;

  position: relative;
  display: flex;
  flex-direction: column;
  /* Fill the viewport like SongSelectScreen; avoid negative margins that cause overflow */
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 1rem clamp(1rem, 3vw, 2.5rem) 0;
  overflow: hidden;
  box-sizing: border-box;
  color: #ffffff;
  background-color: #120820;
}

.root::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 90% 70% at 50% 20%,
    rgb(0 0 0 / 0.15) 0%,
    transparent 50%
  );
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgb(0 0 0 / 0.07) 2px,
    rgb(0 0 0 / 0.07) 4px
  );
  opacity: 0.35;
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hudCorner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--arcade-highlight);
  border-style: solid;
  border-width: 0;
  opacity: 0.65;
}

.hudCornerTl {
  top: 16px;
  left: 16px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.hudCornerTr {
  top: 16px;
  right: 16px;
  border-top-width: 2px;
  border-right-width: 2px;
}

.hudCornerBl {
  bottom: 16px;
  left: 16px;
  border-bottom-width: 2px;
  border-left-width: 2px;
}

.hudCornerBr {
  bottom: 16px;
  right: 16px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.hudCounter {
  position: absolute;
  top: 20px;
  right: 44px;
  font-size: 14px;
  letter-spacing: 0.22em;
  opacity: 0.9;
  color: #ffffff;
}

.hudMeta {
  position: absolute;
  bottom: 16px;
  font-size: 13px;
  letter-spacing: 0.2em;
  opacity: 0.85;
  color: #ffffff;
}

.hudMetaLeft {
  composes: hudMeta;
  left: 22px;
}

.hudMetaRight {
  composes: hudMeta;
  right: 22px;
}

.shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 0 0 1.25rem;
  box-sizing: border-box;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}

.headerBlock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
  flex-shrink: 0;
}

.discoBall {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.95) 0%, transparent 42%),
    conic-gradient(
      from 210deg,
      #8b9cb0,
      #d8e0ea,
      #5a6b7e,
      #a8b8c8,
      #6a7a8e,
      #c5d0dc,
      #8b9cb0
    );
  box-shadow:
    0 0 20px rgb(240 171 252 / 0.5),
    0 0 36px rgb(217 70 239 / 0.25),
    inset 0 -6px 12px rgb(0 0 0 / 0.35);
  border: 1px solid rgb(255 255 255 / 0.35);
  animation: discoBallSpin 18s linear infinite;
}

@keyframes discoBallSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .discoBall {
    animation: none;
  }
}

.screenTitle {
  margin: 0;
  text-align: center;
  letter-spacing: 0.32em;
  font-size: var(--font-size-title);
  color: #ffffff;
  text-shadow: 0 0 24px rgb(255 255 255 / 0.25);
}

.subtitle {
  margin: 0;
  letter-spacing: 0.22em;
  color: rgb(255 255 255 / 0.5);
}

.body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.listPanel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border: 1px solid;
  box-sizing: border-box;
  border-radius: 0;
}

.centerMsg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.spinner {
  width: 2.75rem;
  height: 2.75rem;
  border: 3px solid rgb(240 171 252 / 0.25);
  border-top-color: var(--arcade-highlight);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  box-shadow: 0 0 16px rgb(217 70 239 / 0.35);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.msg {
  margin: 0;
  font-size: var(--font-size-body);
  color: rgb(255 255 255 / 0.72);
  text-align: center;
}

.msgError {
  color: #fda4af;
  letter-spacing: 0.06em;
}

.listHead {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.65rem 0.85rem;
  padding: 0 0.15rem 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgb(255 255 255 / 0.12);
}

.colRank {
  min-width: 2.35rem;
  text-align: center;
  color: rgb(255 255 255 / 0.45);
}

.colName {
  color: rgb(255 255 255 / 0.45);
}

.colScore {
  text-align: right;
  color: rgb(255 255 255 / 0.45);
  justify-self: end;
}

.colGrade {
  min-width: 1.75rem;
  text-align: center;
  color: rgb(255 255 255 / 0.45);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.65rem 0.85rem;
  padding: 0.75rem 0.65rem;
  margin-bottom: 0.5rem;
  border-radius: 0.35rem;
  background: rgb(0 0 0 / 0.38);
  border: 2px solid rgb(255 255 255 / 0.18);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 2px 8px rgb(0 0 0 / 0.35);
}

.rowHighlighted {
  background: rgb(217 70 239 / 0.14);
  border-color: var(--arcade-highlight);
  border-left: 4px solid var(--arcade-highlight);
  padding-left: calc(0.65rem - 2px);
  box-shadow:
    inset 0 0 20px rgb(240 171 252 / 0.08),
    0 0 20px rgb(217 70 239 / 0.2);
}

.rankWrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
}

.rankNum {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-black);
  font-size: var(--font-size-body);
  color: rgb(255 255 255 / 0.4);
}

.rankBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border-radius: 0.35rem;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-black);
  font-size: var(--font-size-caption);
}

.rankGold {
  color: #120820;
  background: linear-gradient(145deg, #fff4a8, #ffd700 45%, #b8860b);
  box-shadow: 0 0 14px rgb(255 215 0 / 0.5);
}

.rankSilver {
  color: #120820;
  background: linear-gradient(145deg, #f5f5f5, #c0c0c0 50%, #787878);
  box-shadow: 0 0 12px rgb(192 192 192 / 0.4);
}

.rankBronze {
  color: #120820;
  background: linear-gradient(145deg, #f0a868, #cd7f32 50%, #6b3f14);
  box-shadow: 0 0 12px rgb(205 127 50 / 0.4);
}

.username {
  margin: 0;
  font-size: clamp(0.95rem, 2.8vw, var(--font-size-title));
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usernameTop {
  text-shadow: 0 0 14px rgb(255 215 0 / 0.55);
}

.score {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-black);
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 0 12px var(--arcade-highlight),
    0 0 28px rgb(240 171 252 / 0.45),
    0 0 48px rgb(217 70 239 / 0.25);
  filter: drop-shadow(0 0 8px rgb(217 70 239 / 0.35));
  justify-self: end;
}

.gradeMini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.35rem;
  border-radius: 0.35rem;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-black);
  font-size: 0.7rem;
  line-height: 1;
  border: 2px solid currentColor;
}

.gradeMini[data-grade='S'] {
  color: #ffd700;
  background: rgb(255 215 0 / 0.12);
  box-shadow: 0 0 10px rgb(255 215 0 / 0.4);
}

.gradeMini[data-grade='A'] {
  color: #86efac;
  background: rgb(134 239 172 / 0.1);
  box-shadow: 0 0 10px rgb(134 239 172 / 0.32);
}

.gradeMini[data-grade='B'] {
  color: #e9d5ff;
  background: rgb(233 213 255 / 0.12);
  box-shadow: 0 0 10px rgb(233 213 255 / 0.28);
}

.gradeMini[data-grade='C'] {
  color: #fde047;
  background: rgb(253 224 71 / 0.1);
}

.gradeMini[data-grade='D'] {
  color: #fb923c;
  background: rgb(251 146 60 / 0.1);
}

.gradeMini[data-grade='F'] {
  color: #fb7185;
  background: rgb(251 113 133 / 0.1);
}

.gradeMini[data-grade='other'] {
  color: #d4d4d8;
  background: rgb(212 212 216 / 0.1);
}

.footer {
  flex-shrink: 0;
  padding-top: 0.5rem;
}

.playAgain {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  display: block;
  border: 0;
  padding: 14px 28px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.2s ease;
}

.playAgain:hover {
  filter: brightness(1.08);
}

.playAgain:active {
  transform: scale(0.99);
}

.creditsLink {
  display: block;
  margin: 0.75rem auto 0;
  background: none;
  border: none;
  padding: 0.4rem;
  letter-spacing: 0.22em;
  color: rgb(255 255 255 / 0.38);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.creditsLink:hover {
  color: rgb(255 255 255 / 0.65);
}

@media (max-width: 720px) {
  .hudCounter,
  .hudMetaLeft,
  .hudMetaRight {
    font-size: 11px;
  }

  .listHead {
    gap: 0.45rem 0.5rem;
  }
}

@media (min-width: 640px) {
  .row {
    gap: 1rem 1.25rem;
    padding: 0.85rem 0.85rem;
  }
}
