:root{
  --bg0:#070707;
  --bg1:#0c0c0c;
  --text:rgba(255,255,255,.92);

  --green:#33e07a;
  --green2:#1fcf69;

  --gold:#f2c94c;
  --silver:#cfd6df;
  --bronze:#e6a07b;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 650px at 50% 6%, #1c1c1c 0%, var(--bg1) 35%, var(--bg0) 100%);
  background-attachment: fixed;
  color:var(--text);
  overflow-x:hidden;
}

/* base glow */
.bg{
  position:fixed; inset:0;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(255,255,255,.08), transparent 60%),
    radial-gradient(700px 400px at 15% 50%, rgba(255,255,255,.05), transparent 60%),
    radial-gradient(700px 400px at 85% 55%, rgba(255,255,255,.04), transparent 60%);
  pointer-events:none;
  z-index:0;
}

/* NASA stars as full-screen background */
#particles-js{
  position:fixed;
  inset:0;
  z-index:1;
  pointer-events:none;
  opacity:1;
  filter: brightness(1.2) contrast(1.05);
}

.wrap{
  width:min(780px, 92vw);
  margin:28px auto 52px;
  position:relative;
  z-index:2;
}

/* centered hint (no big H1) */
.topRow{
  display:flex;
  justify-content:center;
  align-items:center;
  margin:10px 0 14px;
}
.topHint{
  margin-top:0;
  text-align:center;
  color:rgba(255,255,255,.65);
  font-weight:800;
  font-size:12px;
  line-height:1.25;
}

.titlePill{
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  padding:14px 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}

.titlePillInner{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
}

.titleSpan{
  color:#909090;
  font-size:20px;
  font-weight:700;
  line-height:1.1;
}
.titleBreak{ display:block; }
@media (min-width: 768px){
  .titleSpan{ font-size:30px; }
  .titleBreak{ display:none; }
}

.titleLogo{
  object-fit:contain;
  height:22px;
  width:100px;
}
@media (min-width: 768px){
  .titleLogo{
    height:64px;
    width:160px;
  }
}

.podium{
  margin:18px auto 10px;
  display:grid;
  grid-template-columns: 1fr 1.05fr 1fr;
  gap:18px;
  align-items:end;
}

/* ===== Podium entrance animation + staircase via CSS variable ===== */
@keyframes podiumIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(var(--podium-y)); }
}

.pcard{
  --podium-y: 14px; /* default (2nd place) */
  position:relative;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
  min-height:210px;
  padding:14px 14px 12px;
  padding-bottom:88px;

  /* helps reduce transform/gradient seams */
  background-clip: padding-box;
  transform: translateY(var(--podium-y));
  will-change: transform, opacity;
  backface-visibility: hidden;

  animation: podiumIn .6s ease-out both;
  animation-delay: .08s;

  /* Fix: hairline artifacts + clip */
  isolation: isolate;
  overflow: hidden;
}

.pcard.center{
  --podium-y: 0px;
  min-height:245px;
  padding-bottom:96px;
  transform: translateY(var(--podium-y));
  animation-delay: .02s;
}

/* 3rd place lower for staircase */
.pcard.right{
  --podium-y: 30px;
  transform: translateY(var(--podium-y));
  animation-delay: .14s;
}

/* Reduce motion if user requests it */
@media (prefers-reduced-motion: reduce){
  .pcard{ animation:none !important; transition:none !important; }
}

/* rank */
.pRank{
  position:absolute; left:12px; top:10px;
  font-weight:1000;
  color:rgba(255,255,255,.70);
  font-size:12px;
}

/* coin */
.pCoinImg{
  width:72px;height:72px;
  margin:6px auto 8px;
  display:grid;
  place-items:center;

  position: relative;
  overflow: hidden;
  border-radius: 999px;
}
.pCoinImg img{ width:72px; height:72px; display:block; }

/* Subtle coin shimmer (podium only) */
.pCoinImg::after{
  content:"";
  position:absolute;
  inset:-40%;
  background: linear-gradient(
    120deg,
    transparent 35%,
    rgba(255,255,255,.18) 50%,
    transparent 65%
  );
  transform: translateX(-120%) rotate(8deg);
  opacity: .55;
  pointer-events:none;
  mix-blend-mode: screen;
  animation: coinShimmer 3.8s ease-in-out infinite;
}
@keyframes coinShimmer{
  0%   { transform: translateX(-120%) rotate(8deg); opacity: 0; }
  12%  { opacity: .55; }
  28%  { transform: translateX(120%) rotate(8deg); opacity: 0; }
  100% { transform: translateX(120%) rotate(8deg); opacity: 0; }
}
.pcard.center .pCoinImg::after{
  animation-duration: 3.2s;
  opacity: .65;
}
@media (prefers-reduced-motion: reduce){
  .pCoinImg::after{ animation: none !important; }
}

/* name */
.pName{
  text-align:center;
  font-weight:950;
  opacity:.92;
  margin:2px 0 6px;
  line-height:1.1;

  /* Fix: line under text (compositing artifact) */
  position: relative;
  z-index: 2;
  transform: translateZ(0);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

/* Move 1st place coin + username a bit lower */
.pcard.center .pCoinImg{ margin-top: 10px; }
.pcard.center .pName{ margin-top: 6px; }

.pBottom{
  position:absolute; left:0; right:0; bottom:0;
  padding:10px 12px 12px;
  border-top:1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.35));
  border-radius:0 0 16px 16px;
  text-align:center;
}
.pAmt{font-weight:1000; line-height:1.1}
.pSub{font-size:11px;color:rgba(255,255,255,.55);margin-top:2px}
.pPill{
  margin:9px auto 0;
  width:72%;
  border-radius:999px;
  padding:6px 10px;
  font-weight:1000;
  color:#0b0b0b;
}
.pPill.gold{background:var(--gold)}
.pPill.silver{background:var(--silver)}
.pPill.bronze{background:var(--bronze)}

.timerBlock{
  margin:12px 0 10px;
  display:flex; align-items:center; gap:18px;
}
.line{flex:1;height:1px;background:rgba(255,255,255,.12)}
.timerCenter{min-width:320px;text-align:center}
.timerLabel{font-weight:900;color:rgba(255,255,255,.70);margin-bottom:6px;font-size:12px}
.timerTime{font-size:26px;font-weight:1000;letter-spacing:1px;color:rgba(255,255,255,.85)}
.timerBtns{margin-top:10px;display:flex;justify-content:center;gap:10px}

.btn{
  text-decoration:none;
  color:rgba(255,255,255,.85);
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.35);
  padding:8px 14px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
}

.playIcon{
  width:16px;
  height:16px;
  display:inline-block;
  background-image: url("/static/play.png");
  background-size: contain;
  background-repeat:no-repeat;
  background-position:center;
  margin-right:8px;
  filter: drop-shadow(0 0 6px rgba(51,224,122,.25));
}

.btnSvgIcon{
  width:16px;
  height:16px;
  display:inline-block;
  margin-right:8px;
  vertical-align:-3px;
  opacity:.9;
}
.btn.ghost{opacity:.95}

.rowsWrap{margin-top:10px}
.rows{display:flex;flex-direction:column;gap:10px}

.row{
  display:grid;
  grid-template-columns: 72px 1.1fr 1fr 120px;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.07);
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
}

.rankBox{
  display:flex;
  align-items:center;
  gap:10px;
  color:rgba(60,255,150,.85);
  font-weight:1000;
}

.greenCoinImg{ width:34px; height:34px; display:grid; place-items:center; }
.greenCoinImg img{ width:34px; height:34px; display:block; }

.rName{font-weight:950; opacity:.92}
.rWager{font-weight:950;color:rgba(255,255,255,.85)}
.rWager small{display:block;font-weight:800;color:rgba(255,255,255,.55);margin-top:2px}
.rPrize{
  justify-self:end;
  background: linear-gradient(180deg, var(--green), var(--green2));
  color:#07110b;
  font-weight:1000;
  padding:7px 12px;
  border-radius:999px;
  min-width:86px;
  text-align:center;
}

/* Modal */
.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index:50;
}
.modal.open{ display:flex; }

.modalCard{
  width:min(560px, 92vw);
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(18,18,18,.92), rgba(10,10,10,.92));
  box-shadow: 0 40px 120px rgba(0,0,0,.75);
  padding:18px 18px 16px;
  position:relative;
}
.modalCard h2{
  margin:0 0 10px;
  font-size:18px;
  font-weight:1000;
}
.modalBody{
  color: rgba(255,255,255,.78);
  font-weight:700;
  font-size:13px;
  line-height:1.45;
}
.ruleTitle{
  margin-top:12px;
  font-weight:950;
  color: rgba(255,255,255,.85);
}
.ruleLines{
  margin-top:8px;
  display:grid;
  gap:6px;
}
.modalClose{
  position:absolute;
  right:12px;
  top:10px;
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
  font-size:22px;
  cursor:pointer;
}
.modalClose:hover{ background: rgba(255,255,255,.10); }

@media (max-width: 700px){
  .podium{
    grid-template-columns:1fr;
    gap: 6px;
    align-items: stretch;
  }

  /* Order: 1st, 2nd, 3rd */
  .pcard.center{ order: 1; }
  .pcard.left{ order: 2; }
  .pcard.right{ order: 3; }

  /* Mini staircase offsets (smaller than desktop) */
  .pcard{ --podium-y: 10px !important; }
  .pcard.center{ --podium-y: 0px !important; }
  .pcard.right{ --podium-y: 18px !important; }

  /* Slightly faster entrance on mobile */
  .pcard{
    animation-duration: .45s !important;
  }

  .timerCenter{min-width:auto}
  .row{grid-template-columns: 72px 1fr; }
  .rWager{grid-column: 2 / 3}
  .rPrize{grid-column: 1 / -1; justify-self:start}
}
