:root{font-family:system-ui,-apple-system,Segoe UI,sans-serif;color:#17283d;background:#f2f5fa}*{box-sizing:border-box}body{margin:0}header{background:#12365b;color:white;padding:25px 0}header h1{margin:0 0 6px;font-size:clamp(1.6rem,4vw,2.3rem)}header p{margin:0;color:#d8e9f8}.wrap{max-width:1120px;margin:auto;padding:0 18px}main{padding-top:24px!important;padding-bottom:30px!important}.panel{background:white;border:1px solid #dbe3ed;border-radius:14px;padding:22px;box-shadow:0 4px 18px #152e4510;margin-bottom:20px}.upload{display:block;padding:14px;background:#e9f2fb;border:2px dashed #7eaed7;border-radius:10px;font-weight:650}.upload input{display:block;margin-top:10px;max-width:100%}.sliders{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px;margin:20px 0}.sliders label{font-weight:600}.sliders input{width:100%;margin-top:12px}.sliders output{float:right;color:#21649e}.buttons{display:flex;gap:10px;flex-wrap:wrap}button{border:0;border-radius:8px;background:#1363a5;color:white;padding:12px 19px;font-weight:650;cursor:pointer}button:disabled{background:#9eafbf;cursor:not-allowed}#download{background:#22794b}#download:disabled{background:#9eafbf}#status{color:#475569}.views{display:grid;grid-template-columns:1fr 1fr;gap:20px}.preview{background:repeating-conic-gradient(#f3f3f3 0% 25%,white 0% 50%) 50%/20px 20px;min-height:330px;display:flex;align-items:center;justify-content:center;overflow:auto;border:1px solid #d8e0e8;border-radius:8px}.preview canvas,.preview svg{max-width:100%;max-height:460px;width:auto;height:auto}.preview span{color:#64748b}.panel h2{font-size:1.1rem;margin:0 0 14px}.notice p{line-height:1.6}@media(max-width:720px){.sliders,.views{grid-template-columns:1fr}.preview{min-height:240px}}

.views.three{grid-template-columns:repeat(3,minmax(0,1fr))}.mode{display:block;font-weight:650;margin-top:16px}.hint{color:#52657a;font-size:.9rem;margin:8px 0}.preview canvas{image-rendering:auto}@media(max-width:900px){.views.three{grid-template-columns:1fr}}

.preview img{display:block;max-width:100%;max-height:460px;width:auto;height:auto;object-fit:contain}.preview img:not([src]){display:none}#diagnostic{font-weight:600;color:#155e75}
.crop-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:12px 0 18px}.crop-controls .mode{margin:0}.crop-controls button{padding:9px 13px}.crop-controls #resetCrop{background:#64748b}.crop-controls #cropInfo{font-size:.85rem;color:#52657a}.crop-stage{position:relative;display:inline-block;max-width:100%;line-height:0}.crop-stage #original{display:block;max-width:100%;max-height:460px;width:auto;height:auto}.crop-stage #cropOverlay{position:absolute;inset:0;width:100%;height:100%;max-height:none;touch-action:none;cursor:crosshair;display:none}.crop-stage.selecting #cropOverlay{display:block}.crop-stage.selecting{outline:2px solid #1363a5;outline-offset:2px}

/* V4 : le canevas et son calque partagent exactement le même rectangle affiché. */
.crop-stage{position:relative;display:block;width:100%;max-width:100%;line-height:0;overflow:hidden}
.crop-stage #original{display:block;width:100%;height:auto;max-width:none;max-height:none}
.crop-stage #cropOverlay{position:absolute;top:0;left:0;width:100%;height:100%;max-width:none;max-height:none;display:block;pointer-events:none;touch-action:none;z-index:2}
.crop-stage.selecting #cropOverlay{pointer-events:auto;cursor:crosshair}
.crop-controls{display:block;margin:14px 0 0}.crop-controls .mode{margin:0 0 10px}.crop-buttons{display:flex;flex-wrap:wrap;gap:8px}.crop-controls #cropInfo{display:block;margin:10px 0 0;line-height:1.4}
.crop-help{font-size:.82rem;color:#52657a;margin:0 0 10px;line-height:1.4}
.crop-stage.selecting{outline:3px solid #1363a5;outline-offset:-3px}

/* V5 : les interactions sont capturées par le conteneur, pas le calque canvas. */
.crop-stage{position:relative!important;display:block!important;width:100%!important;touch-action:none}
.crop-stage #original{display:block!important;width:100%!important;height:auto!important;max-width:none!important;max-height:none!important;pointer-events:none}
.crop-stage #cropOverlay{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;display:block!important;pointer-events:none!important;z-index:3}
.crop-stage.selecting{cursor:crosshair!important;touch-action:none}
.crop-controls{margin-top:14px}

/* V6 : commandes toujours sous l'image d'origine, dans son panneau. */
.original-panel{display:flex;flex-direction:column}
.original-panel .crop-controls{position:static!important;display:block!important;order:3;margin-top:14px!important}
.original-panel .preview{order:2}
.original-panel .crop-help{order:1}
.original-panel h2{order:0}
.version{font-size:.48em;font-weight:600;vertical-align:middle;opacity:.8}


/* V8 — aperçu SVG : rendu ajusté, indépendant des dimensions intrinsèques
   que VTracer met dans la racine du SVG. */
.vector-heading{display:flex;align-items:center;justify-content:space-between;gap:9px;flex-wrap:wrap;margin-bottom:14px}
.vector-heading h2{margin:0}
.secondary-button{background:#e8eff8;color:#15466b;border:1px solid #c4d5e6;padding:8px 12px}
.secondary-button:hover:not(:disabled){background:#dcebf8}
.secondary-button:focus-visible{outline:3px solid #1476bf;outline-offset:2px}
.vector-preview{height:460px;min-height:0;overflow:hidden;display:block;position:relative}
.vector-preview svg{display:block!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;overflow:visible;}
.vector-preview > span{display:grid;height:100%;place-items:center;text-align:center;padding:20px}
.preview-hint{font-size:.78rem;color:#50657c;margin:9px 0 0;line-height:1.45}
.svg-dialog{border:1px solid #afc4d6;border-radius:13px;padding:0;background:white;color:#17283d;width:min(96vw,1440px);max-width:96vw;height:min(92dvh,960px);max-height:92dvh;box-shadow:0 20px 70px #0005}
.svg-dialog::backdrop{background:rgba(11,27,47,.78)}
.svg-dialog-inner{height:100%;display:flex;flex-direction:column;min-height:0}
.svg-dialog-header,.svg-dialog-toolbar{display:flex;gap:10px;align-items:center;padding:10px 16px;flex-wrap:wrap}
.svg-dialog-header{justify-content:space-between;border-bottom:1px solid #dce6ef}
.svg-dialog-header h2{margin:0;font-size:1.15rem}
.svg-dialog-toolbar{background:#f8fafc;border-bottom:1px solid #dce6ef}
.svg-dialog-toolbar button{padding:7px 13px}
.svg-dialog-toolbar output{font-variant-numeric:tabular-nums;min-width:65px;text-align:center;font-weight:650;color:#155e75}
.svg-dialog-tip{font-size:.8rem;color:#52657a;margin-left:auto}
.svg-zoom-stage{position:relative;flex:1;min-height:0;overflow:hidden;cursor:grab;touch-action:none;user-select:none;background:repeating-conic-gradient(#f4f4f4 0% 25%,white 0% 50%) 50%/22px 22px}
.svg-zoom-stage.is-panning{cursor:grabbing}
.svg-zoom-stage svg{display:block;width:100%;height:100%;max-width:none;max-height:none;pointer-events:none;user-select:none;}
@media(max-width:600px){.svg-dialog-tip{margin-left:0}.svg-dialog-header,.svg-dialog-toolbar{padding:9px}.svg-dialog-header h2{font-size:1rem}.vector-preview{height:380px}}

/* V9 : choix clair entre la découpe fermée et la gravure par ligne centrale. */
.trace-modes{border:1px solid #ccdae8;border-radius:10px;padding:12px 14px;margin-top:20px;background:#f9fbfe}
.trace-modes legend{font-weight:700;color:#173e63;padding:0 5px}
.trace-mode-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.trace-mode-card{display:flex;gap:12px;align-items:flex-start;padding:13px;border:1px solid #cad8e6;border-radius:9px;background:#fff;cursor:pointer}
.trace-mode-card:has(input:checked){background:#eaf4ff;border-color:#1363a5;box-shadow:inset 0 0 0 1px #1363a5}
.trace-mode-card input{margin-top:3px;flex-shrink:0;accent-color:#1363a5}
.trace-mode-card strong{display:block;color:#173e63}
.trace-mode-card small{display:block;font-size:.84rem;font-weight:400;color:#53677d;line-height:1.4;margin-top:4px}
#traceStats{font-weight:600;color:#17629b;line-height:1.5}
@media(max-width:650px){.trace-mode-grid{grid-template-columns:1fr}}


/* V10 — troisième mode + édition géométrique en grand écran */
.trace-mode-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:850px){.trace-mode-grid{grid-template-columns:1fr}}
.editor-toggle{display:flex;align-items:center;gap:7px;white-space:nowrap;font-weight:700;color:#135f95}
.editor-toggle input{accent-color:#1363a5;width:17px;height:17px}
.editor-tools{padding:10px 15px;background:#f4f9fd;border-bottom:1px solid #c9dbe8;flex-shrink:0}
.editor-tools[hidden]{display:none!important}
.editor-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:7px}
.editor-actions button{font-size:.83rem;padding:7px 10px}
.editor-actions button:disabled{opacity:.5;background:#e1e8ee;color:#64748b}
.editor-intensity,.editor-linked{display:flex;align-items:center;gap:7px;font-size:.86rem;color:#284965;font-weight:600}
.editor-intensity input{width:115px}
.editor-intensity output{min-width:40px;font-variant-numeric:tabular-nums}
.edit-info{font-size:.79rem;color:#3a556e;margin:4px 0;line-height:1.35}
.svg-zoom-stage.is-editing{cursor:grab}
.svg-zoom-stage.is-editing svg{pointer-events:auto}
.svg-zoom-stage.is-editing .curve-editor-overlay{pointer-events:none}
.svg-zoom-stage .curve-editor-hit{fill:none;stroke:transparent;pointer-events:stroke;cursor:pointer}
.svg-zoom-stage .curve-editor-highlight{fill:none;stroke:#1363a5;pointer-events:none}
.svg-zoom-stage .curve-editor-tangent{stroke:#23a164;pointer-events:none}
.svg-zoom-stage .curve-editor-node{stroke:#1466ab;stroke-width:1;fill:#fff;pointer-events:all;cursor:move}
.svg-zoom-stage .curve-editor-node.is-selected{fill:#1b80d8;stroke:#fff;stroke-width:1.5}
.svg-zoom-stage .curve-editor-handle{stroke:#147543;stroke-width:1.3;fill:#baf3d2;pointer-events:all;cursor:crosshair}
@media(max-width:650px){.svg-dialog{height:94dvh;max-height:94dvh}.editor-actions{gap:5px}.editor-intensity input{width:90px}}

.download-dialog-button{background:#22794b;color:white;padding:8px 12px}
.download-dialog-button:hover{background:#166039}

/* V10.2 — ciseaux : le rouge n'apparaît que dans l'éditeur. */
#cutSegment[aria-pressed="true"]{background:#b91c1c;color:white;border-color:#991b1b}
#cutSegment[aria-pressed="true"]:hover{background:#991b1b}
.svg-zoom-stage .curve-editor-segment{fill:none;stroke:transparent;pointer-events:stroke;cursor:crosshair;stroke-linecap:round}
.svg-zoom-stage .curve-editor-segment:hover{stroke:#dc2626;stroke-opacity:.85}

.svg-import-controls{margin-top:14px;padding-top:12px;border-top:1px solid #dbe3ed}
.svg-import-controls button{width:100%;text-align:center}
#svgImportInfo.is-error{color:#a62323;font-weight:600}

#addNode[aria-pressed="true"]{background:#166534;color:white;border-color:#14532d}
#addNode[aria-pressed="true"]:hover{background:#14532d}
.svg-zoom-stage .curve-editor-segment.is-inserting:hover{stroke:#16a34a;stroke-opacity:.9}
#exitEditorTool{border-color:#64748b;font-weight:700}
#exitEditorTool[hidden]{display:none!important}

/* V10.5 — quitter la courbe sélectionnée sans fermer l’éditeur. */
#exitCurveEdit{border-color:#1363a5;color:#135f95;font-weight:700}
#exitCurveEdit[hidden]{display:none!important}
