:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #3d3a34;
  --muted: #b3ab9c;
  --gold: #a89375;
  --line: #eeeae2;
  --green: #07c160;
  --red: #e64340;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }

#app { padding: 20px 16px 200px; max-width: 560px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(60, 50, 30, .05);
}

/* ---- 顶部金额卡 ---- */
.store-row { display: flex; align-items: center; gap: 12px; }
.store-badge {
  width: 42px; height: 42px; border-radius: 50%;
  background: #efe9dd; color: #8a7d63;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; flex: none;
}
.store-title { font-size: 17px; font-weight: 700; }
.store-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.amount-row {
  display: flex; align-items: baseline; gap: 6px;
  margin: 18px 0 14px; font-weight: 700; color: var(--gold);
}
.amount-row .cny { font-size: 30px; }
.amount-row #amount { font-size: 56px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }

.note-row {
  border-top: 1px solid var(--line);
  padding-top: 12px; font-size: 13px; color: var(--muted);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.note-icon { font-size: 15px; }
.note-editor { display: flex; gap: 8px; margin-top: 10px; }
.note-editor input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; outline: none; background: #fbfaf7;
}
.note-editor button {
  border: none; background: #efe9dd; color: #6f644f;
  border-radius: 8px; padding: 0 14px; font-size: 13px;
}

/* ---- 快捷金额 ---- */
.chips { display: flex; gap: 10px; margin-top: 16px; }
.chip {
  flex: 1; padding: 12px 0; border: none; border-radius: 12px;
  background: var(--card); color: #6f6759; font-size: 15px;
  box-shadow: 0 1px 3px rgba(60, 50, 30, .05); cursor: pointer;
}
.chip:active { background: #f1ede4; }

/* ---- 键盘 ---- */
#pad { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); max-width: 560px; margin: 0 auto; }
.paybar {
  width: 100%; height: 52px; border: none; border-radius: 26px;
  background: #e9e5dc; color: #b9b2a4; font-size: 16px; font-weight: 600;
}
.paybar.on { background: var(--green); color: #fff; }
.paybar:disabled { cursor: default; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.key {
  padding: 14px 0; border: none; border-radius: 12px; background: var(--card);
  font-size: 20px; color: #55503f; box-shadow: 0 1px 3px rgba(60,50,30,.05); cursor: pointer;
}
.key:active { background: #f1ede4; }

/* ---- 扫码态 ---- */
.qr-card { text-align: center; padding: 28px 20px; }
.qr-store { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
#qrImg { width: 216px; height: 216px; border-radius: 8px; }
.qr-hint { font-size: 13px; color: var(--muted); line-height: 1.7; margin-top: 14px; }
.qr-amount { font-size: 30px; font-weight: 700; color: var(--gold); margin: 10px 0 6px; }
.poll-line { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.link-btn {
  display: block; margin: 16px auto 0; border: none; background: none;
  color: var(--muted); font-size: 13px; cursor: pointer;
}

/* ---- 成功态 ---- */
.done-card { text-align: center; padding: 36px 20px; }
.done-circle {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--green); color: #fff; font-size: 34px;
  display: flex; align-items: center; justify-content: center;
}
.done-circle.warn { background: #e8a13c; }
.done-title { font-size: 19px; font-weight: 700; }
.done-amount { font-size: 42px; font-weight: 700; color: var(--gold); margin: 10px 0 18px; }
.done-meta { font-size: 12px; color: var(--muted); margin-top: 6px; word-break: break-all; }
.primary {
  display: block; width: 100%; max-width: 560px; margin: 20px auto 0;
  height: 48px; border: none; border-radius: 24px;
  background: var(--green); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}

/* ---- toast ---- */
#toast {
  position: fixed; left: 50%; bottom: 220px; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 8px; z-index: 99; max-width: 80vw; text-align: center;
}
