/* ============================================================================
   act.deyci.com 移动端增强层 v2 —— 2026-10-31
   ----------------------------------------------------------------------------
   v1 → v2 变更（按用户反馈）：
     ✗ 撤掉底部居中「菜单 / 首页」双胶囊（挡在内容中间、不舒服）
     ✓ 恢复站点原本的左上角悬浮汉堡（原样，一行未改）
     ✓ 「回小程序首页」改为抽屉里的一项 + 页脚链接，零浮层遮挡
   其余适配项（1–7）沿用 v1，保持不变。

   定位：纯叠加层。不改动 index.html 的原样式表，回滚只需删掉这一个 <link>。
   引入位置：在 mobile.minimal.css 之后（同特异性靠后加载取胜）。
   断点：820（平板/小窗）/ 640（手机，与站点抽屉断点重合）

   改了什么（对应 checklist P0/P1）：
     1. .pg 100vh → 100dvh          —— iOS 地址栏伸缩不再裁掉底部
     2. 字号令牌窄屏抬一档           —— 原 --f-2xs 10.5px / --f-xs 11.5px 手机上偏小
     3. 触控热区 ≥44px（行内小按钮 36px）
     4. .fp-grid 四列数字墙 → 两列
     5. 横向卡片条加 scroll-snap + 不触发 iOS 返回手势
     6. 白底数据弹窗（#lvMask / #cvMask）改底部抽屉、内表横滚
     7. .roster 报名名单卡化（4 列：勾选 / 签到码 / 填写内容 / 状态）
     8. 抽屉「回小程序首页」项 + 页脚「回首页」链接的样式
   ========================================================================== */

/* ---------- 与视口无关的基础项 ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* 去掉 iOS 双击缩放判定带来的 300ms 点击延迟（横滑容器另设 pan-x） */
button, .btn, a[onclick], [onclick] { touch-action: manipulation; }

@media (max-width: 820px) {
  /* 1. dvh 回落：先写 vh 兜底老浏览器，能识别 dvh 的用 dvh */
  .pg { min-height: 100vh; min-height: 100dvh; }

  /* 2. 字号令牌：整站变量单一真相源，改一处全站生效 */
  :root {
    --f-2xs: 11.5px;
    --f-xs: 12.5px;
    --f-sm: 13.5px;
    --f-md: 14.5px;
    --f-base: 15px;
  }

  /* 3. 触控热区 */
  .btn { min-height: 44px; padding: 12px 18px; }
  .btn.sm { min-height: 36px; padding: 8px 14px; }
  .back { min-height: 36px; align-items: center; }
  /* 注意：.nav-drawer a 的原规则写在 body 内的 <style> 里（晚于本文件加载），
     同特异性下 display 会被它赢回去，所以这里加 !important。 */
  .nav-drawer a { min-height: 44px; display: flex !important; align-items: center; }

  /* 4. 四列数字墙 → 两列（四列时每格仅 ~85px，数字会被压成两行） */
  .fp-grid { grid-template-columns: repeat(2, 1fr); }

  /* 5. 横向卡片条：吸附 + 不把横滑手势冒泡成页面返回 */
  .recrow {
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .recrow::-webkit-scrollbar { display: none; }
  .reccard { scroll-snap-align: start; }

  /* 6. 白底数据弹窗（观看明细 / 课时数据）：居中卡片 → 底部抽屉 + 内表横滚。
        这两处的宽高写在元素内联 style 上，必须 !important 才能顶掉。 */
  #lvMask, #cvMask { align-items: flex-end !important; padding: 0 !important; }
  #lvMask > div, #cvMask > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88dvh !important;
    border-radius: 16px 16px 0 0 !important;
  }
  #lvMask table, #cvMask table { min-width: 520px; font-size: 14px; }
  #lvMask td, #lvMask th, #cvMask td, #cvMask th { white-space: nowrap; }
}

@media (max-width: 640px) {
  /* 7. 报名名单卡化：4 列表格在 390 下会把「填写内容」挤成竖排。
        隐藏表头，每行变一张卡片，用 nth-child 补字段名（表格是 JS 生成的，
        没有 data-label，只能用位置选择器）。第 1 列是审核勾选框，保留在卡片顶部。 */
  .roster thead { display: none; }
  .roster, .roster tbody, .roster tr, .roster td { display: block; width: 100%; }
  .roster tr {
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, .18);
  }
  .roster td {
    border: none;
    padding: 5px 0;
    display: flex;
    gap: 10px;
    align-items: flex-start;
  }
  .roster td::before {
    flex: 0 0 64px;
    color: var(--fade);
    font-size: var(--f-xs);
    line-height: 1.7;
  }
  .roster td:nth-child(2)::before { content: "签到码"; }
  .roster td:nth-child(3)::before { content: "填写内容"; }
  .roster td:nth-child(4)::before { content: "状态"; }
  .roster td:nth-child(3) { overflow-wrap: anywhere; }

  /* 8. 「回小程序首页」出口（由 mobile.act.js 注入 DOM）——
        放在抽屉列表末尾，作为「离开本站」的独立出口，不与页面导航混在一起 */
  .nav-drawer .nd-exit {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 11px 12px;
    border-top: 1px solid #26284a;
    color: #7dd3fc;
    font-size: 14px;
    cursor: pointer;
  }
  .nav-drawer .nd-exit:active { background: #1f2142; }
  /* 页脚出口：低干扰，不抢主流程 */
  .ft .ft-home {
    color: var(--cyan);
    text-decoration: none;
    margin-left: 8px;
    white-space: nowrap;
  }
}
