.ngps-upload-grid {
    display: grid;
    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );
    gap: 14px;
}

.ngps-upload-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 245px;
    padding: 22px;
    border: 1px dashed #cfd6e1;
    border-radius: var(--ngps-radius-large);
    background: var(--ngps-surface);
    cursor: pointer;
    text-align: center;
    transition:
            border-color var(--ngps-transition),
            background-color var(--ngps-transition),
            box-shadow var(--ngps-transition),
            transform var(--ngps-transition);
}

.ngps-upload-card:hover,
.ngps-upload-card:focus-within,
.ngps-upload-card.is-dragover {
    border-color: var(--ngps-pink);
    background: var(--ngps-pink-soft);
    box-shadow:
            0 14px 32px
            rgba(236, 72, 153, 0.09);
    transform: translateY(-1px);
}

.ngps-upload-card.is-dragover {
    border-color: var(--ngps-pink);
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(236, 72, 153, .11), 0 16px 36px rgba(236, 72, 153, .12);
}

.ngps-upload-card input[type="file"] {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.ngps-upload-card__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border-radius: 16px;
    background: var(--ngps-pink-soft);
    color: var(--ngps-pink-dark);
    font-size: 13px;
    font-weight: 900;
}

.ngps-upload-card__icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ngps-upload-card strong {
    color: var(--ngps-ink);
    font-size: 13.5px;
    font-weight: 900;
}

.ngps-upload-card > small {
    max-width: 310px;
    margin-top: 6px;
    color: var(--ngps-muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.ngps-file-preview {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
    pointer-events: none;
}

.ngps-preview-item {
    overflow: hidden;
    width: 110px;
    border: 1px solid var(--ngps-line);
    border-radius: 11px;
    background: #ffffff;
    box-shadow:
            0 8px 20px
            rgba(15, 23, 42, 0.06);
}

.ngps-upload-card--logo .ngps-preview-item img {
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #fff;
}

.ngps-upload-card--poster .ngps-preview-item img {
    aspect-ratio: 5 / 4;
    object-fit: cover;
    background: #f3f4f6;
}

[data-ngps-submission-type="entertainment"] .ngps-upload-card--poster .ngps-preview-item img,
[data-ngps-submission-type="event"] .ngps-upload-card--poster .ngps-preview-item img {
    aspect-ratio: 85 / 38;
}

.ngps-preview-item {
    position: relative;
}

.ngps-media-processing-note {
    display: grid;
    gap: 4px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(109, 24, 61, .14);
    border-radius: 12px;
    background: #fdf6f9;
    color: #55142f;
}

.ngps-media-processing-note strong { font-size: 11.5px; }
.ngps-media-processing-note span { font-size: 10.5px; line-height: 1.55; }

.ngps-media-deferred-note {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 11px;
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(217, 119, 6, .28);
    border-radius: 14px;
    background: #fffaf0;
    color: #713f12;
}

.ngps-media-deferred-note__icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: #fef3c7;
    color: #b45309;
    font-size: 15px;
    font-weight: 900;
}

.ngps-media-deferred-note strong {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
    font-weight: 900;
}

.ngps-media-deferred-note p {
    margin: 0;
    font-size: 10.5px;
    line-height: 1.65;
}

.ngps-media-editor { width: min(1240px, calc(100vw - 32px)); max-height: 94dvh; overflow: hidden; }
dialog.ngps-media-editor .ngps-manager-dialog__panel { display: grid !important; grid-template-rows: auto minmax(0, 1fr) auto; max-height: 94dvh; overflow: hidden; }
.ngps-media-editor .ngps-manager-dialog__panel > header { padding: 15px 20px 13px !important; }
.ngps-media-editor .ngps-manager-dialog__panel header h3 { margin-block: 2px; font-size: 17px; }
.ngps-media-editor__body { display: block; min-height: 0; padding: 18px 22px; overflow: auto; background: #f8f6f7; }
.ngps-media-canvas-wrap { display: grid; place-items: center; width: min(100%, 940px); min-height: 390px; margin-inline: auto; padding: 20px; border: 1px solid #ddd4d8; border-radius: 16px; background: radial-gradient(circle at 50% 35%, #fff 0, #f0ecee 72%); overflow: visible; }
.ngps-media-canvas-wrap canvas { display: block; max-width: 100%; max-height: 520px; width: min(100%, 680px); height: auto; border-radius: 9px; background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; box-shadow: 0 18px 48px rgba(25, 5, 15, .2); cursor: grab; touch-action: none; user-select: none; }
.ngps-media-canvas-wrap canvas.is-dragging { cursor: grabbing; }
.ngps-media-canvas-wrap.is-dragover {
    border-color: var(--ngps-pink);
    background: radial-gradient(circle at 50% 35%, #fff5f8 0, #fce8ef 72%);
    box-shadow: inset 0 0 0 3px rgba(236, 72, 153, .10);
}
.ngps-media-editor__body aside { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 9px 11px; width: min(100%, 1080px); margin: 16px auto 0; padding: 15px; border: 1px solid #e2dade; border-radius: 14px; background: #fff; box-shadow: 0 10px 30px rgba(39, 9, 24, .05); }
.ngps-media-editor__body aside > .ngps-media-editor__hint,
.ngps-media-editor__body aside > .ngps-media-editor__quick-actions { grid-column: 1 / -1; }
.ngps-media-editor__hint { padding: 9px 11px; border-radius: 9px; background: #f8edf2; color: #6d183d; font-size: 9.5px; line-height: 1.45; }
.ngps-media-editor__quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ngps-media-editor__quick-actions .ngps-button { min-width: 0; min-height: 36px; padding: 7px 8px; }
.ngps-media-editor__body aside .ngps-field { gap: 5px; margin: 0; }
.ngps-media-editor__body aside .ngps-field > span { font-size: 9.5px; line-height: 1.25; }
.ngps-media-editor__body aside .ngps-field input[type="text"],
.ngps-media-editor__body aside .ngps-field select { min-height: 38px; padding: 8px 10px; font-size: 11px; }
.ngps-media-editor__body aside .ngps-checkbox-line { align-self: end; min-height: 38px; margin: 0; padding: 8px 10px; border: 1px solid #e5dce0; border-radius: 9px; background: #fff8fb; }
.ngps-media-editor__body aside [data-ngps-watermark-title-field] { grid-column: span 2; }
.ngps-media-editor__body aside [data-ngps-background-blur-field][hidden] { display: none; }
.ngps-media-editor__body aside .ngps-color-field input[type="color"] { width: 100%; min-height: 38px; padding: 4px; border: 1px solid #d8dfe8; border-radius: 9px; background: #fff; cursor: pointer; }
.ngps-watermark-positions { display: grid; grid-column: span 2; gap: 5px; }
.ngps-watermark-positions > span { color: var(--ngps-ink-soft); font-size: 9.5px; font-weight: 800; }
.ngps-watermark-positions > div { display: grid; grid-template-columns: repeat(3, 30px); gap: 4px; }
.ngps-watermark-positions button { display: grid; place-items: center; width: 30px; height: 26px; padding: 0; border: 1px solid #d9cdd3; border-radius: 7px; background: #fff; color: #6d183d; font-size: 13px; cursor: pointer; }
.ngps-watermark-positions button:hover { border-color: #8a1e4d; background: #fff2f7; }
.ngps-creative-tools { grid-column: 1 / -1; margin-top: 3px; border: 1px solid #e0d5da; border-radius: 11px; background: #fcfafb; overflow: hidden; }
.ngps-creative-tools summary { padding: 11px 13px; color: #6d183d; font-size: 10.5px; font-weight: 900; cursor: pointer; list-style-position: inside; }
.ngps-creative-tools[open] summary { border-bottom: 1px solid #e7dfe2; background: #fff5f8; }
.ngps-creative-tools > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 11px; padding: 13px; }
.ngps-creative-tools .ngps-field--wide { grid-column: span 2; }
.ngps-media-editor__body input[type="range"] { padding: 0; }
.ngps-media-editor .ngps-manager-dialog__panel > footer { position: relative; z-index: 2; display: flex; justify-content: flex-end; gap: 9px; padding: 12px 20px !important; border-top: 1px solid var(--ngps-line); background: #fff !important; box-shadow: 0 -8px 24px rgba(42, 10, 26, .05); }

@media (max-width: 780px) {
    .ngps-media-editor__body aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ngps-creative-tools > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ngps-media-canvas-wrap { min-height: 300px; }
    .ngps-dialog-options { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .ngps-upload-grid { grid-template-columns: minmax(0, 1fr); }
    .ngps-media-deferred-note { padding: 12px; }
    .ngps-media-editor { width: calc(100vw - 16px); }
    .ngps-media-editor__body { padding: 10px; }
    .ngps-media-editor__body aside { grid-template-columns: 1fr; padding: 11px; }
    .ngps-media-editor__body aside > * { grid-column: 1 !important; }
    .ngps-creative-tools > div { grid-template-columns: 1fr; }
    .ngps-creative-tools .ngps-field--wide { grid-column: 1; }
    .ngps-media-canvas-wrap { min-height: 240px; padding: 10px; }
}

/* Professional wide editor and one-operation-per-row controls. */
.ngps-media-editor {
    width: min(1480px, calc(100vw - 24px));
}

.ngps-media-canvas-wrap {
    width: min(100%, 1120px);
}

.ngps-media-editor__body aside,
.ngps-creative-tools > div {
    grid-template-columns: minmax(0, 1fr);
}

.ngps-media-editor__body aside {
    width: min(100%, 1220px);
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.ngps-media-editor__body aside > .ngps-field,
.ngps-media-editor__body aside > .ngps-checkbox-line,
.ngps-watermark-positions,
.ngps-creative-tools > div > .ngps-field,
.ngps-creative-tools > div > .ngps-checkbox-line {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    align-items: center;
    gap: 22px;
    min-height: 68px;
    margin: 0;
    padding: 11px 18px;
    border: 0;
    border-bottom: 1px solid #eee7ea;
    border-radius: 0;
    background: #fff;
}

.ngps-media-editor__body aside [data-ngps-watermark-title-field],
.ngps-watermark-positions {
    grid-column: auto;
}

.ngps-media-editor__body aside > .ngps-checkbox-line > input,
.ngps-creative-tools > div > .ngps-checkbox-line > input {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
}

.ngps-media-editor__body aside > .ngps-checkbox-line > span,
.ngps-creative-tools > div > .ngps-checkbox-line > span {
    grid-column: 1;
    grid-row: 1;
}

.ngps-media-editor__body aside > .ngps-field > span,
.ngps-media-editor__body aside > .ngps-checkbox-line > span,
.ngps-watermark-positions > span,
.ngps-creative-tools .ngps-field > span,
.ngps-creative-tools .ngps-checkbox-line > span {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #351020;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.25;
}

.ngps-media-editor__body [data-help]::after {
    content: attr(data-help);
    color: #88747d;
    font-size: 9.5px;
    font-weight: 500;
    line-height: 1.35;
}

.ngps-media-editor__hint {
    margin: 14px 18px 8px;
}

.ngps-media-editor__quick-actions {
    display: grid;
    grid-template-columns: minmax(240px, 320px) repeat(3, minmax(100px, 1fr));
    align-items: center;
    gap: 9px;
    padding: 10px 18px 14px;
    border-bottom: 1px solid #eee7ea;
}

.ngps-tool-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ngps-tool-copy strong { color: #351020; font-size: 11px; font-weight: 900; }
.ngps-tool-copy small { color: #88747d; font-size: 9.5px; line-height: 1.35; }

.ngps-media-editor__body input[type="range"] {
    width: 100%;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.ngps-media-editor__body input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f04c91, #7a153f);
    box-shadow: inset 0 0 0 1px rgba(76, 18, 45, .08);
}

.ngps-media-editor__body input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    margin-top: -8px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #7a153f;
    box-shadow: 0 3px 10px rgba(75, 17, 44, .3);
    appearance: none;
    -webkit-appearance: none;
}

.ngps-media-editor__body input[type="range"]::-moz-range-track {
    height: 6px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #f04c91, #7a153f);
}

.ngps-media-editor__body input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #7a153f;
    box-shadow: 0 3px 10px rgba(75, 17, 44, .3);
}

.ngps-media-editor__body input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(240, 76, 145, .2), 0 3px 10px rgba(75, 17, 44, .3);
}

.ngps-watermark-positions {
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}

.ngps-watermark-positions > div {
    grid-template-columns: repeat(9, 34px);
}

.ngps-creative-tools {
    margin: 12px 18px 16px;
}

.ngps-creative-tools > div {
    padding: 0;
}

.ngps-creative-tools .ngps-field--wide {
    grid-column: auto;
}

@media (max-width: 820px) {
    .ngps-media-editor {
        width: calc(100vw - 12px);
    }

    .ngps-media-editor__quick-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ngps-tool-copy {
        grid-column: 1 / -1;
    }

    .ngps-media-editor__body aside > .ngps-field,
    .ngps-media-editor__body aside > .ngps-checkbox-line,
    .ngps-watermark-positions,
    .ngps-creative-tools > div > .ngps-field,
    .ngps-creative-tools > div > .ngps-checkbox-line {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 14px;
    }

    .ngps-watermark-positions > div {
        grid-template-columns: repeat(9, minmax(28px, 1fr));
    }

    .ngps-media-editor__body aside > .ngps-checkbox-line > input,
    .ngps-creative-tools > div > .ngps-checkbox-line > input {
        grid-column: 1;
        grid-row: 2;
    }

    .ngps-media-editor__body aside > .ngps-checkbox-line > span,
    .ngps-creative-tools > div > .ngps-checkbox-line > span {
        grid-column: 1;
        grid-row: 1;
    }
}

/* Keep the live preview visible while desktop users adjust the controls. */
dialog.ngps-manager-dialog.ngps-media-editor,
.ngps-shell dialog.ngps-manager-dialog.ngps-media-editor {
    width: calc(100vw - 16px) !important;
    max-width: 1600px !important;
    height: auto !important;
    max-height: 96dvh !important;
}

@media (min-width: 900px) and (max-width: 1100px) {
    .ngps-media-editor__body {
        display: grid;
        grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr);
        align-items: start;
        gap: 14px;
        padding: 14px;
    }

    .ngps-media-canvas-wrap {
        position: sticky;
        top: 0;
        width: 100%;
        min-height: calc(96dvh - 175px);
        margin: 0;
        padding: 12px;
    }

    .ngps-media-canvas-wrap canvas {
        width: 100%;
        max-height: calc(96dvh - 215px);
    }

    .ngps-media-editor__body aside {
        width: 100%;
        margin: 0;
    }

    .ngps-media-editor__body aside > .ngps-field,
    .ngps-media-editor__body aside > .ngps-checkbox-line,
    .ngps-watermark-positions,
    .ngps-creative-tools > div > .ngps-field,
    .ngps-creative-tools > div > .ngps-checkbox-line {
        grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
        gap: 12px;
        padding-inline: 13px;
    }

    .ngps-media-editor__quick-actions {
        grid-template-columns: minmax(180px, 220px) repeat(3, minmax(64px, 1fr));
        padding-inline: 13px;
    }
}

@media (min-width: 1101px) {
    .ngps-media-editor {
        width: min(1600px, calc(100vw - 16px));
    }

    .ngps-media-editor__body {
        display: grid;
        grid-template-columns: minmax(480px, .9fr) minmax(680px, 1.1fr);
        align-items: start;
        gap: 18px;
        padding: 18px;
    }

    .ngps-media-canvas-wrap {
        position: sticky;
        top: 0;
        width: 100%;
        min-height: min(660px, calc(94dvh - 190px));
        margin: 0;
        padding: 20px;
    }

    .ngps-media-canvas-wrap canvas {
        width: min(100%, 760px);
        max-height: calc(94dvh - 235px);
    }

    .ngps-media-editor__body aside {
        width: 100%;
        margin: 0;
    }
}

@media (min-width: 1101px) and (max-width: 1280px) {
    .ngps-media-editor__body {
        grid-template-columns: minmax(400px, .85fr) minmax(590px, 1.15fr);
    }

    .ngps-media-editor__body aside > .ngps-field,
    .ngps-media-editor__body aside > .ngps-checkbox-line,
    .ngps-watermark-positions,
    .ngps-creative-tools > div > .ngps-field,
    .ngps-creative-tools > div > .ngps-checkbox-line {
        grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
        gap: 14px;
    }

    .ngps-media-editor__quick-actions {
        grid-template-columns: minmax(200px, 250px) repeat(3, minmax(74px, 1fr));
    }
}

.ngps-preview-item img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.ngps-preview-item span {
    display: block;
    overflow: hidden;
    padding: 6px 7px 2px;
    color: var(--ngps-ink-soft);
    font-size: 8.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ngps-preview-item small {
    display: block;
    padding: 0 7px 6px;
    color: var(--ngps-muted);
    font-size: 8px;
}
