:root {
  --bg: #0b0b10;
  --bg-card: #15161c;
  --bg-elev: #1c1e26;
  --border: #2a2c36;
  --text: #f5f5f5;
  --text-muted: #9ca3af;
  --green: #00d68f;
  --green-dim: #00a872;
  --gold: #FFD700;
  --gold-dim: #c9a227;
  --danger: #ef4444;
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0, 214, 143, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(255, 215, 0, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font-family: "Hind Siliguri", "Noto Sans Bengali", "SolaimanLipi", "Kalpurush", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  line-height: 1.55;
}

.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.bg-card { background-color: var(--bg-card); }
.border-card { border-color: var(--border); }

.hero-title {
  background: linear-gradient(120deg, #00d68f 0%, #ffd700 50%, #00d68f 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

.prize-pool {
  text-shadow: 0 0 24px rgba(255, 215, 0, 0.45), 0 0 4px rgba(255, 215, 0, 0.8);
}

.search-input {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 214, 143, 0.18);
  background: #1a1d26;
}

.rank-row {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform .15s, border-color .15s, background .15s;
  content-visibility: auto;
  contain-intrinsic-size: auto 84px;
}
.rank-row:hover {
  border-color: rgba(0, 214, 143, 0.5);
  background: #181a22;
}

/* Top rows: stack above neighbors so the gold glow isn't covered by following rows */
.rank-row.top-1,
.rank-row.top-2,
.rank-row.top-3 {
  border-color: var(--gold-dim);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.08) 0%, var(--bg-card) 100%);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.2), 0 8px 24px -12px rgba(255, 215, 0, 0.35);
}
.rank-row.top-3 { z-index: 2; }
.rank-row.top-2 { z-index: 3; }
.rank-row.top-1 {
  z-index: 4;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.45), 0 12px 30px -10px rgba(255, 215, 0, 0.55);
}

.rank-badge {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.rank-row.top-1 .rank-badge,
.rank-row.top-2 .rank-badge,
.rank-row.top-3 .rank-badge {
  background: linear-gradient(135deg, #ffd700, #c9a227);
  color: #1a1407;
  border-color: transparent;
  box-shadow: 0 4px 12px -4px rgba(255, 215, 0, 0.6);
}
.crown {
  position: absolute;
  top: -10px;
  left: 8px;
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.5));
}

/* Search-match highlight inside rendered rows */
.hl {
  background: rgba(255, 215, 0, 0.22);
  color: var(--gold);
  border-radius: 4px;
  padding: 0 3px;
  margin: 0 -1px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.35);
}

.ticket-pill {
  background: linear-gradient(135deg, rgba(0, 214, 143, 0.18), rgba(0, 214, 143, 0.05));
  border: 1px solid rgba(0, 214, 143, 0.35);
  color: var(--green);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.tab-btn:hover { color: var(--text); border-color: var(--green); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--green), var(--green-dim));
  color: #04140d;
  border-color: transparent;
  box-shadow: 0 6px 18px -6px rgba(0, 214, 143, 0.55);
}

.prize-card {
  background: linear-gradient(160deg, var(--bg-card), var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.prize-card .ribbon {
  font-size: 1.5rem;
  width: 2.5rem;
  text-align: center;
}

.rule-list li { padding: 0.35rem 0; }
.rule-list li::marker { color: var(--green); }

.hint-arrow {
  position: absolute;
  font-size: 1.5rem;
  color: var(--gold);
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.fade-in {
  animation: fadeIn .25s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .rank-row { padding: 0.75rem; }
  .crown { left: 4px; top: -8px; font-size: 1.1rem; }
  .rank-badge { width: 2rem; height: 2rem; font-size: 0.875rem; }
}

/* Hide scrollbar on horizontal scroll containers but keep functionality */
.scroll-x { overflow-x: auto; scrollbar-width: thin; }
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Constrained-height leaderboard list with internal scroll */
.rank-list {
  height: clamp(420px, 65vh, 720px);
  overflow-y: auto;
  padding: 14px 0.5rem 14px 0.25rem; /* breathing room so #1 glow isn't clipped */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  scroll-behavior: smooth;
  isolation: isolate; /* contain z-index stacking */
}
.rank-list::-webkit-scrollbar { width: 6px; }
.rank-list::-webkit-scrollbar-track { background: transparent; }
.rank-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.rank-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 214, 143, 0.45);
}

@media (max-width: 640px) {
  .rank-list { height: clamp(360px, 60vh, 600px); }
}
