:root {
  --bg:         #09011A;
  --bg-2:       #120426;
  --accent:     #8752FA;
  --accent-hov: #CD82FF;
  --text:       #E1E4E1;
  --text-dim:   rgba(225, 228, 225, 0.65);
  --text-mute:  rgba(225, 228, 225, 0.40);
  --border:     rgba(225, 228, 225, 0.10);
  --border-hi:  rgba(135, 82, 250, 0.40);
  --card:       rgba(255, 255, 255, 0.025);
  --danger:     #FF6B8A;
  --success:    #4ADE80;
  --radius:     16px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Figtree', ui-sans-serif, system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* ---------- Ambient background ---------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.55;
  will-change: transform;
}
.bg-glow.a {
  width: 640px; height: 640px;
  background: radial-gradient(circle, #8752FA 0%, transparent 65%);
  top: -180px; left: -120px;
  animation: drift-a 18s ease-in-out infinite alternate;
}
.bg-glow.b {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #CD82FF 0%, transparent 70%);
  bottom: -200px; right: -150px;
  opacity: 0.35;
  animation: drift-b 22s ease-in-out infinite alternate;
}
.bg-glow.c {
  width: 380px; height: 380px;
  background: radial-gradient(circle, #4A1E9E 0%, transparent 70%);
  top: 40%; left: 55%;
  opacity: 0.40;
  animation: drift-c 26s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(80px,  60px) scale(1.05); } }
@keyframes drift-b { to { transform: translate(-60px,-40px) scale(1.08); } }
@keyframes drift-c { to { transform: translate(-40px, 50px) scale(0.95); } }

.bg-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.08 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.4;
  mix-blend-mode: overlay;
}

/* ---------- Layout ---------- */
.page {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 20px;
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 48px;
}
.brandbar img {
  height: 28px;
  width: auto;
  opacity: 0.92;
  filter: drop-shadow(0 0 24px rgba(135, 82, 250, 0.25));
}

.main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12px;
}

.card {
  width: 100%;
  max-width: 480px;
  background:
    linear-gradient(180deg, rgba(135, 82, 250, 0.05) 0%, transparent 50%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px 32px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(135, 82, 250, 0.08) inset;
  animation: cardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Typography ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--text);
}

.lede {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0 0 32px;
  max-width: 42ch;
}

/* ---------- Wallet ---------- */
.wallet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.wallet-row.connected {
  border-color: var(--border-hi);
  background: rgba(135, 82, 250, 0.06);
}
.wallet-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.wallet-label .addr {
  font-family: 'Figtree', monospace;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.wallet-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.wallet-row.connected .wallet-status {
  background: var(--success);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.6);
}

/* ---------- Button pill (connect) ---------- */
.btn-pill {
  appearance: none;
  border: 1px solid var(--accent);
  background: rgba(135, 82, 250, 0.14);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.btn-pill:hover { background: rgba(205, 130, 255, 0.20); border-color: var(--accent-hov); }
.btn-pill:active { transform: scale(0.98); }
.btn-pill:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-pill .spinner { display: none; }
.btn-pill.loading .spinner { display: inline-block; }
.btn-pill.loading .btn-label { opacity: 0.7; }

/* ---------- Amount section ---------- */
.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin: 0 0 12px;
}

.amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.amount-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.12s ease,
    color 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.amount-btn .unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.amount-btn:hover {
  border-color: var(--border-hi);
  background: rgba(135, 82, 250, 0.08);
}
.amount-btn:active { transform: scale(0.98); }
.amount-btn.selected {
  background: rgba(135, 82, 250, 0.14);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 0 20px rgba(135, 82, 250, 0.15);
}

.custom-input-wrap { position: relative; margin-bottom: 26px; }
.custom-input {
  width: 100%;
  appearance: none;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 70px 16px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.custom-input::placeholder { color: var(--text-mute); }
.custom-input:focus { border-color: var(--accent); background: rgba(135, 82, 250, 0.06); }
.custom-input::-webkit-outer-spin-button,
.custom-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.custom-input[type=number] { -moz-appearance: textfield; }
.suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  pointer-events: none;
}

/* ---------- Primary CTA ---------- */
.cta {
  width: 100%;
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 18px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(180deg, var(--accent) 0%, #6D3FD9 100%);
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
  box-shadow: 0 10px 30px rgba(135, 82, 250, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.cta:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent-hov) 0%, var(--accent) 100%);
  box-shadow: 0 10px 36px rgba(205, 130, 255, 0.38);
}
.cta:active:not(:disabled) { transform: scale(0.99); }
.cta:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.cta .spinner { display: none; }
.cta.loading .spinner { display: inline-block; }
.cta.loading .btn-label { opacity: 0.75; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Status panel ---------- */
.status {
  margin-top: 22px;
  padding: 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  display: none;
  border: 1px solid transparent;
  animation: statusIn 0.35s ease both;
}
@keyframes statusIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.status.show    { display: block; }
.status.info    { background: rgba(135, 82, 250, 0.08); border-color: rgba(135, 82, 250, 0.25); color: var(--text); }
.status.success { background: rgba(74, 222, 128, 0.08); border-color: rgba(74, 222, 128, 0.30); color: #C8F7D8; }
.status.error   { background: rgba(255, 107, 138, 0.08); border-color: rgba(255, 107, 138, 0.30); color: #FFD3DD; }
.status .title {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.status.success .title { color: var(--success); }
.status.error   .title { color: var(--danger); }
.status a {
  color: var(--accent-hov);
  text-decoration: none;
  font-weight: 500;
  word-break: break-all;
}
.status a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
footer {
  position: relative;
  z-index: 1;
  padding: 24px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .card { padding: 32px 24px 28px; }
  h1 { font-size: 26px; }
  .brandbar { margin-bottom: 32px; }
  .brandbar img { height: 24px; }
}
