/* ============================================================
   小度大厅兼容层（v20261102a）
   目的：小度智能屏的 WebView 多为 Chromium 67~78 内核，
   不支持 aspect-ratio(88+) / inset(87+) / min()·max()(79+) /
   env() 安全区(69+)。缺失时会出现：
     · 游戏卡片高度塌陷 → 大厅“游戏入口”下方一片空白（显示不全）
     · 弹窗遮罩、返回/签到悬浮球定位错位或跑到屏幕外
   本文件在编译包 CSS 之后加载，仅做等价兜底，不改变新版内核的最终样式：
   同一规则内先写老写法，再写新写法，老内核丢弃新写法即自动降级。
   ============================================================ */

/* ---------- 1. 基础：禁止小度内核自动放大文字 ---------- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ---------- 2. 顶栏 / 布局宽度（min() 缺失时的兜底） ---------- */
.app-header {
    top: 0;
    right: 0;
    left: 0;
}
.header-inner {
    max-width: 92rem;
}
.home-page {
    max-width: 90rem;
}
.grid-viewport {
    width: 100%;
}
.game-grid {
    width: 100%;
    max-width: 68rem;
}
.bottom-nav {
    width: 100%;
    max-width: 45rem;
}
.level-track {
    width: 100%;
    max-width: 18rem;
}

/* ---------- 3. 游戏卡片：不依赖 aspect-ratio 的 1:1 尺寸 ---------- */
/* 新版内核的 aspect-ratio 在 Chromium 88+ 才支持，小度内核普遍更低，
   缺失时卡片高度会塌陷成 0（大厅“游戏入口”整块变空白）。
   卡片内所有内容都是绝对定位，这里改用 padding-bottom 撑高，
   与 1:1 完全等价；.56rem = 上、下边框各 .28rem。 */
.home-page .game-card {
    aspect-ratio: auto;
    height: 0;
    padding-bottom: calc(100% - 0.56rem);
}

/* 卡片玻璃高光层：inset 缺失时逐边兜底 */
.home-page .game-card:before {
    top: 0.32rem;
    right: 0.32rem;
    bottom: 0.32rem;
    left: 0.32rem;
}

/* ---------- 4. 弹窗 / 背景层 / 游戏 iframe：inset 缺失时逐边兜底 ---------- */
.modal-mask,
.space-backdrop,
.image-layer,
.game-host-page,
.game-frame,
.game-missing {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}
.modal-shell {
    max-height: 90vh;
    max-height: min(90vh, 47.5rem);
}

/* ---------- 5. 留存模块：遮罩、悬浮球、Toast、面板 ---------- */
.xdr-overlay {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}
.xdr-fab {
    right: 1rem;
    right: calc(env(safe-area-inset-right, 0rem) + 1rem);
}
.xdr-toasts {
    top: 1rem;
    top: calc(env(safe-area-inset-top, 0rem) + 1rem);
}
.xdr-panel {
    width: 94vw;
    max-width: 46rem;
    max-height: 88vh;
    width: min(46rem, 94vw);
    max-height: min(88vh, 46rem);
}

/* ---------- 底部导航：任务入口统一到右上角"太空任务"，底部只留 2 项（2026-11-02） ---------- */
.bottom-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
.bottom-nav > .nav-item:nth-child(2) {
    display: none !important;
}
