/* ═══════════════════════════════════════════════════════════════════════
   树智云 PWA 支撑样式（2026-10-25）
   职责：①禁双击缩放 ②iOS 安全区适配（仅 standalone 模式生效）
        ③PWA 引导条 / 断网提示条的样式
   配套脚本：assets/js/pwa.js（负责判断设备、注入提示条、加 sz-pwa 类）
   ═══════════════════════════════════════════════════════════════════════ */

/* ── ① 禁止双击缩放（触屏授课时手快双击不会把页面放大）──
   manipulation = 保留滚动、拖拽、双指捏合，只禁掉"双击放大"。
   不影响 board_mode.js 的拖拽分组（拖拽走 touchmove 事件，不在限制范围）。 */
html { touch-action: manipulation; }

/* ── ② iOS 安全区（刘海 / 底部手势条）────────────────────────────
   前提：viewport 必须带 viewport-fit=cover（pwa.js 会在需要的页面补上）。
   只在 .sz-pwa（= 已从主屏幕图标以独立窗口打开）时才让内容延伸进
   状态栏区域并留出安全边距；普通浏览器里页面不受影响。
   注意 .app-top 是 sticky 顶栏，补 padding-top 让它自己"长高"避让刘海；
   .mnav 底栏的 safe-area 已在 layout.php 内联样式里做过，这里不重复。 */
.sz-pwa .app-top {
  padding-top: env(safe-area-inset-top, 0px);
}
.sz-pwa .login-body {
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* ── ③ 提示条（引导安装 / 断网 / 恢复，均由 pwa.js 动态创建）────────
   fixed 顶部细条，z-index 940：低于弹窗(1000+)不抢层级，
   高于页面内容；有内容时只占一条高度，不遮挡授课操作按钮。 */
.sz-pwa-tip {
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 940;
  display: none;                       /* 默认隐藏，加 .show 才出现 */
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: #2e7d32;
  color: #fff;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: 0 2px 10px rgba(20,40,30,.22);
  text-align: left;
}
.sz-pwa-tip.show { display: flex; }
.sz-pwa-tip .sz-pt-txt { flex: 1; min-width: 0; }
.sz-pwa-tip b { font-weight: 600; }

/* 动作按钮（安卓"安装"用） */
.sz-pwa-tip .sz-pt-btn {
  appearance: none;
  border: 0;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 36px;                    /* 触屏手指友好 */
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sz-pwa-tip .sz-pt-btn:active { background: rgba(255,255,255,.3); }

/* 关闭按钮 × */
.sz-pwa-tip .sz-pt-x {
  appearance: none;
  border: 0;
  background: none;
  color: rgba(255,255,255,.85);
  font-size: 17px;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 断网提示：琥珀色；恢复：绿色（短显即隐） */
.sz-pwa-tip.sz-net-off { background: #b26a00; }
.sz-pwa-tip.sz-net-on  { background: #1b5e20; }

/* ── ④ 运行期异常提示（compat.js 创建，仅 PWA 独立窗口 / APP 壳出现一次）──
   位置固定在底部，避开顶部提示条与底部导航；层级低于弹窗，可关闭。 */
.sz-compat-tip {
  position: fixed;
  left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  z-index: 930;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: #fff8e1;
  border: 1px solid #f0d48a;
  border-radius: 10px;
  color: #7a5200;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.sz-compat-tip span { flex: 1; min-width: 0; }
.sz-compat-tip button {
  appearance: none; border: 0; background: #b26a00; color: #fff;
  font-family: inherit; font-size: 13px; border-radius: 999px;
  padding: 7px 14px; min-height: 34px; cursor: pointer; white-space: nowrap;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sz-compat-tip button + button {
  background: none; color: #8a6d3b; min-width: 34px; padding: 7px 6px; font-size: 16px;
}
