:root{
  --bg:#07070a;
  --panel: rgba(0,0,0,.35);
  --panel-strong: rgba(0,0,0,.45);
  --line: rgba(120,255,120,.25);
  --glow: rgba(120,255,120,.18);

  --text:#f2f2f2;
  --muted:rgba(255,255,255,.65);
  --accent:#9dff7a;
  --gold:#ffd75e;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  color:var(--text);
  font-family: Roboto, system-ui, -apple-system, Segoe UI, sans-serif;
  background:
    radial-gradient(circle at 30% 0%, rgba(120,255,120,.08), transparent 55%),
    radial-gradient(circle at 70% 20%, rgba(255,215,94,.06), transparent 50%),
    var(--bg);
}

.frame{
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 44px;
}

header + .frame{ padding-top: 10px; }

/* -----------------------------
   LAYOUT: RAIL + MAIN
------------------------------ */
.lb-layout{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:14px;
  align-items:start;
}

.lb-rail{
  border:1px solid var(--line);
  border-radius:22px;
  background: rgba(0,0,0,.22);
  box-shadow: 0 0 34px rgba(120,255,120,.10);
  padding:14px;
  position: sticky;
  top: 14px;
}

.lb-rail-title{
  font-family:"Press Start 2P", monospace;
  font-size:10px;
  letter-spacing:.10em;
  color: rgba(255,255,255,.78);
  margin-bottom:10px;
}

.cabinet-rail{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.lb-rail-note{
  margin-top:12px;
  color: rgba(255,255,255,.55);
  font-size:12px;
  text-align:center;
}

/* -----------------------------
   CABINET BUTTONS (reused)
------------------------------ */
.cabinet{
  appearance:none;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  color:var(--text);

  padding:14px 14px 12px;
  border-radius:18px;
  cursor:pointer;
  text-align:left;

  box-shadow: 0 0 22px rgba(0,0,0,.35) inset;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.cabinet:hover{
  transform: translateY(-1px);
  border-color: var(--line);
  box-shadow: 0 0 26px var(--glow) inset;
}

.cabinet:focus-visible{
  outline: 2px solid rgba(255,215,94,.45);
  outline-offset: 2px;
}

.cab-title{
  font-family:"Press Start 2P", monospace;
  font-size:11px;
  letter-spacing:.08em;
  line-height:1.3;
}

.cab-sub{
  margin-top:8px;
  font-family:"Press Start 2P", monospace;
  font-size:9px;
  color: rgba(255,255,255,.65);
  letter-spacing:.08em;
  line-height:1.3;
}

/* -----------------------------
   HERO PANEL
------------------------------ */
.hero{
  border-radius:22px;
  padding:16px 16px 14px;

  border:1px solid var(--line);
  background: radial-gradient(circle at top, rgba(0,255,150,.10), rgba(0,0,0,.80));
  box-shadow: 0 0 34px rgba(120,255,120,.10);
}

.hero-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:12px;
  flex-wrap:wrap;
}

.hero-title{
  font-family:"Press Start 2P", monospace;
  letter-spacing:.10em;
  font-size:14px;
  color:var(--accent);
}

.hero-sub{
  font-family:"Press Start 2P", monospace;
  font-size:10px;
  color: rgba(255,255,255,.75);
  letter-spacing:.08em;
  margin-top:8px;
}

.hero-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* Period toggle */
.seg{
  display:flex;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  border-radius:999px;
  overflow:hidden;
}
.seg-btn{
  appearance:none;
  border:0;
  background:transparent;
  color: rgba(255,255,255,.75);
  padding: 10px 12px;
  font-family:"Press Start 2P", monospace;
  font-size:9px;
  letter-spacing:.08em;
  cursor:pointer;
}
.seg-btn--active{
  background: rgba(157,255,122,.14);
  color: var(--accent);
}

/* Live pill */
.live-pill{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  font-family:"Press Start 2P", monospace;
  font-size:9px;
  letter-spacing:.08em;
  color: rgba(255,255,255,.75);
}

.live-dot{
  width:8px; height:8px;
  border-radius:99px;
  background: rgba(120,255,120,.35);
  box-shadow: 0 0 14px rgba(120,255,120,.18);
}
.live-dot.live{
  background: rgba(120,255,120,.90);
  box-shadow: 0 0 18px rgba(120,255,120,.35);
}
.live-time{ color: rgba(255,255,255,.55); }

/* Pulse when updated */
.pulse{
  animation: pulse .55s ease;
}
@keyframes pulse{
  0%{ filter: brightness(1); }
  50%{ filter: brightness(1.25); }
  100%{ filter: brightness(1); }
}

/* -----------------------------
   PODIUM
------------------------------ */
.podium{
  display:grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap:12px;
  margin: 6px 0 12px;
}

.pod{
  border-radius:18px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.28);
  padding: 12px 12px 10px;
  overflow:hidden;
  box-shadow: 0 0 22px rgba(0,0,0,.35) inset;
}

/* Metal edge overlay (applies to all podium cards) */
.pod{
  position: relative; /* <-- ADD THIS if not already */
}

.pod::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:18px;
  pointer-events:none;
  opacity:.95;
}

/* 🥇 GOLD — #1 */
.pod--one{
  border-color: rgba(255,215,94,.55);
  box-shadow:
    0 0 32px rgba(255,215,94,.22),
    0 0 18px rgba(157,255,122,.18),
    0 0 22px rgba(0,0,0,.35) inset;

  background: radial-gradient(circle at top, rgba(255,215,94,.14), rgba(0,0,0,.35));
  transform: translateY(-2px);
}

.pod--one::after{
  border: 2px solid rgba(255,215,94,.78);
  box-shadow:
    inset 0 0 18px rgba(255,215,94,.35),
    inset 0 0 8px rgba(255,215,94,.55);
}

/* 🥈 SILVER — #2 */
.pod--two{
  border-color: rgba(190,205,255,.55);
  box-shadow:
    0 0 22px rgba(190,205,255,.18),
    0 0 14px rgba(157,255,122,.10),
    0 0 22px rgba(0,0,0,.35) inset;
}

.pod--two::after{
  border: 2px solid rgba(190,205,255,.72);
  box-shadow:
    inset 0 0 14px rgba(190,205,255,.30);
}

/* 🥉 BRONZE — #3 */
.pod--three{
  border-color: rgba(255,170,120,.55);
  box-shadow:
    0 0 20px rgba(255,170,120,.18),
    0 0 12px rgba(157,255,122,.08),
    0 0 22px rgba(0,0,0,.35) inset;
}

.pod--three::after{
  border: 2px solid rgba(255,170,120,.72);
  box-shadow:
    inset 0 0 12px rgba(255,170,120,.28);
}

.pod-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
  font-family:"Press Start 2P", monospace;
  font-size:9px;
  letter-spacing:.08em;
  color: rgba(255,255,255,.70);
}

.pod-rank{
  color: rgba(255,255,255,.85);
}

.pod-medal{
  padding: 3px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.75);
}

.pod-main{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:10px;
}

.pod-initials{
  font-family:"Press Start 2P", monospace;
  font-size:16px;
  letter-spacing:.14em;
  color: rgba(255,255,255,.92);
}

.pod--one .pod-initials{ font-size:18px; }

.pod-score{
  font-family:"Press Start 2P", monospace;
  font-size:14px;
  color: var(--gold);
  text-align:right;
  font-variant-numeric: tabular-nums;
}



/* -----------------------------
   TABLE (4–10)
------------------------------ */
.hero-table{
  border-radius:18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.35);
}

.row{
  display:grid;
  grid-template-columns: 44px 92px 1fr 140px; /* rank, initials, game, score */
  gap: 10px;
  padding: 10px 12px;
  align-items:center;

  border-top: 1px dotted rgba(140,255,140,.22);
  font-family:"Press Start 2P", monospace;
  font-size: 10px;
}

.row:first-child{ border-top:none; }

.row-head{
  background: var(--panel-strong);
  border-top:none;
  color: rgba(255,255,255,.85);
}

.rows .row:nth-child(odd){
  background: rgba(255,255,255,.02);
}

.row-loading,
.row-empty{
  grid-template-columns: 1fr;
  text-align:center;
  padding:14px 12px;
  color: rgba(255,255,255,.7);
}

.c-rank{ text-align:left; color: rgba(255,255,255,.85); }
.c-initials{ text-align:left; color: rgba(255,255,255,.90); letter-spacing:.08em; }
.c-game{ text-align:left; color: rgba(255,255,255,.78); }
.c-score{
  color: var(--gold);
  text-align:right;
  font-variant-numeric: tabular-nums;
}

/* Hide GAME column for single-game mode */
.single-game .row{
  grid-template-columns: 44px 1fr 140px; /* rank, initials, score */
}
.single-game .c-game{ display:none; }
.single-game #colGame{ display:none; }

/* Footer note */
.footer-note{
  margin-top:12px;
  text-align:center;
  color: rgba(255,255,255,.55);
  font-size:12px;
}

/* -----------------------------
   RESPONSIVE
------------------------------ */
@media (max-width: 920px){
  .lb-layout{ grid-template-columns: 1fr; }
  .lb-rail{ position: relative; top:auto; }
  .podium{ grid-template-columns: 1fr; }
  .pod--one{ transform:none; }
}

@media (max-width: 520px){
  .row{
    grid-template-columns: 40px 92px 1fr 120px;
    font-size:9px;
  }
}

/* -----------------------------
   UX TWEAKS: clearer active cabinet + zingy hover toggles
   (2026-01-29)
------------------------------ */

/* Make selected cabinet unmistakable */
.cabinet{ position: relative; }

/* Zing hover on period toggles (especially WEEKLY) */
.seg-btn{
  transition: filter .12s ease, background .12s ease, transform .12s ease, color .12s ease;
}
.seg-btn:hover:not(.seg-btn--active){
  background: rgba(157,255,122,.10);
  color: rgba(200,255,200,.95);
  filter: brightness(1.15);
  transform: translateY(-1px);
}
.seg-btn:focus-visible{
  outline: 2px solid rgba(120,255,120,.45);
  outline-offset: 2px;
}

/* -----------------------------
   Spacer divider under period toggle
------------------------------ */

/* Simple blank spacing under controls (no divider line) */
.hero-head{
  margin-bottom: 28px;
}

/* Extra breathing room before podium */
.hero{
  padding-top: 22px;
}

/* Make left + right panels match height */
.lb-layout{
  align-items: stretch; /* was start */
}

/* Let main column stretch its child */
.lb-main{
  display: flex;
}
.lb-main .hero{
  width: 100%;
}

/* Disable sticky so the rail can stretch to the same height */
.lb-rail{
  position: relative; /* was sticky */
  top: auto;
  height: 100%;
}

.seg{
  background: rgba(0,0,0,.35);
  border-color: rgba(120,255,120,.35);
}

.seg-btn{
  padding: 10px 16px;
}

.seg-btn--active{
  background: rgba(157,255,122,.22);
  box-shadow: 0 0 14px rgba(157,255,122,.35);
}

.seg-btn:hover:not(.seg-btn--active){
  background: rgba(157,255,122,.12);
  color: #eaffea;
}

.hero{
  position: relative;
}

/* -----------------------------
   PERIOD TOGGLE — PRIMARY CONTROL
------------------------------ */

.hero-right .seg{
  border-radius: 14px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(120,255,120,.25);
  box-shadow: 0 0 22px rgba(120,255,120,.12);
}

.seg-btn{
  min-width: 96px;
  padding: 12px 18px;
  font-size: 10px;
  letter-spacing: .12em;
  color: rgba(255,255,255,.65);
}

/* ACTIVE = clearly selected mode */
.seg-btn--active{
  background:
    linear-gradient(
      180deg,
      rgba(157,255,122,.28),
      rgba(157,255,122,.10)
    );
  color: var(--accent);
  box-shadow:
    inset 0 0 18px rgba(157,255,122,.35),
    0 0 18px rgba(157,255,122,.25);
}

/* HOVER = strong invitation to switch */
.seg-btn:not(.seg-btn--active):hover{
  background: rgba(157,255,122,.12);
  color: rgba(220,255,220,.95);
  box-shadow: inset 0 0 14px rgba(157,255,122,.25);
  transform: translateY(-1px);
}

/* Footer live indicator alignment */
.hero{
  position: relative;
}

.footer-note{
  margin-top:12px;
  text-align:left;
}

.live-pill--footer{
  position:absolute;
  right:16px;
  bottom:14px;
  opacity:.9;
  transform: scale(.95);
}

.live-pill--footer{
  background: rgba(0,0,0,.20);
  box-shadow: none;
}

/* Footer row: status left, LIVE right */
.hero-footer{
  margin-top:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.hero-footer .footer-note{
  margin:0;
  text-align:left;
}

.hero-footer .live-pill--footer{
  margin:0;
  opacity:.9;
  transform: scale(.95);
  background: rgba(0,0,0,.20);
  box-shadow: none;
}

/* Remove redundant TOP 10 text under cabinet buttons */
.cabinet .cab-sub{
  display:none;
}

/* =============================
   ACTIVE CABINET (single source)
   Matches the active period button
============================= */

.cabinet{ position: relative; }

.cabinet--active{
  background: linear-gradient(
    180deg,
    rgba(157,255,122,.28),
    rgba(157,255,122,.10)
  );
  border-color: rgba(120,255,120,.55);
  box-shadow:
    inset 0 0 18px rgba(157,255,122,.28),
    0 0 18px rgba(157,255,122,.16);
  transform: translateY(-1px);
}

/* left neon strip */
.cabinet--active::before{
  content:"";
  position:absolute;
  left:10px;
  top:12px;
  bottom:12px;
  width:4px;
  border-radius:99px;
  background: rgba(157,255,122,.95);
  box-shadow: 0 0 16px rgba(157,255,122,.35);
}

/* nudge title right (cab-sub is now hidden anyway) */
.cabinet--active .cab-title{
  padding-left:10px;
  color: rgba(235,255,235,.98);
}

/* MOBILE LEADERBOARD — FINAL, CLEAN */
@media (max-width: 480px) {
  .hero-table,
  #heroTable {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  /* Default: ALL GAMES (4 columns) */
  .hero-table .row {
    display: grid;
    grid-template-columns: 28px 44px minmax(0, 1fr) 86px; /* #, ID, GAME, SCORE */
    gap: 6px;
    align-items: center;
    min-width: 0;
    box-sizing: border-box;
  }

  .hero-table .c-game {
    min-width: 0;
    font-size: 0.62rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
  }

  .hero-table .c-score {
    white-space: nowrap;
    font-size: 0.7rem;
  }

  /* SINGLE GAME (Invaders, Frogger, etc.) */
  .single-game .row {
    grid-template-columns: 28px minmax(0, 1fr) 86px; /* #, ID, SCORE */
  }

  /* PODIUM — mobile order: GOLD → SILVER → BRONZE */
  #podium {
    display: flex;
    flex-direction: column;
  }

  #podium .pod--one   { order: 1; } /* GOLD */
  #podium .pod--two   { order: 2; } /* SILVER */
  #podium .pod--three { order: 3; } /* BRONZE */  
}
