:root {
  color-scheme: dark;

  --bg: #07100c;
  --surface: rgba(17, 29, 23, 0.72);
  --surface-solid: #0f1a15;
  --surface-hi: rgba(255, 255, 255, 0.04);
  --line: rgba(190, 255, 220, 0.09);
  --line-hi: rgba(190, 255, 220, 0.18);

  --text: #eef6f1;
  --muted: #9bb0a4;
  --faint: #66796e;

  --emerald: #3ee59a;
  --emerald-deep: #10b981;
  --emerald-ink: #03271a;
  --gold: #f6cf7a;
  --ember: #ff8a4c;
  --danger: #ff7a7a;

  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --font-display: "Zen Maru Gothic", ui-rounded, system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 0% -10%, rgba(62, 229, 154, 0.16), transparent 60%),
    radial-gradient(700px 480px at 110% 105%, rgba(255, 138, 76, 0.13), transparent 60%),
    radial-gradient(600px 400px at 100% 10%, rgba(246, 207, 122, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* film grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

img { display: block; max-width: 100%; }

.wrap {
  position: relative;
  z-index: 1;
  width: min(600px, 100% - 32px);
  margin-inline: auto;
  padding: 24px 0 48px;
}

/* ---------- Sparkles ---------- */

.sparkles span {
  position: fixed;
  z-index: 0;
  color: var(--gold);
  opacity: 0;
  font-size: 14px;
  pointer-events: none;
  animation: twinkle 7s var(--ease) infinite;
}
.sparkles span:nth-child(1) { top: 12%; left: 8%;  animation-delay: 0s; }
.sparkles span:nth-child(2) { top: 28%; right: 7%; animation-delay: 1.2s; color: var(--emerald); }
.sparkles span:nth-child(3) { top: 55%; left: 4%;  animation-delay: 2.4s; font-size: 10px; }
.sparkles span:nth-child(4) { top: 70%; right: 10%; animation-delay: 3.6s; }
.sparkles span:nth-child(5) { top: 86%; left: 14%; animation-delay: 4.8s; color: var(--emerald); font-size: 18px; }
.sparkles span:nth-child(6) { top: 6%;  right: 22%; animation-delay: 6s; font-size: 10px; }

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: translateY(0) scale(0.6) rotate(0deg); }
  40%      { opacity: 0.9; transform: translateY(-10px) scale(1) rotate(45deg); }
  70%      { opacity: 0; transform: translateY(-18px) scale(0.7) rotate(90deg); }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  animation: rise 0.8s var(--ease) both;
}

.hero__banner {
  position: relative;
  aspect-ratio: 3 / 1;
  background: linear-gradient(120deg, #1d3a2c, #3a2a18);
}
.hero__banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 35%, var(--surface-solid) 100%);
}

.hero__body {
  position: relative;
  margin-top: -58px;
  padding: 0 22px 28px;
  text-align: center;
}

.avatar {
  width: 112px;
  height: 112px;
  margin: 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: #1d3a2c;
  border: 4px solid var(--surface-solid);
  box-shadow:
    0 0 0 2px var(--emerald),
    0 12px 40px -6px rgba(62, 229, 154, 0.45);
}

.name {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 7vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, #fff6dc 0%, var(--gold) 45%, var(--emerald) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.handle {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s;
}
.handle:hover { color: var(--emerald); }

.bubble {
  position: relative;
  max-width: 400px;
  margin: 22px auto 0;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(62, 229, 154, 0.07);
  border: 1px solid rgba(62, 229, 154, 0.22);
  font-size: 0.98rem;
  line-height: 1.5;
}
.bubble::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: #11241b;
  border-left: 1px solid rgba(62, 229, 154, 0.22);
  border-top: 1px solid rgba(62, 229, 154, 0.22);
  transform: translateX(-50%) rotate(45deg);
}
.bubble em {
  font-style: normal;
  color: var(--gold);
}

/* ---------- Section ---------- */

.section {
  margin-top: 36px;
  animation: rise 0.8s 0.1s var(--ease) both;
}

.section__head { text-align: center; }
.section__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.6rem;
}
.section__head p {
  max-width: 420px;
  margin: 6px auto 0;
  color: var(--muted);
}

.steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 22px;
  padding: 0;
  list-style: none;
}
.steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--surface-hi);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.steps span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--emerald);
  color: var(--emerald-ink);
  font-weight: 700;
  font-size: 0.75rem;
}

/* ---------- Wallet cards ---------- */

.wallets {
  display: grid;
  gap: 12px;
}

.wallet {
  --coin: var(--emerald);
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: border-color 0.25s, transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  animation: rise 0.7s var(--ease) both;
}
.wallet:hover {
  border-color: color-mix(in srgb, var(--coin) 45%, transparent);
  box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--coin) 70%, transparent);
  transform: translateY(-2px);
}

.wallet__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--coin) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--coin) 30%, transparent);
}
.wallet__icon svg { width: 28px; height: 28px; }

.wallet__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.wallet__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.wallet__symbol {
  display: block;
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.wallet__nets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: color-mix(in srgb, var(--coin) 80%, white);
  background: color-mix(in srgb, var(--coin) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--coin) 25%, transparent);
  white-space: nowrap;
}

.wallet__addr {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 9px 12px;
  border: 1px dashed var(--line-hi);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.wallet__addr:hover { border-color: color-mix(in srgb, var(--coin) 55%, transparent); background: rgba(0, 0, 0, 0.35); }

.wallet__note {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 0.8rem;
}
.wallet__warn {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.8rem;
}

.wallet__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}
.wallet__actions .btn { flex: 1 1 0; }
.wallet__actions .btn--primary { flex-grow: 1.6; }

@media (min-width: 520px) {
  .wallet__actions { grid-column: 2; }
  .wallet__actions .btn { flex: 0 0 auto; }
  .wallet__actions .btn--primary { min-width: 110px; }
}

.wallet.is-empty .wallet__addr {
  color: var(--faint);
  font-family: var(--font-body);
  font-style: italic;
  cursor: default;
}
.wallet.is-empty .wallet__icon { filter: grayscale(0.6); opacity: 0.7; }
.wallet.is-empty:hover { transform: none; box-shadow: none; border-color: var(--line); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-hi);
  background: var(--surface-hi);
  color: var(--text);
  font: 500 0.88rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-deep));
  color: var(--emerald-ink);
  font-weight: 700;
  box-shadow: 0 8px 20px -10px rgba(62, 229, 154, 0.8);
}
.btn--primary:hover { background: linear-gradient(135deg, #5ff0ae, var(--emerald)); }
.btn--primary.is-done { background: var(--gold); box-shadow: 0 8px 20px -10px rgba(246, 207, 122, 0.8); }

.btn--block { width: 100%; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Note & footer ---------- */

.note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 138, 76, 0.07);
  border: 1px solid rgba(255, 138, 76, 0.2);
  color: #f3c7ad;
  font-size: 0.85rem;
  text-align: center;
}
.note strong { color: var(--ember); }

.footer {
  margin-top: 40px;
  text-align: center;
}
.footer__thanks {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.footer__links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
}
.footer__links a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.footer__links a:hover { color: var(--emerald); border-color: currentColor; }

/* ---------- Message form ---------- */

.msg {
  position: relative;
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.msg__row {
  display: grid;
  gap: 14px;
}
@media (min-width: 520px) {
  .msg__row { grid-template-columns: 1fr 1fr; }
}

.field {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field__label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.field__label em {
  margin-left: 4px;
  color: var(--faint);
  font-size: 0.75rem;
  font-style: normal;
}

.field__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-hi);
  border-radius: var(--radius-sm);
  background-color: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: 400 1rem/1.4 var(--font-body);
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.field__input::placeholder { color: var(--faint); }
.field__input:hover { border-color: rgba(190, 255, 220, 0.28); }
.field__input:focus {
  outline: none;
  border-color: var(--emerald);
  background-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 3px rgba(62, 229, 154, 0.15);
}
.field__input--mono { font-family: var(--font-mono); letter-spacing: -0.01em; }

textarea.field__input {
  min-height: 116px;
  padding-bottom: 28px;
  resize: vertical;
}

select.field__input {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239bb0a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}
select.field__input option { background: var(--surface-solid); color: var(--text); }

.field__count {
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  pointer-events: none;
}
.field__count.is-near { color: var(--gold); }

.msg__hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#msg-send { min-height: 46px; margin-top: 2px; }

.msg__status {
  margin: 0;
  font-size: 0.9rem;
  text-align: center;
}
.msg__status:empty { display: none; }
.msg__status.is-ok { color: var(--emerald); }
.msg__status.is-error { color: var(--danger); }

.msg__fine {
  margin: 0;
  color: var(--faint);
  font-size: 0.78rem;
  text-align: center;
}

/* ---------- QR dialog ---------- */

.qr {
  width: min(360px, 100% - 32px);
  padding: 0;
  border: 1px solid var(--line-hi);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.8);
}
.qr[open] { animation: pop 0.35s var(--ease); }
.qr::backdrop {
  background: rgba(3, 8, 6, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.qr__inner {
  position: relative;
  padding: 26px 22px 22px;
  text-align: center;
}
.qr__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-hi);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.qr__close:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.qr__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
}
.qr__network {
  margin: 2px 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
}
.qr__code {
  width: 220px;
  margin: 0 auto;
  padding: 12px;
  border-radius: var(--radius-md);
  background: #fff;
}
.qr__code svg { display: block; width: 100%; height: auto; }
.qr__addr {
  margin: 16px 0 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
  color: var(--text);
  user-select: all;
}
.qr__warn {
  margin: 12px 0 0;
  color: #f3c7ad;
  font-size: 0.8rem;
}

/* ---------- Toast & hearts ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
  padding: 12px 18px;
  border-radius: 999px;
  background: #13241c;
  border: 1px solid rgba(62, 229, 154, 0.35);
  color: var(--text);
  font-size: 0.92rem;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  white-space: nowrap;
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.heart {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  font-size: 18px;
  animation: float-up 1.1s var(--ease) forwards;
}
@keyframes float-up {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -90px) scale(1.1) rotate(var(--rot)); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: none; }
}

@media (min-width: 640px) {
  .wrap { padding-top: 48px; }
  .hero__body { padding-bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .sparkles { display: none; }
}
