/* 任务平台手机版 - layui 扁平简约风
   基于 layui 2.9 色板（主色 #FF5722 / 金币 #FFB800），
   本文件只做：移动端尺寸适配 + 圆角/阴影的扁平化覆盖 + 业务类。
   规则：按钮与输入框一律 line-height 居中，不用 padding 顶字。 */

:root {
  --primary: #FF5722;
  --primary-dark: #E64A19;
  --primary-light: #FFF3EF;
  --gold: #FFB800;
  --bg: #F2F2F2;
  --card: #FFFFFF;
  --text: #333333;
  --text-sub: #666666;
  --text-hint: #999999;
  --border: #EEEEEE;
  --radius: 10px;
  --radius-sm: 8px;
  --tabbar-h: 56px;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input { font-family: inherit; font-size: 14px; }

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

/* ============================================================
   layui 组件：移动端扁平化覆盖
   ============================================================ */

/* --- 按钮：44px 高，圆角 8px，去掉原生阴影 --- */
.layui-btn {
  height: 44px;
  line-height: 44px;
  padding: 0 18px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  border: none;
  box-shadow: none;
  background-color: var(--primary);
}
.layui-btn:active { opacity: .85; }
.layui-btn-lg { height: 48px; line-height: 48px; font-size: 16px; }
.layui-btn-sm { height: 32px; line-height: 32px; padding: 0 14px; font-size: 13px; }
.layui-btn-xs { height: 26px; line-height: 26px; padding: 0 10px; font-size: 12px; }
.layui-btn-fluid { width: 100%; padding: 0; }
.layui-btn-primary {
  background-color: #fff;
  border: 1px solid #DDD;
  color: var(--text-sub);
}
.layui-btn-primary:hover { border-color: var(--primary); color: var(--primary); }
.layui-btn-normal { background-color: #1E9FFF; }
.layui-btn-warm { background-color: var(--gold); }
.layui-btn-danger { background-color: #FF5722; }
.layui-btn-disabled,
.layui-btn[disabled] { opacity: .5; }

/* --- 输入框 --- */
.layui-input,
.layui-textarea,
.layui-select {
  height: 46px;
  line-height: 46px;
  border-radius: var(--radius-sm);
  border-color: #E6E6E6;
  font-size: 15px;
  padding: 0 14px;
}
.layui-input:focus,
.layui-textarea:focus { border-color: var(--primary) !important; box-shadow: none; }
.layui-input::-webkit-input-placeholder { color: #BBB; }
.layui-form-item { margin-bottom: 14px; }
.layui-form-label { display: none; }

/* --- 卡片：扁平，去阴影，改用 1px 描边 --- */
.layui-card {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  background: var(--card);
}
.layui-card-header {
  height: auto;
  line-height: 22px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid #F5F5F5;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
}
.layui-card-header .h-bar {
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
  margin-right: 8px;
  flex: none;
}
.layui-card-body { padding: 14px; }

/* --- 徽章（状态标签） --- */
.layui-badge {
  height: 20px;
  line-height: 20px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 10px;
  background-color: #F2F2F2;
  color: var(--text-sub);
}
.layui-badge.layui-bg-green { background-color: #52C41A !important; }
.layui-badge.layui-bg-orange { background-color: var(--gold) !important; }
.layui-badge.layui-bg-red { background-color: #FF5722 !important; }
.layui-badge.layui-bg-blue { background-color: #1E9FFF !important; }

/* --- 面板与折叠 --- */
.layui-panel,
.layui-collapse { border: none; border-radius: var(--radius); overflow: hidden; }

/* --- 进度/辅助线 --- */
.layui-progress { border-radius: 4px; background-color: #F0F0F0; }
.layui-progress-bar { background-color: var(--primary); }

/* ============================================================
   顶部标题栏
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}
.navbar .nav-back {
  position: absolute;
  left: 4px;
  width: 40px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}
.navbar .nav-right {
  position: absolute;
  right: 14px;
  font-size: 13px;
  font-weight: 400;
  color: #fff;
}

/* ============================================================
   用户信息条（首页 / 我的）
   ============================================================ */
.user-bar {
  background: linear-gradient(135deg, #FF7A45 0%, var(--primary) 100%);
  color: #fff;
  padding: 16px 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-bar .ub-left { min-width: 0; }
.user-bar .ub-name {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-bar .ub-sub {
  font-size: 12px;
  line-height: 18px;
  opacity: .85;
  margin-top: 2px;
}
.user-bar .ub-credit { text-align: right; flex-shrink: 0; padding-left: 12px; }
.user-bar .ub-credit .num {
  font-size: 24px;
  font-weight: 500;
  line-height: 30px;
  letter-spacing: .5px;
}
.user-bar .ub-credit .label { font-size: 11px; line-height: 16px; opacity: .85; }

/* ============================================================
   分类 tab（基于 layui-tab-brief，改成可横滑的胶囊）
   ============================================================ */
.layui-tab.tag-tab { margin: 0; }
.layui-tab.tag-tab > .layui-tab-title {
  height: auto;
  border: none;
  padding: 12px 12px 4px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}
.layui-tab.tag-tab > .layui-tab-title::-webkit-scrollbar { display: none; }
.layui-tab.tag-tab > .layui-tab-title li {
  flex: none;
  min-width: 0;
  height: 32px;
  line-height: 32px;
  padding: 0 16px;
  margin: 0;
  font-size: 13px;
  color: var(--text-sub);
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
}
.layui-tab.tag-tab > .layui-tab-title .layui-this {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
  border-color: var(--primary);
}
.layui-tab.tag-tab > .layui-tab-title .layui-this::after { display: none; }
.layui-tab.tag-tab > .layui-tab-content { padding: 8px 12px 0; }

/* 我的页：单内容复用的 tab 头（不复用 layui-tab 的多 item） */
.my-tabs {
  display: flex;
  gap: 8px;
  padding: 0 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.my-tabs::-webkit-scrollbar { display: none; }
/* 与首页 tab 一致：右侧渐变遮罩提示"还有更多" */
.my-tabs {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
}
.my-tabs .my-tab {
  flex: none;
  height: 32px;
  line-height: 30px;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.my-tabs .my-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
  border-color: var(--primary);
}

/* ============================================================
   任务卡片（首页两列网格）
   ============================================================ */
.task-grid { padding: 0; }
.task-cell { padding: 5px; }

/* ============================================================
   首页「推荐」分类（近 3 天做过的任务）
   平台 API 无剩余任务数，只能用本地完成记录排序
   ============================================================ */
.recent-tip {
  padding: 2px 4px 8px;
  color: var(--text-hint);
  font-size: 12px;
  line-height: 18px;
}
.recent-loading {
  width: 100%;
  text-align: center;
  padding: 32px 0;
  color: var(--text-hint);
  font-size: 13px;
}
.recent-empty {
  width: 100%;
  text-align: center;
  padding: 40px 20px 32px;
  color: var(--text-hint);
}
.recent-empty i { font-size: 34px; color: #D5D5D5; display: block; }
.recent-empty p { font-size: 13px; line-height: 22px; margin-top: 6px; }
.recent-empty span { font-size: 12px; color: #BBBBBB; line-height: 20px; }

/* 推荐卡：主色描边 + 左上角「荐」角标，和分类卡区分 */
.task-card.recent-card {
  position: relative;
  overflow: hidden;
  border-color: #FFD9CC;
  background: linear-gradient(180deg, #FFFCFB 0%, #FFFFFF 60%);
}
.task-card.recent-card::before {
  content: '荐';
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 5px;
  font-size: 10px;
  line-height: 16px;
  color: #FFFFFF;
  background: var(--primary);
  border-radius: var(--radius) 0 var(--radius) 0;
}
.task-card.recent-card .tc-icon {
  background: var(--primary);
  color: #FFFFFF;
}
.recent-count { color: var(--primary); font-weight: 500; }
.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  transition: transform .1s, border-color .15s;
}
.task-card:active { transform: scale(.97); border-color: var(--primary); }
.task-card .tc-icon {
  width: 42px;
  height: 42px;
  line-height: 42px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 20px;
}
.task-card .tc-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card .tc-desc {
  font-size: 11px;
  line-height: 16px;
  color: var(--text-hint);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   做任务页
   ============================================================ */
.task-head {
  background: var(--card);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.task-head .th-name { font-size: 17px; font-weight: 500; line-height: 24px; }
.task-head .th-desc {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-hint);
  margin-top: 2px;
  max-width: 230px;
}
.task-head .th-desc p { margin: 0; }
.task-head .th-desc b { color: var(--text-sub); font-weight: 500; }
.task-head .th-reward {
  font-size: 20px;
  font-weight: 500;
  color: var(--gold);
  line-height: 26px;
  flex: none;
}
.task-head .th-reward span { font-size: 12px; }

.layui-card-header .step-no { margin-right: 8px; }
.layui-card-header .step-title { flex: 1; min-width: 0; }

.step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  flex: none;
}
.step-title { font-size: 15px; font-weight: 500; line-height: 22px; }

.qrcode-box { text-align: center; padding: 4px 0; }
.qrcode-box img {
  width: 190px;
  height: 190px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.qrcode-tip {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 8px;
  line-height: 18px;
}

.copy-box {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  line-height: 22px;
  word-break: break-all;
  color: var(--text);
  max-height: 120px;
  overflow-y: auto;
}

/* 任务关键信息条：公众号名称等，用于用户核对是否加对号 */
.task-meta {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-sub);
  display: flex;
  align-items: flex-start;
}
.task-meta .tm-label { flex: none; color: var(--text-hint); margin-right: 8px; }
.task-meta .tm-value {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-weight: 500;
  word-break: break-all;
}

/* 步骤内的参考图（示例图 / 搜索对照图） */
.step-img { margin-top: 12px; }
.step-img .si-title {
  font-size: 12px;
  color: var(--text-hint);
  margin-bottom: 6px;
  line-height: 18px;
}
.step-img img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}

/* 任务记录里的截图缩略图 */
.li-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-right: 12px;
  flex: none;
  object-fit: cover;
  cursor: pointer;
  display: block;
}

/* ============================================================
   上传区（layui upload 容器）
   ============================================================ */
.uploader {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px dashed #D5D5D5;
  border-radius: var(--radius-sm);
  background: #FAFAFA;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-hint);
  font-size: 13px;
  overflow: hidden;
}
.uploader.has-img { border-style: solid; }
.uploader img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.uploader .up-icon { font-size: 28px; line-height: 32px; color: var(--primary); }
.up-tip { text-align: center; font-size: 12px; color: var(--text-hint); margin-top: 8px; line-height: 18px; }

/* ============================================================
   登录页
   ============================================================ */
.login-logo { text-align: center; padding: 56px 0 30px; }
.login-logo .lg-icon {
  width: 56px;
  height: 56px;
  line-height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 30px;
}
.login-logo .lg-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  line-height: 30px;
}
.login-logo .lg-sub {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 6px;
  line-height: 18px;
}
.form-wrap { padding: 0 20px; }
.form-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 16px;
  line-height: 20px;
}
.form-switch b { color: var(--primary); font-weight: 500; }

/* ============================================================
   列表（我的页）
   ============================================================ */
.list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px;
  overflow: hidden;
}
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title {
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .li-sub {
  font-size: 12px;
  color: var(--text-hint);
  line-height: 18px;
  margin-top: 2px;
}
.list-item .li-right { flex-shrink: 0; text-align: right; font-size: 13px; }
.li-right .add { color: var(--gold); font-weight: 500; }
.li-right .sub { color: var(--text-hint); }

/* 钱包区数字 */
.wallet-num {
  font-size: 22px;
  font-weight: 500;
  line-height: 28px;
  color: var(--gold);
}
.wallet-tip { font-size: 12px; color: var(--text-hint); line-height: 18px; }

/* ============================================================
   空状态
   ============================================================ */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-hint);
  font-size: 13px;
  line-height: 20px;
}
.empty .icon { font-size: 34px; color: #D5D5D5; margin-bottom: 8px; }

/* ============================================================
   底部 tabbar
   ============================================================ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  max-width: 480px;
  margin: 0 auto;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-hint);
  font-size: 11px;
  line-height: 16px;
  gap: 2px;
}
.tabbar a.active { color: var(--primary); }
.tabbar .tb-icon { font-size: 22px; width: 22px; height: 22px; line-height: 22px; text-align: center; }

/* ============================================================
   提示层（降级用：layer 未就绪时仍有兜底样式）
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .8);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 20px;
  z-index: 999;
  max-width: 80%;
  text-align: center;
}

.mock-tip {
  margin: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #FFFBE6;
  border: 1px solid #FFE58F;
  color: #AD6800;
  font-size: 12px;
  line-height: 18px;
}
