/*
 * 23-4.cn 战报 Tab 隔离样式
 * 2026-11-18
 *
 * 作用：
 *  1. #area 只显示当前 tab 的根组件；旧组件/额外卡片即使残留也不可见。
 *  2. 非“我的”tab 不显示全局注入的权益、等级、抽奖、开通线路、权限卡。
 *  3. 非聊天 tab 给固定底栏留出安全间距，避免最后一张卡被底栏盖住。
 *
 * 注意：选择器按当前 bundle 的根 class 写；未知根节点默认隐藏，
 * 这样新增 tab 组件不会把旧页面内容带出来。
 */
#area {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
}

#area > * {
  box-sizing: border-box;
}

/* 固定底栏后方必须是整块不透明背景。
   否则排行榜/聊天滚动内容会从半透明 tabbar 后面透出来，
   看起来就像“底部泄露了别的卡片”。
   注意：必须挂在 #tabbar 自己身上；挂 body 会盖住整个 app-shell，
   连 tabbar 本身都被遮掉。 */
#tabbar::before {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: -10px;
  bottom: -10px;
  background: var(--background, #f7fbff);
  z-index: -1;
  pointer-events: none;
}

html[data-theme="dark"] #tabbar::before {
  background: #0b1020;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) #tabbar::before {
    background: #0b1020;
  }
}

#tabbar {
  isolation: isolate;
}

/* 每个 tab 只允许自己的根组件 + 全局名片层 */
html[data-agh-tab="report"] #area > :not(.rpv):not(.aghvm):not(.aghpf-layer) {
  display: none !important;
}
html[data-agh-tab="rank"] #area > :not(.rankv2):not(.aghpf-layer) {
  display: none !important;
}
html[data-agh-tab="chat"] #area > :not(.chv):not(.aghpf-layer) {
  display: none !important;
}
html[data-agh-tab="fb"] #area > :not(.fbv):not(.aghpf-layer) {
  display: none !important;
}

/* “我的”本身有多个合法卡片；只排除其它 tab 的根组件 */
html[data-agh-tab="mine"] #area > .rpv,
html[data-agh-tab="mine"] #area > .rankv2,
html[data-agh-tab="mine"] #area > .chv,
html[data-agh-tab="mine"] #area > .fbv {
  display: none !important;
}

/* 全局脚本可能直接挂到 body 的权益/权限/抽奖/订阅卡：非“我的”全部收起 */
html:not([data-agh-tab="mine"]) body > .owp,
html:not([data-agh-tab="mine"]) body > .lvp,
html:not([data-agh-tab="mine"]) body > .ltp,
html:not([data-agh-tab="mine"]) body > .ipw,
html:not([data-agh-tab="mine"]) body > .subw,
html:not([data-agh-tab="mine"]) body > .acp,
html:not([data-agh-tab="mine"]) body > .gcp,
html:not([data-agh-tab="mine"]) body > .k-card,
html:not([data-agh-tab="mine"]) body > [class*="benefit"],
html:not([data-agh-tab="mine"]) body > [class*="invite-card"],
html:not([data-agh-tab="mine"]) body > [class*="lottery"],
html:not([data-agh-tab="mine"]) body > [class*="level"] {
  display: none !important;
}

/* 固定底栏留白：聊天视图自己有 foot，不加，避免把输入条顶出去 */
html:not([data-agh-tab="chat"]) .app-main {
  padding-bottom: calc(var(--tb-bar-h, 55px) + var(--tb-safe, 0px) + 18px);
}

/* 旧组件残留的绝对/固定层不允许盖住当前 tab */
html[data-agh-tab="rank"] #area > .aghpf-layer:not(.on),
html[data-agh-tab="chat"] #area > .aghpf-layer:not(.on),
html[data-agh-tab="fb"] #area > .aghpf-layer:not(.on),
html[data-agh-tab="report"] #area > .aghpf-layer:not(.on) {
  display: none !important;
}
