:root {
  --bg: #090b17;
  --bg2: #0f1226;
  --card: rgba(255, 255, 255, 0.045);
  --card-hi: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f1f2ff;
  --muted: #9097c0;
  --gold: #ffc83d;
  --gold2: #ff9f1c;
  --violet: #7c5cff;
  --ok: #3ddc97;
  --bad: #ff6b6b;
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Vazirmatn, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, 0.35), transparent 60%),
    radial-gradient(700px 400px at 0% 10%, rgba(255, 159, 28, 0.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.bg-stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.55;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 20%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 70%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 60%, #ffe8a3 50%, transparent 51%),
    radial-gradient(1px 1px at 10% 85%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 45%, #fff 50%, transparent 51%);
  background-size: 260px 260px;
  animation: drift 60s linear infinite;
}
@keyframes drift { to { background-position: 0 -260px; } }

#app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding: 8px 16px 0; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 14px 0 6px; }
.star-wrap { position: relative; width: 104px; height: 104px; margin: 0 auto 6px; }
.star {
  width: 104px; height: 104px;
  filter: drop-shadow(0 0 22px rgba(255, 200, 61, 0.55)) drop-shadow(0 8px 18px rgba(255, 138, 0, 0.35));
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-6px) rotate(-4deg) scale(1.03); } }
.spark { position: absolute; width: 8px; height: 8px; background: #fff; border-radius: 50%; box-shadow: 0 0 12px #ffe27a; opacity: 0; animation: twinkle 2.4s ease-in-out infinite; }
.s1 { top: 6px; right: 2px; } .s2 { bottom: 14px; left: -4px; animation-delay: .8s; width: 6px; height: 6px; } .s3 { top: 40px; left: -12px; animation-delay: 1.6s; width: 4px; height: 4px; }
@keyframes twinkle { 50% { opacity: 1; transform: scale(1.4); } }
.hero h1 { font-size: 24px; font-weight: 900; margin: 4px 0 2px; letter-spacing: -0.3px; }
.sub { margin: 0; color: var(--muted); font-size: 14px; }
.sub b { color: #cfe3ff; }
.chips { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.chip { font-size: 12.5px; padding: 6px 12px; border-radius: 99px; background: rgba(255, 200, 61, 0.12); color: var(--gold); border: 1px solid rgba(255, 200, 61, 0.25); }
.chip.warn { background: rgba(124, 92, 255, 0.15); color: #c9bbff; border-color: rgba(124, 92, 255, 0.35); }

/* ---------- tabs ---------- */
.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 18px 0 6px; padding: 4px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.tab { position: relative; z-index: 1; padding: 10px; border: 0; background: none; font-weight: 700; color: var(--muted); transition: color .2s; }
.tab.active { color: var(--text); }
.tab-ind { position: absolute; top: 4px; bottom: 4px; right: 4px; width: calc(50% - 4px); border-radius: 12px; background: var(--card-hi); border: 1px solid var(--line); transition: transform .3s cubic-bezier(.2, .9, .3, 1.2); }
.tabs[data-active="orders"] .tab-ind { transform: translateX(-100%); }

/* ---------- buy ---------- */
.label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 20px 4px 10px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pkg {
  position: relative; padding: 14px 6px 12px; border-radius: 18px; text-align: center;
  background: var(--card); border: 1.5px solid var(--line);
  transition: transform .15s, border-color .2s, background .2s, box-shadow .2s;
}
.pkg:active { transform: scale(.96); }
.pkg .n { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 20px; font-weight: 900; }
.pkg .n i { font-style: normal; font-size: 16px; }
.pkg .p { margin-top: 4px; font-size: 12px; color: var(--muted); }
.pkg .tag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: linear-gradient(135deg, #7c5cff, #b55cff); color: #fff; white-space: nowrap; }
.pkg.sel { border-color: var(--gold); background: linear-gradient(160deg, rgba(255, 200, 61, 0.16), rgba(255, 159, 28, 0.05)); box-shadow: 0 0 0 4px rgba(255, 200, 61, 0.08), 0 10px 30px -10px rgba(255, 159, 28, 0.5); }
.pkg.sel .p { color: #ffe3a1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.custom { margin-top: 10px; transition: border-color .2s; }
.custom.sel { border-color: var(--gold); }
.custom-head { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; margin-bottom: 10px; }
.custom-head .muted { font-weight: 400; font-size: 12px; }
.stepper { display: flex; gap: 8px; }
.stepper input { flex: 1; min-width: 0; text-align: center; font-size: 18px; font-weight: 800; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); outline: none; }
.stepper input:focus { border-color: var(--gold); }
.step { width: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-hi); font-size: 22px; font-weight: 700; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.seg-btn { padding: 12px 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; transition: all .2s; }
.seg-btn.active { border-color: var(--violet); background: rgba(124, 92, 255, 0.16); }
.recip { display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 18px; background: linear-gradient(135deg, #7c5cff, #ff9f1c); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.me .who b { display: block; }
.me .who span { font-size: 13px; color: var(--muted); direction: ltr; display: inline-block; }
.warnbox { font-size: 13px; line-height: 1.9; color: #ffd38a; }
.at-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, 0.25); padding: 0 12px; direction: ltr; }
.at-input span { color: var(--muted); font-weight: 700; }
.at-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 12px 6px; font-size: 16px; }
.at-input:focus-within { border-color: var(--violet); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.recip-preview { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.recip-preview.ok { color: var(--ok); } .recip-preview.bad { color: var(--bad); }

.summary .row { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px; font-size: 14px; border-bottom: 1px dashed var(--line); }
.summary .row span { color: var(--muted); }
.summary .row:last-child { border: 0; }
.summary .total b { font-size: 18px; color: var(--gold); }
.secure { text-align: center; font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }
.spacer { height: calc(110px + var(--safe-b)); }

/* ---------- pay bar ---------- */
.paybar { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(14px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 55%, transparent); }
.pay {
  position: relative; overflow: hidden; display: block; width: 100%; max-width: 520px; margin: 0 auto; padding: 16px; border: 0; border-radius: 18px;
  font-size: 16.5px; font-weight: 900; color: #1d1400;
  background: linear-gradient(135deg, #ffe07a, #ffb02e 50%, #ff8a00);
  box-shadow: 0 12px 30px -8px rgba(255, 159, 28, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform .15s, opacity .2s, filter .2s;
}
.pay:active { transform: scale(.98); }
.pay:disabled { filter: grayscale(.9) brightness(.55); box-shadow: none; }
.pay .shine { position: absolute; top: 0; bottom: 0; width: 60px; left: -80px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent); transform: skewX(-20deg); animation: shine 3s ease-in-out infinite; }
.pay:disabled .shine { display: none; }
@keyframes shine { 60%, 100% { left: 110%; } }
.pay.loading .pay-text { opacity: .4; }

/* ---------- orders ---------- */
.orders { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 calc(40px + var(--safe-b)); }
.order { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.order .ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: rgba(255, 200, 61, 0.12); }
.order b { display: block; font-size: 15px; }
.order small { color: var(--muted); font-size: 12px; }
.order .amt { text-align: left; font-size: 13px; }
.badge { display: inline-block; margin-top: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--card-hi); }
.badge.delivered { background: rgba(61, 220, 151, 0.15); color: var(--ok); }
.badge.pending { background: rgba(255, 200, 61, 0.14); color: var(--gold); }
.badge.paid, .badge.delivering { background: rgba(124, 92, 255, 0.18); color: #c9bbff; }
.badge.failed { background: rgba(255, 107, 107, 0.15); color: var(--bad); }
.badge.canceled { color: var(--muted); }
.order .act { grid-column: 1 / -1; display: flex; gap: 8px; }
.mini { flex: 1; padding: 9px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-hi); font-size: 13px; font-weight: 700; }
.empty { text-align: center; padding: 50px 10px; color: var(--muted); }
.empty div { font-size: 44px; margin-bottom: 8px; }
.skel { height: 74px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, var(--card-hi) 50%, var(--card) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(4, 5, 12, 0.65); backdrop-filter: blur(6px); animation: fade .2s; }
.sheet-card { width: 100%; max-width: 520px; margin: 0 auto; padding: 26px 20px calc(22px + var(--safe-b)); border-radius: 28px 28px 0 0; background: linear-gradient(180deg, #171a33, #0f1226); border: 1px solid var(--line); border-bottom: 0; text-align: center; animation: up .35s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(100%); } }
.sheet h3 { margin: 10px 0 6px; font-size: 20px; }
.sheet p { margin: 0 0 6px; color: var(--muted); line-height: 1.9; font-size: 14px; }
.big { font-size: 60px; line-height: 1; }
.pulse { animation: pulse 1.4s ease-in-out infinite; display: inline-block; }
@keyframes pulse { 50% { transform: scale(1.15); filter: drop-shadow(0 0 18px #ffc83d); } }
.sheet .btns { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.btn2 { padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card-hi); font-weight: 800; }
.btn2.gold { border: 0; color: #1d1400; background: linear-gradient(135deg, #ffe07a, #ff9f1c); }
.steps { display: flex; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.steps i { width: 30px; height: 5px; border-radius: 9px; background: var(--line); }
.steps i.on { background: var(--gold); }

.toast { position: fixed; z-index: 30; left: 50%; top: 16px; transform: translateX(-50%); max-width: 90%; padding: 10px 16px; border-radius: 14px; background: #2a1d24; border: 1px solid rgba(255, 107, 107, 0.4); color: #ffd2d2; font-size: 14px; animation: fade .2s; }
#confetti { position: fixed; inset: 0; z-index: 25; pointer-events: none; width: 100%; height: 100%; }
