:root {
  --navy0: #0E1320;
  --navy1: #0B1020;
  --text: rgba(255, 255, 255, .92);
  --muted: rgba(255, 255, 255, .72);
  --primary: #FF8008;
  --primary2: #FFC837;
  --stroke: rgba(255, 255, 255, .16);
  --glass: rgba(255, 255, 255, .07);
  
  --safeTop: env(safe-area-inset-top, 0px);
  --safeBottom: env(safe-area-inset-bottom, 0px);
  
  --cta-py: 14px;
  --cta-px: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  padding-bottom: calc(92px + var(--safeBottom));
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(246, 196, 83, .15), transparent 60%),
    radial-gradient(700px 500px at 90% 10%, rgba(216, 67, 21, .15), transparent 65%),
    linear-gradient(180deg, #0b0f1c 0%, #060912 100%);
}

/* --- ANIMATED BACKGROUND LAYERS --- */
body::before {
  content: '';
  position: fixed;
  inset: -120px;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  background:
    radial-gradient(circle at 12px 12px, rgba(246, 196, 83, .25) 0 1.5px, transparent 2px),
    radial-gradient(circle at 42px 42px, rgba(255, 160, 120, .18) 0 1.2px, transparent 2px);
  background-size: 60px 60px;
  will-change: transform;
  animation: rangoliDrift 14s ease-in-out infinite;
}

@keyframes rangoliDrift {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-18px, -10px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }

.wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 18px 20px 0;
  position: relative;
  z-index: 1;
}

/* --- HEADER / TOPBAR --- */
.topbar {
  position: sticky;
  top: calc(var(--safeTop) + 10px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid; place-items: center;
}
.brandTxt .name {
  font-family: "Noto Serif Devanagari", serif;
  font-weight: 700;
  font-size: 22px;
  background: linear-gradient(to bottom, #fbf5b7 0%, #bf953f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* --- CARDS & UTILS --- */
.tagline {
  text-align: center; font-family: "Noto Serif Devanagari", serif;
  font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  border-left: 2px solid #b63a35; margin-bottom: 30px;
}

.card {
  margin-top: 18px;
  background: linear-gradient(180deg, rgba(28, 20, 20, .95), rgba(12, 10, 14, .95));
  border: 1px solid rgba(246, 196, 83, .25);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  color: rgba(255, 255, 255, .86); background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14); margin-bottom: 12px;
}

.h { font-family: "Noto Serif Devanagari", serif; font-size: 18px; font-weight: 800; margin: 6px 0; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.5; }
.shlok { font-family: "Noto Serif Devanagari", serif; font-size: 18px; font-weight: 700; line-height: 1.6; margin-top: 8px; }
.meaning { color: rgba(255, 255, 255, .82); line-height: 1.6; font-size: 15px; margin-top: 5px; }

/* --- BUTTONS --- */
.btn {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: var(--cta-py) var(--cta-px);
  border-radius: 16px; font-size: 18px; font-weight: 700;
  cursor: pointer; margin: 14px 0; transition: transform 0.2s;
}
.btn:active { transform: scale(0.98); }

.btn.primary {
  background: linear-gradient(135deg, #FF8008 0%, #FFC837 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #000; text-shadow: none;
  box-shadow: 0 4px 15px rgba(255, 128, 8, 0.4);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
}

.btn.bhakti {
  background: linear-gradient(135deg, rgba(67, 24, 24, 0.6), rgba(122, 30, 30, 0.4));
  border: 1px solid rgba(246, 196, 83, 0.3); color: #ffecd2;
}

/* --- FORMS (From Start.php) --- */
.input {
  width: 100%; padding: 14px; border-radius: 16px;
  border: 1px solid var(--stroke); background: rgba(255, 255, 255, .06);
  color: #fff; font-size: 16px; outline: none;
}
.input:focus { border-color: var(--primary2); }
.notice, .error { padding: 12px; border-radius: 12px; font-size: 13px; margin-top: 10px; background: rgba(255, 255, 255, .06); }
.error { border-color: #ff6b6b; background: rgba(255, 0, 0, 0.1); }

/* --- LEADERBOARD SPECIFIC --- */
.row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 8px;
  padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, .08);
  border: 1px solid var(--stroke); margin-bottom: 8px; align-items: center;
}
.rank { width: 40px; height: 40px; display: grid; place-items: center; background: rgba(0, 0, 0, 0.3); border-radius: 12px; font-size: 18px; }
.score { background: var(--primary); color: #000; padding: 4px 10px; border-radius: 8px; font-weight: bold; }
select { width: 100%; padding: 10px; border-radius: 12px; background: #222; color: #fff; border: 1px solid var(--stroke); margin-bottom: 10px; }

/* --- NAVIGATION (Grid System) --- */
.bottom-nav {
  position: fixed; bottom: calc(12px + var(--safeBottom));
  left: 50%; transform: translateX(-50%);
  width: min(540px, calc(100% - 24px));
  height: 64px; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px; border-radius: 22px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .24); z-index: 30;
}
.bottom-nav .tab-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 6px;
  width: calc((100% - 12px) / 4); border-radius: 16px;
  background: rgba(246, 196, 83, .22);
  border: 1px solid rgba(246, 196, 83, .55);
  box-shadow: 0 0 20px rgba(246, 196, 83, .45);
  transform: translateX(calc(var(--tab-index, 0) * 100%));
  transition: transform .28s cubic-bezier(.2, .9, .2, 1);
  pointer-events: none;
}
.bottom-nav a {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; color: rgba(255, 255, 255, .78);
  position: relative; z-index: 1;
}
.bottom-nav a.active { color: #fff; }
.tab-ico { font-size: 18px; }
.tab-lbl { font-size: 10px; margin-top: 2px; }

/* Loading State */
body.is-loading .wrap { opacity: 0; }
body.loaded .wrap { animation: pagePop .65s ease-out both; }
@keyframes pagePop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; }
}