:root {
  --color-bg: #070b12;
  --color-bg-alt: #0a121c;
  --color-surface: #101a28;
  --color-surface-alt: #152232;
  --color-border: rgba(0, 229, 160, 0.15);
  --color-border-strong: rgba(0, 229, 160, 0.32);
  --color-primary: #00e5a0;
  --color-primary-rgb: 0,229,160;
  --color-danger: #DC2626;
  --color-text: #F8FBFF;
  --color-text-dim: rgba(255, 255, 255, 0.55);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px -2px rgba(0,0,0,.5);
  --shadow: 0 16px 48px -12px rgba(0,0,0,.65);
  --focus: 0 0 0 2px rgba(0, 229, 160, .35);
  --grad-primary: linear-gradient(135deg, #00e5a0 0%, #0ea5e9 100%);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html {
  background: #070b12;
}
body,html { margin:0; padding:0; font-family: 'Inter',system-ui,-apple-system,Segoe UI,Roboto,sans-serif; }
body { 
  background: #070b12;
  color: #fff; 
  margin:0;
  position: relative;
  overflow-x: hidden;
}

.app-body { 
  min-height:100vh; 
  display:flex; 
  flex-direction:column;
  background: #070b12;
  position: relative;
  isolation: isolate;
}

/* ── Animated background layer ── */
.app-bg-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.app-bg-fx__aurora {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(ellipse 45% 38% at 72% 18%, rgba(0, 229, 160, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 42% 36% at 18% 78%, rgba(76, 201, 255, 0.14) 0%, transparent 52%),
    radial-gradient(ellipse 35% 30% at 48% 52%, rgba(14, 165, 233, 0.08) 0%, transparent 60%);
  animation: bgAurora 18s ease-in-out infinite alternate;
}

.app-bg-fx__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 160, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 201, 255, 0.02) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 42%, black 8%, transparent 82%);
  animation: bgGridDrift 24s linear infinite;
}

.app-bg-fx__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}

.app-bg-fx__orb--1 {
  width: 480px;
  height: 480px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, rgba(0, 229, 160, 0.22) 0%, transparent 68%);
  animation: bgOrb1 22s ease-in-out infinite;
}

.app-bg-fx__orb--2 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  left: -70px;
  background: radial-gradient(circle, rgba(76, 201, 255, 0.18) 0%, transparent 70%);
  animation: bgOrb2 26s ease-in-out infinite;
}

.app-bg-fx__orb--3 {
  width: 280px;
  height: 280px;
  top: 42%;
  left: 55%;
  background: radial-gradient(circle, rgba(95, 255, 208, 0.12) 0%, transparent 72%);
  animation: bgOrb3 16s ease-in-out infinite;
}

.app-bg-fx__ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
  background:
    linear-gradient(#070b12, #070b12) padding-box,
    linear-gradient(135deg, rgba(0, 229, 160, 0.5), rgba(76, 201, 255, 0.12)) border-box;
  opacity: 0.28;
}

.app-bg-fx__ring--1 {
  width: 320px;
  height: 320px;
  top: 14%;
  right: 8%;
  animation: bgRing1 40s linear infinite;
}

.app-bg-fx__ring--2 {
  width: 200px;
  height: 200px;
  bottom: 18%;
  left: 10%;
  opacity: 0.18;
  animation: bgRing2 55s linear infinite;
}

.app-bg-fx__beam {
  position: absolute;
  width: 2px;
  height: 140px;
  background: linear-gradient(180deg, transparent, rgba(0, 229, 160, 0.55), transparent);
  border-radius: 2px;
  filter: blur(0.5px);
  opacity: 0;
  animation: bgBeam 7s ease-in-out infinite;
}

.app-bg-fx__beam--1 {
  top: 8%;
  left: 22%;
  --beam-rot: 25deg;
  animation-delay: 0s;
}

.app-bg-fx__beam--2 {
  top: 55%;
  right: 18%;
  --beam-rot: -18deg;
  animation-delay: 3.5s;
}

.app-bg-fx__spark {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #5fffd0;
  box-shadow: 0 0 8px 2px rgba(0, 229, 160, 0.45);
  opacity: 0;
  top: var(--t, 50%);
  left: var(--l, 50%);
  animation: bgSpark var(--dur, 6s) ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.55s);
}

.app-bg-fx__spark:nth-of-type(even) {
  background: #4cc9ff;
  box-shadow: 0 0 8px 2px rgba(76, 201, 255, 0.4);
  width: 2px;
  height: 2px;
}

@keyframes bgAurora {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-3%, 2%) scale(1.06); }
  100% { transform: translate(2%, -2%) scale(1.02); }
}

@keyframes bgGridDrift {
  0%   { background-position: 0 0; }
  100% { background-position: 72px 72px; }
}

@keyframes bgOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-40px, 30px) scale(1.08); }
  66%      { transform: translate(20px, -25px) scale(0.95); }
}

@keyframes bgOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%      { transform: translate(35px, -30px) scale(1.1); }
  70%      { transform: translate(-25px, 20px) scale(0.92); }
}

@keyframes bgOrb3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  50%      { transform: translate(calc(-50% + 30px), calc(-50% - 40px)) scale(1.15); opacity: 1; }
}

@keyframes bgRing1 {
  0%   { transform: rotate(0deg) translateY(0); }
  50%  { transform: rotate(180deg) translateY(-16px); }
  100% { transform: rotate(360deg) translateY(0); }
}

@keyframes bgRing2 {
  0%   { transform: rotate(0deg) translateY(0); }
  50%  { transform: rotate(-180deg) translateY(12px); }
  100% { transform: rotate(-360deg) translateY(0); }
}

@keyframes bgBeam {
  0%, 100% { opacity: 0; transform: rotate(var(--beam-rot, 0deg)) translateY(0) scaleY(0.6); }
  15%      { opacity: 0.7; }
  50%      { opacity: 0.35; transform: rotate(var(--beam-rot, 0deg)) translateY(60px) scaleY(1); }
  85%      { opacity: 0; }
}

@keyframes bgSpark {
  0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
  20%      { opacity: 0.9; transform: translateY(-8px) scale(1); }
  50%      { opacity: 0.4; transform: translateY(-22px) scale(0.8); }
  80%      { opacity: 0.75; transform: translateY(-12px) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .app-bg-fx__aurora,
  .app-bg-fx__grid,
  .app-bg-fx__orb,
  .app-bg-fx__ring,
  .app-bg-fx__beam,
  .app-bg-fx__spark {
    animation: none !important;
  }
  .app-bg-fx__aurora {
    transform: none;
  }
}

.app-body::before,
.app-body::after {
  display: none;
}

.app-header {
  backdrop-filter: blur(16px);
  background: rgba(10, 18, 28, 0.82);
  border-bottom: 1px solid var(--color-border);
  padding: 10px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  position:sticky;
  top:0;
  z-index:20;
}

.brand { display:flex; align-items:center; gap:14px; }
.brand-name { font-weight:600; font-size:16px; letter-spacing:.5px; }

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.logo-dot {
  width:18px; height:18px; border-radius:50%;
  background: var(--grad-primary);
  box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.12), 0 0 18px -4px rgba(0,229,160,.45);
}

.network-select-wrapper { position:relative; display:flex; align-items:center; gap:8px; }
.select {
  background: var(--color-surface);
  color: var(--color-text) !important;
  border:1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size:12px;
  padding:4px 8px;
  appearance:none;
  cursor:pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  -webkit-text-fill-color: var(--color-text) !important;
}
.select:focus { outline:none; box-shadow: var(--focus); }
.select option {
  color: var(--color-text) !important;
  background: var(--color-surface);
}

/* Переключатель сетей в swap карточке */
.network-switch-wrapper {
  display: flex;
  align-items: center;
  position: relative;
}

/* New network selector button */
.network-select-btn {
  background: var(--color-surface-alt);
  color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.25s;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: space-between;
}

.network-select-btn:hover {
  background: #2E3A48;
  border-color: var(--color-border-strong);
}

.network-select-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.network-select-arrow {
  font-size: 9px;
  transition: transform 0.2s;
}

.network-select-btn.active .network-select-arrow {
  transform: rotate(180deg);
}

.network-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #1a1b23;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 160px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.network-dropdown.hidden {
  display: none;
}

.network-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
}

.network-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.network-option.selected {
  background: rgba(99, 102, 241, 0.15);
}

.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Old select styles - keep for backwards compatibility */
select.network-switcher,
.select.network-switcher,
#networkSelect {
  background: var(--color-surface-alt) !important;
  color: #ffffff !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 11px !important;
  padding: 4px 8px !important;
  appearance: none !important;
  cursor: pointer !important;
  transition: .25s;
  min-width: auto !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  font-weight: 500 !important;
  -webkit-text-fill-color: #ffffff !important;
}

.wallet-area { display:flex; align-items:center; gap:10px; }
.account-disconnect {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
}
.account-tag {
  background: var(--color-surface);
  border:1px solid var(--color-border);
  padding:6px 10px;
  font-size:12px;
  border-radius: var(--radius-sm);
  letter-spacing:.5px;
}

.main-shell {
  flex:1;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:52px 18px 80px;
  position: relative;
  z-index: 1;
}

.swap-card {
  width:100%;
  max-width: 470px;
  background: linear-gradient(135deg,#1b2430,#1a202b 55%,#1c2734);
  border:1px solid rgba(255,255,255,.04);
  border-radius: var(--radius-lg);
  padding:28px 28px 32px;
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  gap:24px;
  position:relative;
  overflow:hidden;
}

.swap-card:before {
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 85% 15%, rgba(0,229,160,.08), transparent 60%),
    radial-gradient(circle at 15% 85%, rgba(76,201,255,.07), transparent 60%);
  pointer-events:none;
}

.swap-card-head { display:flex; align-items:center; justify-content:space-between; }
.swap-card-head h1 { margin:0; font-size:20px; letter-spacing:.5px; font-weight:600; }
.price-status { font-size:11px; color: var(--color-text-dim); }

.field-block { display:flex; flex-direction:column; gap:10px; }
.field-label-row { display:flex; align-items:center; justify-content:space-between; }
.field-label { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.8px; color: var(--color-text-dim); }
.mini-balance { font-size:11px; color: var(--color-text-dim); }

.token-input-row {
  display:flex; gap:10px; align-items:center;
  background: var(--color-surface);
  border:1px solid var(--color-border);
  padding:10px 12px;
  border-radius: var(--radius);
  transition:.25s;
}
.token-input-row:focus-within {
  border-color: var(--color-border-strong);
  box-shadow:0 0 0 1px var(--color-border-strong), 0 0 0 3px rgba(var(--color-primary-rgb), .15);
}

.token-select-btn {
  background: var(--color-surface-alt);
  border:1px solid var(--color-border);
  color: var(--color-text);
  font-size:13px;
  font-weight:600;
  padding:8px 14px;
  border-radius: var(--radius-sm);
  cursor:pointer;
  transition:.25s;
  min-width:84px;
  display:flex; justify-content:center;
}
.token-select-btn:hover {
  background:#2E3A48;
}
.token-select-btn:focus {
  outline:none;
  box-shadow: var(--focus);
}

.amount-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.amount-input {
  flex:1;
  background:transparent;
  border:none;
  color: var(--color-text);
  font-size:18px;
  font-weight:500;
  letter-spacing:.5px;
  outline:none;
  padding:0;
}
.amount-input::placeholder { color: #566171; }

.max-btn {
  background: var(--grad-primary) !important;
  border: none !important;
  color: white !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px;
  padding: 14px 20px !important;
  border-radius: var(--radius) !important;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  opacity: 0.9;
  height: auto !important;
  min-width: fit-content;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.max-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 229, 160, 0.28);
}

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

.max-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* Token Logo Styles */
.token-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface-alt);
  flex-shrink: 0;
  /* Четкий рендеринг изображений */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.token-btn-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 6px;
}

.token-info-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.token-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Token Images Manager */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.token-image-card {
  background: #1e2328;
  border: 1px solid #2b2f36;
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.token-image-card:hover {
  border-color: #4a9eff;
  transform: translateY(-2px);
}

.token-image-preview {
  text-align: center;
  margin-bottom: 16px;
}

.token-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #2b2f36;
}

.token-image-info h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: #c9d1d9;
}

.token-image-info p {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: #8b949e;
}

.token-actions {
  display: flex;
  gap: 8px;
}

/* Image Editor Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.image-editor-modal {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #30363d;
}

.modal-header h3 {
  margin: 0;
  color: #c9d1d9;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #8b949e;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-body {
  padding: 20px;
}

.upload-section {
  text-align: center;
  padding: 40px 20px;
  border: 2px dashed #30363d;
  border-radius: 8px;
  margin-bottom: 20px;
}

.upload-info {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #8b949e;
}

.crop-section {
  margin: 20px 0;
}

.crop-container {
  max-height: 400px;
  overflow: hidden;
  margin-bottom: 16px;
}

.crop-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.preview-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #30363d;
}

.preview-sizes {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.preview-item {
  text-align: center;
}

.preview-item span {
  display: block;
  font-size: 11px;
  color: #8b949e;
  margin-bottom: 8px;
}

.preview-frame {
  border: 1px solid #30363d;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #161b22;
}

.preview-frame.size-64 {
  width: 66px;
  height: 66px;
}

.preview-frame.size-32 {
  width: 34px;
  height: 34px;
}

.preview-frame.size-16 {
  width: 18px;
  height: 18px;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #30363d;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.switch-zone {
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  margin-top:-6px;
  margin-bottom:-6px;
}
.switch-circle {
  width:42px; height:42px;
  border-radius:50%;
  background: var(--color-surface-alt);
  border:1px solid var(--color-border);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  font-size:18px;
  color: var(--color-text);
  transition:.25s;
  box-shadow: var(--shadow-sm);
  position:relative;
  z-index:2;
}
.switch-circle:hover { background:#2d3742; }
.switch-circle:active { transform: scale(.92); }

.quote-panel {
  background: var(--color-surface);
  border:1px solid var(--color-border);
  border-radius: var(--radius);
  padding:16px 18px;
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
}
.quote-row {
  display:flex; align-items:center; justify-content:space-between;
  color: var(--color-text-dim);
}
.quote-row span:last-child {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight:500;
}
.quote-row.final {
  padding-top:6px;
  margin-top:4px;
  border-top:1px dashed var(--color-border);
}
.quote-row.final span:last-child {
  font-size:15px;
  font-weight:600;
  background: linear-gradient(90deg,#fff,#c7d2fe);
  -webkit-background-clip:text;
  color:transparent;
}

.btn {
  border:none;
  cursor:pointer;
  font-weight:600;
  font-size:14px;
  line-height:1;
  padding:14px 20px;
  border-radius: var(--radius);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  position:relative;
  transition:.3s;
  letter-spacing:.3px;
}

.btn-primary {
  background: var(--grad-primary);
  color:#fff;
  box-shadow:0 6px 20px -6px rgba(136,84,246,.55);
}
.btn-primary:hover {
  filter:brightness(1.06);
  transform:translateY(-2px);
}
.btn-primary:active { transform:translateY(0); }
.btn-primary:disabled {
  opacity:.35;
  cursor:not-allowed;
  transform:none;
  box-shadow:none;
}

.btn-secondary {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border:1px solid var(--color-border);
}
.btn-secondary:hover {
  background:#2d3947;
}
.btn-secondary:active {
  background:#24313f;
}

.w-full { width:100%; }

.disclaimer {
  margin:0;
  font-size:11px;
  line-height:1.4;
  color: var(--color-text-dim);
  background: rgba(255,255,255,.02);
  padding:10px 12px;
  border:1px dashed var(--color-border);
  border-radius: var(--radius-sm);
}

.modal {
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:60;
  padding:20px;
  pointer-events: none; /* Контейнер не блокирует клики */
}
.modal.hidden {
  display:none !important;
}
.modal > * {
  pointer-events: auto; /* Дети модалки принимают клики */
}
.modal-overlay {
  position:absolute;
  inset:0;
  background:rgba(8,12,18,.75);
  opacity:0;
  animation:fadeIn .25s forwards;
  /* Убрано backdrop-filter - оно размывало содержимое модалки */
  z-index: 1;
  pointer-events: auto;
}
.modal-dialog {
  position:relative;
  width:100%;
  max-width:520px;
  background: #1e2734;
  border:1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding:22px 24px 24px;
  box-shadow:0 20px 70px -10px rgba(0,0,0,.95);
  transform:translateY(14px) scale(.96);
  opacity:0;
  animation:popIn .28s cubic-bezier(.34,1.4,.64,1) forwards;
  display:flex;
  flex-direction:column;
  gap:14px;
  max-height:80vh;
  z-index:2;
  /* Гарантируем четкий рендеринг без размытия */
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  pointer-events: auto;
}
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
}
.modal-header h2 { margin:0; font-size:18px; letter-spacing:.5px; }

.modal-close {
  background: var(--color-surface-alt);
  border:1px solid var(--color-border);
  width:34px; height:34px;
  border-radius:10px;
  cursor:pointer;
  font-size:20px;
  line-height:1;
  color: var(--color-text);
  display:flex; align-items:center; justify-content:center;
  transition:.25s;
}
.modal-close:hover { background:#304050; }

.modal-search { position:sticky; top:0; background:inherit; }
.modal-search {
  position: relative;
}

.search-input {
  width:100%;
  padding:10px 40px 10px 14px;
  background: var(--color-surface);
  border:1px solid var(--color-border);
  border-radius:9px;
  font-size:13px;
  color: var(--color-text-primary);
  transition:.2s;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--color-text-secondary);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: .2s;
}

.search-clear:hover {
  background: rgba(255,255,255,0.15);
  color: var(--color-text-primary);
}
.search-input:focus { border-color: var(--color-border-strong); box-shadow: var(--focus); }

.token-list {
  overflow-y: auto;
  overflow-x: hidden;
  display:flex;
  flex-direction:column;
  gap:7px;
  max-height: 400px;
  /* Стилизация скроллбара */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.token-list::-webkit-scrollbar {
  width: 6px;
}

.token-list::-webkit-scrollbar-track {
  background: transparent;
}

.token-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.token-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.token-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: var(--color-surface);
  border:1px solid var(--color-border);
  padding:10px 12px 10px 14px;
  border-radius: 11px;
  cursor:pointer;
  gap:12px;
  transition:.22s;
  position:relative;
  /* Четкий рендеринг текста */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.token-row:hover {
  background:#273342;
  border-color: var(--color-border-strong);
}
.token-row:active { transform:scale(.985); }
.token-row-left { display:flex; align-items:center; gap:12px; }
.token-avatar {
  width:32px; height:32px;
  border-radius:50%;
  background: linear-gradient(145deg,#414d5b,#202a34);
  color:#fff;
  font-size:13px;
  display:flex; align-items:center; justify-content:center;
  font-weight:600;
  letter-spacing:.5px;
  border:1px solid #465363;
}
.token-symbol { font-weight:600; font-size:14px; }
.token-name { font-size:11px; color: var(--color-text-dim); letter-spacing:.3px; }
.token-address { font-size:10px; opacity:.55; letter-spacing:.4px; }

.hidden { display:none !important; }

.toast-container {
  position:fixed;
  top:16px; right:16px;
  display:flex; flex-direction:column; gap:10px;
  z-index:120;
}
.toast {
  background: linear-gradient(135deg,#1d2530,#1d2c3a);
  border:1px solid var(--color-border);
  color: var(--color-text);
  padding:12px 16px;
  font-size:13px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  animation:fadeIn .25s ease;
  position:relative;
  overflow:hidden;
}
.toast:before {
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(90deg,rgba(255,255,255,.06),rgba(255,255,255,0));
  opacity:.35;
}
.toast.error {
  border-color: rgba(220,38,38,.8);
  background:linear-gradient(135deg,#2c1213,#391a1b);
}

.skeleton {
  position:relative;
  overflow:hidden;
  background:#24303c;
  border-radius:6px;
  height:12px;
}
.skeleton:after {
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.08),rgba(255,255,255,0));
  animation:shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { transform:translateX(-100%); }
  100% { transform:translateX(100%); }
}

@keyframes fadeIn {
  to { opacity:1; }
}
@keyframes popIn {
  0% { opacity:0; transform:translateY(22px) scale(.94); }
  70% { opacity:1; transform:translateY(-2px) scale(1.008); }
  100% { transform:translateY(0) scale(1); opacity:1; }
}

/* Снег убран */

@media (max-width:680px) {
  .swap-card {
    padding:24px 20px 28px;
    max-width:520px;
  }
  .app-header { padding:8px 14px; }
  .swap-card-head { 
    flex-wrap: nowrap;
    gap: 10px;
  }
  .swap-card-head h1 { font-size:18px; }
  .network-switch-wrapper {
    flex-shrink: 0;
  }
  .network-switcher {
    font-size: 11px;
    padding: 6px 10px;
  }
  .amount-input { font-size:17px; }
  .brand-logo { height: 28px; }
  
  /* MAX кнопка для планшетов */
  .max-btn {
    font-size: 8px !important;
    padding: 8px 12px !important;
  }
}

@media (max-width:460px) {
  .swap-card {
    border-radius:16px;
    gap:20px;
  }
  .token-input-row { padding:10px 11px; }
  .token-select-btn { min-width:70px; padding:7px 12px; font-size:12px; }
  .amount-input { font-size:16px; }
  .btn { padding:12px 16px; font-size:13px; }
  .modal-dialog { padding:18px 18px 20px; }
  .token-row { padding:9px 11px 9px 13px; }
  .brand-logo { height: 24px; }
  
  /* Уменьшаем кнопку MAX для мобильных, сохраняя пропорции */
  .max-btn {
    font-size: 7px !important;
    padding: 6px 8px !important;
    border-radius: 4px !important;
    margin: 0 !important;
    min-width: auto !important;
    height: auto !important;
  }
  
  /* Уменьшаем gap в amount-input-wrapper */
  .amount-input-wrapper {
    gap: 6px !important;
    padding-right: 0 !important;
  }
  
  /* Убеждаемся что input не выходит за границы */
  .token-input-row {
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  
  /* Уменьшаем размер шрифта в поле ввода на мобильных */
  .amount-input-wrapper .amount-input {
    font-size: 15px !important;
  }
  
  /* Адаптивность quote panel */
  .quote-panel {
    padding: 12px 14px;
    font-size: 12px;
  }
  
  .quote-row.final span:last-child {
    font-size: 14px;
  }
  
  /* Фикс для селектора сети на мобильных */
  select.network-switcher,
  #networkSelect {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    opacity: 1 !important;
    font-weight: 600 !important;
    text-shadow: 0 0 2px rgba(255,255,255,0.8) !important;
    min-height: 28px !important;
    line-height: normal !important;
    font-size: 12px !important;
  }
  
  select.network-switcher option,
  #networkSelect option {
    color: #000000 !important;
    background: #ffffff !important;
    font-weight: 500 !important;
    -webkit-text-fill-color: #000000 !important;
  }
}

/* Для очень маленьких экранов (маленькие смартфоны) */
@media (max-width:380px) {
  .max-btn {
    font-size: 6px !important;
    padding: 5px 6px !important;
    letter-spacing: 0.3px !important;
  }
  
  .token-input-row {
    padding: 6px 8px !important;
    gap: 6px !important;
  }
  
  .amount-input-wrapper {
    gap: 4px !important;
  }
  
  .amount-input-wrapper .amount-input {
    font-size: 14px !important;
  }
  
  .token-select-btn {
    min-width: 60px !important;
    padding: 6px 10px !important;
    font-size: 11px !important;
  }


/* Success Modal Styles */
.success-modal-dialog {
  max-width: 440px !important;
  background: linear-gradient(135deg, #1a1b23 0%, #2d2e3a 100%);
  border: 2px solid #10B981;
  border-radius: 20px;
  padding: 40px 40px 36px 40px;
  text-align: center;
  animation: successSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 20px 60px rgba(16, 185, 129, 0.3), 0 0 0 1px rgba(16, 185, 129, 0.1);
  position: relative;
}

@keyframes successSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.success-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.success-close:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.success-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  padding: 0 8px;
}

.success-title {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
  text-align: center;
  width: 100%;
}

.success-message {
  font-size: 15px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.55;
  max-width: 340px;
  word-wrap: break-word;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.success-summary {
  display: block;
  color: #e2e8f0;
  line-height: 1.6;
}

.success-subtitle {
  display: block;
  font-size: 13px;
  color: #8b949e;
}

.success-address {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  word-break: break-all;
}

.success-icon {
  margin: 8px 0;
  animation: successIconPop 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

@keyframes successIconPop {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-45deg);
  }
  60% {
    transform: scale(1.1) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.success-icon svg {
  filter: drop-shadow(0 6px 20px rgba(16, 185, 129, 0.35));
  display: block;
}

.success-btn {
  width: 100%;
  max-width: 100%;
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  margin-top: 4px;
}

.success-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

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

/* Mobile responsiveness for success modal */
@media (max-width: 640px) {
  .success-modal-dialog {
    max-width: 90% !important;
    padding: 32px 28px 28px 28px;
    border-radius: 18px;
  }

  .success-title {
    font-size: 26px;
  }

  .success-message {
    font-size: 14px;
    max-width: 100%;
    padding: 0 4px;
  }

  .success-address {
    max-width: 100%;
    font-size: 11px;
  }

  .success-icon {
    margin: 6px 0;
  }

  .success-icon svg {
    width: 90px;
    height: 90px;
  }

  .success-btn {
    font-size: 14px;
    padding: 12px 24px;
  }

  .success-close {
    width: 28px;
    height: 28px;
    font-size: 18px;
    top: 10px;
    right: 10px;
  }

  /* Network selector mobile styles */
  .network-select-btn {
    min-width: 90px;
    padding: 6px 10px;
    font-size: 10px;
  }

  .network-select-text {
    font-size: 11px;
  }

  .network-dropdown {
    min-width: 140px;
  }

  .network-option {
    font-size: 12px;
    padding: 8px 10px;
  }
}