:root {
    color-scheme: light;
    --blue: #4a6da7;
    --blue-dark: #365583;
    --blue-light: #edf3fb;
    --page-bg: #897e7e;
    --panel: #fff;
    --panel-head: #f3f5f8;
    --line: #c9d2df;
    --text: #4f4f4f;
    --muted: #757575;
    --danger: #b22d3b;
    --success: #2f7551;
    --shadow: 0 2px 8px rgba(30, 42, 61, .14);
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Helvetica Neue", "Segoe UI", Arial, sans-serif;
}

button, select, textarea {
    font: inherit;
}

a {
    color: var(--blue-dark);
}

.page {
    width: min(960px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 16px rgba(0, 0, 0, .24);
}

.site-header {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 38px;
    border-radius: 8px 8px 0 0;
}

.site-logo {
    width: min(390px, 55%);
    height: auto;
    display: block;
}

.slogan {
    margin: 0;
    color: #747474;
    font-size: 1rem;
    font-style: italic;
    text-align: right;
}

.content {
    padding: 18px 20px 28px;
}

.section-title {
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 1.45rem;
    font-weight: 500;
}

.DecolleDesBord {
    padding: 0 20px;
}

.tool-intro {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fafafa;
}

.tool-picture {
    width: 116px;
    height: 116px;
    flex: 0 0 116px;
    object-fit: contain;
    border-radius: 4px;
}

h1 {
    margin: 0 0 6px;
    color: var(--blue);
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    font-weight: 500;
}

.subtitle {
    max-width: 630px;
    margin: 0;
    color: var(--muted);
    font-size: .94rem;
    line-height: 1.55;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #f5f6f8;
}

button, select, .file-label {
    min-height: 36px;
    border: 1px solid #aeb8c7;
    border-radius: 4px;
    background: #fff;
    color: #4e5968;
    padding: 7px 11px;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}

    button:hover, select:hover, .file-label:hover {
        border-color: var(--blue);
        background: var(--blue-light);
    }

    button:focus-visible, select:focus-visible, textarea:focus-visible, .file-label:focus-within {
        outline: 3px solid rgba(74, 109, 167, .25);
        outline-offset: 2px;
    }

.primary {
    border-color: var(--blue-dark);
    background: var(--blue);
    color: #fff;
    font-weight: 700;
}

    .primary:hover {
        background: var(--blue-dark);
        color: #fff;
    }

.spacer {
    flex: 1;
}

.field {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .88rem;
}

.file-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pane {
    min-height: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-head);
}

.pane-title {
    color: var(--blue-dark);
    font-size: .84rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.meta {
    color: var(--muted);
    font-size: .8rem;
}

textarea {
    width: 100%;
    min-height: 390px;
    resize: none;
    border: 0;
    outline: 0;
    padding: 18px;
    background: #fff;
    color: #263342;
    caret-color: var(--blue);
    tab-size: 2;
    font: 15px/1.55 "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    white-space: pre;
    overflow: auto;
}

    textarea::placeholder {
        color: #8d98a7;
    }

#output {
    background: #f8fafc;
}

.status {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    padding: 7px 2px 0;
    font-size: .88rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #60748b;
}

.status.ok {
    color: var(--success);
}

    .status.ok .dot {
        background: var(--success);
        box-shadow: 0 0 0 4px rgba(47, 117, 81, .10);
    }

.status.error {
    color: var(--danger);
}

    .status.error .dot {
        background: var(--danger);
        box-shadow: 0 0 0 4px rgba(178, 45, 59, .10);
    }

.site-footer {
    padding: 16px 20px;
    background: var(--blue);
    color: #fff;
    font-size: .86rem;
    text-align: center;
}

    .site-footer a {
        color: #fff;
    }

@media (max-width: 840px) {
    .site-header {
        min-height: 115px;
        padding: 18px 20px;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    textarea {
        min-height: 310px;
        resize: vertical;
    }
}

@media (max-width: 570px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .site-logo {
        width: min(340px, 100%);
    }

    .slogan {
        text-align: left;
    }

    .content {
        padding: 14px 12px 22px;
    }

    .tool-intro {
        align-items: flex-start;
    }

    .tool-picture {
        width: 82px;
        height: 82px;
        flex-basis: 82px;
    }

    .spacer {
        display: none;
    }
}

.image-stage {
    position: relative;
    overflow: hidden;
}

.crop-overlay {
    position: absolute;
    z-index: 3;
    border: 2px solid rgba(255, 255, 255, .95);
    /* Assombrit tout ce qui se trouve hors du cadre */
    box-shadow: 0 0 0 9999px rgba(25, 34, 48, .48);
    pointer-events: none;
    touch-action: none;
}

    .crop-overlay[hidden] {
        display: none;
    }

.crop-grid-line {
    position: absolute;
    z-index: 1;
    display: block;
    background: rgba(255, 255, 255, .62);
    pointer-events: none;
}

.crop-grid-v1,
.crop-grid-v2 {
    top: 0;
    bottom: 0;
    width: 1px;
}

.crop-grid-h1,
.crop-grid-h2 {
    left: 0;
    right: 0;
    height: 1px;
}

.crop-grid-v1 {
    left: 33.333%;
}

.crop-grid-v2 {
    left: 66.666%;
}

.crop-grid-h1 {
    top: 33.333%;
}

.crop-grid-h2 {
    top: 66.666%;
}

.crop-handle {
    position: absolute;
    z-index: 2;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 3px;
    background: var(--blue);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .38);
    pointer-events: auto;
    touch-action: none;
}

    .crop-handle:hover:not(:disabled),
    .crop-handle:focus-visible {
        background: var(--blue-dark);
    }

.crop-handle-top,
.crop-handle-bottom {
    left: 50%;
    width: 34px;
    height: 11px;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.crop-handle-left,
.crop-handle-right {
    top: 50%;
    width: 11px;
    height: 34px;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.crop-handle-top {
    top: -7px;
}

.crop-handle-right {
    right: -7px;
}

.crop-handle-bottom {
    bottom: -7px;
}

.crop-handle-left {
    left: -7px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 10px;
    padding: 12px;
}

    .options-grid fieldset {
        min-width: 0;
        margin: 0;
    }

.crop-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

    .crop-buttons button {
        flex: 1 1 90px;
    }

.metadata-field {
    margin-top: 14px;
    padding-top: 11px;
    border-top: 1px solid #dfe5ec;
}
.options-panel .ui-switch-track {
    transform: scale(.75);
    transform-origin: left center;
    /* Compense l’espace conservé par la taille d’origine */
    margin-right: -19px;
    margin-top: -4px;
    margin-bottom: -4px;
}