/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #06060f;
  --bg-secondary: #0c0c1d;
  --glass-bg: rgba(12, 13, 35, 0.65);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.04);
  --accent: #a78bfa;
  --accent2: #818cf8;
  --accent3: #38bdf8;
  --gold: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-glow: 0 0 40px rgba(167, 139, 250, 0.12);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(167, 139, 250, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(56, 189, 248, 0.05), transparent),
    radial-gradient(ellipse 50% 40% at 20% 60%, rgba(129, 140, 248, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ========== Canvas ========== */
#particleCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ========== Main Container ========== */
.main-container {
  position: relative;
  z-index: 1;
  max-width: 500px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ========== Glass Card ========== */
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-bottom: 20px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.03) inset,
    0 8px 40px rgba(0, 0, 0, 0.4),
    var(--shadow-glow);
  transition: border-color var(--transition);
}

.card-glass:hover {
  border-color: rgba(167, 139, 250, 0.15);
}

/* ========== Hero Section ========== */
.hero-section {
  text-align: center;
  margin-bottom: 28px;
  padding-top: 20px;
}

.avatar-glow {
  display: inline-block;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
  box-shadow:
    0 0 60px rgba(167, 139, 250, 0.3),
    0 0 120px rgba(129, 140, 248, 0.15);
  animation: glowPulse 4s ease-in-out infinite;
  margin-bottom: 20px;
  position: relative;
}

.avatar-glow::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(167,139,250,0.2), transparent, rgba(56,189,248,0.2));
  animation: glowRotate 8s linear infinite;
  z-index: -1;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 40px rgba(167, 139, 250, 0.25), 0 0 80px rgba(129, 140, 248, 0.1);
  }
  50% {
    box-shadow: 0 0 70px rgba(167, 139, 250, 0.35), 0 0 140px rgba(56, 189, 248, 0.2);
  }
}

@keyframes glowRotate {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

.avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a3a, #252550);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.avatar svg { width: 64px; height: 64px; }

.site-title {
  font-size: 30px;
  font-weight: 800;
  background: linear-gradient(135deg, #c4b5fd, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.site-desc {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 20px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0.3px;
}

.stats-bar {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  padding: 10px 24px;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.04);
}

.stats-bar strong {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
}

.stats-bar span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ========== Section Title ========== */
.section-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), transparent);
}

/* ========== Amount Grid ========== */
.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.amount-btn {
  padding: 14px 8px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  color: var(--text-secondary);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.amount-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(56,189,248,0.08));
  opacity: 0;
  transition: opacity var(--transition);
}

.amount-btn:hover {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.25);
  color: var(--text-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(167, 139, 250, 0.15);
}

.amount-btn:hover::before { opacity: 1; }

.amount-btn.active {
  background: linear-gradient(135deg, rgba(167,139,250,0.25), rgba(129,140,248,0.2));
  border-color: var(--accent);
  color: #fff;
  box-shadow:
    0 0 25px rgba(167, 139, 250, 0.3),
    0 0 0 1px rgba(167, 139, 250, 0.3);
  transform: translateY(-2px);
}

.custom-amount-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
  z-index: 1;
}

.custom-amount {
  width: 100%;
  padding: 14px 14px 14px 32px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: all var(--transition);
}

.custom-amount:focus {
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.06);
  background: rgba(255,255,255,0.04);
}

.custom-amount::placeholder { color: var(--text-muted); }

/* ========== Message Input ========== */
.message-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.message-input-wrapper input {
  padding: 13px 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.message-input-wrapper input:focus {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.05);
  background: rgba(255,255,255,0.04);
}

.message-input-wrapper input::placeholder { color: var(--text-muted); }

/* ========== Payment Buttons ========== */
.payment-methods {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.pay-btn {
  flex: 1;
  padding: 16px 12px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.pay-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.pay-icon { font-size: 20px; }

.pay-btn.wechat {
  background: linear-gradient(135deg, #07C160 0%, #05a34f 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(7, 193, 96, 0.25);
}

.pay-btn.alipay {
  background: linear-gradient(135deg, #1677FF 0%, #0b52d0 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(22, 119, 255, 0.25);
}

.pay-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.1);
}

.pay-btn:active {
  transform: translateY(-1px) scale(0.98);
}

.pay-btn.wechat:hover { box-shadow: 0 8px 30px rgba(7, 193, 96, 0.4); }
.pay-btn.alipay:hover { box-shadow: 0 8px 30px rgba(22, 119, 255, 0.4); }

.selected-amount {
  text-align: center;
  padding: 12px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  background: rgba(167,139,250,0.06);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

/* ========== QR Overlay ========== */
.qr-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.qr-overlay.show { display: flex; }

.qr-modal {
  text-align: center;
  max-width: 360px;
  width: 92%;
  position: relative;
  animation: scaleIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.qr-close {
  position: absolute;
  top: 14px; right: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  transform: rotate(90deg);
}

.qr-modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.qr-image-wrapper {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.qr-image-wrapper img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 8px;
}

.qr-tip {
  margin-top: 12px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.qr-amount {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 6px;
}

.qr-actions {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  padding: 13px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.5px;
}

.btn-done {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.3);
}

.btn-cancel {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.08);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-done:hover { box-shadow: 0 6px 25px rgba(167, 139, 250, 0.45); }
.btn-cancel:hover { background: rgba(255,255,255,0.1); }

/* ========== Ranking ========== */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.015);
  transition: all var(--transition);
  gap: 12px;
  border: 1px solid transparent;
}

.rank-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.04);
}

.rank-item.top-three {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.06), rgba(129, 140, 248, 0.03));
  border: 1px solid rgba(167, 139, 250, 0.1);
}

.rank-num {
  width: 32px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}

.rank-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.rank-count {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 32px;
  text-align: right;
  font-weight: 500;
}

.rank-amount {
  font-weight: 800;
  color: var(--gold);
  font-size: 16px;
  min-width: 75px;
  text-align: right;
  letter-spacing: 0.5px;
}

.empty-tip {
  text-align: center;
  color: var(--text-muted);
  padding: 36px 0;
  font-size: 14px;
}

/* ========== Messages ========== */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  margin-bottom: 18px;
  padding-right: 4px;
}

.message-list::-webkit-scrollbar { width: 4px; }
.message-list::-webkit-scrollbar-track { background: transparent; }
.message-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.message-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
  transition: all var(--transition);
  animation: fadeInMsg 0.4s ease;
}

.message-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.06);
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.msg-content { flex: 1; min-width: 0; }

.msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.msg-nickname {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  word-break: break-word;
}

.msg-input-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-input-area > input {
  padding: 11px 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.msg-input-area > input:focus {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.05);
}

.msg-input-area input::placeholder { color: var(--text-muted); }

.msg-input-row {
  display: flex;
  gap: 8px;
}

.msg-input-row input {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.msg-input-row input:focus {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.05);
}

.btn-send {
  padding: 11px 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(167, 139, 250, 0.25);
}

.btn-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(167, 139, 250, 0.4);
}

.btn-send:active {
  transform: translateY(0) scale(0.97);
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 32px 0 16px;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: rgba(15, 15, 40, 0.95);
  color: var(--text-primary);
  padding: 13px 32px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  z-index: 2000;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  letter-spacing: 0.5px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--green);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
  .main-container { padding: 24px 14px 60px; }
  .card-glass { padding: 24px 18px; border-radius: var(--radius-lg); }
  .amount-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .amount-btn { font-size: 15px; padding: 12px 6px; }
  .stats-bar { gap: 16px; font-size: 13px; padding: 8px 18px; }
  .site-title { font-size: 26px; }
  .avatar { width: 76px; height: 76px; }
  .avatar svg { width: 56px; height: 56px; }
}
