/* =========================================================
   打本报名 · 全局样式
   紫色主题（与小程序端一致 #6C4DF6），移动端优先布局
   ========================================================= */
:root {
  --primary: #6C4DF6;
  --primary-dark: #5A3DE0;
  --primary-light: #EFEBFE;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --text: #1F2329;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --danger: #DC2626;
  --success: #16A34A;
  --warning: #D97706;
  --border: #EEF0F4;
  --radius: 16rpx;
  --shadow: 0 2rpx 12rpx rgba(31, 35, 41, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

body {
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: #fff;
  border-bottom: 1rpx solid var(--border);
  z-index: 100;
  box-shadow: 0 1rpx 4rpx rgba(0,0,0,0.04);
}
.topbar-inner {
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  position: relative;
}
.nav-back {
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  margin-left: -8px;
}
.nav-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}
.nav-right {
  min-width: 40px;
  text-align: right;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
}

/* ---------- 页面容器 ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 56px 12px 76px;
  min-height: 100vh;
}

/* ---------- 底部 TabBar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1rpx solid var(--border);
  display: flex;
  z-index: 100;
}
.tabbar .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 0 8px;
  cursor: pointer;
  color: var(--text-3);
}
.tabbar .tab-item.active { color: var(--primary); }
.tabbar .tab-icon { font-size: 20px; line-height: 1.2; }
.tabbar .tab-label { font-size: 11px; margin-top: 2px; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:disabled { background: #C4BBF5; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: #F3F4F6; color: var(--text); }
.btn-outline { background: #fff; color: var(--primary); border: 1rpx solid var(--primary); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
}
.tag-green { background: #E7F6EC; color: var(--success); }
.tag-orange { background: #FEF3E2; color: var(--warning); }
.tag-gray { background: #F3F4F6; color: var(--text-3); }
.tag-red { background: #FEE2E2; color: var(--danger); }
.tag-purple { background: #F3E8FF; color: #9333EA; }

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.flex { display: flex; align-items: center; }
.flex-1 { flex: 1; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

/* 头像 */
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-lg { width: 72px; height: 72px; font-size: 36px; }
.avatar-sm { width: 30px; height: 30px; font-size: 16px; }

/* 列表行 */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1rpx solid var(--border);
}
.row:last-child { border-bottom: none; }

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

/* 空状态 */
.empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-3);
}
.empty-icon { font-size: 44px; margin-bottom: 10px; }

/* 骨架屏（加载中） */
.skeleton {
  background: linear-gradient(90deg, #F0F1F5 25%, #E7E9EF 37%, #F0F1F5 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius);
}
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* 进度条 */
.progress-bar {
  height: 8px;
  background: #F0F1F5;
  border-radius: 8px;
  overflow: hidden;
}
.progress-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #9B7BFF);
  border-radius: 8px;
  transition: width .4s ease;
}
.progress-bar-lg { height: 14px; border-radius: 10px; }
.progress-inner-lg {
  height: 100%;
  background: linear-gradient(90deg, #F59E0B, var(--primary));
  border-radius: 10px;
  transition: width .5s ease;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 80%;
  z-index: 999;
  text-align: center;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 300px;
  max-width: 86%;
  padding: 20px;
}
.modal-title { font-size: 16px; font-weight: 600; text-align: center; }
.modal-content { font-size: 14px; color: var(--text-2); margin: 12px 0 18px; line-height: 1.6; white-space: pre-line; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #6C4DF6 0%, #9B7BFF 55%, #EDE9FE 100%);
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: 0 12px 32px rgba(60, 40, 160, 0.25);
}
.login-logo { text-align: center; margin-bottom: 6px; }
.login-logo .logo-icon { font-size: 52px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; color: var(--primary); }
.login-sub { text-align: center; font-size: 12px; color: var(--text-3); margin: 6px 0 22px; }
.login-tabs { display: flex; margin-bottom: 18px; background: #F5F6FA; border-radius: 10px; padding: 4px; }
.login-tabs .lt-item { flex: 1; text-align: center; padding: 8px; font-size: 14px; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.login-tabs .lt-item.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1rpx 4rpx rgba(0,0,0,.06); }
.login-tip { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 14px; }

/* ---------- 首页车次卡片 ---------- */
.week-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.week-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  border: 1rpx solid transparent;
}
.week-tab.active { background: var(--primary); color: #fff; font-weight: 600; }

.car-card { cursor: pointer; }
.car-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.car-title { font-size: 16px; font-weight: 600; }
.car-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.car-meta span { display: inline-flex; align-items: center; gap: 3px; }
.car-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1rpx solid var(--border); font-size: 12px; color: var(--text-3); }

/* 榜单 */
.rank-list { padding: 0 4px; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1rpx solid var(--border); cursor: pointer; }
.rank-item:last-child { border-bottom: none; }
.rank-no { width: 26px; text-align: center; font-size: 16px; font-weight: 700; color: var(--text-3); }
.rank-no.top { color: var(--warning); }
.rank-score { font-size: 16px; font-weight: 700; color: var(--primary); }
.rank-sub { font-size: 11px; color: var(--text-3); min-width: 70px; text-align: right; }
.rank-crown { font-size: 14px; animation: rank-crown-bounce 1.6s ease-in-out infinite; display: inline-block; }
@keyframes rank-crown-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.rank-top1 {
  background: linear-gradient(135deg, #FFF9E6, #FFEFC2 55%, #FFE3A3);
  border: 1rpx solid #F5C34E;
  border-radius: 14px;
  padding: 14px 10px;
  margin: 6px 0 4px;
  box-shadow: 0 4px 16px rgba(245, 195, 78, .35);
}
.rank-top1 .rank-no { font-size: 22px; }
.rank-top1 .rank-score { color: #B8860B; font-size: 18px; }
.rank-top2 {
  background: linear-gradient(135deg, #F2F4F8, #E8EBF2);
  border: 1rpx solid #C9CFDD;
  border-radius: 12px;
  padding: 12px 10px;
  margin: 4px 0;
}
.rank-top2 .rank-no { font-size: 20px; color: #6B7280; }
.rank-top3 {
  background: linear-gradient(135deg, #FDF0E7, #F8E0CE);
  border: 1rpx solid #E0A878;
  border-radius: 12px;
  padding: 12px 10px;
  margin: 4px 0;
}
.rank-top3 .rank-no { font-size: 18px; color: #B06A2B; }

/* 个人主页 */
.profile-hero {
  background: linear-gradient(135deg, #6C4DF6, #9B7BFF);
  color: #fff;
  border-radius: 16px;
  padding: 20px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-hero .avatar { background: rgba(255,255,255,.25); }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-stats { display: flex; gap: 18px; margin-top: 8px; font-size: 12px; opacity: .95; }
.stat-num { font-size: 16px; font-weight: 700; }

/* 年度活动页 */
.hero {
  background: linear-gradient(135deg, #F59E0B, #F97316, #6C4DF6);
  color: #fff;
  border-radius: 16px;
  padding: 24px 18px;
  text-align: center;
  margin-bottom: 12px;
}
.hero-title { font-size: 22px; font-weight: 800; letter-spacing: 2px; }
.hero-slogan { font-size: 15px; margin: 8px 0; font-weight: 600; }
.hero-reward { font-size: 13px; opacity: .95; }

/* 管理后台 */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.admin-tab { padding: 8px 14px; border-radius: 20px; background: #fff; font-size: 13px; cursor: pointer; color: var(--text-2); border: 1rpx solid var(--border); }
.admin-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 通知 */
.msg-item { padding: 12px 0; border-bottom: 1rpx solid var(--border); }
.msg-item:last-child { border-bottom: none; }
.msg-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.msg-content { font-size: 13px; color: var(--text-2); margin-top: 4px; line-height: 1.5; }
.msg-time { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; }

/* 表格（后台名单） */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 6px; border-bottom: 1rpx solid var(--border); text-align: left; }
.table th { color: var(--text-2); font-weight: 500; background: #FAFAFC; }

/* 分段容器 */
.seg { display: flex; gap: 8px; margin-bottom: 12px; }
.seg-item { flex: 1; text-align: center; padding: 9px 0; border-radius: 10px; background: #fff; cursor: pointer; font-size: 13px; color: var(--text-2); }
.seg-item.active { background: var(--primary); color: #fff; font-weight: 600; }

/* 评论输入 */
.comment-box { display: flex; gap: 8px; margin-top: 10px; }
.comment-box .form-input { flex: 1; }

/* 消息通知权限横幅 */
.notify-banner {
  background: #FFF7E6;
  border: 1rpx solid #FDE68A;
  color: #92400E;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 新增：积分商城 ===== */
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-card { display: flex; flex-direction: column; }
.shop-img { width: 100%; height: 120px; border-radius: 8px; overflow: hidden; background: #F4F4F8; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.shop-img img { width: 100%; height: 100%; object-fit: cover; }
.shop-img-empty { font-size: 34px; }
.shop-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.shop-desc { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.4; flex: 1; }
.shop-bottom { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.shop-points { font-size: 15px; font-weight: 800; color: var(--primary); }
.shop-thumb { width: 42px; height: 42px; border-radius: 8px; overflow: hidden; background: #F4F4F8; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-right: 10px; flex: none; }
.shop-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shop-thumb-sm { width: 34px; height: 34px; font-size: 16px; margin-right: 8px; }
.shop-img-zoom { cursor: zoom-in; }
.shop-thumb-zoom { cursor: zoom-in; }
.img-preview { max-width: 82vw; max-height: 70vh; margin: 0 auto; text-align: center; }
.img-preview img { max-width: 100%; max-height: 70vh; border-radius: 8px; display: block; margin: 0 auto; }

/* ===== 新增：图片头像 ===== */
.avatar-img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.avatar-uploader { width: 88px; height: 88px; border-radius: 50%; background: #F4F4F8; border: 1rpx dashed var(--border); display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--text-3); overflow: hidden; margin: 0 auto; cursor: pointer; }
.avatar-uploader img { width: 100%; height: 100%; object-fit: cover; }

/* ===== 新增：徽章与隐藏 ===== */
.tag-primary { background: rgba(124, 58, 237, .12); color: #6d28d9; }
.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }
.mb-12 { margin-bottom: 12px; }
