/* ============================================================
   小度低配渲染层 · xd-lite（v20261102b）
   目标设备：小度智能屏（DuerOS，Chromium 85 左右，GPU 弱、内存小）
   作用分三块：
     1) 布局兜底：不再依赖 @supports 探测，只要带 .xd-lite 就强制补全
        inset 的四边定位，避免菜单容器塌陷成"一条窄栏"
     2) 低配渲染：关闭毛玻璃(backdrop-filter)、大模糊、无限动画、滤镜，
        并把大阴影换成单层小阴影，显著降低每帧合成/重绘成本
     3) 对比度：菜单标题改为"浅底深字"胶囊，避免白字压在浅色背景上看不清
   仅当 <html> 带 .xd-lite 生效（由 /shared/xd-lite.js 或大厅注入）。
   ============================================================ */

/* ---------- 1. 布局兜底：显式补齐四边定位 + 尺寸 ---------- */
html.xd-lite .page,
html.xd-lite .xd-mode,
html.xd-lite .result-layer,
html.xd-lite .rules-modal,
html.xd-lite .overlay,
html.xd-lite .modal-mask,
html.xd-lite .hotspot-layer,
html.xd-lite .piece-layer,
html.xd-lite .tiles-layer,
html.xd-lite .xd-overlay,
html.xd-lite .xdr-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}


/* ---------- 2. 低配渲染 ---------- */
html.xd-lite *,
html.xd-lite *::before,
html.xd-lite *::after {
    /* 毛玻璃是低端 GPU 的头号杀手：每帧都要重新采样背景 */
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    /* 无限动画（星空闪烁、星云漂浮、脉冲）会导致持续重绘 */
    animation: none !important;
    /* 大面积模糊/投影滤镜走 CPU，直接关掉 */
    filter: none !important;
    background-attachment: scroll !important;
}

html.xd-lite * {
    /* 只保留合成成本最低的属性过渡 */
    transition-property: transform, opacity !important;
    transition-duration: 0.12s !important;
    -webkit-tap-highlight-color: transparent;
}

/* 大面板/大卡片：把多层重阴影收敛成一层小阴影 */
html.xd-lite .app,
html.xd-lite .app-shell,
html.xd-lite .xd-mode-btn,
html.xd-lite .xd-pill,
html.xd-lite .game-card,
html.xd-lite .glass-panel,
html.xd-lite .xd-panel,
html.xd-lite .modal-shell,
html.xd-lite .modal,
html.xd-lite .big-button,
html.xd-lite .space-btn {
    box-shadow: 0 3px 10px rgba(18, 10, 40, 0.22) !important;
}

/* 弹窗遮罩：去掉模糊后加深底色，保证层次不掉 */
html.xd-lite .rules-modal,
html.xd-lite .result-layer,
html.xd-lite .overlay,
html.xd-lite .modal-mask,
html.xd-lite .xd-overlay,
html.xd-lite .xdr-overlay {
    background-color: rgba(12, 6, 30, 0.55);
}

/* 背景图不再随滚动重绘（部分页面用了 fixed） */
html.xd-lite body,
html.xd-lite .app,
html.xd-lite .app-shell {
    background-attachment: scroll !important;
}

/* ---------- 3. 对比度：菜单标题/提示不再与背景撞色 ---------- */
html.xd-lite .xd-mode-title {
    color: #3b2a72 !important;
    background: rgba(255, 255, 255, 0.94);
    padding: 0.12em 0.85em;
    border-radius: 999px;
    box-shadow: 0 3px 10px rgba(18, 10, 40, 0.22);
    text-shadow: none !important;
}

html.xd-lite .xd-mode-title .xd-mode-subtitle {
    color: #6a5a9c !important;
    text-shadow: none !important;
}

html.xd-lite .xd-mode-note {
    color: #ffffff !important;
    background: rgba(24, 12, 52, 0.62);
    padding: 0.16em 0.8em;
    border-radius: 999px;
    text-shadow: none !important;
}

/* 菜单按钮：实色底，避免半透明叠在花背景上导致文字发灰 */
html.xd-lite .xd-mode-btn {
    background: #ffffff !important;
}

html.xd-lite .xd-mode-btn.xd-mode-btn--secondary {
    background: #f4f8ff !important;
}

html.xd-lite .xd-mode-btn.xd-mode-btn--rules {
    background: #fff8ec !important;
}

html.xd-lite .xd-mode-btn-main {
    color: #3b2a72 !important;
}

html.xd-lite .xd-mode-btn-sub {
    color: #5f4f8e !important;
}

/* 菜单高度不足时允许内部滚动，避免底部按钮被裁掉 */
html.xd-lite .xd-mode {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- 4. 奖励/成长面板对比度（v20261102f） ----------
   面板里的浅灰字、白字配浅橙底在小度屏上几乎看不清，这里统一加深 */
html.xd-lite .xdr-panel {
    background: #ffffff !important;
}
html.xd-lite .xdr-head-sub,
html.xd-lite .xdr-sec-note,
html.xd-lite .xdr-cal-foot,
html.xd-lite .xdr-chest-need,
html.xd-lite .xdr-day-label,
html.xd-lite .xdr-mission-text,
html.xd-lite .xdr-cb-text {
    color: #4f3f7d !important;
}
html.xd-lite .xdr-day-reward {
    color: #5a2fbe !important;
}
html.xd-lite .xdr-day.xdr-done .xdr-day-reward,
html.xd-lite .xdr-day.xdr-grand.xdr-done .xdr-day-reward {
    color: #12603a !important;
}
html.xd-lite .xdr-day.xdr-miss .xdr-day-reward,
html.xd-lite .xdr-day.xdr-miss .xdr-day-label {
    color: #5f5488 !important;
}
html.xd-lite .xdr-day-flag {
    background: #a84700 !important;
    color: #ffffff !important;
}
html.xd-lite .xdr-mission-claim.xdr-go {
    background: #d0510c !important;
    color: #ffffff !important;
}
html.xd-lite .xdr-mission-claim.xdr-get {
    background: #5b2fd0 !important;
    color: #ffffff !important;
}
html.xd-lite .xdr-chest-state {
    background: #ded7f2 !important;
    color: #3f3168 !important;
}
html.xd-lite .xdr-chest.xdr-ready .xdr-chest-state {
    background: #d0510c !important;
    color: #ffffff !important;
}
html.xd-lite .xdr-chest-reward {
    color: #4b2ba8 !important;
}
html.xd-lite .xdr-toast {
    background: rgba(18, 8, 44, 0.96) !important;
}

/* ---------- 5. 渲染再降：小元素阴影与文字阴影（弱 GPU 上很贵） ---------- */
html.xd-lite .stone,
html.xd-lite .piece,
html.xd-lite .piece-sprite,
html.xd-lite .cell,
html.xd-lite .tile,
html.xd-lite .hero-cell,
html.xd-lite .gomoku-board,
html.xd-lite .sudoku-board,
html.xd-lite .chest,
html.xd-lite .hero-block::before,
html.xd-lite .hero-block::after {
    box-shadow: none !important;
}
html.xd-lite * {
    text-shadow: none !important;
}

/* 紫色头部区域保持白字（上面统一加深时误伤到了头部副标题） */
html.xd-lite .xdr-head .xdr-head-sub,
html.xd-lite .xdr-head .xdr-head-title,
html.xd-lite .xdr-head .xdr-chip,
html.xd-lite .xdr-head .xdr-xp-text {
    color: #ffffff !important;
}
/* 等级徽章是白底，里面保持深紫字 */
html.xd-lite .xdr-level-badge .xdr-lv-num,
html.xd-lite .xdr-level-badge small {
    color: #5b34c9 !important;
    opacity: 1 !important;
}
html.xd-lite .xdr-head .xdr-head-sub {
    color: rgba(255, 255, 255, 0.92) !important;
}
/* 大厅卡片标签：白字配更深的紫底 */
html.xd-lite .game-tag {
    background: #7a4fe0 !important;
    color: #ffffff !important;
}

/* ---------- 6. 任务/奖励页强制高对比（v20261102g） ----------
   任务页是"白玻璃面板 + 部分白字/透明底标签"的设计，
   在小度上（无毛玻璃、屏色偏冷）文字几乎融进背景，这里统一成白底深字。 */
html.xd-lite .tasks-header,
html.xd-lite .task-card,
html.xd-lite .page-band .glass-panel,
html.xd-lite .profile-banner,
html.xd-lite .section-title {
    background: #ffffff !important;
    color: #241a4d !important;
}

html.xd-lite .task-card h3,
html.xd-lite .task-card p,
html.xd-lite .task-card .status,
html.xd-lite .task-card .reward strong,
html.xd-lite .task-card .reward span,
html.xd-lite .task-card small,
html.xd-lite .tasks-header h1,
html.xd-lite .tasks-header p,
html.xd-lite .task-balance strong,
html.xd-lite .task-balance span {
    color: #241a4d !important;
}

html.xd-lite .task-card .status.complete {
    color: #0b6b45 !important;
}

html.xd-lite .filter-chip,
html.xd-lite .chip.filter-chip {
    color: #2f2460 !important;
    background: #efeaff !important;
    border-color: #cfc4f0 !important;
}

html.xd-lite .filter-chip.active {
    color: #ffffff !important;
    background: #4f37c8 !important;
    border-color: #4f37c8 !important;
}

html.xd-lite .task-card .progress-track {
    background: #ded4f6 !important;
}

html.xd-lite .task-card .progress-track span {
    background: #6a3df0 !important;
}

html.xd-lite .task-card .space-btn {
    background: #efeaff !important;
    color: #2f2460 !important;
    border-color: #cfc4f0 !important;
}

html.xd-lite .task-card .space-btn:disabled {
    background: #e7e2f6 !important;
    color: #4a3a7a !important;
    opacity: 1 !important;
}

html.xd-lite .task-card .space-btn:not(:disabled) {
    background: #4f37c8 !important;
    color: #ffffff !important;
}

/* ---------- 7. 五子棋棋子：纯 CSS 兜底（v20261102h） ----------
   .stone 是 grid item，宽度 82%、高度靠 aspect-ratio；
   老内核没有该属性时高度为 0，棋子"看不见"。
   这里用 padding-bottom 撑高，不依赖 JS 也能显示出圆形棋子。 */
html.xd-lite .stone {
    aspect-ratio: auto !important;
    height: 0;
    padding-bottom: 82%;
    box-sizing: content-box;
    min-height: 8px;
}

/* ---------- 8. "我的"页面强制高对比（v20261102k） ---------- */
html.xd-lite .profile-banner,
html.xd-lite .metric,
html.xd-lite .summary-card,
html.xd-lite .record-card,
html.xd-lite .section-title,
html.xd-lite .modal-shell,
html.xd-lite .xd-panel,
html.xd-lite .preview-copy,
html.xd-lite .avatar-option {
    background: #ffffff !important;
    color: #241a4d !important;
}

html.xd-lite .profile-banner h1,
html.xd-lite .profile-banner p,
html.xd-lite .level-text,
html.xd-lite .metric strong,
html.xd-lite .metric span,
html.xd-lite .summary-card strong,
html.xd-lite .summary-grid b,
html.xd-lite .summary-grid small,
html.xd-lite .record-card p,
html.xd-lite .record-card strong,
html.xd-lite .record-info span,
html.xd-lite .section-title h2,
html.xd-lite .section-title p,
html.xd-lite .avatar-option small,
html.xd-lite .hint,
html.xd-lite .muted {
    color: #241a4d !important;
}

html.xd-lite .summary-grid div,
html.xd-lite .record-info span {
    background: #f3efff !important;
    border-color: #d5cbf2 !important;
}

html.xd-lite .chip {
    background: #efeaff !important;
    color: #2f2460 !important;
    border-color: #cfc4f0 !important;
}

html.xd-lite .level-track {
    background: #ded4f6 !important;
}

html.xd-lite .profile-banner .space-btn,
html.xd-lite .actions .space-btn {
    background: #4f37c8 !important;
    color: #ffffff !important;
    border-color: #4f37c8 !important;
}

/* ---------- 9. 提升屏占比（v20261102l） ----------
   游戏舞台按 1460×980 设计，在 1024×600 屏上只能缩到 0.557，
   四周黑边大、界面偏小。这里把舞台高度压到 56rem（≈855~900px），
   缩放提升到 ~0.67，整体 UI 与棋盘放大约 15%，且宽度几乎填满。 */
html.xd-lite {
    --stage-height: 56rem;
}

/* 棋子/落点按钮尺寸兜底：calc(百分比×数÷数) 在老内核可能解析失败，
   解析失败会导致宽度为 0，棋子完全不可见。这里给出等值百分比。 */
html.xd-lite .piece-sprite,
html.xd-lite .point-hotspot {
    width: 6.5304% !important;
    height: 6.5304% !important;
}

/* ---------- 10. 进一步放大棋盘与控制面板（v20261102m） ----------
   棋盘高度受"页面内边距"挤压（上方 88px 是给返回按钮留白），
   收紧后棋盘可直接多出约 8% 高度；控制面板字号同步放大，按钮更好点。 */
html.xd-lite .page:not(.xd-mode) {
    padding: 52px 16px 14px !important;
}

html.xd-lite .game-layout {
    gap: 10px;
}

html.xd-lite .control-panel {
    font-size: 1.14rem;
}

html.xd-lite .control-panel .space-btn,
html.xd-lite .control-panel .tool-button,
html.xd-lite .control-panel button {
    min-height: 2.9em;
    font-size: 1.02em;
}
