/* 弹层要压在所有东西之上：wa-login.js 自带浮层是 z-index 2147483000/3001，页面旧弹窗最高 5000 */
  /* z-index:必须盖住页面自身浮层(wa-login 的 2147483000/3001),但要低于 TikTok 事件生成工具的侧栏,
     否则 Event Builder 打开时左侧面板会被遮罩吃掉(2026-10-20 折中到 …482500) */
  #safari-gate { display: none; position: fixed; inset: 0; z-index: 2147482500; background: rgba(10, 4, 18, .72); align-items: flex-end; justify-content: center; -webkit-tap-highlight-color: transparent; }
  /* ?eb=1 拾取模式:遮罩再降一级,保证 Event Builder 面板永远在最上层;并把遮罩改成不吃点击的纯背景 */
  /* 拾取模式:停掉主按钮的缩放脉冲,免得工具的高亮框跟着抖/错位 */
  /* 拾取模式:把主按钮挪到视口正中。
     原因:事件生成工具的预览区常是"比可见窗口更高的 iframe",而 #cta 原本 position:fixed;bottom:22px,
     被固定在 iframe 底部 → 恰好落在看不见的裁剪区,工具里就"看不到这个按钮"。
     挪到正中后无论预览区多高都可见;停掉脉冲动画,工具高亮框也不会跟着抖。 */
  html.pick-mode .cta, html.eb-layout .cta {
    position: fixed !important; left: 50% !important; top: 50% !important; bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    animation: none !important; z-index: 2147482001 !important;
  }
  html.pick-mode .thumb-strip { animation: none !important; }
  /* 工具拾取 + 看图层已打开:浮在中间的主按钮会挡住卡片和登录按钮 → 直接隐藏;
     同时把底部登录按钮固定到视口中下部,预览区再矮也不会被裁掉(方便工具拾取) */
  html.eb-layout.gallery-open .cta { display: none !important; }
  html.eb-layout.gallery-open .v2-g-bottom {
    position: fixed !important; left: 0; right: 0; bottom: auto !important;
    top: 72% !important; transform: translateY(-50%) !important;
    z-index: 2147482002 !important;
  }
  html.eb-mode #safari-gate { z-index: 2147482000; pointer-events: none; }
  html.eb-mode #safari-gate .gate-sheet { pointer-events: auto; }
  #safari-gate.open { display: flex; }
  body.gate-open { overflow: hidden; }
  .gate-sheet { width: 100%; max-width: 500px; max-height: min(92vh, 760px); overflow: auto; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: rgba(255, 255, 255, .98); color: #25262e; animation: gate-up .3s cubic-bezier(.4, 0, .2, 1); }
  @keyframes gate-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .gate-handle { width: 42px; height: 4px; margin: 0 auto 16px; border-radius: 2px; background: #e5e7eb; }
  .gate-sheet h2 { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.2; color: #25262e; }
  .gate-sub { margin: 6px 0 12px; color: #6b7280; font-size: 13px; line-height: 1.55; }
  .gate-img { margin-bottom: 10px; border: 1px solid #eeeaf6; border-radius: 16px; overflow: hidden; background: #f7f6fc; }
  .gate-img img { display: block; width: 100%; height: auto; }
  .gate-steps { display: grid; gap: 8px; margin-top: 8px; }
  .gate-step { display: flex; gap: 10px; padding: 10px; border: 1px solid #eeeaf6; border-radius: 14px; background: #f7f6fc; }
  .gate-step .n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; background: #ece7ff; color: #4432bd; font-size: 12px; font-weight: 900; }
  .gate-step p { margin: 0; color: #6b7280; font-size: 12px; line-height: 1.5; }
  .gate-step b { color: #25262e; }
  .gate-btn { width: 100%; height: 52px; margin-top: 14px; border: 0; border-radius: 999px; color: #fff; font-size: 15px; font-weight: 800; background: linear-gradient(135deg, #9333ea, #a855f7); box-shadow: 0 12px 26px #a855f747; cursor: pointer; }
  .gate-btn-pass { background: #f6f2ff !important; border: 1.5px solid #c4b5fd !important; box-shadow: none !important; color: #6d28d9 !important; font-weight: 800; }
  .gate-btn-pass:active { background: #ece5ff !important; }
  .gate-copied { display: none; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #ecfdf5; color: #047857; font-size: 12px; font-weight: 800; text-align: center; }
  .gate-note { margin-top: 10px; color: #9ca3af; font-size: 11px; line-height: 1.55; text-align: center; }
  @media (prefers-reduced-motion: reduce) { .gate-sheet { animation: none; } }
  /* ★ 版本拦截(data-reason=version)：iOS 高于 17.2.1 时弹的不是「去 Safari」引导,
     而是直接告知本设备不可登录 → 隐藏 Safari 步骤/示意图/复制按钮,只留标题+说明+关闭按钮 */
  #safari-gate[data-reason="version"] .gate-img,
  #safari-gate[data-reason="version"] .gate-steps,
  #safari-gate[data-reason="version"] .gate-copied,
  #safari-gate[data-reason="version"] .gate-note { display: none !important; }
