.image-mode-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  border: 0;
}

.image-mode-tab {
  min-width: 74px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  color: #8f959d;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: color 0.16s ease, background 0.16s ease;
}

.image-mode-tab.is-active {
  color: #ff8ab2;
  background: #1a1c1e;
}

.image-upload-panel[hidden] {
  display: none;
}

.image-case-grid {
  --case-height: min(280px, 20vw);
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
  overflow: visible;
}

.image-case-grid .ugc-case-card {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.image-case-grid .ugc-case-card::before {
  display: none;
}

.image-case-grid .ugc-case-card:hover {
  transform: none;
  border: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.image-case-grid .ugc-case-media,
.image-case-grid .ugc-case-media img {
  border: 0;
  background: transparent !important;
  box-shadow: none;
}

.image-case-source .ugc-case-media {
  width: var(--case-height);
  height: var(--case-height);
  aspect-ratio: auto;
}

.image-case-result .ugc-case-media {
  width: calc(var(--case-height) * 16 / 9);
  height: var(--case-height);
  aspect-ratio: auto;
}

.image-case-arrow {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aeb4bb;
}

.image-case-arrow svg {
  width: 48px;
  height: 20px;
  opacity: 0.9;
}

@media (max-width: 760px) {
  .image-case-grid {
    flex-direction: column;
    align-items: center;
  }

  .image-case-source .ugc-case-media,
  .image-case-result .ugc-case-media {
    width: 280px;
    height: auto;
  }

  .image-case-source .ugc-case-media {
    aspect-ratio: 1 / 1;
  }

  .image-case-result .ugc-case-media {
    aspect-ratio: 16 / 9;
  }

  .image-case-arrow {
    transform: rotate(90deg);
  }
}

.image-tool-body .ugc-history-media img,

.product-set-spec-section {
  margin-bottom: 18px;
}

.product-set-category-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  padding-right: 2px;
}

.product-set-category-grid::-webkit-scrollbar {
  width: 6px;
}

.product-set-category-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

/* ==================== 参数收进输入框底栏（对齐图片复刻页） ====================
   上架平台 / 套图类别 / 参数收成输入框内左下角三颗按钮（各自带弹层），算力与发送并在右下角；
   提示语区吃掉面板剩余高度，底栏始终贴在输入框底部，不再单独占一条 footer 或一整块参数配置。 */
.image-tool-body .ugc-left-scroll {
  display: flex;
  flex-direction: column;
}

/* 套图设计规范：进入规范阶段后提示语输入框整块收起，规范区独占面板剩余高度，
   规范列表超出时在卡片列表内部滚动，底部的横向「确认生成」按钮始终贴在面板底部。
   （提示语区隐藏时 :has 不成立，所以这里用 flex:1 1 auto 让它吃满剩余空间。） */
.image-tool-body .product-set-spec-section:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.image-tool-body .product-set-spec-section:not([hidden]) .product-set-spec-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.image-tool-body .ugc-form-section:has(.ugc-prompt-bar) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

/* 提示语区给自己留一个下限：底栏（32px）+ 至少两行正文，规范再长也压不掉底栏 */
.image-tool-body .ugc-form-section:has(.ugc-prompt-bar) .ugc-prompt-box {
  flex: 1 1 auto;
  min-height: 210px;
  display: flex;
  flex-direction: column;
}

/* 输入框正文：底部留出底栏的位置（默认高度装不下底栏，这里放高并按需伸缩） */
.image-tool-body .ugc-prompt-box:has(.ugc-prompt-bar) textarea {
  flex: 1 1 auto;
  height: auto;
  min-height: 150px;
  padding: 13px 13px 58px;
}

/* 三颗按钮挤在一行：左边整组一起伸缩，摘要过长时优先在按钮内部省略，避免顶破面板 */
.image-tool-body .ugc-prompt-bar .ugc-prompt-left {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
  /* 类别按钮会吃满剩余宽度，不额外留间距时会紧贴右侧的发送按钮，看着很挤 */
  margin-right: 14px;
}

.image-tool-body .ugc-prompt-bar .ugc-prompt-left > .ugc-params-btn {
  flex: 0 1 auto;
  /* 共享样式的 max-width:68% 会按左侧整组宽度反算，把「淘宝天猫」「中文 · 1 : 1」
     这种短摘要也各截掉一两个字符；放开后由 flex 收缩决定谁让位。 */
  max-width: none;
}

/* 平台 / 参数摘要短，保持完整不收缩；类别名最长，压缩量全部由它承担（超出用省略号） */
.image-tool-body .ugc-prompt-bar .ugc-prompt-left > #image-platform-trigger,
.image-tool-body .ugc-prompt-bar .ugc-prompt-left > #image-params-trigger {
  flex: 0 0 auto;
}

.image-tool-body .ugc-prompt-bar .ugc-prompt-left > #product-set-category-trigger {
  flex: 0 1 auto;
  min-width: 0;
}

.image-tool-body .ugc-prompt-bar .ugc-prompt-actions {
  flex: 0 0 auto;
}

/* 底栏只放「参数 + 算力 + 发送」，左侧三颗按钮的宽度由内容决定，收紧内边距省空间 */
.image-tool-body .ugc-prompt-bar .ugc-prompt-left .ugc-params-btn {
  gap: 5px;
  padding: 7px 9px;
  font-size: 11px;
}

/* 平台 / 参数弹层按内容收紧，不套视频页那个最小高度 */
.image-tool-body .ugc-prompt-bar .ugc-params-pop.ugc-clone-pop {
  min-height: 0;
}

/* 共享样式给弹层排了 auto + minmax(0,1fr) 两行，行高会被拿去撑满可用空间：
   平台有 17 项时弹层会被拉到 840px、整块越过面板顶部（网格行不会因为 max-height 收缩）。
   这里改成「标题固定 + 内容可收缩」的纵向 flex，再配合 JS 的 max-height（barPopMaxHeight）限高，
   超出部分就落到内容区自己滚动。 */
.image-tool-body .ugc-prompt-bar .ugc-params-pop {
  display: flex;
  flex-direction: column;
  grid-template-rows: none;
  max-height: calc(100vh - 160px);
  overflow: hidden;
}

.image-tool-body .ugc-prompt-bar .ugc-params-pop > .ugc-params-pop-head {
  flex: 0 0 auto;
}

.image-tool-body .ugc-prompt-bar .ugc-params-pop > .ugc-params-pop-body,
.image-tool-body .ugc-prompt-bar .ugc-params-pop > .ugc-params-rows,
.image-tool-body .ugc-prompt-bar .ugc-params-pop > .product-set-category-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.image-tool-body .ugc-prompt-bar #image-platform-pop {
  gap: 10px;
  padding: 12px 14px 14px;
}

/* auto 不是具体比例，不画示意方块，避免被当成某个固定比例 */
.image-tool-body .ugc-prompt-bar .ugc-params-choice[data-value="auto"] .ugc-params-ratio-mark {
  display: none;
}

/* 套图类别弹层：作为底栏按钮的弹层向上弹出，几何尺寸与其它两张卡片完全一致
   （同一套 left / width / padding），标题行也换成共享的 .ugc-params-pop-head。 */
.image-tool-body .ugc-prompt-bar .product-set-category-menu {
  left: -14px;
  right: auto;
  bottom: calc(100% + 8px);
  width: calc(100% + 28px);
  min-width: 0;
  max-width: none;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  padding: 14px 18px 20px;
}

/* 弹层打开时把上面的区块压暗一档，浮起来的卡片更明确 */
.image-tool-body .ugc-left-scroll:has(.ugc-params-pop:not([hidden])) > .ugc-form-section:not(:has(.ugc-prompt-bar)) {
  opacity: 0.45;
  transition: opacity 0.18s ease;
}

/* 压暗会让每个区块各自变成层叠上下文，向下展开的模型菜单会被后面的区块盖住、
   点不中；持有菜单的区块浮到最上层即可（菜单仍留在同一个层叠上下文里）。 */
.image-tool-body .ugc-left-scroll:has(#image-model-menu:not([hidden])) > #image-model-section {
  z-index: 3;
}

/* 注：类别弹层的标题行已改用共享的 .ugc-params-pop-head / -title / -close，
   原来的 .product-set-category-head / -title / -close 已无用并删除。 */

.ugc-left.set-category-menu-open,
.ugc-left.set-category-menu-open .ugc-left-scroll {
  overflow: visible;
}

.product-set-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 3px 0;
}

.product-set-category-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.product-set-category-name {
  color: #dce1e6;
  font-size: 12px;
  font-weight: 700;
}

.product-set-category-desc {
  color: #8b9199;
  font-size: 10.5px;
  line-height: 1.45;
}

.product-set-category-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.product-set-category-stepper button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  color: #c6ccd3;
  background: transparent;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.product-set-category-stepper button:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.product-set-category-stepper strong {
  min-width: 22px;
  text-align: center;
  color: #f2f4f6;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.product-set-spec-reset {
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #d6dbe0;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.product-set-spec-reset[hidden] {
  display: none;
}

.product-set-spec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(620px, 62vh);
  overflow-y: auto;
  padding-right: 2px;
}

.product-set-spec-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  padding: 9px 10px;
  color: #c6cbd1;
  font-size: 12px;
  line-height: 1.65;
}

.product-set-spec-card.is-loading {
  min-height: 74px;
  position: relative;
  overflow: hidden;
}

.product-set-spec-card.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: product-set-spec-shimmer 1.2s infinite;
}

.product-set-spec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.product-set-spec-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #f2f4f6;
  font-weight: 750;
}

.product-set-spec-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 7px;
  color: #ff8ab2;
  background: rgba(255,45,104,.18);
  font-size: 11px;
  font-weight: 800;
}

.product-set-spec-content {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #aeb4bb;
}

.product-set-spec-editor {
  display: block;
  width: 100%;
  min-height: 195px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 11px;
  color: #dce1e6;
  background: rgba(0, 0, 0, 0.16);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}

.product-set-spec-card-pending {
  min-height: 150px;
}

.product-set-spec-skeleton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 132px;
}

.product-set-spec-skeleton span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  animation: product-set-spec-dot 1.2s ease-in-out infinite;
}

.product-set-spec-skeleton span:nth-child(2) {
  animation-delay: 0.16s;
}

.product-set-spec-skeleton span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes product-set-spec-dot {
  0%, 80%, 100% {
    opacity: 0.28;
    transform: scale(0.85);
  }
  40% {
    opacity: 0.95;
    transform: scale(1.35);
  }
}

@keyframes product-set-spec-shimmer {
  to {
    transform: translateX(100%);
  }
}

.image-tool-body .image-case-grid.set-image-case-grid {
  --set-case-gap: 16px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--set-case-gap);
  margin-top: 26px;
  align-items: stretch;
}

.image-tool-body .image-case-grid.set-image-case-grid .ugc-case-card {
  flex: none;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  overflow: visible;
}

.image-tool-body .image-case-grid.set-image-case-grid .ugc-case-card::before {
  display: none;
}

.image-tool-body .image-case-grid.set-image-case-grid .ugc-case-media {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.image-tool-body .image-case-grid.set-image-case-grid .ugc-case-media::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: inherit;
  pointer-events: none;
}

.image-tool-body .image-case-grid.set-image-case-grid .ugc-case-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.45s ease, filter 0.45s ease;
}

.image-tool-body .image-case-grid.set-image-case-grid .ugc-case-card:hover .ugc-case-media img {
  transform: scale(1.06);
  filter: saturate(1.08) contrast(1.02);
}

.set-image-case-overlay {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #f5f7f8;
  background: rgba(10, 11, 13, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.set-image-case-overlay span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #ff8ab2;
  background: rgba(255,45,104,0.22);
  font-size: 10px;
  font-weight: 850;
}

.set-image-case-overlay strong {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

@media (max-width: 1080px) {
  .image-tool-body .image-case-grid.set-image-case-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .product-set-category-grid {
    grid-template-columns: 1fr;
  }

  .image-tool-body .image-case-grid.set-image-case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .set-image-case-overlay {
    left: 9px;
    bottom: 9px;
    padding: 6px 8px;
    gap: 6px;
  }
}

.image-tool-body .ugc-history-card {
  background: transparent !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 12px;
}

.image-tool-body .ugc-history-media {
  background: transparent !important;
  flex: 0 0 auto;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  height: auto;
  min-height: 150px;
  aspect-ratio: auto;
  display: flex;
  align-items: stretch;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
}

.image-tool-body .ugc-history-body {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.image-tool-body .ugc-history-title {
  width: 100%;
}

.image-tool-body .ugc-history-controls {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.image-tool-body .ugc-history-controls .ugc-history-actions {
  margin-left: auto;
}

.image-tool-body .ugc-history-media-item {
  position: relative;
  flex: 0 0 auto;
  height: 150px;
  width: auto;
  min-width: 0;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 10px;
  overflow: hidden;
  background: transparent !important;
  cursor: zoom-in;
}

.image-tool-body .ugc-history-media-item img {
  width: auto;
  height: 100%;
  max-width: none;
  display: block;
  object-fit: contain;
}

.image-tool-body .ugc-history-card.is-running {
  flex-direction: column-reverse;
}

.image-tool-body .ugc-history-media::before {
  display: none;
}

.image-tool-body .ugc-history-card.is-running .ugc-history-media,
.image-tool-body .ugc-history-card.is-running .ugc-history-media-item.is-pending {
  background-image: none !important;
  animation: none !important;
}

.image-tool-body .ugc-history-card.is-running .ugc-history-media {
  background: transparent !important;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  min-height: 150px;
  height: auto;
  /* 公共样式给这个容器挂了 aspect-ratio，占位卡较多时会把整行撑得过高，这里交回给卡片高度决定。 */
  aspect-ratio: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: auto;
}

.image-tool-body .ugc-history-card.is-running .ugc-history-media-item.is-pending {
  flex: 0 0 auto;
  width: auto;
  height: 150px;
  aspect-ratio: var(--history-media-aspect, 1 / 1);
}

.image-tool-body .ugc-history-card.is-running .ugc-history-empty-media {
  width: 100%;
  min-height: 150px;
  place-content: center;
  text-align: center;
}

.image-tool-body .ugc-history-empty-media {
  min-height: 120px;
  align-content: center;
  justify-content: center;
  align-items: center;
  justify-items: center;
}
