:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #182230;
  background: #eef3f8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(81, 148, 255, .16), transparent 30rem),
    #eef3f8;
}

button, input, textarea { font: inherit; }
[hidden] { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 38px; border-radius: 22px; background: white; box-shadow: 0 24px 70px rgba(30,62,100,.14); }
.login-card h1 { font-size: 30px; }
.login-card input { width: 100%; border: 1px solid #d8e0e9; border-radius: 12px; padding: 12px 14px; outline: none; }
.login-button { width: 100%; margin-top: 26px; padding: 13px; border-radius: 12px; color: white; cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(420px, 1fr);
}

.editor {
  padding: 56px clamp(28px, 5vw, 72px);
  background: rgba(255, 255, 255, .92);
  box-shadow: 16px 0 48px rgba(27, 54, 86, .08);
  z-index: 1;
}

.eyebrow {
  margin: 0 0 12px;
  color: #2776df;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.intro { margin: 14px 0 36px; color: #6a7788; line-height: 1.65; }

.payment-tabs { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 5px; border-radius: 13px; background: #edf2f7; }
.payment-tab { border: 0; border-radius: 9px; padding: 11px 14px; background: transparent; color: #66768a; font-weight: 750; cursor: pointer; }
.payment-tab.active { background: #07c160; color: white; box-shadow: 0 3px 10px rgba(7,193,96,.2); }
.payment-tabs.alipay .payment-tab.active { background: #1677ff; box-shadow: 0 3px 10px rgba(22,119,255,.22); }

.account-bar { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; color: #66768a; font-size: 13px; }
.record-manager { margin-top: 18px; padding: 15px; border: 1px solid #d8e0e9; border-radius: 14px; background: #f8fbff; }
.record-manager label:first-child { margin-top: 0; }
.record-select-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
.record-select-row select, .record-manager input { width: 100%; min-width: 0; border: 1px solid #d8e0e9; border-radius: 10px; padding: 10px 11px; background: white; }
.record-select-row button { border: 1px solid #bad0eb; border-radius: 10px; padding: 9px 12px; background: white; color: #245fad; font-weight: 700; }

label {
  display: block;
  margin: 22px 0 9px;
  font-size: 14px;
  font-weight: 700;
}

textarea, input[type="text"], input:not([type]) {
  width: 100%;
  border: 1px solid #d8e0e9;
  border-radius: 12px;
  padding: 12px 14px;
  color: #182230;
  background: #f9fbfd;
  outline: none;
  transition: .2s ease;
}

textarea { width: 100%; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus { border-color: #2b7de9; box-shadow: 0 0 0 3px rgba(43, 125, 233, .12); }

.field-grid { display: grid; grid-template-columns: 1fr 140px; gap: 16px; }
.color-control { height: 47px; display: flex; align-items: center; gap: 10px; }
input[type="color"] { width: 48px; height: 42px; padding: 3px; border: 1px solid #d8e0e9; border-radius: 10px; background: white; }
.color-control output { font-size: 13px; color: #647184; }

.avatar-row { display: flex; align-items: center; gap: 12px; }
.avatar-row img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 3px solid white; box-shadow: 0 3px 14px rgba(24, 34, 48, .18); }
#avatar-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.upload-button, button { cursor: pointer; }
.upload-button { margin: 0; padding: 10px 15px; border: 1px solid #cdd8e5; border-radius: 10px; background: white; font-size: 14px; }
.text-button { border: 0; background: transparent; color: #65758a; }

.random-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.random-actions button { padding: 10px 8px; border: 1px solid #cdd8e5; border-radius: 10px; background: #f8fbff; color: #245fad; font-size: 13px; font-weight: 700; cursor: pointer; }
.random-actions button:last-child { border-color: #87b6f2; background: #eaf3ff; }

.avatar-picker { margin-top: 16px; border: 1px solid #d8e0e9; border-radius: 12px; background: #f9fbfd; }
.avatar-picker summary { padding: 12px 14px; color: #556579; font-size: 13px; font-weight: 700; cursor: pointer; }
.avatar-gallery { max-height: 260px; overflow: auto; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 4px 12px 14px; }
.avatar-choice { padding: 0; aspect-ratio: 1; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: #edf2f7; cursor: pointer; }
.avatar-choice:hover { border-color: #8bbbf8; }
.avatar-choice.selected { border-color: #07c160; box-shadow: 0 0 0 2px rgba(7,193,96,.18); }
.avatar-choice img { display: block; width: 100%; height: 100%; object-fit: cover; }

.actions { display: flex; gap: 12px; margin-top: 34px; }
.actions button { flex: 1; border-radius: 12px; padding: 13px 18px; font-weight: 750; }
.primary-button { border: 1px solid #2b7de9; background: #2b7de9; color: white; }
.secondary-button { border: 1px solid #c9d5e4; background: white; color: #245fAD; }
.status { min-height: 22px; margin: 13px 0 0; color: #277044; font-size: 13px; }
.export-note { margin: 12px 0 0; color: #718094; font-size: 12px; line-height: 1.55; }

.preview-stage {
  min-height: 100vh;
  display: grid;
  place-content: center;
  padding: 48px 28px;
}

.payment-card {
  --pay-color: #07c160;
  position: relative;
  width: 414px;
  height: 578px;
  overflow: hidden;
  background: #fff;
  color: white;
  box-shadow: 0 28px 70px rgba(21, 92, 66, .24);
}

.green-area {
  position: relative;
  height: 475px;
  padding-top: 36px;
  background: var(--pay-color);
}

.green-area::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: -8%;
  bottom: -25px;
  width: 116%;
  height: 50px;
  border-radius: 0 0 50% 50%;
  background: inherit;
}

.payment-card header { position: relative; z-index: 1; text-align: center; }
.payment-card h2 { margin: 0 0 28px; font-size: 29px; font-weight: 650; letter-spacing: .01em; }

.qr-panel {
  position: relative;
  z-index: 1;
  width: 258px;
  margin: 0 auto;
  padding: 34px 22px 21px;
  border-radius: 9px;
  background: white;
  box-shadow: 0 3px 12px rgba(0, 75, 39, .08);
}

#qrcode { width: 214px; height: 214px; }
#qrcode canvas, #qrcode svg { display: block; width: 214px; height: 214px; }
.qr-panel p { margin: 17px 0 0; color: #161616; text-align: center; font-size: 17px; }

.brand-footer {
  position: relative;
  z-index: 2;
  height: 103px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding-top: 19px;
  background: white;
  color: #4a4a4a;
}

.brand-footer strong { font-size: 34px; font-weight: 430; letter-spacing: .02em; }
.pay-logo { position: relative; width: 50px; height: 43px; border-radius: 50%; background: var(--pay-color); transform: rotate(-8deg); }
.pay-logo::after { content: ""; position: absolute; left: 4px; bottom: -5px; border: 10px solid transparent; border-top-color: var(--pay-color); transform: rotate(20deg); }
.pay-logo span { position: absolute; z-index: 1; left: 13px; top: 12px; width: 25px; height: 13px; border-left: 5px solid white; border-bottom: 5px solid white; transform: rotate(-42deg); }
.pay-logo b { display: none; }
.payment-card.alipay { box-shadow: 0 28px 70px rgba(22, 92, 180, .25); }
.payment-card.alipay .pay-logo { width: 46px; height: 46px; border-radius: 11px; transform: none; }
.payment-card.alipay .pay-logo::after, .payment-card.alipay .pay-logo span { display: none; }
.payment-card.alipay .pay-logo b { display: grid; place-items: center; height: 100%; color: white; font-size: 29px; font-weight: 700; }
.scan-note { margin: 20px 0 0; text-align: center; color: #718094; font-size: 13px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .preview-stage { min-height: auto; }
}

@media (max-width: 470px) {
  .editor { padding: 36px 20px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .random-actions { grid-template-columns: 1fr; }
  .preview-stage { padding: 28px 12px; overflow: hidden; }
  .payment-card { width: min(390px, calc(100vw - 24px)); transform-origin: top center; }
}
