:root {
  --bg: #070c16;
  --card: #ffffff;
  --text: #0f172a;
  --text-soft: #64748b;
  --text-faint: #94a3b8;
  --line: #e2e8f0;
  --brand: #07c160;
  --brand-deep: #059e4e;
  --brand-soft: #e8faf0;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info-soft: #dbeafe;
  --info: #1d4ed8;
  --radius: 24px;
  --shadow: 0 30px 70px -30px rgba(2, 6, 23, 0.7);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(7, 193, 96, 0.32), transparent 62%),
    radial-gradient(900px 520px at 102% -4%, rgba(59, 130, 246, 0.24), transparent 58%),
    linear-gradient(180deg, #0b1220 0%, #0a1120 52%, #070c16 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- 顶部 ---------- */
.hero {
  padding: 8px 6px 22px;
  color: #ffffff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #12d977, var(--brand));
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
}

.hero h1 {
  margin: 18px 0 8px;
  font-size: clamp(1.9rem, 8vw, 2.45rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.hero-sub {
  margin: 0;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.92rem;
}

/* ---------- 卡片 ---------- */
.layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

/* ---------- 金额输入 ---------- */
.amount-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
  transition: border-color 0.2s ease;
}

.amount-wrap:focus-within {
  border-color: var(--brand);
}

.amount-symbol {
  font-size: clamp(1.4rem, 6vw, 1.75rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.amount-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: clamp(2.4rem, 12vw, 3.35rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.amount-input::placeholder {
  color: #cbd5e1;
  font-weight: 600;
}

.hint {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  transition: color 0.2s ease;
}

.hint.is-error {
  color: var(--danger);
}

/* ---------- 快捷金额 ---------- */
.quick-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.quick-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f1f5f9;
  color: #334155;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.quick-btn:active {
  transform: scale(0.97);
  background: #e2e8f0;
}

.quick-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- 支付按钮 ---------- */
.pay-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  margin-top: 22px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #14db7c 0%, var(--brand) 55%, var(--brand-deep) 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 16px 28px -14px rgba(7, 193, 96, 0.85);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.pay-btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 8px 18px -12px rgba(7, 193, 96, 0.9);
}

.pay-btn:focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 3px;
}

.pay-btn:disabled {
  cursor: not-allowed;
  filter: saturate(0.65);
  opacity: 0.72;
}

.pay-btn.is-loading .pay-btn-label {
  opacity: 0;
}

.pay-btn .spinner {
  display: none;
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.pay-btn.is-loading .spinner {
  display: block;
}

.security-note {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* ---------- 支付记录 ---------- */
.text-btn {
  border: none;
  background: transparent;
  color: var(--brand-deep);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 8px;
}

.text-btn:active {
  opacity: 0.65;
}

.text-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.record-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}

.record:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.record-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.record-amount {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.record-time {
  font-size: 0.76rem;
  color: var(--text-faint);
}

.badge {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-paid {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.badge-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-refunded {
  background: var(--info-soft);
  color: var(--info);
}

.badge-closed {
  background: #f1f5f9;
  color: var(--text-soft);
}

.empty {
  margin: 0;
  padding: 30px 0 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer {
  margin-top: 22px;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: rgba(148, 163, 184, 0.55);
}

/* ---------- 支付结果页 ---------- */
.result-header {
  padding: 8px 6px 22px;
  text-align: center;
}

.result-header .brand {
  text-decoration: none;
}

.result-card {
  padding-top: 32px;
  text-align: center;
}

.result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  border-radius: 50%;
}

.result-icon.is-success {
  background: linear-gradient(135deg, #14db7c, var(--brand-deep));
  box-shadow: 0 14px 28px -14px rgba(7, 193, 96, 0.8);
}

.result-icon.is-failed,
.result-icon.is-error {
  background: linear-gradient(135deg, #f87171, var(--danger));
  box-shadow: 0 14px 28px -14px rgba(220, 38, 38, 0.65);
}

.result-icon.is-pending,
.result-icon.is-refunded {
  background: #f1f5f9;
}

.result-icon.is-cancelled {
  background: var(--warn-soft);
}

.result-icon.is-success .result-icon-mark {
  width: 17px;
  height: 31px;
  margin-top: -6px;
  border-right: 4px solid #ffffff;
  border-bottom: 4px solid #ffffff;
  border-radius: 2px;
  transform: rotate(45deg);
}

.result-icon.is-failed .result-icon-mark,
.result-icon.is-error .result-icon-mark {
  position: relative;
  width: 32px;
  height: 32px;
}

.result-icon.is-failed .result-icon-mark::before,
.result-icon.is-failed .result-icon-mark::after,
.result-icon.is-error .result-icon-mark::before,
.result-icon.is-error .result-icon-mark::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 0;
  width: 32px;
  height: 4px;
  border-radius: 4px;
  background: #ffffff;
  transform: rotate(45deg);
}

.result-icon.is-failed .result-icon-mark::after,
.result-icon.is-error .result-icon-mark::after {
  transform: rotate(-45deg);
}

.result-icon.is-pending .result-icon-mark {
  width: 34px;
  height: 34px;
  border: 3px solid #d1fae5;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.result-icon.is-cancelled .result-icon-mark::before {
  content: "!";
  color: var(--warn);
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1;
}

.result-icon.is-refunded .result-icon-mark::before {
  content: "退";
  color: var(--info);
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1;
}

.result-summary h1 {
  margin: 0;
  font-size: clamp(1.55rem, 7vw, 1.9rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.result-summary p {
  max-width: 340px;
  margin: 10px auto 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.65;
}

.result-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 17px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.result-amount strong {
  color: var(--text);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.result-details {
  margin: 20px 0 0;
  text-align: left;
}

.result-details > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.8rem;
  line-height: 1.5;
}

.result-details > div:last-child {
  border-bottom: none;
}

.result-details dt {
  flex: none;
  margin: 0;
  color: var(--text-faint);
}

.result-details dd {
  min-width: 0;
  margin: 0;
  color: #475569;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.result-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 15px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.result-btn-primary {
  border: 1px solid var(--brand);
  background: linear-gradient(135deg, #14db7c, var(--brand-deep));
  color: #ffffff;
  box-shadow: 0 12px 22px -14px rgba(7, 193, 96, 0.85);
}

.result-btn-secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text-soft);
}

.result-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.result-btn:focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 3px;
}

.result-note {
  margin: 18px 0 0;
  color: var(--text-faint);
  font-size: 0.7rem;
  line-height: 1.5;
}

.result-amount[hidden],
.result-details[hidden],
.result-details > div[hidden],
.result-btn[hidden] {
  display: none;
}

/* ---------- 首页底部 ---------- */
.footer-links {
  margin: 0 0 8px;
  letter-spacing: 0;
}

.footer-line {
  margin: 0;
}

.footer-filing {
  margin: 8px 0 0;
  font-size: 0.7rem;
  line-height: 1.7;
  letter-spacing: 0;
}

.footer-filing[hidden] {
  display: none;
}

.footer-link {
  color: rgba(226, 232, 240, 0.78);
  text-decoration: none;
  border-bottom: 1px solid rgba(226, 232, 240, 0.28);
  padding-bottom: 1px;
}

.footer-link:active {
  opacity: 0.7;
}

.footer-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- 支付记录页 ---------- */
.gate-form {
  margin-top: 18px;
}

.gate-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
}

.gate-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.gate-input:focus {
  border-color: var(--brand);
  background: #ffffff;
}

.gate-input::placeholder {
  color: var(--text-faint);
}

.records-card .record-list {
  margin-top: 12px;
}

.records-card .record {
  align-items: flex-start;
}

.record-order {
  font-size: 0.7rem;
  color: var(--text-faint);
  word-break: break-all;
}

/* ---------- 确认对话框 ---------- */
.confirm-card {
  width: 100%;
  max-width: 340px;
  padding: 24px 22px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 30px 60px -24px rgba(2, 6, 23, 0.8);
  text-align: left;
}

.confirm-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.confirm-text {
  margin: 10px 0 0;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--text-soft);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.confirm-btn {
  flex: 1;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.confirm-btn-ghost {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text-soft);
}

.confirm-btn-primary {
  background: linear-gradient(135deg, #14db7c, var(--brand-deep));
  color: #ffffff;
}

.confirm-btn:active {
  transform: scale(0.99);
}

.confirm-btn:focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 2px;
}

/* ---------- 全局提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: min(86vw, 420px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  font-size: 0.88rem;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 18px 40px -18px rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-success {
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
}

.toast.is-error {
  background: linear-gradient(135deg, #b91c1c, var(--danger));
}

/* ---------- 全屏加载 ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(4px);
}

.mask[hidden] {
  display: none;
}

.mask-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 34px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 30px 60px -24px rgba(2, 6, 23, 0.8);
}

.mask-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.spinner-dark {
  display: block;
  width: 26px;
  height: 26px;
  border: 2px solid #d1fae5;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 适配 ---------- */
@media (min-width: 600px) {
  .page {
    padding-top: 44px;
  }

  .card {
    padding: 26px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
