:root {
  color-scheme: dark;
  --bg: #070b16;
  --panel: rgba(16, 26, 48, .82);
  --panel-2: rgba(28, 42, 74, .82);
  --line: rgba(148, 163, 184, .18);
  --text: #e5edf8;
  --muted: #91a2bd;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --danger: #fb7185;
  --ok: #34d399;
  --warn: #fcd34d;
  --shadow: 0 28px 90px rgba(0, 0, 0, .46);
  --glow: 0 0 38px rgba(34, 211, 238, .28), 0 0 70px rgba(139, 92, 246, .2);
  --dock-h: calc(76px + env(safe-area-inset-bottom, 0px));
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(139, 92, 246, .35), transparent 29rem),
    radial-gradient(circle at 88% 16%, rgba(34, 211, 238, .22), transparent 27rem),
    radial-gradient(circle at 78% 88%, rgba(244, 114, 182, .14), transparent 30rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow: hidden;
}
body::before, body::after {
  content: "";
  position: fixed;
  width: 34rem;
  height: 34rem;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(24px);
  opacity: .22;
  z-index: 0;
  animation: drift 18s ease-in-out infinite alternate;
}
body::before {
  left: -10rem;
  top: 10rem;
  background: conic-gradient(from 180deg, var(--accent), transparent, var(--accent-2), transparent);
}
body::after {
  right: -12rem;
  bottom: -8rem;
  background: conic-gradient(from 20deg, var(--accent-3), transparent, var(--accent-2), transparent);
  animation-delay: -6s;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  to { transform: translate3d(4rem, -2rem, 0) rotate(18deg) scale(1.08); }
}
@keyframes floatIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

button, input, textarea, select { font: inherit; color: inherit; }
button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease, border-color .18s ease;
}
button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.18), transparent);
  transform: translateX(-120%);
  transition: transform .45s ease;
  pointer-events: none;
}
@media (hover: hover) {
  button:hover::after { transform: translateX(120%); }
  button:hover { transform: translateY(-2px); background: rgba(42, 59, 101, .95); box-shadow: 0 10px 32px rgba(0,0,0,.18); }
}
.hidden { display: none !important; }

.boot {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.logo-img {
  width: 46px; height: 46px; border-radius: 14px;
  object-fit: cover; display: block;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.boot-spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: floatIn .45s ease both;
}
.screen {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(var(--dock-h) + 14px);
}
.screen.onboard { padding-bottom: 28px; }

.brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.brand h1, .h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.4px;
}
.lead { color: var(--muted); line-height: 1.45; margin: 0 0 22px; text-align: center; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.btn, .btn-primary, .btn-ghost, .btn-danger {
  width: 100%;
  padding: 14px 16px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary, button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07111f;
  box-shadow: var(--glow);
  font-weight: 800;
}
.btn-ghost, button.ghost {
  background: transparent;
  border: 1px solid var(--line);
}
.btn-danger, button.danger {
  color: #ffe4e9;
  background: rgba(251, 113, 133, .18);
}
button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.card, .addr-card, .login-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(17, 28, 51, .84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 18px;
}

.seed-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 18px;
}
.seed-item, .seed-input {
  background: rgba(5, 10, 24, .68);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
}
.seed-item b, .seed-input b { color: var(--muted); font-weight: 600; min-width: 18px; font-size: 12px; }
.seed-item span { font-weight: 600; }
.seed-input input {
  flex: 1; background: transparent; border: 0; outline: none; min-width: 0; font-weight: 600; width: auto; padding: 0;
}
.warn {
  background: rgba(252, 211, 77, .08); color: var(--warn);
  border: 1px solid rgba(252, 211, 77, .22);
  border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.4; margin-bottom: 14px;
}

.pin-dots { display: flex; justify-content: center; gap: 10px; margin: 22px 0 18px; }
.pin-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
}
.pin-dot.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: var(--glow);
}
.pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto;
}
.pad button {
  height: 58px; font-size: 22px; font-weight: 700; border-radius: 16px;
}
.pad button.muted { color: var(--muted); font-size: 15px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.wallet-name { font-weight: 800; font-size: 15px; letter-spacing: -.2px; }
.eye {
  width: 38px; height: 38px; border-radius: 12px; padding: 0;
  display: grid; place-items: center;
}
.balance {
  font-size: 34px; font-weight: 800; letter-spacing: -.8px; margin: 10px 0 4px;
}
.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.actions-3 { grid-template-columns: 1fr 1fr 1fr; }
.action {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-weight: 700; font-size: 12px;
  backdrop-filter: blur(18px);
}
.token-mid { min-width: 0; flex: 1; }
.chg { font-style: normal; font-weight: 700; margin-left: 4px; }
.chg.up { color: var(--ok); }
.chg.down { color: var(--danger); }
.swap-card { text-align: left; }
.swap-out {
  margin-top: 8px; font-size: 22px; font-weight: 800; letter-spacing: -.4px;
}
.swap-flip {
  width: 42px; height: 42px; margin: -4px auto 8px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--accent-2);
}
.net-pills.tight { padding: 0 0 10px; }
.swap-hash {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.action {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-weight: 700; font-size: 13px;
  backdrop-filter: blur(18px);
}
.action svg { width: 22px; height: 22px; color: var(--accent-2); }

.section-title {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: 13px; font-weight: 650; margin: 8px 0;
}
.token {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
  backdrop-filter: blur(16px);
  animation: floatIn .35s ease both;
}
.token-ic {
  width: 40px; height: 40px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #07111f; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  overflow: hidden;
}
.token-ic img { width: 100%; height: 100%; object-fit: cover; }
.token-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.token-net { color: var(--muted); font-size: 12px; }
.token-amt { margin-left: auto; text-align: right; }
.token-amt b { display: block; font-size: 14px; }
.token-amt span { color: var(--muted); font-size: 12px; }

.qr-box {
  width: 196px; height: 196px; margin: 8px auto 14px;
  background: #fff; border-radius: 16px; padding: 10px;
  display: grid; place-items: center;
}
.qr-box img, .qr-box canvas { width: 100% !important; height: 100% !important; }
.addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; word-break: break-all; line-height: 1.4;
}
.net-pills { display: flex; gap: 8px; overflow: auto; padding: 4px 0 14px; }
.net-pill {
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 650;
}
.net-pill.on {
  background: linear-gradient(135deg, rgba(139,92,246,.28), rgba(34,211,238,.2));
  border-color: rgba(34, 211, 238, .45);
  color: #e5edf8;
}

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%;
  background: rgba(5, 10, 24, .68);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(96, 165, 250, .75);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .14);
  background: rgba(8, 14, 31, .9);
}
.field textarea { min-height: 84px; resize: none; }
.max {
  float: right; color: var(--accent-2); background: none; border: 0; padding: 0;
  font-size: 12px; font-weight: 700; box-shadow: none;
}
.max::after { display: none; }

.list-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 8px; text-align: left; font-weight: 650;
}
.list-btn span { color: var(--muted); font-weight: 500; font-size: 13px; }
.back {
  background: none; border: 0; color: var(--accent-2); font-weight: 700; padding: 0 0 12px; box-shadow: none;
}
.back::after { display: none; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: var(--dock-h);
  padding: 8px 10px env(safe-area-inset-bottom, 8px);
  background: linear-gradient(180deg, rgba(17, 28, 51, .76), rgba(8, 13, 29, .92));
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.dock-btn {
  background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 650; box-shadow: none; padding: 6px;
}
.dock-btn::after { display: none; }
.dock-btn svg { width: 22px; height: 22px; }
.dock-btn.on { color: var(--text); }
.dock-btn.on svg { color: var(--accent-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + 12px); transform: translateX(-50%);
  z-index: 40; background: #e5edf8; color: #07111f;
  border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow); white-space: nowrap;
}

.empty { color: var(--muted); text-align: center; padding: 28px 8px; }
.lang { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.lang button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-weight: 700;
}
.lang button.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07111f; border-color: transparent;
}
.reveal { filter: blur(7px); user-select: none; }
.reveal.open { filter: none; user-select: text; }
.tg-ok {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ok); font-weight: 650;
  margin-bottom: 10px;
}
.token-ic.sm { width: 28px; height: 28px; border-radius: 50%; font-size: 11px; }
.dex-tabs {
  display: flex; gap: 18px; align-items: baseline; margin: 2px 0 14px;
  font-size: 22px; font-weight: 800;
}
.dex-tabs span { color: var(--muted); }
.dex-tabs span.on { color: #fff; }
.dex-modes {
  display: flex; background: #121212; border-radius: 999px; padding: 3px; margin-bottom: 14px;
}
.dex-modes button {
  flex: 1; border-radius: 999px; background: transparent; color: #8b8b8b;
  font-weight: 700; font-size: 13px; padding: 8px 10px; box-shadow: none;
}
.dex-modes button::after { display: none; }
.dex-modes button.on { background: #fff; color: #111; }
.dex-modes button:hover { transform: none; background: rgba(255,255,255,.08); }
.dex-modes button.on:hover { background: #fff; }
.dex-bal {
  color: var(--muted); font-size: 13px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.dex-stack { position: relative; }
.dex-box {
  background: #141414;
  border-radius: 16px;
  padding: 14px 14px;
  display: flex; align-items: center; gap: 10px;
  min-height: 72px;
}
.dex-box + .dex-box { margin-top: 8px; }
.dex-chip {
  display: flex; align-items: center; gap: 8px;
  background: #1f1f1f; border-radius: 999px; padding: 6px 10px 6px 6px;
  font-weight: 800; width: auto; flex: none;
  box-shadow: none;
}
.dex-chip::after { display: none; }
.dex-chip:hover { transform: none; background: #2a2a2a; }
.dex-chev { width: 14px; height: 14px; color: #9aa; }
.dex-amt {
  flex: 1; min-width: 0; text-align: right;
  font-size: 28px; font-weight: 700; letter-spacing: -.6px;
  background: transparent; border: 0; outline: none; padding: 0; width: auto;
}
.dex-flip {
  position: absolute; left: 50%; top: 50%;
  width: 40px; height: 40px; margin: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%; padding: 0;
  background: #fff; color: #111;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
  z-index: 2;
}
.dex-flip::after { display: none; }
.dex-flip:hover { transform: translate(-50%, -50%); background: #f2f2f2; }
.dex-flip svg { width: 18px; height: 18px; }
.dex-meta { color: var(--muted); font-size: 12px; min-height: 16px; margin: 8px 2px 10px; }
.dex-go {
  width: 100%; padding: 16px; border-radius: 14px;
  background: #2a2a2a; color: #888; font-weight: 800; font-size: 16px;
  box-shadow: none;
}
.dex-go::after { display: none; }
.dex-go:hover { transform: none; }
.dex-go:not(:disabled) {
  background: #fff; color: #111;
}
.dex-pos-hd {
  margin: 22px 0 8px; font-weight: 800; font-size: 15px;
}
.dex-pos-hd span.on { border-bottom: 2px solid #fff; padding-bottom: 4px; }
.dex-pos-cols { margin-top: 4px; }
.dex-pos { background: transparent; border: 0; padding: 10px 4px; border-radius: 0; margin: 0; }
.dex-pos:hover { transform: none; background: rgba(255,255,255,.04); }
.dex-pick-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 16px;
}
.dex-x { background: none; box-shadow: none; padding: 6px 8px; font-size: 18px; }
.dex-x::after { display: none; }
.dex-search {
  width: 100%; background: #141414; border: 0; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; outline: none;
}
.dex-pick-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: transparent; text-align: left; padding: 10px 4px; margin: 0;
  box-shadow: none; border-radius: 12px;
}
.dex-pick-row::after { display: none; }
.dex-pick-row:hover { transform: none; background: rgba(255,255,255,.05); }
