/* [p6 2026-10-26] 手机排版：加载在 assistant.css 之后，只做窄屏覆盖，不动桌面样式 */
@media (max-width: 820px) {
  html { -webkit-text-size-adjust: 100%; }
  body.aid-app { height: 100vh; height: 100dvh; }

  /* ---- 顶栏：品牌一行、按钮一行；按钮可横向滑动，绝不挤成歪行 ---- */
  /* [ui-v3] 顶栏一行：标题在左，「新对话」「话术库」从右往左；
     [ui-v3c] 右侧留 12px（与左侧 logo 一致），齿轮改到输入区上方悬浮 */
  .aid-top { flex: 0 0 auto; height: auto; min-height: 52px; flex-wrap: nowrap;
    gap: 8px; padding: 8px 12px; }
  .aid-brand { flex: 1 1 auto; min-width: 0; gap: 8px; }
  .aid-brand .aid-logo { width: 28px; height: 28px; border-radius: 8px; font-size: 14px; }
  .aid-brand strong { display: block; font-size: 14px; line-height: 1.35;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .aid-brand small { display: none; }
  .aid-user { flex: 0 0 auto; gap: 6px; justify-content: flex-end; min-width: 0;
    flex-direction: row-reverse; flex-wrap: nowrap; overflow: visible; }
  .aid-user .btn { flex: 0 0 auto; padding: 6px 10px; font-size: 12.5px; white-space: nowrap; }
  .aid-user .role-tag { display: none; }

  /* ---- 对话区 ---- */
  .aid-wrap { max-width: none; }
  .aid-chat { padding: 10px 12px 14px; gap: 10px; }
  .aid-hello { font-size: 13px; line-height: 1.65; padding: 11px 12px; border-radius: 10px; }
  .aid-msg { max-width: 100%; }
  .aid-msg.user { max-width: 88%; }
  .aid-bubble { padding: 10px 12px; font-size: 15px; line-height: 1.7; border-radius: 11px; }
  .aid-msg.assistant .aid-bubble { font-size: 15px; }
  .aid-meta { gap: 5px; }

  /* ---- 卡片：不再横向滚动，4 列改成能换行的等宽表 ---- */
  .aid-card-wide { padding: 8px; border-radius: 9px; overflow-x: visible; }
  .aid-card-wide table { table-layout: fixed; width: 100%; font-size: 12px; }
  .aid-card-wide th, .aid-card-wide td { padding: 5px 5px; font-size: 12px;
    line-height: 1.5; white-space: normal; word-break: break-word; }
  .aid-card-wide th:first-child, .aid-card-wide td:first-child { width: 23%; }
  .aid-card-wide th:nth-child(4), .aid-card-wide td:nth-child(4) { width: 27%; }
  .aid-cmp, .aid-bj, .aid-price { padding: 8px 9px; }
  .aid-cmp table, .aid-bj table { table-layout: fixed; width: 100%; }
  .aid-cmp th, .aid-cmp td, .aid-bj th, .aid-bj td { font-size: 11.5px;
    padding: 4px 5px; white-space: normal; word-break: break-word; }
  .aid-price-row > span { flex: 0 0 52px; }

  /* ---- [ui-v3] 输入区：只有一个图形发送键，底部留 iPhone 手势区 ---- */
  .aid-input { padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .aid-composer { padding: 4px 6px 4px 10px; border-radius: 13px; }
  .aid-composer textarea { min-height: 40px; padding: 8px 0; font-size: 15px; }
  .aid-send { width: 40px; height: 40px; }
  .aid-send svg { width: 30px; height: 30px; }

  /* ---- 抽屉 / 设置齿轮 / 提示 ---- */
  .aid-drawer { width: 100%; }
  .aid-drawer-body { padding: 10px 12px 40px; }
  .as-cfg { right: 10px; top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .as-cfg-btn { width: 30px; height: 30px; font-size: 15px; }
  .as-cfg-panel { position: fixed; left: 8px; right: 8px; top: 48px; bottom: auto; width: auto; }
  .toast { bottom: 14px; max-width: calc(100% - 24px); }
  .aid-wt-url { flex: 1 1 100%; }
  .aid-src-body { -webkit-line-clamp: 2; }
}

@media (max-width: 400px) {
  .aid-bubble, .aid-msg.assistant .aid-bubble { font-size: 14.5px; }
  .aid-card-wide th, .aid-card-wide td { font-size: 11.5px; padding: 4px; }
  .aid-card-wide th:first-child, .aid-card-wide td:first-child { width: 25%; }
  .aid-actions .btn { font-size: 12.5px; padding: 9px 5px; }
}
