:root {
  --bg: #050507;
  --panel: #0b0b0f;
  --line: #16161c;
  --neon: #5b8cff;
  --neon-2: #9d6bff;
  --text: #e8e8ec;
  --dim: #6b6b78;
  --faint: #34343e;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* faint grid texture, very dark */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center;
}

a { color: var(--text); text-decoration: none; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(5,5,7,.8);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-weight: 700; font-size: .9rem; letter-spacing: 3px;
}
.brand-ball {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--neon), var(--neon-2));
  box-shadow: 0 0 14px var(--neon);
}
.lb-link {
  font-size: .8rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  padding: 10px 22px; border-radius: 7px;
  border: 1px solid transparent;
  background: linear-gradient(110deg, var(--neon), var(--neon-2));
  box-shadow: 0 0 22px rgba(91,140,255,.45);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.lb-link:hover {
  filter: brightness(1.12);
  box-shadow: 0 0 30px rgba(91,140,255,.7);
  transform: translateY(-1px);
}

/* ── LAYOUT ── */
main { max-width: 1100px; margin: 0 auto; padding: 0 28px; }

/* ── HERO ── */
.hero { padding: 90px 0 56px; text-align: center; position: relative; }
.hero::before {
  content: '';
  position: absolute; inset: -40% 0 auto 0; height: 400px;
  background: radial-gradient(ellipse 50% 60% at 50% 30%, rgba(91,140,255,.12), transparent 70%);
  pointer-events: none; z-index: -1;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: .98;
  margin-bottom: 22px;
}
.hero h1 span {
  background: linear-gradient(110deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  max-width: 480px; margin: 0 auto;
  color: var(--dim); font-size: 1rem; line-height: 1.7;
}

/* ── STAGE ── */
.stage { padding-bottom: 60px; }
.frame {
  position: relative; width: 100%; aspect-ratio: 960 / 600;
  border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(91,140,255,.06), 0 30px 80px -30px rgba(0,0,0,.9);
}
.frame::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon), var(--neon-2), transparent);
  z-index: 2;
}
.frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.fs {
  display: block; margin: 14px 0 0 auto;
  background: transparent; color: var(--dim);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 16px; font-family: inherit; font-size: .76rem;
  font-weight: 600; letter-spacing: 1px; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.fs:hover { color: var(--text); border-color: var(--faint); }

/* ── AD ── */
.ad-wrap { max-width: 970px; margin: 0 auto 48px; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.ad-wrap ins { width: 100%; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--line);
  padding: 24px 28px; text-align: center;
  font-size: .72rem; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--faint);
}
footer a { color: var(--dim); }
footer a:hover { color: var(--text); }
footer .sep { margin: 0 10px; color: var(--faint); }

/* ── LEADERBOARD PAGE ── */
.page { max-width: 880px; margin: 0 auto; padding: 56px 28px 80px; }
.page-head { margin-bottom: 32px; }
.page-head h1 {
  font-size: 2.4rem; font-weight: 700; letter-spacing: -1px; margin-bottom: 6px;
}
.page-head p { color: var(--dim); font-size: .9rem; }

.tabs { display: inline-flex; gap: 2px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 7px; padding: 3px; margin-bottom: 24px; }
.tab {
  padding: 7px 18px; font-family: inherit; font-size: .78rem; font-weight: 600;
  letter-spacing: .5px; color: var(--dim); background: transparent;
  border: none; border-radius: 5px; cursor: pointer; transition: all .2s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--neon); color: #050507; box-shadow: 0 0 16px rgba(91,140,255,.35); }

.board { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.board-box { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.board-box h2 {
  font-size: .76rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--dim); padding: 16px 18px; border-bottom: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; }
td { padding: 11px 18px; font-size: .85rem; border-bottom: 1px solid var(--line); color: var(--dim); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(91,140,255,.04); }
.rk { width: 26px; font-weight: 700; font-size: .78rem; color: var(--faint); }
tr:nth-child(1) .rk { color: #f5c451; }
tr:nth-child(2) .rk { color: #c2c8d4; }
tr:nth-child(3) .rk { color: #c98a4b; }
.nm { color: var(--text); font-weight: 500; }
.vl { text-align: right; font-weight: 700; color: var(--neon); white-space: nowrap; }
.vl-r { color: #ff6b6b; }
.empty { padding: 22px 18px; color: var(--faint); font-size: .85rem; }

/* The viewer's own row, highlighted on the deadliest board. */
tr.me td { background: rgba(91,140,255,.10); color: var(--text); }
tr.me .nm { color: var(--neon); font-weight: 700; }
.nm .badge {
  margin-left: 6px; font-size: .6rem; letter-spacing: .5px; text-transform: uppercase;
  color: #4da3ff; border: 1px solid rgba(77,163,255,.4); border-radius: 4px; padding: 1px 5px;
}

.back { display: inline-block; margin-top: 28px; color: var(--dim); font-size: .82rem; letter-spacing: .5px; }
.back:hover { color: var(--text); }

/* ── Rounds (first-to-reach), scrollable ── */
.rounds-scroll { max-height: 460px; overflow-y: auto; }
.rounds-scroll::-webkit-scrollbar { width: 8px; }
.rounds-scroll::-webkit-scrollbar-track { background: transparent; }
.rounds-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.rounds-scroll::-webkit-scrollbar-thumb:hover { background: var(--faint); }

.round-group { border-bottom: 1px solid var(--line); }
.round-group:last-child { border-bottom: none; }
.round-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px 8px;
  font-size: .72rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--neon);
}
.round-label .count { color: var(--faint); font-weight: 500; }
.round-row {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 18px; font-size: .84rem; color: var(--dim);
}
.round-row:hover { background: rgba(91,140,255,.04); }
.round-row .pos { width: 20px; font-weight: 700; font-size: .72rem; color: var(--faint); }
.round-row .first { color: #f5c451; }
.round-row .who { color: var(--text); font-weight: 500; }
.round-row .badge {
  margin-left: auto; font-size: .66rem; letter-spacing: .5px; text-transform: uppercase;
  color: #f5c451; border: 1px solid rgba(245,196,81,.3); border-radius: 4px; padding: 1px 6px;
}

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  .nav { padding: 0 14px; height: 54px; }
  .brand { letter-spacing: 2px; font-size: .78rem; }
  .brand-ball { width: 13px; height: 13px; }
  .lb-link { padding: 6px 11px; font-size: .68rem; letter-spacing: 1px; }
  main, .page { padding-left: 14px; padding-right: 14px; }

  .hero { padding: 40px 0 30px; }
  .hero h1 { margin-bottom: 16px; }
  .hero p { font-size: .92rem; }

  /* The game is landscape; on a portrait phone a 960:600 box is a thin strip.
     Give it a usable, taller area and let the canvas fill it. */
  .stage { padding-bottom: 36px; }
  .frame { aspect-ratio: 4 / 3; border-radius: 8px; }

  /* Big, obvious "play fullscreen" button on phones (it opens the game tab). */
  .fs {
    width: 100%; margin: 14px 0 0; text-align: center;
    padding: 14px; font-size: .82rem; letter-spacing: 1.2px;
    color: var(--text); border-color: var(--neon);
    background: rgba(91,140,255,.08);
  }

  .ad-wrap { margin-bottom: 32px; }

  /* Leaderboard: stack the two boards. */
  .board { grid-template-columns: 1fr; }
  .page { padding-top: 36px; }
  .page-head h1 { font-size: 1.9rem; }
}

/* Very small / narrow phones */
@media (max-width: 380px) {
  .hero h1 { font-size: 2.2rem; }
  .frame { aspect-ratio: 1 / 1; }
}
