/* Match the existing target/content modals; keep changes scoped to this step. */
.target-adjustment .modal-dialog { width: min(440px, calc(100% - 24px)); margin: 12px auto; }
.target-adjustment .modal-content { border: 0; border-radius: 20px; overflow: hidden; }
.target-adjustment .target-adjustment-header { padding: 18px 16px; flex: none; }
.target-adjustment .modal-heading-3 { margin: 0; font-size: 23px; }
.target-adjustment .btn-close { filter: none; }
.target-adjustment .target-adjustment-body { padding: 18px; }
.target-adjustment p.target-adjustment-copy { padding: 0; font-size: 15px; line-height: 1.5; text-align: center; color: #0F133A; }
.target-adjustment p.target-adjustment-note { padding: 0; margin: 12px 0; color: #707070; font-size: 13px; line-height: 1.45; text-align: center; }
.target-adjustment-image { width: 100%; height: auto; max-height: 38vh; max-height: clamp(96px, calc(100dvh - 300px), 38dvh); object-fit: contain; display: block; border-radius: 10px; background: #F6F6F6; }
/* The canvas fills the stage; the script fits the image inside it with room for the corner handles. */
.target-adjustment-stage { position: relative; width: 100%; height: clamp(220px, calc(100vh - 430px), 460px); height: clamp(220px, calc(100dvh - 430px), 460px); border-radius: 10px; overflow: hidden; background: #00000081; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.target-adjustment-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; -webkit-tap-highlight-color: transparent; }
.target-adjustment-canvas:active { cursor: grabbing; }
.target-adjustment-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 20px; }
.target-adjustment .modal-btn { width: 100%; margin: 0; font-size: 17px; padding: 12px; }
.target-adjustment .modal-secondary-btn { font-size: 16px; padding: 4px; }
.target-adjustment button:disabled { opacity: .55; cursor: wait; }
.target-adjustment button:focus-visible { outline: 3px solid #FFB242; outline-offset: 3px; }
.target-adjustment canvas:focus-visible { outline: 3px solid #FFB242; outline-offset: -3px; }
.target-adjustment-corner-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.target-adjustment-corner-tools label { font-size: 13px; color: #0F133A; }
.target-adjustment-corner-tools select { margin-top: 4px; }
.target-adjustment-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.target-adjustment-comparison figure { margin: 0; min-width: 0; }
.target-adjustment-comparison figcaption { text-align: center; font-size: 13px; color: #0F133A; margin-bottom: 6px; }
.target-adjustment p.target-adjustment-error { color: #CC0000; padding: 0; font-size: 14px; margin: 12px 0 0; }
.target-adjustment [hidden] { display: none !important; }
.target-adjustment .modal-body { border-radius: 0; }

/* Keep the image within the visible screen; the original file is unchanged. */
.target-adjustment .modal-dialog-scrollable { height: calc(100vh - 24px); height: calc(100dvh - 24px); }
.target-adjustment .target-adjustment-actions { position: sticky; bottom: -18px; z-index: 1; background: #fff; padding: 10px 0; }
@media (max-width: 480px), (max-height: 600px) {
    .target-adjustment .target-adjustment-header { padding: 12px 14px; }
    .target-adjustment .target-adjustment-body { padding: 12px; }
    .target-adjustment .target-adjustment-actions { bottom: -12px; gap: 8px; margin-top: 12px; }
    .target-adjustment p.target-adjustment-copy { margin-bottom: 10px; font-size: 14px; line-height: 1.4; }
    .target-adjustment p.target-adjustment-note { margin: 8px 0; font-size: 12px; }
    .target-adjustment .modal-btn { min-height: 44px; padding: 10px; font-size: 16px; }
    .target-adjustment .modal-secondary-btn { min-height: 44px; font-size: 14px; }
}

/* Small screens: while moving corners the editor takes the whole screen, so the
   image is as large as possible: one line of guidance on top, actions below. */
@media (max-width: 575.98px), (max-height: 600px) {
    .target-adjustment--editing .modal-dialog { width: 100%; max-width: none; margin: 0; height: 100vh; height: 100dvh; }
    .target-adjustment--editing .modal-content { height: 100%; max-height: none; border-radius: 0; background: #fff; }
    .target-adjustment--editing .target-adjustment-header { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
    .target-adjustment--editing .modal-heading-3 { font-size: 19px; }
    .target-adjustment--editing .target-adjustment-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    .target-adjustment--editing [data-editor] { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
    .target-adjustment--editing p.target-adjustment-copy { margin: 0 0 8px; font-size: 14px; line-height: 1.35; }
    .target-adjustment--editing .target-adjustment-stage { flex: 1 1 auto; height: auto; min-height: 120px; }
    /* Dragging replaces the corner picker and its hint on touch screens. */
    .target-adjustment--editing .target-adjustment-corner-select,
    .target-adjustment--editing p.target-adjustment-note { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
    .target-adjustment--editing .target-adjustment-corner-tools { justify-content: center; margin-top: 4px; }
    .target-adjustment--editing .target-adjustment-actions { position: static; flex-direction: row-reverse; align-items: center; gap: 12px; margin-top: 0; padding: 0; }
    .target-adjustment--editing .target-adjustment-actions .modal-btn { flex: 1 1 auto; width: auto; }
    .target-adjustment--editing .target-adjustment-actions .modal-secondary-btn { flex: none; padding: 4px 12px; }
    .target-adjustment--editing p.target-adjustment-error { margin: 6px 0 0; text-align: center; }
    .target-adjustment--editing p.target-adjustment-error:empty { display: none; }
}
