:root {
  --bg: #0b0b12;
  --bg-2: #12121c;
  --card: #161622;
  --card-2: #1d1d2b;
  --line: rgba(255, 255, 255, 0.06);
  --text: #f4f4fa;
  --muted: #8d8da6;
  --dim: #5c5c74;
  --violet: #8b6cff;
  --cyan: #2dd4e6;
  --up: #3ddc97;
  --down: #ff6b81;
  --brand: linear-gradient(135deg, var(--violet), var(--cyan));
  --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: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; flex: none; }
.hidden { display: none !important; }

#app { max-width: 520px; margin: 0 auto; padding-bottom: calc(120px + var(--safe-b)); }
.screen { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Hero ─────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 14px 16px 22px;
  background: radial-gradient(120% 90% at 50% 0%, #1c1830 0%, var(--bg) 70%);
  border-bottom: 1px solid var(--line);
}
.hero-glow {
  position: absolute; inset: -40% -20% auto; height: 260px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(139, 108, 255, 0.35), transparent),
              radial-gradient(closest-side at 80% 60%, rgba(45, 212, 230, 0.18), transparent);
  filter: blur(20px);
}
.hero-top { position: relative; display: flex; align-items: center; justify-content: space-between; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.icon-btn svg { width: 20px; height: 20px; }
.profile-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; max-width: 55vw;
}
.profile-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: var(--brand); color: var(--bg); font-weight: 800; font-size: 13px;
}

.balance { position: relative; text-align: center; margin: 26px 0 22px; }
.balance-row { display: inline-flex; align-items: center; gap: 10px; }
.balance-value { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.balance-value .cents { color: var(--muted); }
.eye { color: var(--muted); display: grid; place-items: center; }
.balance-caption { color: var(--muted); font-size: 14px; margin-top: 4px; }
.dotted { color: var(--text); border-bottom: 1px dashed var(--dim); font-weight: 600; }

.actions { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.action-ic {
  width: 52px; height: 52px; border-radius: 18px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line);
  transition: transform 0.15s ease, background 0.15s ease;
}
.action:first-child .action-ic { background: var(--brand); color: var(--bg); border: 0; }
.action:active .action-ic { transform: scale(0.92); }

/* ── Promo carousel ─────────────────────────────── */
.promo-wrap { padding: 16px 16px 4px; }
.promo-track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.promo-track::-webkit-scrollbar { display: none; }
.promo {
  flex: 0 0 100%; scroll-snap-align: start;
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
}
.promo-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.promo-ic.violet { background: rgba(139, 108, 255, 0.16); color: var(--violet); }
.promo-ic.cyan { background: rgba(45, 212, 230, 0.14); color: var(--cyan); }
.promo-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.promo-body b { font-size: 15px; }
.promo-body small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.promo-chev { color: var(--dim); width: 18px; height: 18px; margin-left: auto; }
.dots { display: flex; justify-content: center; gap: 5px; margin-top: 10px; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--card-2); transition: width 0.2s, background 0.2s; }
.dots i.on { width: 18px; background: var(--brand); }

/* ── Blocks ─────────────────────────────── */
.block { padding: 18px 16px 0; }
.block-title {
  display: flex; align-items: center; gap: 4px; margin: 0 0 10px;
  font-size: 17px; font-weight: 800;
  background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.block-title svg { width: 18px; height: 18px; color: var(--cyan); }
.block-title.plain { background: none; color: var(--text); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.asset { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 2px; text-align: left; }
.asset + .asset { border-top: 1px solid var(--line); }
.coin { width: 44px; height: 44px; flex: none; }
.coin svg { width: 44px; height: 44px; }
.asset-mid { flex: 1; min-width: 0; }
.asset-name { font-weight: 700; font-size: 16px; }
.asset-sub { color: var(--muted); font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.asset-right { text-align: right; font-variant-numeric: tabular-nums; }
.asset-amt { font-weight: 700; font-size: 15px; }
.up { color: var(--up); }
.down { color: var(--down); }

.op { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.op + .op { border-top: 1px solid var(--line); }
.op-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); flex: none; }
.op-ic.in { color: var(--up); }
.op-ic.out { color: var(--violet); }
.op-mid { flex: 1; min-width: 0; }
.op-title { font-weight: 700; }
.op-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.op-amt { font-weight: 700; font-variant-numeric: tabular-nums; }

.skel { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.skel + .skel { border-top: 1px solid var(--line); }
.sk { background: linear-gradient(90deg, var(--card-2) 0%, #262636 50%, var(--card-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
.sk.c { width: 40px; height: 40px; border-radius: 50%; }
.sk.l1 { height: 12px; width: 45%; }
.sk.l2 { height: 10px; width: 28%; margin-top: 7px; }
.sk.r { height: 12px; width: 60px; margin-left: auto; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ── Tab bar ─────────────────────────────── */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(26px + var(--safe-b));
  width: min(300px, calc(100% - 32px));
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px; border-radius: 26px;
  background: rgba(22, 22, 34, 0.82); border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 20;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--dim); padding: 4px 0; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--text); }
.tab-logo { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; filter: grayscale(1) brightness(0.7); }
.tab-logo svg { width: 32px; height: 32px; }
.tab.active .tab-logo { filter: none; box-shadow: 0 0 18px rgba(139, 108, 255, 0.45); }
.brandline { position: fixed; bottom: calc(6px + var(--safe-b)); left: 0; right: 0; text-align: center; font-size: 11px; color: var(--dim); letter-spacing: 0.5px; z-index: 19; }

/* ── Pages ─────────────────────────────── */
.page-title { margin: 18px 16px 12px; font-size: 24px; font-weight: 800; }
#screen-history .card { margin: 0 16px; }
.ghost-btn { display: block; margin: 12px auto; padding: 10px 18px; border-radius: 12px; background: var(--card); color: var(--muted); font-weight: 600; }
.placeholder { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 36px; }
.ph-ic { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); color: var(--violet); margin-bottom: 16px; }
.ph-ic svg { width: 32px; height: 32px; }
.placeholder h3 { margin: 0 0 6px; font-size: 20px; }
.placeholder p { margin: 0; color: var(--muted); }

/* ── Bottom sheet ─────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 40; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 520px; margin: 0 auto; max-height: 88vh; overflow-y: auto;
  padding: 8px 16px calc(22px + var(--safe-b));
  background: var(--bg-2); border-radius: 26px 26px 0 0; border-top: 1px solid var(--line);
  transform: translateY(105%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.open { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--card-2); margin: 4px auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.sheet .lead { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 16px; text-align: left; background: var(--card); border: 1px solid var(--line); }
.pick + .pick { margin-top: 8px; }
.pick .coin, .pick .coin svg { width: 38px; height: 38px; }
.pick-chev { margin-left: auto; color: var(--dim); width: 18px; height: 18px; }
.net-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: rgba(139, 108, 255, 0.15); color: var(--violet); }

.qr-box { margin: 6px auto 14px; width: 220px; padding: 12px; border-radius: 22px; background: #fff; position: relative; }
.qr-box svg { width: 100%; height: auto; display: block; }
.qr-coin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; background: #fff; padding: 3px; }
.qr-coin svg { width: 40px; height: 40px; }
.addr { padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; word-break: break-all; text-align: center; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border-radius: 16px; font-weight: 700; background: var(--card); border: 1px solid var(--line); }
.btn.primary { background: var(--brand); color: var(--bg); border: 0; }
.btn svg { width: 18px; height: 18px; }
.note { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 184, 77, 0.08); border: 1px solid rgba(255, 184, 77, 0.2); color: #ffcf85; font-size: 13px; }
.note svg { width: 18px; height: 18px; margin-top: 1px; }

.toast { position: fixed; left: 50%; top: 16px; transform: translate(-50%, -20px); opacity: 0; padding: 10px 16px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); font-weight: 600; font-size: 14px; transition: all 0.25s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.blurred .balance-value, .blurred .asset-right, .blurred .op-amt { filter: blur(7px); }
.addr { -webkit-user-select: text; user-select: text; }
.coin img, .qr-coin img { width: 100%; height: 100%; display: block; }

/* ── Forms ─────────────────────────────── */
.field { display: block; margin-bottom: 12px; }
.field > span { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; margin: 0 4px 6px; }
.field > span b { color: var(--text); font-weight: 600; }
.input-wrap { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); transition: border-color 0.15s; }
.input-wrap:focus-within { border-color: rgba(139, 108, 255, 0.6); }
.input-wrap input, .input-wrap textarea {
  flex: 1; min-width: 0; padding: 14px 0; border: 0; outline: 0; background: none; color: var(--text);
  font: inherit; font-size: 16px; -webkit-user-select: text; user-select: text; resize: none;
}
.input-wrap input::placeholder, .input-wrap textarea::placeholder { color: var(--dim); }
.mini-btn { padding: 8px 12px; border-radius: 12px; background: var(--card-2); color: var(--cyan); font-weight: 700; font-size: 13px; flex: none; }
.mini-btn svg { width: 18px; height: 18px; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 7px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.chip img { width: 24px; height: 24px; }
.chip.on { border-color: transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--brand) border-box; border: 1.5px solid transparent; }
.chip.plain { padding: 8px 14px; }
.chips.recent { margin: -6px 0 14px; }
.chips.recent .chip { font-size: 13px; font-weight: 600; padding: 6px 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 4px 14px; margin-bottom: 12px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; font-size: 14.5px; }
.summary div + div { border-top: 1px solid var(--line); }
.summary div span { color: var(--muted); flex: none; }
.summary div b { text-align: right; word-break: break-all; font-variant-numeric: tabular-nums; }
.summary .total b { font-size: 16px; }
.btn.wide { width: 100%; margin-top: 4px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.err { color: var(--down); font-size: 13.5px; margin: -4px 4px 12px; min-height: 0; }
.ok-ic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto 14px; background: rgba(61, 220, 151, 0.12); color: var(--up); }
.ok-ic svg { width: 34px; height: 34px; }
.center { text-align: center; }
.page { padding: 0 16px; }
.svc { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); text-align: left; }
.svc + .svc { margin-top: 10px; }
.svc .promo-ic { width: 48px; height: 48px; }
.swap-arrow { display: grid; place-items: center; margin: -4px 0 8px; color: var(--dim); }
.quote { margin-top: 4px; }
.countdown { color: var(--muted); font-size: 12.5px; text-align: center; margin: 6px 0 10px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; }
.check-row + .check-row { border-top: 1px solid var(--line); }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--card-2); color: var(--muted); }
.tag.live { background: rgba(61, 220, 151, 0.12); color: var(--up); }

/* ── PIN pad ─────────────────────────────── */
.pin-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(11, 11, 18, 0.97); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 24px calc(24px + var(--safe-b)); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.pin-overlay.open { opacity: 1; pointer-events: auto; }
.pin-ic { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; background: var(--brand); color: var(--bg); margin-bottom: 18px; }
.pin-ic svg { width: 30px; height: 30px; }
.pin-title { font-size: 21px; font-weight: 800; text-align: center; }
.pin-sub { color: var(--muted); font-size: 14px; text-align: center; margin-top: 6px; min-height: 19px; max-width: 300px; }
.pin-sub.err { color: var(--down); }
.pin-dots { display: flex; gap: 16px; margin: 26px 0 30px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); transition: background 0.15s, transform 0.15s; }
.pin-dots i.on { background: var(--brand); border-color: transparent; transform: scale(1.1); }
.pin-dots.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-keys { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; }
.pin-keys button { width: 76px; height: 76px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); font-size: 28px; font-weight: 700; }
.pin-keys button:active { background: var(--card-2); transform: scale(0.95); }
.pin-keys button.ghost { background: none; border: 0; font-size: 15px; color: var(--muted); font-weight: 600; }
.pin-keys button.ghost svg { width: 26px; height: 26px; }

/* ── QR payment ─────────────────────────────── */
.qr-pay { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 18px; padding: 12px 14px; border-radius: 18px; text-align: left; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); }
.qr-pay-ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--brand); color: var(--bg); flex: none; }
.qr-pay-body { display: flex; flex-direction: column; gap: 2px; }
.qr-pay-body b { font-size: 15.5px; }
.qr-pay-body small { color: var(--muted); font-size: 12.5px; }
.qr-pay .promo-chev { margin-left: auto; }
.qr-sum { text-align: center; font-size: 40px; font-weight: 800; letter-spacing: -1px; margin: 4px 0 2px; }
.qr-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
