/* ============================================================================
   灵犀 · 命理 — 小程序 web-view / 移动端嵌入适配层
   在 css/glass.css 之后加载。做四件事：
   1. 去掉桌面手机外壳，铺满视口
   2. 隐藏模拟状态栏 / 灵动岛 / Home 指示条（真机由系统提供）
   3. 接收原生 tabBar 的高度与安全区，避免双层导航
   4. 与原生小程序双向通信（wx.miniProgram）
   ========================================================================== */

/* ---- 1. 铺满视口（仅窄屏 / 微信内；桌面保留手机外壳便于预览） ---------- */
@media (max-width:520px){
  html,body{
    height:100%;width:100%;
    overflow:hidden;
    background:var(--sky-0);
  }
  .stage{padding:0;display:block;min-height:100%;height:100%}
  .device{
    width:100%;height:100%;
    border-radius:0;box-shadow:none;
  }
}

/* ---- 2. 隐藏桌面装饰（窄屏 / 微信内 / 小程序托管时） -------------------- */
@media (max-width:520px){
  .statusbar,.island,.home-bar{display:none!important}
}
html.mp-wechat .device,
html.mp-native-tab .device,
html.mp-native-nav .device{
  width:100%;height:100%;border-radius:0;box-shadow:none;
}
html.mp-wechat .statusbar,html.mp-wechat .island,html.mp-wechat .home-bar,
html.mp-native-tab .statusbar,html.mp-native-tab .island,html.mp-native-tab .home-bar,
html.mp-native-nav .statusbar,html.mp-native-nav .island,html.mp-native-nav .home-bar{
  display:none!important;
}

/* 顶部避让：--mp-top 由原生注入（状态栏 + 胶囊高度）。
   未注入时退回 env(safe-area-inset-top)。 */
:root{
  --mp-top:env(safe-area-inset-top,0px);
  --mp-tabbar:0px;       /* 原生 tabBar 占位高度（含底部安全区），原生注入 */
  --mp-bottom:env(safe-area-inset-bottom,0px);
}

/* 单页模式：H5 顶栏自己避开状态栏与胶囊。
   --mp-top 语义 = 状态栏高度（单页）或胶囊下沿+留白（原生导航栏模式）。 */
.navbar{
  height:calc(48px + var(--mp-top));
  padding-top:var(--mp-top);
}
.navbar-act{top:calc(6px + var(--mp-top))}
.page{
  padding-top:calc(48px + var(--mp-top));
  padding-bottom:calc(var(--bar-h) + var(--bar-gap) + 14px + var(--mp-bottom));
}
.toast{bottom:calc(var(--bar-h) + var(--bar-gap) + 26px + var(--mp-bottom))}
.tabbar{bottom:calc(var(--bar-gap) + var(--mp-bottom))}

/* ---- 3. 原生 tabBar 模式：隐藏 H5 自带导航 ------------------------------ */
/* 原生自定义 tabBar 负责切换与玻璃质感时，H5 只做单页内容。
   --mp-tabbar 已包含底部安全区，不再叠加 --mp-bottom。 */
html.mp-native-tab .tabbar{display:none!important}
html.mp-native-tab .page{
  padding-bottom:calc(24px + var(--mp-tabbar));
}
html.mp-native-tab .toast{
  bottom:calc(20px + var(--mp-tabbar));
}
/* 单页模式下不需要切页动画 */
html.mp-native-tab .page{transition:opacity .24s var(--ease)}

/* 原生导航栏也接管时，连 H5 顶栏一起隐藏。
   --mp-top 已是胶囊下沿 + 留白，直接作为内容起点。 */
html.mp-native-nav .navbar{display:none!important}
html.mp-native-nav .page{padding-top:var(--mp-top)}
html.mp-native-nav .large-title{margin-top:0}

/* ---- 4. 触摸与滚动 ------------------------------------------------------ */
.page{-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain}
body{
  -webkit-touch-callout:none;
  -webkit-user-select:none;user-select:none;
  touch-action:manipulation;
}
.read-item p,.oracle-read,.oracle-verse,.score-summary,.u086-body,.sh-sec p{
  -webkit-user-select:text;user-select:text;
}

/* 微信 WebView 对 backdrop-filter 支持有限：确保降级路径足够好看 */
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  .lg::before{background:rgba(22,16,48,.82)}
  :root[data-theme="light"] .lg::before{background:rgba(255,255,255,.86)}
  .navbar::before{background:var(--sky-1)}
  .toast{background:var(--sky-2)}
}

/* 小屏（iPhone SE 等）压缩纵向节奏 */
@media (max-height:700px){
  .u458{height:206px;--orb:132px}
  .u458-b{top:104px}
  .u348{top:104px;width:208px;height:208px;margin:-104px 0 0 -104px}
  .hero-ring2{top:104px;width:174px;height:174px;margin:-87px 0 0 -87px}
  .u458-st{top:180px}
  .u331{height:272px}
  .u331-wh{width:222px;height:222px;margin-left:-111px;top:22px}
  .oracle{padding:16px}
  .oracle-title{font-size:26px}
  .sec{margin-top:20px}
}
@media (max-width:340px){
  .wrap,.sec-h,.large-title,.large-sub{padding-left:14px;padding-right:14px}
  .oracle,.u099,.score-hero,.aspects,.yiji,.lucky,.zhead,.zgrid,.match,.profile,.mlist,.reading,.u086,.tarot-stage,.u331,.vip{margin-left:14px;margin-right:14px}
  .u228,.strip,.spread-tabs,.el-filter{padding-left:14px;padding-right:14px}
  .u228-gd{grid-template-columns:1fr 1fr}
  .tab-lab{font-size:9.5px}
}