/* ==================== 全局 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f8f9fc;
  --bg-card: #ffffff;
  --text: #1a1e2e;
  --text-dim: #6b7394;
  --text-light: #9aa3be;
  --gold: #d4a84b;
  --gold-soft: #e8c97a;
  --gold-deep: #b8892a;
  --line: #e6e9f0;
  --line-light: #f0f1f6;
  --shadow: rgba(0, 0, 0, .05);
  --shadow-md: rgba(0, 0, 0, .08);
  --accent: #3b82f6;
  --green: #22a06b;
}

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ==================== 顶部导航 ==================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 880px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--text); }

/* 导航栏右侧：登录 / 用户状态 */
.nav-right {
  display: flex; align-items: center; gap: 8px;
}
.nav-login {
  font-size: 14px; font-weight: 600; color: var(--gold);
  text-decoration: none; padding: 6px 16px;
  border: 1px solid var(--gold); border-radius: 20px;
  transition: all .2s;
}
.nav-login:hover {
  background: var(--gold); color: #fff;
}
.nav-user {
  display: flex; align-items: center; gap: 8px;
}
.nav-username {
  font-size: 14px; font-weight: 600; color: var(--text);
}
.nav-logout {
  font-size: 13px; color: var(--text-dim); text-decoration: none;
  padding: 4px 10px; border-radius: 6px; transition: background .2s;
}
.nav-logout:hover { background: var(--line-light); color: var(--text); }
.nav-center {
  font-size: 13px; color: var(--gold-deep); text-decoration: none;
  padding: 4px 10px; border-radius: 6px; transition: background .2s;
}
.nav-center:hover { background: var(--gold-soft, var(--line-light)); }

/* ==================== Hero ==================== */
.hero {
  position: relative;
  min-height: 100vh;
  padding-top: 60px;
}
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(800px 400px at 30% 20%, rgba(212, 168, 75, .08), transparent 60%),
    radial-gradient(600px 300px at 80% 80%, rgba(59, 130, 246, .04), transparent 55%),
    linear-gradient(180deg, #f5f7fb 0%, #f8f9fc 100%);
}

/* 左右两栏容器 */
.hero-inner {
  position: relative; z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* 左侧：文字 */
.hero-content { text-align: left; }
.hero-eyebrow {
  letter-spacing: 4px; font-size: 12px; color: var(--gold);
  margin-bottom: 14px;
}
.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800; letter-spacing: 2px;
  color: var(--text);
  line-height: 1.2;
}
.hero-title em { color: var(--gold); font-style: normal; }

/* 左侧按钮 */
.hero-action { margin-top: 36px; }

/* 右侧：排行榜 */
.hero-rank { min-width: 0; }
.btn-donate {
  padding: 14px 44px;
  font-size: 16px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  border: none; border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212, 168, 75, .25);
  transition: transform .2s, box-shadow .2s;
}
.btn-donate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 168, 75, .35);
}
.btn-donate:active { transform: translateY(0) scale(.98); }

/* ==================== 主体 ==================== */
.main { max-width: 880px; margin: 0 auto; padding: 40px 20px 60px; }

/* 移动端：左右两栏堆叠 */
@media (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 40px 20px 40px;
  }
  .hero-content { text-align: center; }
}

.section-title {
  font-size: 22px; font-weight: 700;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::before { content: ""; width: 4px; height: 20px; border-radius: 2px; background: var(--gold); }

/* ==================== 排行榜 ==================== */
.rank-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
  box-shadow: 0 1px 4px var(--shadow);
}
.rank-title { font-size: 14px; margin-bottom: 12px; color: var(--text); font-weight: 700; }
.rank-list { list-style: none; }
.rank-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--line-light);
  font-size: 13px;
}
.rank-list li:last-child { border-bottom: none; }
.rank-no {
  width: 20px; height: 20px; flex: none;
  border-radius: 4px; display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  background: var(--line); color: var(--text-dim);
}
.rank-list li:nth-child(1) .rank-no { background: var(--gold); color: #fff; }
.rank-list li:nth-child(2) .rank-no { background: #c8cdd8; color: #fff; }
.rank-list li:nth-child(3) .rank-no { background: #d4a070; color: #fff; }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-amount { color: var(--gold); font-weight: 600; }
.rank-more { display: block; text-align: center; margin-top: 10px; font-size: 13px; color: var(--accent); text-decoration: none; }
.rank-more:hover { text-decoration: underline; }

/* 完整榜单表格 */

/* 右侧栏内的排行榜表格更紧凑 */
.hero-rank .rank-table { font-size: 13px; }
.hero-rank .rank-table th,
.hero-rank .rank-table td { padding: 8px 10px; }
.rank-table-wrap {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 1px 4px var(--shadow);
}
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th {
  text-align: left; padding: 12px 16px;
  background: var(--line-light); color: var(--text-dim);
  font-weight: 600; white-space: nowrap;
}
.rank-table td { padding: 12px 16px; border-top: 1px solid var(--line-light); color: var(--text-dim); }
.rank-table tbody tr:hover { background: rgba(59, 130, 246, .03); }
.rank-table .td-name { color: var(--text); font-weight: 600; }
.rank-table .td-amount { color: var(--gold); font-weight: 600; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px;
}
.chip-alipay { background: rgba(59, 130, 246, .08); color: var(--accent); }
.chip-wxpay { background: rgba(34, 160, 107, .08); color: var(--green); }
.rank-medal { font-size: 14px; }

/* ==================== 页脚 ==================== */
.footer { margin-top: 60px; text-align: center; padding: 32px 20px; border-top: 1px solid var(--line); color: var(--text-light); font-size: 13px; line-height: 1.8; }

/* ==================== 模态框 ==================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .35);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; }

.modal {
  position: relative;
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px; padding: 28px 24px 22px;
  box-shadow: 0 12px 40px var(--shadow-md);
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--line-light);
  color: var(--text-dim); font-size: 14px; cursor: pointer;
  transition: background .2s;
}
.modal-close:hover { background: var(--line); color: var(--text); }
.modal-title { font-size: 18px; text-align: center; margin-bottom: 4px; }
.modal-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }

/* ==================== 收款码 ==================== */
.qr-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.qr-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.qr-label {
  display: inline-block;
  font-size: 13px; font-weight: 700;
  color: #fff; background: #1677ff;
  padding: 4px 14px; border-radius: 14px;
  margin-bottom: 10px;
}
.qr-label.wx { background: #07c160; }
.qr-item img {
  width: 100%; max-width: 200px;
  border-radius: 8px; display: block; margin: 0 auto;
}
.qr-tip { font-size: 12px; color: var(--text-dim); margin-top: 10px; }

@media (max-width: 768px) {
  .qr-grid { grid-template-columns: 1fr; }
}

/* 模态框左右两栏 */
.modal-body { display: grid; grid-template-columns: 1fr 190px; gap: 16px; margin-bottom: 12px; }
@media (max-width: 640px) { .modal-body { grid-template-columns: 1fr; } }

.modal-form { min-width: 0; }
.modal-rank { min-width: 0; }
.modal-rank .rank-card { padding: 10px 10px; }
.modal-rank .rank-title { font-size: 13px; margin-bottom: 8px; }
.modal-rank .rank-list li { padding: 4px 0; font-size: 12px; gap: 4px; }
.modal-rank .rank-no { width: 16px; height: 16px; font-size: 9px; }
.modal-rank .rank-amount { font-size: 12px; }
.modal-rank .rank-more { font-size: 11px; margin-top: 6px; }

/* 支付方式 tabs */
.pay-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px;
}
.pay-tab {
  padding: 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text-dim); font-size: 14px; font-weight: 600;
  transition: all .2s; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.pay-tab.active {
  border-color: var(--gold); color: var(--gold);
  background: rgba(212, 168, 75, .06);
}
.tab-ico {
  width: 20px; height: 20px; border-radius: 4px; font-size: 12px;
  display: grid; place-items: center; font-style: normal; font-weight: 700;
  background: var(--accent); color: #fff;
}
.tab-ico.wx { background: var(--green); color: #fff; }

/* 金额档位 */
.tiers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
@media (max-width: 480px) { .tiers { grid-template-columns: repeat(3, 1fr); } }
.tier {
  padding: 10px 4px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg);
  text-align: center; transition: all .2s;
}
.tier b { display: block; font-size: 15px; color: var(--text); }
.tier span { font-size: 11px; color: var(--text-light); }
.tier:hover { border-color: var(--gold-soft); }
.tier.active {
  border-color: var(--gold);
  background: rgba(212, 168, 75, .06);
}
.tier.active b { color: var(--gold); }

.custom-amount { margin-bottom: 14px; }
.custom-amount label, .field label { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; display: block; }
.custom-amount input, .field input {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color .2s;
}
.custom-amount input:focus, .field input:focus { border-color: var(--gold); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.btn-confirm {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  cursor: pointer; transition: transform .15s, opacity .15s;
  box-shadow: 0 3px 12px rgba(212, 168, 75, .25);
}
.btn-confirm:hover { transform: translateY(-1px); }
.btn-confirm:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.modal-safe { text-align: center; margin-top: 10px; font-size: 12px; color: var(--text-light); }

/* 支付步骤 2 */
.pay-body { text-align: center; min-height: 100px; padding: 10px 0; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-box img { width: 170px; height: 170px; display: block; }
.pay-qr-tip { margin-top: 10px; color: var(--text-dim); font-size: 14px; line-height: 1.7; }
.spin {
  width: 36px; height: 36px; margin: 18px auto;
  border: 3px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pay-success {
  padding: 18px 0; color: var(--green);
  font-size: 36px;
}
.pay-success-txt { color: var(--text); font-size: 15px; font-weight: 600; margin-top: 4px; }
.pay-success-sub { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.pay-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.btn-plain {
  padding: 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text-dim); font-size: 14px; transition: background .2s;
}
.btn-plain:hover { background: var(--line-light); }