/* —— 画笔编辑器（局部重绘弹层复用） —— */

.workflows-brush-editor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.workflows-brush-tip {
  margin: 0;
  padding: 0 8px;
  max-width: 100%;
  flex: 0 0 auto;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: #b42318;
  font-weight: 500;
}

.workflows-brush-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1 1 auto;
}

/*
 * 光标圆环：黑白高对比，故意不含红色。
 * 涂鸦笔迹仍是红笔；指针叠在红区上也不会被淹没。
 */
.workflows-brush-cursor-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 14px;
  height: 14px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  background: rgba(20, 20, 24, 0.18);
  box-shadow:
    0 0 0 2px #111,
    0 0 0 4px rgba(255, 255, 255, 0.95),
    0 0 0 5.5px #111,
    0 0 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  will-change: transform;
}

.workflows-brush-cursor-ring.is-visible {
  opacity: 1;
}

.workflows-brush-cursor-ring.is-drawing {
  background: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 2.5px #111,
    0 0 0 5px #fff,
    0 0 0 6.5px #111,
    0 0 14px rgba(0, 0, 0, 0.65);
}

.workflows-brush-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  cursor: none;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bifang-local-redraw-modal .bifang-inpaint-result-visual {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}

/* 局部重绘：进度一行（说明 + 进度条 + 百分比）整体居中，不贴左 */
.bifang-local-redraw-modal .bifang-inpaint-progress-status {
  justify-content: center;
}

#bifangGenResultRedraw {
  border-color: var(--ink, #141414);
  min-height: 44px;
}

@media (max-width: 900px) {
  #bifangGenResultUpscale,
  #bifangGenResultInpaint,
  #bifangGenResultRedraw {
    width: 100%;
    min-height: 44px;
  }
}

/* 局部重绘：笔触大小滑动条（样式放此处，避免继续堆超标的 upscale-dock.css） */
.bifang-inpaint-brush-fab {
  width: min(420px, calc(100% - 24px));
  box-sizing: border-box;
}

.bifang-inpaint-brush-slider-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  cursor: pointer;
}

.bifang-inpaint-brush-preview {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bifang-inpaint-brush-preview .bifang-inpaint-brush-dot {
  width: 11px;
  height: 11px;
}

.bifang-inpaint-brush-size-label {
  flex: 0 0 2.2ch;
  min-width: 2.2ch;
  font-size: 12px;
  line-height: 1;
  color: #555;
  text-align: right;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.bifang-inpaint-brush-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.bifang-inpaint-brush-slider:focus {
  outline: none;
}

.bifang-inpaint-brush-slider:focus-visible {
  outline: 2px solid rgba(229, 69, 69, 0.45);
  outline-offset: 2px;
  border-radius: 999px;
}

.bifang-inpaint-brush-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: #e4e4e7;
}

.bifang-inpaint-brush-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #e54545;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.bifang-inpaint-brush-slider::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: #e4e4e7;
}

.bifang-inpaint-brush-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #e54545;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

@media (max-width: 720px) {
  .bifang-inpaint-brush-fab {
    width: calc(100% - 16px);
    max-width: none;
    margin-left: 8px;
    margin-right: 8px;
    padding: 6px 10px;
    border-radius: 16px;
    gap: 8px;
  }

  .bifang-inpaint-brush-slider-wrap {
    min-height: 44px;
    gap: 10px;
  }

  .bifang-inpaint-brush-preview {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .bifang-inpaint-brush-size-label {
    flex-basis: 2.4ch;
    font-size: 13px;
  }

  .bifang-inpaint-brush-slider {
    height: 44px;
  }

  .bifang-inpaint-brush-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -12px;
  }

  .bifang-inpaint-brush-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }
}

/* 局部重绘：黑色滑条，旁边可退回上一笔 */
.bifang-local-redraw-modal .bifang-local-redraw-brush-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, calc(100% - 24px));
}

.bifang-local-redraw-modal .bifang-inpaint-brush-slider-wrap {
  min-height: 44px;
}

.bifang-local-redraw-modal .bifang-local-redraw-brush-caption {
  flex: 0 0 auto;
  color: #111;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}

.bifang-local-redraw-modal .bifang-inpaint-brush-slider:focus-visible {
  outline-color: #111;
}

.bifang-local-redraw-modal .bifang-inpaint-brush-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: #111;
}

.bifang-local-redraw-modal .bifang-inpaint-brush-slider::-webkit-slider-thumb {
  background: #111;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #111;
}

.bifang-local-redraw-modal .bifang-inpaint-brush-slider::-moz-range-track {
  height: 4px;
  background: #111;
}

.bifang-local-redraw-modal .bifang-inpaint-brush-slider::-moz-range-thumb {
  background: #111;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #111;
}

.bifang-local-redraw-undo {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #111;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.bifang-local-redraw-undo:disabled {
  opacity: 0.38;
  cursor: default;
}

.bifang-local-redraw-stages {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.bifang-local-redraw-stages > li {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
  color: #444;
}

.bifang-local-redraw-stages > li.is-running {
  border-color: #111;
  color: #111;
  font-weight: 650;
}

.bifang-local-redraw-stages > li.is-done {
  color: #666;
}

.bifang-local-redraw-stages > li.is-error {
  border-color: #b42318;
  color: #b42318;
}
