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

:root {
  --bg: #f2f5f9;
  --bg-end: #e6ecf4;
  --card: #ffffff;
  --card-soft: rgba(255, 255, 255, 0.9);
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-end: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.1);
  --primary-hover: #3b82f6;
  --border: rgba(148, 163, 184, 0.2);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-lg: 24px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 8px 28px rgba(30, 41, 59, 0.06);
  --shadow-soft: 0 2px 12px rgba(37, 99, 235, 0.06);
  --confirm-dark: #0f172a;
  --confirm-dark-end: #1e293b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, #eef2f7 40%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 88px;
}

.screen {
  display: none;
  padding: 16px 20px 28px;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

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

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

.btn-icon {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--card-soft);
  backdrop-filter: blur(12px);
  font-size: 24px;
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.btn-close { font-size: 28px; }
.btn-back { font-size: 28px; }
.btn-auto {
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-soft) 0%, rgba(59, 130, 246, 0.15) 100%);
  color: var(--primary);
}

.header-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Balance card */
.balance-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card), 0 0 0 1px var(--border);
  position: relative;
  overflow: hidden;
}

.balance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
  opacity: 0.6;
}

.balance-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 500;
}

.btn-eye {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s;
}

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

.balance-amount {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.balance-id {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.balance-card.hidden .balance-amount,
.balance-card.hidden .balance-id {
  filter: blur(8px);
  user-select: none;
}

.balance-card.hidden .balance-amount {
  -webkit-text-fill-color: var(--text);
}

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

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: rgba(37, 99, 235, 0.2);
}

.action-btn:active {
  transform: translateY(0) scale(0.98);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, rgba(59, 130, 246, 0.2) 100%);
  color: var(--primary);
}

.action-btn-exchange .action-icon {
  font-size: 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(59, 130, 246, 0.25) 100%);
}

/* Transactions */
.transactions { margin-bottom: 28px; }

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

.transactions-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.link {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.link:hover { color: var(--primary-hover); }

.transaction-list {
  list-style: none;
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.2s, transform 0.2s;
}

.transaction-item:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.transaction-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.transaction-icon.sent {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
  color: #dc2626;
}

.transaction-icon.received {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.12) 100%);
  color: #16a34a;
}

.transaction-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.transaction-info strong { font-size: 14px; font-weight: 600; }
.transaction-info span { font-size: 12px; color: var(--text-muted); }

.transaction-amount {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.transaction-amount strong { font-size: 15px; font-weight: 700; }
.transaction-amount span { font-size: 12px; color: var(--text-muted); }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 420px;
  width: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 8px 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 254, 0.99) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  z-index: 100;
  box-shadow:
    0 -2px 20px rgba(0, 0, 0, 0.04),
    0 -1px 0 rgba(255, 255, 255, 0.8) inset;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 10px;
  border: none;
  background: none;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 16px;
  transition: color 0.25s ease, transform 0.2s ease, background 0.2s ease;
  min-width: 64px;
}

.nav-item:hover {
  color: var(--text);
}

.nav-item:hover .nav-icon {
  background: rgba(148, 163, 184, 0.12);
  transform: scale(1.05);
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-item.active .nav-icon {
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.18) 0%, rgba(59, 130, 246, 0.22) 100%);
  color: var(--primary);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.25);
  transform: scale(1.08);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.9;
}

.nav-item {
  position: relative;
}

.nav-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.nav-icon-home svg,
.nav-icon-wallet svg {
  width: 26px;
  height: 26px;
}

/* Exchange screen */
.exchange-widget {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card), 0 0 0 1px var(--border);
  position: relative;
  overflow: hidden;
}

.exchange-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 50%, #60a5fa 100%);
  opacity: 0.5;
}

.exchange-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.exchange-row.you-pay { margin-bottom: 10px; }
.exchange-row.you-receive { margin-top: 10px; margin-bottom: 24px; }

.row-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.currency-select {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: opacity 0.2s;
}

.currency-select:hover { opacity: 0.9; }

.currency-flag { font-size: 26px; }
.currency-chevron { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

.balance-line {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.amount-block {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.currency-symbol {
  font-size: 18px;
  color: var(--text-muted);
  font-weight: 600;
}

.amount-input {
  border: none;
  background: none;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  width: 110px;
  text-align: right;
  outline: none;
  letter-spacing: -0.02em;
}

.amount-input::placeholder { color: #94a3b8; }

.amount-output {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.exchange-middle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 0;
}

.btn-swap {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 50%;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.btn-swap:hover {
  transform: scale(1.08) rotate(180deg);
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.btn-swap:active {
  transform: scale(1) rotate(180deg);
}

.rate-line {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-confirm {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-end) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: -0.02em;
}

.btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.4);
}

.btn-confirm:active {
  transform: translateY(0);
}

.btn-arrow { font-size: 20px; opacity: 0.95; }

/* Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px 0;
}

.key {
  height: 56px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: var(--radius-sm);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.key:hover {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.key:active {
  transform: scale(0.96);
  background: #e2e8f0;
}

.key-special { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.key-back { font-size: 20px; }

/* Wallet screen — неоморфная карточка как на фото */
.wallet-card {
  background: linear-gradient(180deg, #f1f4f8 0%, #e8ecf2 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
}

.wallet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  margin-bottom: 12px;
  background: linear-gradient(145deg, #e4e8ee 0%, #dce2ea 100%);
  border-radius: 18px;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.wallet-row.you-pay { margin-bottom: 10px; }
.wallet-row.you-receive { margin-top: 10px; margin-bottom: 22px; }

.wallet-row .row-label {
  color: #94a3b8;
  font-size: 10px;
  letter-spacing: 0.1em;
}

.wallet-row .currency-symbol {
  color: #94a3b8;
  font-weight: 500;
}

.wallet-row .amount-input,
.wallet-row .amount-output {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.wallet-middle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 0;
}

.btn-swap-wallet {
  width: 48px;
  height: 48px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.8) !important;
  color: var(--text);
}

.btn-swap-wallet:hover {
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(148, 163, 184, 0.5) !important;
}

.btn-confirm-wallet {
  background: linear-gradient(180deg, var(--confirm-dark) 0%, var(--confirm-dark-end) 100%) !important;
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.2) !important;
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 700;
}

.btn-confirm-wallet:hover {
  box-shadow:
    0 14px 36px rgba(15, 23, 42, 0.5),
    0 6px 16px rgba(0, 0, 0, 0.25) !important;
  transform: translateY(-1px);
}

#screen-wallet .rate-line {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

.wallet-keypad .key {
  background: linear-gradient(145deg, #f8fafc 0%, #eef2f7 100%);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* Модальные окна */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-overlay.is-open .modal {
  transform: scale(1);
  opacity: 1;
}

.modal {
  display: none;
  width: 100%;
  max-width: 360px;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.modal-overlay.is-open .modal.active {
  display: block;
}

.modal-content {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.4;
}

.modal-field {
  margin-bottom: 16px;
}

.modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-field input,
.modal-field select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-field input:focus,
.modal-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.modal-field input::placeholder {
  color: #94a3b8;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-modal {
  flex: 1;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  border: none;
}

.btn-modal:active {
  transform: scale(0.98);
}

.btn-cancel {
  background: #f1f5f9;
  color: var(--text-muted);
}

.btn-cancel:hover {
  background: #e2e8f0;
  color: var(--text);
}

.btn-confirm-modal {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-end) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-confirm-modal:hover {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}
