/* ==================== 参数收进输入框底栏 ====================
   尺寸 / 输出张数收成输入框内左下角一颗聚合按钮（弹层里按组排），
   算力与发送并在右下角；提示语区吃掉面板剩余高度，底栏贴在输入框底部。 */
.image-tool-body .ugc-left-scroll {
  display: flex;
  flex-direction: column;
}

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

.image-tool-body .ugc-form-section:has(.ugc-prompt-bar) .ugc-prompt-box {
  flex: 1 1 auto;
  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 #image-params-pop {
  min-height: 0;
}

/* 弹层打开时把上面的区块压暗一档，浮起来的卡片更明确 */
.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;
}

/* 底栏左侧只有这一颗聚合按钮时，共享样式里的 max-width:68% 会按按钮自身内容宽度反算，
   把「auto · 1 张」这种摘要截成省略号；这里放开，让按钮按内容撑开（挤不下时仍会收缩省略）。 */
.image-tool-body .ugc-prompt-bar .ugc-prompt-left > .ugc-params-btn {
  max-width: none;
}

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

.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,
.image-tool-body .ugc-page-hero-media img,
.image-tool-body .ugc-case-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

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

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

.product-set-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-set-category-field {
  position: relative;
  min-width: 0;
}

.product-set-category-field > span {
  display: block;
  margin-bottom: 7px;
  color: #9ba1a8;
  font-size: 11px;
  font-weight: 700;
}

.product-set-category-field .ugc-select-trigger {
  width: 100%;
}

.product-set-category-menu {
  min-width: 128px;
  padding: 7px;
}

.product-set-category-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}

.product-set-category-stepper button {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #e3e7eb;
  background: rgba(255, 255, 255, 0.045);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.product-set-category-stepper button:hover {
  background: rgba(255, 255, 255, 0.09);
}

.product-set-category-stepper strong {
  min-width: 24px;
  text-align: center;
  color: #f2f4f6;
  font-size: 13px;
  font-weight: 800;
}

.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: 380px;
  overflow-y: auto;
  padding-right: 2px;
}

.product-set-spec-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 11px 12px;
  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;
}

@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;
}

/* 下拉面板：宽一点、高一点，可滚动 */
.image-tool-body .ugc-select-menu {
  padding: 6px;
  max-height: min(392px, 54vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.image-tool-body .ugc-select-menu::-webkit-scrollbar {
  width: 6px;
}

/* 输入方式切换：中性分段控件 */
.image-tool-body .image-mode-tabs {
  padding: 3px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
}

.image-tool-body .image-mode-tab {
  height: 30px;
  border-radius: 8px;
  color: #8f959d;
  font-weight: 600;
}

.image-tool-body .image-mode-tab.is-active {
  color: #0c0c0d;
  background: #ececee;
  box-shadow: none;
}

.image-tool-body .ugc-prompt-box textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------------------------------------
   公共案例：极简图片墙（去掉大段文案与前后对比排版，多铺几张成品图）
   -------------------------------------------------------------------------- */
.image-tool-body #image-panel-cases {
  padding-top: 22px;
}

.image-tool-body .case-wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}

.image-tool-body .case-tile {
  position: relative;
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  background: #2b2e30;
  transition: border-color 0.2s ease;
}

.image-tool-body .case-tile.is-wide {
  grid-column: span 2;
  aspect-ratio: auto;
}

.image-tool-body .case-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}


.image-tool-body .case-tile:hover img {
  transform: scale(1.04);
}

@media (max-width: 680px) {
  .image-tool-body .case-wall {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
}

/* 画面偏矮时整体收窄一点，保证 8 张两排能完整放下、不出现上下滚动。 */
@media (min-width: 681px) and (max-height: 830px) {
  .image-tool-body .case-wall {
    max-width: 760px;
    margin-inline: auto;
  }
}

@media (min-width: 681px) and (max-height: 730px) {
  .image-tool-body .case-wall {
    max-width: 660px;
  }
}
