/* ===== GWDW H5 Global Styles ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100vh; padding-bottom: 70px; }

/* --- Navigation Bar (bottom fixed) --- */
.nav-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 56px; background: #fff;
  display: flex; justify-content: space-around; align-items: center;
  border-top: 1px solid #eee; z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.nav-item {
  flex: 1; text-align: center; padding: 4px 0;
  font-size: 11px; color: #999; cursor: pointer;
  transition: color 0.2s;
}
.nav-item .nav-icon {
  display: block; font-size: 22px; line-height: 1; margin-bottom: 2px;
}
.nav-item.active { color: #e53935; }

/* --- Header --- */
.page-header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #e53935 0%, #ff6f00 100%);
  color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(229,57,53,0.2);
}
.page-header .sub { font-size: 12px; font-weight: 400; opacity: 0.9; }

/* --- Cards --- */
.card {
  background: #fff; border-radius: 12px; margin: 10px 12px;
  padding: 14px 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-title {
  font-size: 15px; font-weight: 600; color: #333; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.card-title .dot {
  width: 6px; height: 6px; border-radius: 50%; background: #e53935;
}

/* --- Buttons --- */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 20px;
  font-size: 14px; font-weight: 600; text-align: center;
  border: none; cursor: pointer; transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, #e53935 0%, #ff6f00 100%);
  color: #fff; box-shadow: 0 4px 12px rgba(229,57,53,0.3);
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }
.btn-secondary {
  background: #f0f0f0; color: #666;
}
.btn-block { display: block; width: 100%; }
.btn-gold {
  background: linear-gradient(135deg, #ffb300 0%, #ff8f00 100%);
  color: #fff; box-shadow: 0 4px 12px rgba(255,179,0,0.3);
}

/* --- Coin Display --- */
.coin-display {
  display: flex; align-items: baseline; gap: 4px; color: #e53935;
  font-weight: 700;
}
.coin-display .amount { font-size: 28px; }
.coin-display .unit { font-size: 14px; }

/* --- Ad Cards --- */
.ad-card {
  background: linear-gradient(135deg, #fff8e1 0%, #fff 100%);
  border: 1px solid #ffe082; border-radius: 12px;
  padding: 12px 16px; margin: 8px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.ad-card .ad-info { flex: 1; }
.ad-card .ad-title { font-size: 14px; font-weight: 600; color: #333; }
.ad-card .ad-reward { font-size: 12px; color: #e53935; margin-top: 4px; }
.ad-card .ad-btn {
  background: #e53935; color: #fff; padding: 6px 14px;
  border-radius: 14px; font-size: 12px; font-weight: 600;
  white-space: nowrap; margin-left: 10px;
}

/* --- Red Packet Group Page --- */
.chat-container {
  background: #f5f5f5; padding: 10px 12px;
  max-height: calc(100vh - 200px); overflow-y: auto;
}
.chat-msg {
  display: flex; align-items: flex-start; margin-bottom: 12px;
}
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #e53935, #ff6f00);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0; margin-right: 10px;
}
.chat-bubble {
  background: #fff; border-radius: 12px; padding: 10px 14px;
  font-size: 13px; color: #333; max-width: 70%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.chat-bubble.system {
  background: #e8f5e9; color: #2e7d32; font-size: 12px;
  align-self: center; margin: 6px auto;
}

.redpacket-float {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  z-index: 200; text-align: center;
}
.redpacket-btn {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, #e53935 0%, #ff6f00 100%);
  color: #fff; font-size: 18px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(229,57,53,0.4);
  border: 3px solid #ffeb3b; cursor: pointer;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.redpacket-btn .rp-label { font-size: 11px; font-weight: 400; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: #fff; border-radius: 16px; padding: 24px;
  width: 80%; max-width: 320px; text-align: center;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: #666; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* --- Invite Page --- */
.invite-code-box {
  background: linear-gradient(135deg, #e53935 0%, #ff6f00 100%);
  color: #fff; border-radius: 12px; padding: 20px;
  text-align: center; margin: 12px;
}
.invite-code-box .code {
  font-size: 32px; font-weight: 700; letter-spacing: 4px;
  background: rgba(255,255,255,0.2); border-radius: 8px;
  padding: 10px 20px; display: inline-block; margin: 10px 0;
}
.invite-tree {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  padding: 16px;
}
.invite-node {
  text-align: center;
}
.invite-node .avatar {
  width: 50px; height: 50px; border-radius: 50%;
  background: #e53935; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; margin: 0 auto 6px;
}
.invite-node .label { font-size: 12px; color: #666; }
.invite-arrow { font-size: 20px; color: #e53935; }

/* --- Welfare Page --- */
.welfare-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; padding: 0 12px;
}
.welfare-item {
  background: #fff; border-radius: 12px; padding: 16px 8px;
  text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.welfare-item .icon {
  font-size: 32px; margin-bottom: 6px;
}
.welfare-item .name { font-size: 13px; font-weight: 600; color: #333; }
.welfare-item .desc { font-size: 11px; color: #999; margin-top: 2px; }

/* --- Mine Page --- */
.mine-header {
  background: linear-gradient(135deg, #e53935 0%, #ff6f00 100%);
  color: #fff; padding: 30px 20px 20px; text-align: center;
}
.mine-header .avatar-large {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,0.3); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 600; margin: 0 auto 10px;
}
.mine-menu {
  background: #fff; border-radius: 12px; margin: 12px;
  overflow: hidden;
}
.mine-menu-item {
  display: flex; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid #f5f5f5; cursor: pointer;
}
.mine-menu-item:last-child { border-bottom: none; }
.mine-menu-item .icon { font-size: 20px; margin-right: 12px; width: 24px; text-align: center; }
.mine-menu-item .text { flex: 1; font-size: 14px; color: #333; }
.mine-menu-item .arrow { color: #ccc; font-size: 14px; }

/* --- Toast --- */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75); color: #fff; padding: 12px 24px;
  border-radius: 8px; font-size: 14px; z-index: 3000;
  pointer-events: none; animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Loading --- */
.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.8); z-index: 2500;
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 36px; height: 36px; border: 3px solid #f3f3f3;
  border-top: 3px solid #e53935; border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Utility --- */
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }
.hidden { display: none !important; }
.text-gold { color: #ff8f00; }
.text-red { color: #e53935; }
.text-gray { color: #999; }
.fs-12 { font-size: 12px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
