/* 局部调整可选风格：标题栏按钮 + 高于局部调整弹层的选择层 */

.bifang-local-adjust-modal #bifangLocalAdjustResult .bifang-inpaint-result-slide {
  flex: 1 1 0;
  width: 0;
  max-width: 100%;
  border: 1px solid #d4d4d8;
  border-radius: 12px;
  box-sizing: border-box;
  padding: 8px;
  background: #f6f6f7;
}

.bifang-local-adjust-modal #bifangLocalAdjustResult .bifang-inpaint-result-visual,
.bifang-local-adjust-modal #bifangLocalAdjustResult .bifang-inpaint-result-visual img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  box-shadow: none;
}

.bifang-inpaint-modal-head {
  flex-wrap: wrap;
  align-items: center;
  padding-right: 16px;
}

.bifang-inpaint-modal-head-text {
  flex: 1 1 140px;
  min-width: 0;
}

.bifang-inpaint-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.bifang-inpaint-modal-close {
  position: static;
  top: auto;
  right: auto;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

.bifang-inpaint-style-btn {
  appearance: none;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #f3f3f5;
  color: #141414;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  max-width: 42vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bifang-inpaint-style-btn.hidden {
  display: none !important;
}

.bifang-inpaint-modal.is-loading .bifang-inpaint-style-btn,
.bifang-inpaint-modal.is-running .bifang-inpaint-style-btn,
.bifang-inpaint-modal.is-result .bifang-inpaint-style-btn,
.bifang-inpaint-modal.is-failed .bifang-inpaint-style-btn {
  display: none !important;
}

.bifang-inpaint-style-btn:hover {
  background: #e8e8eb;
}

/* 复用精准生图公开风格弹窗时，须盖过局部调整层（12000） */
.workflows-style-modal.is-over-local-adjust {
  z-index: 12500;
}

.workflows-style-modal.is-over-local-adjust #workflowStyleAltLinks {
  display: none;
}

.bifang-local-adjust-style-modal {
  position: fixed;
  inset: 0;
  z-index: 12500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bifang-local-adjust-style-modal.hidden {
  display: none;
}

.bifang-local-adjust-style-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 14, 0.45);
}

.bifang-local-adjust-style-panel {
  position: relative;
  width: min(100%, 560px);
  max-height: min(86vh, 720px);
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bifang-local-adjust-style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 8px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.bifang-local-adjust-style-head h3 {
  margin: 0;
  font-size: 16px;
}

.bifang-local-adjust-style-close {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}

.bifang-local-adjust-style-body {
  padding: 8px 16px 12px;
  overflow: auto;
  flex: 1 1 auto;
}

.bifang-local-adjust-style-hint {
  margin: 0 0 8px;
  color: #6b6b73;
  font-size: 12px;
}

.bifang-local-adjust-style-selected {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.bifang-local-adjust-style-selected.is-empty {
  color: #6b6b73;
  font-size: 12px;
}

.bifang-local-adjust-style-section {
  margin: 0 0 10px;
  padding: 10px 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.02);
}

.bifang-local-adjust-style-section:last-child {
  margin-bottom: 0;
}

.bifang-local-adjust-style-section-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: #6b6b73;
}

.bifang-local-adjust-style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.bifang-local-adjust-style-section .bifang-local-adjust-style-chips {
  margin-bottom: 0;
}

.bifang-local-adjust-style-chip {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: pointer;
}

.bifang-local-adjust-style-chip.is-on {
  background: #141414;
  color: #fff;
  border-color: #141414;
}

.bifang-local-adjust-style-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bifang-local-adjust-style-option,
.bifang-local-adjust-style-cover {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: #141414;
}

.bifang-local-adjust-style-option.is-on {
  border-color: #141414;
}

.bifang-local-adjust-style-option img,
.bifang-local-adjust-style-cover img,
.bifang-local-adjust-style-cover-ph {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  background: #f3f3f5;
  display: block;
}

.bifang-local-adjust-style-foot {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.bifang-local-adjust-style-foot .bifang-inpaint-modal-btn {
  flex: 1 1 0;
  min-height: 44px;
}

@media (min-width: 721px) {
  .bifang-local-adjust-style-modal {
    align-items: center;
  }

  .bifang-local-adjust-style-panel {
    border-radius: 16px;
    max-height: min(80vh, 680px);
  }
}

@media (max-width: 720px) {
  .bifang-inpaint-modal-head {
    padding: max(10px, env(safe-area-inset-top, 0px)) 12px 8px 14px;
  }

  .bifang-inpaint-modal-close {
    width: 44px;
    height: 44px;
    top: auto;
    right: auto;
  }

  .bifang-inpaint-style-btn {
    font-size: 12px;
    padding: 0 10px;
  }

  .bifang-local-adjust-style-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
