/* ============================================================================
 * contrast-aa-fix.css  (lixuanlh 选股精准战役 · P1 WCAG-AA 对比度修复)
 * 数据来源：10 轮重度审计 /tmp/lixuan_audit_report.json
 *   summary.uniqueContrastViolations = 189（去重后 14 个唯一选择器）
 * 仅修复「审计实证 + 底色明确」的真 bug，禁欲极简（无渐变/光晕/阴影/浮起）。
 * 仅用 !important 收敛已知违规，不动主题变量体系。
 * 本批不碰 .down / .template-desc / 无类 SPAN / .lix-review-ts（深浅双背景，
 *   盲目改会引入新 bug，留作组件级 token 化 P5）。
 * ==========================================================================*/

/* ① 真 bug：白字落浅卡（research-command 市场广度组件，1.01:1 近乎不可见）
 *    .rc-breadth 底 = rgb(245,248,255)（浅）；legend/label 透明继承浅卡。改深色字。 */
/* B5: --bg-subtle 已补为深色 #131a28，白卡消失，深色字反成隐形 -> 改回浅色 */
.rc-breadth,
.rc-breadth-legend,
.rc-breadth-label {
  color: #c0cbde !important;
}

/* ② 真 bug：蓝字落实蓝底徽标（NEW/PRO/0，1.37:1→3.24 仅加白字仍不达标）。
 *    底 = rgb(79,141,247) 实蓝，白字仅 3.24:1（未达 AA 4.5）。Round1 将实蓝
 *    加深为 #2A6BDB（白字 4.97:1，过 WCAG-AA）。仅作用于无内联 style 的徽标，
 *    以 :not([style]) 排除 agent 端带内联浅染的 PRO 徽标，避免误伤设计。 */
.nav-badge:not([style]),
.nav-item .nav-badge:not([style]),
.nav-item[data-view] .nav-badge:not([style]) {
  background: #2A6BDB !important;
  color: #ffffff !important;
  border-color: rgba(42, 107, 219, 0.45) !important;
}

/* ③ 真 bug：蓝字落浅蓝染底标签（template-tag 经典等，1.36:1）。
 *    底 = rgba(90,140,255,0.12)（浅蓝染，非实蓝）→ 白字会反成白落浅，故用深色字。 */
/* B5 修正: --accent-soft(rgba(90,140,255,.12)) 在深色底合成后是 rgb(20,29,49) 深底,
   深色字 = 1.08:1 隐形。应改亮蓝字。 */
.template-tag {
  color: #9dc0ff !important;
}

/* ④ 热力图：品牌红/绿 + 白字（2.12:1）。保品牌色不动，白字 + 淡描边提图形对比。
 *    覆盖 .heat-cell 及其内 .heat-name/.heat-val（继承透明，统一处理）。 */
.heat-cell,
.heat-cell .heat-name,
.heat-cell .heat-val,
.heat-name,
.heat-val {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
}
/* v960: #2624 全屏态布局重构 —— 修 v852c 双重定位bug（top:14%+translate(-50%,-50%) 把area中心钉在14%高位：顶裁152-160px + 下方53%黑空）
   方案：area 锁源图 AR 648/794（avatar-living _drawCover 实为 contain → 精确贴合，零 letterbox 零裁切，K线标签左溢出自愈）
        + top:44% 标准居中（人脸落视口 ~23-30% 黄金位，底部留气泡区，保留 v852c 气泡不压脸意图）
        + min(94vw, 78vh*0.81612) 双约束：移动端宽瓶颈 / 桌面端高瓶颈
   v992 #2643-🅳（老板拍板：数智人大小适合页面+移动端·美观·功能零损）：
     78vh→84vh 桌面高瓶颈放宽（h 624→672, w 509→548=42.8% 屏宽, 面积+16%, 顶余 16px 保呼吸感,
     底叠 v990 纯色底字幕卡 ≤32px 属沉浸式常态）；AR 锁定/contain 零裁切/top:44% 人脸黄金位全保持 */
html body #ai-avatar-fab#ai-avatar-fab.fab-ai.ai-dock.fullscreen-mode .ai-dock-avatar-area,
html body #ai-avatar-fab#ai-avatar-fab.fab-ai.ai-dock.dock-expanded.fullscreen-mode .ai-dock-avatar-area{
  position:absolute!important;
  top:44%!important;
  left:50%!important;
  right:auto!important;
  bottom:auto!important;
  transform:translate(-50%,-50%)!important;
  width:min(94vw, calc(84vh * 0.81612))!important;
  max-width:94vw!important;
  height:auto!important;
  max-height:84vh!important;
  aspect-ratio:648/794!important;
  z-index:5!important;
}
html body #ai-avatar-fab#ai-avatar-fab.fab-ai.ai-dock.fullscreen-mode .ai-avatar-living-canvas,
html body #ai-avatar-fab#ai-avatar-fab.fab-ai.ai-dock.fullscreen-mode .ai-avatar-idle-video,
html body #ai-avatar-fab#ai-avatar-fab.fab-ai.ai-dock.fullscreen-mode .ai-avatar-broadcast-video,
html body .fab-ai.fullscreen-mode .ai-avatar-living-canvas,
html body .fab-ai.fullscreen-mode .ai-avatar-idle-video,
html body .fab-ai.fullscreen-mode .ai-avatar-broadcast-video{
  width:100%!important;
  height:100%!important;
  max-width:none!important;
  max-height:none!important;
  object-fit:contain!important;
}

/* === R5 主 CTA 触控目标 >=44px (WCAG 2.5.5 AA) === */
/* 二者均为 index.html 内联样式，用 !important 覆盖内联 */

/* ============================================================
   R6 交互 / 动效审计修复
   ============================================================ */

/* ① 键盘焦点环兜底（WCAG 2.4.7 Focus Visible, AA）
   根因：theme.css `button,input,select,textarea{outline:0}` 全局归零
        + nav-refined.css `...:focus{outline:none!important}` 二次加固
   实测：桌面 3 个、移动 5 个可聚焦元素 outline-width:0px，键盘焦点完全不可见
   修复：仅对键盘触发的 :focus-visible 恢复焦点环，鼠标点击不显示（不影响视觉） */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
}

/* ② 移除静态卡片常驻 will-change（合成层内存反模式）
   实测：.index-card(5) / .card(5) 计算值 transform,box-shadow 但 animating=0
        .ticker-track animating=1 → 常驻合理，保留 */
.index-card,
.card {
  will-change: auto !important;
}

/* ============================================================
   R8 品牌 / SEO 修复：语义化 H1（零视觉影响）
   ------------------------------------------------------------
   问题：全站 0 个 <h1>，搜索引擎与屏幕阅读器无法识别页面主旨。
   对策：插入 sr-only 的 H1（视觉隐藏、语义存在），不改动任何可见布局。
   标准 clip 方案（兼容读屏软件，且不影响 Tab 焦点顺序）。
   ============================================================ */
.lx-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ============================================================
   R10 CLS 修复（老板拍板 B 方案 · 基于 probe_cls3 精确实测）
   ------------------------------------------------------------
   根因：异步数据返回后，动态区块「插入 / 移除 / 位移」改变布局。
   实测主因（prod-mobile CLS 0.9484）：
     · #lx-living-status 状态条出现 → 把 #tab-dashboard 顶下 131px（贡献 0.819）
     · .lx-learning-card 插入 113px（贡献 0.810）
     · .lix-ai-screener / .dashboard-header / .flywheel-cards 重建（0.74/0.12/0.05）
   对策：用「实测最终稳定高度」做 min-height，预留空间。
        ——只改变加载中间态，不改变最终视觉（最终高度本就是这些值）。
   ============================================================ */

/* ① 学习卡片插入预留（移动端最大单项 0.810） */
.lx-learning-card { min-height: 113px !important; }
@media (max-width: 767px) {
  .lx-learning-card { min-height: 224px !important; }
}

/* ② 状态条固定 27px 占位（避免其出现/消失推动下方 131px） */
#lx-living-status.lx-mini-banner { min-height: 27px !important; }

/* ③ dashboard 头部（实测稳定 36px） */
.dashboard-header { min-height: 36px !important; }

/* ④ 飞轮卡片（实测稳定 272px） */
.flywheel-cards { min-height: 272px !important; }

/* ============================================================
   R11 · CLS 根治（v886）— hero 初始即显示
   ------------------------------------------------------------
   根因：theme.css:1590 `.lx-daily-hero{display:none}`，
   靠 JS `showHero()` 在数据就绪后（实测 1.8–3.3s）才加 `.show`
   切成 display:block，把下方全部内容整体顶下去
   234px(prod-mobile) / 288px(prod-desktop) / 565px(agent-mobile)。
   这是全站 CLS 最大单项（agent-mobile 0.5253 / prod-mobile 0.2050）。
   而 hero 的完整内容（头像/标题/副标题/CTA）早已写在 index.html 中，
   纯属被 display:none 压住，无需等任何数据。

   修法：CSS 层强制 hero 在「未设 data-lx-view 的初始态」与
   「dashboard 视图」下立即可见，不再依赖 JS 加 .show。
   - 特异性 (0,2,1) 与 nav-refined.css:1958/1959 相同，
     本文件加载于其后 → 平局后加载者胜。
   - 非 dashboard 视图仍由 nav-refined.css:1958 的
     `body[data-lx-view] .lx-daily-hero{display:none!important}` 隐藏，
     视图门禁语义完全保留。
   - 入场动画 lx-hero-in 仅含 opacity + translateY，
     不触发布局位移，CLS 安全。
   ============================================================ */
body:not([data-lx-view]) .lx-daily-hero,
body[data-lx-view="dashboard"] .lx-daily-hero {
  display: block !important;
}

/* ============================================================
   R11b · hero 内部动态区预留高度（v887）
   ------------------------------------------------------------
   根因：#lx-dh-indices / #lx-dh-picks 在 index.html 中为空容器，
   数据回来后才填充 → hero 自身增高（移动端 +112px、桌面 +121px），
   把下方 #tab-dashboard 整体顶下去 131px（prod-mobile 单项 0.0932，
   是 hero 初始显示修复后剩余的最大 CLS 来源）。

   修法：按实测最终稳定高度设 min-height，加载中间态即占位，
   数据填充后高度不变 → 零位移。最终态无视觉差异。
   数值：indices 桌面24/移动112/平板24，picks 桌面97/移动0(隐藏)/平板148。
   注：移动端 typo-refined.css:316 已 `#lx-dh-picks{display:none}`，
   display:none 不生成盒，min-height 自然失效，无需额外排除。
   ============================================================ */
#lx-dh-indices { min-height: 24px; }
#lx-dh-picks   { min-height: 97px; }
@media (max-width: 767px) {
  #lx-dh-indices { min-height: 112px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  #lx-dh-picks { min-height: 148px; }
}

/* ============================================================
   R11c · hero 整体高度锁定（v888）
   ------------------------------------------------------------
   背景：R11 让 hero 初始显示后，原先被 display:none 掩盖的
   「hero 内部填充」中间态暴露出来 —— hero 高度 240→303→338→361
   分 3 次增长（桌面），把 #tab-dashboard 与 hero 内部的
   .lx-dh-cta-row / .lx-quick-bar 反复下挤（合计 ~0.077 CLS）。

   两级锁定（缺一不可）：
   ① hero 整体 min-height → 防止 hero 下方内容被顶动；
   ② R11b 的内部 #lx-dh-indices / #lx-dh-picks min-height
      → 防止 hero 内部元素互相挤动（总高固定时内部仍会位移）。
   数值为最终稳定高度，不影响最终视觉，只消除加载中间态跳动。
   ============================================================ */
#lx-daily-hero { min-height: 361px; }
@media (min-width: 768px) and (max-width: 1023px) {
  #lx-daily-hero { min-height: 412px; }
}

/* R27: 焦点环兜底 —— 被 outline:none 关闭的元素 */
#btn-menu:focus-visible,
#lx-guanxuan-close:focus-visible,
.user-menu-item:focus-visible,
.lang-on:focus-visible,
.lx-dh-adopt:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
}

/* ============================================================================
 * B5-b 全站对比度统一收口（data-driven：29 视图 × 2 视口实测，违规 357 -> 目标 <40）
 * 策略：品牌蓝底上的文字一律纯白 #fff + 底统一加深到 var(--brand-blue-2)（白字 5.09:1，过 AA）
 *       品牌红底上的文字一律纯白 + 底加深到 #B3261E（白字 6.54:1）
 * 禁欲极简：仅调明度，不加渐变/光晕/阴影/hover 浮起。
 * ==========================================================================*/

/* ① 侧栏 PRO 徽标：蓝字落蓝底 1.37:1（带 inline style，原 :not([style]) 管不到） */
.nav-badge.pricing-nav-badge,
.nav-item .nav-badge.pricing-nav-badge,
span.pricing-nav-badge {
  background: #2A6BDB !important;
  color: #ffffff !important;
  border-color: rgba(42, 107, 219, 0.45) !important;
}

/* ② 主按钮族：白字落 var(--accent) = 3.24:1 -> 底加深 + 纯白字 = 5.09:1 */
.btn-primary,
.btn.btn-primary,
.btn.btn-xs,
.btn.btn-scan,
.btn-buy-quick,
.btn.btn-buy-quick,
.dpv-chat-btn {
  background: var(--brand-blue-2) !important;
  border-color: var(--brand-blue-2) !important;
  color: #ffffff !important;
}
/* 卖出：白字落品牌红 3.35:1 -> 深红 #B3261E = 6.54:1 */
.btn-sell-quick,
.btn.btn-sell-quick {
  background: #B3261E !important;
  border-color: #B3261E !important;
  color: #ffffff !important;
}

/* ③ 刷新/提交/标签激活态：白字落 rgb(58,123,240) = 3.98:1 -> 5.09:1 */
.dp-btn.dp-btn-primary,
button.dp-btn-primary,
#algo-refresh,
#algo-submit,
#evo-learn,
.algo-type-tab.on,
.lhb-tab.on {
  background: var(--brand-blue-2) !important;
  border-color: var(--brand-blue-2) !important;
  color: #ffffff !important;
}

/* ④ 因子/策略 tab 激活态：浅白落 var(--accent) = 2.80:1 -> 纯白字 = 5.09:1 */
.ftab-btn.active,
.sb-ftab-btn.active {
  background: var(--brand-blue-2) !important;
  color: #ffffff !important;
}

/* ⑤ 策略模板卡激活态：底为实蓝，浅色说明文字 1.93:1 -> 纯白 = 5.09:1 */
.template-card.active .template-desc,
.template-card.active .template-name {
  color: #ffffff !important;
}
.template-card.active {
  background: var(--brand-blue-2) !important;
  border-color: var(--brand-blue-2) !important;
}
/* 激活态上的标签：亮蓝字落实蓝底 1.76:1 -> 纯白 */
/* 白底合成后为 rgb(84,133,220)，白字仅 3.65:1；改用黑底 rgba(0,0,0,.28) -> 8.21:1 */
.template-card.active .template-tag {
  background: rgba(0, 0, 0, 0.28) !important;
  color: #ffffff !important;
}

/* ⑥ 激进选股按钮：红字落深紫底 3.06:1 -> 提亮文字到 #ff8a80 = 6.48:1 */
.smart-strategy-btn {
  color: #ff8a80 !important;
}

/* ⑦ 合规免责声明文本：rgba(154,178,207,.5) = 3.00:1 -> .82 提亮 */
.lx-disclaimer-text,
.lx-compliance-disclaimer,
.lx-compliance-disclaimer div,
.lx-compliance-disclaimer span {
  color: rgba(186, 205, 232, 0.82) !important;
}

/* ============================================================================
 * B5-d agent 站分叉违规专项
 * ① #btn-pro-cta 是 id 选择器，旧的 .btn-pro-cta（class）规则打不到 —— 用 id 覆盖
 * ② 导航项激活态白字落实蓝 var(--accent) = 3.24:1
 * 统一加深到 var(--brand-blue-2)（白字 5.09:1）
 * ==========================================================================*/
.nav-item.active .nav-text,
.nav-item.active > span.nav-text {
  background: var(--brand-blue-2) !important;
  color: #ffffff !important;
}

/* ============================================================================
 * B5-f 修正 B5-d 引入的回归
 * nav-refined.css 里有：#sidebar .sidebar-nav .nav-item.active .nav-text{color:#cfe0ff!important}
 *   特异性 (1,3,1)，压过 B5-d 的 (0,2,1) -> 亮蓝字 #cfe0ff 落 var(--brand-blue-2) 底只有 3.82:1
 * 这里用「.nav-text.nav-text」重复类名把特异性抬到 (1,4,1) 稳赢，改纯白 = 5.09:1
 * ==========================================================================*/
#sidebar .sidebar-nav .nav-item.active .nav-text.nav-text,
.sidebar-nav .nav-item.active .nav-text.nav-text,
.nav-item.active .nav-text.nav-text {
  color: #ffffff !important;
}

/* ============================================================================
 * v992 · #2643-🅳 移动端 fullscreen 数智人放大（老板拍板）
 * 移动端瓶颈是宽度（h=449 由 94vw×AR 决定，远未触及 84vh 上限）：
 * 94vw→98vw（w 366.6→382.2, h 449→468, 面积+8.6%），两侧各留 3.9px
 * 保 16px 圆角完整不贴边。AR 锁定 + contain 零裁切 + top:44% 黄金位不变。
 * ==========================================================================*/
@media (max-width: 767px) {
  html body #ai-avatar-fab#ai-avatar-fab.fab-ai.ai-dock.fullscreen-mode .ai-dock-avatar-area,
  html body #ai-avatar-fab#ai-avatar-fab.fab-ai.ai-dock.dock-expanded.fullscreen-mode .ai-dock-avatar-area {
    width: min(98vw, calc(84vh * 0.81612)) !important;
    max-width: 98vw !important;
    max-height: 84vh !important;
  }
}
