:root {
  --bg: #0A0E1A;
  --card: #101728;
  --border: #1A2238;
  --text: #F2F5FA;
  --text-2: #A8B3C7;
  --blue: #4F8CFF;
  --green: #22C77A;
  --red: #FF5C6C;
  --nav-h: 62px;
  --font: system-ui, -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 380px; background: radial-gradient(60% 70% at 25% 0%, rgba(79,140,255,.20), transparent 70%), radial-gradient(40% 50% at 95% 10%, rgba(34,199,122,.06), transparent 70%); pointer-events: none; }
.app { position: relative; max-width: 480px; margin: 0 auto; min-height: 100vh; padding: calc(env(safe-area-inset-top) + 14px) 18px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); }
.header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--blue); font-weight: 800; font-size: 14px; letter-spacing: .16em; }
.mark { width: 24px; height: 24px; }
.user { display: flex; align-items: center; gap: 9px; }
.user-name { font-size: 14px; font-weight: 600; color: var(--text-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--card) center/cover no-repeat; border: 1px solid var(--border); color: var(--blue); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.view { display: none; }
.view.active { display: block; }
.hero { padding: 0 2px; }
.label { font-size: 13px; color: var(--text-2); height: 18px; margin-bottom: 8px; }
.balance { font-size: 58px; line-height: 1; font-weight: 800; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balance .dec { font-size: 30px; font-weight: 600; letter-spacing: -.02em; color: var(--text-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 6px 11px; border-radius: 999px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pill span:first-child { font-size: 9px; }
.pill.up { color: var(--green); background: rgba(34,199,122,.12); }
.pill.down { color: var(--red); background: rgba(255,92,108,.12); }
.chart-wrap { margin: 10px -18px 0; }
.chart { width: 100%; height: 230px; touch-action: pan-y; }
.ranges { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin: 6px auto 0; max-width: 300px; padding: 3px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.ranges button { position: relative; z-index: 1; height: 32px; background: none; border: 0; color: var(--text-2); font: 600 13px var(--font); cursor: pointer; transition: color .2s; }
.ranges button.active { color: var(--text); }
.ranges-ind { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 4); border-radius: 9px; background: #1B2542; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); transform: translateX(100%); transition: transform .3s cubic-bezier(.3,.9,.3,1); }
.chips { display: flex; gap: 8px; margin: 18px 0 20px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.card { background: linear-gradient(180deg, rgba(79,140,255,.07), rgba(79,140,255,0) 55%), var(--card); border: 1px solid var(--border); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); border-radius: 20px; padding: 18px; }
.card-title { font-size: 14px; font-weight: 600; }
.w-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.w-pct { font-size: 28px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.bar { height: 12px; border-radius: 999px; background: #0A0E1A; border: 1px solid var(--border); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #3A6FE0, var(--blue) 70%, #7BAEFF); box-shadow: 0 0 14px rgba(79,140,255,.65); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.w-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.remaining { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.credit { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.list { padding: 4px 18px; }
.row { display: flex; justify-content: space-between; padding: 15px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row span:first-child { color: var(--text-2); }
.row span:last-child { font-weight: 600; }
.error { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px 14px; font-size: 13px; color: var(--text-2); border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.error button { background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 8px 14px; font: 700 13px var(--font); cursor: pointer; }
.error[hidden] { display: none; }
.loading { position: relative; color: transparent !important; }
.loading .dec, .loading span { color: transparent !important; }
.balance.loading, .pill.loading { background: linear-gradient(100deg, #131b30 30%, #1b2542 50%, #131b30 70%) 0 0 / 200% 100%; border-radius: 12px; animation: shimmer 1.3s linear infinite; width: fit-content; }
.balance.loading { min-width: 200px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(10,14,26,.88); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.nav-inner { position: relative; display: grid; grid-template-columns: 1fr 1fr; max-width: 480px; margin: 0 auto; }
.nav-ind { position: absolute; top: -1px; left: 0; width: 50%; height: 2px; display: flex; justify-content: center; transition: transform .35s cubic-bezier(.3,.9,.3,1); }
.nav-ind::after { content: ""; width: 34px; height: 2px; border-radius: 2px; background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.nav-btn { height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: 0; color: #6C7894; font: 600 11px var(--font); cursor: pointer; transition: color .2s, transform .15s; }
.nav-btn:active { transform: scale(.94); }
.nav-btn svg { width: 23px; height: 23px; fill: currentColor; }
.nav-btn.active { color: var(--blue); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
#trade-list > div:last-child { border-bottom: none !important; padding-bottom: 0 !important; }

/* Active Trade Pulse Animation */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--blue);
  box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.7);
  animation: pulse-blue 1.5s infinite;
}
@keyframes pulse-blue {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(79, 140, 255, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 140, 255, 0); }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
