/* Flouter / pixeliser une zone */

.mask-shell {
  overflow: hidden;
}

.mask-editor[hidden] {
  display: none !important;
}

.mask-editor {
  display: grid;
  gap: 18px;
}

.mask-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee9e1;
}

.mask-file-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.mask-file-info strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mask-file-info span {
  color: var(--muted);
  font-size: .82rem;
}

.mask-settings {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, .9fr);
  gap: 18px;
  align-items: stretch;
}

.mask-effect-fieldset,
.mask-shape-fieldset,
.mask-strength {
  min-width: 0;
  margin: 0;
  padding: 15px;
  border: 1px solid #e7e4de;
  border-radius: 18px;
  background: #fffdf9;
}

.mask-effect-fieldset legend {
  padding: 0 5px;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 850;
}

.mask-effect-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mask-effect-option {
  position: relative;
  cursor: pointer;
}

.mask-effect-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mask-effect-option span {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 13px;
  border: 2px solid transparent;
  border-radius: 15px;
  background: #f5f7f8;
  transition: .15s ease;
}

.mask-effect-option strong {
  color: #344657;
  font-size: .93rem;
}

.mask-effect-option small {
  color: var(--muted);
  font-size: .77rem;
  line-height: 1.35;
}

.mask-effect-option input:checked + span {
  border-color: rgba(22,119,220,.24);
  background: #edf6ff;
}

.mask-strength {
  display: grid;
  align-content: center;
  gap: 9px;
}

.mask-strength-head,
.mask-strength-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mask-strength-head label {
  color: var(--ink);
  font-size: .88rem;
  font-weight: 850;
}

.mask-strength-head strong {
  color: #1c6fbd;
  font-size: .82rem;
}

.mask-strength input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.mask-strength-scale {
  color: var(--muted);
  font-size: .72rem;
}

.mask-zone-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mask-delete-zone {
  color: #8c4e4e;
  background: #fff1f1;
}

.mask-zone-count {
  margin-left: auto;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
}

.mask-stage {
  position: relative;
  min-width: 0;
  display: block;
  overflow: auto;
  padding: 12px;
  border: 1px solid #e5e7ea;
  border-radius: 20px;
  background:
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%),
    #fff;
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.mask-image-wrap {
  position: relative;
  width: auto;
  max-width: none;
  max-height: none;
  margin: auto;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}

.mask-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.mask-zones-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.mask-zone {
  position: absolute;
  min-width: 34px;
  min-height: 34px;
  border: 2px solid rgba(255,255,255,.98);
  border-radius: 6px;
  background: rgba(22,119,220,.08);
  box-shadow:
    0 0 0 2px rgba(22,119,220,.88),
    0 3px 14px rgba(0,0,0,.16);
  cursor: move;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.mask-zone.is-selected {
  box-shadow:
    0 0 0 3px #1677dc,
    0 4px 18px rgba(0,0,0,.22);
}

.mask-zone[data-shape="round"] {
  border-radius: 999px;
}

.mask-zone-number {
  position: absolute;
  left: 7px;
  top: 7px;
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(13,45,89,.86);
  color: #fff;
  font-size: .72rem;
  font-weight: 900;
  pointer-events: none;
}

.mask-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #1677dc;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
  touch-action: none;
}

.mask-handle-nw { left: -13px; top: -13px; cursor: nwse-resize; }
.mask-handle-ne { right: -13px; top: -13px; cursor: nesw-resize; }
.mask-handle-sw { left: -13px; bottom: -13px; cursor: nesw-resize; }
.mask-handle-se { right: -13px; bottom: -13px; cursor: nwse-resize; }

.mask-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
  text-align: center;
}

.mask-actions {
  margin-top: 0;
}

.mask-actions .primary {
  min-width: min(100%, 260px);
}

@media (max-width: 780px) {
  .mask-settings {
    grid-template-columns: 1fr;
  }

  .mask-file-head {
    align-items: stretch;
    flex-direction: column;
  }

  .mask-file-head button {
    width: 100%;
  }

  .mask-stage {
    padding: 7px;
    border-radius: 16px;
  }

  .mask-image-wrap {
    max-height: none;
  }

  .mask-handle {
    width: 28px;
    height: 28px;
  }

  .mask-handle-nw { left: -15px; top: -15px; }
  .mask-handle-ne { right: -15px; top: -15px; }
  .mask-handle-sw { left: -15px; bottom: -15px; }
  .mask-handle-se { right: -15px; bottom: -15px; }

  .mask-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mask-actions button,
  .mask-actions .primary {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .mask-effect-options {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .mask-shape-options {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .mask-effect-option span,
  .mask-shape-option span {
    min-height: 70px;
    padding: 10px;
  }

  .mask-zone-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mask-zone-toolbar button {
    width: 100%;
  }

  .mask-zone-count {
    grid-column: 1 / -1;
    margin-left: 0;
    text-align: center;
  }
}


.mask-shape-fieldset legend {
  padding: 0 5px;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 850;
}

.mask-shape-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mask-shape-option {
  position: relative;
  cursor: pointer;
}

.mask-shape-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mask-shape-option span {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 13px;
  border: 2px solid transparent;
  border-radius: 15px;
  background: #f5f7f8;
  transition: .15s ease;
}

.mask-shape-option strong {
  color: #344657;
  font-size: .93rem;
}

.mask-shape-option small {
  color: var(--muted);
  font-size: .77rem;
  line-height: 1.35;
}

.mask-shape-option input:checked + span {
  border-color: rgba(22,119,220,.24);
  background: #edf6ff;
}

/* Zoom de travail : le cadre reste fixe, seule la photo s’agrandit à l’intérieur. */
.mask-stage {
  scrollbar-width: thin;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  cursor: default;
}

.mask-stage.is-pinching,
.mask-stage.is-panning {
  touch-action: none;
  user-select: none;
}

.mask-stage.is-zoomed {
  cursor: grab;
}

.mask-stage.is-panning {
  cursor: grabbing;
}

.mask-image-wrap {
  flex: none;
}

.mask-zoom-indicator {
  position: sticky;
  z-index: 8;
  left: 10px;
  bottom: 10px;
  width: max-content;
  margin: 0 0 8px 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(28, 48, 68, .82);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  pointer-events: none;
}

