* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #f6f7f9;
  color: #1a1a1a;
  font-size: 14px;
}
/* 页面滚动区：高度 = 视口 - tabbar，内容永远不会被底部导航遮住 */
.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.hidden { display: none !important; }

/* 头部 */
.hero {
  background: linear-gradient(135deg, #4a6cf7, #7a5af8);
  color: #fff;
  padding: 20px 16px 16px;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; }
.hero h1 { font-size: 20px; }
.hero-sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.badge-wait { background: rgba(255,255,255,.25); }
.badge-ok { background: #2fbf71; }
.badge-off { background: #e05252; }
.user { display: flex; align-items: center; margin-top: 14px; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 15px; font-weight: 600; }
.user-sub { font-size: 11px; opacity: .8; margin-top: 2px; }

/* 活动 banner */
.banner { padding: 12px 16px 0; }
.banner-card {
  border-radius: 12px; padding: 12px 14px; font-size: 13px;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.banner-card strong { color: #4a6cf7; }

/* 主区 */
main { padding: 12px 16px 16px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 8px; }
.section-head h2 { font-size: 15px; }
.hint { font-size: 11px; color: #999; }
.link-btn { border: 0; background: none; color: #4a6cf7; font-size: 12px; }

/* 进度卡 */
.progress-card, .cond-card {
  background: #fff; border-radius: 12px; padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.progress-line { display: flex; justify-content: space-between; font-size: 13px; }
.progress-line b { color: #4a6cf7; font-size: 18px; }
.bar { height: 6px; border-radius: 3px; background: #eee; margin-top: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #4a6cf7, #7a5af8); border-radius: 3px; transition: width .3s; }
.progress-sub { font-size: 11px; color: #999; margin-top: 8px; }

/* 日历 */
.calendar {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
}
.cell {
  aspect-ratio: 1; border-radius: 8px; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: #999; border: 1px solid #eee;
}
.cell .d { font-size: 12px; font-weight: 600; color: #666; }
.cell.signed { background: #e6f8ee; border-color: #2fbf71; }
.cell.signed .d { color: #1c9a57; }
.cell.makeup { background: #fff8e0; border-color: #f5b840; }
.cell.makeup .d { color: #b57e10; }
.cell.missed { border-color: #f0a0a0; background: #fff5f5; cursor: pointer; }
.cell.missed .d { color: #d05353; }
.cell.locked { background: #f2f2f4; border-color: #e4e4e8; color: #aaa; }
.cell.locked .d { color: #aaa; }
.cell.today { border: 2px solid #4a6cf7; }
.cell.future { background: #fafafa; }

/* 数据小卡 */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px;
}
.stat-cell {
  background: #fff; border-radius: 10px; padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: #888;
}
.stat-cell b {
  font-size: 13px; color: #333; font-weight: 600; max-width: 62%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tip {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: #fff5f5; color: #c05050; font-size: 12px; line-height: 1.6;
}
.hint.center { display: block; text-align: center; margin-top: 8px; }


/* 大按钮 */
.big-btn {
  width: 100%; margin-top: 16px; padding: 14px 0; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #4a6cf7, #7a5af8); color: #fff;
  font-size: 16px; font-weight: 600;
}
.big-btn:disabled { background: #c8ccd4; }

/* 排行 */
.cond-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.cond-row { display: flex; justify-content: space-between; font-size: 12px; color: #666; margin-top: 4px; }
.my-rank {
  margin-top: 12px; background: #fff; border-radius: 12px; padding: 12px 14px;
  border: 1px solid #4a6cf7; font-size: 13px;
}
.my-rank b { color: #4a6cf7; }
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 10px 12px;
}
.rank-no { width: 28px; text-align: center; font-weight: 700; color: #999; }
.rank-item.top3 .rank-no { color: #f5a623; }
.rank-name { flex: 1; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.rank-count { font-size: 12px; color: #666; }
.rank-prize { font-size: 12px; color: #4a6cf7; font-weight: 600; text-align: right; display: flex; flex-direction: column; gap: 2px; }
.sub { font-size: 10px; color: #999; font-weight: 400; }
.empty { text-align: center; color: #999; font-size: 12px; padding: 24px 0; }
.budget {
  margin-top: 12px; background: #fff; border-radius: 12px; padding: 12px 14px;
  font-size: 12px; color: #666; line-height: 1.6;
}
.budget b { color: #4a6cf7; }

/* 推荐 */
.ref-summary {
  background: #fff; border-radius: 12px; padding: 16px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ref-num { text-align: center; flex: 1; }
.ref-num b { font-size: 24px; color: #4a6cf7; }
.ref-num span { display: block; font-size: 11px; color: #999; margin-top: 2px; }
.ref-rule { font-size: 11px; color: #666; line-height: 1.7; margin-top: 10px; }
.ops-row { display: flex; gap: 10px; align-items: stretch; }
.ops-row .big-btn { flex: 2; margin-top: 12px; }
.btn-secondary {
  flex: 1; margin-top: 12px; border: 1px solid #4a6cf7; background: #fff; color: #4a6cf7;
  border-radius: 12px; font-size: 13px; padding: 0 8px;
}
.link-text {
  word-break: break-all; background: #f6f7f9; border-radius: 8px;
  padding: 10px; margin-top: 8px !important; color: #333 !important;
}

/* 记录 */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  flex-shrink: 0; border: 1px solid #e2e4ea; background: #fff; color: #666;
  border-radius: 14px; font-size: 12px; padding: 5px 12px;
}
.chip.active { background: #4a6cf7; border-color: #4a6cf7; color: #fff; }
.record-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.record-item {
  background: #fff; border-radius: 12px; padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.record-main { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.record-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: #4a6cf7; }
.record-side .sub { color: #999; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 6px; }
.tag.checkin { background: #e6f8ee; color: #1c9a57; }
.tag.makeup { background: #fff8e0; color: #b57e10; }
.load-more {
  width: 100%; margin-top: 12px; padding: 10px 0; border-radius: 10px;
  border: 1px solid #e2e4ea; background: #fff; color: #4a6cf7; font-size: 13px;
}
.ref-list { display: flex; flex-direction: column; gap: 8px; }
.ref-item {
  background: #fff; border-radius: 12px; padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center; font-size: 13px;
}
.ref-status { font-size: 12px; }
.ref-status.done { color: #1c9a57; }
.ref-status.doing { color: #b57e10; }

/* 规则 */
.rules { background: #fff; border-radius: 12px; padding: 16px 14px; }
.rules h2 { font-size: 14px; margin: 12px 0 6px; }
.rules h2:first-child { margin-top: 0; }
.rules ol { padding-left: 18px; }
.rules li { font-size: 12px; color: #444; line-height: 1.8; }
.prize-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.prize-table th, .prize-table td { border: 1px solid #eee; padding: 6px 8px; font-size: 12px; text-align: left; }
.prize-table th { background: #f6f7f9; }

/* 底部 tab：参与文档流，不再悬浮覆盖内容 */
.tabbar {
  flex-shrink: 0;
  background: #fff; border-top: 1px solid #eee;
  display: flex; z-index: 10;
  /* 给 Home 指示条留出高度，避免上滑手势区域压住导航按钮 */
  padding-bottom: max(env(safe-area-inset-bottom), 14px);
}
.tab {
  flex: 1; border: 0; background: none; font-size: 13px; color: #999;
  padding: 13px 0; min-height: 48px;
}
.tab.active { color: #4a6cf7; font-weight: 600; }

/* 弹窗与提示 */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.dialog { width: 78%; background: #fff; border-radius: 14px; padding: 18px 16px; }
.dialog h3 { font-size: 15px; margin-bottom: 8px; }
.dialog p { font-size: 13px; color: #666; line-height: 1.6; }
.dialog-ops { display: flex; gap: 10px; margin-top: 16px; }
.btn-ghost, .btn-primary { flex: 1; padding: 10px 0; border-radius: 10px; font-size: 14px; }
.btn-ghost { border: 1px solid #ddd; background: #fff; color: #666; }
.btn-primary { border: 0; background: #4a6cf7; color: #fff; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; font-size: 13px;
  padding: 8px 14px; border-radius: 16px; z-index: 30; max-width: 80%;
  text-align: center;
}
