/* ==========================================================================
   AI Chat 交互界面样式
   布局参考 liblib.art 图片生成器：上方对话记录，底部居中输入窗体
   ========================================================================== */

.ai-chat-workspace {
  --chat-primary: #0044ff;
  --chat-primary-soft: #e9f0ff;
  --chat-ink: #0f2033;
  --chat-muted: #64748b;
  --chat-border: #e2e8f0;
  display: flex;
  align-items: stretch;
  gap: 1rem;
  height: calc(100vh - 72px);
  min-height: 0;
}

.ai-chat-aside-left,
.ai-chat-aside-right {
  display: none;
  flex-direction: column;
  min-height: 0;
}

.ai-chat-page {
  --chat-primary: #0044ff;
  --chat-primary-soft: #e9f0ff;
  --chat-ink: #0f2033;
  --chat-muted: #64748b;
  --chat-border: #e2e8f0;
  --chat-bubble-user: #0044ff;
  --chat-bubble-bot: #f4f6fb;
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 72px);
  max-width: 1152px; /* 原 960px，按中间内容加宽 20% */
  margin: 0 auto;
  padding: 0 1rem;
  min-width: 0;
  flex: 1 1 auto;
}

@media (min-width: 992px) {
  body.ai-chat-shell > .container.py-4 {
    max-width: none;
    width: 100%;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .ai-chat-workspace {
    width: 100%;
  }

  .ai-chat-aside-left,
  .ai-chat-aside-right {
    display: flex;
    overflow: hidden;
    width: auto;
    flex: 1 1 0;
    min-width: 168px;
    /* 与中间 .ai-chat-composer-wrap 的底部留白一致：历史窗口底部与发送区底部对齐 */
    padding-bottom: 0.75rem;
  }

  .ai-chat-page {
    flex: 1 1 1152px;
    max-width: 1152px; /* 原 960px，按中间内容加宽 20% */
    width: 100%;
    margin: 0;
    height: 100%;
  }

  /* 顶部导航收紧后重新校准整页高度：内容区铺满视口，底部与版权区域贴紧不留大片空白 */
  body.ai-chat-shell {
    margin-bottom: 32px;
  }

  body.ai-chat-shell .ai-chat-workspace {
    height: calc(100vh - 158px);
  }

  .ai-chat-inspire-btn {
    display: none !important;
  }

  .ai-chat-inspire-panel {
    display: none !important;
  }
}

.ai-chat-banner-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.ai-chat-banner-area[hidden] {
  display: none !important;
}

.ai-chat-banner-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--chat-border);
  cursor: pointer;
  padding: 0;
}

.ai-chat-banner-card:first-child {
  grid-column: 1 / -1;
}

.ai-chat-banner-card img,
.ai-chat-banner-card video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.ai-chat-banner-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(8, 12, 24, 0.22) 0%, rgba(8, 12, 24, 0.46) 58%, rgba(8, 12, 24, 0.62) 100%);
  pointer-events: none;
}

.ai-chat-banner-card:hover::after {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(8, 12, 24, 0.16) 0%, rgba(8, 12, 24, 0.4) 58%, rgba(8, 12, 24, 0.56) 100%);
}

.ai-chat-banner-title {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  pointer-events: none;
}

.ai-chat-banner-title-pill {
  display: inline-block;
  max-width: 100%;
  padding: 0.16rem 0.68rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ai-chat-banner-card:first-child .ai-chat-banner-title-pill {
  font-size: 0.8rem;
  padding: 0.2rem 0.82rem;
}

.ai-chat-windows {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  overflow: hidden;
}

.ai-chat-aside-left:has(.ai-chat-window-more-menu),
.ai-chat-windows:has(.ai-chat-window-more-menu),
.ai-chat-windows-list:has(.ai-chat-window-more-menu) {
  overflow: visible;
}

.ai-chat-windows-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.ai-chat-windows-head h2,
.ai-chat-inspire-rail-head h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--chat-ink);
}

.ai-chat-windows-head-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ai-chat-window-search,
.ai-chat-window-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--chat-ink);
  cursor: pointer;
}

.ai-chat-window-search:hover,
.ai-chat-window-new:hover {
  background: #eef2ff;
  color: var(--chat-primary);
}

.ai-chat-window-search svg,
.ai-chat-window-new svg {
  width: 20px;
  height: 20px;
}

.ai-chat-windows-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.35rem;
}

.ai-chat-window-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 0.45rem 0.4rem 0.45rem 0.55rem;
  text-align: left;
  color: var(--chat-ink);
  cursor: pointer;
}

.ai-chat-window-item.is-active {
  background: var(--chat-primary-soft);
  color: var(--chat-primary);
}

.ai-chat-window-item.is-flash {
  animation: ai-chat-window-flash 0.32s ease-in-out 2;
}

@keyframes ai-chat-window-flash {
  0%, 100% { background: var(--chat-primary-soft); }
  50% { background: #93c5fd; }
}

.ai-chat-window-item:hover {
  background: #f8fafc;
}

.ai-chat-window-item.is-active:hover {
  background: var(--chat-primary-soft);
}

.ai-chat-window-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.ai-chat-window-name-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
  font-size: 0.8rem;
}

.ai-chat-window-actions {
  display: flex;
  flex: 0 0 auto;
  position: relative;
}

.ai-chat-window-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.ai-chat-window-more-btn:hover,
.ai-chat-window-more-btn.is-open {
  background: #e2e8f0;
  color: #0f172a;
}

.ai-chat-window-more-btn svg {
  width: 18px;
  height: 18px;
}

.ai-chat-window-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  min-width: 112px;
  padding: 0.28rem 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.ai-chat-window-more-menu button {
  display: block;
  width: 100%;
  padding: 0.48rem 0.8rem;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.84rem;
  color: var(--chat-ink);
  cursor: pointer;
}

.ai-chat-window-more-menu button:hover {
  background: #f8fafc;
}

.ai-chat-window-more-menu button.is-danger {
  color: #dc2626;
}

.ai-chat-windows-empty {
  padding: 1.2rem 0.8rem;
  color: var(--chat-muted);
  font-size: 0.8rem;
  text-align: center;
}

.ai-chat-window-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.42);
}

.ai-chat-window-search-overlay[hidden] {
  display: none !important;
}

.ai-chat-window-search-dialog {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(78vh, 720px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.ai-chat-window-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.ai-chat-window-search-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.ai-chat-window-search-close {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.3rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

.ai-chat-window-search-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ai-chat-window-search-row {
  padding: 0.75rem 1rem 0.35rem;
}

.ai-chat-window-search-input {
  width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
}

.ai-chat-window-search-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(0, 68, 255, 0.12);
}

.ai-chat-window-search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  padding: 0.35rem 1rem 0.75rem;
  border-bottom: 1px solid #eef2f6;
}

.ai-chat-window-search-filters label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #64748b;
}

.ai-chat-window-search-filters select {
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: 0.28rem 0.4rem;
  font-size: 0.8rem;
  color: #0f172a;
  background: #fff;
}

.ai-chat-window-search-results {
  flex: 1 1 auto;
  min-height: 180px;
  overflow-y: auto;
  padding: 0.55rem 0.7rem 0.9rem;
}

.ai-chat-window-search-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.86rem;
}

.ai-chat-window-search-group {
  margin-bottom: 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.ai-chat-window-search-group-name {
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
}

.ai-chat-window-search-hit {
  display: block;
  width: 100%;
  border: none;
  border-top: 1px solid #eef2f6;
  background: #fff;
  text-align: left;
  padding: 0.48rem 0.7rem;
  cursor: pointer;
}

.ai-chat-window-search-hit:hover {
  background: #eff6ff;
}

.ai-chat-window-search-hit-kind {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.7rem;
  color: #64748b;
}

.ai-chat-window-search-hit mark {
  background: #fef08a;
  color: #9a3412;
  padding: 0 0.08em;
  border-radius: 2px;
}

.ai-chat-item.is-search-target {
  outline: 2px solid #0044ff;
  outline-offset: 2px;
  border-radius: 12px;
}

.ai-chat-inspire-rail-head {
  flex: 0 0 auto;
  padding: 0.15rem 0.2rem 0.55rem;
}

.ai-chat-inspire-rail-scroll {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.ai-chat-inspire-rail.ai-chat-inspire-masonry {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
  column-count: 2;
  column-gap: 0.5rem;
  column-fill: balance;
  padding: 0 0.05rem 0.2rem;
}

.ai-chat-inspire-rail.is-pending,
.ai-chat-inspire-rail.is-empty {
  display: block;
  column-count: 1;
}

.ai-chat-inspire-rail .ai-chat-inspire-card {
  display: inline-block;
  width: 100%;
  margin-bottom: 0.5rem;
  break-inside: avoid;
}

.ai-chat-inspire-rail .ai-chat-inspire-cover img,
.ai-chat-inspire-rail .ai-chat-inspire-cover video {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
}

.ai-chat-inspire-rail .ai-chat-inspire-cover-empty {
  min-height: 96px;
  aspect-ratio: auto;
}

.ai-chat-inspire-rail .ai-chat-inspire-overlay h3 {
  font-size: 0.78rem;
}

/* 手机端固定顶部标题栏：桌面端隐藏（≤991.98px 媒体查询内展示） */
.ai-chat-mobile-topbar {
  display: none;
}

.ai-chat-mobile-windows-btn,
.ai-chat-mobile-windows-scrim,
.ai-chat-mobile-windows-panel {
  display: none;
}

/* ── 对话记录区 ── */
.ai-chat-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem 0.25rem 1rem;
  /* 历史上滑 prepend 时必须用 auto；关闭 overflow-anchor，避免与手动保位互相抢滚动 */
  scroll-behavior: auto;
  overflow-anchor: none;
  /* 隐藏滚动条（保留滚动能力）：对话记录区不展示多余滚动条 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ai-chat-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.ai-chat-page.has-history-tools .ai-chat-scroll {
  padding-top: 3.1rem;
}

.ai-chat-load-more {
  position: sticky;
  top: 0.55rem;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  margin: 0.15rem 0 -28px;
  padding: 0;
  pointer-events: none;
  overflow-anchor: none;
}

.ai-chat-load-more[hidden] {
  display: none !important;
}

.ai-chat-load-more-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #d7e0ee;
  border-top-color: var(--chat-primary);
  border-radius: 50%;
  animation: ai-chat-spin 0.7s linear infinite;
  flex: 0 0 auto;
}

.ai-chat-history-tools {
  position: absolute;
  top: 0.7rem;
  right: 1.15rem;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  pointer-events: auto;
}

.ai-chat-history-tools[hidden] {
  display: none !important;
}

.ai-chat-history-search {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(15, 32, 51, 0.08);
  backdrop-filter: blur(8px);
  transition: width 0.2s ease;
}

.ai-chat-history-search:hover,
.ai-chat-history-search.is-open {
  width: 198px;
}

.ai-chat-history-search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0;
  font-size: 0.78rem;
  color: var(--chat-ink);
  opacity: 0;
  pointer-events: none;
}

.ai-chat-history-search:hover .ai-chat-history-search-input,
.ai-chat-history-search.is-open .ai-chat-history-search-input {
  padding: 0 0 0 0.85rem;
  opacity: 1;
  pointer-events: auto;
}

.ai-chat-history-search-clear {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-right: 0.1rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--chat-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.ai-chat-history-search-clear:hover {
  color: var(--chat-ink);
  background: #eef2f7;
}

.ai-chat-history-search-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
}

.ai-chat-history-search-btn svg {
  width: 15px;
  height: 15px;
}

.ai-chat-history-type {
  height: 34px;
  max-width: 7.6rem;
  padding: 0 1.6rem 0 0.7rem;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E") no-repeat right 0.55rem center;
  box-shadow: 0 4px 14px rgba(15, 32, 51, 0.08);
  backdrop-filter: blur(8px);
  color: var(--chat-ink);
  font-size: 0.75rem;
  appearance: none;
  cursor: pointer;
}

.ai-chat-history-type:focus {
  outline: none;
  border-color: #93b4ff;
}

/* 由“模型广场”标题栏右侧迁移而来的多窗口图标，置于“全部类型”右侧（仅移动端显示） */
.ai-chat-history-windows-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--chat-ink);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 32, 51, 0.08);
}
.ai-chat-history-windows-btn svg {
  width: 18px;
  height: 18px;
}
.ai-chat-history-windows-btn:hover,
.ai-chat-history-windows-btn.is-active {
  color: var(--chat-primary);
  border-color: #93b4ff;
}
@media (min-width: 992px) {
  .ai-chat-history-windows-btn { display: none; }
}

@media (max-width: 640px) {
  .ai-chat-history-search:hover,
  .ai-chat-history-search.is-open {
    width: 154px;
  }

  .ai-chat-history-type {
    max-width: 6.4rem;
    font-size: 0.7rem;
  }
}

@keyframes ai-chat-spin {
  to { transform: rotate(360deg); }
}

/* 空状态欢迎区 */
.ai-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1rem 2rem;
  color: var(--chat-ink);
}

.ai-chat-empty-icon {
  font-size: 2rem;
  color: var(--chat-primary);
  margin-bottom: 0.75rem;
}

.ai-chat-empty h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.ai-chat-empty p {
  color: var(--chat-muted);
  max-width: 520px;
  line-height: 1.8;
}

.ai-chat-empty-tips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.ai-chat-tip {
  border: 1px solid var(--chat-border);
  background: #fff;
  color: var(--chat-ink);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ai-chat-tip:hover {
  border-color: var(--chat-primary);
  color: var(--chat-primary);
  background: var(--chat-primary-soft);
}

/* ── 消息列表 ── */
.ai-chat-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow-anchor: none;
}

.ai-chat-item {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-anchor: none;
}

/* 用户发送块：时间标题 + 气泡 + 操作按钮 */
.ai-chat-request {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ai-chat-request + .ai-chat-meta {
  margin-top: 0.15rem;
}

.ai-chat-row {
  display: flex;
  gap: 0.6rem;
}

.ai-chat-row.is-user {
  justify-content: flex-end;
}

.ai-chat-bubble {
  max-width: 78%;
  border-radius: 16px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-chat-row.is-user .ai-chat-bubble {
  background: var(--chat-bubble-user);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-chat-row.is-bot .ai-chat-bubble {
  background: var(--chat-bubble-bot);
  color: var(--chat-ink);
  border-bottom-left-radius: 6px;
}

.ai-chat-bubble.is-error {
  background: #fef2f2;
  color: #b91c1c;
}

/* 气泡内元信息（模式/模型标签、时间） */
.ai-chat-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--chat-muted);
  margin-top: 0.3rem;
}

.ai-chat-row.is-user .ai-chat-meta,
.ai-chat-meta.is-end {
  justify-content: flex-end;
}

.ai-chat-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  background: var(--chat-primary-soft);
  color: var(--chat-primary);
  font-size: 0.72rem;
}

/* 请求附件缩略图 / 回复媒体 */
.ai-chat-bubble-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.ai-chat-bubble-images img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  cursor: zoom-in;
}

.ai-chat-bubble-audio-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  border: 1px solid var(--chat-border);
  background: #f8fafc;
  color: var(--chat-ink);
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: center;
  padding: 0.4rem 0.3rem;
  overflow: hidden;
}

.ai-chat-bubble-audio-chip svg {
  width: 22px;
  height: 22px;
  color: var(--chat-muted);
  flex: 0 0 auto;
}

.ai-chat-bubble-audio-chip span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

.ai-chat-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.ai-chat-assets img {
  height: 182px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
  cursor: zoom-in;
  background: #e5e9f2;
}

.ai-chat-assets video {
  height: 182px;
  width: auto;
  max-width: 100%;
  border-radius: 12px;
  background: #000;
}

/* 对话列表视频：隐藏原生底部控件，悬停预览 + 角标操作 */
.ai-chat-video {
  position: relative;
  margin: 0;
  display: inline-block;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  line-height: 0;
}

.ai-chat-video video {
  display: block;
  height: 182px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}

.ai-chat-video-chrome {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1;
}

.ai-chat-video-duration {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.ai-chat-video-duration[hidden] {
  display: none !important;
}

.ai-chat-video-play {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(2px);
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0;
  line-height: 0;
  overflow: hidden;
}

.ai-chat-video-play svg {
  width: 14px;
  height: 14px;
  display: block;
}

.ai-chat-video:hover .ai-chat-video-chrome,
.ai-chat-video.is-playing .ai-chat-video-chrome {
  opacity: 0;
}

.ai-chat-video-btn {
  position: absolute;
  bottom: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

.ai-chat-video-btn svg {
  width: 15px;
  height: 15px;
}

.ai-chat-video-btn:hover {
  background: rgba(15, 23, 42, 0.78);
}

.ai-chat-video-dl {
  left: auto;
  right: 46px;
}

.ai-chat-video-fs {
  right: 8px;
}

.ai-chat-video:hover .ai-chat-video-btn {
  opacity: 1;
}

.ai-chat-video-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-video-lightbox[hidden] {
  display: none !important;
}

.ai-chat-video-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
}

.ai-chat-video-lightbox-body {
  position: relative;
  width: min(92vw, 56rem);
  height: min(88vh, 36rem);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45);
  background: #000;
  z-index: 1;
}

.ai-chat-video-lightbox-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.ai-chat-video-lightbox-player {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.ai-chat-video-lightbox-player::-webkit-media-controls-enclosure {
  bottom: var(--ai-mark-controls-lift, 0px) !important;
}

.ai-chat-video-lightbox-body:fullscreen,
.ai-chat-video-lightbox-body:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
}

.ai-chat-video-lightbox-player::-webkit-media-controls-download-button {
  display: none !important;
}

.ai-chat-video-lightbox-actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  z-index: 2;
}

.ai-chat-video-lightbox-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ai-chat-video-lightbox-btn svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.ai-chat-video-lightbox-btn:hover {
  background: rgba(37, 99, 235, 0.85);
}

.ai-chat-video-lightbox-lock {
  overflow: hidden;
}

.ai-chat-video-lightbox-stage > .ai-gen-mark {
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
  padding: 0.22em;
}

.ai-chat-asset .ai-gen-mark,
.ai-chat-video .ai-gen-mark {
  top: auto;
  bottom: 8px;
  left: 8px;
}

.ai-chat-asset {
  position: relative;
  margin: 0;
  cursor: zoom-in;
}

.ai-chat-asset img {
  display: block;
}

.ai-chat-asset-view {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(15, 32, 51, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.ai-chat-asset-view svg {
  width: 16px;
  height: 16px;
}

.ai-chat-asset:hover .ai-chat-asset-view {
  opacity: 1;
}

/* 生成中占位框：按请求规格提前展示尺寸与数量（小尺寸骨架，保证一页可见更多内容） */
.ai-chat-ph-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.ai-chat-ph {
  position: relative;
  height: 182px;
  width: auto;
  flex: 0 0 auto;
  max-width: 100%;
  border-radius: 10px;
  background: linear-gradient(110deg, #eef1f6 30%, #f7f9fc 50%, #eef1f6 70%);
  background-size: 200% 100%;
  animation: aiChatPhShimmer 1.6s linear infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--chat-muted);
}

.ai-chat-ph.is-video {
  height: 182px;
}

.ai-chat-ph .ai-chat-load-more-spinner {
  border-top-color: var(--chat-primary);
}

.ai-chat-ph-label {
  font-size: 0.7rem;
}

@keyframes aiChatPhShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 生成中占位 */
.ai-chat-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--chat-muted);
}

.ai-chat-pending .ai-chat-load-more-spinner {
  border-top-color: var(--chat-primary);
}

/* 记录底部操作行：再次编辑 / 重新生成 / 删除 */
.ai-chat-item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: -0.2rem;
}

/* 发送消息下方：复制 / 重新编辑 / 删除（PC 悬停显示，预留高度避免跳动） */
.ai-chat-request-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-height: 28px;
  margin: 0.05rem 0 0.15rem;
}

.ai-chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--chat-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.ai-chat-action-btn svg {
  width: 15px;
  height: 15px;
}

.ai-chat-action-btn:hover {
  background: var(--chat-primary-soft);
  color: var(--chat-primary);
}

.ai-chat-action-btn[data-chat-action="delete"]:hover {
  background: #fef2f2;
  color: #dc2626;
}

.ai-chat-action-btn.is-copied {
  background: var(--chat-primary-soft);
  color: var(--chat-primary);
}

/* 精确指针：移入发送消息时显示操作，移出隐藏 */
@media (hover: hover) and (pointer: fine) {
  .ai-chat-request-actions {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s, visibility 0.12s;
  }

  .ai-chat-request:hover .ai-chat-request-actions,
  .ai-chat-request:focus-within .ai-chat-request-actions,
  .ai-chat-request.is-action-open .ai-chat-request-actions {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }
}

/* 触控：长按后以悬浮栏显示三个操作按钮 */
@media (hover: none), (pointer: coarse) {
  .ai-chat-request {
    margin-bottom: 0.35rem;
  }
  .ai-chat-row.is-user .ai-chat-bubble {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .ai-chat-request-actions {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 40;
    min-height: 0;
    margin: 0;
    padding: 0.28rem 0.35rem;
    background: #fff;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(15, 32, 51, 0.16);
    transform: translateY(8px);
  }

  .ai-chat-request-actions.is-open {
    display: flex;
  }

  .ai-chat-request-actions.is-above {
    top: auto;
    bottom: 100%;
    transform: translateY(-8px);
  }

  .ai-chat-request-actions .ai-chat-action-btn {
    width: 36px;
    height: 36px;
  }

  .ai-chat-request-actions .ai-chat-action-btn svg {
    width: 17px;
    height: 17px;
  }
}

/* 删除确认时高亮整组对话（请求+回复）范围：平台主题蓝色描边 + 淺蓝底色凸显区分，小偏移避免被滚动容器左右裁切 */
.ai-chat-item.is-delete-target {
  outline: 2px solid var(--chat-primary);
  outline-offset: 2px;
  border-radius: 12px;
  background: var(--chat-primary-soft);
  box-shadow: 0 0 0 4px rgba(0, 68, 255, 0.08);
}

/* ── 输入窗体（底部居中） ── */
.ai-chat-composer-wrap {
  flex: 0 0 auto;
  padding: 0.5rem 0 0.75rem;
  position: relative;
  z-index: 20;
}

.ai-chat-composer {
  position: relative;
  border: 1px solid var(--chat-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(15, 32, 51, 0.08);
  padding: 0.75rem 0.9rem 0.65rem;
}

.ai-chat-composer:focus-within {
  border-color: var(--chat-primary);
}

/* 左上角模式列表 + 右上角灵感入口 */
.ai-chat-modes-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.ai-chat-modes {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0;
}

.ai-chat-mode {
  border: 1px solid transparent;
  background: #f1f5f9;
  color: var(--chat-muted);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ai-chat-mode.is-active {
  background: var(--chat-primary);
  color: #fff;
}

/* 与通用「灵感助手」按钮同源：ty-star 图标 +「灵感」文案 */
.ai-chat-inspire-btn {
  display: inline-flex;
  align-items: center;
  border: none;
  background-color: transparent;
  background-image: url('https://hx-ai-storage.oss-cn-shenzhen.aliyuncs.com/res/assets/ty-star.png');
  background-repeat: no-repeat;
  background-position: 6px center;
  background-size: 20px 19px;
  color: #2563eb;
  border-radius: 6px;
  padding: 0.2rem 0.55rem 0.2rem 1.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

.ai-chat-inspire-btn:hover,
.ai-chat-inspire-btn.is-active {
  background-color: #eff6ff;
  color: #2563eb;
}

.ai-chat-inspire-panel {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: calc(100% + 0.45rem);
  z-index: 30;
  max-height: min(64vh, 600px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--chat-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 32, 51, 0.16);
}

.ai-chat-inspire-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.ai-chat-inspire-close {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 1.25rem;
  line-height: 1;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  cursor: pointer;
}

.ai-chat-inspire-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ai-chat-inspire-masonry {
  flex: 1 1 auto;
  min-height: 0;
  column-count: 5;
  column-gap: 0.45rem;
  column-fill: balance;
  padding: 0.55rem;
  overflow: auto;
}

/* 加载中 / 空态：关掉分栏，避免先露出空卡片边框栅格 */
.ai-chat-inspire-masonry.is-pending,
.ai-chat-inspire-masonry.is-empty {
  display: block;
  column-count: 1;
  column-gap: 0;
}

.ai-chat-inspire-card {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 0.45rem;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  cursor: pointer;
  background: #f8fafc;
}

/* 媒体未就绪前不显示边框/底，避免预置空卡片栅格 */
.ai-chat-inspire-card:not(.is-ready) {
  border-color: transparent;
  background: transparent;
}

.ai-chat-inspire-card:not(.is-ready) .ai-chat-inspire-overlay,
.ai-chat-inspire-card:not(.is-ready) .ai-chat-inspire-cat {
  opacity: 0;
}

.ai-chat-inspire-card:not(.is-ready) img,
.ai-chat-inspire-card:not(.is-ready) video {
  opacity: 0;
  background: transparent;
}

.ai-chat-inspire-card:hover {
  border-color: var(--chat-primary);
}

.ai-chat-inspire-card:not(.is-ready):hover {
  border-color: transparent;
}

.ai-chat-inspire-cover {
  position: relative;
  display: block;
}

.ai-chat-inspire-cover img,
.ai-chat-inspire-cover video {
  width: 100%;
  display: block;
  vertical-align: top;
  background: #e2e8f0;
}

.ai-chat-inspire-cover video {
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.ai-chat-inspire-card:not(.is-ready) .ai-chat-inspire-cover img,
.ai-chat-inspire-card:not(.is-ready) .ai-chat-inspire-cover video {
  opacity: 0;
  background: transparent;
}

.ai-chat-inspire-card:not(.is-ready) .ai-chat-inspire-cover-empty {
  display: none;
}

.ai-chat-inspire-cover-empty {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.7rem;
}

.ai-chat-inspire-cat {
  position: absolute;
  top: 0.28rem;
  left: 0.28rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-size: 0.58rem;
}

.ai-chat-inspire-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem 0.4rem 0.35rem;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.78), transparent);
  color: #fff;
}

.ai-chat-inspire-overlay h3 {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
}

.ai-chat-inspire-empty {
  column-span: all;
  text-align: center;
  color: #94a3b8;
  padding: 1.5rem 0.5rem;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .ai-chat-inspire-masonry {
    column-count: 4;
  }
}

@media (max-width: 720px) {
  .ai-chat-inspire-masonry {
    column-count: 3;
  }

  .ai-chat-inspire-panel {
    max-height: min(60vh, 560px);
  }
}

/* 附件预览 */
.ai-chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.ai-chat-attachment {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--chat-border);
  background: #f8fafc;
}

.ai-chat-attachment img,
.ai-chat-attachment video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-chat-attachment.is-video {
  background: #0f172a;
}

.ai-chat-attachment.is-audio {
  width: 72px;
  background: #f8fafc;
}

.ai-chat-attachment-file.is-audio {
  gap: 0.2rem;
  font-size: 0.62rem;
  color: var(--chat-ink);
}

.ai-chat-attachment-file.is-audio svg {
  width: 20px;
  height: 20px;
  color: var(--chat-muted);
}

.ai-chat-attachment-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.62rem;
  color: var(--chat-muted);
  padding: 0.2rem;
  text-align: center;
  word-break: break-all;
  overflow: hidden;
}

.ai-chat-attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 32, 51, 0.65);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}

/* 文本输入框：随内容自动撑高（JS 计算行高），封顶 max-height 后内部滚动 */
.ai-chat-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--chat-ink);
  background: transparent;
  max-height: 500px;
  overflow-y: hidden;
}

.ai-chat-input::placeholder {
  color: #9aa7b8;
}

/* 底部工具行 */
.ai-chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.ai-chat-toolbar-left,
.ai-chat-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ai-chat-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--chat-border);
  background: #fff;
  color: var(--chat-muted);
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.ai-chat-tool-btn:hover {
  border-color: var(--chat-primary);
  color: var(--chat-primary);
}

.ai-chat-tool-btn svg {
  width: 17px;
  height: 17px;
}

.ai-chat-toolbar-left .ai-chat-frame-add,
.ai-chat-toolbar-left .ai-chat-video-mode-picker {
  flex: 0 0 auto;
}

.ai-chat-video-mode-trigger {
  max-width: 168px;
  padding: 0.32rem 0.5rem;
  gap: 0.28rem;
}

.ai-chat-video-mode-trigger #chatVideoModeName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.ai-chat-video-mode-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--chat-muted);
  flex: 0 0 auto;
}

.ai-chat-video-mode-ico svg {
  width: 16px;
  height: 16px;
}

.ai-chat-video-mode-menu {
  min-width: 168px;
  max-width: 210px;
  width: max-content;
}

.ai-chat-video-mode-menu .ai-chat-model-ico {
  width: 26px;
  height: 26px;
}

.ai-chat-video-mode-menu .ai-chat-model-option {
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
}

.ai-chat-video-mode-menu .ai-chat-model-text strong {
  font-size: 0.8rem;
}

/* 规格按钮：展示当前比例 + 数量/时长预览 */
.ai-chat-spec-btn {
  gap: 0.35rem;
  min-width: 0;
}

.ai-chat-spec-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--chat-ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.ai-chat-spec-preview-sep {
  color: var(--chat-muted);
  font-weight: 500;
}

/* 模型选择下拉 */
.ai-chat-model-picker {
  position: relative;
}

.ai-chat-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--chat-border);
  background: #fff;
  color: var(--chat-ink);
  border-radius: 10px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 260px;
}

.ai-chat-model-trigger:hover {
  border-color: var(--chat-primary);
}

.ai-chat-model-trigger #chatModelName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-caret {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.ai-chat-model-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  max-width: 360px;
  max-height: 360px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(15, 32, 51, 0.14);
  padding: 0.4rem;
  z-index: 30;
}

.ai-chat-model-filter-wrap {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.15rem 0.15rem 0.4rem;
  background: #fff;
}

.ai-chat-model-filter {
  width: 100%;
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  color: var(--chat-ink);
  outline: none;
  background: #f8fafc;
}

.ai-chat-model-filter:focus {
  border-color: var(--chat-primary);
  background: #fff;
}

.ai-chat-model-empty {
  padding: 0.75rem 0.6rem;
  font-size: 0.8rem;
  color: var(--chat-muted);
  text-align: center;
}

.ai-chat-model-group {
  font-size: 0.72rem;
  color: var(--chat-muted);
  padding: 0.4rem 0.6rem 0.2rem;
}

.ai-chat-model-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  color: var(--chat-ink);
  text-align: left;
  cursor: pointer;
}

.ai-chat-model-option:hover {
  background: var(--chat-primary-soft);
}

.ai-chat-model-option.is-selected {
  color: var(--chat-primary);
}

.ai-chat-model-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-chat-model-option.is-disabled:hover {
  background: transparent;
}

.ai-chat-model-ico {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #f2f5f9;
  color: var(--chat-muted);
}

.ai-chat-model-option.is-selected .ai-chat-model-ico {
  background: var(--chat-primary-soft);
  color: var(--chat-primary);
}

.ai-chat-model-ico svg {
  width: 16px;
  height: 16px;
}

.ai-chat-model-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1 1 auto;
}

.ai-chat-model-text strong {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-model-text small {
  font-size: 0.72rem;
  color: var(--chat-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-model-cost {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
  color: var(--chat-muted);
  font-size: 0.78rem;
}

.ai-chat-model-cost strong {
  font-weight: 600;
  color: var(--chat-ink);
  font-variant-numeric: tabular-nums;
}

.ai-chat-model-cost-ico {
  width: 12px;
  height: 12px;
}

.ai-chat-coin-badge {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* 预计消耗（内嵌在生成按钮内部，仅登录后展示） */
.ai-chat-estimate {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: #fff;
  font-size: 0.88rem;
}

.ai-chat-estimate img {
  width: 16px;
  height: 16px;
}

/* 登录态切换：未登录隐藏预计消耗并显示“生成”文字；登录后反之 */
.ai-chat-composer.is-guest .ai-chat-estimate {
  display: none;
}

.ai-chat-composer:not(.is-guest) .ai-chat-send-text {
  display: none;
}

/* 生成发送按钮（胶囊：左侧预计消耗/文字 + 右侧向上箭头圆片） */
.ai-chat-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #0044ff, #0576ff);
  color: #fff;
  padding: 0.32rem 0.38rem 0.32rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}

.ai-chat-send-btn:hover {
  transform: translateY(-1px);
}

.ai-chat-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.ai-chat-send-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}

.ai-chat-send-icon {
  width: 15px;
  height: 15px;
}

/* 规格配置弹层（贴靠规格按钮上方，与模型菜单同款定位） */
.ai-chat-spec-picker {
  position: relative;
  display: inline-flex;
}

.ai-chat-spec-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(400px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(15, 32, 51, 0.16);
  padding: 1rem 1.1rem;
  z-index: 40;
}

.ai-chat-spec-panel[hidden] {
  display: none;
}

.ai-chat-spec-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ai-chat-spec-group[hidden] {
  display: none;
}

.ai-chat-spec-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ai-chat-spec-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--chat-ink);
}

/* 分段按钮组：浅灰容器 + 选中项白底浮起；项过多时自动换行 */
.ai-chat-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  background: #f2f4f7;
  border-radius: 10px;
  padding: 0.25rem;
}

.ai-chat-seg-item {
  flex: 1 1 auto;
  min-width: 4.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  color: var(--chat-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}

.ai-chat-seg-item:hover {
  color: var(--chat-ink);
}

.ai-chat-seg-item.is-active {
  background: #fff;
  color: var(--chat-ink);
  font-weight: 600;
  border-color: var(--chat-border);
  box-shadow: 0 1px 4px rgba(15, 32, 51, 0.08);
}

.ai-chat-seg-item.is-disabled,
.ai-chat-seg-item:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  color: var(--chat-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.ai-chat-seg-item.is-disabled:hover,
.ai-chat-seg-item:disabled:hover {
  color: var(--chat-muted);
}

/* 尺寸宫格：多行排列 + 比例形状图标 */
.ai-chat-seg--grid {
  flex-wrap: wrap;
}

.ai-chat-seg--grid .ai-chat-seg-item {
  flex: 0 0 calc(25% - 0.2rem);
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.42rem 0.3rem;
  font-size: 0.74rem;
}

.ai-chat-seg--wrap .ai-chat-seg-item {
  flex: 1 1 calc(33.333% - 0.2rem);
  min-width: 5.2rem;
}

.ai-chat-ratio-ico {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  opacity: 0.75;
}

.ai-chat-seg-item.is-active .ai-chat-ratio-ico {
  opacity: 1;
}

/* 视频时长滚动轴：2–20，吸附模型支持尺度 */
.ai-chat-duration-slider {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem 0.5rem;
  background: #f2f4f7;
  border-radius: 10px;
}

.ai-chat-duration-slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-chat-duration-slider-head strong {
  font-size: 0.92rem;
  color: var(--chat-ink);
  font-variant-numeric: tabular-nums;
}

.ai-chat-duration-slider-hint {
  font-size: 0.7rem;
  color: var(--chat-muted);
}

.ai-chat-duration-range {
  width: 100%;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #c9d4e8, #0044ff);
  outline: none;
  cursor: pointer;
}

.ai-chat-duration-range::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0044ff;
  box-shadow: 0 1px 4px rgba(15, 32, 51, 0.2);
  cursor: pointer;
}

.ai-chat-duration-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0044ff;
  box-shadow: 0 1px 4px rgba(15, 32, 51, 0.2);
  cursor: pointer;
}

.ai-chat-duration-slider-scale {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--chat-muted);
}

.ai-chat-duration-ticks {
  position: relative;
  flex: 1 1 auto;
  height: 8px;
}

.ai-chat-duration-tick {
  position: absolute;
  top: 1px;
  width: 2px;
  height: 6px;
  margin-left: -1px;
  background: #b7c2d3;
  border-radius: 1px;
}

.ai-chat-duration-tick.is-active {
  background: #0044ff;
  height: 8px;
  top: 0;
}

.ai-chat-spec-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--chat-muted);
}

/* 视频首帧/尾帧上传（工具栏规格按钮右侧，仅视频模式展示，非必选） */
.ai-chat-frames {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ai-chat-frames[hidden] {
  display: none;
}

.ai-chat-frame-slot {
  position: relative;
  display: inline-flex;
}

.ai-chat-frame-slot[hidden] {
  display: none;
}

.ai-chat-frame-slot img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--chat-border);
}

.ai-chat-frame-add {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  border: 1px dashed var(--chat-border);
  background: #fff;
  color: var(--chat-muted);
  border-radius: 10px;
  padding: 0.32rem 0.5rem;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.ai-chat-frame-add span {
  line-height: 1;
}

.ai-chat-frame-add svg {
  flex: 0 0 auto;
}

.ai-chat-frame-add .ai-chat-media-plus {
  width: 12px;
  height: 12px;
}

.ai-chat-frame-add .ai-chat-media-kind {
  width: 14px;
  height: 14px;
}

.ai-chat-frame-add:hover {
  border-color: var(--chat-primary);
  color: var(--chat-primary);
}

.ai-chat-frame-add.is-filled {
  border-style: solid;
  border-color: var(--chat-primary);
  color: var(--chat-primary);
}

.ai-chat-frame-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 32, 51, 0.65);
  color: #fff;
  font-size: 0.66rem;
  line-height: 1;
  cursor: pointer;
}


/* 底部说明 */
.ai-chat-footnote {
  text-align: center;
  color: #9aa7b8;
  font-size: 0.76rem;
  margin: 0.55rem 0 0;
}

.ai-chat-footnote a {
  color: var(--chat-muted);
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  .ai-chat-page {
    height: calc(100vh - 60px);
    padding: 0 0.6rem;
  }

  .ai-chat-bubble {
    max-width: 88%;
  }

  .ai-chat-assets img {
    height: 151px;
    width: auto;
  }

  .ai-chat-assets video {
    height: 151px;
    width: auto;
  }

  .ai-chat-ph {
    height: 151px;
  }

  .ai-chat-ph.is-video {
    height: 151px;
  }

  /* 工具行换行：左侧控件一行，生成按钮独占整行避免显示不全 */
  .ai-chat-toolbar {
    flex-wrap: wrap;
    align-items: stretch;
    row-gap: 0.55rem;
  }

  .ai-chat-toolbar-left {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
  }

  .ai-chat-toolbar-right {
    flex: 1 1 100%;
    width: 100%;
  }

  .ai-chat-send-btn {
    width: 100%;
    justify-content: center;
    padding-left: 1rem;
    padding-right: 0.45rem;
  }

  .ai-chat-spec-preview {
    font-size: 0.72rem;
  }

  /* 移动端：模型 / 规格改为底部全宽弹层，避免桌面 absolute 弹层显示不全 */
  .ai-chat-mobile-sheet {
    position: fixed;
    inset: 0;
    z-index: 11050;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
  }

  .ai-chat-mobile-sheet.is-open {
    pointer-events: auto;
    opacity: 1;
  }

  .ai-chat-mobile-sheet-scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
  }

  .ai-chat-mobile-sheet-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: min(78vh, 640px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 36px rgba(15, 23, 42, 0.18);
    transform: translateY(12px);
    transition: transform 0.2s ease;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .ai-chat-mobile-sheet.is-open .ai-chat-mobile-sheet-panel {
    transform: translateY(0);
  }

  .ai-chat-mobile-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.65rem;
    border-bottom: 1px solid var(--chat-border);
  }

  .ai-chat-mobile-sheet-header strong {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--chat-ink);
  }

  .ai-chat-mobile-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
  }

  .ai-chat-mobile-sheet-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.55rem 0.75rem 1rem;
  }

  .ai-chat-model-menu.is-mobile-sheet-content,
  .ai-chat-spec-panel.is-mobile-sheet-content {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .ai-chat-model-menu.is-mobile-sheet-content .ai-chat-model-filter-wrap {
    position: sticky;
    top: 0;
  }
}

/* ── 手机排版：去除底部导航栏，顶部固定标题栏（配合 body.ai-chat-shell） ── */
@media (max-width: 991.98px) {
  .ai-chat-workspace {
    display: block;
    height: auto;
  }

  body.ai-chat-shell > .container.py-4 {
    max-width: none;
    padding: 0 !important;
  }

  body.ai-chat-shell main.pb-3 {
    padding-bottom: 0 !important;
  }

  .ai-chat-mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1090;
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--chat-border);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
  }

  .ai-chat-mobile-back {
    position: absolute;
    left: 0.5rem;
    top: calc(env(safe-area-inset-top, 0px) + 7px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--chat-ink);
    cursor: pointer;
  }

  .ai-chat-mobile-back:hover {
    background: #f1f5f9;
  }

  .ai-chat-mobile-back svg {
    width: 22px;
    height: 22px;
  }

  .ai-chat-mobile-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--chat-ink);
    line-height: 1.2;
  }

  .ai-chat-mobile-windows-btn {
    position: absolute;
    right: 0.5rem;
    top: calc(env(safe-area-inset-top, 0px) + 7px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--chat-ink);
    cursor: pointer;
  }

  .ai-chat-mobile-windows-btn:hover,
  .ai-chat-mobile-windows-btn.is-active {
    background: #f1f5f9;
    color: var(--chat-primary);
  }

  .ai-chat-mobile-windows-btn svg {
    width: 22px;
    height: 22px;
  }

  .ai-chat-mobile-windows-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1084;
    background: rgba(15, 23, 42, 0.28);
  }

  .ai-chat-mobile-windows-scrim[hidden] {
    display: none !important;
  }

  .ai-chat-mobile-windows-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: calc(var(--mobile-topbar-h, 48px) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    z-index: 1086;
    max-height: min(70vh, 520px);
    background: #fff;
    border-bottom: 1px solid var(--chat-border);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
  }

  .ai-chat-mobile-windows-panel[hidden] {
    display: none !important;
  }

  .ai-chat-mobile-windows-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  }

  .ai-chat-mobile-windows-head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--chat-ink);
  }

  .ai-chat-mobile-windows-panel .ai-chat-windows-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.4rem 0.35rem 0.7rem;
  }

  /* 页面整体占满视口高，顶部为固定标题栏留白（创作页不显示底部导航，底部仅留安全区） */
  body.ai-chat-shell .ai-chat-page {
    height: 100vh;
    height: 100dvh;
    padding: calc(var(--mobile-topbar-h, 48px) + env(safe-area-inset-top, 0px)) 0.6rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }

  /* 创作页移动端不显示底部“单次对话对应...”说明行 */
  body.ai-chat-shell .ai-chat-footnote {
    display: none;
  }

  /* 历史搜索/筛选悬浮入口避开固定标题栏 */
  body.ai-chat-shell .ai-chat-history-tools {
    top: calc(var(--mobile-topbar-h, 48px) + env(safe-area-inset-top, 0px) + 0.55rem);
    right: 0.75rem;
  }
}
