html.yz-cutout-open,
html.yz-cutout-open body {
  overflow: hidden;
}

.yz-cutout-backdrop[hidden] {
  display: none !important;
}

.yz-cutout-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 20, 24, 0.56);
  backdrop-filter: blur(10px);
}

.yz-cutout-dialog {
  width: min(1180px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid #dedde4;
  border-radius: 22px;
  background: #fbfbfc;
  box-shadow: 0 28px 90px rgba(24, 22, 34, 0.24);
  color: #19191d;
}

.yz-cutout-header,
.yz-cutout-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: #fff;
}

.yz-cutout-header {
  border-bottom: 1px solid #ecebf0;
}

.yz-cutout-header > div,
.yz-cutout-column-title > div {
  display: grid;
  gap: 3px;
}

.yz-cutout-header strong {
  font-size: 18px;
}

.yz-cutout-header span,
.yz-cutout-column-title small,
.yz-cutout-hint,
.yz-cutout-footer span {
  color: #777680;
  font-size: 12px;
}

.yz-cutout-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f0eff3;
  font-size: 22px;
  cursor: pointer;
}

.yz-cutout-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 18px;
  overflow: auto;
  max-height: calc(100vh - 190px);
}

.yz-cutout-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.yz-cutout-column-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
}

.yz-cutout-file,
.yz-cutout-tools button,
.yz-cutout-result-actions button,
.yz-cutout-run {
  border: 1px solid #d9d7df;
  border-radius: 10px;
  background: #fff;
  color: #25242a;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.yz-cutout-drag-handle {
  margin-left: auto;
  border-color: #cfc8f4 !important;
  color: #5b43c7 !important;
}

.yz-cutout-wires {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}

.yz-cutout-wires path {
  fill: none;
  stroke: #8b6ff6;
  stroke-width: 2;
  opacity: 0.62;
}

.yz-cutout-wires path.active {
  stroke-width: 2.5;
  opacity: 0.95;
  stroke-dasharray: 8 6;
}

.yz-cutout-node {
  position: absolute;
  width: 292px;
  overflow: visible;
  border: 1px solid #d8d3ee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(37, 28, 74, 0.12);
  color: #1e1d23;
}

.yz-cutout-node > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid #ece9f5;
  cursor: grab;
  user-select: none;
}

.yz-cutout-node > header span {
  font-size: 13px;
  font-weight: 700;
}

.yz-cutout-node > header button {
  border: 0;
  background: transparent;
  color: #8d8996;
  font-size: 18px;
  cursor: pointer;
}

.yz-cutout-node-input {
  position: absolute;
  left: -6px;
  top: 84px;
  width: 11px;
  height: 11px;
  border: 2px solid #8b6ff6;
  border-radius: 50%;
  background: #fff;
}

.yz-cutout-node-preview {
  height: 190px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 12px;
  border: 1px solid #e4e1ed;
  border-radius: 10px;
  background: #f2f1f5;
}

.yz-cutout-node-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.yz-cutout-node-actions,
.yz-cutout-node > footer {
  display: flex;
  gap: 7px;
  padding: 0 12px;
}

.yz-cutout-node-actions button,
.yz-cutout-node > footer button {
  flex: 1;
  border: 1px solid #dcd8e8;
  border-radius: 8px;
  background: #fff;
  padding: 7px 8px;
  color: #302c3b;
  font-size: 12px;
  cursor: pointer;
}

.yz-cutout-node-actions button:first-child {
  border-color: #1f1d27;
  background: #1f1d27;
  color: #fff;
}

.yz-cutout-node-status {
  min-height: 18px;
  margin: 8px 12px;
  color: #777281;
  font-size: 11px;
}

.yz-cutout-node-status[data-kind="error"] { color: #c73a42; }
.yz-cutout-node-status[data-kind="success"] { color: #188454; }

.yz-cutout-node > footer {
  padding-bottom: 12px;
}

.yz-cutout-node > footer button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.yz-cutout-stage {
  position: relative;
  min-height: 430px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #dedde4;
  border-radius: 16px;
  background: #f0eff2;
}

.yz-cutout-stage img {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  object-fit: contain;
  user-select: none;
  backface-visibility: hidden;
}

.yz-cutout-stage img[hidden] {
  display: none;
}

.yz-cutout-stage.is-pixel-zoom > img {
  image-rendering: pixelated;
}

.yz-cutout-stage canvas {
  position: absolute;
  z-index: 2;
  opacity: 0;
  cursor: crosshair;
  touch-action: none;
}

.yz-cutout-stage canvas[hidden] {
  display: none;
}

.yz-cutout-selection-overlay {
  position: absolute;
  z-index: 3;
  overflow: visible;
  pointer-events: none;
  shape-rendering: geometricPrecision;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .28));
}

.yz-cutout-selection-overlay[hidden] {
  display: none;
}

.yz-cutout-placeholder {
  color: #94929c;
  font-size: 13px;
}

.yz-cutout-checker {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e7e6eb 25%, transparent 25%),
    linear-gradient(-45deg, #e7e6eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e7e6eb 75%),
    linear-gradient(-45deg, transparent 75%, #e7e6eb 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.yz-cutout-tools,
.yz-cutout-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.yz-cutout-tools button.active {
  border-color: #1f1e23;
  background: #1f1e23;
  color: #fff;
}

.yz-cutout-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: #66646e;
  font-size: 12px;
}

.yz-cutout-tools input {
  width: 90px;
}

.yz-cutout-tools output {
  width: 26px;
  text-align: right;
}

.yz-cutout-result-actions button:disabled,
.yz-cutout-run:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.yz-cutout-hint {
  margin: 0;
  line-height: 1.55;
}

.yz-cutout-footer {
  border-top: 1px solid #ecebf0;
}

.yz-cutout-footer span[data-kind="error"] {
  color: #c73a42;
}

.yz-cutout-footer span[data-kind="success"] {
  color: #188454;
}

.yz-cutout-run {
  min-width: 126px;
  border-color: #18171b;
  background: #18171b;
  color: #fff;
  font-weight: 700;
}

@media (max-width: 860px) {
  .yz-cutout-backdrop { padding: 8px; }
  .yz-cutout-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .yz-cutout-body { grid-template-columns: 1fr; max-height: calc(100vh - 160px); }
  .yz-cutout-stage { min-height: 320px; }
}
.youzi-cutout-zoom-host {
  position: relative;
  overflow: hidden !important;
  overscroll-behavior: contain;
}

.youzi-cutout-zoom-host.can-pan,
.youzi-cutout-zoom-host.is-panning {
  cursor: grab;
}

.youzi-cutout-zoom-host.is-panning {
  cursor: grabbing;
}

.youzi-cutout-zoom-toolbar {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 104px;
  padding: 5px 6px 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  background: rgba(22, 22, 26, 0.82);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
}

.youzi-cutout-zoom-toolbar button {
  border: 0;
  border-radius: 5px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.youzi-cutout-zoom-toolbar button:hover {
  background: rgba(255, 255, 255, 0.24);
}

.youzi-cutout-zoom-hint {
  position: absolute;
  left: 10px;
  bottom: 12px;
  z-index: 30;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(22, 22, 26, 0.66);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.header-actions .yz-cutout-launch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: #17171a;
  background: #17171a;
  color: #fff;
  white-space: nowrap;
}

.header-actions .yz-cutout-launch:hover {
  border-color: #7657e8;
  background: #7657e8;
}

.header-actions .yz-cutout-launch span {
  font-size: 13px;
}

.yz-cutout-stage.is-dragover {
  outline: 2px solid #7657e8;
  outline-offset: -2px;
  background-color: rgba(118, 87, 232, 0.06);
}

.yz-cutout-placeholder b,
.yz-cutout-placeholder small {
  display: block;
}

.yz-cutout-placeholder small {
  margin-top: 6px;
  color: #9696a0;
  font-size: 11px;
}

/* Compact cutout workspace */
.yz-cutout-dialog {
  width: min(1080px, calc(100vw - 40px));
  border-radius: 16px;
}

.yz-cutout-header,
.yz-cutout-footer {
  padding: 12px 16px;
}

.yz-cutout-header strong {
  font-size: 16px;
}

.yz-cutout-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 20px;
}

.yz-cutout-body {
  gap: 14px;
  padding: 14px;
  max-height: calc(100vh - 146px);
}

.yz-cutout-column {
  gap: 8px;
}

.yz-cutout-column-title {
  min-height: 32px;
}

.yz-cutout-column-title b {
  font-size: 14px;
}

.yz-cutout-file,
.yz-cutout-tools button,
.yz-cutout-result-actions button,
.yz-cutout-run {
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 13px;
}

.yz-cutout-stage {
  min-height: 390px;
  border-radius: 12px;
  contain: paint;
}

.yz-cutout-tools,
.yz-cutout-result-actions {
  min-height: 34px;
}

.yz-cutout-tools [data-tool="polygon"] {
  pointer-events: none;
}

.yz-cutout-tool-tip {
  color: #83818a;
  font-size: 12px;
}

.yz-cutout-tools [data-action="undo"] {
  margin-left: auto;
}

.yz-cutout-result-actions {
  justify-content: flex-end;
}

.yz-cutout-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
}

.yz-cutout-loading[hidden] {
  display: none !important;
}

.yz-cutout-loading .dot-wave {
  position: absolute;
  inset: -28%;
  width: auto;
  height: auto;
}

.yz-cutout-loading .dot-wave span {
  animation: none;
}

.yz-cutout-result-card-mode .yz-cutout-dialog {
  width: min(760px, calc(100vw - 40px));
}

.yz-cutout-result-card-mode .yz-cutout-body {
  grid-template-columns: minmax(0, 1fr);
}

.yz-cutout-result-card-mode .yz-cutout-result-column,
.yz-cutout-result-card-mode .yz-cutout-file {
  display: none;
}

.yz-cutout-result-card-mode .yz-cutout-stage {
  min-height: min(620px, calc(100vh - 230px));
}

.yz-cutout-result-card {
  position: absolute;
}

.yz-cutout-result-card .result-image {
  position: relative;
}

.yz-cutout-result-card .generation-preview {
  min-height: 252px;
}

.yz-cutout-result-card .yz-cutout-result-error {
  min-height: 252px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: #b33d45;
  text-align: center;
  font-size: 10px;
  line-height: 1.5;
  box-sizing: border-box;
}

.yz-cutout-result-card footer > span:first-child {
  margin-right: auto;
}

.yz-cutout-checker > img {
  width: 100%;
  height: 100%;
  cursor: zoom-in;
  object-fit: contain;
}

.yz-cutout-checker > img.is-ready {
  animation: yz-cutout-result-in 380ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes yz-cutout-result-in {
  from { opacity: 0; transform: scale(.975); filter: blur(5px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

.yz-cutout-viewer {
  z-index: 12000;
}

.viewer-stage.yz-left-pan,
.viewer-stage.yz-left-pan img {
  cursor: grab !important;
  user-select: none;
}

.viewer-stage.yz-left-pan.is-dragging,
.viewer-stage.yz-left-pan.is-dragging img {
  cursor: grabbing !important;
}

.result-card .result-image {
  cursor: grab;
  touch-action: none;
}

.result-card .result-image:active {
  cursor: grabbing;
}

.result-card footer {
  justify-content: flex-start !important;
  gap: 8px;
  cursor: default !important;
  touch-action: manipulation;
}

.result-card footer > span:first-child {
  margin-right: auto;
}

.result-card footer button,
.result-card footer .yz-cutout-drag-handle {
  box-sizing: border-box;
  flex: 0 0 auto;
  height: 30px;
  min-height: 30px;
  margin-left: 0;
  padding: 0 9px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.youzi-cutout-zoom-host.is-panning img,
.youzi-cutout-zoom-host.is-panning canvas,
.viewer-stage.is-dragging img {
  will-change: transform, translate;
}

@media (max-width: 860px) {
  .yz-cutout-dialog { width: calc(100vw - 16px); }
  .yz-cutout-body { max-height: calc(100vh - 130px); }
  .yz-cutout-stage { min-height: 300px; }
}
