:root {
  --primary: #FF6B35;
  --primary-light: #FF8C42;
  --primary-bg: #FFF4ED;
  --secondary: #4CAF50;
  --gold: #FFB300;
  --text: #1F2937;
  --text-light: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --danger: #EF4444;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 84px; min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* 顶部 Header */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 14px 16px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.25);
}
.app-header h1 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-header .user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.95;
}
.app-header select {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  max-width: 120px;
}
.app-header select option { color: var(--text); }

/* 通用容器 */
.container { padding: 12px 16px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 数据统计卡 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-item {
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.stat-item .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.stat-item .label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

/* 按钮 */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  background: var(--primary);
  color: #fff;
  text-align: center;
  width: 100%;
  transition: transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; }
.btn-block { width: 100%; }
.btn-secondary { background: var(--secondary); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost { background: var(--bg); color: var(--text-light); }

/* Tab Bar */
.tabbar {  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1;
  padding: 8px 0 10px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tabbar button.active { color: var(--primary); }
.tabbar button .icon { font-size: 18px; }

/* 底部备案信息（法定要求：ICP 备案号需展示在网站底部） */
.app-footer {
  position: fixed;
  bottom: 58px; left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding-bottom: 2px;
  z-index: 19;
  pointer-events: none;
}
.app-footer a { color: var(--text-muted); text-decoration: none; pointer-events: auto; }

/* 视图切换 */
.view { display: none; animation: fadeIn 0.2s; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.form-group textarea { min-height: 80px; resize: vertical; }

/* 上传区 */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 8px;
  background: #FAFBFC;
}
.upload-area.has-file { border-color: var(--primary); color: var(--primary); }
.upload-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.upload-preview .preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}
.upload-preview .preview-item img,
.upload-preview .preview-item video {
  width: 100%; height: 100%; object-fit: cover;
}
.upload-preview .preview-item .remove {
  position: absolute;
  top: 2px; right: 2px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}

/* 排行榜 */
.rank-list { list-style: none; }
.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.rank-list li:last-child { border-bottom: none; }
.rank-list .rank-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-light);
}
.rank-list .rank-1 { background: linear-gradient(135deg, #FFD700, #FFA500); color: #fff; }
.rank-list .rank-2 { background: linear-gradient(135deg, #E5E5E5, #B0B0B0); color: #fff; }
.rank-list .rank-3 { background: linear-gradient(135deg, #CD7F32, #A0522D); color: #fff; }
.rank-list .name { flex: 1; font-size: 14px; font-weight: 500; }
.rank-list .team-tag {
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.rank-list .points { font-weight: 700; color: var(--primary); }

/* 标签切换 */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.tabs button {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* 提示 */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

.empty-state {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-state .emoji { font-size: 36px; display: block; margin-bottom: 8px; }

/* 进度条 */
.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.4s;
}

/* 团队成员 */
.member-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}
.member-card {
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}
.member-card .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 4px;
  font-weight: 700;
}
.member-card .name { font-size: 12px; font-weight: 500; }
.member-card .pts { font-size: 11px; color: var(--text-light); }

/* 日历 */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.calendar-grid .cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--text-light);
}
.calendar-grid .cell.checked { background: var(--primary); color: #fff; font-weight: 600; }
.calendar-grid .cell.sprint { background: var(--gold); color: #fff; }
.calendar-grid .cell.today { outline: 2px solid var(--primary); }
