/* Native Tools - Image Editor module CSS
 * Loaded only with /js/tools/modules/image-editor.js.
 */

.native-image-editor-card {
    display: grid;
    gap: 12px;
}


.native-image-drop {
    min-height: 120px;
}


.native-image-toolbar .native-tools-btn.is-active,
.native-image-toolbar .native-tools-btn[aria-pressed="true"] {
    border-color: rgba(233, 166, 36, .85) !important;
    box-shadow: 0 0 0 3px rgba(233, 166, 36, .16) !important;
}


body.light-mode .native-image-toolbar .native-tools-btn.is-active,
body.light-mode .native-image-toolbar .native-tools-btn[aria-pressed="true"],
html.light-mode body .native-image-toolbar .native-tools-btn.is-active,
html.light-mode body .native-image-toolbar .native-tools-btn[aria-pressed="true"] {
    border-color: rgba(0, 0, 0, .55) !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .10) !important;
}



@media (max-width: 820px) {

    .native-extra-two-col,
    .native-image-controls {
        grid-template-columns: minmax(0, 1fr);
    }
}


.native-image-controls {
    grid-template-columns: minmax(120px, 160px) minmax(120px, 160px) minmax(220px, 1fr);
    gap: 14px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--tools-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .035);
}


.native-image-controls label {
    margin: 0 0 6px 0;
    font-weight: 900;
    color: var(--tools-text);
}


.native-image-controls input[type="color"] {
    width: 100%;
    height: 44px;
    padding: 5px;
    border-radius: 12px;
}


.native-image-controls input[type="number"],
.native-image-controls input[type="text"] {
    margin: 0;
}


.native-image-text-object:focus {
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(233, 166, 36, .18);
    background: rgba(0, 0, 0, .32);
}


body.light-mode .native-sid-card,
html.light-mode body .native-sid-card,
body.light-mode .native-image-controls,
html.light-mode body .native-image-controls,
body.light-mode #native-tools-content[data-current-tool="aspect-ratio"] .native-extra-grid,
html.light-mode body #native-tools-content[data-current-tool="aspect-ratio"] .native-extra-grid,
body.light-mode #native-tools-content[data-current-tool="resolution-scaler"] .native-extra-grid,
html.light-mode body #native-tools-content[data-current-tool="resolution-scaler"] .native-extra-grid {
    background: #ffffff;
    border-color: rgba(0, 0, 0, .14);
}


@media (max-width: 900px) {

    .native-image-controls,
    #native-tools-content[data-current-tool="aspect-ratio"] .native-extra-grid,
    #native-tools-content[data-current-tool="resolution-scaler"] .native-extra-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* =========================================================
   Native Tools - Image Editor Toolbar Text Overlay Rework
   ========================================================= */

.native-image-editor-card {
    overflow: visible;
}


.native-image-toolbar {
    position: sticky;
    top: 8px;
    z-index: 50;
    border: 1px solid var(--tools-border);
    border-radius: 14px;
    background: rgba(38, 38, 38, .94);
    backdrop-filter: blur(12px);
}


.native-image-toolbar-tools,
.native-image-toolbar-actions,
.native-image-toolbar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}


.native-image-toolbar .native-tools-btn {
    min-height: 34px;
    padding: 7px 10px;
}


.native-image-toolbar .native-tools-btn.is-active,
.native-image-toolbar .native-tools-btn.active,
.native-image-toolbar .native-tools-btn[aria-pressed="true"] {
    background: var(--tools-accent) !important;
    color: #000000 !important;
    border-color: var(--tools-accent) !important;
    box-shadow: 0 0 0 3px rgba(233, 166, 36, .18) !important;
}


.native-image-inline-control {
    display: inline-grid;
    grid-template-columns: auto auto;
    gap: 8px;
    align-items: center;
    margin: 0;
    color: var(--tools-text);
    font-weight: 900;
    white-space: nowrap;
}


.native-image-inline-control span {
    font-weight: 900;
    color: var(--tools-text);
}


.native-image-inline-control input[type="color"] {
    width: 46px;
    height: 34px;
    min-width: 46px;
    padding: 3px;
    margin: 0;
    border-radius: 10px;
}


.native-image-size-control input {
    width: 70px;
    height: 34px;
    margin: 0;
    text-align: center;
}


.native-image-controls {
    display: none;
}


.native-image-canvas-wrap {
    min-height: 0 !important;
    margin-top: 14px;
    border: 1px solid var(--tools-border);
    border-radius: 14px;
    background:
        linear-gradient(45deg, rgba(255, 255, 255, .08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, .08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, .08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, .08) 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}


.native-image-canvas-wrap canvas {
    background: transparent;
    cursor: crosshair;
}


.native-image-text-toolbar {
    position: sticky;
    top: 72px;
    z-index: 55;
    margin: 10px 0;
    padding: 8px;
    border: 1px solid rgba(233, 166, 36, .45);
    border-radius: 14px;
    background: rgba(20, 20, 20, .96);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
}


.native-image-text-tool-btn {
    min-width: 34px;
    height: 34px;
    border: 1px solid var(--tools-border);
    border-radius: 10px;
    background: #050505;
    color: #ffffff;
    font-weight: 950;
    cursor: pointer;
}


.native-image-text-tool-btn:hover,
.native-image-text-tool-btn:focus-visible {
    border-color: var(--tools-accent);
}


.native-image-text-delete {
    color: #ff7777;
}


.native-image-text-toolbar select,
.native-image-text-toolbar input[type="number"],
.native-image-text-toolbar input[type="color"] {
    margin: 0;
}


.native-image-text-toolbar input[type="color"] {
    padding: 3px;
    border-radius: 10px;
}


.native-image-text-object {
    position: absolute;
    min-width: 42px;
    min-height: 24px;
    padding: 3px 6px;
    border: 1px dashed rgba(233, 166, 36, .75);
    border-radius: 6px;
    background: rgba(0, 0, 0, .18);
    font-weight: 900;
    line-height: 1.15;
    cursor: move;
    user-select: text;
    outline: none;
    z-index: 5;
}


body.light-mode .native-image-toolbar,
html.light-mode body .native-image-toolbar {
    background: rgba(255, 255, 255, .96);
    border-color: rgba(0, 0, 0, .14);
}


body.light-mode .native-image-toolbar .native-tools-btn.is-active,
body.light-mode .native-image-toolbar .native-tools-btn.active,
body.light-mode .native-image-toolbar .native-tools-btn[aria-pressed="true"],
html.light-mode body .native-image-toolbar .native-tools-btn.is-active,
html.light-mode body .native-image-toolbar .native-tools-btn.active,
html.light-mode body .native-image-toolbar .native-tools-btn[aria-pressed="true"] {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
    box-shadow: none !important;
}


body.light-mode .native-image-text-toolbar,
html.light-mode body .native-image-text-toolbar {
    border-color: rgba(0, 0, 0, .24);
}


body.light-mode .native-image-text-tool-btn,
html.light-mode body .native-image-text-tool-btn {
    background: #ffffff;
    color: #000000;
    border-color: rgba(0, 0, 0, .18);
}


body.light-mode .native-image-text-delete,
html.light-mode body .native-image-text-delete {
    color: #b00020;
}


body.light-mode .native-image-text-object,
html.light-mode body .native-image-text-object {
    background: rgba(255, 255, 255, .65);
}


@media (max-width: 1150px) {
    .native-image-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }


    .native-image-toolbar-controls,
    .native-image-toolbar-actions {
        justify-content: flex-start;
    }
}


/* =========================================================
   Native Tools - Image Editor Selection Persistence Rework
   ========================================================= */

/* Werkzeugleiste darf auf schmalen/hochkantigen Monitoren nicht abschneiden */
#native-tools-content[data-current-tool="image-editor"] {
    overflow: auto;
    max-width: 100%;
}


#native-tools-content[data-current-tool="image-editor"] .native-image-editor-tool,
#native-tools-content[data-current-tool="image-editor"] .native-image-editor-card {
    min-width: 0;
    max-width: 100%;
}


.native-image-toolbar {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
}


.native-image-toolbar-tools,
.native-image-toolbar-controls,
.native-image-toolbar-actions {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}


.native-image-toolbar-tools .native-tools-btn,
.native-image-toolbar-actions .native-tools-btn {
    flex: 0 0 auto;
}


/* Kontext-/Texttoolbar als möglichst kompakter Einzeiler */
.native-image-text-toolbar {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    width: 100%;
    box-sizing: border-box;
}


.native-image-text-toolbar[hidden] {
    display: none !important;
}


.native-image-text-toolbar>* {
    flex: 0 0 auto;
}


.native-image-text-toolbar input[type="number"] {
    width: 72px;
    min-width: 72px;
}


.native-image-text-toolbar input[type="color"] {
    width: 42px;
    min-width: 42px;
}


/* Bild nicht in interner Scrollbox verstecken */
.native-image-canvas-wrap {
    max-height: none !important;
}


/* Textobjekte bleiben auswählbar und editierbar */
.native-image-text-object {
    white-space: pre-wrap;
    max-width: none;
}


/* Lightmode konsistent */
body.light-mode .native-image-text-toolbar,
html.light-mode body .native-image-text-toolbar {
    background: rgba(255, 255, 255, .98);
}


@media (max-width: 900px) {


    .native-image-toolbar-controls,
    .native-image-toolbar-actions {
        justify-content: flex-start;
        width: 100%;
    }


    .native-image-inline-control {
        flex: 0 0 auto;
    }
}


/* =========================================================
   Native Tools - Image Editor Sticky Controls Performance Fix
   ========================================================= */

/* Schriftart-Dropdown war vertikal angeschnitten */


.native-image-text-toolbar select,
.native-image-text-toolbar input[type="number"],
.native-image-text-toolbar input[type="color"] {
    padding-top: 0;
    padding-bottom: 0;
}


.native-image-text-toolbar select {
    padding-left: 12px;
    padding-right: 34px;
}


/* JS-Fallback für echtes Sticky, auch wenn ein Parent ein Scroll-Container ist */


/* Toolbar darf nicht mehr durch Kartenbreite abgeschnitten werden */
#native-tools-content[data-current-tool="image-editor"] .native-image-toolbar,
#native-tools-content[data-current-tool="image-editor"] .native-image-text-toolbar {
    max-width: calc(100vw - 16px);
}


/* Colorpicker nicht live re-rendern: optisch trotzdem direkt und leicht bedienbar */
.native-image-text-toolbar input[type="color"],
.native-image-inline-control input[type="color"] {
    cursor: pointer;
    flex: 0 0 auto;
}


/* Hochkant/schmal: Kontrollen bleiben nutzbar statt abgeschnitten */



/* =========================================================
   Native Tools - Image Editor Sticky Formatting Resize Center Fix
   ========================================================= */

/* Bei wenig Platz mehrzeilig statt horizontal abgeschnitten/gescrollt */


.native-image-toolbar-tools,
.native-image-toolbar-controls,
.native-image-toolbar-actions,
.native-image-text-toolbar {
    flex-wrap: wrap;
    white-space: normal;
}


/* Fixed-Sticky Fallback für interne Content-Scrollcontainer */
.native-image-toolbar.is-fixed-sticky,
.native-image-text-toolbar.is-fixed-sticky {
    position: fixed !important;
    right: auto !important;
    box-sizing: border-box !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38) !important;
}


/* Kontextmenü nicht abschneiden */
.native-image-text-toolbar {
    padding-top: 7px;
    padding-bottom: 7px;
}


/* Bildfläche zentrieren, keine interne Scrollbox */
.native-image-canvas-wrap {
    width: max-content !important;
}


.native-image-canvas-wrap canvas {
    display: block;
    max-width: none !important;
    width: auto !important;
    height: auto !important;
}


/* Auflösungsinfo */
.native-image-resolution {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 10;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .68);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, .18);
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 12px;
    pointer-events: none;
}


/* Resize-Handles am Rand */


.native-image-resize-x {
    top: 50%;
    right: -7px;
    width: 14px;
    height: 54px;
    transform: translateY(-50%);
    cursor: ew-resize;
    border-radius: 8px;
}


.native-image-resize-y {
    left: 50%;
    bottom: -7px;
    width: 54px;
    height: 14px;
    transform: translateX(-50%);
    cursor: ns-resize;
    border-radius: 8px;
}


.native-image-resize-xy {
    right: -8px;
    bottom: -8px;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    border-radius: 6px;
}


.native-image-resize-xy::after {
    content: "";
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
}


.native-image-text-object.is-selected,
.native-image-text-object:focus {
    z-index: 20;
}


body.light-mode .native-image-resolution,
html.light-mode body .native-image-resolution {
    background: rgba(255, 255, 255, .88);
    color: #000000;
    border-color: rgba(0, 0, 0, .16);
}


body.light-mode .native-image-resize-handle,
html.light-mode body .native-image-resize-handle {
    border-color: #000000;
    background: #000000;
}


body.light-mode .native-image-resize-xy::after,
html.light-mode body .native-image-resize-xy::after {
    border-color: #ffffff;
}


@media (max-width: 900px) {


    .native-image-toolbar-tools,
    .native-image-toolbar-controls,
    .native-image-toolbar-actions,
    .native-image-text-toolbar {
        width: 100%;
        max-width: 100%;
    }
}


/* =========================================================
   Native Tools - Image Editor Real Formatting Sticky Width Fix
   ========================================================= */

/*
   Werkzeugleiste war viel zu breit, weil sie als Grid mit 1fr-Spalte lief.
   Jetzt ist sie eine kompakte Flex-Leiste, die bei wenig Platz mehrzeilig wird.
*/


.native-image-toolbar-tools,
.native-image-toolbar-controls,
.native-image-toolbar-actions {
    white-space: normal;
}


.native-image-toolbar.is-fixed-sticky {
    position: fixed !important;
    right: auto !important;
    z-index: 10050 !important;
    width: min(1100px, calc(100vw - 16px)) !important;
    max-width: calc(100vw - 16px) !important;
    box-sizing: border-box !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38) !important;
}


/* Text-Kontextleiste ebenfalls mehrzeilig statt abgeschnitten */
.native-image-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    overflow: visible;
    white-space: normal;
    max-width: min(1100px, 100%);
    min-height: 50px;
}


.native-image-text-toolbar.is-fixed-sticky {
    position: fixed !important;
    right: auto !important;
    z-index: 10055 !important;
    width: min(1100px, calc(100vw - 16px)) !important;
    max-width: calc(100vw - 16px) !important;
    box-sizing: border-box !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38) !important;
}


/* Select war unten abgeschnitten */
.native-image-text-toolbar select,
.native-image-text-toolbar input[type="number"],
.native-image-text-toolbar input[type="color"] {
    height: 40px;
    min-height: 40px !important;
    line-height: 38px;
    box-sizing: border-box;
}


.native-image-text-toolbar select {
    width: 150px;
    min-width: 150px;
    padding-top: 0;
    padding-bottom: 0;
}


/* Bild bleibt zentriert */


/* Sticky-Abstand nur solange fixed */
.native-image-editor-card.has-fixed-image-toolbar {
    padding-top: calc(var(--image-toolbar-fixed-offset, 0px) + 12px);
}


/* Toolbar-Controls sollen Werte nicht über aggressive Theme-Regeln verlieren */


@media (max-width: 900px) {

    .native-image-toolbar,
    .native-image-text-toolbar {
        width: 100%;
        max-width: 100%;
    }
}


/* =========================================================
   Native Tools - Image Editor Dynamic Toolbar Canvas Fill Fix
   ========================================================= */

/* Dynamische Leistenbreite: kein fester 1100px-Deckel mehr */
.native-image-toolbar,
.native-image-text-toolbar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}


.native-image-toolbar.is-fixed-sticky,
.native-image-text-toolbar.is-fixed-sticky {
    width: var(--native-image-sticky-width, calc(100vw - 16px)) !important;
    max-width: var(--native-image-sticky-width, calc(100vw - 16px)) !important;
}


/* Werkzeuge als Icon-Buttons statt Textbuttons */
.native-image-tool-icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 18px;
}


.native-image-tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", system-ui, sans-serif;
    font-weight: 950;
}


.native-image-tool-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* Text-Werkzeug als klares T */
.native-image-tool-icon-btn[data-tool-action="image-tool-text"] .native-image-tool-icon {
    font-family: system-ui, sans-serif;
    font-weight: 1000;
    font-size: 18px;
}


/* Linie sauber lesbar */
.native-image-tool-icon-btn[data-tool-action="image-tool-line"] .native-image-tool-icon,
.native-image-tool-icon-btn[data-tool-action="image-tool-rect"] .native-image-tool-icon,
.native-image-tool-icon-btn[data-tool-action="image-tool-circle"] .native-image-tool-icon,
.native-image-tool-icon-btn[data-tool-action="image-tool-fill"] .native-image-tool-icon,
.native-image-tool-icon-btn[data-tool-action="image-tool-pixelate"] .native-image-tool-icon,
.native-image-tool-icon-btn[data-tool-action="image-tool-transparent"] .native-image-tool-icon {
    font-family: system-ui, sans-serif;
}


/* Toolbar darf mehrzeilig werden und bleibt in der berechneten Breite */
.native-image-toolbar,
.native-image-toolbar-tools,
.native-image-toolbar-controls,
.native-image-toolbar-actions,
.native-image-text-toolbar {
    overflow: visible;
}


/* Bildfläche bleibt zentriert, Resize-Handles bleiben sichtbar */


/* Auflösung/Griffe nicht von Theme-Regeln verstecken lassen */
.native-image-resolution,
.native-image-resize-handle {
    user-select: none;
}


/* =========================================================
   Native Tools - Image Editor Navbar Shape Resolution Bg Patch
   ========================================================= */

/* Sticky-Leisten dürfen nicht hinter der Nav-Bar verschwinden */
.native-image-toolbar.is-fixed-sticky,
.native-image-text-toolbar.is-fixed-sticky {
    z-index: 420024 !important;
}


/* Aktive Werkzeuge: Dark = schwarz, Light = weiß, kein gelber Background */
html:not(.light-mode) body:not(.light-mode) .native-image-toolbar .native-image-tool-icon-btn.is-active,
html:not(.light-mode) body:not(.light-mode) .native-image-toolbar .native-image-tool-icon-btn.active,
html:not(.light-mode) body:not(.light-mode) .native-image-toolbar .native-image-tool-icon-btn[aria-pressed="true"],
body:not(.light-mode) .native-image-toolbar .native-image-tool-icon-btn.is-active,
body:not(.light-mode) .native-image-toolbar .native-image-tool-icon-btn.active,
body:not(.light-mode) .native-image-toolbar .native-image-tool-icon-btn[aria-pressed="true"] {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: var(--tools-accent) !important;
    box-shadow: 0 0 0 2px rgba(233, 166, 36, .32) !important;
}


html.light-mode body .native-image-toolbar .native-image-tool-icon-btn.is-active,
html.light-mode body .native-image-toolbar .native-image-tool-icon-btn.active,
html.light-mode body .native-image-toolbar .native-image-tool-icon-btn[aria-pressed="true"],
body.light-mode .native-image-toolbar .native-image-tool-icon-btn.is-active,
body.light-mode .native-image-toolbar .native-image-tool-icon-btn.active,
body.light-mode .native-image-toolbar .native-image-tool-icon-btn[aria-pressed="true"] {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .12) !important;
}


/* Neue Toolbar-Felder */
.native-image-shape-control select,
.native-image-resolution-control input {
    height: 34px;
    min-height: 34px;
    margin: 0;
}


.native-image-shape-control select {
    width: 105px;
    min-width: 105px;
}


.native-image-resolution-control input {
    text-align: center;
    font-family: Consolas, Monaco, "Courier New", monospace;
}


/* Auflösungsinfo ist jetzt in der Toolbar, nicht mehr auf dem Bild */
.native-image-resolution {
    display: none;
}


/* Background-Remove-Button als Icon-Action */
.native-image-action-icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 18px;
}


/* Leisten umbrechen weiterhin dynamisch */
.native-image-toolbar,
.native-image-toolbar-tools,
.native-image-toolbar-controls,
.native-image-toolbar-actions,
.native-image-text-toolbar {
    flex-wrap: wrap;
    white-space: normal;
}




/* =========================================================
   Native Tools - Image Editor follow-up patch
   ========================================================= */

/* Alle Werkzeug-Icons bekommen den Modus-Hintergrund, aktiv nur Glow */
body:not(.light-mode) .native-image-toolbar .native-image-tool-icon-btn,
html:not(.light-mode) body .native-image-toolbar .native-image-tool-icon-btn {
    background: #000000;
    color: #ffffff;
    border-color: rgba(233, 166, 36, .28);
}


body.light-mode .native-image-toolbar .native-image-tool-icon-btn,
html.light-mode body .native-image-toolbar .native-image-tool-icon-btn {
    background: #ffffff;
    color: #000000;
    border-color: rgba(0, 0, 0, .18);
}


body .native-image-toolbar .native-image-tool-icon-btn.is-active,
body .native-image-toolbar .native-image-tool-icon-btn[aria-pressed="true"] {
    box-shadow: 0 0 0 2px rgba(233, 166, 36, .28), 0 0 18px rgba(233, 166, 36, .38) !important;
    border-color: rgba(233, 166, 36, .85) !important;
}


.native-image-toolbar-controls,
.native-image-toolbar-actions,
.native-image-toolbar-tools,
.native-image-text-toolbar {
    row-gap: 8px;
}


.native-image-canvas-wrap canvas,
.native-image-text-object {
    will-change: transform;
}


.native-image-text-toolbar select,
.native-image-text-toolbar input[type="number"],
.native-image-text-toolbar input[type="color"] {
    max-width: 100%;
}


.native-image-text-toolbar #tool-image-text-toolbar-border-style {
    min-width: 120px;
}


.native-image-text-object {
    border-width: 1px;
}


@media (max-width: 1100px) {
    .native-image-toolbar {
        grid-template-columns: 1fr;
    }


    .native-image-toolbar-tools,
    .native-image-toolbar-controls,
    .native-image-toolbar-actions,
    .native-image-text-toolbar {
        width: 100%;
        max-width: 100%;
    }
}



/* =========================================================
   Native Tools - Image Editor Crop Grabber Fix
   ========================================================= */

.native-image-canvas-wrap {
    position: relative;
    overflow: visible !important;
    display: block;
}


.native-image-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    border-radius: 14px;
}


.native-image-viewport canvas {
    position: absolute;
    left: 0 !important;
    top: 0 !important;
    max-width: none;
    width: auto !important;
    height: auto !important;
    transform-origin: 0 0 !important;
}


.native-image-viewport .native-image-text-object {
    transform-origin: 0 0 !important;
}


.native-image-resize-handle {
    position: absolute;
    z-index: 30;
    border: 1px solid rgba(233, 166, 36, .95) !important;
    background: rgba(233, 166, 36, .95) !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .24) !important;
    padding: 0;
    margin: 0;
}


.native-image-resize-left,
.native-image-resize-right {
    top: 50%;
    width: 14px;
    height: 56px;
    transform: translateY(-50%);
    cursor: ew-resize;
    border-radius: 8px;
}


.native-image-resize-left {
    left: -8px;
}


.native-image-resize-right {
    right: -8px;
}


.native-image-resize-top,
.native-image-resize-bottom {
    left: 50%;
    width: 56px;
    height: 14px;
    transform: translateX(-50%);
    cursor: ns-resize;
    border-radius: 8px;
}


.native-image-resize-top {
    top: -8px;
}


.native-image-resize-bottom {
    bottom: -8px;
}


.native-image-resize-tl,
.native-image-resize-tr,
.native-image-resize-bl,
.native-image-resize-br {
    width: 18px;
    height: 18px;
    border-radius: 6px;
}


.native-image-resize-tl {
    left: -9px;
    top: -9px;
    cursor: nwse-resize;
}


.native-image-resize-tr {
    right: -9px;
    top: -9px;
    cursor: nesw-resize;
}


.native-image-resize-bl {
    left: -9px;
    bottom: -9px;
    cursor: nesw-resize;
}


.native-image-resize-br {
    right: -9px;
    bottom: -9px;
    cursor: nwse-resize;
}


.native-image-resize-x,
.native-image-resize-y,
.native-image-resize-xy {
    display: none;
}


.native-image-resolution-control input {
    width: 170px;
    min-width: 170px;
}


.native-image-text-object {
    border-color: currentColor;
}


#tool-image-text-toolbar-border-style {
    min-width: 124px;
}



/* =========================================================
   Native Tools - Image Editor Transparent/Original Pen Patch
   ========================================================= */



/* =========================================================
   Native Tools - Image Editor Transparent/Original Pen V2
   ========================================================= */

.native-image-tool-icon-btn[data-tool-action="image-tool-transparent-pen"] .native-image-tool-icon,
.native-image-tool-icon-btn[data-tool-action="image-tool-restore-original"] .native-image-tool-icon {
    font-family: system-ui, sans-serif;
    font-weight: 1000;
}


.native-image-tool-icon-btn[data-tool-action="image-tool-restore-original"] {
    border-style: dashed;
}


/* =========================================================
   Native Tools - Image Editor FLAT Toolbar Fix
   ========================================================= */

/*
   Keine Grid-Hacks. Keine Gruppenbreiten. Keine Canvas-Scroll-Änderung.
   Die drei Wrapper werden mit display: contents flach gemacht.
   Dadurch stehen alle Buttons/Controls als direkte Flex-Items in EINER
   natürlichen Werkzeugleiste und brechen nur um, wenn wirklich kein Platz ist.
*/

.native-image-toolbar {
    align-content: flex-start;
}


/* Wrapper neutralisieren: Kinder werden direkte Toolbar-Items */


/* Alle Icon-Buttons einheitlich klein */
.native-image-toolbar .native-image-tool-icon-btn,
.native-image-toolbar .native-image-action-icon-btn,
.native-image-toolbar .native-image-toolbar-action-icon {
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    height: 34px;
    min-height: 34px;
    max-height: 34px;
    padding: 0;
    flex: 0 0 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}


/* Actionbuttons bleiben Icons, nie Textbuttons */
.native-image-toolbar .native-image-action-icon-btn,
.native-image-toolbar .native-image-toolbar-action-icon {
    font-size: 0;
    overflow: hidden;
}


.native-image-toolbar .native-image-action-icon-btn .native-image-tool-icon,
.native-image-toolbar .native-image-toolbar-action-icon .native-image-tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 20px;
    line-height: 1;
    font-family: system-ui, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-weight: 1000;
    color: inherit;
}


.native-image-toolbar .native-image-action-icon-btn .native-image-tool-label,
.native-image-toolbar .native-image-toolbar-action-icon .native-image-tool-label {
    position: absolute;
    width: 1px;
    min-width: 1px;
    max-width: 1px !important;
    height: 1px;
    min-height: 1px;
    max-height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}


/* Controls kompakt: Label direkt neben Feld */
.native-image-toolbar .native-image-inline-control {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 5px;
    margin: 0;
    width: auto;
    overflow: visible;
}


.native-image-toolbar .native-image-inline-control>span {
    display: inline-block;
    width: auto;
    min-width: max-content;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
}


/* Felder bewusst kurz halten */
.native-image-toolbar .native-image-inline-control input[type="color"] {
    width: 38px;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 2px;
    margin: 0;
}


.native-image-toolbar .native-image-size-control input {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    height: 32px;
    min-height: 32px !important;
    max-height: 32px;
    padding: 4px 6px;
    margin: 0;
    text-align: center;
}


.native-image-toolbar .native-image-shape-control select {
    width: 86px;
    min-width: 86px;
    max-width: 86px;
    height: 32px;
    min-height: 32px !important;
    max-height: 32px;
    padding: 4px 8px;
    margin: 0;
}


.native-image-toolbar .native-image-draw-surface-control select,
.native-image-toolbar #tool-image-draw-surface-mode {
    width: 118px;
    min-width: 118px;
    max-width: 118px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 4px 8px;
    margin: 0;
}


.native-image-toolbar .native-image-resolution-control input {
    width: 118px;
    min-width: 118px;
    max-width: 118px;
    height: 32px;
    min-height: 32px !important;
    max-height: 32px;
    padding: 4px 8px;
    margin: 0;
}


/*
   Drop-Feld: gleiche sichtbare Breite wie die Toolbar/Card.
   Keine min-content-Überbreite.
*/
.native-tools-card:has(.native-image-toolbar),
.native-tools-card:has(#tool-image-drop) {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}


#tool-image-drop,
.native-image-drop,
.native-image-dropzone,
.native-image-drop-area,
.native-image-upload-area,
.native-image-upload {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    inline-size: 100%;
    max-inline-size: 100%;
    box-sizing: border-box;
    overflow: hidden;
}


#tool-image-drop *,
.native-image-drop *,
.native-image-dropzone *,
.native-image-drop-area *,
.native-image-upload-area * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
}


/* Keine eigene Bild-Scroll-Änderung. Bestehendes Verhalten bleibt. */


/* =========================================================
   Native Tools - Image Editor Dropzone Width + Transparent != Modified
   ========================================================= */

/*
   Dropzone exakt an die verfügbare Card-/Toolbar-Breite binden.
   Keine künstliche Mindestbreite und kein Überlaufen nach rechts.
*/
.native-image-editor-tool,
.native-image-editor-tool .native-tools-card,
.native-image-editor-tool .native-tools-card-body,
.native-image-editor-tool .native-extra-tool,
.native-image-editor-tool .native-image-editor-card,
.native-image-editor-tool .native-image-drop,
.native-image-editor-tool #tool-image-drop {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}


.native-image-editor-tool #tool-image-drop,
.native-image-editor-tool .native-image-drop,
.native-image-editor-tool .native-tools-file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    inline-size: 100%;
    max-width: 100%;
    max-inline-size: 100%;
    min-width: 0;
    flex: 0 1 auto;
    align-self: stretch;
    overflow: hidden;
    margin-left: 0;
    margin-right: 0;
}


.native-image-editor-tool #tool-image-drop *,
.native-image-editor-tool .native-image-drop *,
.native-image-editor-tool .native-tools-file-dropzone * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
}


/* Toolbar und Dropzone am selben Inhaltsmaß ausrichten */
.native-image-editor-tool .native-image-toolbar,
.native-image-editor-tool #tool-image-drop {
    width: 100%;
    max-width: 100%;
}



/* =========================================================
   Native Tools - Image Editor Mobile Sidebar + Touch Draw
   ========================================================= */

@media (pointer: coarse),
(max-width: 900px) {

    body.tools-page .native-tools-sidebar,
    body.tools-page .sidebar,
    body.tools-page #sidebar,
    body.tools-page .app-sidebar,
    body.tools-page .mobile-sidebar,
    body.tools-page .nav-sidebar {
        z-index: 420420 !important;
    }

    body.tools-page .sidebar-backdrop,
    body.tools-page #sidebar-backdrop,
    body.tools-page .mobile-sidebar-backdrop,
    body.tools-page .nav-backdrop {
        z-index: 420419 !important;
    }

    body.tools-page.sidebar-open .native-image-toolbar,
    body.tools-page.sidebar-open .native-image-text-toolbar,
    body.tools-page.nav-open .native-image-toolbar,
    body.tools-page.nav-open .native-image-text-toolbar,
    body.tools-page.menu-open .native-image-toolbar,
    body.tools-page.menu-open .native-image-text-toolbar,
    html.sidebar-open body.tools-page .native-image-toolbar,
    html.sidebar-open body.tools-page .native-image-text-toolbar,
    html.nav-open body.tools-page .native-image-toolbar,
    html.nav-open body.tools-page .native-image-text-toolbar,
    html.menu-open body.tools-page .native-image-toolbar,
    html.menu-open body.tools-page .native-image-text-toolbar,
    html[data-menu="open"] body.tools-page .native-image-toolbar,
    html[data-menu="open"] body.tools-page .native-image-text-toolbar {
        pointer-events: none;
        z-index: 1;
    }
}


/* Touch-Zeichnen Button: Desktop ausblenden, Mobile anzeigen */
.native-image-touch-draw-toggle {
    display: none !important;
}


@media (pointer: coarse),
(max-width: 900px) {
    .native-image-touch-draw-toggle {
        display: inline-flex !important;
    }


    body.tools-page.native-image-touch-draw-disabled #tool-image-canvas {
        touch-action: pan-y !important;
        cursor: default !important;
    }


    body.tools-page.native-image-touch-draw-enabled #tool-image-canvas {
        touch-action: none !important;
    }


    .native-image-touch-draw-toggle.is-active,
    .native-image-touch-draw-toggle[aria-pressed="true"] {
        outline: 2px solid var(--tools-accent, #e9a624) !important;
        box-shadow: 0 0 0 3px rgba(233, 166, 36, .22) !important;
    }
}



/* =========================================================
   Native Tools - Mobile Sidebar Tap Fix
   ========================================================= */

/*
   Fix:
   Sidebar liegt nicht nur optisch oben, sondern fängt Touch/Klicks auch wirklich.
   Backdrop/Content bleiben darunter. Image-Editor-Leisten dürfen die Sidebar
   nicht überdecken und bekommen keine Pointer-Events, sobald eine Sidebar offen ist.
*/
@media (pointer: coarse),
(max-width: 900px) {

    body.tools-page .native-tools-sidebar,
    body.tools-page #sidebar,
    body.tools-page .sidebar,
    body.tools-page .app-sidebar,
    body.tools-page .mobile-sidebar,
    body.tools-page .nav-sidebar,
    body.tools-page [data-sidebar],
    body.tools-page [data-mobile-sidebar] {
        position: fixed !important;
        z-index: 2147483647 !important;
        pointer-events: auto !important;
        touch-action: pan-y !important;
        isolation: isolate !important;
    }

    body.tools-page .sidebar-backdrop,
    body.tools-page #sidebar-backdrop,
    body.tools-page .mobile-sidebar-backdrop,
    body.tools-page .nav-backdrop,
    body.tools-page [data-sidebar-backdrop],
    body.tools-page [data-mobile-sidebar-backdrop] {
        z-index: 2147483646 !important;
        pointer-events: auto !important;
    }

    body.tools-page .native-image-toolbar,
    body.tools-page .native-image-toolbar.is-fixed-sticky,
    body.tools-page .native-image-text-toolbar,
    body.tools-page .native-image-text-toolbar.is-fixed-sticky {
        z-index: 20 !important;
    }

    body.tools-page.sidebar-open .native-image-toolbar,
    body.tools-page.sidebar-open .native-image-text-toolbar,
    body.tools-page.nav-open .native-image-toolbar,
    body.tools-page.nav-open .native-image-text-toolbar,
    body.tools-page.menu-open .native-image-toolbar,
    body.tools-page.menu-open .native-image-text-toolbar,
    html.sidebar-open body.tools-page .native-image-toolbar,
    html.sidebar-open body.tools-page .native-image-text-toolbar,
    html.nav-open body.tools-page .native-image-toolbar,
    html.nav-open body.tools-page .native-image-text-toolbar,
    html.menu-open body.tools-page .native-image-toolbar,
    html.menu-open body.tools-page .native-image-text-toolbar,
    html[data-menu="open"] body.tools-page .native-image-toolbar,
    html[data-menu="open"] body.tools-page .native-image-text-toolbar,
    body.tools-page:has(.native-tools-sidebar.is-open) .native-image-toolbar,
    body.tools-page:has(.native-tools-sidebar.is-open) .native-image-text-toolbar,
    body.tools-page:has(.native-tools-sidebar.open) .native-image-toolbar,
    body.tools-page:has(.native-tools-sidebar.open) .native-image-text-toolbar,
    body.tools-page:has(.native-tools-sidebar.active) .native-image-toolbar,
    body.tools-page:has(.native-tools-sidebar.active) .native-image-text-toolbar {
        pointer-events: none !important;
        z-index: 1 !important;
    }
}


/* =========================================================
   Native Tools - Image Editor Zoom Slider
   ========================================================= */


@media (max-width: 760px) {
    .native-image-zoom-control {
        flex: 1 1 220px;
        width: 100%;
        max-width: 100%;
    }


    .native-image-zoom-control input[type="range"] {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
    }
}


/* =========================================================
   Native Tools - Image Editor Toolbar Fit + Default Canvas Fill
   ========================================================= */

/* Toolbar darf nicht mehr rechts aus dem Viewport laufen */
.native-image-editor-card,
.native-image-editor-tool,
.native-image-editor-card .native-tools-card {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}


.native-image-toolbar {
    min-width: 0;
    flex-wrap: wrap;
}


.native-image-toolbar-tools {
    flex: 1 1 520px;
}


.native-image-toolbar-controls {
    flex: 1 1 520px;
}


.native-image-toolbar-actions {
    flex: 0 1 auto;
}


.native-image-resolution-control {
    flex: 0 1 190px;
}


.native-image-resolution-control input {
    max-width: 132px;
}


/* Default-/Transparenzfläche bleibt innerhalb der Content-Area */
.native-image-canvas-wrap {
    box-sizing: border-box;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}


.native-image-canvas-wrap.is-default-fill {
    max-width: 100% !important;
}


.native-image-viewport {
    transform-origin: 0 0 !important;
    will-change: transform;
}


@media (max-width: 900px) {

    .native-image-toolbar-tools,
    .native-image-toolbar-controls,
    .native-image-toolbar-actions {
        flex: 1 1 100%;
    }


    .native-image-resolution-control,
    .native-image-zoom-control {
        flex: 1 1 220px;
        width: 100%;
        max-width: 100%;
    }
}


/* =========================================================
   Native Tools - Image Editor Toolbar Same Width As Canvas
   ========================================================= */

/*
   Die Toolbar darf exakt nur so breit wie der initiale Bildbereich sein.
   Die Breite wird zusätzlich per JS als Inline-Width gesetzt.
*/
.native-image-editor-tool .native-image-toolbar {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    overflow: hidden;
}


/*
   Wichtig:
   Die Toolbar-Gruppen dürfen umbrechen und dürfen keine Phantom-Breite erzwingen.
*/
.native-image-editor-tool .native-image-toolbar-tools,
.native-image-editor-tool .native-image-toolbar-controls,
.native-image-editor-tool .native-image-toolbar-actions {
    max-width: 100%;
    min-width: 0;
    width: auto;
    flex-wrap: wrap;
    overflow: visible;
}


.native-image-editor-tool .native-image-toolbar-controls {
    justify-content: flex-start;
}


.native-image-editor-tool .native-image-toolbar-actions {
    margin-left: 0;
}


/* Controls kompakter halten, damit sie innerhalb der Canvas-Breite bleiben */
.native-image-editor-tool .native-image-inline-control {
    min-width: 0;
}


.native-image-editor-tool .native-image-resolution-control {
    flex: 0 1 170px;
}


.native-image-editor-tool .native-image-resolution-control input {
    max-width: 118px;
}


.native-image-editor-tool .native-image-draw-surface-control {
    flex: 0 1 210px;
}


.native-image-editor-tool .native-image-draw-surface-control select {
    max-width: 145px;
}


.native-image-editor-tool .native-image-zoom-control {
    flex: 1 1 210px;
    min-width: 190px;
    max-width: 260px;
}


.native-image-editor-tool .native-image-zoom-control input[type="range"] {
    min-width: 80px !important;
    width: 105px;
    max-width: 120px !important;
}


/*
   Initiale transparente Fläche füllt den sichtbaren Bereich nach unten.
   Sie soll zentriert bleiben und niemals horizontal aus dem Content laufen.
*/
.native-image-editor-tool .native-image-canvas-wrap {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}


.native-image-editor-tool .native-image-canvas-wrap.is-default-fill {
    max-width: 100% !important;
}


@media (max-width: 900px) {
    .native-image-editor-tool .native-image-toolbar {
        width: 100%;
    }


    .native-image-editor-tool .native-image-toolbar-tools,
    .native-image-editor-tool .native-image-toolbar-controls,
    .native-image-editor-tool .native-image-toolbar-actions {
        flex: 1 1 100% !important;
    }
}


/* =========================================================
   Native Tools - Image Editor Final Width Discipline
   ========================================================= */

/*
   Finaler Ansatz:
   Die Toolbar wird nicht mehr als riesige eine-Zeile-Leiste behandelt.
   Sie bekommt exakt die Canvas-Breite und legt ihre Gruppen untereinander.
   Damit kann rechts nichts mehr ausbrechen.
*/


.native-image-toolbar-tools,
.native-image-toolbar-controls,
.native-image-toolbar-actions {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    overflow: hidden;
    margin: 0;
}


.native-image-toolbar-tools {
    grid-row: 1;
}


.native-image-toolbar-controls {
    grid-row: 2;
}


.native-image-toolbar-actions {
    grid-row: 3;
}


.native-image-toolbar .native-image-inline-control>span {
    flex: 0 0 auto;
}


/*
   Canvas-Bereich: minimal weniger breit als Content,
   damit Handles nicht rechts/links abgeschnitten werden.
*/


/* Auf kleineren Breiten bleibt alles sauber untereinander */
@media (max-width: 900px) {

    .native-image-toolbar-tools,
    .native-image-toolbar-controls,
    .native-image-toolbar-actions {
        overflow: visible;
    }

    .native-image-toolbar .native-image-inline-control,
    .native-image-zoom-control {
        flex: 1 1 220px;
    }
}


/* =========================================================
   Native Tools - Image Editor Exact Canvas Width + Max 2 Rows
   ========================================================= */

/*
   Final:
   - Toolbar bekommt exakt die Initial-Canvas-Breite per JS.
   - Layout maximal zweizeilig.
   - Zeile 1: Werkzeug-Icons links, Actions rechts.
   - Zeile 2: Controls.
   - Die umgebende Card darf optisch nicht wie eine riesige Toolbar wirken.
*/


.native-image-toolbar-controls {
    margin: 0;
}


/* Buttons wieder kompakt, damit Zeile 1 nicht unnötig groß wird */


/* Bei sehr vielen Icons bleiben sie optisch in Zeile 1 und brechen nicht in eine 3. Zeile.
   Overflow wird versteckt statt die Toolbar breiter zu machen. */
.native-image-toolbar-tools>* {
    flex: 0 0 auto;
}


/* Controls kompakt halten */
.native-image-toolbar .native-image-inline-control {
    max-width: 100%;
}


.native-image-toolbar #tool-image-color {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
}


.native-image-toolbar #tool-image-size {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
}


.native-image-toolbar #tool-image-shape {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
}


.native-image-toolbar #tool-image-draw-surface-mode {
    width: 135px;
    min-width: 120px;
    max-width: 135px;
}


.native-image-toolbar #tool-image-resolution-input {
    width: 112px;
    min-width: 105px;
    max-width: 112px;
}


/* Canvas nutzt exakt dieselbe Card-Innenbreite wie die Toolbar.
   Kein calc(100% - 36px) mehr. */


/* Äußere Cards dürfen niemals horizontal scrollen/überlaufen */


/* Auf schmaleren Displays weiterhin maximal 2 Zeilen,
   aber die Controls dürfen natürlich innerhalb Zeile 2 umbrechen. */



/* =========================================================
   Native Tools - Image Editor Exact Initial Width + Zoom Visible
   ========================================================= */

/*
   Bildbereich und Toolbar verwenden dieselbe gespeicherte Initialbreite.
   Die Toolbar darf nicht auf Card-Breite wachsen.
*/


/* Zoom explizit sichtbar und kompakt */


/* Canvas wieder mit dem sicheren Innenabzug, damit es nicht breiter wird als vorher */
.native-image-canvas-wrap,
.native-image-canvas-wrap.is-default-fill {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}





/* =========================================================
   Native Tools - Image Editor Image-Width Toolbar + Zoom Scroll
   ========================================================= */

/*
   1. Toolbar-Breite wird per JS aus der ECHT gerenderten Breite
      vom initialen Bildbereich gelesen.
   2. Canvas liegt in einem eigenen Scrollfenster.
      Beim Zoomen wird der Canvas größer, das Scrollfenster bleibt gleich breit.
*/

/* Scrollfenster für gezoomten Canvas */
.native-image-scroll {
    width: 100%;
}


/* Canvas selbst darf beim Zoom größer als das Scrollfenster werden */


/* Bei 100% bleibt der Bildbereich optisch wie bisher sauber eingepasst */
.native-image-scroll .native-image-canvas-wrap.is-default-fill {
    max-width: none !important;
}


/* Toolbar exakt auf JS-Breite halten */


/* Zeile 1: Tools links */


/* Zeile 1: Aktionen rechts */


/* Zeile 2: Controls inkl. Zoom */


.native-image-toolbar .native-image-inline-control {
    min-width: 0;
    flex: 0 1 auto;
    white-space: nowrap;
}


/* Zoom bleibt sichtbar und kompakt */


/* Äußere Card verhindert nur Seiten-Overflow, nicht den Canvas-Scroll */


/* Mobile darf auf 3 Zeilen fallen, Desktop bleibt bei 2 */



/* =========================================================
   Native Tools - Image Editor Toolbar Width = Dropzone Width
   ========================================================= */

/*
   Die Toolbar-Breite hängt jetzt ausschließlich an der Dropzone-Breite.
   Bildupload, Bildauflösung und Zoom dürfen die Toolbar nicht mehr schmaler machen.
*/
.native-image-toolbar,
.native-image-scroll {
    box-sizing: border-box;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}


/* Dropzone als visuelle Referenz: volle verfügbare Card-Breite */
#tool-image-drop.native-image-drop,
.native-image-drop {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}


/* Canvas darf im Scrollfenster größer sein, aber nicht die Toolbar-Breite beeinflussen */


.native-image-scroll .native-image-canvas-wrap {
    margin-left: 0 !important;
    margin-right: 0 !important;
}


/* Desktop: maximal zwei Zeilen */


/* Äußere Card nie wegen Canvas/Toolbar horizontal wachsen lassen */


/* =========================================================
   Native Tools - Image Editor Center Uploaded Image + Center Toolbar
   ========================================================= */

/*
   Breitenregel:
   - Dropzone ist die Referenz.
   - Toolbar und Canvas-Scrollfenster nehmen dieselbe Breite.
   - Upload/Zoom dürfen diese Breite nicht ändern.
*/

/* Canvas-Scrollfenster bleibt Dropzone-breit und zentriert */


/* JS setzt bei passender Breite auto/auto und bei Overflow 0/0.
   Deshalb hier nur Grundregeln, keine harte linksbündige Margin mehr. */


/* Toolbar: gleiche Breite wie Dropzone, Inhalt aber optisch zentriert */


/* Zeile 1: Tools und Actions als zentrierter Block */


/* Zeile 2: Controls ebenfalls zentriert */


/* Zoom bleibt sichtbar und kompakt */
.native-image-zoom-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 190px;
    max-width: 245px;
    flex: 0 1 245px;
}


.native-image-zoom-control input[type="range"] {
    display: inline-block;
    width: 92px;
    min-width: 80px;
    max-width: 105px;
}


.native-image-zoom-control output {
    display: inline-block;
    min-width: 40px;
    color: var(--tools-text);
    font-weight: 850;
    text-align: right;
    font-variant-numeric: tabular-nums;
}


/* Card darf nie durch Canvas oder Toolbar horizontal wachsen */
.native-image-editor-card,
.native-image-editor-tool,
.native-image-editor-tool .native-tools-card {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}


/* Mobile darf weiter umbrechen */
@media (max-width: 900px) {

    .native-image-zoom-control {
        flex: 1 1 220px;
        max-width: 100%;
    }

    .native-image-zoom-control input[type="range"] {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
    }
}


/* =========================================================
   Native Tools - Image Editor Center Toolbar Bar Itself
   ========================================================= */

/*
   Die Toolbar-Leiste selbst wird zentriert.
   Nicht nur die Icons innerhalb einer vollbreiten Leiste.
*/
.native-image-toolbar {
    width: fit-content;
    max-width: calc(100% - 36px);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    padding: 8px;
    display: grid;
    grid-template-columns: minmax(0, auto) auto;
    grid-template-areas:
        "tools actions"
        "controls controls";
    justify-content: center;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}


/* Zeile 1: Werkzeuge + Aktionen bleiben als Leisteninhalt zusammen */
.native-image-toolbar-tools {
    grid-area: tools;
    min-width: 0;
    width: auto;
    max-width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    overflow: hidden;
}


.native-image-toolbar-actions {
    grid-area: actions;
    min-width: 0;
    width: auto;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-left: 8px;
    overflow: visible;
}


/* Zeile 2: Controls über die Breite der Leiste */
.native-image-toolbar-controls {
    grid-area: controls;
    width: auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 8px;
    overflow: hidden;
}


/* Button-Größe stabil halten */
.native-image-toolbar .native-image-tool-icon-btn,
.native-image-toolbar .native-image-action-icon-btn {
    flex: 0 0 32px !important;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
}


/* Canvas-Scrollfenster bleibt Dropzone-breit und zentriert */
.native-image-scroll {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    overflow: auto;
    overflow-y: auto;
    box-sizing: border-box;
    scrollbar-gutter: stable both-edges;
}


.native-image-scroll .native-image-canvas-wrap {
    max-width: none !important;
    box-sizing: border-box;
}


/* Bei kleiner Breite darf die Toolbar wieder volle Breite nehmen */
@media (max-width: 900px) {
    .native-image-toolbar {
        width: 100%;
        max-width: 100%;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "tools"
            "controls"
            "actions";
    }

    .native-image-toolbar-tools {
        flex-wrap: wrap;
        overflow: visible;
    }

    .native-image-toolbar-actions {
        justify-content: flex-start;
        margin-left: 0;
    }
}


/* =========================================================
   Image Editor - Mini-Fix: Auflösung breiter + Inhalt zentriert
   ========================================================= */

/*
   NACH tools.css laden oder ganz ans Ende der aktuellen tools.css hängen.

   Macht nur:
   - Auflösungsfeld breiter.
   - Toolbar-Inhalt wieder mittig ausrichten.
   - Sticky-Verhalten bleibt unangetastet.
   - Keine fixed-Position.
   - Kein JS.
*/

/* obere Icon-Reihe als Gesamtgruppe mittig, Actions bleiben rechts */
body.tools-page .native-image-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas:
        ". tools actions"
        "controls controls controls";
    align-items: center;
}


/* Tool-Icons mittig */
body.tools-page .native-image-toolbar-tools {
    grid-area: tools;
    justify-content: center;
    margin: 0;
}


/* Action-Buttons rechts */
body.tools-page .native-image-toolbar-actions {
    grid-area: actions;
    justify-content: flex-end !important;
    margin-left: 8px;
}


/* Control-Zeile mittig */
body.tools-page .native-image-toolbar-controls {
    grid-area: controls;
    justify-content: center;
    gap: 8px 14px;
    overflow: visible;
}


/* Auflösung breiter, damit 2122 × 1361 / 2122 × 2177 reinpasst */
body.tools-page .native-image-toolbar #tool-image-resolution-input {
    width: 175px;
    min-width: 175px;
    max-width: 175px;
    text-align: center;
    font-family: Consolas, Monaco, "Courier New", monospace;
}


/* Fallback, falls das Feld über die Control-Klasse gestylt wird */
body.tools-page .native-image-toolbar .native-image-resolution-control input {
    width: 175px;
    min-width: 175px;
    max-width: 175px;
}


/* Abstand zwischen Auflösung und Zoom erzwingen */


/* =========================================================
   Image Editor - NUR Toolbar-Rahmen an Kachelbreite angleichen
   ========================================================= */

/*
   NACH tools.css laden oder ganz ans Ende der aktuellen tools.css hängen.

   Macht NICHT:
   - keine Icon-Zentrierung
   - kein fixed
   - kein sticky neu setzen
   - kein JS
   - keine komplette tools.css ersetzen

   Macht NUR:
   - die Werkzeugleisten-BOX selbst gleich breit zur Kachel/Dropzone machen
   - fit-content/max-content der alten Fehlversuche überschreiben
   - Auflösungsfeld etwas breiter machen
*/

/* DAS ist der eigentliche Fix:
   Die Leiste selbst darf NICHT fit-content sein. */
body.tools-page .native-image-toolbar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;

    margin-left: 0;
    margin-right: 0;
}


/* Falls ein alter Fehlversuch die Leiste in der Card künstlich verkleinert */
body.tools-page .native-image-editor-card .native-image-toolbar,
body.tools-page .native-image-editor-tool .native-image-toolbar,
body.tools-page .native-tools-card .native-image-toolbar {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}


/* Auflösungsfeld breiter, damit der Wert nicht gequetscht wird */
body.tools-page .native-image-toolbar #tool-image-resolution-input,
body.tools-page .native-image-toolbar .native-image-resolution-control input {
    width: 175px;
    min-width: 175px !important;
    max-width: 175px !important;
    text-align: center;
    font-family: Consolas, Monaco, "Courier New", monospace !important;
}


/* Nur Abstand zwischen Auflösung und Zoom, keine Layout-Neuerfindung */
body.tools-page .native-image-toolbar .native-image-resolution-control {
    margin-right: 10px;
}


body.tools-page .native-image-toolbar .native-image-zoom-control {
    margin-left: 10px;
}


body.tools-page .native-tools-page :where(.native-tools-card,
    .native-tools-result-box,
    .native-word-html-code,
    .native-word-html-editor,
    .native-image-canvas-wrap,
    .native-chmod-table-wrap) {
    overflow-wrap: anywhere;
}


body.tools-page .native-tools-page :where(.native-tools-card-grid,
    .native-tools-card-grid-single,
    .native-tools-two-col,
    .native-tools-three-col,
    .native-tools-four-col,
    .native-exp-form-grid,
    .native-extra-grid,
    .native-exp-output-grid,
    .native-compose-grid,
    .native-compose-two-col,
    .native-color-picker-layout,
    .native-word-html-grid,
    .native-image-editor-layout,
    .native-b64-file-grid,
    .native-list-compare-grid,
    .native-list-io-grid) {
    min-width: 0;
}


body.tools-page .native-tools-page :where(.native-tools-row,
    .native-tools-header-actions,
    .native-word-html-toolbar,
    .native-image-toolbar,
    .native-image-text-toolbar,
    .native-compose-row-editor-head,
    .native-tools-chip-list,
    .native-tools-format-options) {
    min-width: 0;
    max-width: 100%;
}


@media (max-width: 1100px) {

    body.tools-page .native-tools-page :where(.native-tools-card-grid,
        .native-tools-card-grid-single,
        .native-tools-two-col,
        .native-tools-three-col,
        .native-tools-four-col,
        .native-exp-form-grid,
        .native-extra-grid,
        .native-exp-output-grid,
        .native-color-picker-layout,
        .native-word-html-grid,
        .native-image-editor-layout,
        .native-list-compare-grid,
        .native-list-io-grid) {
        grid-template-columns: minmax(0, 1fr);
    }
}


@media (max-width: 760px) {

    body.tools-page .native-tools-btn,
    body.tools-page .native-tools-header-actions .native-tools-btn,
    body.tools-page .native-tools-card button:not(.native-image-text-object):not(.native-tools-global-search-result) {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 44px !important;
        justify-content: center !important;
        white-space: normal !important;
        line-height: 1.18 !important;
    }


    body.tools-page .native-tools-format-options,
    body.tools-page .native-tools-row,
    body.tools-page .native-word-html-toolbar,
    body.tools-page .native-image-toolbar,
    body.tools-page .native-image-text-toolbar,
    body.tools-page .native-compose-row-editor-head {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        align-items: stretch !important;
    }


    body.tools-page .native-tools-format-options>*,
    body.tools-page .native-tools-row>*,
    body.tools-page .native-word-html-toolbar>*,
    body.tools-page .native-image-toolbar>*,
    body.tools-page .native-image-text-toolbar>* {
        flex: 1 1 145px !important;
        min-width: 0 !important;
    }
}


@media (max-width: 520px) {

    body.tools-page .native-tools-page :where(.native-tools-format-options > *,
        .native-tools-row > *,
        .native-word-html-toolbar > *,
        .native-image-toolbar > *,
        .native-image-text-toolbar > *) {
        flex-basis: 100%;
    }
}


/* =========================================================
   Native Tools - Mobile portrait Phase 3: tool-specific UX
   Desktop remains untouched: all rules are portrait/mobile gated.
   ========================================================= */
@media (max-width: 900px) and (orientation: portrait),
(hover: none) and (pointer: coarse) and (orientation: portrait) {

    /* Fullscreen editor for JSON/Base64/Regex */
    body.tools-page .native-tools-mobile-editor-open-btn {
        width: 100% !important;
        min-height: 42px !important;
        margin: 0 0 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        border: 1px solid var(--tools-border) !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, .055) !important;
        color: var(--tools-accent) !important;
        font-weight: 950 !important;
        cursor: pointer !important;
    }

    body.light-mode.tools-page .native-tools-mobile-editor-open-btn {
        background: rgba(255, 255, 255, .82) !important;
    }

    body.tools-page .native-tools-mobile-editor-modal {
        position: fixed !important;
        inset: 0 !important;
        z-index: 420470 !important;
        display: none !important;
    }

    body.tools-page .native-tools-mobile-editor-modal.is-open {
        display: block !important;
    }

    body.tools-page .native-tools-mobile-editor-backdrop {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border: 0 !important;
        background: rgba(0, 0, 0, .50) !important;
    }

    body.tools-page .native-tools-mobile-editor-panel {
        position: absolute !important;
        inset: calc(var(--global-nav-height, 66px) + 8px) 8px calc(var(--log-height, 0px) + env(safe-area-inset-bottom, 0px) + 8px) 8px !important;
        min-height: 0 !important;
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
        overflow: hidden !important;
        border: 1px solid var(--tools-border) !important;
        border-radius: 18px !important;
        background: var(--tools-card) !important;
        color: var(--tools-text) !important;
        box-shadow: 0 30px 100px rgba(0, 0, 0, .58) !important;
    }

    body.light-mode.tools-page .native-tools-mobile-editor-panel {
        background: #ffffff !important;
        color: #222222 !important;
    }

    body.tools-page .native-tools-mobile-editor-header,
    body.tools-page .native-tools-mobile-editor-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        padding: 10px !important;
        border-bottom: 1px solid var(--tools-border) !important;
    }

    body.tools-page .native-tools-mobile-editor-actions {
        border-top: 1px solid var(--tools-border) !important;
        border-bottom: 0 !important;
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    body.tools-page .native-tools-mobile-editor-header h3 {
        margin: 0 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        color: var(--tools-accent) !important;
        font-size: 18px !important;
        font-weight: 950 !important;
    }

    body.tools-page .native-tools-mobile-editor-close {
        width: 42px !important;
        height: 42px !important;
        display: grid !important;
        place-items: center !important;
        border: 1px solid var(--tools-border) !important;
        border-radius: 999px !important;
        background: transparent !important;
        color: var(--tools-text) !important;
        font-size: 28px !important;
        line-height: 1 !important;
    }

    body.light-mode.tools-page .native-tools-mobile-editor-close {
        color: #222222 !important;
    }

    body.tools-page .native-tools-mobile-editor-value {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 14px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: rgba(0, 0, 0, .18) !important;
        color: inherit !important;
        resize: none !important;
        font-family: Consolas, Monaco, 'Courier New', monospace !important;
        font-size: 14px !important;
        line-height: 1.45 !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.light-mode.tools-page .native-tools-mobile-editor-value {
        background: #f1f1f1 !important;
    }

    /* Image editor: fullscreen canvas mode */
    body.tools-page .native-tools-mobile-image-fullscreen-btn {
        width: 100% !important;
        margin: 0 0 10px !important;
    }

    body.tools-page .native-tools-mobile-image-fullscreen-close {
        display: none !important;
    }

    body.native-tools-image-fullscreen.tools-page,
    html.native-tools-image-fullscreen {
        overflow: hidden !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-tools-mobile-shell,
    body.native-tools-image-fullscreen.tools-page .native-tools-header,
    body.native-tools-image-fullscreen.tools-page .native-tools-mobile-tabs,
    body.native-tools-image-fullscreen.tools-page .native-tools-status,
    body.native-tools-image-fullscreen.tools-page .native-tools-mobile-card-toggle {
        display: none !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-image-editor-card {
        position: fixed !important;
        inset: var(--global-nav-height, 66px) 0 calc(var(--log-height, 0px) + env(safe-area-inset-bottom, 0px)) 0 !important;
        z-index: 420460 !important;
        display: grid !important;
        grid-template-rows: auto auto minmax(0, 1fr) !important;
        gap: 8px !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        margin: 0 !important;
        padding: 8px !important;
        border-radius: 0 !important;
        border: 0 !important;
        background: var(--tools-card) !important;
        overflow: hidden !important;
    }

    body.light-mode.native-tools-image-fullscreen.tools-page .native-image-editor-card {
        background: #ffffff !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-tools-mobile-image-fullscreen-btn,
    body.native-tools-image-fullscreen.tools-page .native-image-drop {
        display: none !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-tools-mobile-image-fullscreen-close {
        position: fixed !important;
        top: calc(var(--global-nav-height, 66px) + 8px) !important;
        right: 8px !important;
        z-index: 420462 !important;
        min-width: 94px !important;
        min-height: 42px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1px solid var(--tools-border) !important;
        border-radius: 999px !important;
        background: var(--tools-accent) !important;
        color: #111111 !important;
        font-weight: 950 !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, .32) !important;
    }

    body.light-mode.native-tools-image-fullscreen.tools-page .native-tools-mobile-image-fullscreen-close {
        color: #ffffff !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-image-toolbar {
        min-height: 0 !important;
        max-height: 34dvh !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-right: 100px !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-image-scroll {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        border-radius: 14px !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-image-canvas-wrap,
    body.native-tools-image-fullscreen.tools-page .native-image-viewport {
        max-width: none !important;
    }
}



/* =========================================================
   Native Tools - Mobile portrait cleanup
   - removes recently-used UI
   - moves drawer to the right
   - adds stable mobile CSS normalization for problematic tools
   Desktop/landscape remains untouched.
   ========================================================= */
@media (max-width: 900px) and (orientation: portrait),
(hover: none) and (pointer: coarse) and (orientation: portrait) {
    body.tools-page {
        --tools-mobile-sidebar-width: min(92vw, 360px);
    }

    /* Recently used was removed again. */
    body.tools-page .native-tools-mobile-recent,
    body.tools-page #native-tools-mobile-recent,
    body.tools-page .native-tools-mobile-recent-list,
    body.tools-page .native-tools-mobile-recent-btn {
        display: none !important;
    }

    /* Right-side tool drawer. */
    body.tools-page .native-tools-sidebar {
        left: auto !important;
        right: 0 !important;
        border-left: 1px solid var(--tools-border) !important;
        border-right: 0 !important;
        box-shadow: -18px 0 44px rgba(0, 0, 0, .48) !important;
        transform: translateX(calc(100% + 18px)) !important;
        touch-action: pan-y !important;
    }

    body.tools-page.tools-native-sidebar-open .native-tools-sidebar,
    html.tools-native-sidebar-open body.tools-page .native-tools-sidebar,
    body.tools-page .native-tools-page.tools-native-sidebar-open .native-tools-sidebar {
        transform: translateX(var(--native-tools-drawer-drag-x, 0px)) !important;
    }

    body.tools-page .native-tools-sidebar.is-swipe-closing {
        transition: none !important;
        will-change: transform !important;
    }

    body.tools-page .native-tools-mobile-backdrop {
        left: 0 !important;
        right: 0 !important;
    }

    /* Phase 4 added a Share button, so the bottom bar has 6 actions now. */
    body.tools-page .native-tools-mobile-shell {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
        gap: 3px !important;
    }

    body.tools-page .native-tools-mobile-shell-btn {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    body.tools-page .native-tools-mobile-shell-btn strong {
        font-size: 9.5px !important;
        letter-spacing: -0.01em !important;
    }

    /* Generic mobile hardening for tools that still had desktop min-width/grid rules. */
    body.tools-page .native-tools-page,
    body.tools-page .native-tools-main,
    body.tools-page #native-tools-content,
    body.tools-page .native-tools-content,
    body.tools-page .native-tools-card,
    body.tools-page .native-tools-card *,
    body.tools-page .native-tools-header,
    body.tools-page .native-tools-header * {
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    body.tools-page .native-tools-card,
    body.tools-page .native-tools-card-grid,
    body.tools-page .native-tools-card-grid-single,
    body.tools-page .native-tools-two-col,
    body.tools-page .native-tools-three-col,
    body.tools-page .native-tools-four-col,
    body.tools-page .native-tools-option-grid,
    body.tools-page .native-tools-format-options,
    body.tools-page .native-tools-b64-file-grid,
    body.tools-page .native-color-picker-layout,
    body.tools-page .native-word-html-grid,
    body.tools-page .native-cron-grid,
    body.tools-page .native-tools-page :where(.native-exp-form-grid,
        .native-exp-output-grid,
        .native-extra-grid,
        .native-compose-grid,
        .native-compose-two-col,
        .native-compose-v2,
        .native-compose-basic,
        .native-compose-details,
        .native-compose-side,
        .native-compose-row-table,
        .native-compose-row-editor,
        .native-compose-row-editor-head,
        .native-winget-modal-grid,
        .native-winget-builder-grid,
        .native-winget-builder-card,
        .native-registry-grid,
        .native-task-grid,
        .native-task-visible-grid,
        .native-image-editor-tool,
        .native-image-editor-grid,
        .native-image-toolbar,
        .native-image-text-toolbar,
        .native-base64-tool,
        .native-regex-tool,
        .native-json-tool,
        .native-diff-tool,
        .native-list-tool,
        .native-urlparse-tool,
        .native-dns-tool,
        .native-xml-tool,
        .native-markdown-tool,
        .native-yaml-tool,
        .native-csv-tool,
        .native-tools-home-grid) {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.tools-page .native-tools-page :where(.native-tools-row,
        .native-tools-header-actions,
        .native-tools-chip-list,
        .native-cron-presets,
        .native-tools-mobile-output-actions,
        .native-word-html-toolbar,
        .native-word-html-toolgroup,
        .native-image-toolbar,
        .native-image-text-toolbar,
        .native-compose-row-editor-actions) {
        min-width: 0;
        max-width: 100%;
        flex-wrap: wrap;
    }

    body.tools-page .native-tools-page :where(input,
        select,
        textarea,
        button,
        pre,
        code,
        kbd,
        samp,
        .native-tools-result-box,
        .native-tools-json-tree,
        .native-tools-tree-placeholder,
        .native-cron-help,
        .native-word-html-editor,
        .native-word-html-code,
        .native-word-html-codebox,
        .native-compose-output,
        .native-compose-editor,
        .native-winget-search-command) {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.tools-page .native-tools-page :where(pre,
        code,
        .native-tools-result-box,
        .native-tools-json-tree,
        .native-tools-tree-placeholder,
        .native-cron-help,
        .native-compose-output,
        .native-compose-editor,
        .native-winget-search-command) {
        overflow: auto !important;
        white-space: pre-wrap !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.tools-page .native-tools-page :where(textarea,
        .native-tools-large-textarea,
        .native-word-html-editor,
        .native-word-html-code,
        .native-word-html-codebox) {
        width: 100% !important;
        min-height: 180px !important;
        max-height: 56dvh !important;
        overflow: auto !important;
        resize: vertical !important;
    }

    /* Word -> HTML: toolbar groups must not force a wide desktop row on phones. */
    body.tools-page .native-word-html-mobile-enhanced .native-word-html-toolbar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 8px !important;
        overflow: visible !important;
    }

    body.tools-page .native-word-html-mobile-enhanced .native-word-html-toolbar .native-word-html-toolgroup {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Docker Compose: desktop compact override must lose on portrait phones. */
    html body.tools-page #native-tools-content[data-current-tool="docker-compose-builder"] .native-compose-generator-card,
    html body.tools-page #native-tools-content[data-current-tool="docker-compose-builder"] .native-compose-editor-card,
    html body.tools-page #native-tools-content[data-current-tool="docker-compose-builder"] .native-exp-output-card,
    html body.tools-page #native-tools-content[data-current-tool="docker-compose-builder"] .native-compose-row-table,
    html body.tools-page #native-tools-content[data-current-tool="docker-compose-builder"] .native-compose-row-editor {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* Image editor: keep canvas/dropzone/toolbars inside the viewport. */
    body.tools-page .native-image-editor-tool,
    body.tools-page .native-image-editor-tool .native-tools-card,
    body.tools-page .native-image-editor-tool .native-image-canvas-wrap,
    body.tools-page .native-image-editor-tool #tool-image-canvas-wrap,
    body.tools-page .native-image-editor-tool .native-image-scroll,
    body.tools-page .native-image-editor-tool #tool-image-scroll {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: auto !important;
    }

    body.tools-page .native-image-editor-tool canvas,
    body.tools-page .native-image-editor-tool img {
        max-width: 100%;
    }

    body.tools-page .native-image-toolbar button,
    body.tools-page .native-image-text-toolbar button,
    body.tools-page .native-word-html-toolbar button {
        min-height: 42px !important;
        flex: 1 1 auto !important;
    }

    /* Modals/search overlays that had desktop min-widths. */
    html body.tools-page :where(.native-winget-search-modal,
        .native-winget-search-card,
        .native-tools-home-modal-panel,
        .native-tools-mobile-editor-panel,
        .native-tools-mobile-output-panel,
        .native-tools-mobile-command-panel) {
        width: auto !important;
        max-width: calc(100vw - 20px) !important;
        min-width: 0 !important;
    }

    html body.tools-page .native-winget-search-modal-backdrop .native-winget-modal-grid,
    html body.tools-page .native-winget-search-modal-backdrop .native-winget-modal-grid label,
    html body.tools-page .native-winget-search-modal-backdrop .native-winget-modal-check {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-column: 1 / -1 !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
}


/* =========================================================
   Native Tools - Mobile portrait smart layout cleanup
   Desktop/landscape remain untouched.
   ========================================================= */
@media (max-width: 900px) and (orientation: portrait),
(hover: none) and (pointer: coarse) and (orientation: portrait) {

    /* The generic Input/Output/Help tab row is now opt-in per tool. */
    body.tools-page .native-tools-mobile-tabs[hidden],
    body.tools-page .native-tools-mobile-tabs[data-mobile-tabs-enabled="0"],
    body.tools-page .native-tools-page[data-mobile-tabs-enabled="0"] .native-tools-mobile-tabs,
    body.tools-page #native-tools-content[data-mobile-tabs-enabled="0"]~.native-tools-mobile-tabs {
        display: none !important;
    }

    body.tools-page #native-tools-content[data-mobile-tabs-enabled="0"] .native-tools-card,
    body.tools-page #native-tools-content[data-mobile-tabs-enabled="0"][data-mobile-tab="all"] .native-tools-card,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-tools-card,
    body.tools-page #native-tools-content[data-current-tool="word-html"] .native-tools-card,
    body.tools-page #native-tools-content[data-current-tool="docker-compose-builder"] .native-tools-card {
        display: block !important;
    }

    body.tools-page #native-tools-content[data-mobile-tabs-enabled="0"] .native-tools-mobile-card-toggle,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-tools-mobile-card-toggle {
        display: none !important;
    }

    body.tools-page #native-tools-content[data-mobile-tabs-enabled="0"] .native-tools-card[data-mobile-collapsed="1"]> :not(.native-tools-mobile-card-toggle),
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-tools-card[data-mobile-collapsed="1"]> :not(.native-tools-mobile-card-toggle) {
        display: revert !important;
    }

    /* General hardening for tools that still inherit desktop min-widths. */
    body.tools-page #native-tools-content :where(.native-tools-card,
        .native-tools-card-grid,
        .native-tools-card-grid-single,
        .native-tools-two-col,
        .native-tools-three-col,
        .native-tools-four-col,
        .native-tools-option-grid,
        .native-tools-format-options,
        .native-tools-b64-file-grid,
        .native-color-picker-layout,
        .native-word-html-grid,
        .native-cron-grid,
        .native-exp-form-grid,
        .native-exp-output-grid,
        .native-extra-grid,
        .native-registry-grid,
        .native-task-grid,
        .native-task-visible-grid,
        .native-markdown-grid,
        .native-yaml-grid,
        .native-csv-grid,
        .native-diff-grid,
        .native-list-grid,
        .native-rom-patcher-grid,
        .native-base64-tool,
        .native-regex-tool,
        .native-json-tool) {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.tools-page #native-tools-content :where(.native-tools-row,
        .native-tools-chip-list,
        .native-cron-presets,
        .native-word-html-toolbar,
        .native-word-html-toolgroup,
        .native-image-toolbar,
        .native-image-text-toolbar,
        .native-image-toolbar-tools,
        .native-image-toolbar-controls,
        .native-image-toolbar-actions) {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    /* Image editor: the generic mobile card/tabs layer is disabled here.
       The editor gets its own phone layout so the canvas and controls stay usable. */
    body.tools-page #native-tools-content[data-current-tool="image-editor"] {
        overflow: visible;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-editor-tool,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-editor-card,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-tools-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow: visible;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-editor-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto minmax(260px, 1fr);
        gap: 10px;
        padding: 12px;
        border-radius: 16px;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] #tool-image-drop,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-drop {
        min-height: 108px;
        max-height: 28dvh;
        padding: 14px;
        margin: 0;
        overflow: hidden;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-text-toolbar {
        position: static;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        max-height: none;
        padding: 8px;
        overflow: visible;
        border-radius: 14px;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar-tools {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        max-height: 180px;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 2px 2px;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
        min-width: 0;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        min-width: 0;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-inline-control,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-resolution-control,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-draw-surface-control,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-zoom-control {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
        min-width: 0;
        width: 100%;
        margin: 0;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-resolution-control,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-zoom-control,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-draw-surface-control {
        grid-column: 1 / -1;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar input,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar select,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-text-toolbar input,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-text-toolbar select {
        height: 40px;
        min-height: 40px;
        font-size: 16px;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar button,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-text-toolbar button {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        min-height: 42px;
        padding: 6px 4px;
        overflow: hidden;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-tool-label,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-action-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 10px;
        line-height: 1.05;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] #tool-image-scroll,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-scroll {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        min-height: min(48dvh, 420px);
        max-height: calc(100dvh - var(--global-nav-height, 66px) - var(--tools-mobile-bottom-bar-height, 68px) - var(--log-height, 0px) - 290px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y;
        border-radius: 14px;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] #tool-image-canvas-wrap,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-canvas-wrap,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] #tool-image-viewport,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-viewport {
        width: max-content !important;
        min-width: 100% !important;
        max-width: none !important;
        min-height: 240px !important;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] #tool-image-canvas,
    body.tools-page #native-tools-content[data-current-tool="image-editor"] canvas {
        display: block;
        max-width: none;
        width: auto !important;
        height: auto !important;
        touch-action: none !important;
    }

    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-resize-handle {
        z-index: 4;
    }

    body.native-tools-image-fullscreen.tools-page .native-image-toolbar-tools {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        max-height: 21dvh !important;
    }

    body.native-tools-image-fullscreen.tools-page .native-image-toolbar-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.native-tools-image-fullscreen.tools-page #tool-image-scroll,
    body.native-tools-image-fullscreen.tools-page .native-image-scroll {
        min-height: 0 !important;
        max-height: none !important;
        height: 100% !important;
    }

    body.native-tools-image-fullscreen.tools-page #tool-image-canvas-wrap,
    body.native-tools-image-fullscreen.tools-page .native-image-canvas-wrap,
    body.native-tools-image-fullscreen.tools-page #tool-image-viewport,
    body.native-tools-image-fullscreen.tools-page .native-image-viewport,
    body.native-tools-image-fullscreen.tools-page #tool-image-canvas,
    body.native-tools-image-fullscreen.tools-page canvas {
        max-width: none !important;
    }

    /* Wide text/code based tools: keep them usable even if older rules set fixed widths. */
    body.tools-page #native-tools-content :where(.native-tools-large-textarea,
        textarea,
        .native-word-html-editor,
        .native-word-html-code,
        .native-word-html-codebox,
        .native-compose-editor,
        .native-compose-output,
        .native-tools-result-box,
        .native-tools-json-tree,
        .native-tools-tree-placeholder,
        pre,
        code) {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: auto !important;
        overflow-wrap: anywhere !important;
        -webkit-overflow-scrolling: touch !important;
    }
}


@media (max-width: 420px) and (orientation: portrait),
(hover: none) and (pointer: coarse) and (max-width: 420px) and (orientation: portrait) {
    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar-tools {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }


    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    body.tools-page #native-tools-content[data-current-tool="image-editor"] .native-image-toolbar-controls {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* =========================================================
   Image Editor Mobile - alte native-tools-v2 Smartphone-Guards entfernt.
   Gültige mobile Regeln beginnen beim V3-Guard und beim echten Smartphone-Renderer.
   ========================================================= */

/* =========================================================
   Image Editor Smartphone - V3 final hard guard
   ========================================================= */
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active,
html.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active {
    overflow: hidden !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-tools-header,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-tools-status,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active #native-tools-mobile-tabs {
    display: none !important;
}

body.native-image-mobile-local-shell-active #native-tools-mobile-shell,
body.native-image-mobile-local-shell-active #native-tools-mobile-shell.native-image-mobile-generic-shell-suppressed {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#native-image-mobile-local-shell.native-image-mobile-local-shell {
    box-sizing: border-box !important;
    position: fixed !important;
    left: max(6px, env(safe-area-inset-left, 0px)) !important;
    right: max(6px, env(safe-area-inset-right, 0px)) !important;
    bottom: max(6px, env(safe-area-inset-bottom, 0px)) !important;
    z-index: 420500 !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    min-height: 74px !important;
    padding: 7px 8px 8px !important;
    border: 1px solid rgba(255, 255, 255, .10) !important;
    border-radius: 20px !important;
    background: rgba(22, 22, 22, .96) !important;
    color: #fff !important;
    box-shadow: 0 -10px 42px rgba(0, 0, 0, .50) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
}

#native-image-mobile-local-shell.native-image-mobile-local-shell .native-tools-mobile-shell-btn {
    appearance: none !important;
    min-width: 0 !important;
    min-height: 54px !important;
    padding: 5px 2px !important;
    display: grid !important;
    grid-template-rows: 24px auto !important;
    place-items: center !important;
    gap: 2px !important;
    border: 1px solid transparent !important;
    border-radius: 16px !important;
    background: transparent !important;
    color: inherit !important;
    font: inherit !important;
}

#native-image-mobile-local-shell.native-image-mobile-local-shell .native-tools-mobile-shell-btn strong {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    font-weight: 900 !important;
}

#native-image-mobile-local-shell.native-image-mobile-local-shell .native-tools-mobile-shell-btn[aria-pressed="true"] {
    border-color: var(--tools-accent, #e9a624) !important;
    background: rgba(233, 166, 36, .08) !important;
    box-shadow: inset 0 -3px 0 var(--tools-accent, #e9a624), 0 0 0 1px rgba(233, 166, 36, .22) !important;
    color: inherit !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active #native-tools-content,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-tools-main,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-tools-tool-instance[data-tool-id="image-editor"],
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-app {
    position: static !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-stage,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-scroll,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-canvas-wrap,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-viewport {
    background-color: #222222 !important;
    background-image:
        linear-gradient(45deg, rgba(255,255,255,.055) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,.055) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,.055) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.055) 75%) !important;
    background-size: 24px 24px !important;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0 !important;
    overflow: hidden !important;
    touch-action: none !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active #tool-image-canvas {
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-tools .native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-options .native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-actions .native-image-mobile-sheet {
    position: fixed !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    bottom: calc(var(--native-image-mobile-app-bottom, 90px) + 10px) !important;
    z-index: 420460 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    max-height: min(58dvh, 520px) !important;
    padding: 12px !important;
    border: 1px solid var(--tools-border) !important;
    border-radius: 22px !important;
    background: color-mix(in srgb, var(--tools-card) 97%, transparent) !important;
    color: var(--tools-text) !important;
    box-shadow: 0 -18px 54px rgba(0, 0, 0, .46) !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-canvas .native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-file .native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-canvas .native-image-mobile-file-panel,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-tools .native-image-mobile-file-panel,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-options .native-image-mobile-file-panel,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-actions .native-image-mobile-file-panel {
    display: none !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-file .native-image-mobile-file-panel {
    position: fixed !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    bottom: calc(var(--native-image-mobile-app-bottom, 90px) + 10px) !important;
    z-index: 420460 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    max-height: min(58dvh, 520px) !important;
    overflow: auto !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 0 0 10px !important;
    padding-bottom: 8px !important;
    background: inherit !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet-tabs button,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-tab-btn {
    min-width: 0 !important;
    min-height: 48px !important;
    display: grid !important;
    grid-template-rows: auto auto !important;
    place-items: center !important;
    gap: 2px !important;
    padding: 6px 4px !important;
    border-radius: 13px !important;
    border: 1px solid var(--tools-border) !important;
    background: var(--tools-card-2) !important;
    color: var(--tools-text) !important;
    font: inherit !important;
    font-weight: 900 !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet-tabs button.is-active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-tab-btn.is-active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet-tabs button[aria-pressed="true"] {
    border-color: var(--tools-accent) !important;
    background: color-mix(in srgb, var(--tools-accent) 16%, var(--tools-card-2)) !important;
    box-shadow: inset 0 -3px 0 var(--tools-accent), 0 0 0 1px rgba(233, 166, 36, .28) !important;
    color: var(--tools-text) !important;
}


/* =========================================================
   Image Editor Smartphone - V4 usable sheet portal
   ========================================================= */
body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal.native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal.native-image-mobile-file-panel {
    box-sizing: border-box !important;
    position: fixed !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    bottom: calc(var(--native-image-mobile-app-bottom, 90px) + 10px) !important;
    z-index: 420480 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: min(50dvh, 430px) !important;
    margin: 0 !important;
    padding: 12px !important;
    border: 1px solid var(--tools-border) !important;
    border-radius: 22px !important;
    background: color-mix(in srgb, var(--tools-card) 98%, transparent) !important;
    color: var(--tools-text) !important;
    box-shadow: 0 -18px 54px rgba(0, 0, 0, .55) !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-canvas .native-image-mobile-portal.native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-file .native-image-mobile-portal.native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-canvas .native-image-mobile-portal.native-image-mobile-file-panel,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-tools .native-image-mobile-portal.native-image-mobile-file-panel,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-options .native-image-mobile-portal.native-image-mobile-file-panel,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-actions .native-image-mobile-portal.native-image-mobile-file-panel {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-tools .native-image-mobile-portal.native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-options .native-image-mobile-portal.native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-actions .native-image-mobile-portal.native-image-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-panel-file .native-image-mobile-portal.native-image-mobile-file-panel {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal .native-image-mobile-sheet-tabs {
    position: sticky !important;
    top: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 0 0 10px !important;
    padding-bottom: 8px !important;
    background: color-mix(in srgb, var(--tools-card) 98%, transparent) !important;
    z-index: 2 !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal [data-image-mobile-sheet-content][hidden] {
    display: none !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal .native-image-toolbar-tools,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal .native-image-toolbar-actions {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal .native-image-toolbar-controls {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal .native-image-tool-icon-btn,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-portal .native-image-action-icon-btn {
    min-width: 0 !important;
    width: 100% !important;
}


/* =========================================================
   Image Editor - echter Smartphone-Renderer
   Kein Desktop-DOM-Umbau, keine .native-image-toolbar im Mobile-Markup.
   ========================================================= */
html.image-editor-mobile-active,
body.image-editor-mobile-active {
    overflow: hidden !important;
    height: 100dvh !important;
}

body.image-editor-mobile-active .native-tools-header,
body.image-editor-mobile-active .native-tools-status,
body.image-editor-mobile-active #native-tools-mobile-tabs,
body.image-editor-mobile-active .native-tools-header-actions {
    display: none !important;
}

body.image-editor-mobile-active #native-tools-mobile-shell,
body.image-editor-mobile-active #native-tools-mobile-shell.image-editor-mobile-generic-shell-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.image-editor-mobile-active .native-tools-main,
body.image-editor-mobile-active .native-tools-content,
body.image-editor-mobile-active .native-tools-tool-instance[data-tool-id="image-editor"],
body.image-editor-mobile-active .image-editor-mobile-app {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-stage {
    box-sizing: border-box !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: var(--image-editor-mobile-top, var(--global-nav-height, 64px)) !important;
    bottom: var(--image-editor-mobile-bottom, 84px) !important;
    height: var(--image-editor-mobile-height, auto) !important;
    z-index: 420000 !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #222222 !important;
    background-image:
        linear-gradient(45deg, rgba(255,255,255,.055) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,.055) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,.055) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.055) 75%) !important;
    background-size: 24px 24px !important;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0 !important;
    touch-action: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-scroll,
body.image-editor-mobile-active .image-editor-mobile-canvas-wrap,
body.image-editor-mobile-active .image-editor-mobile-viewport {
    box-sizing: border-box !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    border: 0 !important;
    background: transparent !important;
    touch-action: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-bar {
    box-sizing: border-box !important;
    position: fixed !important;
    left: max(8px, env(safe-area-inset-left, 0px)) !important;
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
    bottom: max(6px, env(safe-area-inset-bottom, 0px)) !important;
    z-index: 420500 !important;
    min-height: 72px !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom, 0px)) !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    border-radius: 20px !important;
    background: rgba(20, 20, 20, .94) !important;
    color: #ffffff !important;
    box-shadow: 0 -16px 44px rgba(0,0,0,.48) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

body.light-mode.image-editor-mobile-active .image-editor-mobile-bar {
    background: rgba(246, 246, 246, .94) !important;
    color: #111111 !important;
    border-color: rgba(0,0,0,.14) !important;
}

body.image-editor-mobile-active .image-editor-mobile-bar button {
    appearance: none !important;
    min-width: 0 !important;
    min-height: 54px !important;
    display: grid !important;
    grid-template-rows: 24px auto !important;
    place-items: center !important;
    gap: 2px !important;
    border: 1px solid transparent !important;
    border-radius: 15px !important;
    background: transparent !important;
    color: inherit !important;
    font: inherit !important;
    cursor: pointer !important;
}

body.image-editor-mobile-active .image-editor-mobile-bar button span {
    font-size: 18px !important;
    line-height: 1 !important;
}

body.image-editor-mobile-active .image-editor-mobile-bar button strong {
    display: block !important;
    max-width: 100% !important;
    color: inherit !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.image-editor-mobile-active .image-editor-mobile-bar button.is-active,
body.image-editor-mobile-active .image-editor-mobile-bar button[aria-pressed="true"] {
    border-color: var(--tools-accent) !important;
    background: rgba(233,166,36,.10) !important;
    box-shadow: inset 0 -4px 0 var(--tools-accent), 0 0 0 1px rgba(233,166,36,.28) !important;
    color: inherit !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet {
    box-sizing: border-box !important;
    position: fixed !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    bottom: calc(var(--image-editor-mobile-bottom, 84px) + 10px) !important;
    z-index: 420480 !important;
    width: auto !important;
    max-height: min(56dvh, 520px) !important;
    margin: 0 !important;
    padding: 12px !important;
    border: 1px solid var(--tools-border) !important;
    border-radius: 22px !important;
    background: color-mix(in srgb, var(--tools-card) 98%, transparent) !important;
    color: var(--tools-text) !important;
    box-shadow: 0 -18px 54px rgba(0, 0, 0, .55) !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet[hidden] {
    display: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet-tabs {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin: 0 0 10px !important;
    padding-bottom: 8px !important;
    background: color-mix(in srgb, var(--tools-card) 98%, transparent) !important;
}

body.image-editor-mobile-active .image-editor-mobile-panel-file .image-editor-mobile-sheet-tabs,
body.image-editor-mobile-panel-file .image-editor-mobile-sheet-tabs {
    display: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet-tabs button {
    min-width: 0 !important;
    min-height: 48px !important;
    display: grid !important;
    grid-template-rows: auto auto !important;
    place-items: center !important;
    gap: 2px !important;
    padding: 6px 4px !important;
    border-radius: 13px !important;
    border: 1px solid var(--tools-border) !important;
    background: var(--tools-card-2) !important;
    color: var(--tools-text) !important;
    font: inherit !important;
    font-weight: 900 !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet-tabs button.is-active,
body.image-editor-mobile-active .image-editor-mobile-sheet-tabs button[aria-pressed="true"] {
    border-color: var(--tools-accent) !important;
    background: color-mix(in srgb, var(--tools-accent) 16%, var(--tools-card-2)) !important;
    box-shadow: inset 0 -3px 0 var(--tools-accent), 0 0 0 1px rgba(233,166,36,.28) !important;
}

body.image-editor-mobile-active .image-editor-mobile-tools,
body.image-editor-mobile-active .image-editor-mobile-actions {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
}

body.image-editor-mobile-active .image-editor-mobile-options {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
}

body.image-editor-mobile-active [data-image-editor-mobile-panel-content][hidden] {
    display: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn,
body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-action-icon-btn {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 44px !important;
    padding: 6px 4px !important;
    border-radius: 12px !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-label {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}


/* =========================================================
   Image Editor Desktop - Zoom skaliert den Tool-Content, nicht ein internes Bild-Scrollfenster
   ========================================================= */
body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] .native-image-scroll,
body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] #tool-image-scroll {
    overflow: visible;
    overflow-x: visible;
    overflow-y: visible;
    max-width: none;
    max-height: none;
    height: auto;
    scrollbar-gutter: auto;
}

body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] .native-image-canvas-wrap,
body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] .native-image-canvas-wrap.is-default-fill {
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
}

body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] .native-image-viewport {
    overflow: hidden;
}

body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] .native-image-editor-card,
body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] .native-image-editor-tool,
body.tools-page.native-tools-v2-desktop #native-tools-content[data-current-tool="image-editor"] .native-image-editor-tool .native-tools-card {
    overflow: visible;
}


/* =========================================================
   Mobile cleanup: Image Editor Resize-Grabber bedienbar machen
   ========================================================= */

body.image-editor-mobile-active .native-image-resize-handle {
    display: block !important;
    position: absolute !important;
    z-index: 12 !important;
    pointer-events: auto !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    border: 2px solid rgba(0, 0, 0, .70) !important;
    background: var(--tools-accent, #e9a624) !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .16), 0 4px 14px rgba(0, 0, 0, .38) !important;
}

body.image-editor-mobile-active .native-image-resize-left,
body.image-editor-mobile-active .native-image-resize-right {
    top: 50% !important;
    width: 28px !important;
    height: 78px !important;
    transform: translateY(-50%) !important;
    border-radius: 999px !important;
}

body.image-editor-mobile-active .native-image-resize-left {
    left: 6px !important;
}

body.image-editor-mobile-active .native-image-resize-right {
    right: 6px !important;
}

body.image-editor-mobile-active .native-image-resize-top,
body.image-editor-mobile-active .native-image-resize-bottom {
    left: 50% !important;
    width: 78px !important;
    height: 28px !important;
    transform: translateX(-50%) !important;
    border-radius: 999px !important;
}

body.image-editor-mobile-active .native-image-resize-top {
    top: 6px !important;
}

body.image-editor-mobile-active .native-image-resize-bottom {
    bottom: 6px !important;
}

body.image-editor-mobile-active .native-image-resize-tl,
body.image-editor-mobile-active .native-image-resize-tr,
body.image-editor-mobile-active .native-image-resize-bl,
body.image-editor-mobile-active .native-image-resize-br {
    width: 34px !important;
    height: 34px !important;
    border-radius: 11px !important;
}

body.image-editor-mobile-active .native-image-resize-tl {
    left: 8px !important;
    top: 8px !important;
}

body.image-editor-mobile-active .native-image-resize-tr {
    right: 8px !important;
    top: 8px !important;
}

body.image-editor-mobile-active .native-image-resize-bl {
    left: 8px !important;
    bottom: 8px !important;
}

body.image-editor-mobile-active .native-image-resize-br {
    right: 8px !important;
    bottom: 8px !important;
}

/* =========================================================
   Image Editor Mobile - Grabber/Zoom stabile Canvas-Buehne
   ========================================================= */
body.image-editor-mobile-active .image-editor-mobile-stage {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    contain: layout paint size !important;
}

body.image-editor-mobile-active .image-editor-mobile-scroll {
    box-sizing: border-box !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: var(--image-editor-mobile-height, 100%) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    overflow: hidden !important;
    touch-action: none !important;
    overscroll-behavior: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-canvas-wrap {
    box-sizing: content-box !important;
    position: relative !important;
    flex: 0 0 auto !important;
    width: var(--image-editor-mobile-visual-width, 100%) !important;
    height: var(--image-editor-mobile-visual-height, 100%) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    touch-action: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-viewport {
    box-sizing: border-box !important;
    position: relative !important;
    width: var(--image-editor-mobile-view-width, 100%) !important;
    height: var(--image-editor-mobile-view-height, 100%) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    touch-action: none !important;
    transform-origin: 0 0 !important;
    z-index: 1 !important;
}

body.image-editor-mobile-active #tool-image-canvas {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-handle {
    display: block !important;
    position: fixed !important;
    z-index: 420460 !important;
    pointer-events: auto !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    border: 2px solid rgba(0, 0, 0, .78) !important;
    background: var(--tools-accent, #e9a624) !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .18), 0 6px 18px rgba(0, 0, 0, .42) !important;
    opacity: .96 !important;
}

body.image-editor-mobile-active:not(.image-editor-mobile-panel-canvas) .native-image-resize-handle {
    display: none !important;
    pointer-events: none !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-left,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-right {
    top: var(--image-editor-mobile-center-y, 50dvh) !important;
    width: 30px !important;
    height: min(96px, calc(var(--image-editor-mobile-height, 360px) - 36px)) !important;
    min-height: 58px !important;
    transform: translateY(-50%) !important;
    border-radius: 999px !important;
    cursor: ew-resize !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-left {
    left: max(8px, env(safe-area-inset-left, 0px)) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-right {
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-top,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bottom {
    left: var(--image-editor-mobile-center-x, 50vw) !important;
    width: min(112px, calc(var(--image-editor-mobile-width, 360px) - 40px)) !important;
    min-width: 64px !important;
    height: 30px !important;
    transform: translateX(-50%) !important;
    border-radius: 999px !important;
    cursor: ns-resize !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-top {
    top: calc(var(--image-editor-mobile-top, 64px) + 8px) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bottom {
    bottom: calc(var(--image-editor-mobile-bottom, 84px) + 8px) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tl,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tr,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bl,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-br {
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tl {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    top: calc(var(--image-editor-mobile-top, 64px) + 10px) !important;
    cursor: nwse-resize !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tr {
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    top: calc(var(--image-editor-mobile-top, 64px) + 10px) !important;
    cursor: nesw-resize !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bl {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    bottom: calc(var(--image-editor-mobile-bottom, 84px) + 10px) !important;
    cursor: nesw-resize !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-br {
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    bottom: calc(var(--image-editor-mobile-bottom, 84px) + 10px) !important;
    cursor: nwse-resize !important;
}

body.light-mode.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-handle,
html.light-mode body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-handle {
    border-color: rgba(0, 0, 0, .86) !important;
    background: var(--tools-accent, #e9a624) !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .42), 0 6px 18px rgba(0, 0, 0, .28) !important;
}

/* =========================================================
   Image Editor Mobile - V5 full-stage canvas
   ========================================================= */
body.image-editor-mobile-active .image-editor-mobile-stage,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-stage {
    left: 0 !important;
    right: 0 !important;
    top: var(--image-editor-mobile-top, var(--native-image-mobile-app-top, var(--global-nav-height, 64px))) !important;
    bottom: var(--image-editor-mobile-bottom, var(--native-image-mobile-app-bottom, 84px)) !important;
    width: var(--image-editor-mobile-width, 100vw) !important;
    overflow: hidden !important;
    touch-action: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-scroll,
body.image-editor-mobile-active .image-editor-mobile-canvas-wrap,
body.image-editor-mobile-active .image-editor-mobile-viewport,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-scroll,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-canvas-wrap,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-viewport {
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    overflow: hidden !important;
    touch-action: none !important;
}

body.image-editor-mobile-active .image-editor-mobile-scroll,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-scroll {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    height: 100% !important;
}

body.image-editor-mobile-active .image-editor-mobile-canvas-wrap,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-canvas-wrap {
    flex: 0 0 auto !important;
}

body.image-editor-mobile-active #tool-image-canvas,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active #tool-image-canvas {
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
}

/* V5-Grabber-Positionen entfernt: V6 definiert die aktive Grabber-Positionierung direkt danach. */

/* =========================================================
   Image Editor Mobile - V6 echte Stage als Canvas + Grabber am Bildrand
   ========================================================= */
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-handle,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-handle {
    position: absolute !important;
    display: block !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-left,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-left {
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-right,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-right {
    left: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-top,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-top {
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bottom,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-bottom {
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%) !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tl,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-tl {
    left: 2px !important;
    right: auto !important;
    top: 2px !important;
    bottom: auto !important;
    width: 38px !important;
    height: 38px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tr,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-tr {
    left: auto !important;
    right: 2px !important;
    top: 2px !important;
    bottom: auto !important;
    width: 38px !important;
    height: 38px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bl,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-bl {
    left: 2px !important;
    right: auto !important;
    top: auto !important;
    bottom: 2px !important;
    width: 38px !important;
    height: 38px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-br,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-br {
    left: auto !important;
    right: 2px !important;
    top: auto !important;
    bottom: 2px !important;
    width: 38px !important;
    height: 38px !important;
}

/* =========================================================
   Image Editor Mobile - V8 echte Stage-Hoehe als Zeichenflaeche
   ========================================================= */
body.image-editor-mobile-active .image-editor-mobile-stage,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-stage {
    height: auto !important;
}

body.image-editor-mobile-active .image-editor-mobile-scroll,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-scroll {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

body.image-editor-mobile-active .image-editor-mobile-canvas-wrap,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-canvas-wrap {
    width: var(--image-editor-mobile-visual-width, var(--image-editor-mobile-stage-width, 100vw)) !important;
    height: var(--image-editor-mobile-visual-height, var(--image-editor-mobile-stage-height, 100%)) !important;
}

body.image-editor-mobile-active .image-editor-mobile-viewport,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-viewport {
    width: var(--image-editor-mobile-view-width, var(--image-editor-mobile-stage-width, 100vw)) !important;
    height: var(--image-editor-mobile-view-height, var(--image-editor-mobile-stage-height, 100%)) !important;
}

/* =========================================================
   Image Editor Mobile - V7 bottom bar centering
   Ziel: lokale Bar bleibt unten und wird auf breiten Viewports zentriert.
   ========================================================= */
@media (min-width: 720px) {
    #native-image-mobile-local-shell.native-image-mobile-local-shell {
        left: 50% !important;
        right: auto !important;
        bottom: max(6px, env(safe-area-inset-bottom, 0px)) !important;
        width: min(calc(100vw - 24px), 560px) !important;
        max-width: min(calc(100vw - 24px), 560px) !important;
        transform: translateX(-50%) !important;
    }
}

/* =========================================================
   Image Editor Mobile - V8 Shell/Resize/Log fixes
   ========================================================= */
html body.tools-page.native-tools-mobile-mode.image-editor-mobile-active #native-tools-mobile-shell,
html body.tools-page.native-tools-mobile-mode.native-tools-v2-canvas-app-mobile #native-tools-mobile-shell,
html body.tools-page.native-tools-mobile-mode.native-image-mobile-local-shell-active #native-tools-mobile-shell,
html body.tools-page.native-tools-mobile-mode.native-image-mobile-app-active #native-tools-mobile-shell,
body.tools-page.native-tools-mobile-mode.image-editor-mobile-active #native-tools-mobile-shell,
body.tools-page.native-tools-mobile-mode.native-tools-v2-canvas-app-mobile #native-tools-mobile-shell,
body.tools-page.native-tools-mobile-mode.native-image-mobile-local-shell-active #native-tools-mobile-shell,
body.tools-page.native-tools-mobile-mode.native-image-mobile-app-active #native-tools-mobile-shell,
body.image-editor-mobile-active #native-tools-mobile-shell.image-editor-mobile-generic-shell-hidden,
body.native-image-mobile-local-shell-active #native-tools-mobile-shell.native-image-mobile-generic-shell-suppressed {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-handle,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-handle {
    min-width: 44px !important;
    min-height: 44px !important;
    z-index: 420700 !important;
    pointer-events: auto !important;
    touch-action: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-left,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-left {
    left: 0 !important;
    width: 48px !important;
    height: 124px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-right,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-right {
    right: 0 !important;
    width: 48px !important;
    height: 124px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-top,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-top {
    top: 0 !important;
    width: 140px !important;
    height: 44px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bottom,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-bottom {
    bottom: 0 !important;
    width: 140px !important;
    height: 44px !important;
}

body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tl,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-tr,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-bl,
body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-br,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-tl,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-tr,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-bl,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-br {
    width: 52px !important;
    height: 52px !important;
}


/* =========================================================
   Image Editor Mobile - V9 touch cleanup
   Ziel: Rand-Resize-Griffe nur im Touch-Modus entfernen; Log bleibt ueber der Canvas-Buehne.
   ========================================================= */
body.image-editor-mobile-active .image-editor-mobile-stage,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-stage {
    z-index: 420000 !important;
}

@media (hover: none) and (pointer: coarse) {
    body.image-editor-mobile-active .native-image-resize-handle,
    body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-resize-handle,
    body.image-editor-mobile-active.image-editor-mobile-panel-canvas .native-image-resize-handle,
    body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active.native-image-mobile-app-panel-canvas .native-image-resize-handle {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* =========================================================
   Image Editor Mobile - V10 low bar + neutral tool buttons
   Ziel: Bar knapp über dem Log; Werkzeugbuttons nicht gelb, aktives Werkzeug klarer markiert.
   ========================================================= */
body.image-editor-mobile-active .image-editor-mobile-bar,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-bar {
    bottom: calc(var(--tools-mobile-bottom-gap-v10, 10px) + var(--log-height, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 420520 !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet {
    bottom: calc(var(--image-editor-mobile-bottom, 84px) + var(--tools-mobile-bottom-gap-v10, 10px) + var(--log-height, 0px) + env(safe-area-inset-bottom, 0px) + 8px) !important;
    max-height: calc(100dvh - var(--global-nav-height, 64px) - var(--image-editor-mobile-bottom, 84px) - var(--tools-mobile-bottom-gap-v10, 10px) - var(--log-height, 0px) - env(safe-area-inset-bottom, 0px) - 32px) !important;
    z-index: 420550 !important;
}

body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button.is-active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button.active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button[aria-pressed="true"],
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn.is-active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn.active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn[aria-pressed="true"],
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn.is-active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn.active,
body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn[aria-pressed="true"] {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: var(--tools-accent) !important;
    outline: 2px solid rgba(233, 166, 36, .72) !important;
    outline-offset: -3px !important;
    box-shadow: inset 0 -5px 0 var(--tools-accent), 0 0 0 2px rgba(233, 166, 36, .22), 0 0 22px rgba(233, 166, 36, .30) !important;
}

html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button.is-active,
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button.is-active,
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button.active,
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button.active,
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button[aria-pressed="true"],
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools button[aria-pressed="true"],
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn.is-active,
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn.is-active,
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn.active,
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn.active,
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn[aria-pressed="true"],
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-tools-btn[aria-pressed="true"],
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn.is-active,
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn.is-active,
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn.active,
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn.active,
html.light-mode body.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn[aria-pressed="true"],
body.light-mode.native-tools-v2-canvas-app-mobile .native-image-mobile-sheet .native-image-toolbar-tools .native-image-tool-icon-btn[aria-pressed="true"] {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: var(--tools-accent) !important;
    outline: 2px solid rgba(233, 166, 36, .78) !important;
    outline-offset: -3px !important;
    box-shadow: inset 0 -5px 0 var(--tools-accent), 0 0 0 2px rgba(233, 166, 36, .20), 0 0 18px rgba(233, 166, 36, .22) !important;
}


/* =========================================================
   Image Editor Mobile - V11 Werkzeugfarben final
   Ziel: echte Mobile-Sheet-Buttons neutral halten; nur aktives Werkzeug deutlich markieren.
   ========================================================= */
body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn,
body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-action-icon-btn,
body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn,
body.image-editor-mobile-active .image-editor-mobile-actions .native-image-action-icon-btn,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-tool-icon-btn,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-action-icon-btn,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-tools .native-image-tool-icon-btn,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-actions .native-image-action-icon-btn,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-action-icon-btn {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,.18) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04) !important;
}

html.light-mode body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn,
html.light-mode body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-action-icon-btn,
html.light-mode body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn,
html.light-mode body.image-editor-mobile-active .image-editor-mobile-actions .native-image-action-icon-btn,
body.light-mode.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn,
body.light-mode.image-editor-mobile-active .image-editor-mobile-sheet .native-image-action-icon-btn,
body.light-mode.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn,
body.light-mode.image-editor-mobile-active .image-editor-mobile-actions .native-image-action-icon-btn,
html.light-mode body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-tool-icon-btn,
html.light-mode body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-action-icon-btn,
html.light-mode body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn,
html.light-mode body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-action-icon-btn,
body.light-mode.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-tool-icon-btn,
body.light-mode.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-action-icon-btn,
body.light-mode.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn,
body.light-mode.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-action-icon-btn {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: rgba(0,0,0,.20) !important;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.04) !important;
}

body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn.is-active,
body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn.active,
body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn[aria-pressed="true"],
body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn.is-active,
body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn.active,
body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn[aria-pressed="true"],
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-tool-icon-btn.is-active,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-tool-icon-btn.active,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .image-editor-mobile-sheet .native-image-tool-icon-btn[aria-pressed="true"],
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn.is-active,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn.active,
body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn[aria-pressed="true"] {
    background: #111111 !important;
    background-color: #111111 !important;
    color: #ffffff !important;
    border: 2px solid var(--tools-accent) !important;
    outline: 2px solid rgba(233,166,36,.70) !important;
    outline-offset: -5px !important;
    box-shadow: inset 0 -6px 0 var(--tools-accent), 0 0 0 2px rgba(233,166,36,.25), 0 10px 22px rgba(233,166,36,.22) !important;
    transform: translateY(-1px) !important;
}

html.light-mode body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn.is-active,
html.light-mode body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn.active,
html.light-mode body.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn[aria-pressed="true"],
html.light-mode body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn.is-active,
html.light-mode body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn.active,
html.light-mode body.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn[aria-pressed="true"],
body.light-mode.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn.is-active,
body.light-mode.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn.active,
body.light-mode.image-editor-mobile-active .image-editor-mobile-sheet .native-image-tool-icon-btn[aria-pressed="true"],
body.light-mode.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn.is-active,
body.light-mode.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn.active,
body.light-mode.image-editor-mobile-active .image-editor-mobile-tools .native-image-tool-icon-btn[aria-pressed="true"],
html.light-mode body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn.is-active,
html.light-mode body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn.active,
html.light-mode body.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn[aria-pressed="true"],
body.light-mode.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn.is-active,
body.light-mode.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn.active,
body.light-mode.native-tools-v2-canvas-app-mobile.native-image-mobile-app-active .native-image-mobile-portal .native-image-tool-icon-btn[aria-pressed="true"] {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid var(--tools-accent) !important;
    outline: 2px solid rgba(233,166,36,.76) !important;
    outline-offset: -5px !important;
    box-shadow: inset 0 -6px 0 var(--tools-accent), 0 0 0 2px rgba(233,166,36,.22), 0 10px 20px rgba(233,166,36,.16) !important;
}
