/* ============================================================
   style.css — 重写版（布局写法重构，计算样式与原 style.css.orig 完全一致）
   手法：CSS 自定义属性、逻辑属性(padding-block/inline)、min()、
        aspect-ratio、place-items；未改动任何颜色/尺寸/字号/圆角/阴影数值。
   ============================================================ */

/* ---------- 设计令牌（收敛重复的颜色 / 圆角 / 阴影 / 间距） ---------- */
:root{
  /* 字体 */
  --font-sans: Inter, Arial, Helvetica, sans-serif;

  /* 颜色 */
  --c-bg: #f3f4f6;            /* 页面底 / 返回按钮底 */
  --c-surface: #fff;          /* 卡片 / 按钮白底（原文 white 与 #fff 同值） */
  --c-ink: #111827;           /* 主文字 */
  --c-ink-soft: #4b5563;      /* footer strong */
  --c-muted: #6b7280;         /* 次要文字 / disabled 底 */
  --c-ink-muted: #374151;     /* loader-text / back-btn */
  --c-border: #e5e7eb;        /* 卡片描边 / hover 底 */
  --c-green: #00c853;         /* 强调绿 */
  --c-green-deep: #00a63e;    /* 深绿文字 */
  --c-green-bright: #00d455;  /* 高亮绿 / 主按钮 */
  --c-green-hover: #00c44e;   /* 主按钮 hover */
  --c-green-soft: #b7efc5;    /* 浅绿描边 */
  --c-green-pale: #eafff1;    /* 徽标底 / 成功消息底 */
  --c-green-mint: #e9fff1;    /* 金额区底 */
  --c-green-ghost: #b8f8ce;   /* more-btn 底 */
  --c-logo-a: #00e05a;        /* logo 渐变起 */
  --c-logo-b: #00b84a;        /* logo 渐变止 */
  --c-topbar: #d1d5db;        /* 顶部把手 */
  --c-verify: #1d9bf0;       /* 认证徽标 */
  --c-surface-soft: #f9fafb;  /* 信息块底 */
  --c-loader-bg: #f4f5f7;     /* loading 遮罩 */
  --c-loader-pill: #ccf5dc;   /* loader 外圈 */
  --c-danger: #b91c1c;        /* 错误文字 */
  --c-danger-bg: #fee2e2;     /* 错误底 */
  --c-danger-border: #fecaca; /* 错误描边 */
  --c-success-text: #15803d;  /* 成功文字 */
  --c-success-bg: #dcfce7;    /* 成功底 */
  --c-success-border: #bbf7d0;/* 成功描边 */
  --c-warn-text: #b45309;     /* 警示文字 */
  --c-warn-bg: #fff8e5;       /* 警示底 */
  --c-warn-soft: #fff3cd;     /* 待支付状态底 */

  /* 圆角 */
  --radius-card: 26px;
  --radius-panel: 20px;
  --radius-pill: 999px;
  --radius-circle: 50%;
  --radius-lg: 18px;
  --radius-md: 16px;
  --radius-sm: 14px;
  --radius-xs: 12px;
  --radius-xxs: 10px;
  --radius-xl: 22px;

  /* 阴影 */
  --shadow-card: 0 10px 35px rgba(0,0,0,.08);
  --shadow-logo: 0 10px 24px rgba(0,200,83,.25);
  --shadow-pay: 0 10px 24px rgba(0,212,85,.25);
  --shadow-amount-active: 0 8px 18px rgba(0,212,85,.2);
  --shadow-loader: 0 12px 28px rgba(0,212,85,.28);
  --shadow-qr-logo: 0 6px 16px rgba(0,0,0,.15);

  /* 间距刻度（重复出现的 gap / margin / padding） */
  --space-4: 4px;
  --space-6: 6px;
  --space-7: 7px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-14: 14px;
  --space-16: 16px;
  --space-18: 18px;
  --space-20: 20px;

  /* 尺寸 / 字号（响应式双档取值） */
  --w-card: 450px;
  --fs-amount: 48px;
  --fs-amount-sm: 42px;
  --fs-success-amount: 42px;
  --fs-success-amount-sm: 38px;
  --qr-size: 280px;
  --qr-size-sm: 250px;
}

*{ box-sizing: border-box; margin: 0; padding: 0; font-family: var(--font-sans); }

html, body{ width: 100%; min-height: 100%; }

body{
  min-height: 100vh;
  background: var(--c-bg);
  display: flex;
  justify-content: center;
  place-items: center;
  padding: 16px;
  color: var(--c-ink);
}

#app{
  width: 100%;
  display: flex;
  justify-content: center;
  place-items: center;
}

/* 首页 */
.page{
  width: min(100%, var(--w-card));
  background: var(--c-surface);
  border-radius: var(--radius-card);
  padding-block: 24px 28px;
  padding-inline: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--c-border);
}

.home-view .top-bar{
  width: 54px;
  height: 5px;
  background: var(--c-topbar);
  border-radius: var(--radius-pill);
  margin-block: -12px 20px;
  margin-inline: auto;
}

.title{
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  margin-block-end: var(--space-12);
}

.title .name{ color: var(--c-green); }

.verify{
  display: inline-flex;
  width: 18px;
  aspect-ratio: 1;
  background: var(--c-verify);
  color: var(--c-surface);
  border-radius: var(--radius-circle);
  place-items: center;
  justify-content: center;
  font-size: 12px;
  margin-inline-start: var(--space-4);
  vertical-align: middle;
  font-weight: 900;
}

.badge{
  width: fit-content;
  margin-block: 0 20px;
  margin-inline: auto;
  padding-block: var(--space-8);
  padding-inline: var(--space-16);
  border-radius: var(--radius-pill);
  background: var(--c-green-pale);
  color: var(--c-green-deep);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  place-items: center;
  gap: var(--space-7);
}

.shield{
  width: 18px;
  aspect-ratio: 1;
  border-radius: var(--radius-circle);
  background: var(--c-green);
  color: var(--c-surface);
  display: inline-flex;
  place-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
}

.brand-card{
  border: 1px solid var(--c-border);
  border-radius: var(--radius-panel);
  padding: var(--space-16);
  text-align: center;
  margin-block-end: var(--space-20);
  background: var(--c-surface);
}

.logo{
  width: 64px;
  aspect-ratio: 1;
  margin-block: 0 var(--space-12);
  margin-inline: auto;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--c-logo-a), var(--c-logo-b));
  color: var(--c-surface);
  display: flex;
  place-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 900;
  box-shadow: var(--shadow-logo);
}

.brand-title{
  font-size: 19px;
  font-weight: 900;
  margin-block-end: var(--space-4);
}

.brand-subtitle{
  font-size: 14px;
  color: var(--c-muted);
  line-height: 1.45;
}

.amount-box{
  background: var(--c-green-mint);
  border-radius: var(--radius-panel);
  padding: var(--space-18);
  margin-block-end: var(--space-20);
}

.amount-title{
  color: var(--c-green-deep);
  font-size: 14px;
  font-weight: 900;
  display: flex;
  place-items: center;
  gap: var(--space-8);
  margin-block-end: var(--space-16);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.coin-icon{
  width: 20px;
  aspect-ratio: 1;
  border: 2px solid var(--c-green-deep);
  color: var(--c-green-deep);
  border-radius: var(--radius-circle);
  display: inline-flex;
  place-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}

.amount-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-12);
  margin-block-end: var(--space-12);
}

.amount-btn{
  border: 1px solid var(--c-green-soft);
  background: var(--c-surface);
  color: var(--c-ink);
  border-radius: var(--radius-pill);
  padding-block: var(--space-14);
  padding-inline: var(--space-6);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: .18s;
}

.amount-btn:hover{
  transform: translateY(-1px);
  border-color: var(--c-green-bright);
}

.amount-btn.active{
  background: var(--c-green-bright);
  border-color: var(--c-green-bright);
  color: var(--c-surface);
  box-shadow: var(--shadow-amount-active);
}

.more-btn{
  width: 100%;
  border: none;
  background: var(--c-green-ghost);
  color: var(--c-green-deep);
  border-radius: var(--radius-pill);
  padding: var(--space-14);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  margin-block-end: var(--space-12);
}

.more-amounts{
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-12);
  margin-block-end: var(--space-12);
}

.custom-input{
  display: flex;
  place-items: center;
  height: 52px;
  background: var(--c-surface);
  border: 1px solid var(--c-green-soft);
  border-radius: var(--radius-pill);
  padding-inline: var(--space-18);
  gap: var(--space-10);
}

.custom-input span{
  color: var(--c-green-deep);
  font-size: 18px;
  font-weight: 900;
}

.custom-input input{
  border: none;
  outline: none;
  width: 100%;
  font-size: 16px;
  font-weight: 800;
  color: var(--c-ink);
  background: transparent;
}

.pay-button{
  width: 100%;
  border: none;
  background: var(--c-green-bright);
  color: var(--c-surface);
  border-radius: var(--radius-pill);
  padding: var(--space-18);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow-pay);
  transition: .18s;
}

.pay-button:hover{
  background: var(--c-green-hover);
  transform: translateY(-1px);
}

.pay-button:disabled{
  background: var(--c-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.home-view .message{
  display: none;
  margin-block-start: var(--space-14);
  padding: var(--space-12);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
  line-height: 1.4;
}

.home-view .message.error{
  display: block;
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border: 1px solid var(--c-danger-border);
}

.home-view .message.success{
  display: block;
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid var(--c-success-border);
}

.footer{
  text-align: center;
  margin-block-start: var(--space-18);
  color: var(--c-muted);
  font-size: 14px;
}

.footer strong{ color: var(--c-ink-soft); }

/* 付款页 */
.checkout{
  width: min(100%, var(--w-card));
  background: var(--c-surface);
  border-radius: var(--radius-card);
  padding-block: 22px 26px;
  padding-inline: var(--space-20);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--c-border);
}

.payment-view .top-bar{
  width: 54px;
  height: 5px;
  background: var(--c-topbar);
  border-radius: var(--radius-pill);
  margin-block: -10px 20px;
  margin-inline: auto;
}

.timer{
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border-radius: var(--radius-xs);
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .8px;
  padding: var(--space-12);
  margin-block-end: var(--space-16);
}

.timer.expired{
  background: var(--c-danger-bg);
  color: var(--c-danger);
}

.label{
  text-align: center;
  color: var(--c-muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1.2px;
  margin-block-end: var(--space-8);
  text-transform: uppercase;
}

.amount{
  text-align: center;
  color: var(--c-green);
  font-size: var(--fs-amount);
  line-height: 1;
  font-weight: 900;
  margin-block-end: var(--space-10);
}

.hint{
  text-align: center;
  color: var(--c-muted);
  font-size: 14px;
  margin-block-end: 22px;
}

.qr-card{
  border: 1px solid var(--c-border);
  border-radius: var(--radius-panel);
  padding: var(--space-20);
  margin-block-end: var(--space-18);
  display: flex;
  justify-content: center;
  background: var(--c-surface);
}

.qr-wrap{
  position: relative;
  width: var(--qr-size);
  aspect-ratio: 1;
}

.qr-wrap img{
  width: 100%;
  height: 100%;
  display: block;
}

.qr-logo{
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: var(--c-green);
  color: var(--c-surface);
  display: flex;
  justify-content: center;
  place-items: center;
  font-size: 30px;
  font-weight: 900;
  border: 5px solid var(--c-surface);
  box-shadow: var(--shadow-qr-logo);
}

.info-box{
  background: var(--c-surface-soft);
  border-radius: var(--radius-sm);
  padding-block: var(--space-14);
  padding-inline: var(--space-16);
  margin-block-end: var(--space-10);
  display: flex;
  justify-content: space-between;
  place-items: center;
  gap: var(--space-10);
}

.info-left{ min-width: 0; }

.info-title{
  color: var(--c-muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-block-end: var(--space-6);
}

.info-value{
  font-size: 14px;
  font-weight: 900;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.status{
  padding-block: var(--space-8);
  padding-inline: var(--space-12);
  border-radius: var(--radius-xxs);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status.waiting{ background: var(--c-warn-soft); color: var(--c-warn-text); }
.status.paid{ background: var(--c-success-bg); color: var(--c-success-text); }
.status.expired{ background: var(--c-danger-bg); color: var(--c-danger); }

.invoice-line{
  background: var(--c-surface-soft);
  border-radius: var(--radius-sm);
  padding-block: var(--space-14);
  padding-inline: var(--space-16);
  margin-block-end: var(--space-18);
  display: flex;
  justify-content: space-between;
  gap: var(--space-12);
  place-items: center;
}

.prefix{
  color: var(--c-muted);
  font-size: 14px;
  font-weight: 800;
}

.bolt{
  font-size: 13px;
  font-weight: 900;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  max-width: 260px;
}

.pay-btn{
  width: 100%;
  border: none;
  background: var(--c-green-bright);
  color: var(--c-surface);
  border-radius: var(--radius-pill);
  padding: var(--space-18);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow-pay);
  margin-block-end: var(--space-16);
}

.pay-btn:disabled{
  background: var(--c-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.copy-btn{
  width: 100%;
  border: none;
  padding: 10px;
  background: transparent;
  color: var(--c-ink);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.payment-view .message{
  display: none;
  margin-block-start: var(--space-10);
  padding: var(--space-12);
  border-radius: var(--radius-xs);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.payment-view .message.show{
  display: block;
  background: var(--c-green-pale);
  color: var(--c-success-text);
}

.payment-view .message.warn{
  display: block;
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
}

.payment-view .message.err{
  display: block;
  background: var(--c-danger-bg);
  color: var(--c-danger);
}

.success-screen{ text-align: center; }

.success-icon{
  width: 76px;
  aspect-ratio: 1;
  border-radius: var(--radius-circle);
  background: var(--c-green);
  color: var(--c-surface);
  display: flex;
  place-items: center;
  justify-content: center;
  margin-block: 20px 16px;
  margin-inline: auto;
  font-size: 42px;
  font-weight: 900;
}

.success-title{
  font-size: 25px;
  font-weight: 900;
  margin-block-end: var(--space-8);
}

.success-subtitle{
  color: var(--c-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-block-end: var(--space-20);
}

.success-amount{
  font-size: var(--fs-success-amount);
  font-weight: 900;
  color: var(--c-green);
  margin-block-end: var(--space-18);
}

.success-detail{
  background: var(--c-surface-soft);
  border-radius: var(--radius-md);
  padding: var(--space-14);
  margin-block-end: var(--space-16);
}

.success-row{
  display: flex;
  justify-content: space-between;
  gap: var(--space-10);
  padding-block: var(--space-8);
  font-size: 14px;
}

.success-key{ color: var(--c-muted); font-weight: 900; }
.success-value{ color: var(--c-ink); font-weight: 900; }

.done-btn{
  width: 100%;
  border: none;
  background: var(--c-green-bright);
  color: var(--c-surface);
  border-radius: var(--radius-pill);
  padding: 17px;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.empty{
  text-align: center;
  color: var(--c-muted);
  font-weight: 800;
  line-height: 1.5;
  padding-block: 30px;
  padding-inline: 10px;
}

/* Loading */
.page-loader{
  position: fixed;
  inset: 0;
  background: var(--c-loader-bg);
  z-index: 99999;
  display: none;
  place-items: center;
  justify-content: center;
}

.page-loader.show{ display: flex; }

.loader-box{ text-align: center; }

.loader-logo-wrap{
  width: 132px;
  aspect-ratio: 1;
  background: var(--c-loader-pill);
  border-radius: var(--radius-xl);
  display: flex;
  place-items: center;
  justify-content: center;
  margin-block: 0 14px;
  margin-inline: auto;
  animation: loaderPulse 1.2s ease-in-out infinite;
}

.loader-logo{
  width: 82px;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  background: var(--c-green-bright);
  color: var(--c-surface);
  font-size: 54px;
  font-weight: 900;
  display: flex;
  place-items: center;
  justify-content: center;
  box-shadow: var(--shadow-loader);
}

.loader-text{
  color: var(--c-ink-muted);
  font-size: 16px;
  font-weight: 900;
}

.loader-dots::after{
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots{
  0%{ content: ""; }
  25%{ content: "."; }
  50%{ content: ".."; }
  75%{ content: "..."; }
  100%{ content: ""; }
}

@keyframes loaderPulse{
  0%{ transform: scale(1); opacity: 1; }
  50%{ transform: scale(1.04); opacity: .92; }
  100%{ transform: scale(1); opacity: 1; }
}

@media (max-width: 420px){
  .amount{ font-size: var(--fs-amount-sm); }
  .qr-wrap{ width: var(--qr-size-sm); }
  .success-amount{ font-size: var(--fs-success-amount-sm); }
}

/* 返回按钮（与 Pay Now 同尺寸胶囊，次要灰 ✓） */
.back-btn{
  width: 100%;
  margin-block-start: var(--space-10);
  border: none;
  background: var(--c-bg);
  color: var(--c-ink-muted);
  border-radius: var(--radius-pill);
  padding: var(--space-16);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
  font-family: inherit;
}

.back-btn:hover{
  background: var(--c-border);
  transform: translateY(-1px);
}

.back-btn:active{ transform: translateY(0); }
