* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 1rem;
  min-height: 100vh;
  background: #08080a;
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -30%, rgba(107, 127, 255, 0.18), transparent 50%),
    radial-gradient(ellipse 80% 60% at 100% 50%, rgba(139, 92, 246, 0.1), transparent 45%),
    radial-gradient(ellipse 70% 50% at 0% 60%, rgba(99, 102, 241, 0.08), transparent 45%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(107, 127, 255, 0.06), transparent 40%);
  color: #e6e6e6;
  position: relative;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}
.wrap { max-width: 420px; margin: 0 auto; position: relative; z-index: 1; }
.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #e6e6e6;
  text-decoration: none;
  margin-right: 1rem;
}
.brand span { color: #6b7fff; }
.brand-tagline { font-size: 0.7rem; font-weight: 400; color: #6b6b7a; letter-spacing: 0.04em; margin-left: 0.15rem; white-space: nowrap; }
nav {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
nav a { color: #8b8b9a; text-decoration: none; font-size: 0.95rem; }
nav a:hover { color: #e6e6e6; }
nav .nav-sep { color: #3a3a42; margin: 0 0.15rem; }
.pool-header {
  text-align: center;
  margin-bottom: 1rem;
}
.pool-title {
  font-size: 1.1rem;
  color: #8b8b9a;
}
.pool-pair {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 0 30px rgba(107, 127, 255, 0.25);
}
.pool-pair span { color: #6b7fff; }
.pool-ctn-usd {
  font-size: 0.8rem;
  color: #8b8b9a;
  margin-top: 0.25rem;
}
.pool-ctn-usd .usd-note { font-size: 0.75rem; opacity: 0.85; }
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  background: rgba(22, 22, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid rgba(107, 127, 255, 0.08);
}
.tabs a {
  flex: 1;
  text-align: center;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  color: #8b8b9a;
  text-decoration: none;
  font-weight: 500;
}
.tabs a:hover { color: #e6e6e6; }
.tabs a.active { background: #222228; color: #e6e6e6; }
.panel { display: none; }
.panel.active { display: block; }
.payto-link-row { display: flex; gap: 0.5rem; align-items: center; }
.payto-link-row .amount-in { flex: 1; }
.pool-back-link {
  display: inline-block;
  font-size: 0.8rem;
  color: #6b7fff;
  text-decoration: none;
  margin-bottom: 0.4rem;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.pool-back-link:hover { opacity: 1; }
.wallet-mode-banner {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
}
.pool-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7fff;
  background: rgba(107, 127, 255, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(107, 127, 255, 0.25);
}
.chart-box {
  background: rgba(22, 22, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  height: 200px;
  border: 1px solid rgba(107, 127, 255, 0.08);
}
.chart-box canvas { width: 100% !important; height: 180px !important; }
.swap-card {
  background: rgba(22, 22, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(107, 127, 255, 0.08);
}
.swap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.swap-row .amount-wrap { flex: 1; min-width: 0; }
.swap-row .token-wrap { flex-shrink: 0; }
.swap-label { font-size: 0.8rem; color: #8b8b9a; margin-bottom: 0.25rem; }
.amount-in {
  width: 100%;
  background: transparent;
  border: none;
  color: #e6e6e6;
  font-size: 1.5rem;
  font-weight: 500;
  outline: none;
}
.amount-in::placeholder { color: #4a4a55; }
.token-btn {
  background: #222228;
  color: #e6e6e6;
  border: 1px solid #2e2e35;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 90px;
}
.token-btn:hover { background: #2a2a32; }
.flip-row {
  display: flex;
  justify-content: center;
  margin: -0.35rem 0;
}
.flip-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #222228;
  border: 2px solid #2e2e35;
  color: #8b8b9a;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flip-btn:hover { background: #2a2a32; color: #e6e6e6; }
.rate-row {
  font-size: 0.85rem;
  color: #8b8b9a;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2e2e35;
}
.rate-row strong { color: #e6e6e6; }
.btn-refresh-quote {
  display: block;
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border: 1px solid #2e2e35;
  border-radius: 8px;
  background: #2a2a32;
  color: #8b8b9a;
  cursor: pointer;
}
.btn-refresh-quote:hover { background: #35353f; color: #e6e6e6; }
.slippage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #8b8b9a;
}
.slippage-row input {
  width: 70px;
  background: #222228;
  border: 1px solid #2e2e35;
  border-radius: 8px;
  color: #e6e6e6;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
}
.receive-to {
  margin-top: 0.75rem;
}
.receive-to label { font-size: 0.8rem; color: #8b8b9a; display: block; margin-bottom: 0.25rem; }
.receive-to input {
  width: 100%;
  background: #222228;
  border: 1px solid #2e2e35;
  border-radius: 10px;
  color: #e6e6e6;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}
.receive-to input::placeholder { color: #4a4a55; }
.btn-swap {
  width: 100%;
  margin-top: 1rem;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: #6b7fff;
  color: #fff;
}
.btn-swap:hover:not(:disabled) { background: #5a6aeb; box-shadow: 0 0 20px rgba(107, 127, 255, 0.35); }
.btn-swap:disabled { opacity: 0.5; cursor: not-allowed; }
.msg {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  font-size: 0.9rem;
  word-break: break-all;
}
.msg.ok { background: #1a2e1a; color: #7dd87d; }
.msg.err { background: #2e1a1a; color: #e88; }
.msg a { color: #6b7fff; }
.msg code { background: #222228; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85em; }
.msg .btn-copy { margin-left: 0.5rem; padding: 0.2rem 0.5rem; font-size: 0.8rem; background: #2e2e35; color: #e6e6e6; border: none; border-radius: 6px; cursor: pointer; }
.msg .btn-copy:hover { background: #3a3a42; }
#loadHint { font-size: 0.8rem; color: #6b6b7a; margin-top: 0.75rem; }
.hint { font-size: 0.8rem; color: #6b6b7a; margin-top: 0.35rem; }
.chart-label { font-size: 0.8rem; color: #8b8b9a; margin-bottom: 0.4rem; }
.liq-intro { font-size: 0.9rem; color: #8b8b9a; margin-bottom: 0.35rem; line-height: 1.4; }
.liq-hint { font-size: 0.8rem; color: #6b7fff; margin-bottom: 1rem; line-height: 1.35; opacity: 0.9; }

/* Pool visualisation */
.pool-viz { margin-bottom: 1rem; }
.pool-bar-wrap {
  background: #1a1a20;
  border-radius: 10px;
  height: 32px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(107,127,255,0.12);
}
.pool-bar-fill {
  height: 100%;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(90deg, #6b7fff 0%, #8b5cf6 100%);
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  min-width: 2%;
}
.pool-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 60%, rgba(255,255,255,0.08));
  border-radius: inherit;
  animation: barShimmer 2s infinite;
}
@keyframes barShimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.pool-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #8b8b9a;
  margin-top: 0.3rem;
}
.pool-bar-labels strong { color: #e6e6e6; }
.pool-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.pool-stat {
  background: rgba(22,22,26,0.85);
  border: 1px solid rgba(107,127,255,0.08);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  text-align: center;
}
.pool-stat .stat-val {
  font-size: 1rem;
  font-weight: 600;
  color: #e6e6e6;
}
.pool-stat .stat-label {
  font-size: 0.7rem;
  color: #8b8b9a;
  margin-top: 0.15rem;
}

/* Swap progress overlay */
.swap-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,8,10,0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.swap-overlay.active { display: flex; }
.swap-progress {
  background: rgba(22,22,26,0.95);
  border: 1px solid rgba(107,127,255,0.15);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
}
.progress-ring-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 1.2rem;
}
.progress-ring {
  transform: rotate(-90deg);
  width: 100px;
  height: 100px;
}
.progress-ring-bg {
  fill: none;
  stroke: #2e2e35;
  stroke-width: 6;
}
.progress-ring-bar {
  fill: none;
  stroke: #6b7fff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 0.6s ease;
}
.progress-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #e6e6e6;
}
.swap-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  text-align: left;
}
.swap-steps li {
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: #4a4a55;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s;
}
.swap-steps li.active { color: #e6e6e6; }
.swap-steps li.done { color: #7dd87d; }
.swap-steps li .step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #2e2e35;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: all 0.3s;
}
.swap-steps li.active .step-icon {
  border-color: #6b7fff;
  background: rgba(107,127,255,0.15);
  animation: stepPulse 1.2s infinite;
}
.swap-steps li.done .step-icon {
  border-color: #7dd87d;
  background: rgba(125,216,125,0.15);
  color: #7dd87d;
}
@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(107,127,255,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(107,127,255,0); }
}
.progress-status {
  font-size: 0.85rem;
  color: #8b8b9a;
  margin-top: 0.5rem;
}
