*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:    #d93025;
  --red-dk: #a50e0e;
  --gold:   #f5b800;
  --bg:     #1a0505;
  --card:   rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.10);
  --text:   #f0e0d0;
  --muted:  rgba(255,255,255,0.45);
}

body {
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #2d0808 0%, #0d0101 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', sans-serif;
  color: var(--text);
}

/* ── NAV ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.btn-connect {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--red), var(--red-dk));
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 2px 12px rgba(217,48,37,0.45);
}
.btn-connect:hover { opacity: 0.88; transform: translateY(-1px); }

.lang-select {
  padding: 5px 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  min-width: 52px;
  text-align: center;
}
.lang-select:hover { background: rgba(255,255,255,0.14); }

.user-bar { display: none; align-items: center; gap: 10px; }
.user-bar.show { display: flex; }

.account-pill {
  padding: 6px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  color: #ffd0a0;
}

/* ── 红包提示横幅 ── */
#redpacketAlert {
  display: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  padding: 7px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(180,20,20,0.5), rgba(100,5,5,0.5));
  border: 1px solid rgba(255,180,60,0.45);
  white-space: nowrap;
  user-select: none;
  animation: alertGlow 2s ease-in-out infinite;
  transition: transform 0.15s;
  margin: 8px auto 8px;
}
#redpacketAlert.show { display: inline-flex; align-items: center; gap: 6px; }
#redpacketAlert:hover { transform: scale(1.04); }

@keyframes alertGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255,180,0,0.25);
    border-color: rgba(255,160,60,0.45);
  }
  50% {
    box-shadow: 0 0 22px rgba(255,210,0,0.55), 0 0 6px rgba(255,100,0,0.3);
    border-color: rgba(255,220,60,0.75);
  }
}

/* ── MAIN ── */
main {
  max-width: 460px;
  margin: 12px auto 80px;
  padding: 0 16px;
  padding-bottom: 80px;
}

/* ── 首页：统计卡片 ── */
.stat-card {
  background: linear-gradient(150deg, #6b0f0f 0%, #3a0505 100%);
  border: 1px solid rgba(255,160,60,0.2);
  border-radius: 24px;
  padding: 28px 24px 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,200,80,0.1);
  margin-top: 16px;
}
.stat-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 24px;
  letter-spacing: 1px;
}
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.stat-item { text-align: center; flex: 1; }
.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-label {
  font-size: 12px;
  color: rgba(255,200,150,0.6);
  font-weight: 500;
}
.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.1);
}

/* ── 红包页：卡片 ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-send {
  background: linear-gradient(150deg, #9b1010 0%, #5a0000 100%);
  border-color: rgba(255,160,60,0.25);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,200,80,0.15);
}

/* ── 表单 ── */
.field { margin-bottom: 14px; }

label {
  display: block;
  font-size: 12px;
  color: rgba(255,220,160,0.75);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,180,80,0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
input::placeholder { color: rgba(255,255,255,0.28); }
input:focus { border-color: rgba(255,200,80,0.55); }

.amount-wrap { position: relative; }
.amount-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  pointer-events: none;
}
.amount-wrap input { padding-right: 52px; }

/* ── 按钮 ── */
.btn-primary {
  width: 100%;
  padding: 13px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--gold), #e09800);
  border: none;
  border-radius: 12px;
  color: #5a0000;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245,184,0,0.4);
  transition: opacity 0.15s, transform 0.15s;
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-claim {
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--red), var(--red-dk));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-claim:hover:not(:disabled) { opacity: 0.88; }
.btn-claim:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-claim-inline {
  padding: 5px 14px;
  background: linear-gradient(135deg, var(--red), var(--red-dk));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}
.btn-claim-inline:hover:not(:disabled) { opacity: 0.85; }
.btn-claim-inline:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  width: 100%;
  padding: 13px;
  background: rgba(220,50,50,0.12);
  border: 1px solid rgba(220,50,50,0.3);
  border-radius: 12px;
  color: #ff7070;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgba(220,50,50,0.2); }

/* ── 领红包行 ── */
.fee-notice {
  font-size: 12px;
  color: rgba(255, 210, 100, 0.7);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 200, 50, 0.08);
  border-radius: 8px;
  border-left: 3px solid rgba(255, 200, 50, 0.4);
}
.claim-row { display: flex; gap: 8px; }
.claim-row input { flex: 1; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: rgba(0,0,0,0.25);
  padding: 4px;
  border-radius: 12px;
}
.tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab.active { background: rgba(255,255,255,0.10); color: var(--text); }

/* ── 红包列表 ── */
.packet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.packet-item:last-child { border-bottom: none; }
.packet-id   { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.packet-peer { font-size: 14px; font-weight: 600; color: var(--text); }
.packet-msg  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.packet-right  { text-align: right; }
.packet-amount { font-size: 15px; font-weight: 700; color: var(--gold); }
.packet-status {
  font-size: 11px;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 8px;
  display: inline-block;
}
.s0 { background: rgba(245,184,0,0.15); color: var(--gold); }
.s1 { background: rgba(80,200,120,0.15); color: #6ee7a0; }
.s2 { background: rgba(255,255,255,0.08); color: var(--muted); }
.empty { text-align: center; padding: 24px 0; color: var(--muted); font-size: 14px; }

/* ── 我的页面 ── */
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 16px;
}
.profile-avatar {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--red), var(--red-dk));
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.profile-name { font-size: 18px; font-weight: 700; color: var(--text); }
.profile-bal  { font-size: 14px; color: var(--gold); margin-top: 4px; }

.profile-stats {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}
.profile-stat {
  flex: 1;
  padding: 16px 0;
  text-align: center;
  border-right: 1px solid var(--border);
}
.profile-stat:last-child { border-right: none; }
.profile-stat .val { font-size: 20px; font-weight: 700; color: var(--text); }
.profile-stat .lbl { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── 连接钱包 Modal ── */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-bg.show { display: flex; }

.modal {
  background: #1e0808;
  border: 1px solid rgba(255,100,80,0.25);
  border-radius: 20px;
  padding: 28px 24px;
  width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.modal h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.modal p  { font-size: 13px; color: var(--muted); margin-bottom: 22px; line-height: 1.5; }

.wallet-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}
.wallet-btn:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.2); }
.wallet-btn .wicon { font-size: 28px; }
.wallet-btn .wdesc { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }

.modal-close {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ── 金币特效 ── */
.coin {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: var(--size);
  opacity: 1;
  animation: coinFly var(--dur) ease-out forwards;
  animation-delay: var(--delay);
}
@keyframes coinFly {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  background: #222;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok   { border-color: rgba(80,200,120,0.4); background: #0d2016; }
.toast.err  { border-color: rgba(220,80,80,0.4);  background: #200d0d; }

/* ── 底部导航 ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: rgba(12,2,2,0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  transition: color 0.2s;
}
.nav-item.active { color: var(--gold); }
.nav-item.active svg { filter: drop-shadow(0 0 5px rgba(245,184,0,0.6)); }
.nav-item.active span { font-weight: 700; }
.nav-item svg  { width: 22px; height: 22px; }
.nav-item span { font-size: 11px; font-weight: 600; }
