:root {
  --bg-deep: #070b14;
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-card-strong: rgba(255, 255, 255, 0.1);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --text-muted: rgba(248, 250, 252, 0.55);
  --accent: #5eead4;
  --accent-2: #818cf8;
  --accent-warm: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "SF Pro Display", "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
  --font-body: "SF Pro Text", "PingFang SC", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 12px 16px calc(16px + var(--safe-bottom));
  position: relative;
  z-index: 1;
}

.aurora {
  position: fixed;
  inset: 0;
  max-width: 430px;
  margin: 0 auto;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  width: 140%;
  height: 60%;
  filter: blur(60px);
  opacity: 0.55;
  animation: drift 18s ease-in-out infinite alternate;
}

.aurora::before {
  top: -10%;
  left: -20%;
  background: radial-gradient(circle at 30% 30%, #312e81, transparent 55%),
    radial-gradient(circle at 70% 20%, #0d9488, transparent 50%);
}

.aurora::after {
  bottom: -5%;
  right: -25%;
  background: radial-gradient(circle at 60% 60%, #be123c, transparent 45%),
    radial-gradient(circle at 20% 80%, #4338ca, transparent 55%);
  animation-delay: -6s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  to {
    transform: translate3d(-4%, 3%, 0) rotate(2deg);
  }
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 20px;
}

.badge-live {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.12);
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.25);
}

.badge-demo {
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.25);
}

.merchant-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.merchant-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(94, 234, 212, 0.25);
}

.merchant-meta h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.merchant-meta p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.hero-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  margin-bottom: 16px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.label-row span {
  font-size: 13px;
  color: var(--text-muted);
}

.currency-pills {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  border: 1px solid var(--stroke);
}

.currency-pills button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.currency-pills button.active {
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.25), rgba(129, 140, 248, 0.25));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.amount-display {
  min-height: 72px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  transition: transform 0.15s ease;
}

.amount-display.pulse {
  transform: scale(1.02);
}

.amount-symbol {
  font-size: 28px;
  font-weight: 600;
  color: var(--accent);
}

.amount-value {
  font-size: clamp(42px, 12vw, 52px);
  font-weight: 700;
  line-height: 1;
}

.amount-placeholder {
  font-size: 42px;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.18);
}

.amount-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.remark-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(255, 255, 255, 0.14);
}

.remark-row svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.remark-row input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.remark-row input::placeholder {
  color: var(--text-muted);
}

.channel-auto {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  white-space: nowrap;
}

.channel-auto-wechat {
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.35);
}

.channel-auto-alipay {
  background: rgba(56, 189, 248, 0.14);
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.35);
}

.keypad-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.key {
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  min-height: 54px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

.key:active {
  transform: scale(0.96);
  background: var(--bg-card-strong);
}

.key-fn {
  font-size: 15px;
  color: var(--text-muted);
}

.key-pay {
  grid-row: span 2;
  min-height: 116px;
  background: linear-gradient(160deg, #2dd4bf, #6366f1);
  border: none;
  color: #042f2e;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(45, 212, 191, 0.35);
}

.key-pay:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--stroke);
  font-size: 13px;
  z-index: 50;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 24px;
}

.modal {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(165deg, #1e293b, #0f172a);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  animation: modal-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
}

.modal p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.qr-box {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.qr-box canvas,
.qr-box img {
  width: 200px;
  height: 200px;
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #042f2e;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.loading-shimmer {
  height: 14px;
  width: 120px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.06)
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}
