/* Canvas editor additions (nai-image-editor.js): tool panels, selection overlay, HSV Adjustment
 * popup and the Resize Canvas modal. Values mirror the official styled-components
 * (theme: bg0 #0e0f21, bg1 #13152c, bg2 #191b31, bg3 #22253f, textHeadings #f5f3c2). */
#view-nai-image #nai-editor-host [hidden] { display: none !important; }
#view-nai-image #nai-editor-stage canvas.nai-editor-overlay { pointer-events: none; transform: none; }
#view-nai-image #nai-editor-host .jjOUNX > span { line-height: 1.15; }

/* HSV Adjustment popup: official As (sc-3ee5cf41-8) + IB/IV/IH (sc-ea7688aa-*) */
#view-nai-image #nai-editor-host .nai-ed-float {
  display: flex; justify-content: center; position: absolute; bottom: 62px; left: 50%;
  transform: translate(-50%, 0); z-index: 2;
}
#view-nai-image #nai-editor-host .nai-ed-float > * { pointer-events: auto; }
#view-nai-image #nai-editor-host .nai-ed-hsv {
  background: rgb(25, 27, 49); border: 1px solid rgb(34, 37, 63); border-radius: 3px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; min-width: 260px; max-width: 340px; color: #fff;
}
#view-nai-image #nai-editor-host .nai-ed-hsv .iMqaMM { margin: 0; }
#view-nai-image #nai-editor-host .nai-ed-hsv-title { font-size: 0.875rem; color: #fff; font-weight: 600; }
#view-nai-image #nai-editor-host .nai-ed-hsv-actions { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 4px; }
#view-nai-image #nai-editor-host .nai-ed-flex { flex: 1; }
#view-nai-image #nai-editor-host .nai-ed-hsv-reset { font-size: 0.8rem; opacity: 0.7; color: #fff; }
#view-nai-image #nai-editor-host .nai-ed-hsv-cancel { font-size: 0.8rem; color: #fff; }
#view-nai-image #nai-editor-host .nai-ed-hsv-apply { font-size: 0.8rem; padding: 4px 12px; }

/* Resize Canvas modal (official Large modal + ResizeContainer) */
#view-nai-image #nai-editor-host .nai-ed-modal-overlay {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(14, 15, 33, 0.75);
}
#view-nai-image #nai-editor-host .nai-ed-modal {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0;
  width: min(520px, calc(100% - 40px)); max-height: calc(100% - 40px); overflow: auto;
  background: rgb(19, 21, 44); border: 1px solid rgb(34, 37, 63); border-radius: 3px; padding: 30px 30px 20px; color: #fff;
}
#view-nai-image #nai-editor-host .nai-ed-modal-close { position: absolute; top: 16px; right: 16px; padding: 4px; }
#view-nai-image #nai-editor-host .nai-ed-modal-close > div { width: 16px; height: 16px; }
#view-nai-image #nai-editor-host .nai-ed-modal-close:hover > div { background-color: rgb(245, 243, 194); }
#view-nai-image #nai-editor-host .nai-ed-modal-title { font-size: 1.275rem; font-family: Eczar, serif; color: rgb(245, 243, 194); margin-bottom: 20px; }
#view-nai-image #nai-editor-host .nai-ed-row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 0; }
#view-nai-image #nai-editor-host .nai-ed-heading { font-size: 0.875rem; font-weight: 600; margin: 6px 0; }
#view-nai-image #nai-editor-host .nai-ed-heading > span { opacity: 0.5; font-weight: 400; }
#view-nai-image #nai-editor-host .nai-ed-or { opacity: 0.5; margin: 10px 0; }
#view-nai-image #nai-editor-host .nai-ed-crop { opacity: 0.9; font-size: 0.875rem; color: #fff; text-decoration: underline; text-underline-offset: 3px; }
#view-nai-image #nai-editor-host .nai-ed-crop:hover { color: rgb(245, 243, 194); }
#view-nai-image #nai-editor-host .nai-ed-swap > div { width: 15px; height: 15px; margin: 18px; flex: 0 0 auto; }
#view-nai-image #nai-editor-host .nai-ed-swap:hover > div { background-color: rgb(245, 243, 194); }
#view-nai-image #nai-editor-host .nai-ed-input {
  width: 100%; min-width: 0; box-sizing: border-box; padding: 10px; border: 1px solid transparent; border-radius: 3px;
  background: rgb(14, 15, 33); color: #fff; font: inherit; font-size: 0.875rem; outline: none;
}
#view-nai-image #nai-editor-host .nai-ed-input:focus { border-color: rgb(34, 37, 63); }
#view-nai-image #nai-editor-host .nai-ed-edges { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 6px 0 20px; }
#view-nai-image #nai-editor-host .nai-ed-col { display: flex; flex-direction: column; align-items: center; }
#view-nai-image #nai-editor-host .nai-ed-mid { gap: 6px; }
#view-nai-image #nai-editor-host .nai-ed-col .nai-ed-input { max-width: 80px; }
#view-nai-image #nai-editor-host .nai-ed-preview { border: 1px solid rgb(34, 37, 63); border-radius: 3px; overflow: visible; }
#view-nai-image #nai-editor-host .nai-ed-go { margin-left: auto; padding: 10px 20px; }

/* Transparent pixels (moved selections, expanded canvas) show as a dim checkerboard. */
#view-nai-image #nai-editor-stage canvas.nai-editor-view { background: repeating-conic-gradient(rgb(40, 43, 68) 0 25%, rgb(28, 30, 54) 0 50%) 0 0 / 32px 32px; }

/* Compare (nai-image-compare.js): before / after over the results canvas. */
#view-nai-image .nai-compare { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; background: #0e0f21; outline: none; pointer-events: auto; }
#view-nai-image .nai-compare[hidden], #view-nai-image .nai-compare [hidden] { display: none !important; }
#view-nai-image .nai-compare-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 8px 14px; background: #13152c; border-bottom: 1px solid #22253f; color: #fff; font-size: 14px; }
#view-nai-image .nai-compare-title { font-weight: 600; color: #f5f3c2; }
#view-nai-image .nai-compare-hint { color: rgba(255, 255, 255, 0.55); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#view-nai-image .nai-compare-gap { flex: 1 1 auto; }
#view-nai-image .nai-compare-btn { height: 34px; padding: 0 14px; border-radius: 3px; border: 1px solid #22253f; background: #191b31; color: #fff; font: inherit; font-size: 13px; cursor: pointer; }
#view-nai-image .nai-compare-btn:hover { background: #22253f; }
#view-nai-image .nai-compare-btn[data-role="close"] { background: #f5f3c2; color: #13152c; border-color: #f5f3c2; font-weight: 600; }
#view-nai-image .nai-compare-view { position: relative; flex: 1 1 0; min-height: 0; overflow: hidden; cursor: grab; touch-action: none;
  background-color: #0e0f21; background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px); background-size: 20px 20px; }
#view-nai-image .nai-compare-view:active { cursor: grabbing; }
#view-nai-image .nai-compare-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 0 0 1px #22253f; }
#view-nai-image .nai-compare-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; image-rendering: auto; }
#view-nai-image .nai-compare-badge { position: absolute; top: 12px; padding: 4px 10px; border-radius: 3px; background: rgba(19, 21, 44, 0.85); border: 1px solid #22253f; color: #f5f3c2; font-size: 12px; font-weight: 600; pointer-events: none; }
#view-nai-image .nai-compare-badge.is-left { left: 12px; }
#view-nai-image .nai-compare-badge.is-right { right: 12px; }
#view-nai-image .nai-compare-divider { position: absolute; top: 0; bottom: 0; width: 24px; margin-left: -12px; cursor: ew-resize; outline: none; }
#view-nai-image .nai-compare-divider::before { content: ''; position: absolute; top: 0; bottom: 0; left: 11px; width: 2px; background: #f5f3c2; box-shadow: 0 0 0 1px rgba(14, 15, 33, 0.5); }
#view-nai-image .nai-compare-thumb { position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #f5f3c2; color: #13152c; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); }
#view-nai-image .nai-compare-divider:focus-visible .nai-compare-thumb { box-shadow: 0 0 0 3px rgba(245, 243, 194, 0.4); }
#view-nai-image #nai-viewer-chrome [data-action="compare"].is-active { background: rgb(37, 40, 65); color: #f5f3c2; }

/* Scale Image row of the Resize Canvas modal: same inputs and buttons as the rows around it. */
#view-nai-image #nai-editor-host .nai-ed-scale { display: flex; flex-direction: column; }
#view-nai-image #nai-editor-host .nai-ed-scale .nai-ed-row { gap: 12px; justify-content: flex-start; }
#view-nai-image #nai-editor-host .nai-ed-scale .nai-ed-input { max-width: 80px; }
#view-nai-image #nai-editor-host .nai-ed-scale-to { flex: 1 1 auto; font-size: 0.8125rem; opacity: 0.6; white-space: nowrap; }
#view-nai-image #nai-editor-host .nai-ed-scale-go { margin-left: auto; padding: 6px 16px; }
