:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-raised: #1c1c1c;
  --ink: #f5f5f5;
  --muted: #a3a3a3;
  --placeholder: #808080;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #ffffff;
  --accent-hover: #e6e6e6;
  --accent-ink: #0a0a0a;
  --ring: rgba(255, 255, 255, 0.18);
  --danger: #ff9b9b;
  --radius: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(48px, 10vh, 96px) 24px 96px;
}

.intro {
  margin-bottom: 40px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0;
  max-width: 40ch;
  color: var(--muted);
  font-size: 1.0625rem;
}

section {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  animation: rise 420ms var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.field-label,
.field > label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--muted);
}

.hint {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.hint.error {
  color: var(--danger);
}

input,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

textarea {
  display: block;
  min-height: 64px;
  resize: vertical;
}

/* Amount */

.amount-field {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.amount-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.amount-prefix {
  padding-left: 16px;
  font-size: 1.5rem;
  color: var(--muted);
}

.amount-field input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 14px 16px 14px 8px;
  font-size: 1.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.amount-field input:focus {
  box-shadow: none;
}

.presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 176px;
  overflow-y: auto;
  margin: 16px -4px 0;
  padding: 4px;
  scrollbar-width: thin;
}

.chip {
  font: inherit;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 0;
  cursor: pointer;
  transition: color 200ms var(--ease), border-color 200ms var(--ease),
    background-color 200ms var(--ease), transform 150ms var(--ease);
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.chip:active {
  transform: scale(0.96);
}

.chip[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* Assets */

.assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.asset {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 200ms var(--ease), background-color 200ms var(--ease),
    transform 150ms var(--ease);
}

.asset:hover {
  border-color: var(--line-strong);
}

.asset:active {
  transform: scale(0.98);
}

.asset[aria-pressed="true"] {
  background: var(--surface-raised);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.asset-symbol {
  font-weight: 600;
}

.asset-net {
  font-size: 0.8125rem;
  color: var(--muted);
}

.callout {
  margin: 0 0 12px;
  padding: 12px 14px;
  font-size: 0.875rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.callout.warning {
  color: var(--ink);
  border-left: 2px solid var(--accent);
}

/* Payment box */

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary > div {
  padding: 14px 16px;
}

.summary > div + div {
  border-left: 1px solid var(--line);
}

.summary dt {
  margin-bottom: 4px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.summary dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.address-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.address {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  word-break: break-all;
}

.address-row .btn {
  flex: 0 0 auto;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.qr {
  width: 200px;
  height: 200px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease),
    transform 150ms var(--ease), opacity 200ms var(--ease);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:focus-visible,
.chip:focus-visible,
.asset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn.primary {
  color: var(--accent-ink);
  background: var(--accent);
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn.secondary {
  color: var(--ink);
  background: transparent;
  border-color: var(--line-strong);
}

.btn.secondary:hover {
  background: var(--surface-raised);
}

.btn.wide {
  width: 100%;
  margin-top: 8px;
}

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

.actions .btn {
  flex: 1 1 200px;
}

/* Form */

.field {
  margin-bottom: 18px;
}

.status {
  min-height: 1.5em;
  margin: 12px 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status.error {
  color: var(--danger);
}

.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

@media (max-width: 480px) {
  .summary {
    grid-template-columns: 1fr;
  }

  .summary > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .address-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
