:root {
  --bg-dark: #0A0E1A;
  --bg-darker: #060810;
  --ton-blue: #0098EA;
  --ton-cyan: #00D4FF;
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated Background */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 50%, #0D1525 100%);
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--ton-blue) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--ton-cyan) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation-delay: -7s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #6366F1 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

.mesh-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.03) 1px, transparent 0);
  background-size: 40px 40px;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(-30px, -20px) scale(1.02); }
}

/* App Container */
.app-container {
  position: relative;
  min-height: 100vh;
}

.app-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 24px;
}

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

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--ton-cyan) 0%, var(--ton-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.network-badge {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.network-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--ton-blue);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.status-connected {
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
}

.status-connecting {
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-disconnected {
  background: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--warning); }
  50% { opacity: 0.5; box-shadow: 0 0 20px var(--warning); }
}

.disconnect-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.disconnect-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* TON Logo */
.ton-logo {
  filter: drop-shadow(0 0 20px var(--ton-cyan));
  transition: all 0.3s ease;
}

.ton-logo.floating {
  animation: floatLogo 3s ease-in-out infinite;
}

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

/* Glass Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
  transition: all 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(0, 152, 234, 0.3);
  box-shadow: 0 8px 32px rgba(0, 152, 234, 0.1);
}

.glass-card-subtle {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  transition: all 0.3s ease;
}

/* Hero Section */
.hero-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.hero-card {
  text-align: center;
  width: 100%;
  background: linear-gradient(135deg, rgba(0, 152, 234, 0.1) 0%, rgba(0, 212, 255, 0.05) 100%);
  border: 1px solid rgba(0, 152, 234, 0.2);
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  margin: 24px 0 8px;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--ton-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 1rem;
}

.connect-btn {
  background: linear-gradient(135deg, var(--ton-blue) 0%, var(--ton-cyan) 100%);
  border: none;
  padding: 16px 48px;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 24px rgba(0, 152, 234, 0.4);
  position: relative;
  overflow: hidden;
}

.connect-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.connect-btn:hover::before {
  left: 100%;
}

.connect-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 152, 234, 0.5);
}

.connect-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.wallet-icons {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.wallet-icon {
  font-size: 2rem;
  opacity: 0.6;
  transition: all 0.3s ease;
  cursor: pointer;
}

.wallet-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Dashboard */
.dashboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Balance Card */
.balance-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(0, 152, 234, 0.15) 0%, rgba(0, 212, 255, 0.08) 100%);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.balance-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(0, 152, 234, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.balance-content {
  position: relative;
  z-index: 1;
}

.balance-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.balance-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--ton-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.balance-usd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.balance-usd {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.balance-change {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
}

.balance-change.positive {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.balance-change.negative {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-action:hover {
  transform: translateY(-4px);
  background: rgba(0, 152, 234, 0.1);
  border-color: var(--ton-blue);
  box-shadow: 0 8px 24px rgba(0, 152, 234, 0.2);
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ton-blue) 0%, var(--ton-cyan) 100%);
  border-radius: 12px;
  font-size: 1.2rem;
  color: white;
}

.quick-action-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Transactions */
.transactions-section, .assets-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.transactions-list, .assets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tx-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.1rem;
}

.tx-icon.receive {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.tx-icon.send {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.tx-details {
  flex: 1;
  min-width: 0;
}

.tx-address-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tx-address {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.3s ease;
  font-size: 0.8rem;
}

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

.tx-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tx-right {
  text-align: right;
}

.tx-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  display: block;
}

.tx-amount.receive {
  color: var(--success);
}

.tx-amount.send {
  color: var(--error);
}

.tx-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 8px;
  text-transform: capitalize;
}

.tx-status.confirmed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.tx-status.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 32px;
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Assets */
.asset-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.asset-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  font-size: 1.5rem;
}

.asset-info {
  flex: 1;
}

.asset-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
}

.asset-symbol {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.asset-values {
  text-align: right;
}

.asset-balance {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  display: block;
}

.asset-usd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

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

.asset-change {
  font-size: 0.75rem;
  font-weight: 500;
}

.asset-change.positive {
  color: var(--success);
}

.asset-change.negative {
  color: var(--error);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.modal-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  width: 100%;
}

.modal-input:focus {
  outline: none;
  border-color: var(--ton-blue);
  box-shadow: 0 0 0 3px rgba(0, 152, 234, 0.1);
}

.modal-input::placeholder {
  color: var(--text-muted);
}

.amount-input-row {
  display: flex;
  gap: 8px;
}

.max-btn {
  background: rgba(0, 152, 234, 0.2);
  border: 1px solid var(--ton-blue);
  color: var(--ton-cyan);
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.max-btn:hover {
  background: rgba(0, 152, 234, 0.3);
}

.fee-estimate {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.confirm-btn {
  background: linear-gradient(135deg, var(--ton-blue) 0%, var(--ton-cyan) 100%);
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.confirm-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 152, 234, 0.4);
}

/* Receive Modal */
.receive-modal {
  text-align: center;
}

.qr-placeholder {
  background: white;
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 16px;
}

.qr-code {
  font-size: 6rem;
  line-height: 1;
}

.qr-placeholder p {
  color: #333;
  margin-top: 8px;
  font-size: 0.85rem;
}

.address-display {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
}

.full-address {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  word-break: break-all;
  color: var(--text-secondary);
}

.copy-address-btn, .share-btn {
  background: rgba(0, 152, 234, 0.2);
  border: 1px solid var(--ton-blue);
  color: var(--ton-cyan);
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-address-btn:hover, .share-btn:hover {
  background: rgba(0, 152, 234, 0.3);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--glass-border);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--text-primary);
  z-index: 2000;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Footer */
.footer {
  margin-top: auto;
  padding: 24px 0;
  text-align: center;
}

.security-notice {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--ton-cyan);
}

.footer-links span {
  color: var(--text-muted);
}

/* Mobile Optimizations */
@media (max-width: 400px) {
  .app-content {
    padding: 12px;
  }

  .balance-amount {
    font-size: 2rem;
  }

  .quick-actions {
    gap: 8px;
  }

  .quick-action {
    padding: 12px 4px;
  }

  .quick-action-icon {
    width: 36px;
    height: 36px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .connect-btn {
    padding: 14px 36px;
  }
}