/* ============ Design tokens ============ */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --ink: #0b1324;
  --ink-2: #334155;
  --muted: #6b7486;
  --line: #e6e9f0;

  --navy-1: #0a1a35;
  --navy-2: #12305a;
  --navy-3: #1b4a85;

  --primary: #0e9f6e;
  --primary-2: #057a55;
  --primary-soft: #e3f6ee;
  --gold: #f5b942;
  --gold-2: #e09b1a;
  --sky: #0ea5e9;
  --violet: #7c5cff;
  --danger: #e5484d;

  --radius: 20px;
  --shadow: 0 1px 2px rgba(11, 19, 36, .04), 0 6px 20px rgba(11, 19, 36, .06);
  --shadow-lg: 0 16px 40px rgba(10, 26, 53, .28);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #131c2e;
  --surface-2: #1a2438;
  --ink: #eef2f8;
  --ink-2: #c7d0de;
  --muted: #8b97ab;
  --line: #24304a;
  --primary-soft: rgba(14, 159, 110, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Hind Siliguri', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 92px;
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; background: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.accent { color: var(--primary); }
.center { text-align: center; }
.num, .t-val, .wallet-amount, .eh-amount, .tb-val { font-family: 'Inter', 'Hind Siliguri', sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

input {
  font-family: inherit; font-size: 16px; width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: 14px; outline: none;
  background: var(--surface-2); color: var(--ink); transition: border-color .15s, background .15s;
}
input:focus { border-color: var(--primary); background: var(--surface); }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--navy-1);
  color: #fff;
}
.avatar {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #34d399);
  display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff;
  font-family: 'Inter', sans-serif;
}
.avatar.xl { width: 76px; height: 76px; border-radius: 24px; font-size: 28px; margin: 0 auto; box-shadow: 0 0 0 4px rgba(255,255,255,.15); }
.who { flex: 1; min-width: 0; }
.name { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verified { width: 16px; height: 16px; background: #3b82f6; border-radius: 50%; padding: 2px; stroke-width: 3.5; color: #fff; }
.hello { font-size: 13px; color: #9fb0cc; }
.top-bal { text-align: right; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 5px 12px; }
.tb-label { font-size: 11px; color: #9fb0cc; }
.tb-val { font-weight: 700; font-size: 16px; color: var(--gold); }

main { padding: 16px 16px 0; }
.page { display: none; animation: fade .25s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ Wallet card ============ */
.wallet {
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 20px; color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(245,185,66,.22), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(14,159,110,.35), transparent 60%),
    linear-gradient(145deg, var(--navy-2), var(--navy-1));
  box-shadow: var(--shadow-lg);
}
.wallet::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: linear-gradient(180deg, #000, transparent 70%);
}
.wallet > * { position: relative; z-index: 1; }
.wallet-top { display: flex; justify-content: space-between; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; background: rgba(14,159,110,.2); color: #6ee7b7; border: 1px solid rgba(110,231,183,.25); padding: 4px 11px; border-radius: 99px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52,211,153,.7); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.brand-mark { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 13px; letter-spacing: .04em; padding: 5px 9px; border-radius: 9px; background: rgba(255,255,255,.1); color: var(--gold); }
.wallet-label { margin-top: 18px; color: #b6c3da; font-size: 14px; }
.wallet-amount { font-size: 46px; font-weight: 800; line-height: 1.1; margin: 2px 0 14px; }
.wallet-progress { margin-bottom: 16px; }
.wp-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; color: inherit; }
.wallet .wp-row { color: #b6c3da; }
.track { height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.track.light { background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 16px; }
.track.dark { background: rgba(255,255,255,.12); margin: 12px 0 8px; }
.fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), #34d399); transition: width .5s ease; }
.fill.gold, .wallet .fill { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.fill.sky { background: linear-gradient(90deg, #0284c7, var(--sky)); }

.btn-gold, .btn-primary, .btn-secondary, .btn-outline {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: 14px; font-size: 16.5px; font-weight: 700; transition: transform .1s, opacity .15s;
}
.btn-gold:active, .btn-primary:active, .btn-secondary:active, .btn-outline:active { transform: scale(.98); }
.btn-gold { background: linear-gradient(180deg, #ffd27a, var(--gold)); color: #3d2a00; box-shadow: 0 6px 18px rgba(245,185,66,.35); }
.btn-gold svg { fill: currentColor; stroke: none; width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, #13b37d, var(--primary)); color: #fff; box-shadow: 0 6px 16px rgba(14,159,110,.28); margin-top: 14px; }
.btn-secondary { background: linear-gradient(180deg, #1aa9ef, #0284c7); color: #fff; box-shadow: 0 6px 16px rgba(2,132,199,.25); }
.btn-outline { border: 1.5px solid var(--line); color: var(--ink); margin-top: 10px; background: var(--surface); }
.btn-primary:disabled, .btn-secondary:disabled { opacity: .5; box-shadow: none; }
.big-btn { padding: 15px; font-size: 17px; }
#watchAd svg, #watchAd use { fill: currentColor; stroke: none; }

/* ============ Tiles & cards ============ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.t-label { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.t-val { font-size: 22px; font-weight: 700; margin-top: 2px; }

.ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.ic svg { width: 20px; height: 20px; }
.ic.big { width: 52px; height: 52px; border-radius: 16px; }
.ic.big svg { width: 26px; height: 26px; }
.ic.huge { width: 68px; height: 68px; border-radius: 22px; margin: 4px auto 12px; }
.ic.huge svg { width: 32px; height: 32px; }
.ic-emerald { background: var(--primary-soft); color: var(--primary); }
.ic-blue { background: rgba(59,130,246,.12); color: #3b82f6; }
.ic-violet { background: rgba(124,92,255,.12); color: var(--violet); }
.ic-amber { background: rgba(245,185,66,.16); color: var(--gold-2); }
.ic-sky { background: rgba(14,165,233,.12); color: var(--sky); }

.card { background: var(--surface); border-radius: var(--radius); padding: 18px; margin-top: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; gap: 12px; }
.card-title { font-weight: 700; font-size: 17px; }
.card-title.lg { font-size: 20px; }
.ref-pill { margin-left: auto; font-family: 'Inter', sans-serif; font-weight: 800; color: var(--primary); background: var(--primary-soft); padding: 6px 12px; border-radius: 10px; }
.field-label { font-weight: 600; font-size: 14px; color: var(--ink-2); margin: 16px 0 7px; }
.copybox { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1.5px dashed var(--line); border-radius: 14px; padding: 6px 6px 6px 14px; }
.copybox span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--ink-2); font-family: 'Inter', sans-serif; }
.copybox button { background: var(--surface); border: 1px solid var(--line); color: var(--primary); border-radius: 10px; width: 42px; height: 38px; display: grid; place-items: center; }
.note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }

.row-link { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.rl-text { flex: 1; }
.join { background: var(--sky); color: #fff; font-weight: 700; padding: 8px 18px; border-radius: 99px; font-size: 14px; }

.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.trust div { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px; }
.trust svg { color: var(--primary); }

/* ============ Earn ============ */
.earn-hero { border-radius: 22px; padding: 20px; color: #fff; text-align: center; background: linear-gradient(145deg, var(--navy-2), var(--navy-1)); box-shadow: var(--shadow-lg); }
.eh-label { color: #b6c3da; font-size: 14px; }
.eh-amount { font-size: 40px; font-weight: 800; color: var(--gold); margin: 2px 0; }
.eh-sub { color: #b6c3da; font-size: 13.5px; }
.task-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.task-info { flex: 1; }
.tips { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: var(--primary-soft); color: var(--ink-2); font-size: 14px; }
.tips-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--primary-2); }
[data-theme="dark"] .tips-title { color: #6ee7b7; }
.tips ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; }

details { border-top: 1px solid var(--line); padding: 12px 0; }
details:first-of-type { margin-top: 10px; }
summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
summary::after { content: '+'; color: var(--muted); font-size: 18px; }
details[open] summary::after { content: '−'; }
details p { color: var(--muted); margin: 8px 0 0; line-height: 1.6; }

/* ============ Withdraw ============ */
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.methods button { padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: 15px; font-weight: 700; border: 1.5px solid var(--line); color: var(--ink-2); font-family: 'Inter', sans-serif; }
.methods button.sel { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.amount-row { display: flex; gap: 8px; }
.max-btn { padding: 0 16px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.list .item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.list .item:last-child { border-bottom: 0; }
.list .item b { font-family: 'Inter', sans-serif; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 0 6px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.pill.pending { background: rgba(245,185,66,.16); color: var(--gold-2); }
.pill.paid { background: var(--primary-soft); color: var(--primary); }
.pill.rejected { background: rgba(229,72,77,.12); color: var(--danger); }
.pos { color: var(--primary); }

/* ============ Profile ============ */
.profile-head { text-align: center; padding: 22px 16px 20px; border-radius: 24px; color: #fff; background: linear-gradient(145deg, var(--navy-2), var(--navy-1)); box-shadow: var(--shadow-lg); }
.ph-name { font-size: 20px; font-weight: 700; margin-top: 10px; }
.ph-id { color: #9fb0cc; font-size: 13px; font-family: 'Inter', sans-serif; }
.section-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin: 20px 2px 0; }
.section-title svg { color: var(--primary); }
.list-card { padding: 4px 16px; }
.lc-row { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); font-size: 15.5px; text-align: left; }
.lc-row:last-child { border-bottom: 0; }
.lc-row span { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.lc-row span svg { color: var(--muted); }
.lc-row b { font-family: 'Inter', sans-serif; font-size: 17px; }
.chev { color: var(--muted); width: 18px; height: 18px; }
.rules { padding-left: 20px; line-height: 1.8; color: var(--ink-2); margin-bottom: 0; }

/* ============ Ads ============ */
.ad-slot { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 14px; }
.ad-slot:empty { display: none; }
.ad-slot iframe { border: 0; width: 320px; max-width: 100%; height: 50px; border-radius: 8px; }
.ad-slot iframe.custom { height: auto; min-height: 50px; }

/* ============ Tab bar ============ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.tab { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 12px; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--primary); }
.tab.active svg { background: var(--primary-soft); border-radius: 10px; padding: 3px; width: 36px; height: 28px; }

/* ============ Toast / overlay ============ */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(16px);
  background: var(--navy-1); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; text-align: center; z-index: 50; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.ok { background: var(--primary-2); }
.toast.err { background: var(--danger); }
.overlay { position: fixed; inset: 0; background: rgba(10,26,53,.72); backdrop-filter: blur(4px); z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; gap: 14px; font-size: 17px; padding: 20px; text-align: center; }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--gold); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
