/* ============================================================
   Liquid — Web3 DApp
   Liquid Glass / iOS-style UI · Mobile-first
   ============================================================ */

:root {
  --bg-0: #0b0e1a;
  --bg-1: #1a1228;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.5);
  --text-1: #f5f7ff;
  --text-2: rgba(245, 247, 255, 0.72);
  --text-3: rgba(245, 247, 255, 0.45);
  --accent-1: #fde047;
  --accent-2: #f5b301;
  --accent-3: #f97316;
  --accent-grad: linear-gradient(135deg, #fde047, #f5b301 50%, #f97316);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --danger: #fb7185;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow-ambient: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text-1);
  background: var(--bg-0);
  line-height: 1.4;
  overflow-x: hidden;
  position: relative;
  /* iOS rubber band feel */
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ============================================================
   Ambient liquid glass background
   ============================================================ */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 80% at 90% -10%, rgba(249, 115, 22, 0.30), transparent 60%),
    radial-gradient(120% 80% at 0% 110%, rgba(253, 224, 71, 0.24), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0));
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  will-change: transform;
}

.blob-a {
  width: 55vw;
  height: 55vw;
  max-width: 420px;
  max-height: 420px;
  top: -12%;
  right: -20%;
  background: linear-gradient(135deg, #f97316, #eab308);
  animation: float1 18s ease-in-out infinite;
}

.blob-b {
  width: 50vw;
  height: 50vw;
  max-width: 380px;
  max-height: 380px;
  bottom: -15%;
  left: -18%;
  background: linear-gradient(135deg, #fde047, #f97316);
  animation: float2 22s ease-in-out infinite;
}

.blob-c {
  width: 34vw;
  height: 34vw;
  max-width: 260px;
  max-height: 260px;
  top: 30%;
  left: 55%;
  background: linear-gradient(135deg, #fb923c, #facc15);
  opacity: 0.32;
  animation: float1 26s ease-in-out infinite reverse;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8%, 6%) scale(1.1); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-7%, -8%) scale(1.05); }
}

/* Film grain overlay */
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ============================================================
   Views / routing
   ============================================================ */

.view {
  position: relative;
  min-height: 100dvh;
  min-height: 100vh;
  display: none;
  flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.view.active {
  display: flex;
}

/* ============================================================
   Glass treatment (shared)
   ============================================================ */

.glass-card {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow:
    var(--shadow-card),
    inset 0 1px 0 var(--glass-highlight);
  overflow: hidden;
}

/* Top inner light reflection */
.glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 6%;
  right: 6%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
}

/* ============================================================
   CONNECT VIEW
   ============================================================ */

#connect-view {
  align-items: center;
  justify-content: center;
  padding-top: calc(var(--safe-top) + 24px);
  padding-bottom: calc(var(--safe-bottom) + 24px);
}

.connect-card {
  width: 100%;
  max-width: 420px;
  padding: 26px 22px 22px;
  animation: cardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  margin-bottom: 30px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background 0.4s ease;
}

.status-pill.online .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
}

/* Logo */
.logo-wrap {
  text-align: center;
  margin-bottom: 28px;
}

.logo-disc {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 26px;
  padding: 2px;
  background: var(--accent-grad);
  box-shadow: 0 14px 40px -10px rgba(167, 139, 250, 0.6);
  animation: logoFloat 5s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.logo-inner {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04));
  display: grid;
  place-items: center;
}

.logo-inner svg {
  width: 46px;
  height: 46px;
}

.logo-wrap h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--text-3);
  font-size: 0.95rem;
  margin-top: 4px;
}

.connect-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.connect-sub {
  text-align: center;
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 24px;
}

/* Wallet list */
.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  text-align: left;
}

.wallet-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.wallet-btn.wide {
  min-height: 68px;
}

.wallet-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--accent-1);
  background: linear-gradient(150deg, rgba(125, 211, 252, 0.18), rgba(167, 139, 250, 0.14));
  border: 1px solid rgba(125, 211, 252, 0.24);
}

.wallet-icon svg {
  width: 24px;
  height: 24px;
}

.wallet-btn-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wallet-btn-text strong {
  font-size: 0.98rem;
  font-weight: 600;
}

.wallet-btn-text small {
  color: var(--text-3);
  font-size: 0.78rem;
}

.chev {
  width: 20px;
  height: 20px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* Demo / no wallet notice */
.demo-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(251, 113, 133, 0.08);
  border: 1px solid rgba(251, 113, 133, 0.2);
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
}

.demo-notice svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--danger);
  margin-top: 1px;
}

.linklike {
  color: var(--accent-1);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fineprint {
  margin-top: 22px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-3);
}

/* ============================================================
   APP VIEW
   ============================================================ */

#app-view {
  padding-top: calc(var(--safe-top));
  padding-bottom: calc(var(--safe-bottom));
}

.app-header {
  margin: 10px 0 14px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #0b0e1a;
  background: var(--accent-grad);
  font-size: 1.15rem;
}

.brand-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.brand-copy small {
  color: var(--text-3);
  font-size: 0.76rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  transition: background 0.2s ease, color 0.2s ease;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn:active {
  background: rgba(251, 113, 133, 0.16);
  color: var(--danger);
}

.account-chip {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  font-size: 0.86rem;
  color: var(--text-2);
  font-family: 'Space Grotesk', monospace;
  letter-spacing: 0.02em;
}

.avatar-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-grad);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}

/* Content scroll */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 90px;
}

/* Balance card */
.balance-card {
  padding: 22px 20px;
  background: linear-gradient(
    160deg,
    rgba(167, 139, 250, 0.16),
    rgba(255, 255, 255, 0.05)
  );
}

.balance-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-2);
  font-size: 0.82rem;
  margin-bottom: 10px;
}

.balance-token {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
}

.balance-number {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.balance-usd {
  color: var(--text-3);
  font-size: 0.9rem;
  margin-top: 4px;
}

.balance-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.action-btn {
  padding: 12px 0;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  transition: transform 0.15s ease, background 0.2s ease;
}

.action-btn.primary {
  background: var(--accent-grad);
  color: #0b0e1a;
  border: none;
  font-weight: 700;
}

.action-btn:active {
  transform: scale(0.96);
}

/* Stats grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.stat-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.stat-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--success);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* List cards (tokens / activity) */
.list-card {
  padding: 16px 18px;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.token-symbol {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(150deg, rgba(125, 211, 252, 0.25), rgba(167, 139, 250, 0.2));
  color: #e0f2fe;
}

.token-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.token-info strong {
  font-weight: 600;
}

.token-info small {
  color: var(--text-3);
  font-size: 0.78rem;
}

.token-amount {
  text-align: right;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.token-amount strong {
  font-weight: 600;
}

.token-amount small {
  color: var(--text-3);
  font-size: 0.76rem;
}

.empty-state {
  color: var(--text-3);
  font-size: 0.86rem;
  text-align: center;
  padding: 14px 0;
}

/* ============================================================
   Bottom tab bar
   ============================================================ */

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 10px);
  width: calc(100% - 32px);
  max-width: 440px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 24px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0 5px;
  border-radius: 16px;
  color: var(--text-3);
  font-size: 0.66rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
}

.tab svg {
  width: 22px;
  height: 22px;
}

.tab.active {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   Toast
   ============================================================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 14px);
  transform: translateX(-50%) translateY(80px);
  z-index: 40;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(20, 24, 45, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  max-width: 85vw;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================
   Responsive / desktop upscale
   ============================================================ */

@media (min-width: 520px) {
  body {
    /* subtle vignette on larger screens */
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   Lightning Swap — additional components
   ============================================================ */

/* Swap hero snippet */
.swap-snippet {
  margin-bottom: 18px;
}

.swap-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.token-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(253, 224, 71, 0.16);
  border: 1px solid rgba(253, 224, 71, 0.34);
  color: #fef3c7;
}

.token-chip.eth-chip {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.34);
  color: #e2e8f0;
}

.swap-arrow {
  color: var(--accent-1);
  font-size: 1.3rem;
  font-weight: 700;
}

.swap-quote {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-2);
  font-size: 0.85rem;
}

.swap-quote strong {
  color: #fef3c7;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

/* Quick swap CTA */
.swap-cta {
  display: block;
  margin-top: 20px;
}

.big-cta {
  width: 100%;
  padding: 16px 0;
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: var(--accent-grad);
  color: #1a1228;
  border: none;
  box-shadow: 0 8px 26px -8px rgba(245, 179, 1, 0.6);
}

/* Alt list button */
.alt-list {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
  padding: 13px 4px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.alt-list svg {
  width: 18px;
  height: 18px;
  color: var(--text-3);
}

.alt-list:active {
  color: var(--accent-1);
}

/* Perks */
.perks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.perk {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.perk-icon {
  font-size: 1.5rem;
}

.perk div {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.perk strong {
  font-size: 0.95rem;
}

.perk small {
  color: var(--text-3);
  font-size: 0.76rem;
}

/* Swap meta (network / chain) */
.swap-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: var(--text-3);
}

.swap-meta strong {
  color: var(--text-1);
  font-weight: 600;
}

/* Chain tag (compact network/chain indicator) */
.chain-tag {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

.chain-tag strong {
  color: var(--text-2);
  font-weight: 600;
}

.chain-tag.subtle {
  color: var(--text-3);
  font-weight: 500;
}

/* Simplified swap card: compact, focused action */
.swap-card {
  padding-bottom: 20px;
}

.swap-card .big-cta {
  margin-top: 16px;
}

/* Split balance card: Wallet vs Deposited */
.balance-split {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}

.split-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.split-col.deposited {
  text-align: right;
}

.split-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-3);
}

.split-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.split-usd {
  font-size: 0.8rem;
  color: var(--text-3);
}

.split-col.deposited .split-number {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.split-divider {
  width: 1px;
  height: 54px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.18), transparent);
}

/* Payout pending row (shown only when ETH is deposited) */
.payout-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(253,224,71,0.14), rgba(249,115,22,0.10));
  border: 1px solid rgba(253,224,71,0.28);
}

.pp-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}

.pp-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
