/* Habitoxy celebrations — dialog aur point toast ki poori shakl.
   ==========================================================================
   Saara look yahan hai, celebrate.js sirf node banati hai aur ghadi chalati
   hai — wahi bantwara jo .lp-toast ka app.css ke saath hai.

   Teen niyam jo is repo mein pehle tootne par pakde gaye the, aur yahan
   shuruaat se hi maane gaye hain:
     - har button par font-family likhi hai, warna UA stylesheet use Arial de
       deta hai (918 mein se 828 control isi wajah se Arial mein the);
     - koi text 10px se chhota nahi, aur sab --fs-* token se;
     - accent par baithne wala akshar var(--on-accent) hai, cyan par safed
       nahi.
   ========================================================================== */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.lp-cel {
  position: fixed;
  inset: 0;
  z-index: 99998;              /* customConfirmModal (99999) ke theek neeche */
  display: none;               /* JS ise flex karta hai */
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity .22s ease;
}
.lp-cel.is-open { opacity: 1; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.lp-cel .lp-cel-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: calc(100dvh - 32px);
  overflow: hidden auto;       /* confetti bahar nahi girta, lamba card scroll hota hai */
  box-sizing: border-box;
  padding: 26px 22px 22px;
  border-radius: 22px;
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(var(--accent-rgb), 0.22), transparent 60%),
    var(--bg, #0E1420);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(16px) scale(.96);
  transition: transform .34s cubic-bezier(.16, 1, .3, 1);
}
.lp-cel.is-open .lp-cel-card { transform: none; }

.lp-cel .lp-cel-x {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-sm);
  line-height: 1;
  color: var(--text-dim);
  background: var(--inner-box-bg, rgba(255, 255, 255, .06));
  border: 1px solid var(--card-brd, rgba(255, 255, 255, .12));
  transition: color .18s ease, background .18s ease;
}
.lp-cel .lp-cel-x:hover { color: var(--text); background: rgba(255, 255, 255, .12); }
.lp-cel .lp-cel-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Confetti ────────────────────────────────────────────────────────────── */
.lp-cel .lp-cel-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
.lp-cel .lp-cel-confetti i {
  position: absolute;
  top: -14px;
  display: block;
  opacity: 0;
  animation-name: lpCelFall;
  animation-timing-function: cubic-bezier(.25, .6, .4, 1);
  animation-fill-mode: forwards;
}
@keyframes lpCelFall {
  0%   { opacity: 0; transform: translateY(-10px) rotate(0deg); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(420px) rotate(var(--spin, 360deg)); }
}

/* ── Sar ─────────────────────────────────────────────────────────────────── */
.lp-cel .lp-cel-body { position: relative; z-index: 3; }

.lp-cel .lp-cel-burst {
  font-size: 40px;
  line-height: 1;
  animation: lpCelPop .5s cubic-bezier(.16, 1.3, .3, 1) both;
}
@keyframes lpCelPop {
  0%   { transform: scale(.3) rotate(-18deg); opacity: 0; }
  60%  { transform: scale(1.18) rotate(6deg); opacity: 1; }
  100% { transform: none; }
}

.lp-cel .lp-cel-kicker {
  margin-top: 10px;
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-micro);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.lp-cel .lp-cel-title {
  margin: 4px 0 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

/* ── Kaun ────────────────────────────────────────────────────────────────── */
.lp-cel .lp-cel-who {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 4px;
}
.lp-cel .lp-cel-av {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(var(--accent-rgb), .45);
}
.lp-cel .lp-cel-av-txt {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--on-accent, #000);
  background: var(--accent);
  border: none;
}
.lp-cel .lp-cel-who-txt { text-align: left; min-width: 0; }
.lp-cel .lp-cel-name {
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.lp-cel .lp-cel-rank {
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

/* ── Ring ────────────────────────────────────────────────────────────────── */
.lp-cel .lp-cel-ring {
  width: 116px;
  height: 116px;
  margin: 16px auto 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* --p JS se aata hai: 0-100. Ek hi gradient, do rang, koi SVG nahi. */
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%),
                             var(--card-brd, rgba(255, 255, 255, .12)) 0);
  animation: lpCelRing .6s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes lpCelRing {
  from { transform: scale(.84); opacity: .2; }
  to   { transform: none; opacity: 1; }
}
.lp-cel .lp-cel-ring-in {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg, #0E1420);
}
.lp-cel .lp-cel-ring-lbl {
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-micro);
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--text-dim);
}
.lp-cel .lp-cel-ring-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-hero);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

/* ── Teen tile ───────────────────────────────────────────────────────────── */
.lp-cel .lp-cel-stats {
  display: flex;
  gap: 8px;
  margin: 16px 0 0;
}
.lp-cel .lp-cel-tile {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--inner-box-bg, rgba(255, 255, 255, .05));
  border: 1px solid var(--card-brd, rgba(255, 255, 255, .1));
}
.lp-cel .lp-cel-tile b {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lp-cel .lp-cel-tile span {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.lp-cel .lp-cel-note {
  margin: 14px 0 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-dim);
}

.lp-cel .lp-cel-go {
  width: 100%;
  margin-top: 16px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--on-accent, #000);
  background: linear-gradient(135deg, var(--accent), var(--violet, #9B6BFF));
  box-shadow: 0 10px 26px rgba(var(--accent-rgb), .28);
  transition: transform .16s ease, box-shadow .16s ease;
}
.lp-cel .lp-cel-go:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(var(--accent-rgb), .36); }
.lp-cel .lp-cel-go:active { transform: none; }
.lp-cel .lp-cel-go:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Ujale theme par kaali chamak dhabba lagti hai aur card safed par safed. */
body.light-theme .lp-cel { background: rgba(15, 23, 42, 0.45); }
body.light-theme .lp-cel .lp-cel-card {
  border-color: rgba(var(--accent-rgb), .3);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, .8);
}
body.light-theme .lp-cel .lp-cel-x:hover { background: rgba(15, 23, 42, .08); }

/* ── Point ka toast ──────────────────────────────────────────────────────── */
.lp-ptoast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10001;              /* .lp-toast (10000) ke theek upar */
  display: none;               /* JS ise flex karta hai */
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 16px 10px 12px;
  box-sizing: border-box;
  border-radius: 14px;
  /* Aam toast gol aur saada hai; ye kone se kata, accent ki lakeer ke saath —
     do alag khabar, do alag shakl. */
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .18), rgba(10, 15, 26, .92));
  border: 1px solid rgba(var(--accent-rgb), .45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .03) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  opacity: 0;
  transform: translate(-50%, 14px) scale(.96);
  transition: opacity .24s ease, transform .3s cubic-bezier(.16, 1, .3, 1);
  pointer-events: none;
}
.lp-ptoast.is-up { opacity: 1; transform: translate(-50%, 0) scale(1); }
.lp-ptoast.is-minus {
  background: linear-gradient(135deg, rgba(255, 255, 255, .06), rgba(10, 15, 26, .92));
  border-color: var(--card-brd, rgba(255, 255, 255, .14));
}
.lp-ptoast .lp-ptoast-spark {
  font-size: var(--fs-lg);
  line-height: 1;
  animation: lpCelPop .45s cubic-bezier(.16, 1.3, .3, 1) both;
}
.lp-ptoast .lp-ptoast-n {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}
.lp-ptoast.is-minus .lp-ptoast-n { color: var(--text-dim); }
.lp-ptoast .lp-ptoast-txt { text-align: left; min-width: 0; }
.lp-ptoast .lp-ptoast-txt b {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}
.lp-ptoast .lp-ptoast-txt span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
}
body.light-theme .lp-ptoast {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .14), rgba(255, 255, 255, .95));
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
  color: #0F172A;
}
body.light-theme .lp-ptoast .lp-ptoast-txt b { color: #0F172A; }

@media (max-width: 640px) {
  .lp-cel .lp-cel-card { padding: 22px 16px 18px; border-radius: 18px; }
  .lp-cel .lp-cel-ring { width: 104px; height: 104px; }
  .lp-cel .lp-cel-ring-in { width: 86px; height: 86px; }
  .lp-ptoast {
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
    max-width: calc(100vw - 28px);
  }
  /* FAB isi kone mein hai — wo aam toast ke liye upar hat-ta hai, aur ab iske
     liye bhi. Height JS naapta hai, kyunki wo likhe hue text par nirbhar hai. */
  body.lp-ptoast-up .fab-container {
    transform: translateY(calc(-1 * (var(--lp-toast-h, 0px) + 12px)));
  }
}

@media (prefers-reduced-motion: reduce) {
  .lp-cel .lp-cel-card,
  .lp-cel .lp-cel-burst,
  .lp-cel .lp-cel-ring,
  .lp-ptoast .lp-ptoast-spark { animation: none; transition: none; transform: none; }
  .lp-ptoast { transition: opacity .2s ease; transform: translate(-50%, 0); }
  .lp-ptoast.is-up { transform: translate(-50%, 0); }
}
