/* ============ 基础设计令牌 ============ */
:root {
  --green: #00856A;
  --green-dark: #00705A;
  --green-deep: #00564A;
  --green-light: #E6F4F0;
  --green-soft: #F2FAF7;
  --red: #E8503A;
  --red-soft: #FFF3F0;
  --orange: #F08A24;
  --orange-2: #FF7A16;
  --orange-soft: #FFF6E9;
  --gold: #C9A227;
  --gold-num: #E3C275;
  --text: #1A1A1A;
  --text-2: #666;
  --text-3: #999;
  --text-4: #BDBDBD;
  --line: #EDEDED;
  --bg: #F5F5F5;
  /* 设计稿逻辑尺寸：内部仍按 390×844 排版，再由 app.js 等比缩放到视口 */
  --page-w: 390px;
  --page-h: 844px;
  /* 桌面浏览器下内容列的偏移（由 app.js 计算，用于居中） */
  --app-left: 0px;
  --app-top: 0px;
  --fit: 1;
  --fit-h: 844px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  /* 整页铺满视口；桌面浏览器两侧为浅灰底，移动端看不到底 */
  background: #EDEFEE;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body { position: relative; height: 100%; }

img { display: block; max-width: 100%; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, textarea { font-family: inherit; border: none; outline: none; background: none; }
ul, li { list-style: none; }
a { color: inherit; text-decoration: none; }

/* ============ H5 舞台（无手机外壳） ============ */
/* 整页就是一张铺满视口的 H5：没有机身、黑边、圆角与 Home 条。
   内部按 390×844 设计稿排版，由 app.js 算出的 --fit 等比缩放到当前视口；
   桌面浏览器保持原尺寸居中，两侧留浅灰底。 */
.device {
  position: fixed;
  left: var(--app-left, 0px);
  top: var(--app-top, 0px);
  width: var(--page-w);
  height: var(--fit-h, var(--page-h));
  background: #fff;
  transform: scale(var(--fit, 1));
  transform-origin: left top;
  /* 桌面下与两侧浅灰底之间留一道极淡分隔，手机上不可见 */
  box-shadow: 0 0 30px rgba(0, 0, 0, .05);
}

.device-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
  isolation: isolate;
}

/* ============ 状态栏 ============ */
.statusbar {
  /* 48px 为设计稿高度，真机再叠一层刘海安全区 */
  height: calc(48px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0px) 24px 0 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2px;
  flex: none;
}
.statusbar .st-time { font-variant-numeric: tabular-nums; }
.statusbar .st-right { display: flex; align-items: center; gap: 5px; }
.statusbar.light { color: #fff; }
.statusbar.dark { color: #1a1a1a; }
.statusbar svg { display: block; }

/* ============ 页面容器 ============ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  animation: screen-in .26s ease;
}
@keyframes screen-in {
  from { opacity: .55; transform: translateX(38%); }
  to { opacity: 1; transform: none; }
}
.screen.no-anim { animation: none; }

.screen-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen-body::-webkit-scrollbar { display: none; }

/* ============ 通用导航条 ============ */
.navbar {
  position: relative;
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--text);
}
.navbar .nav-title {
  font-size: 21px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: .4px;
  transform: translateY(-3px);
}
.navbar .nav-left,
.navbar .nav-right {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.navbar .nav-left { left: 16px; }
.navbar .nav-right { right: 16px; }
/* 导航区裸 SVG 兜底尺寸：图标库生成的 svg 没有 width/height 属性，
   直接放进 flex 容器会塌陷成 0×0（右侧图标整体消失） */
.navbar .nav-left > svg,
.navbar .nav-right > svg {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
}
.navbar.green { background: var(--green); color: #fff; }
.navbar.gray { background: #F7F7F7; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
}
.icon-btn svg { display: block; width: 24px; height: 24px; }

/* ============ 底部导航（原图为大字文字版，无图标） ============ */
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  /* 84px 为设计稿高度，真机让出底部 Home 条安全区 */
  height: calc(84px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #E5E5E5;
  display: flex;
  align-items: flex-start;
  padding-top: 13px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 60;
}
/* 上沿 8px 极淡投影（原图 y752~760：#FEFEFE → #F1F1F1） */
.tabbar::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -9px; height: 8px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.018) 45%, rgba(0,0,0,.055) 100%);
  pointer-events: none;
}
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  font-size: 18px;
  font-weight: 700;
  line-height: 18px;
  color: #333;
}
.tabbar .tab.active { color: var(--green); }
.tabbar .tab.active::after {
  content: "";
  position: absolute;
  left: 50%; top: 100%;
  transform: translateX(-50%);
  margin-top: 8px;
  width: 28px; height: 3px;
  border-radius: 2px;
  background: var(--green);
}
.tabbar .tab-assist {
  margin-top: calc(-34px - env(safe-area-inset-bottom, 0px));
  gap: 5px;
}
.tabbar .tab-assist .assist-fab {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 133, 106, .28);
}
.tabbar .tab-assist span {
  font-size: 14px;
  font-weight: 400;
  line-height: 14px;
  color: #222;
}

/* ============ 通用小组件 ============ */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.045);
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.muted { color: var(--text-3); }
.divider { height: 1px; background: var(--line); }

.cell-list { background: #fff; }
.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.cell:last-child { border-bottom: none; }
.cell .cell-arrow { color: #C9C9C9; display: flex; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 26px;
  border-radius: 22px;
  background: var(--orange-2);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}
.pill-btn.block { width: 100%; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 46px 0 20px;
  color: var(--text-3);
  font-size: 13px;
}
.empty .empty-art { margin-bottom: 14px; opacity: .9; }

/* 滚动条隐藏 */
.hide-scroll { scrollbar-width: none; }
.hide-scroll::-webkit-scrollbar { display: none; }

/* ============ 移动端 H5 适配 ============ */
/* 内部永远按 390 定宽设计稿排版，再由 .device 的 scale(--fit) 等比铺满视口：
   - 手机（竖屏 / 横屏）：铺满屏宽，高度跟随真实视口，四边零留白
   - 桌面：保持原尺寸居中，两侧浅灰底
   - 因为排版宽度恒为 390，所有已校准的像素位置在各机型上保持一致 */

@media (max-width: 500px) {
  html, body { background: #fff; }
}

/* 手机横屏：内容列按宽度放大后两侧会留边，用白底衔接，
   同时去掉桌面预览用的淡投影，避免出现“卡片浮在灰底上”的观感 */
@media (max-height: 500px) {
  html, body { background: #fff; }
  .device { box-shadow: none; }
}

/* ---- 刘海 / 灵动岛 / Home 条安全区 ---- */
/* env() 在桌面浏览器与不支持的机型上取 0，可全局生效，不影响 1:1 排版。
   各页面自带安全区的容器（如 .home-scroll / .mine-scroll）在自身文件末尾补充。 */

/* 内容区统一禁止横向滚动（内部轮播 / chips 仍可自行横滑） */
.screen-body { overflow-x: hidden; max-width: 100%; }

/* ============ 真机交互增强 ============ */
/* 1) 纵向滚动更顺手：允许自身滚动，同时用 overscroll-behavior 阻止滚动穿透到 body */
.screen-body {
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

/* 2) 可横向滑动的容器（轮播 / chips）交给浏览器处理手势，避免误触发纵向滚动 */
.screen-body [style*="overflow-x"],
.screen-body .hide-scroll {
  overscroll-behavior-x: contain;
}

/* 3) 长按不弹系统菜单、不选中文字，更像原生 App；输入框与可复制区单独放开 */
.device-screen {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.device-screen input,
.device-screen textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* 4) 点击反馈：真机没有 hover，按下时轻微变淡，避免“点了没反应” */
.screen-body [data-go]:active,
.screen-body [data-act]:active,
.tabbar .tab:active {
  opacity: .62;
}
