/* ============================================================================
   mobile-compact.css  手机端 1:1 收口（最后加载，覆盖全部 composer/landing）
   参考站（390 视口）：
     hero：logo 左 + 标题区右（badge → 大标题竖排 → 副标题）
     作曲器（底部固定紧凑卡片）：
       1) ribbon（升级版/工作台 + 3 个 tab）
       2) 参考图上传 | 文本输入
       3) 快捷设置 | 模型 / 分辨率 | 时长（2 行选择器）+ 发送钮（右下）
   仅作用 ≤767 手机，不改桌面布局。
   ============================================================================ */

/* 桌面默认隐藏弹层触发按钮，仅手机显示 */
.compact-trigger-btn { display: none; }
#compactPanel, #compactLayer { display: none; }

@media (max-width: 767px) {

  /* ------------------------------------------------------------------
     1. 作曲器整体：全宽、贴底，不再左右挤
     ------------------------------------------------------------------ */
  .ws-main .ws-composer.cp-v2 {
    width: 100%;
    max-width: 100%;
    padding: 5px 10px 9px !important;
    box-sizing: border-box;
    flex: 0 0 auto;
  }
  .cp-v2 .cp-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    gap: 0;
    min-width: 0;
  }
  .cp-v2 .cp-side-left, .cp-v2 .cp-side-right { display: none !important; }

  /* ------------------------------------------------------------------
     2. 输入卡片：全宽，去掉桌面预留的右侧 88px
     ------------------------------------------------------------------ */
  .cp-v2 .composer-box,
  .cp-v2 .composer-box.bottom-input-wrapper {
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 9px 10px !important;
    border-radius: 17px !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  /* bottom-container 改为可换行的 flex 容器，便于"上传|文本"并排、"选择器"换行 */
  .cp-v2 .bottom-container {
    width: 100%;
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
  }

  /* ------------------------------------------------------------------
     3. ribbon：全宽单行横排（绝不竖排），过长横向滑动
     ------------------------------------------------------------------ */
  .cp-v2 .mf-ribbon {
    flex: 0 0 100% !important;
    width: 100% !important;
    order: -3;
    margin: 0 0 1px !important;
    padding: 5px 9px !important;
    box-sizing: border-box;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .cp-v2 .mf-ribbon::-webkit-scrollbar { display: none; }
  .cp-v2 .mf-ribbon-l {
    flex: 0 0 auto;
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .cp-v2 .mf-ribbon-ver {
    flex: 0 0 auto;
    display: inline-block;
    width: auto;
    height: auto;
    padding: 2px 8px;
    white-space: nowrap;
  }
  .cp-v2 .mf-ribbon-t {
    flex: 0 0 auto;
    display: inline-block;
    width: auto !important;
    height: auto !important;
    font-size: 13px;
    white-space: nowrap;
  }
  .cp-v2 .mf-ribbon-r {
    flex: 0 0 auto;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    margin-left: auto;
  }
  .cp-v2 .mf-ribbon-r span {
    flex: 0 0 auto;
    display: inline-block;
    width: auto !important;
    height: auto !important;
    font-size: 12px;
    white-space: nowrap;
  }

  /* ------------------------------------------------------------------
     4. 参考图上传 | 文本输入（同一行，对齐参考站 .top-section）
     ------------------------------------------------------------------ */
  .cp-v2 .cp-refs,
  #wsComposer.mf-composer .composer-box .cp-refs {
    flex: 0 0 24% !important;
    order: 0 !important;
    width: auto !important;
    max-width: 24% !important;
    align-self: stretch !important;
    min-width: 0;
  }
  .cp-v2 .cp-frames {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 7px;
    align-items: stretch;
    justify-content: flex-start;
  }
  .cp-v2 .cp-frames .cp-frame-add {
    flex: 1 1 100%;
    width: auto !important;
    height: auto !important;
    min-height: 70px;
  }
  /* 文本输入占剩余宽度 */
  .cp-v2 .top-section {
    flex: 0 0 calc(76% - 8px);
    order: 1;
    width: auto;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
  }
  /* 顶部附件按钮列移动端隐藏（上传已由左侧参考图槽承载） */
  .cp-v2 .top-section .left-section { display: none !important; }
  .cp-v2 .top-section .input-section { flex: 1 1 auto; min-width: 0; }
  /* 输入区上方重复工具栏隐藏 */
  .cp-v2 .composer-toolbar { display: none !important; }
  .cp-v2 .rich-input-wrapper { width: 100%; }
  .cp-v2 .rich-input {
    min-height: 64px !important;
    height: 64px;
    max-height: 110px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.5;
  }
  /* 输入框右上角资产小钮不抢宽 */
  .cp-v2 .shurukuang-asset-btn { width: 30px; height: 30px; }
  /* 扣费角标不另占整行 */
  .cp-v2 .cp-corner {
    position: static !important;
    display: flex;
    justify-content: flex-end;
    flex: 0 0 100%;
    order: -2;
  }

  /* ------------------------------------------------------------------
     5. 选择器（快捷设置 + 模型 + 分辨率 + 时长）：换行 2 行
     ------------------------------------------------------------------ */
  .cp-v2 .composer-params {
    flex: 0 0 100%;
    order: 2;
    width: auto;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center;
    gap: 7px;
    padding: 1px 0;
    min-width: 0;
  }
  .cp-v2 .composer-params .param-chip {
    flex: 1 1 auto !important;
    min-width: 0;
    height: 34px;
    white-space: nowrap !important;
  }
  .cp-v2 .composer-params .param-chip .param-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 多帧：标记为 .panel-bound 的 chip（渠道 / 比例）在面板关闭时隐藏；
     面板打开时由 JS 移入面板，关闭时移回原位。用类标记避免 nth-of-type 重编号误杀。 */
  body.mf-agent .cp-v2 .composer-params .param-chip.panel-bound {
    display: none !important;
  }
  /* 风险提示在移动端收入快捷面板（不占用曲器高度） */
  body.mf-agent .cp-v2 .mf-risk-tip { display: none !important; }
  .cp-v2 .mf-risk-tip {
    flex: 0 0 100%;
    order: 3;
    font-size: 11.5px;
    line-height: 1.5;
  }

  /* ------------------------------------------------------------------
     6. 底部行：只留发送钮（右）
     ------------------------------------------------------------------ */
  .cp-v2 .composer-bottom {
    flex: 0 0 100%;
    order: 4;
    width: auto;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    position: static !important;
    padding: 0 !important;
    background: none !important;
    min-width: 0;
  }
  .cp-v2 .composer-bottom .mode-buttons { display: none !important; }
  .cp-v2 .cp-enter-hint { display: none !important; }
  .cp-v2 .composer-bottom .send-stack {
    margin-left: auto !important;
    flex: 0 0 auto;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
  }
  .cp-v2 .send-stack .ai-writer-open {
    position: static !important;
    transform: none !important;
  }
  .cp-v2 .send-btn, .cp-v2 .send-stack .send-btn {
    width: 42px; height: 42px;
    flex: 0 0 auto;
  }

  /* 快捷设置按钮：放在选择器行首位 */
  .compact-trigger-btn {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center;
    gap: 5px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1.5px solid rgba(0, 229, 160, .5);
    background: linear-gradient(135deg, rgba(0,202,224,.18), rgba(0,229,160,.14));
    color: #5ff0c8;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }
  .compact-trigger-btn svg { width: 16px; height: 16px; }

  /* ------------------------------------------------------------------
     7. 桌面贴边绝对定位的玩法/模式切换（mf-out-l/r）在移动端隐藏：
        已由快捷面板承载
     ------------------------------------------------------------------ */
  #agPlaybookBtn.mf-out-l,
  #s2ModeSwitch.mf-out-r { display: none !important; }
  .bottom-action-slot.bottom-action-left { display: none !important; }

  /* ------------------------------------------------------------------
     8. Hero：横排（logo 左 + 标题区右），对齐参考站
     ------------------------------------------------------------------ */
  .re-hero.re-hero-multiframe,
  .re-hero.re-hero-multi,
  .re-hero.re-hero-canvas {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap;
    gap: 18px !important;
    text-align: left !important;
    width: 100%;
    padding: 8px 4px 6px;
  }
  .re-hero.re-hero-multiframe .re-logo,
  .re-hero.re-hero-multi .re-logo,
  .re-hero.re-hero-canvas .re-logo {
    width: 104px; height: 104px; flex: 0 0 104px; margin: 0;
  }
  .re-hero.re-hero-multiframe .re-title-area,
  .re-hero.re-hero-multi .re-title-area,
  .re-hero.re-hero-canvas .re-title-area {
    align-items: flex-start !important;
    width: auto;
    flex: 0 0 auto;
    gap: 8px;
  }
  .re-hero.re-hero-multiframe .re-title {
    font-size: 38px !important;
    line-height: 1.4;
    width: 90px;
  }
  .re-hero.re-hero-multiframe .re-sub,
  .re-hero.re-hero-multi .re-sub,
  .re-hero.re-hero-canvas .re-sub {
    text-align: left !important;
    font-size: 13px;
  }
  .re-fsection.re-fs-multiframe { width: 100%; align-items: center; }
}

/* ============================================================================
   9. 快捷操作面板（底部弹层）样式 1:1 参考站
   ============================================================================ */
.compact-actions-layer {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.compact-actions-panel {
  position: fixed;
  left: 12px; right: 12px;
  bottom: 70px;
  width: auto;
  max-height: min(70vh, 620px);
  z-index: 9991;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(124, 58, 237, .18);
  border-radius: 16px;
  background: linear-gradient(155deg, #14171f, #0a0c11);
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 30px rgba(124,58,237,.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.compact-actions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.compact-actions-title { color: #f2f6fc; font-size: 16px; font-weight: 700; }
.compact-actions-subtitle { margin-top: 3px; color: #8a93a6; font-size: 12px; line-height: 1.5; }
.compact-actions-close {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: #aab2c2;
  cursor: pointer;
}
.compact-actions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 13px 14px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.compact-actions-list::-webkit-scrollbar { width: 4px; }
.compact-actions-list::-webkit-scrollbar-thumb { background: rgba(124,58,237,.3); border-radius: 999px; }
.compact-block-title {
  margin-bottom: 2px;
  color: #8a93a6;
  font-size: 12px;
  font-weight: 600;
}
.compact-mode-card {
  padding: 12px;
  border: 1px solid rgba(124,58,237,.14);
  border-radius: 13px;
  background: rgba(255,255,255,.03);
}
.compact-mode-card .s2c-mode-switch,
.compact-mode-card #s2ModeSwitch {
  position: static !important;
  display: flex !important;
  width: 100%;
  margin: 0 !important;
}
.compact-mode-card .s2c-ms { width: 100%; }
.compact-mode-card .s2c-ms-opt {
  flex: 1;
  justify-content: center;
  padding: 9px 6px;
}
/* 面板内被收纳的参数 chip（渠道/比例）：整行可点 */
.compact-actions-list .param-chip {
  width: 100%;
  max-width: none !important;
  height: 48px !important;
  flex: 0 0 auto !important;
  justify-content: flex-start;
  padding: 0 13px !important;
  box-sizing: border-box;
  white-space: nowrap;
  border-radius: 12px !important;
  background: rgba(255,255,255,.03) !important;
  border: 1px solid rgba(124,58,237,.14) !important;
  color: #e8edf6 !important;
}
.compact-actions-list .param-chip .param-val {
  margin-left: auto;
  color: #9aa3b5;
}
/* 面板内 chip 的下拉菜单：不再原位显示，由 JS 移入子视图 #compactSub */
.compact-actions-list .param-chip { position: relative; overflow: visible !important; }
.compact-actions-list .param-chip .param-dropdown-menu {
  display: none !important;
}
/* 子视图：在面板内做整页二级导航 */
.compact-sub {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.compact-sub-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.compact-sub-back {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  background: rgba(255,255,255,.04);
  color: #dfe6f2;
}
.compact-sub-title { color: #f2f6fc; font-size: 15px; font-weight: 700; }
.compact-sub-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 12px;
}
/* 移入子视图的下拉菜单：静态整宽列表 */
.compact-sub-body .param-dropdown-menu {
  position: static !important;
  display: block !important;
  width: 100%;
  min-width: 0 !important;
  max-height: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.compact-sub-body .param-dropdown-menu button {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  padding: 11px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  font-size: 14px;
}
.compact-sub-body .param-dropdown-menu button.selected {
  background: rgba(34,211,238,.12);
  color: #22d3ee;
}

@media (max-width: 360px) {
  .compact-actions-panel { left: 8px; right: 8px; }
}
