/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f5f6fa;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 容器样式 */
.home-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* 卡片通用样式 */
.user-card,
.lottery-card,
.section-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  margin-bottom: 16px;
  overflow: hidden;
}

/* 用户卡片 */
.user-card {
  background: linear-gradient(135deg, #4287f5, #2673e6);
  color: white;
  padding: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.default-avatar {
  color: white;
  font-weight: bold;
  font-size: 24px;
}

.user-details {
  flex-grow: 1;
}

.user-name {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.premium-badge i {
  color: #FFD700;
  font-size: 18px;
}

.user-id {
  font-size: 14px;
  opacity: 0.8;
}

/* 用户余额显示 - 全新设计 */
.user-balances {
  margin-top: 15px;
  position: relative;
}

/* 分隔线 */
.balance-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 10px 0;
  width: 100%;
}

/* 主余额样式 */
.main-balance {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin: 0 auto;
  width: 90%;
}

.balance-value {
  font-size: 32px;
  font-weight: 700;
  color: white;
}

.balance-currency {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  margin-top: 3px;
}

.balance-currency i {
  font-size: 16px;
}

/* 奖励网格样式 */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 10px;
  margin: 8px 0;
}

.reward-cell {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reward-cell:nth-child(1) {
  background: rgba(100, 181, 246, 0.15);
}

.reward-cell:nth-child(2) {
  background: rgba(77, 208, 225, 0.15);
}

.reward-cell:nth-child(3) {
  background: rgba(171, 71, 188, 0.15);
}

.reward-cell:nth-child(4) {
  background: rgba(236, 64, 122, 0.15);
}

.reward-value {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
}

.reward-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.9);
}

.reward-info i {
  font-size: 18px;
  opacity: 0.9;
}

.reward-info span {
  font-size: 14px;
  font-weight: 500;
}

/* 底部余额信息 */
.bottom-balance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
  color: white;
  font-size: 15px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.balance-amount {
  font-weight: 700;
}

.balance-dash {
  opacity: 0.6;
}

.balance-label {
  color: white;
}

/* 奖励列表样式 */
.rewards-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reward-card {
  flex: 1;
  min-width: calc(50% - 5px);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.reward-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0.5;
  z-index: 0;
}

.reward-card:nth-child(1) {
  background: rgba(255, 193, 7, 0.2);
}

.reward-card:nth-child(2) {
  background: rgba(76, 175, 80, 0.2);
}

.reward-card:nth-child(3) {
  background: rgba(233, 30, 99, 0.2);
}

.reward-card:nth-child(4) {
  background: rgba(3, 169, 244, 0.2);
}

.reward-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 奖励网格布局 */
.reward-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.reward-item:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.reward-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.reward-icon i {
  font-size: 18px;
  color: white;
}

.reward-details {
  display: flex;
  flex-direction: column;
}

.reward-amount {
  font-size: 18px;
  font-weight: 600;
  color: white;
  line-height: 1.2;
}

.reward-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

/* 抽奖活动卡片 */
.lottery-card {
  padding: 24px;
}

.lottery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.lottery-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lottery-time {
  text-align: right;
}

.time-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}

.countdown {
  font-size: 20px;
  font-weight: 600;
  color: #4287f5;
}

.lottery-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
}

.lottery-stats .stat-item {
  text-align: center;
  background: transparent;
  padding: 0;
}

.lottery-stats .stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #4287f5;
  margin-bottom: 4px;
}

.lottery-stats .stat-label {
  font-size: 14px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.join-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff4d4d, #f33);
  color: white;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 16px;
}

.join-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,77,77,0.3);
}

.lottery-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.action-link {
  padding: 12px;
  border-radius: 8px;
  background: #f8f9fa;
  color: #666;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.action-link:hover {
  background: #e9ecef;
  color: #4287f5;
}

/* 通用部分卡片样式 */
.section-card {
  padding: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 18px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header h2 i {
  color: #4287f5;
}

.view-all {
  color: #4287f5;
  text-decoration: none;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.subtitle {
  font-size: 12px;
  color: #666;
}

/* 排行榜样式 */
.leaderboard-list {
  padding: 0 16px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.leaderboard-item:hover {
  background: #f8f9fa;
}

.rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 12px;
}

.rank-1 {
  background: #FFD700;
  color: white;
}

.rank-2 {
  background: #C0C0C0;
  color: white;
}

.rank-3 {
  background: #CD7F32;
  color: white;
}

.rank:not(.rank-1):not(.rank-2):not(.rank-3) {
  background: #f0f0f0;
  color: #666;
}

.user {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.default-mini {
  color: #666;
  font-size: 14px;
  font-weight: bold;
}

.score {
  font-weight: bold;
  color: #4287f5;
}

/* 任务部分 */
.task-summary {
  padding: 16px;
  background: #f8f9fa;
  margin: 16px;
  border-radius: 12px;
}

.reward-summary {
  text-align: center;
}

.reward-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.reward-value {
  font-size: 24px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.task-list {
  padding: 16px;
}

.task-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: 12px;
  background: #f8f9fa;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.task-item:hover {
  background: #e9ecef;
}

.task-item.completed {
  opacity: 0.7;
}

.task-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #4287f5;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.task-icon i {
  font-size: 24px;
}

.task-info {
  flex: 1;
}

.task-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.task-desc {
  font-size: 13px;
  color: #666;
}

.task-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-reward {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #4287f5;
  font-weight: 500;
}

.task-btn {
  padding: 6px 12px;
  border-radius: 6px;
  background: #4287f5;
  color: white;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.task-btn:hover {
  background: #2673e6;
}

.task-completed i {
  color: #4CAF50;
  font-size: 24px;
}

/* 活动数据统计样式 */
.stats-card {
  padding: 20px;
}

.stats-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 16px;
}

.stats-content .stat-item {
  text-align: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.stats-content .stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stats-content .stat-icon {
  margin-bottom: 12px;
}

.stats-content .stat-icon i {
  font-size: 32px;
  color: #4287f5;
}

.stats-content .stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}

.stats-content .stat-label {
  font-size: 14px;
  color: #666;
}

/* 空状态样式 */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #666;
}

.empty-state i {
  font-size: 48px;
  color: #ddd;
  margin-bottom: 8px;
  display: block;
}

.empty-state p {
  margin: 0;
}

/* 响应式调整 */
@media (max-width: 480px) {
  .home-container {
    padding: 12px;
  }
  
  .user-card {
    padding: 15px;
  }
  
  .user-avatar {
    width: 48px;
    height: 48px;
  }
  
  .user-name {
    font-size: 16px;
  }
  
  .main-balance {
    padding: 5px 0;
  }
  
  .balance-value {
    font-size: 28px;
  }
  
  .rewards-grid {
    gap: 8px;
  }
  
  .reward-cell {
    padding: 12px 8px;
  }
  
  .reward-value {
    font-size: 20px;
  }
  
  .reward-info {
    font-size: 12px;
  }
  
  .bottom-balance {
    font-size: 14px;
    gap: 15px;
  }
  
  .task-item {
    padding: 12px;
  }
  
  .task-icon {
    width: 36px;
    height: 36px;
  }
  
  .task-icon i {
    font-size: 20px;
  }
  
  .stats-content {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
  }
  
  .stats-content .stat-item {
    padding: 12px 8px;
  }
  
  .stats-content .stat-icon i {
    font-size: 24px;
  }
  
  .stats-content .stat-value {
    font-size: 18px;
  }
  
  .stats-content .stat-label {
    font-size: 12px;
  }
}
