:root {
  --bg-0: #050505; --bg-1: #111111; --bg-2: #1a1708;
  --card: rgba(16, 16, 16, 0.78);
  --gold: #f7d33e; --gold-2: #e0ad00; --gold-3: #ffe97a;
  --red: #ff3b3b; --orange: #ff9a1f;
  --text: #fff8e1; --muted: #c9c2a6;
  --line: rgba(247, 211, 62, 0.25);
  --shadow-gold: 0 10px 40px rgba(247, 211, 62, 0.28);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; height: 100dvh; overflow: hidden;            /* no page scroll */
  font-family: "Plus Jakarta Sans", "Hind Siliguri", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 60% at 50% -10%, #3a3005 0%, transparent 60%),
              radial-gradient(90% 40% at 100% 100%, rgba(247, 211, 62, 0.18) 0%, transparent 60%),
              linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 48%, var(--bg-2) 100%);
}

/* floating sparkles */
.sparkles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sparkles i {
  position: absolute; bottom: -10px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); opacity: 0; filter: blur(0.5px);
  box-shadow: 0 0 10px var(--gold), 0 0 20px rgba(247, 211, 62, 0.6);
  animation: rise linear infinite;
}
.sparkles i:nth-child(odd) { background: #fff; box-shadow: 0 0 10px #fff, 0 0 20px rgba(255, 255, 255, 0.5); }
@keyframes rise { 0% { transform: translateY(0) scale(0.6); opacity: 0; } 15% { opacity: 0.9; } 100% { transform: translateY(-110vh) scale(1.2); opacity: 0; } }

/* ---------- page shell: fills the screen, children share the height ---------- */
.page {
  position: relative; z-index: 1;
  max-width: 460px; margin: 0 auto; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--card); backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 30px 80px rgba(0, 0, 0, 0.6);
}
@media (min-width: 480px) and (min-height: 700px) {
  .page { height: calc(100dvh - 40px); margin: 20px auto; border-radius: 28px; overflow: hidden; }
}
.top-glow { position: absolute; left: 50%; top: -120px; width: 420px; height: 260px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(247, 211, 62, 0.28), transparent); pointer-events: none; }

.content {
  flex: 1; min-height: 0; position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px; text-align: center;
}

.logo {
  display: block; width: clamp(150px, 44vw, 200px); margin: 0 auto 8px;
  padding: 8px 14px; border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fff6cf 100%);
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(247, 211, 62, 0.18), 0 8px 24px rgba(247, 211, 62, 0.35);
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(247, 211, 62, 0.14), rgba(247, 211, 62, 0.04));
  color: var(--gold-3); font-weight: 700; font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.pill svg { width: 14px; height: 14px; }

/* ---------- HERO: takes whatever height is left ---------- */
.hero {
  flex: 1 1 0; min-height: 0; width: 100%; margin: 10px 0;
  display: flex; justify-content: center;
}
.hero-frame {
  width: 100%; height: 100%;
  border-radius: 20px; padding: 3px; position: relative;
  background: linear-gradient(135deg, var(--gold-3), var(--gold) 45%, var(--gold-2) 70%, #6b5200);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 16px 40px rgba(0, 0, 0, 0.45), var(--shadow-gold);
  animation: border-glow 3.5s ease-in-out infinite;
}
@keyframes border-glow { 50% { box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 16px 50px rgba(0, 0, 0, 0.5), 0 10px 44px rgba(247, 211, 62, 0.5); } }
.hero-inner { width: 100%; height: 100%; border-radius: 17px; overflow: hidden; background: #0d0d0d; position: relative; }
.hero-bg { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(18px) saturate(1.3); opacity: .8; }
.hero-img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.hero-empty { height: 100%; display: grid; place-items: center; color: var(--muted); padding: 20px; font-size: 14px; }

/* ---------- AVIATOR ---------- */
.av-box {
  height: 100%; display: flex; flex-direction: column; padding: 6px 8px 8px; gap: 6px;
  background: radial-gradient(80% 60% at 50% 30%, #1d1b10 0%, #080808 100%);
  position: relative; overflow: hidden;
}
.av-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; position: relative; z-index: 2; }
.av-title {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: clamp(14px, 4.2vw, 18px); letter-spacing: 2px; text-transform: uppercase;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-3) 40%, #fff 50%, var(--gold-3) 60%, var(--gold-2)); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.4s linear infinite;
  filter: drop-shadow(0 2px 8px rgba(247, 211, 62, .45));
}
.av-title i { font-style: normal; -webkit-text-fill-color: initial; animation: bob 1.4s ease-in-out infinite; display: inline-block; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-8deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.av-bet { font-size: 11.5px; color: var(--muted); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0,0,0,.4); }
.av-bet b { color: var(--gold); font-size: 12.5px; }

.av-sky {
  position: relative; flex: 1 1 0; min-height: 0; border-radius: 14px; overflow: hidden;
  background: radial-gradient(120% 90% at 0% 100%, #2a2306 0%, #0a0a0a 60%);
  box-shadow: inset 0 0 0 1px rgba(247, 211, 62, .25), inset 0 0 40px rgba(0, 0, 0, .8);
}
#aviator { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.av-mult {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
  font-weight: 900; font-size: clamp(30px, 10vw, 46px); line-height: 1; color: #fff; letter-spacing: -1px;
  text-shadow: 0 0 24px rgba(247, 211, 62, .55), 0 4px 10px rgba(0,0,0,.8); font-variant-numeric: tabular-nums;
  transition: color .2s;
}
.av-mult span { font-size: .55em; color: var(--gold); margin-left: 2px; }
.av-box.flying .av-mult { color: var(--gold-3); }
.av-box.crashed .av-mult { color: var(--red); text-shadow: 0 0 24px rgba(255, 59, 59, .6), 0 4px 10px rgba(0,0,0,.8); }
.av-box.won .av-mult { color: #5dff9a; text-shadow: 0 0 24px rgba(93, 255, 154, .6), 0 4px 10px rgba(0,0,0,.8); }
.av-msg {
  position: absolute; left: 8px; right: 8px; top: 6px; z-index: 2; pointer-events: none;
  font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.3;
  padding: 5px 8px; border-radius: 10px; background: rgba(0, 0, 0, .55); border: 1px solid rgba(255,255,255,.06);
}
.av-msg b { color: var(--gold); }
.av-box.crashed .av-msg b { color: var(--red); }
.av-box.won .av-msg b { color: #5dff9a; }

.av-btn {
  flex: none; width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid #fff3b0; position: relative; z-index: 2;
  background: linear-gradient(180deg, var(--gold-3), var(--gold) 50%, var(--gold-2));
  color: #111; font-weight: 900; font-size: clamp(15px, 4.4vw, 18px); letter-spacing: 2px; text-transform: uppercase; font-family: inherit;
  cursor: pointer; box-shadow: 0 8px 20px rgba(0,0,0,.5), 0 0 26px rgba(247, 211, 62, 0.55), inset 0 -4px 8px rgba(0,0,0,.15);
  animation: pulse 1.6s ease-in-out infinite; transition: background .2s, color .2s;
}
@keyframes pulse { 50% { box-shadow: 0 8px 20px rgba(0,0,0,.5), 0 0 44px rgba(247, 211, 62, .95), inset 0 -4px 8px rgba(0,0,0,.15); transform: scale(1.02); } }
.av-btn.cashout {
  background: linear-gradient(180deg, #7dffb0, #2ee36f 50%, #12b14c); border-color: #d6ffe6; color: #052b14;
  box-shadow: 0 8px 20px rgba(0,0,0,.5), 0 0 26px rgba(46, 227, 111, 0.6), inset 0 -4px 8px rgba(0,0,0,.15);
  animation: pulse-green .9s ease-in-out infinite;
}
@keyframes pulse-green { 50% { box-shadow: 0 8px 20px rgba(0,0,0,.5), 0 0 44px rgba(46, 227, 111, 1), inset 0 -4px 8px rgba(0,0,0,.15); transform: scale(1.03); } }
.av-btn:disabled { animation: none; cursor: default; opacity: .8; }

/* result modal */
.result { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; padding: 20px;
  background: rgba(0, 0, 0, 0.84); backdrop-filter: blur(6px); }
.result.show { display: grid; }
.result-card { width: 100%; max-width: 340px; text-align: center; padding: 26px 20px 22px; border-radius: 24px;
  background: linear-gradient(180deg, #1f1b08, #0d0d0d); border: 1px solid var(--line);
  box-shadow: var(--shadow-gold); animation: pop .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.result-card .trophy { font-size: 52px; line-height: 1; }
.result-card h2 { margin: 8px 0 2px; font-size: 20px; }
.result-card .prize { font-size: 28px; font-weight: 900; color: var(--gold); text-shadow: 0 0 20px rgba(247,211,62,.6); margin: 4px 0 10px; }
.result-card p { color: var(--muted); margin: 0 0 16px; font-size: 13px; }

/* ---------- TEXT + CTA ---------- */
.hero-text { font-size: clamp(13px, 3.6vw, 15px); line-height: 1.45; color: #f3eed9; margin: 0 0 10px; font-weight: 500; }

.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 300px; margin: 0 auto; padding: 13px 20px; border-radius: 999px;
  text-decoration: none; color: #111; font-weight: 800; font-size: 16px;
  background: linear-gradient(90deg, var(--gold-3), var(--gold) 45%, var(--gold-2));
  box-shadow: 0 10px 26px rgba(247, 211, 62, 0.4), inset 0 1px 0 rgba(255,255,255,.6);
  position: relative; overflow: hidden; transition: transform .15s;
}
.cta:active { transform: scale(.97); }
.cta::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-20deg); animation: shine 2.6s infinite; }
@keyframes shine { 0% { left: -60%; } 60%, 100% { left: 130%; } }
.cta svg { width: 20px; height: 20px; }
.cta-note { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 5px; }
.cta-note svg { width: 13px; height: 13px; color: var(--gold); }

.trust { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; font-size: 11.5px; font-weight: 700; color: #f6f1dc; }
.trust span { display: inline-flex; align-items: center; gap: 4px; }
.trust svg { width: 13px; height: 13px; color: var(--gold); }

.divider { width: 100%; height: 1px; margin: 8px 0; background: linear-gradient(90deg, transparent, var(--line), transparent); }

.pay-title { font-size: 11px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; margin: 0 0 7px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.pay-title svg { width: 12px; height: 12px; color: var(--gold); }
.pay { display: flex; justify-content: center; gap: 10px; width: 100%; }
.pay-badge {
  flex: 1; max-width: 112px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; padding: 5px 10px;
  background: #fff; border: 2px solid var(--c); overflow: hidden;
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 60%, transparent), inset 0 0 0 1px rgba(0,0,0,.04);
  animation: badge 3s ease-in-out infinite;
}
.pay-badge img { display: block; width: auto; height: 32px; max-width: 100%; object-fit: contain; }
.pay-badge:nth-child(2) { animation-delay: 1s; } .pay-badge:nth-child(3) { animation-delay: 2s; }
@keyframes badge { 50% { transform: translateY(-2px); box-shadow: 0 0 26px color-mix(in srgb, var(--c) 85%, transparent), inset 0 0 0 1px rgba(0,0,0,.04); } }
.pay-badge.bkash { --c: #e2136e; } .pay-badge.nagad { --c: #f6921e; } .pay-badge.rocket { --c: #8b3392; }

footer {
  flex: none; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); text-align: center; border-top: 2px solid var(--gold);
  background: rgba(0, 0, 0, 0.6); font-size: 11px; color: var(--muted);
  display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
}
footer .age { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--gold-3); font-weight: 700; font-size: 10.5px; }
footer .age svg { width: 12px; height: 12px; }

/* countdown (only when enabled in the admin panel) */
.countdown {
  position: relative; margin: 0 0 6px; z-index: 40;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.9); border: 1px solid var(--line); color: var(--gold-3);
  font-size: 11px; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.5); white-space: nowrap;
}
.countdown b { font-variant-numeric: tabular-nums; color: #fff; font-size: 13px; }
.countdown .dot { width: 7px; height: 7px; border-radius: 50%; background: #3cff8f; box-shadow: 0 0 10px #3cff8f; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* very short screens: drop the least important bits so nothing scrolls */
@media (max-height: 640px) {
  .cta-note, .divider { display: none; }
  .trust { margin-top: 6px; }
}
@media (max-height: 560px) {
  .trust, .pill { display: none; }
}

/* short phones: give the game the room instead of the helper lines */
@media (max-height: 720px) {
  .av-msg { display: none; }
  .av-mult { top: 34%; }
  .hero { margin: 6px 0; }
  .hero-text { margin-bottom: 8px; }
  footer { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
}

/* Hero box (image or Aviator): capped height; leftover space spreads between the sections */
.hero { max-height: min(38dvh, 330px); }
.content { justify-content: space-evenly; }
.content .hero-text { margin: 0; }
.content .trust { margin-top: 0; }
.content .divider { margin: 0; }
@media (max-height: 720px) { .hero { max-height: min(40dvh, 330px); } }
