/*
 * wap.com · 全局样式基座
 * 与 wx.com/app.wxss 1:1 对应，rpx→px 已 ÷2（750 设计稿 = 375px 视口）。
 * 设计令牌与 wx.com/app.wxss 的 page{} 完全一致。
 */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #17191f;
  --muted: #6f7480;
  --faint: #9aa0aa;
  --line: #ebedf1;
  --brand: #4f5bd5;
  --brand-ink: #3d48b8;
  --brand-soft: #eef0ff;
  --green: #0f7b4f;
  --green-soft: #e7f5ee;
  --amber: #8a5a00;
  --amber-soft: #fdf4e3;
  --red: #a3302b;
  --red-soft: #fbedec;
  --blue: #1d5fa8;
  --blue-soft: #e9f1fb;
  --app-w: 560px; /* 桌面预览时 App 的最大宽度，固定条与它对齐 */
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* 桌面预览：滚动条常驻槽位，避免切页时滚动条出现/消失把居中内容左右顶一下 */
html { scrollbar-gutter: stable; }

/* 桌面预览时居中 560px，手机端天然满宽 */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

button, input, textarea {
  font-family: inherit;
  padding: 0;
  margin: 0;
  border: 0;
  outline: 0;
  background: transparent;
  border-radius: 0;
  line-height: inherit;
  font-size: inherit;
  color: inherit;
}

.num { font-variant-numeric: tabular-nums; }

/* 首屏（.boot）禁掉所有过渡：二级页首次直开时 tabbar 不允许出现"往下滑走"的中间态 */
.boot .nav,
.boot .tabbar,
.boot #view { transition: none !important; }

/* H5 内容区：底部预留 tabbar */
.page-body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
.page-body.no-tab { padding-bottom: 0; }
.footer-pad { height: 8px; }

/* 切页不抖动的前提：内容容器自成 BFC。
   否则首个子元素的 margin-top 会"穿透"到 #view 上，把容器整体顶下去，
   首页（首块是带 padding 的问候）与作品页（首块带 margin）就会差出十几像素。 */
#view { display: flow-root; }

/* ---------- 顶部导航（tab 页 Videos/Assets 用毛玻璃版） ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  /* 分隔线用 inset 阴影而不是 border：0.5px 边框会把高度变成 44.5，切页时内容区会被顶 1px */
  border-bottom: 0;
  box-shadow: inset 0 -0.5px 0 var(--line);
  transition: opacity 0.15s ease;
}

/* 隐藏态不再做位移：栏位始终占同样高度，切页时内容区顶边一模一样（0 位移） */
.nav.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* tab 之间瞬时切换时，导航栏也不许做滑入淡出（否则内容已换、栏还在动） */
.nav.is-instant { transition: none !important; }

/* 二级页导航（components/nav 版，白底不透明） */
.nav.nav-solid {
  background: #ffffff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom: 0;
  box-shadow: none;
}

.nav-bar {
  position: relative;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.nav-title {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: #000;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 100px;
}

.nav-side {
  position: relative;
  z-index: 2;
  width: 48px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-side.right {
  width: auto;
  margin-left: auto;
  justify-content: flex-end;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:active { opacity: 0.4; }

.icon-btn .ic { width: 22px; height: 22px; }

.icon-btn-text {
  width: auto;
  height: 32px;
  padding: 0 8px;
  font-size: 15px;
  color: #000;
  display: flex;
  align-items: center;
}

/* ---------- 区块标题 ---------- */
.sec {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 22px 16px 10px;
}

.sec-t { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.sec-more { margin-left: auto; font-size: 12px; color: var(--faint); cursor: pointer; }
.sec-h { font-size: 11px; color: var(--faint); }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: 16px; }
.card-m { margin-left: 16px; margin-right: 16px; }
.card-pad { padding: 16px; }

/* ---------- 状态标签 ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
  flex: 0 0 4px;
}

.pill-plain::before { display: none; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-gray { background: #f1f2f5; color: #5f6572; }
.pill-brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- 列表行 ---------- */
.list { background: #fff; border-radius: 16px; overflow: hidden; }

.li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 0.5px solid var(--line);
}

.li:last-child { border-bottom: 0; }

.li-ico {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #f4f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5f6572;
  flex: 0 0 36px;
}

.li-ico .ic { width: 17px; height: 17px; }
.li-ico.thumb-sq { background: linear-gradient(135deg, #2f3448, #59617f); }

.li-main { min-width: 0; flex: 1; }

.li-t {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.li-s { font-size: 11px; color: var(--faint); margin-top: 2px; }
.li-act { font-size: 12px; color: var(--brand); flex: 0 0 auto; cursor: pointer; }

/* ---------- 键值行 ---------- */
.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--line);
  font-size: 13px;
}

.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 400; }

/* ---------- 按钮 ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  background: #f4f5f7;
  color: var(--text);
  cursor: pointer;
}

.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:active { background: var(--brand-ink); }
.btn-main { flex: 1; }
.btn-sub { flex: 0 0 auto; }

/* ---------- 提示条 ---------- */
.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.notice .ic { width: 16px; height: 16px; margin-top: 1px; }
.notice b { font-weight: 500; color: var(--text); }

/* ---------- 分段切换 ---------- */
.seg {
  display: flex;
  gap: 4px;
  background: #eceef2;
  border-radius: 11px;
  padding: 3px;
  margin: 14px 16px 0;
}

.seg-item {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.seg-item.is-on {
  background: #fff;
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

/* ---------- 进度条 ---------- */
.track { height: 5px; background: #f0f1f4; border-radius: 4px; overflow: hidden; }
.track-fill { height: 100%; border-radius: 4px; background: var(--brand); }

/* ---------- 状态页 / 页脚 ---------- */
.state { padding: 70px 16px; text-align: center; }
.state-t { font-size: 13px; color: var(--faint); }

.state-btn {
  display: inline-flex;
  margin-top: 12px;
  padding: 7px 20px;
  border-radius: 20px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
}

.foot-note {
  padding: 18px 20px 26px;
  text-align: center;
  font-size: 11px;
  color: #b3b8c2;
  line-height: 1.7;
}

/* ---------- 深色积分卡 ---------- */
.balance {
  margin: 0 16px;
  border-radius: 16px;
  background: #1b1e2a;
  color: #fff;
  padding: 16px;
}

.bal-k { font-size: 11px; color: #a7acbb; }
.bal-v { font-size: 30px; font-weight: 600; letter-spacing: -1px; margin-top: 2px; }
.bal-f { display: flex; justify-content: space-between; font-size: 10px; color: #a7acbb; margin-top: 7px; }

.bal-hint {
  font-size: 10px;
  color: #8b92a3;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  line-height: 1.6;
}

/* ---------- 封面渐变 ---------- */
.thumb-c1 { background: linear-gradient(135deg, #2f3448, #59617f); }
.thumb-c2 { background: linear-gradient(135deg, #2c3f3a, #6d8f7d); }
.thumb-c3 { background: linear-gradient(135deg, #3d3247, #7b6a86); }
.thumb-c4 { background: linear-gradient(135deg, #463a2c, #8d7758); }
.thumb-c5 { background: linear-gradient(135deg, #2b3a4a, #5c7b94); }
.thumb-c6 { background: linear-gradient(135deg, #3f2f33, #8a6b72); }

/* ---------- 底部 tabBar（custom-tab-bar 1:1） ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  right: auto;
  width: 100%;
  max-width: var(--app-w, 560px);
  bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 0.5px solid #ebedf1;
  padding-bottom: env(safe-area-inset-bottom);
  overflow: visible;
  transition: transform 0.22s ease;
  transform: translateX(-50%);
}

/* 中央 FAB 凸出栏体 14px，110% 藏不干净会在二级页底部露出一条圆弧 → 多降 30px */
.tabbar.is-hidden { transform: translateX(-50%) translateY(calc(100% + 30px)); pointer-events: none; }

.tabbar-inner {
  display: flex;
  align-items: center;
  height: 58px;
  max-width: 560px;
  margin: 0 auto;
  overflow: visible;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #8b909c;
  cursor: pointer;
}

.tab .ic { width: 21px; height: 21px; }
.tab-t { font-size: 10px; line-height: 1.2; }
.tab.is-on { color: #4f5bd5; }

.fab-wrap {
  flex: 0 0 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #4f5bd5;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateY(-16px);
  border: 3px solid #fff;
  box-shadow: 0 6px 18px rgba(79, 91, 213, 0.38);
  cursor: pointer;
}

.fab .ic { width: 20px; height: 20px; }
.fab-t { font-size: 9px; margin-top: 1px; letter-spacing: 0.5px; line-height: 1.2; color: #fff; }
.fab.is-on { background: #3d48b8; }

/* ---------- 内容区切换转场（防白屏核心） ---------- */
#view {
  will-change: opacity;
  transition: opacity 0.12s ease;
}

#view.is-fading { opacity: 0; }

/* ---------- Toast ---------- */
#toast-layer {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#toast-layer.is-on { display: flex; }

.toast {
  max-width: 70%;
  background: rgba(23, 25, 31, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 18px;
  border-radius: 10px;
  text-align: center;
  animation: toast-in 0.18s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Modal（wx.showModal 同款） ---------- */
#modal-layer {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 210;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

#modal-layer.is-on { display: flex; }

.modal {
  width: 300px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  animation: toast-in 0.18s ease;
}

.modal-t { padding: 26px 24px 0; text-align: center; font-size: 16px; font-weight: 600; }
.modal-c { padding: 12px 24px 24px; text-align: center; font-size: 14px; color: var(--muted); line-height: 1.6; }
.modal-btns { display: flex; border-top: 0.5px solid var(--line); }
.modal-btn { flex: 1; height: 46px; display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; }
.modal-btn:active { background: #f4f5f7; }
.modal-btn.main { color: var(--brand); font-weight: 600; border-left: 0.5px solid var(--line); }

/* ---------- ActionSheet（wx.showActionSheet 同款） ---------- */
#sheet-layer {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 210;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

#sheet-layer.is-on { display: flex; }

.sheet {
  width: 100%;
  max-width: 560px;
  background: #f4f5f7;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  animation: sheet-up 0.2s ease;
}

@keyframes sheet-up {
  from { transform: translateY(30%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-item {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 8px;
  text-align: center;
  padding: 15px;
  font-size: 16px;
  cursor: pointer;
}

.sheet-item:active { background: #f0f1f4; }
.sheet-cancel { font-weight: 500; margin-bottom: 0; }
