/* =====================================================================
   爆更兔 · SPA 工作台移动端适配（手机/竖屏平板，<=899px）
   桌面结构：固定满屏 _shell/_body + 左/右 transform 抽屉 + 自定义绝对滚动视口
   移动目标：全部解除固定高度与位移 → 单栏纵向、页面整体滚动、无裁切
   ===================================================================== */

/* === 1. 等宽卡片/统计网格：窄屏降为自适应，最多两列，防止压扁 === */
@media (max-width: 899px){
[class*="_spendLadder_"],
[class*="_categoryGrid_"],
[class*="_vipWarehouseGrid_"],
[class*="_fontGrid_"],
[class*="_coinStats_"],
[class*="_referralRulesGrid_"],
[class*="_referralStats_"],
[class*="_skeletonGrid_"],
[class*="_heroStage_"],
[class*="_channelRow_"],
[class*="_summary_"],
[class*="_stats_"],
[class*="_ruleStrip_"],
[class*="_engineGrid_"],
[class*="_threeCol_"]{
  grid-template-columns: repeat(auto-fit, minmax(min(100%,150px),1fr)) !important;
  gap:10px !important;
}}

/* === 2. 顶部「生成」工具条 swx：允许横排换行，不裁切 === */
@media (max-width: 899px){
  .swx-toolbar{
    display:flex !important; flex-wrap:wrap !important; flex-direction:row !important;
    width:100% !important; max-width:100% !important; gap:8px !important;
  }
  .swx-toolbar > button,
  .swx-toolbar > a{ flex:0 0 auto !important; white-space:nowrap !important; }
}

/* === 3. 工作台外壳 _shell/_body：解除固定高度，纵向自然流 === */
@media (max-width: 899px){
  [class*="_shell_1oklx"],
  [class*="_uiLayer_1oklx"]{
    position:static !important;
    inset:auto !important;
    height:auto !important;
    min-height:0 !important;
    overflow:visible !important;
  }
  [class*="_body_1oklx"]{
    display:flex !important;
    flex:0 0 auto !important;
    flex-direction:column !important;
    flex-wrap:nowrap !important;
    height:auto !important;
    min-height:0 !important;
    overflow:visible !important;
  }
  /* 外层左抽屉（搜索 / 导航）：手机端隐藏（主导航用汉堡） */
  [class*="_leftColumn_1oklx"]{ display:none !important; }

  /* 主列：全宽、自然高 */
  [class*="_mainColumn_1oklx"]{
    width:100% !important;
    flex:0 0 auto !important;
    height:auto !important;
    min-width:0 !important;
    overflow:visible !important;
    margin:0 !important;
  }

  /* 顶部条 _bar：桌面固定 px 多列 grid → 单列纵向，按钮不竖排彩条 */
  [class*="_bar_1155g"]{
    grid-template-columns:1fr !important;
    grid-auto-flow:row !important;
    width:100% !important;
    gap:10px !important;
  }
  [class*="_bar_1155g"] > *{ width:100% !important; min-width:0 !important; }
  [class*="_leftGroup_"]{ width:100% !important; display:flex !important; flex-wrap:wrap !important; gap:8px !important; }
  [class*="_leftGroup_"] button{ flex:0 0 auto !important; white-space:nowrap !important; }

  /* _bar 右侧按钮组（缩放 / 保存草稿 / AI续写 / AI润色）：全宽横排换行 */
  [class*="_rightGroup_"]{
    width:100% !important; display:flex !important; flex-wrap:wrap !important; gap:8px !important;
  }
  [class*="_rightGroup_"] button{
    flex:1 1 auto !important; min-width:92px !important; width:auto !important; white-space:nowrap !important;
  }

  /* === 4. 自定义滚动视口链：解除绝对定位/固定高度/裁切，全部自然流动 === */
  [class*="_contentRow_1oklx"]{
    height:auto !important; flex:0 0 auto !important; overflow:visible !important;
  }
  [class*="_viewport_u1pex"]{
    position:static !important;
    height:auto !important; width:100% !important;
    overflow:visible !important;
  }
  [class*="_inner_u1pex"],
  [class*="_pageWrap_u1pex"]{
    height:auto !important; width:100% !important; transform:none !important;
  }

  /* === 5. 核心三栏写作台 _editor：纵向堆叠 === */
  [class*="_editor_1lylm"]{
    display:flex !important; flex-direction:column !important;
    width:100% !important; height:auto !important; min-width:0 !important;
  }
  /* 编辑器富文本工具条：按钮横排、可换行，不被挤窄竖排 */
  [class*="_toolbar_1lylm"]{ display:flex !important; flex-wrap:wrap !important; width:100% !important; }
  [class*="_toolBtn_1lylm"]{
    flex:0 0 auto !important; min-width:64px !important; height:auto !important;
    white-space:nowrap !important; writing-mode:horizontal-tb !important;
  }
  [class*="_leftSidebar_1lylm"]{ display:none !important; }
  [class*="_mainArea_1lylm"]{
    width:100% !important; flex:0 0 auto !important; min-width:0 !important;
  }
  [class*="_rightPanel_1lylm"]{
    width:100% !important; flex:0 0 auto !important;
    position:static !important; height:auto !important; margin:0 !important;
  }
  [class*="_panelSection_1lylm"],
  [class*="_panelTitle_1lylm"],
  [class*="_panelText_1lylm"]{ max-width:100% !important; box-sizing:border-box !important; }

  /* 正文输入：全宽、16px 防 iOS 聚焦自动缩放 */
  [class*="_mainArea_1lylm"] textarea,
  [class*="_mainArea_1lylm"] [contenteditable]{
    width:100% !important; max-width:100% !important; box-sizing:border-box !important; font-size:16px !important;
  }

  /* === 6. 外层右抽屉（生成/设置 _panel_g4kff）：清位移，常驻正文下方 === */
  [class*="_rightColumn_1oklx"]{
    transform:none !important;
    position:static !important;
    width:100% !important; max-width:100% !important;
    flex:0 0 auto !important;
    height:auto !important; overflow:visible !important;
    margin:0 !important; padding:0 !important;
    opacity:1 !important; visibility:visible !important; pointer-events:auto !important;
  }
  [class*="_panel_g4kff"]{ width:100% !important; height:auto !important; max-width:100% !important; opacity:1 !important; visibility:visible !important; }
  [class*="_scroll_g4kff"]{ height:auto !important; max-height:none !important; overflow:visible !important; }
  [class*="_footer_g4kff"]{ position:static !important; width:100% !important; }
  [class*="_footer_g4kff"] button{ width:100% !important; }

  /* === 7. 设置页头像：整条父链满宽，.sw-rabbits 网格自适应、不裁切 === */
  [class*="_row_1ixrm"],
  [class*="_control_1ixrm"],
  [class*="_avatarPicker_"],
  [class*="_avatarUploadRow_"]{
    width:100% !important; max-width:100% !important; min-width:0 !important; box-sizing:border-box !important;
  }
  .sw-rabbits{
    display:grid !important; width:100% !important; max-width:100% !important;
    grid-template-columns:repeat(auto-fill,minmax(96px,1fr)) !important; gap:10px !important;
  }
  .sw-rabbits .sw-rabbit{ width:100% !important; min-width:0 !important; box-sizing:border-box !important; }

  /* === 8. 通用防溢出兜底 === */
  img,video,canvas,table,pre,input,select{ max-width:100% !important; }
  [contenteditable]{ max-width:100% !important; box-sizing:border-box !important; }
}

/* === 9. 顶部全局栏 _topNav/_topActions：补齐 768~899px 平板区间，断点与主导航折叠(899)对齐 ===
   问题：m.css 仅在 <=767 隐藏营销扩展组并收紧顶部栏，768~899px 仍走桌面规则，
   顶部按钮（额度徽章 + 礼包/进群/拉新/公告/充值组 + 备忘录 + 两个面板开关）总宽约 990px，
   超出该区间视口导致轻微层叠。此处让顶部栏在整个 <=899 区间采用与手机端一致的紧凑布局。
   仅收紧间距 / 切换已有短文案 / 隐藏窄屏本不展示的营销组，不改动任何按钮的点击交互。 */
@media (max-width: 899px){
  [class*="_topNav_1oklx_57"]{
    height:52px !important; gap:8px !important; padding:0 10px 0 12px !important;
  }
  [class*="_topActions_1oklx_161"]{
    gap:6px !important; flex:1 1 auto !important; min-width:0 !important;
  }
  /* 营销扩展组（新人礼包 / 进群领字数 / 拉新返佣 / 公告 / 充值）：与 <=767 一致隐藏；
     窄屏由汉堡菜单与个人中心承载，充值仍可通过右侧额度徽章进入 */
  [class*="_desktopToolbarExtras_1oklx_307"]{ display:none !important; }
  /* 额度徽章：完整文案与分隔隐藏、只显示短数字，可收缩且不挤压右侧按钮 */
  [class*="_aiBadge_1oklx_235"]{
    flex:0 1 auto !important; min-width:0 !important;
    gap:4px !important; padding:4px 8px !important;
  }
  [class*="_aiBadgeFull_1oklx_845"],
  [class*="_aiBadgeDivider_1oklx_287"]{ display:none !important; }
  [class*="_aiBadgeShort_1oklx_299"]{ display:inline !important; }
  /* 备忘录按钮：仅保留图标 */
  [class*="_memoBtn_1oklx_319"]{
    width:32px !important; padding:0 !important; flex:0 0 auto !important;
  }
  [class*="_memoBtn_1oklx_319"] span{ display:none !important; }
  /* 两个面板开关保持固定图标宽，不被压缩 */
  [class*="_panelToggle_1oklx_363"]{ flex:0 0 auto !important; }
}

/* === 10. 顶部栏桌面偏窄区间 900~1023px（小笔记本 / 平板横屏）：
   桌面布局全部按钮显示需约 1010px，900~1023 区间右侧按钮会溢出。
   让操作区与额度徽章可收缩，并把额度徽章切为短数字（不隐藏任何按钮、不改点击）。 */
@media (min-width: 900px) and (max-width: 1023px){
  [class*="_topActions_1oklx_161"]{ flex:0 1 auto !important; min-width:0 !important; }
  [class*="_aiBadge_1oklx_235"]{
    flex:0 1 auto !important; min-width:0 !important; overflow:hidden !important;
  }
  [class*="_aiBadgeFull_1oklx_845"],
  [class*="_aiBadgeDivider_1oklx_287"]{ display:none !important; }
  [class*="_aiBadgeShort_1oklx_299"]{ display:inline !important; }
}
