* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; }
body { overflow: hidden; background: #000; }

.pay-app {
  --card-bg: rgba(255,255,255,0.94);
  --card-border: rgba(255,255,255,0.65);
  --text: #1e293b;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-soft: rgba(59,130,246,0.15);
  --shadow: 0 20px 50px rgba(15,23,42,0.12);
  --page-bg: linear-gradient(165deg, #eef2ff 0%, #f8fafc 50%, #e0e7ff 100%);
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; min-height: -webkit-fill-available;
  max-width: 480px; margin: 0 auto;
  background: var(--page-bg);
  color: var(--text);
  position: relative;
  transition: background .35s ease;
}

[data-theme="pearl"] { --page-bg: linear-gradient(165deg,#eef2ff,#f8fafc 50%,#e0e7ff); --accent:#3b82f6; --accent-dark:#2563eb; --accent-soft:rgba(59,130,246,.15); --shadow:0 20px 50px rgba(59,130,246,.14); }
[data-theme="aurora"] { --page-bg: linear-gradient(160deg,#312e81,#6366f1 40%,#a855f7); --card-bg:rgba(255,255,255,.14); --card-border:rgba(255,255,255,.22); --text:#fff; --muted:rgba(255,255,255,.78); --accent:#c4b5fd; --accent-dark:#a78bfa; --accent-soft:rgba(196,181,253,.25); --shadow:0 20px 50px rgba(49,46,129,.35); }
[data-theme="sunset"] { --page-bg: linear-gradient(160deg,#fff7ed,#fdba74 35%,#fb7185); --card-bg:rgba(255,255,255,.9); --card-border:rgba(255,255,255,.7); --text:#431407; --muted:#9a3412; --accent:#ea580c; --accent-dark:#c2410c; --accent-soft:rgba(234,88,12,.15); --shadow:0 20px 50px rgba(234,88,12,.18); }
[data-theme="jade"] { --page-bg: linear-gradient(160deg,#ecfdf5,#6ee7b7 40%,#14b8a6); --card-bg:rgba(255,255,255,.92); --card-border:rgba(255,255,255,.75); --text:#064e3b; --muted:#047857; --accent:#059669; --accent-dark:#047857; --accent-soft:rgba(5,150,105,.15); --shadow:0 20px 50px rgba(5,150,105,.18); }
[data-theme="night"] { --page-bg: linear-gradient(165deg,#0f172a,#1e1b4b 55%,#312e81); --card-bg:rgba(15,23,42,.72); --card-border:rgba(251,191,36,.18); --text:#f8fafc; --muted:#94a3b8; --accent:#fbbf24; --accent-dark:#f59e0b; --accent-soft:rgba(251,191,36,.18); --shadow:0 20px 50px rgba(0,0,0,.45); }

.pay-body { flex: 1; min-height: 0; overflow-y: auto; padding: calc(env(safe-area-inset-top,0px) + 20px) 18px 12px; -webkit-overflow-scrolling: touch; }

.merchant-card-shell {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 28px 22px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.merchant-photo-wrap {
  width: 96px; height: 96px; margin: 0 auto 16px;
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  border: 3px solid rgba(255,255,255,.85);
}
.merchant-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.merchant-fallback {
  width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: #fff; font-weight: 700;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}
.merchant-title { font-size: 22px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; color: var(--text); }
.merchant-sub { font-size: 13px; color: var(--muted); letter-spacing: .5px; }

.amount-panel {
  margin-top: 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px 20px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.field-label { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; letter-spacing: 1px; }
.amount-row { display: flex; align-items: baseline; justify-content: center; min-height: 72px; margin-bottom: 12px; }
.currency { font-size: 30px; font-weight: 700; color: var(--text); margin-right: 4px; opacity: .85; }
.amount-display { font-size: 52px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -1px; }
.amount-display.empty { color: var(--muted); opacity: .35; font-size: 44px; }
.amount-cursor { display: inline-block; width: 3px; height: 46px; background: var(--accent); margin-left: 3px; animation: blink 1s step-end infinite; border-radius: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.pay-hint { text-align: center; font-size: 14px; color: var(--muted); }
.pay-hint strong { color: var(--text); font-weight: 600; }

.pay-footer { text-align: center; padding: 8px 16px 4px; flex-shrink: 0; }
.pay-footer p { font-size: 11px; color: var(--muted); opacity: .75; }
.is-alipay .pay-footer { display: none; }

.keyboard {
  display: grid; grid-template-columns: repeat(3, 1fr) 26%;
  grid-template-rows: repeat(4, 54px);
  background: rgba(255,255,255,.55);
  border-top: 1px solid rgba(255,255,255,.35);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  backdrop-filter: blur(10px);
}
[data-theme="night"] .keyboard, [data-theme="aurora"] .keyboard { background: rgba(0,0,0,.25); border-top-color: rgba(255,255,255,.08); }
.key {
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 500;
  background: rgba(255,255,255,.82);
  border-right: 1px solid rgba(0,0,0,.04); border-bottom: 1px solid rgba(0,0,0,.04);
  user-select: none; cursor: pointer; color: var(--text);
}
[data-theme="night"] .key, [data-theme="aurora"] .key { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.06); }
.key:active { background: var(--accent-soft); }
.key.del { font-size: 20px; color: var(--muted); }
.key.wide { grid-column: span 2; }
.key.pay-key {
  grid-column: 4; grid-row: 2 / 5;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff; font-size: 20px; font-weight: 700; letter-spacing: 3px; border-right: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.key.pay-key:active { filter: brightness(.95); }
.key.pay-key.disabled { opacity: .45; pointer-events: none; }



.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 12px 20px;
  border-radius: 12px; font-size: 14px; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; }
.loading { position: fixed; inset: 0; background: rgba(255,255,255,.55); display: none; align-items: center; justify-content: center; z-index: 190; }
.loading.show { display: flex; }
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid rgba(0,0,0,.08);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-tip { text-align: center; padding: 36px 16px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.is-alipay .keyboard { grid-template-rows: repeat(4,48px); padding-bottom: calc(env(safe-area-inset-bottom,0px) + 24px); }
