:root {
  --bg: #0b0a1f;
  --bg2: #110f2b;
  --card: #17143a;
  --card2: #1f1b4c;
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .14);
  --text: #f5f3ff;
  --muted: #9a94c7;
  --violet: #7c5cff;
  --violet2: #a68fff;
  --gold: #ffcb3d;
  --gold2: #ffe08a;
  --green: #34d399;
  --red: #ff6b81;
  --r: 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); overflow-x: hidden; max-width: 100%; }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background:
    radial-gradient(600px 300px at 85% -60px, rgba(124, 92, 255, .35), transparent 70%),
    radial-gradient(400px 260px at -10% 30%, rgba(255, 203, 61, .06), transparent 70%),
    var(--bg);
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; }
b { font-weight: 650; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

#app { max-width: 520px; margin: 0 auto; padding: 0 14px calc(150px + var(--safe-b)); }

/* ── Header ───────────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; letter-spacing: -.3px; }
.brand b { color: var(--gold); font-weight: 750; }
.logo { width: 34px; height: 34px; }
.chip-balance { display: flex; gap: 6px; align-items: center; padding: 8px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; }

/* ── Cards ────────────────────────────── */
.card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.card h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.hero { padding: 6px 2px 14px; }
.hero h1 { margin: 0; font-size: 26px; letter-spacing: -.6px; line-height: 1.15; }
.hero p { margin: 6px 0 0; color: var(--muted); }
.trust { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.trust span { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: #d6d1ff; }

/* ── Segmented ────────────────────────── */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(0, 0, 0, .25); padding: 4px; border-radius: 14px; gap: 4px; }
.seg button { padding: 10px 8px; border-radius: 11px; font-weight: 600; color: var(--muted); transition: .15s; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button.on { background: var(--violet); color: #fff; box-shadow: 0 6px 18px rgba(124, 92, 255, .35); }

/* ── Inputs ───────────────────────────── */
.field { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; margin-top: 12px; transition: border-color .15s; }
.field:focus-within { border-color: var(--violet); }
.field input, .field textarea { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 13px 0; font-size: 16px; }
.field textarea { resize: none; min-height: 84px; }
.field .pre { color: var(--muted); font-weight: 600; }
.rcp { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; min-height: 22px; }
.rcp img, .rcp .ava { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--violet); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.rcp .ok { color: var(--green); }
.rcp .err { color: var(--red); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips button { font-size: 13px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }

/* ── Quantity ─────────────────────────── */
.qty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 0 2px; }
.qty .star { font-size: 30px; filter: drop-shadow(0 4px 12px rgba(255, 203, 61, .45)); }
.qty input { width: 100%; max-width: 260px; min-width: 0; padding: 0; margin: 0; text-align: center; font-size: 44px; font-weight: 750; letter-spacing: -1px; background: none; border: 0; outline: 0; font-variant-numeric: tabular-nums; -webkit-appearance: none; appearance: none; text-indent: 0; }
.qty-sub { text-align: center; color: var(--muted); font-size: 14px; }
.qty-sub b { color: var(--text); }
.packs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.packs button { padding: 10px 4px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); text-align: center; transition: .15s; }
.packs button b { display: block; font-size: 15px; }
.packs button small { color: var(--muted); font-size: 11px; }
.packs button.on { border-color: var(--gold); background: rgba(255, 203, 61, .1); }
.nudge { margin-top: 14px; font-size: 13px; color: #ffe7a3; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--gold)); border-radius: 6px; transition: width .25s; }

/* ── Options (methods, plans) ─────────── */
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); text-align: left; transition: .15s; width: 100%; }
.opt .ic { width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, .06); display: grid; place-items: center; font-size: 20px; flex: none; }
.opt .tx { flex: 1; min-width: 0; }
.opt .tx b { display: block; font-size: 15px; }
.opt .tx small { color: var(--muted); font-size: 12px; }
.opt .pr { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.opt .pr s { display: block; color: var(--muted); font-weight: 500; font-size: 12px; text-align: right; }
.opt.on { border-color: var(--violet); background: rgba(124, 92, 255, .12); }
.opt .badge { font-size: 11px; font-weight: 700; color: #1b1300; background: var(--gold); padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.opt[disabled] { opacity: .45; }

/* ── Summary ──────────────────────────── */
.sum { display: grid; gap: 6px; font-size: 14px; }
.sum div { display: flex; justify-content: space-between; gap: 12px; }
.sum div span:first-child { color: var(--muted); }
.sum .total { font-size: 18px; font-weight: 750; padding-top: 8px; margin-top: 4px; border-top: 1px dashed var(--line2); }
.sum .total span:first-child { color: var(--text); }
.green { color: var(--green); }

/* ── Gifts ────────────────────────────── */
.gifts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gift { padding: 14px 6px 10px; border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); text-align: center; position: relative; }
.gift .e { font-size: 38px; line-height: 1.1; display: block; }
.gift b { display: block; margin-top: 6px; font-size: 14px; }
.gift small { color: var(--muted); font-size: 11px; }
.gift .ltd { position: absolute; top: 6px; right: 6px; font-size: 9px; font-weight: 700; background: var(--violet); color: #fff; border-radius: 6px; padding: 1px 5px; }
.gift.on { border-color: var(--gold); background: rgba(255, 203, 61, .1); }

/* ── Profile ──────────────────────────── */
.me { display: flex; align-items: center; gap: 14px; }
.me .ava { width: 54px; height: 54px; border-radius: 18px; background: linear-gradient(135deg, var(--violet), #4b2fd6); display: grid; place-items: center; font-size: 22px; font-weight: 750; }
.me b { font-size: 18px; display: block; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.tile { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.tile small { color: var(--muted); font-size: 12px; display: block; }
.tile b { font-size: 20px; letter-spacing: -.4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 12px; }
.stats b { display: block; font-size: 18px; }
.stats small { color: var(--muted); font-size: 12px; }
.linkbox { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .25); border: 1px dashed var(--line2); border-radius: 14px; padding: 10px 12px; margin-top: 12px; font-size: 13px; word-break: break-all; }
.linkbox span { flex: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 14px; font-weight: 650; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); width: 100%; }
.btn.primary { background: var(--violet); border-color: transparent; }
.btn.gold { background: var(--gold); color: #1b1300; border-color: transparent; }
.btn.sm { padding: 8px 12px; width: auto; font-size: 13px; border-radius: 11px; }
.list { display: grid; }
.list button, .list a { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); text-align: left; color: inherit; text-decoration: none; }
.list > :last-child { border-bottom: 0; }
.list .ic { width: 34px; height: 34px; border-radius: 11px; background: rgba(255, 255, 255, .06); display: grid; place-items: center; font-size: 17px; flex: none; }
.list .tx { flex: 1; }
.list .tx small { display: block; color: var(--muted); font-size: 12px; }
.list .arr { color: var(--muted); }

/* ── Orders / reviews ─────────────────── */
.ord { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.ord:last-child { border-bottom: 0; }
.ord .tx { flex: 1; min-width: 0; }
.ord .tx small { color: var(--muted); font-size: 12px; display: block; }
.st { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.st.completed { background: rgba(52, 211, 153, .15); color: var(--green); }
.st.pending, .st.paid, .st.processing { background: rgba(255, 203, 61, .14); color: var(--gold); }
.st.failed, .st.expired, .st.refunded { background: rgba(255, 107, 129, .14); color: var(--red); }
.rate-head { display: flex; align-items: center; gap: 16px; }
.rate-head .big { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; }
.stars-row { color: var(--gold); letter-spacing: 2px; }
.rev { padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); margin-bottom: 8px; }
.rev .h { display: flex; align-items: center; gap: 10px; }
.rev .h .ava { width: 34px; height: 34px; border-radius: 50%; background: var(--violet); display: grid; place-items: center; font-weight: 700; flex: none; }
.rev .h small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.rev p { margin: 10px 0 4px; }
.rev time { color: var(--muted); font-size: 12px; }
.picker { display: flex; gap: 6px; justify-content: center; font-size: 34px; margin: 4px 0 6px; }
.picker button { filter: grayscale(1) opacity(.35); transition: .12s; }
.picker button.on { filter: none; transform: scale(1.06); }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .e { font-size: 42px; display: block; margin-bottom: 8px; }

/* ── CTA ──────────────────────────────── */
.cta-wrap { position: fixed; left: 0; right: 0; bottom: calc(68px + var(--safe-b)); padding: 10px 14px; z-index: 6; max-width: 520px; margin: 0 auto;
  background: linear-gradient(transparent, var(--bg) 40%); }
.cta { width: 100%; padding: 16px; border-radius: 16px; font-weight: 750; font-size: 16px; color: #1b1300;
  background: linear-gradient(135deg, var(--gold2), var(--gold)); box-shadow: 0 10px 30px rgba(255, 203, 61, .28); transition: .15s; }
.cta:disabled { background: var(--card2); color: var(--muted); box-shadow: none; }
.tg-main .cta-wrap { display: none !important; }
.tg-main #app { padding-bottom: calc(90px + var(--safe-b)); }

/* ── Tabs ─────────────────────────────── */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: grid; grid-template-columns: repeat(4, 1fr); max-width: 520px; margin: 0 auto;
  padding: 6px 8px calc(8px + var(--safe-b)); background: rgba(17, 15, 43, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabs button { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs button i { font-style: normal; font-size: 21px; filter: grayscale(1) opacity(.6); transition: .15s; }
.tabs button.on { color: var(--text); }
.tabs button.on i { filter: none; transform: translateY(-1px); }
.subpage .tabs { display: none; }

/* ── Sheet ────────────────────────────── */
.sheet-bg { position: fixed; inset: 0; background: rgba(4, 3, 15, .65); z-index: 20; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 520px; margin: 0 auto; max-height: 92vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); animation: up .25s cubic-bezier(.2, .9, .3, 1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line2); margin: 0 auto 14px; }
.sheet h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.pay-amount { text-align: center; margin: 18px 0 6px; }
.pay-amount b { font-size: 38px; letter-spacing: -1px; display: block; }
.pay-amount small { color: var(--muted); }
.qr { display: block; width: 210px; height: 210px; margin: 14px auto; border-radius: 18px; background: #fff; padding: 8px; }
.copy { display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 13px; margin-top: 8px; font-size: 13px; text-align: left; width: 100%; }
.copy span { flex: 1; min-width: 0; word-break: break-all; }
.copy small { display: block; color: var(--muted); font-size: 11px; }
.status { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 16px 0 8px; color: var(--muted); font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s infinite; }
.success { text-align: center; padding: 18px 0 6px; }
.success .e { font-size: 64px; display: block; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.success h2 { margin-top: 8px; }
.success p { color: var(--muted); margin: 6px 0 18px; }
.link { color: var(--muted); text-align: center; display: block; width: 100%; margin-top: 12px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); z-index: 30; background: #fff; color: #110f2b; font-weight: 600; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 86vw; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: fade .2s; }
.loader { display: grid; place-items: center; padding: 80px 0; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--violet); animation: rot .8s linear infinite; }
.pagehead { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.pagehead h1 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.back { width: 36px; height: 36px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 18px; }
.tg .back { display: none; }
.note { font-size: 13px; color: var(--muted); margin-top: 10px; }

@keyframes rot { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40%); opacity: .4; } }
@keyframes pulse { 50% { opacity: .3; transform: scale(.8); } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
