/* ============================================================================
 * fab-unify.css — A-43 全站 FAB / 场景区（2026-10-14 · lane gap2）
 * 作用：把散在 4 个 JS + 2 段内联 <style> 里的 10 个「自由 z-index」收编成令牌档；
 *       并落地 A-43 的 FAB / 场景区位置与尺寸。
 * 唯一回退点：删掉 index.html 里指向本文件的那一行 <link>（本文件不改任何 JS / 不删任何 DOM）。
 * 依据：notes/项目资料/设计/20261014-FAB-场景区/移植影响清单.md（§1.2 为什么不逐文件改 · §1.3 覆盖项清单 18 项）
 * 本批不做（按该清单自己的分批）：
 *   · #4 / #15 / #16（#p4Coach 已停用件 · 归 P2，避免动到别的线在用的行）
 *   · #14 房间内隐藏 FAB（需登录进房间实测，单独一步）
 * ========================================================================== */

/* 只新增两档令牌；既有的 --z-base/--z-dropdown/--z-sticky/--z-modal/--z-toast
   沿用 pro-css/tokens.css:53-54 的现值（0/1000/1100/1200/1300），本文件不重定义、不改值。 */
:root {
  --z-fab: 900;    /* 常驻浮动按钮（客服 FAB / 沙箱 FAB） */
  --z-sheet: 950;  /* 场景区浮层（AI 助教小窗 / 沙箱面板） */
}

/* ---- 1. 常驻 FAB ---- */
/* ⚠️ :not(#a43) 是本站既有手法（同 site-unify.css 的 `.k.k.k` / `h2:not(#x)`）：
   站内有一条 `transition:all var(--dur-fast) !important` 的按钮总规则，
   它的选择器是 `button:not([class*=…]):not(…)…`（14 个 :not ⇒ 权重 0,14,1），
   普通 `html body .p4-fab`（0,1,2）即使带 !important 也压不过 ⇒ 用 :not(#…) 借一个 id 权重。
   实测证据：notes/项目资料/文档/批1-落地-20261014/_工具/_probe-transition.json（TRANS 10:12） */
html body .p4-fab:not(#a43) {
  z-index: var(--z-fab) !important;
  transition: background-color 160ms ease-out, transform 120ms ease-out !important;
}
html #sbFab {
  z-index: var(--z-fab) !important;
  background: #1D1D1F !important;
  transition: background-color 160ms ease-out, transform 120ms ease-out !important;
}

/* ---- 2. 场景区 ---- */
html body .p4-tutor {
  z-index: var(--z-sheet) !important;
  bottom: 138px !important;
  border-radius: 18px !important;
  max-height: calc(100vh - 200px) !important;
}
html body .p4-tutor .p4-tutor-body { padding: 24px !important; }
html #sbWrap { z-index: var(--z-sheet) !important; }
html #sbPanel {
  border-radius: 24px !important;
  width: min(660px, 94vw) !important;
}

/* ---- 3. 弹层：本就是 --z-modal(1200)，只写令牌引用，不改值 ---- */
html body .p4-resume-mask { z-index: var(--z-modal) !important; }
html body .p4-media-view { z-index: var(--z-modal) !important; }
html body .resource-modal { z-index: var(--z-modal); }
html body .float-panel-overlay { z-index: var(--z-modal); }

/* ---- 4. 吸顶与轻提示 ---- */
/* #clibBanner 的 z 写在创建时的内联 style.cssText（ui.201f4b01.js:335）⇒ 必须 !important */
#clibBanner { z-index: var(--z-sticky) !important; }
.v17-toast { z-index: var(--z-toast) !important; }        /* index.html:59 内联 <style> */
html #crToast, html .cr-toast { z-index: var(--z-toast) !important; }
html #mDesktopNotice { z-index: var(--z-toast) !important; }

/* ---- 5. 移动端：右缘 16 · 底 16 + 安全区 ---- */
@media (max-width: 640px) {
  html body .p4-fab { right: 16px !important; }
  html #sbFab {
    right: 16px !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
