@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --accent: #5B6EF5;
  --accent-2: #8B5CF6;
  --accent-glow: rgba(91, 110, 245, 0.35);
  --bg: #0a0b0f;
  --panel: #14151c;
  --panel-2: #191a22;
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #f2f3f8;
  --text-dim: #8b8d9a;
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.3);
  --red: #ef4444;
  --yellow: #f59e0b;
  --pixel-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --body-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--body-font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.grid-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 800px 500px at 20% -10%, rgba(91,110,245,0.16), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(139,92,246,0.12), transparent 60%);
  pointer-events: none;
}

.hidden { display: none !important; }
.screen { position: relative; z-index: 1; min-height: 100vh; }

.pxicon rect { fill: currentColor; }
.pxicon { flex-shrink: 0; }

/* ---------- Gate ---------- */
#gate { display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 26px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px var(--accent-glow);
}
.logo {
  font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--text-dim); font-size: 14px; line-height: 1.7; margin: 16px 0 22px; }
.warn { color: var(--yellow); font-size: 14px; margin-bottom: 14px; font-weight: 500; }

/* ---------- Inputs / Buttons ---------- */
input, textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  caret-color: var(--accent);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--body-font);
  margin-bottom: 10px;
  outline: none;
  direction: ltr;
  text-align: left;
  transition: border-color .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea { min-height: 90px; resize: vertical; direction: ltr; text-align: left; }

button { font-family: var(--body-font); cursor: pointer; }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 13px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14.5px;
  box-shadow: 0 8px 20px var(--accent-glow);
  transition: transform .08s ease, box-shadow .08s ease, opacity .08s ease;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:active { transform: scale(0.98); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.5; }

.btn-outline {
  width: 100%;
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin: 10px 0;
  transition: border-color .1s ease, color .1s ease;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-outline:active { border-color: var(--accent); color: var(--text); }

.error { color: var(--red); font-size: 13px; margin-top: 8px; font-weight: 500; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; background: rgba(10,11,15,0.85); backdrop-filter: blur(12px); z-index: 5;
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text);
  padding: 8px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  transition: background .1s ease;
}
.icon-btn:active { background: rgba(255,255,255,0.1); }
.total-balance { text-align: right; }
.total-balance .label { display: block; font-size: 10px; color: var(--text-dim); letter-spacing: 0.5px; font-weight: 600; text-transform: uppercase; }
.total-balance .value { font-size: 18px; font-weight: 700; color: var(--text); }

main { padding: 16px; padding-bottom: 130px; }
.view h2 {
  font-size: 18px; font-weight: 700; margin: 4px 0 16px; line-height: 1.4;
  display: flex; align-items: center; gap: 8px;
}
.view h3 { font-size: 14px; margin: 18px 0 8px; color: var(--text-dim); font-weight: 600; }

.sub-status {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px; text-align: center;
}

/* ---------- Wallet cards ---------- */
.wallet-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.wallet-card .chain-head { display: flex; align-items: center; gap: 8px; }
.wallet-card .chain-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.wallet-card .addr { direction: ltr; text-align: left; font-size: 11px; color: var(--text-dim); word-break: break-all; margin: 8px 0; font-family: ui-monospace, monospace; }
.wallet-card .bal-row { display: flex; justify-content: space-between; font-size: 15px; margin-top: 6px; }
.wallet-card .bal-usd { color: var(--text); font-weight: 700; }
.wallet-card .wallet-actions { display: flex; gap: 8px; margin-top: 12px; }
.wallet-card .wallet-actions button { flex: 1; padding: 9px 4px; font-size: 12px; margin: 0; }
.wallet-card .regen-link {
  display: block; margin-top: 10px; text-align: center; font-size: 11.5px; color: var(--text-dim);
  background: none; border: none; text-decoration: underline; padding: 4px; width: 100%;
}
.wallet-card .regen-link:active { color: var(--red); }

.quick-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.quick-actions button { margin: 0; }

.balance-hidden { filter: blur(7px); user-select: none; }

.chain-picker-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.chain-picker-item {
  display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); cursor: pointer; font-weight: 600;
}
.chain-picker-item:active { border-color: var(--accent); background: rgba(91,110,245,0.1); }

.regen-warning { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: var(--radius-sm); padding: 14px; font-size: 13.5px; line-height: 1.7; color: var(--text); }
.regen-warning b { color: var(--red); }
.regen-steps-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.regen-steps-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.regen-steps-dots span.active { background: var(--red); }

/* ---------- Token card ---------- */
.token-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.token-card .name-row { display: flex; justify-content: space-between; align-items: center; }
.token-card .name { font-weight: 700; font-size: 15.5px; }
.token-card .chain-tag { font-size: 11px; padding: 4px 9px; border-radius: 20px; background: rgba(255,255,255,0.06); color: var(--text-dim); display: flex; align-items: center; gap: 4px; font-weight: 500; }
.token-card .addr { direction: ltr; text-align: left; font-size: 12px; color: var(--text-dim); word-break: break-all; margin: 6px 0; font-family: ui-monospace, monospace; }
.token-card .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; font-size: 13.5px; }
.token-card .stats-grid div span { color: var(--text-dim); }
.risk-badge { display: inline-block; padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; margin-top: 6px; }
.risk-low { background: var(--green-glow); color: var(--green); }
.risk-mid { background: rgba(245,158,11,0.18); color: var(--yellow); }
.risk-high { background: rgba(239,68,68,0.18); color: var(--red); }
.ai-box { margin-top: 12px; padding: 12px; background: rgba(91,110,245,0.08); border-radius: var(--radius-sm); border: 1px solid rgba(91,110,245,0.2); font-size: 13.5px; line-height: 1.7; }

/* ---------- Positions ---------- */
.position-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.position-card .pos-head { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; }
.position-card .pnl-pos { color: var(--green); font-weight: 700; }
.position-card .pnl-neg { color: var(--red); font-weight: 700; }
.position-card .sell-row { display: flex; gap: 8px; margin-top: 12px; }
.position-card .sell-row button { flex: 1; padding: 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); color: var(--text); font-size: 12.5px; font-weight: 500; }
.position-card .sell-row button:active { background: rgba(255,255,255,0.08); }
.position-card .sell-row button.danger { color: var(--red); }

/* ---------- Pump list ---------- */
.pump-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
  transition: border-color .1s ease;
}
.pump-item:active { border-color: var(--accent); }
.pump-toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 16px; margin-bottom: 16px; font-size: 14px;
}

.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,0.12); border-radius: 24px; transition: .15s; }
.slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- Bottom nav ----------
   Floats above the bottom edge (not flush with it) so it doesn't collide
   with the phone's own gesture bar / on-screen nav buttons. */
.bottom-nav {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  display: flex; background: rgba(20,21,28,0.85); border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(16px);
}
.nav-btn {
  flex: 1; background: none; border: none; color: var(--text-dim);
  padding: 10px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative; border-radius: 16px; margin: 4px;
  transition: color .1s ease, background .1s ease;
}
.nav-btn span { font-size: 9.5px; font-weight: 600; }
.nav-btn.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,0.7); display: flex; align-items: flex-end; }
.modal-card {
  background: var(--panel); border: 1px solid var(--border); border-bottom: none;
  border-radius: 22px 22px 0 0;
  width: 100%; padding: 22px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}
.modal-card h3 { font-size: 16px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.amt-btn { padding: 13px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); color: var(--text); font-weight: 600; transition: border-color .1s ease, background .1s ease; }
.amt-btn:active { border-color: var(--accent); background: rgba(91,110,245,0.12); }
.amt-btn.custom { grid-column: span 3; }
.amt-btn.active { border-color: var(--accent); background: rgba(91,110,245,0.16); color: var(--text); }

.qr-box { display: flex; justify-content: center; margin: 16px 0; }
.qr-box img { border-radius: var(--radius-sm); background: #fff; padding: 10px; }
.deposit-addr-box {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
  font-size: 13px; word-break: break-all; direction: ltr; text-align: left; margin: 10px 0; font-family: ui-monospace, monospace;
}

.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 20px; z-index: 50; font-size: 13.5px; border-radius: 14px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5); max-width: 90vw; text-align: center;
}

.admin-stats { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 14px 0; font-size: 13.5px; line-height: 2; }

/* ---------- Language picker ---------- */
.language-list { max-height: 45vh; overflow-y: auto; margin: 12px 0; }
.language-item {
  display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: rgba(255,255,255,0.02); margin-bottom: 6px; font-size: 14px; cursor: pointer;
  transition: border-color .1s ease;
}
.language-item:active { border-color: var(--accent); }
.language-item .flag { font-size: 17px; }
.language-item.active { border-color: var(--accent); background: rgba(91,110,245,0.1); }

/* ---------- Chain color accents (real brand colors) ---------- */
.c-sol { color: #9945FF; }
.c-eth { color: #627EEA; }
.c-bnb { color: #F0B90B; }

/* ---------- Copy / paste affordances ---------- */
.addr-row {
  display: flex; align-items: center; gap: 8px; margin: 8px 0;
}
.addr-row .addr { flex: 1; margin: 0; min-width: 0; }
.copy-btn, .paste-btn {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-dim);
  transition: background .1s ease, color .1s ease, transform .1s ease;
}
.copy-btn:active, .paste-btn:active { background: rgba(91,110,245,0.15); color: var(--accent); transform: scale(0.92); }
.copy-btn.copied { color: var(--green); background: var(--green-glow); }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { margin-bottom: 10px; }
.input-row .paste-btn { width: 44px; height: 44px; margin-top: 0; }

/* ---------- Pixel-block loading animation ---------- */
.loading-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; color: var(--text-dim); font-size: 14px; }
.pixel-loader { display: inline-flex; gap: 4px; flex-shrink: 0; }
.pixel-loader span {
  width: 7px; height: 7px; border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  animation: pixel-pulse 1.1s infinite ease-in-out both;
}
.pixel-loader span:nth-child(1) { animation-delay: 0s; }
.pixel-loader span:nth-child(2) { animation-delay: 0.12s; }
.pixel-loader span:nth-child(3) { animation-delay: 0.24s; }
.pixel-loader span:nth-child(4) { animation-delay: 0.36s; }
.pixel-loader.sm span { width: 5px; height: 5px; }
@keyframes pixel-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.6) rotate(0deg); }
  40% { opacity: 1; transform: scale(1) rotate(90deg); }
}
.btn-primary .pixel-loader span, .btn-outline .pixel-loader span { background: currentColor; }
