:root {
  --bg: #070b16;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --gold: #fbbf24;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* The WebGL canvas sits behind all content. Pointer events are disabled
   so it never intercepts clicks meant for the login button. */
#scene,
#scene-fallback {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Shown only if WebGL/Three.js fails to load, so the page still looks
   deliberate rather than broken. */
#scene-fallback {
  display: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(ellipse at 50% 90%, rgba(14, 165, 233, 0.1), transparent 70%);
}

body.no-webgl #scene-fallback {
  display: block;
}

/* A vignette + scanline wash sells the "holographic projection" look and
   keeps text readable over the moving model. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 45%, rgba(7, 11, 22, 0.85) 100%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.018) 0px,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px,
      transparent 3px
    );
}

#landing {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 3rem 1.25rem;
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: 0.02em;
  text-shadow: 0 0 28px rgba(56, 189, 248, 0.45);
}

.tagline {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

#leaderboard-panel {
  width: min(440px, 100%);
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 14px;
  padding: 1.1rem 1.25rem 1.25rem;
}

#leaderboard-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

#leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rank;
}

#leaderboard li {
  display: grid;
  grid-template-columns: 1.5rem 34px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.9rem;
  text-align: left;
}

#leaderboard .avatar-slot {
  display: block;
  width: 34px;
  height: 34px;
}

#leaderboard .avatar {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.18);
}

/* Google profile photos are arbitrary aspect ratios; crop rather than
   squash, and match the generated avatars' rounded square. */
#leaderboard .avatar.photo {
  object-fit: cover;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

#leaderboard .unit {
  display: block;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

#leaderboard .who small {
  display: block;
  line-height: 1.3;
}

#leaderboard li:last-child {
  border-bottom: none;
}

#leaderboard li.empty {
  display: block;
  grid-template-columns: none;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.75rem 0;
}

#leaderboard .rank {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#leaderboard li:nth-child(1) .rank {
  color: var(--gold);
}

#leaderboard .who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leaderboard .who small {
  color: var(--muted);
  font-size: 0.75rem;
}

#leaderboard .score {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}

#login-button {
  display: inline-block;
  padding: 0.85rem 2.75rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
  color: #061019;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  box-shadow: 0 0 34px rgba(56, 189, 248, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 48px rgba(56, 189, 248, 0.6);
}

#login-button .sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.8;
  margin-top: 0.15rem;
}

footer {
  margin-top: 0.5rem;
}

#audio-toggle {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.75rem;
  cursor: pointer;
}

#audio-toggle:hover {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.5);
}

#audio-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.5);
}

/* Respect users who have asked for reduced motion: the model stops
   animating and the glow transitions are removed. */
@media (prefers-reduced-motion: reduce) {
  #login-button {
    transition: none;
  }
}
