/**
 * Stream Platform Navigation Styles
 * Complete navigation system matching Stream platform exactly
 */

/* CSS Variables for Stream compatibility */
:root {
  --panel-top: rgba(255, 255, 255, .06);
  --panel-bot: rgba(255, 255, 255, .03);
  --line: rgba(255, 255, 255, .12);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, .65);
  --radius-md: 12px;
  --radius-sm: 8px;
}

html.light {
  --panel-top: #ffffff;
  --panel-bot: #ffffff;
  --line: rgba(0, 0, 0, .12);
  --text: #000000;
  --text-dim: rgba(0, 0, 0, .8);
}

/* ===== Standard Scrollbar Styling (Cross-Platform Consistency) ===== */
/* Ensures consistent page width across all platforms by standardizing scrollbar width */
html {
  /* Reserve space for scrollbar to prevent layout shift */
  scrollbar-gutter: stable;
}

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

html.light ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  background-clip: padding-box;
}

html.light ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
  background-clip: padding-box;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

html.light * {
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* ===== Top Header (Matches Stream Platform) ===== */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(15, 15, 22, 0.6);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05), 0 4px 12px rgba(0, 0, 0, .1);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

html.light .top-header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, .1);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 4px 12px rgba(0, 0, 0, .08);
}

/* Ensure logo is visible in light mode */
html.light .top-header .brand-logo {
  opacity: 1 !important;
  display: block !important;
  filter: none !important;
  /* Don't apply any filters that might hide it */
}

html.light .top-header .brand picture,
html.light .top-header .brand img {
  display: block !important;
  opacity: 1 !important;
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  /* Allow brand to take available space */
  min-width: 0;
  /* Prevent flex item from overflowing */
}

/* Ensure brand doesn't get cut off on mobile */
@media (max-width: 768px) {
  .top-header-left {
    min-width: 80px;
    flex-shrink: 0;
    /* Don't shrink on mobile */
  }
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile Stream Link (TV Screen Icon) - Replaces mobile-nav-earn */
.mobile-nav-stream {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(244, 183, 62, .18), rgba(244, 183, 62, .1));
  border-color: rgba(244, 183, 62, .35);
  color: var(--dx-gold);
  margin-left: 4px;
}

.top-header .toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
  flex-shrink: 0;
  padding: 0;
}

.top-header .toggle-btn:hover {
  background: rgba(255, 255, 255, .08);
  color: #e4e4e7;
}

.top-header .toggle-btn:active {
  background: rgba(255, 255, 255, .12);
}

.top-header .brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.top-header .brand-text {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--dx-gold) 0%, var(--dx-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-header .brand-logo {
  height: 24px;
  width: auto;
  max-width: 120px;
  /* Prevent logo from being too wide on mobile */
  object-fit: contain;
  display: block !important;
  /* Ensure logo is always visible */
}

/* Ensure logo is visible on mobile */
@media (max-width: 768px) {
  .top-header .brand {
    display: flex !important;
    align-items: center;
    min-width: 80px;
    /* Ensure brand link has minimum width */
    flex-shrink: 0;
    /* Don't shrink on mobile */
  }

  .top-header .brand-logo {
    height: 22px;
    max-width: 100px;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .top-header .brand picture,
  .top-header .brand img {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Ensure logo is visible in light mode on mobile */
  html.light .top-header .brand-logo {
    opacity: 1 !important;
    display: block !important;
    filter: none !important;
  }
}

html.light .top-header .toggle-btn {
  color: #52525b;
}

html.light .top-header .toggle-btn:hover {
  background: rgba(0, 0, 0, .06);
  color: #18181b;
}

/* ===== TOKEN BALANCE PILL - STREAM STYLING (EXACT MATCH) ===== */
.top-header-right .token-balance-pill,
#tokenBalancePill.token-balance-pill,
.token-balance-pill {
  display: flex;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 16px !important;
  border-radius: 24px !important;
  border: 1.5px solid var(--dx-gold) !important;
  background: linear-gradient(135deg, rgba(244, 183, 62, 0.12) 0%, rgba(244, 183, 62, 0.08) 100%) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  color: var(--dx-gold) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative !important;
  overflow: hidden !important;
  box-shadow: 0 2px 8px rgba(244, 183, 62, 0.15) !important;
  margin: 0 !important;
  line-height: normal !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
}

.token-balance-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(244, 183, 62, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.token-balance-pill:hover {
  background: linear-gradient(135deg, rgba(244, 183, 62, 0.18) 0%, rgba(244, 183, 62, 0.12) 100%) !important;
  border-color: var(--dx-gold) !important;
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 6px 20px rgba(244, 183, 62, 0.3),
    0 0 0 1px rgba(244, 183, 62, 0.2) !important;
}

.token-balance-pill:hover::before {
  opacity: 1;
}

.token-balance-logo {
  height: 1em !important;
  width: auto !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
  opacity: 0.9 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

.token-balance-value {
  font-family: 'Courier New', monospace !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  white-space: nowrap !important;
  min-width: fit-content !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: 0.02em !important;
  position: relative !important;
  z-index: 1 !important;
  line-height: normal !important;
  margin: 0 !important;
  padding: 0 !important;
}

html.light .token-balance-pill {
  background: rgba(244, 183, 62, 0.08);
  border-color: var(--dx-gold);
  color: #d97706;
}

html.light .token-balance-pill:hover {
  background: rgba(244, 183, 62, 0.12);
  box-shadow: 0 4px 12px rgba(244, 183, 62, 0.15);
}

.token-balance-pill.loading {
  opacity: 0.7;
  cursor: wait;
}

.token-balance-pill.loading:hover {
  transform: none;
  box-shadow: none;
}

.token-balance-pill.loading .token-balance-value::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid var(--dx-gold);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

html.light .token-balance-pill.loading .token-balance-value::after {
  border-color: #d97706;
  border-top-color: transparent;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.token-balance-label {
  opacity: 0.9;
  font-size: 12px;
}

/* ===== Wallet Pill (Matches Stream Platform) ===== */
.wallet-pill-container {
  position: relative;
}

/* ===== WALLET PILL - STREAM STYLING (EXACT MATCH) ===== */
.top-header-right .wallet-pill-container button.wallet-pill,
.top-header-right button.wallet-pill,
#walletPillBtn.wallet-pill,
.wallet-pill-container button.wallet-pill,
button.wallet-pill,
.wallet-pill {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 9px 18px !important;
  border-radius: 24px !important;
  border: 1.5px solid var(--dx-emerald) !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  color: var(--dx-emerald) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  white-space: nowrap !important;
  position: relative !important;
  overflow: hidden !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15) !important;
  margin: 0 !important;
  line-height: normal !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
  /* Button reset overrides */
  background-color: transparent !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  outline: none !important;
}

.wallet-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallet-pill>* {
  position: relative;
  z-index: 1;
}

.wallet-pill:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.12) 100%) !important;
  border-color: var(--dx-emerald) !important;
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 6px 20px rgba(16, 185, 129, 0.3),
    0 0 0 1px rgba(16, 185, 129, 0.2) !important;
}

.wallet-pill:hover::before {
  opacity: 1;
}

.wallet-pill:active {
  transform: translateY(0);
}

.wallet-pill.connected {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.12) 100%);
  border-color: var(--dx-emerald);
  box-shadow:
    0 2px 8px rgba(16, 185, 129, 0.2),
    0 0 0 1px rgba(16, 185, 129, 0.15);
}

.wallet-pill.connected::before {
  opacity: 0.5;
  /* Subtle glow when connected */
}

.wallet-pill.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.wallet-pill.loading:hover {
  transform: none;
  box-shadow: none;
}

.wallet-pill:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.wallet-pill-text {
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: normal !important;
}

.wallet-pill-address {
  display: inline-block !important;
  font-family: 'Courier New', monospace !important;
  font-size: 13px !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: normal !important;
}

.wallet-pill-arrow {
  display: inline-block !important;
  font-size: 10px !important;
  margin-left: 4px !important;
  transition: transform 0.2s ease !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-right: 0 !important;
  padding: 0 !important;
  line-height: normal !important;
}

.wallet-pill-container.active .wallet-pill-arrow {
  transform: rotate(180deg);
}

/* ===== Wallet Dropdown ===== */
.wallet-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 280px;
  background: linear-gradient(180deg, rgba(26, 29, 41, .98) 0%, rgba(21, 24, 33, .98) 100%);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, .45),
    0 0 0 1px rgba(255, 255, 255, .05);
  padding: 14px;
  z-index: 1000;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top right;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wallet-dropdown-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 8px;
}

.wallet-dropdown-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .65);
  letter-spacing: 0.5px;
}

.wallet-dropdown-address-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-dropdown-address {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: rgb(255, 255, 255);
  word-break: break-all;
  flex: 1;
}

/* Ensure minimum touch target for accessibility */
.wallet-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, .65);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.wallet-copy-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallet-copy-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--dx-emerald);
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.wallet-copy-btn:hover::before {
  opacity: 1;
}

.wallet-copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  color: var(--dx-emerald);
}

/* Network Toggle in Wallet Dropdown */
.wallet-network-toggle {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 8px;
}

.wallet-network-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.wallet-network-toggle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .65);
  letter-spacing: 0.5px;
}

.wallet-network-warning {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #fbbf24;
  font-weight: 500;
}

.wallet-network-warning svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.wallet-network-toggle-buttons {
  display: flex;
  gap: 6px;
}

.wallet-network-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.wallet-network-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, .15);
}

.wallet-network-btn.active {
  background: rgba(31, 221, 254, 0.15);
  border-color: rgba(31, 221, 254, 0.4);
  color: #1FDDFE;
}

.wallet-network-btn-label {
  font-size: 13px;
  font-weight: 500;
  color: inherit;
}

.wallet-network-btn-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
  transition: all 0.2s ease;
}

.wallet-network-btn.active .wallet-network-btn-indicator {
  background: #1FDDFE;
  box-shadow: 0 0 8px rgba(31, 221, 254, 0.5);
}

/* Light mode network toggle */
html.light .wallet-network-toggle {
  border-bottom-color: rgba(0, 0, 0, .12);
}

html.light .wallet-network-toggle-label {
  color: rgba(0, 0, 0, .65);
}

html.light .wallet-network-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, .1);
  color: rgba(0, 0, 0, .8);
}

html.light .wallet-network-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, .15);
}

html.light .wallet-network-btn.active {
  background: rgba(31, 221, 254, 0.1);
  border-color: rgba(31, 221, 254, 0.3);
  color: #0ea5e9;
}

html.light .wallet-network-warning {
  color: #f59e0b;
}

/* Network Instructions Panel */
.wallet-network-instructions {
  margin-top: 12px;
  padding: 12px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wallet-network-instructions-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-network-instructions-title {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wallet-network-instructions-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wallet-network-instructions-steps li {
  margin: 0;
}

.wallet-network-instructions-steps strong {
  color: #fbbf24;
  font-weight: 600;
}

.wallet-network-instructions-close {
  align-self: flex-end;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.wallet-network-instructions-close:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: rgba(251, 191, 36, 0.5);
  transform: translateY(-1px);
}

/* Light mode instructions */
html.light .wallet-network-instructions {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

html.light .wallet-network-instructions-title {
  color: #f59e0b;
}

html.light .wallet-network-instructions-steps {
  color: rgba(0, 0, 0, 0.8);
}

html.light .wallet-network-instructions-steps strong {
  color: #f59e0b;
}

html.light .wallet-network-instructions-close {
  color: #f59e0b;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
}

html.light .wallet-network-instructions-close:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.3);
}

.wallet-dropdown-item {
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: rgb(255, 255, 255);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.wallet-dropdown-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, rgba(31, 221, 253, 0.08) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallet-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--dx-emerald);
  transform: translateX(4px);
  box-shadow: -2px 0 8px rgba(16, 185, 129, 0.15);
}

/* Danger/Warning style for revoke access button (DXfi only) */
.wallet-dropdown-item-danger {
  color: rgba(239, 68, 68, 0.9);
}

.wallet-dropdown-item-danger::before {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.08) 100%);
}

.wallet-dropdown-item-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  box-shadow: -2px 0 8px rgba(239, 68, 68, 0.2);
}

.wallet-dropdown-item:hover::before {
  opacity: 1;
}

.wallet-dropdown-item-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 20px;
  height: auto;
  margin: 0;
  padding: 0;
  padding-bottom: 0.1em;
  /* Slight adjustment to align with text baseline */
}

.wallet-dropdown-item>span:not(.wallet-dropdown-item-icon) {
  display: inline-block;
  line-height: 1.4;
  margin: 0;
  padding: 0;
}

html.light .wallet-pill {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--dx-emerald);
  color: #059669;
}

html.light .wallet-pill:hover {
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

html.light .wallet-pill.connected {
  background: rgba(16, 185, 129, 0.12);
}

html.light .wallet-dropdown {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  backdrop-filter: none;
  border: 1px solid rgba(0, 0, 0, .1);
}

html.light .wallet-dropdown-label {
  color: rgba(0, 0, 0, 0.7) !important;
}

html.light .wallet-dropdown-address {
  color: #0f172a !important;
}

html.light .wallet-dropdown-header {
  border-bottom: 1px solid rgba(0, 0, 0, .1);
}

html.light .wallet-copy-btn {
  border: 1px solid rgba(0, 0, 0, .1);
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.7);
}

html.light .wallet-copy-btn:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #059669;
}

html.light .wallet-dropdown-item {
  color: #0f172a !important;
}

html.light .wallet-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #059669;
}

html.light .wallet-dropdown-item-danger {
  color: #dc2626 !important;
}

html.light .wallet-dropdown-item-danger:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

/* ===== Wallet Modal ===== */
.wallet-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Hide wallet modal when it has the hidden class */
.wallet-modal.hidden {
  display: none !important;
}

.wallet-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.wallet-modal-content {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06) 0%, rgba(255, 255, 255, .03) 100%);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
}

html:not(.light) .wallet-modal-content {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f172a 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
}

.wallet-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.wallet-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: rgb(255, 255, 255);
  line-height: 1.4;
}

.wallet-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .65);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.wallet-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgb(255, 255, 255);
}

.wallet-modal-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.wallet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 12px;
}

.wallet-option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--dx-emerald);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.wallet-option-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.wallet-option-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.wallet-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wallet-option-name {
  font-weight: 600;
  font-size: 14px;
  color: rgb(255, 255, 255);
}

.wallet-option-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, .65);
}

.wallet-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, .65);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.wallet-modal-footer:hover {
  color: rgb(255, 255, 255);
}

html.light .wallet-modal-content {
  background: #ffffff !important;
  backdrop-filter: none !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

html.light .wallet-modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
}

html.light .wallet-modal-title {
  color: #0f172a !important;
  /* Slate 900 - Better contrast than pure black */
  font-weight: 700 !important;
}

html.light .wallet-modal-close {
  color: #475569 !important;
  /* Slate 600 - Better visibility */
}

html.light .wallet-modal-close:hover {
  background: #e2e8f0 !important;
  /* Slate 200 - Subtle hover */
  color: #0f172a !important;
}

html.light .wallet-option {
  background: #f8fafc !important;
  /* Slate 50 - Better than rgba */
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

html.light .wallet-option:hover {
  background: #e2e8f0 !important;
  /* Slate 200 - Better hover state */
  border-color: var(--dx-emerald) !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2) !important;
}

html.light .wallet-option-name {
  color: #0f172a !important;
  /* Slate 900 - High contrast */
  font-weight: 600 !important;
}

html.light .wallet-option-desc {
  color: #334155 !important;
  /* Slate 700 - Better contrast than rgba(0,0,0,.65) */
}

html.light .wallet-modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
  background: #f8fafc !important;
  color: #334155 !important;
  /* Slate 700 - Better contrast */
}

html.light .wallet-modal-footer:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* ===== Sidebar Navigation (Matches Stream Platform) ===== */
.sidebar {
  width: 90px;
  background: linear-gradient(180deg, rgba(26, 29, 41, .95) 0%, rgba(21, 24, 33, .98) 100%);
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(255, 255, 255, .1);
  border-left: none;
  border-top: none;
  border-bottom: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  z-index: 100;
  top: 56px;
  left: 0;
  border-radius: 0 16px 16px 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  overflow: hidden;
  box-shadow:
    2px 0 16px rgba(0, 0, 0, .2),
    0 0 0 1px rgba(255, 255, 255, .05);
}

.sidebar:hover {
  box-shadow:
    4px 0 24px rgba(0, 0, 0, .3),
    0 0 0 1px rgba(255, 255, 255, .08);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  min-height: 0;
  max-height: calc(100vh - 60px);
}

.sidebar.collapsed {
  width: 60px;
  border-radius: 0 12px 12px 0;
}

.sidebar.collapsed .sidebar-nav {
  padding: 8px;
}

.sidebar.collapsed .nav-item-text {
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, height 0.2s ease;
  font-size: 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 2px;
  aspect-ratio: 1;
  max-width: 56px;
  max-height: 56px;
}

.sidebar.collapsed .nav-item-icon {
  margin: 0;
}

.sidebar.collapsed .nav-divider {
  margin: 12px 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px;
  border-radius: 10px;
  text-decoration: none;
  color: #a1a1aa;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
  aspect-ratio: 1;
  min-width: 0;
  max-width: 100px;
  max-height: 100px;
  width: 100%;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(16, 185, 129, .1) 0%, rgba(31, 221, 253, .1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.nav-item>* {
  position: relative;
  z-index: 1;
}

.nav-item-text {
  transition: opacity 0.2s ease, width 0.2s ease;
  opacity: 1;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, .15);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.nav-item:hover::before {
  opacity: 1;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, .2) 0%, rgba(31, 221, 253, .15) 100%);
  color: #10b981;
  border-color: rgba(16, 185, 129, .4);
  box-shadow:
    0 4px 12px rgba(16, 185, 129, .2),
    0 0 0 1px rgba(16, 185, 129, .1);
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item.trade {
  color: #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, .12), rgba(16, 185, 129, .06));
  border-color: rgba(16, 185, 129, .25);
}

.nav-item.trade:hover {
  background: linear-gradient(180deg, rgba(16, 185, 129, .18), rgba(16, 185, 129, .1));
  border-color: rgba(16, 185, 129, .35);
}

.nav-item.earn {
  color: #f4b73e;
  background: linear-gradient(180deg, rgba(244, 183, 62, .18), rgba(244, 183, 62, .1));
  border-color: rgba(244, 183, 62, .35);
}

.nav-item.stream {
  color: #f4b73e;
  background: linear-gradient(180deg, rgba(244, 183, 62, .18), rgba(244, 183, 62, .1));
  border-color: rgba(244, 183, 62, .35);
}

.nav-item.stream:hover {
  background: linear-gradient(180deg, rgba(244, 183, 62, .22), rgba(244, 183, 62, .12));
  border-color: rgba(244, 183, 62, .4);
  color: #f4b73e;
}

html.light .nav-item.trade {
  background: linear-gradient(180deg, rgba(16, 185, 129, .12), rgba(16, 185, 129, .06));
  border-color: rgba(16, 185, 129, .25);
  color: #059669;
}

html.light .nav-item.trade:hover {
  background: linear-gradient(180deg, rgba(16, 185, 129, .18), rgba(16, 185, 129, .1));
  border-color: rgba(16, 185, 129, .35);
}

html.light .nav-item.stream {
  background: linear-gradient(180deg, rgba(244, 183, 62, .12), rgba(244, 183, 62, .06));
  border-color: rgba(244, 183, 62, .25);
  color: #d97706;
}

html.light .nav-item.stream:hover {
  background: linear-gradient(180deg, rgba(244, 183, 62, .18), rgba(244, 183, 62, .1));
  border-color: rgba(244, 183, 62, .35);
  color: #b45309;
}

.nav-item-icon {
  font-size: 24px;
  width: auto;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, .06);
  margin: 12px 0;
  transition: margin 0.2s ease;
}

.nav-spacer {
  flex: 1;
  min-height: 0;
}

.nav-item-theme {
  margin-top: auto;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-item-theme {
  margin-top: auto;
  flex-shrink: 0;
}

/* Light mode sidebar */
html.light .sidebar {
  background: linear-gradient(180deg, #f8f9fa, #fafafa);
  border-right: 1px solid rgba(0, 0, 0, .08);
}

html.light .nav-item {
  color: #52525b;
  background: linear-gradient(180deg, #f8f9fa, #fafafa);
  border-color: rgba(0, 0, 0, .08);
}

html.light .nav-item:hover {
  background: rgba(0, 0, 0, .06);
  color: #18181b;
  border-color: rgba(0, 0, 0, .12);
}

html.light .nav-item.active {
  background: rgba(16, 185, 129, .12);
  color: #059669;
  border-color: rgba(16, 185, 129, .25);
}

html.light .nav-divider {
  background: rgba(0, 0, 0, .06);
}

/* ===== Main Content (Account for Sidebar) ===== */
.main-content {
  margin-left: calc(90px + 8px);
  margin-right: 16px;
  margin-top: 56px;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px 0;
  width: calc(100vw - 90px - 24px);
  max-width: none;
}

.sidebar.collapsed~.main-content {
  margin-left: calc(60px + 8px);
  margin-right: 16px;
  width: calc(100vw - 60px - 24px);
}

/* ===== Footer ===== */
.footer {
  margin-left: calc(90px + 8px);
  margin-right: 16px;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 8px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 13px;
  width: calc(100vw - 90px - 24px);
  max-width: none;
}

.sidebar.collapsed~.footer {
  margin-left: calc(60px + 8px);
  margin-right: 16px;
  width: calc(100vw - 60px - 24px);
}

html.light .footer {
  border-top: 1px solid var(--line);
  color: var(--text-dim);
}

/* Override global link styles for footer - must match Stream exactly */
.footer,
.footer *,
.footer a,
.footer a:visited,
.footer a:link {
  color: var(--text-dim) !important;
}

.footer a {
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover,
.footer a:focus {
  color: var(--text) !important;
}

html.light .footer,
html.light .footer *,
html.light .footer a,
html.light .footer a:visited,
html.light .footer a:link {
  color: var(--text-dim) !important;
}

html.light .footer a:hover,
html.light .footer a:focus {
  color: var(--text) !important;
}

/* ===== Mobile Bottom Navigation ===== */
.mobile-nav {
  display: none;
  /* Hidden on desktop - shown on mobile via media query */
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  /* Dynamic height based on safe area */
  min-height: calc(56px + env(safe-area-inset-bottom, 0px));
  height: auto;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  /* Use max() to ensure minimum padding even without safe area */
  background: linear-gradient(180deg, rgba(26, 29, 41, .98) 0%, rgba(21, 24, 33, 1) 100%) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, .1);
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow:
    0 -4px 24px rgba(0, 0, 0, .4),
    inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, height 0.3s ease;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  /* Ensure it's always on top */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.mobile-nav:active {
  transform: translateY(2px);
  box-shadow:
    0 -2px 16px rgba(0, 0, 0, .3),
    0 0 0 1px rgba(255, 255, 255, .05);
}

/* Mobile nav items - base styles */
.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.mobile-nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(16, 185, 129, .15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.mobile-nav-item>* {
  position: relative;
  z-index: 1;
}

/* Trade button - SQUARE */
.mobile-nav-trade {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 185, 129, .12), rgba(16, 185, 129, .06));
  border-color: rgba(16, 185, 129, .25);
  color: var(--dx-emerald);
  margin-right: 4px;
}

/* Home/Diamond button - SQUARE */
.mobile-nav-home {
  width: 58px;
  height: 58px;
  min-width: 58px;
  max-width: 58px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
  margin: 0 4px;
  flex-shrink: 0;
  z-index: 2;
  padding: 0;
}

/* Earn button - SQUARE */
.mobile-nav-earn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(244, 183, 62, .18), rgba(244, 183, 62, .1));
  border-color: rgba(244, 183, 62, .35);
  color: var(--dx-gold);
  margin-left: 4px;
}

/* Theme button - SQUARE with moon emoji */
.mobile-nav-theme {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 1px solid var(--line);
  margin-left: auto;
  flex-shrink: 0;
  padding: 0;
}

/* Mobile nav icons */
.mobile-nav-icon {
  font-size: 22px;
  line-height: 1;
  display: block;
}

.mobile-nav-trade .mobile-nav-icon {
  font-size: 22px;
}

.mobile-nav-home .mobile-nav-icon {
  font-size: 28px;
}

.mobile-nav-earn .mobile-nav-icon,
.mobile-nav-stream .mobile-nav-icon {
  font-size: 22px;
}

.mobile-nav-theme .mobile-nav-icon {
  font-size: 22px;
}

.mobile-nav-item:hover {
  filter: brightness(1.15);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3), 0 0 0 1px rgba(16, 185, 129, .2);
  border-color: rgba(16, 185, 129, .3);
}

.mobile-nav-item:hover::before {
  opacity: 1;
}

.mobile-nav-item.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, .2) 0%, rgba(31, 221, 253, .15) 100%);
  border-color: rgba(16, 185, 129, .4);
  box-shadow:
    0 4px 16px rgba(16, 185, 129, .25),
    0 0 0 1px rgba(16, 185, 129, .2),
    inset 0 1px 0 rgba(255, 255, 255, .1);
  transform: scale(1.05);
}

.mobile-nav-item.active::before {
  opacity: 1;
}

.mobile-nav-item:active {
  transform: scale(0.95);
}

.mobile-nav-home:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
}

.mobile-nav-home:active {
  transform: scale(0.95);
}

/* Active state for home button */
.mobile-nav-home.active {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

/* Light mode compatibility */
html.light .mobile-nav {
  background: linear-gradient(180deg, #f8f9fa, #ffffff) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-top: 1px solid rgba(0, 0, 0, .12) !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
  box-shadow:
    0 -4px 24px rgba(0, 0, 0, .08),
    inset 0 1px 0 rgba(255, 255, 255, .8) !important;
}

html.light .mobile-nav-trade {
  background: linear-gradient(180deg, rgba(16, 185, 129, .08), rgba(16, 185, 129, .04)) !important;
  border-color: rgba(16, 185, 129, .2) !important;
}

html.light .mobile-nav-earn,
html.light .mobile-nav-stream {
  background: linear-gradient(180deg, rgba(244, 183, 62, .12), rgba(244, 183, 62, .06)) !important;
  border-color: rgba(244, 183, 62, .25) !important;
}

html.light .mobile-nav-home {
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1) !important;
  background: linear-gradient(180deg, #ffffff, #f8fafc) !important;
  border-color: rgba(0, 0, 0, .1) !important;
}

.mobile-nav-token-balance.loading {
  opacity: 0.6;
  pointer-events: none;
}

.mobile-nav-token-balance.loading .token-balance-value::after {
  content: '...';
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {

  0%,
  20% {
    content: '.';
  }

  40% {
    content: '..';
  }

  60%,
  100% {
    content: '...';
  }
}

@media (min-width: 769px) {
  .mobile-nav {
    display: none !important;
  }

  /* Show top header on desktop */
  .top-header {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .top-header .toggle-btn {
    display: none;
  }

  .sidebar {
    display: none;
  }

  /* Ensure brand logo is visible on mobile */
  .top-header .brand {
    display: flex !important;
    align-items: center;
    min-width: 80px;
    flex-shrink: 0;
  }

  .top-header .brand-logo {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: 22px;
    max-width: 100px;
  }

  .top-header .brand picture,
  .top-header .brand img {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Hide token balance pill in top header on mobile (it's in bottom nav) */
  /* Need higher specificity to override global rule and inline styles */
  .top-header .token-balance-pill,
  .top-header-right .token-balance-pill,
  #tokenBalancePill.token-balance-pill {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 56px;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Footer - account for no sidebar on mobile */
  .footer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .footer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-bottom: calc(32px + 80px);
    width: 100% !important;
    max-width: 100% !important;
    /* Account for mobile nav - full width on mobile */
  }

  .mobile-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    border-radius: 20px 20px 0 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 12px !important;
    /* Adjust padding based on safe area - ensures proper spacing on all devices */
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
    min-height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    /* Ensure nav adapts to different screen sizes */
    -webkit-tap-highlight-color: transparent;
    /* Ensure solid background on mobile */
    background: linear-gradient(180deg, rgba(26, 29, 41, .98) 0%, rgba(21, 24, 33, 1) 100%) !important;
    /* Force hardware acceleration */
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    /* Ensure visibility */
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Mobile Nav Token Balance Pill - Standalone, Far Left - Always Visible */
  .mobile-nav-token-balance {
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border-radius: 18px;
    border: 1px solid var(--dx-gold);
    background: rgba(244, 183, 62, 0.1);
    color: var(--dx-gold);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    height: 32px;
    position: absolute;
    left: 8px;
    min-width: fit-content;
  }

  .mobile-nav-token-balance .token-balance-value {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
  }

  .mobile-nav-token-balance .token-balance-logo {
    height: 0.9em;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.9;
    display: block;
  }

  html.light .mobile-nav-token-balance {
    background: rgba(244, 183, 62, 0.08) !important;
    border-color: var(--dx-gold) !important;
    color: #d97706 !important;
  }

  html.light .mobile-nav-token-balance:hover {
    background: rgba(244, 183, 62, 0.12) !important;
    border-color: var(--dx-gold) !important;
  }

  /* Ensure mobile nav items have proper light mode colors */
  html.light .mobile-nav-item {
    border-color: rgba(0, 0, 0, .1) !important;
  }

  html.light .mobile-nav-item:hover {
    border-color: rgba(0, 0, 0, .15) !important;
  }

  html.light .mobile-nav-theme {
    background: rgba(0, 0, 0, .04) !important;
    border-color: rgba(0, 0, 0, .1) !important;
  }

  html.light .mobile-nav-theme:hover {
    background: rgba(0, 0, 0, .08) !important;
    border-color: rgba(0, 0, 0, .15) !important;
  }

  .mobile-nav-token-balance.loading {
    opacity: 0.7;
    cursor: wait;
  }

  /* Center the main nav items (Trade, Home, Stream) */
  .mobile-nav-trade,
  .mobile-nav-home,
  .mobile-nav-earn,
  .mobile-nav-stream {
    order: 0;
    flex-shrink: 0;
    /* Responsive sizing - adjust based on available space */
    width: clamp(40px, 11vw, 44px);
    height: clamp(40px, 11vw, 44px);
    min-width: clamp(40px, 11vw, 44px);
    min-height: clamp(40px, 11vw, 44px);
  }

  /* Theme button stays on the right - use absolute positioning */
  .mobile-nav-theme {
    order: 1;
    position: absolute !important;
    right: max(8px, env(safe-area-inset-right, 8px)) !important;
    margin-left: 0 !important;
    z-index: 20 !important;
    /* Responsive sizing */
    width: clamp(40px, 11vw, 44px) !important;
    height: clamp(40px, 11vw, 44px) !important;
    min-width: clamp(40px, 11vw, 44px) !important;
    min-height: clamp(40px, 11vw, 44px) !important;
  }

  /* Ensure token balance doesn't affect flex centering */
  .mobile-nav-token-balance {
    position: absolute !important;
    left: max(8px, env(safe-area-inset-left, 8px)) !important;
    /* Responsive sizing */
    font-size: clamp(9px, 2.5vw, 11px) !important;
    padding: clamp(4px, 1vw, 5px) clamp(7px, 2vw, 9px) !important;
    height: clamp(28px, 8vw, 32px) !important;
  }

  /* Ensure centered items don't have absolute positioning */
  .mobile-nav-trade,
  .mobile-nav-home,
  .mobile-nav-earn,
  .mobile-nav-stream {
    position: relative !important;
    flex-shrink: 0 !important;
  }
}

/* ===== Diamond Tooltip (Mobile Nav) - Matches Stream Platform Exactly ===== */
.diamond-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.diamond-tooltip.show {
  display: block;
  pointer-events: auto;
  animation: tooltipFadeIn 0.3s ease-out;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.tooltip-content {
  background: linear-gradient(180deg, rgba(26, 29, 41, .98) 0%, rgba(21, 24, 33, .98) 100%);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  min-width: 200px;
  max-width: 260px;
}

.tooltip-text {
  margin: 0 0 10px 0;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, .85);
}

.tooltip-close {
  width: 100%;
  padding: 6px 12px;
  background: var(--dx-emerald);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tooltip-close:hover {
  background: var(--dx-emerald);
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.tooltip-close:active {
  transform: translateY(0);
}

.tooltip-arrow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(255, 255, 255, .1);
}

.tooltip-arrow::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(21, 24, 33, .98);
}

html.light .tooltip-content {
  background: linear-gradient(180deg, rgba(250, 250, 250, .98), rgba(250, 250, 250, .95));
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

html.light .tooltip-text {
  color: rgba(0, 0, 0, .85);
}

html.light .tooltip-arrow {
  border-top-color: rgba(0, 0, 0, .12);
}

html.light .tooltip-arrow::after {
  border-top-color: rgba(250, 250, 250, .95);
}

/* Tablet responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
  .sidebar {
    width: 60px;
  }

  .sidebar .sidebar-nav {
    padding: 12px 8px;
  }

  .sidebar .nav-item-text {
    opacity: 0;
    height: 0;
    overflow: hidden;
    font-size: 0;
  }

  .sidebar .nav-item {
    justify-content: center;
    padding: 12px 8px;
  }

  /* Footer - account for sidebar on tablet */
  .footer {
    margin-left: calc(60px + 8px) !important;
    margin-right: 16px !important;
    width: calc(100vw - 60px - 24px) !important;
  }

  .sidebar.collapsed~.footer {
    margin-left: calc(60px + 8px) !important;
    margin-right: 16px !important;
    width: calc(100vw - 60px - 24px) !important;
  }

  .main-content {
    margin-left: calc(60px + 16px) !important;
  }

  /* Footer - account for sidebar on tablet */
  .footer {
    margin-left: calc(60px + 8px) !important;
    margin-right: 16px !important;
    width: calc(100vw - 60px - 24px) !important;
    max-width: none !important;
  }

  .sidebar.collapsed~.footer {
    margin-left: calc(60px + 8px) !important;
    margin-right: 16px !important;
    width: calc(100vw - 60px - 24px) !important;
  }
}
