/*
 * SVG-O-Matic : habillage inspiré du petit électroménager des années 50 à 70.
 *
 * Sept coloris, comme au catalogue : un émail de couleur pour le capot, une teinte d'appui pour les touches
 * enfoncées et une couleur vive pour la touche principale. Le reste (panneaux crème, chrome, bakélite) est commun.
 * Le coloris est porté par l'attribut data-coloris de la page, posé par js/coloris.js ; l'éclairage (jour ou nuit)
 * par data-eclairage. La nuit, les panneaux prennent une teinte sombre propre au coloris, jamais un simple marron.
 *
 * La zone de l'image reste neutre et les pastilles de la palette restent à plat :
 * rien ne doit fausser le jugement des couleurs.
 */
@font-face {
  font-family: "Jost";
  src: url("../fonts/jost.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lobster";
  src: url("../fonts/lobster.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

/* ---------- coloris ---------- */
/* Chaque bloc s'applique à la page entière et à la pastille qui représente le coloris dans le nuancier. */
:root, [data-coloris="turquoise"] {      /* Turquoise : le « Turquoise Green » des cuisines de 1955 */
  --body-a: #b5e0d7; --body-b: #93cfc5; --on-enamel: #1f3b38;
  --tint: #10686c; --tint-hi: #1a8589; --tint-text: #fdf8ea;
  --red-a: #c5303a; --red-b: #a11a25; --red-edge: #7d111b; --red-text: #fff6e6;
  --plate-a: #c5303a; --plate-b: #a11a25; --plate-text: #fff6e6; --plate-o: #ffd978;
  --ink: #a11a25; --star: #e3a41d; --star-2: #1a8589;
  --night: #11272a; --tint-n: #4fc3ba; --ink-n: #ff8f85;
  --trim: linear-gradient(#f7f7f6, #c9cdd3 45%, #eef0f2 60%, #8f959e); --trim-h: 5px;
}
[data-coloris="rose"] {                  /* Rose pétale : le « Petal Pink » de 1955, marié au turquoise */
  --body-a: #f9d2d7; --body-b: #f1b0bd; --on-enamel: #4a1f2c;
  --tint: #8f2c4f; --tint-hi: #b03a66; --tint-text: #fff3ee;
  --red-a: #1f9a96; --red-b: #12757a; --red-edge: #0c5357; --red-text: #f3fffb;
  --plate-a: #1f9a96; --plate-b: #12757a; --plate-text: #f3fffb; --plate-o: #ffd3dc;
  --ink: #9c2c52; --star: #e9a23b; --star-2: #12757a;
  --night: #27141e; --tint-n: #f595b5; --ink-n: #f7a8c0;
}
[data-coloris="jaune"] {                 /* Jaune soleil : « Sunny Yellow » et « Canary Yellow », avec le bleu cadet */
  --body-a: #fbe793; --body-b: #f3d45e; --on-enamel: #3d2f08;
  --tint: #2a5a7c; --tint-hi: #36739c; --tint-text: #f7fbff;
  --red-a: #d8402f; --red-b: #b02a1d; --red-edge: #821b12; --red-text: #fff4e8;
  --plate-a: #d8402f; --plate-b: #b02a1d; --plate-text: #fff4e8; --plate-o: #ffe27a;
  --ink: #b02a1d; --star: #36739c; --star-2: #d8402f;
  --night: #121d2c; --tint-n: #f5d766; --ink-n: #f7dc74;
}
[data-coloris="menthe"] {                /* Vert menthe : l'« Island Green » de 1955, relevé de corail */
  --body-a: #cfedcf; --body-b: #aaddb0; --on-enamel: #1c3f27;
  --tint: #1f6e4a; --tint-hi: #2b8a5e; --tint-text: #f4fff6;
  --red-a: #ee6a4f; --red-b: #cf4a31; --red-edge: #9a3220; --red-text: #fff5ee;
  --plate-a: #ee6a4f; --plate-b: #cf4a31; --plate-text: #fff5ee; --plate-o: #fff0b8;
  --ink: #c2452d; --star: #f0b33a; --star-2: #2b8a5e;
  --night: #11231a; --tint-n: #83d99e; --ink-n: #ff957f;
}
[data-coloris="azur"] {                  /* Bleu azur : le « Cadet Blue » éclairci, avec l'orange des années 60 */
  --body-a: #abd9f7; --body-b: #7fc0ee; --on-enamel: #12324d;
  --tint: #1c4f80; --tint-hi: #2769a6; --tint-text: #f3f9ff;
  --red-a: #f07f2a; --red-b: #d2600f; --red-edge: #9c4406; --red-text: #fff6ea;
  --plate-a: #f07f2a; --plate-b: #d2600f; --plate-text: #fff6ea; --plate-o: #fff1b0;
  --ink: #c2540a; --star: #f2b632; --star-2: #2769a6;
  --night: #0f1d2e; --tint-n: #80c6f5; --ink-n: #ffa860;
}
[data-coloris="orange"] {                /* Orange pop : le plastique orange des années 70, plaque blanche, bleu pétrole */
  --body-a: #f89c50; --body-b: #ee7b26; --on-enamel: #3b1a05;
  --tint: #b3470d; --tint-hi: #cf5a14; --tint-text: #fff6ea;
  --red-a: #17838a; --red-b: #0e6068; --red-edge: #094449; --red-text: #f1fffd;
  --plate-a: #fffaf0; --plate-b: #f1e4cc; --plate-text: #c2500e; --plate-o: #0e6068;
  --ink: #c2500e; --star: #f2b632; --star-2: #0e6068;
  --night: #1b1d26; --tint-n: #ff9d52; --ink-n: #ffa55e;
  --trim: linear-gradient(#7a3b12 0 34%, #f2b632 34% 67%, #fff3d6 67%); --trim-h: 6px;
}
[data-coloris="creme"] {                 /* Crème et cuivre : le beige, le « Coppertone » de 1964 et le vert avocat de 1966 */
  --body-a: #f0e2c5; --body-b: #e3cfa6; --on-enamel: #3d2a17;
  --tint: #5d6b2a; --tint-hi: #74853a; --tint-text: #fbffe9;
  --red-a: #bd6631; --red-b: #954719; --red-edge: #6c3210; --red-text: #fff5ea;
  --plate-a: #bd6631; --plate-b: #954719; --plate-text: #fff5ea; --plate-o: #ffe9b0;
  --ink: #954719; --star: #d9a13a; --star-2: #74853a;
  --night: #1d1b19; --tint-n: #c5d27a; --ink-n: #f0a878;
}

:root {
  --ui: "Jost", "Century Gothic", "Futura", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --script: "Lobster", "Brush Script MT", "Segoe Script", cursive;
  --mono: ui-monospace, Consolas, "Courier New", monospace;

  /* le coloris, appliqué à l'appareil */
  --enamel-a: var(--body-a);    /* capot, haut */
  --enamel-b: var(--body-b);    /* capot, bas */
  --accent: var(--tint);        /* touche enfoncée */
  --accent-hi: var(--tint-hi);
  --accent-text: var(--tint-text);
  --title: var(--ink);          /* titres en script */

  /* éclairage de jour : panneaux crème, communs à tous les coloris */
  --bg: #efe5cf;            /* mur de la cuisine */
  --panel: #fbf6ea;         /* émail crème */
  --soft: #f1e8d4;          /* creux, plateaux */
  --line: #d8cbb0;
  --text: #2f231c;          /* bakélite */
  --muted: #736353;
  --well: #3a2c24;          /* logement des touches, fente des curseurs */
  --key-a: #fffdf6;         /* touche, haut */
  --key-b: #efe5d0;         /* touche, bas */
  --key-edge: #c6b697;
  --key-shadow: #b3a384;
  --chrome-a: #fbfbfa;
  --chrome-b: #c3c7cd;
  --chrome-c: #eef0f2;
  --chrome-d: #8e949d;
  --tick: #b9a98b;
  --lamp-off: #a89c88;
  --lamp-busy: #f5a51c;
  --lamp-ok: #37a852;
  --lamp-err: #d8362b;
  --check-a: #ffffff;       /* damier neutre derrière l'image */
  --check-b: #e4e4e2;
  --chip-edge: rgba(0, 0, 0, .3);
  --q-bg: #5a4a3e;
  --bezel: #f6eeda;         /* encadrement des hublots */
  --pattern: color-mix(in oklab, var(--body-b) 28%, var(--bg));     /* boomerangs du Formica */
  --pattern-2: color-mix(in oklab, var(--star) 38%, var(--bg));     /* ses étoiles */
}
/* éclairage de nuit : la teinte sombre du coloris remplace le crème, le capot garde sa couleur */
:root[data-eclairage="nuit"] {
  --enamel-a: color-mix(in oklab, var(--body-a) 90%, #000);
  --enamel-b: color-mix(in oklab, var(--body-b) 86%, #000);
  --accent: color-mix(in oklab, var(--tint-n) 82%, #000);
  --accent-hi: var(--tint-n);
  --accent-text: #17130f;
  --title: var(--ink-n);
  --bg: color-mix(in oklab, var(--night) 74%, #000);
  --panel: color-mix(in oklab, var(--night) 92%, #fff);
  --soft: var(--night);
  --line: color-mix(in oklab, var(--night) 78%, #fff);
  --text: #f4ead6;
  --muted: color-mix(in oklab, #f4ead6 64%, var(--night));
  --well: color-mix(in oklab, var(--night) 45%, #000);
  --key-a: color-mix(in oklab, var(--night) 68%, #fff);
  --key-b: color-mix(in oklab, var(--night) 79%, #fff);
  --key-edge: color-mix(in oklab, var(--night) 50%, #000);
  --key-shadow: color-mix(in oklab, var(--night) 38%, #000);
  --chrome-a: #dedede;
  --chrome-b: #8f9196;
  --chrome-c: #c6c7c9;
  --chrome-d: #5d6067;
  --tick: color-mix(in oklab, var(--night) 62%, #fff);
  --lamp-off: color-mix(in oklab, var(--night) 55%, #fff);
  --check-a: #2e2e30;
  --check-b: #252527;
  --chip-edge: rgba(255, 255, 255, .3);
  --q-bg: color-mix(in oklab, var(--night) 55%, #fff);
  --bezel: color-mix(in oklab, var(--night) 88%, #fff);
  --pattern: color-mix(in oklab, var(--body-b) 13%, var(--bg));
  --pattern-2: color-mix(in oklab, var(--star) 26%, var(--bg));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 14.5px/1.45 var(--ui);
}
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* ---------- capot (barre du haut) ---------- */
.bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 13px;
  background: linear-gradient(var(--enamel-a), var(--enamel-b));
  color: var(--on-enamel);
  flex-wrap: wrap;
}
/* jonc chromé (années 50) ou triple bande (années 70) */
.bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--trim-h);
  background: var(--trim);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
/* voyant + compteur : prennent la place restante, le texte passe sur deux lignes plutôt que de pousser les touches */
.readout { flex: 1 1 0; min-width: 16px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 4px; }
.readout .lamp { order: 2; }
.status {
  min-width: 0; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  font-size: 12.5px; font-weight: 500; line-height: 1.22; text-align: right; text-wrap: balance;
  font-variant-numeric: tabular-nums;
}

/* plaque de marque : le nom d'un seul tenant, dans le script des titres ; seul « -O- » change de couleur */
.brand { margin: 0 10px 0 0; font-size: inherit; line-height: 1; }
.plate {
  display: inline-block;
  padding: 4px 18px 7px 17px;
  border-radius: 999px;
  background: linear-gradient(var(--plate-a), var(--plate-b));
  color: var(--plate-text);
  font: 400 24px/1 var(--script);
  letter-spacing: .01em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    0 0 0 2px var(--chrome-c), 0 0 0 3.5px var(--chrome-d),
    0 3px 5px rgba(0, 0, 0, .28);
}
.plate i { font-style: normal; color: var(--plate-o); }

/* voyant : éteint, en marche (orange, clignote), prêt (vert), panne (rouge) */
.lamp {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .75), transparent 45%), var(--lamp-off);
  box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3px var(--chrome-d);
}
.lamp[data-state=busy] { background-color: var(--lamp-busy); animation: lamp .9s ease-in-out infinite; }
.lamp[data-state=ok] { background-color: var(--lamp-ok); box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3px var(--chrome-d), 0 0 9px 1px var(--lamp-ok); }
.lamp[data-state=err] { background-color: var(--lamp-err); box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3px var(--chrome-d), 0 0 9px 1px var(--lamp-err); }
@keyframes lamp {
  0%, 100% { box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3px var(--chrome-d), 0 0 3px 0 var(--lamp-busy); }
  50% { box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3px var(--chrome-d), 0 0 11px 3px var(--lamp-busy); }
}
@media (prefers-reduced-motion: reduce) { .lamp[data-state=busy] { animation: none; } }

/* ---------- touches ---------- */
.btn {
  font: 500 14px/1.2 var(--ui);
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid var(--key-edge);
  background: linear-gradient(var(--key-a), var(--key-b));
  color: var(--text);
  box-shadow: 0 2px 0 var(--key-shadow), inset 0 1px 0 rgba(255, 255, 255, .55);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .05s, box-shadow .05s;
}
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 var(--key-shadow), inset 0 1px 3px rgba(0, 0, 0, .25); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; box-shadow: none; border-color: color-mix(in srgb, currentColor 35%, transparent); color: inherit; }
.btn.ghost:hover:not(:disabled) { background: color-mix(in srgb, currentColor 9%, transparent); filter: none; }
.btn.primary {
  background: linear-gradient(var(--red-a), var(--red-b));
  border-color: var(--red-edge);
  color: var(--red-text);
  font-weight: 600; letter-spacing: .02em;
  box-shadow: 0 2px 0 var(--red-edge), inset 0 1px 0 rgba(255, 255, 255, .3);
}
/* la touche principale de la façade est sertie de chrome */
.bar .btn.primary { margin: 0 4px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 2px var(--chrome-c), 0 0 0 3.5px var(--chrome-d), 0 3px 4px 2px rgba(0, 0, 0, .22); }
.bar .btn.primary:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35), 0 0 0 2px var(--chrome-c), 0 0 0 3.5px var(--chrome-d); }
.btn.wide { width: 100%; }
.btn.round { width: 32px; height: 32px; padding: 0; border-radius: 50%; font-weight: 700; flex: none; }

/* rangée de touches façon mixeur : celle qui est enfoncée s'allume */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 11px;
  background: var(--well);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .25);
}
.seg button {
  flex: 1;
  font: 500 13.5px/1.2 var(--ui);
  padding: 6px 11px 7px;
  border: 0; border-radius: 8px;
  background: linear-gradient(var(--key-a), var(--key-b));
  color: var(--text);
  box-shadow: 0 2px 0 var(--key-shadow), inset 0 1px 0 rgba(255, 255, 255, .55);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: 2px;
}
.seg button:hover:not(.on) { filter: brightness(1.05); }
.seg button.on {
  background: linear-gradient(var(--accent), var(--accent-hi));
  color: var(--accent-text);
  font-weight: 600;
  transform: translateY(2px);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35);
}
.seg.small button { padding: 4px 8px 5px; font-size: 12.5px; }
.side .seg { display: flex; }

/* interrupteur à bascule */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input {
  -webkit-appearance: none; appearance: none;
  flex: none; margin: 0;
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--well);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .25);
  position: relative; cursor: pointer;
  transition: background .15s;
}
.check input::before {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--chrome-a), var(--chrome-b) 70%, var(--chrome-d));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  transition: transform .15s;
}
.check input:checked { background: var(--accent-hi); }
.check input:checked::before { transform: translateX(16px); }

/* ---------- zone principale ---------- */
main { flex: 1; display: flex; min-height: 0; }

/* les deux vues sont des hublots cerclés de chrome, comme la vitre d'un four ; l'intérieur reste neutre */
.viewer { flex: 1; display: flex; gap: 12px; padding: 11px; background: var(--bezel); position: relative; min-width: 0; }
.pane {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
  border-radius: 16px;
  box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3.5px var(--chrome-d), 0 2px 5px 2px rgba(0, 0, 0, .18), inset 0 2px 7px rgba(0, 0, 0, .22);
  cursor: grab;
  touch-action: none;
  background-color: var(--check-a);
  background-image:
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%),
    linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.pane.drag { cursor: grabbing; }
.viewer.svg #paneSrc, .viewer.src #paneSvg { display: none; }
/* boutons de zoom, posés en bas à droite de l'aperçu */
.zoom {
  position: absolute; right: 22px; bottom: 22px; z-index: 2;
  display: flex; gap: 7px; padding: 5px; border-radius: 999px;
  background: color-mix(in oklab, var(--panel) 80%, transparent);
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(0, 0, 0, .28);
}
.zoom .btn.round { font-size: 19px; line-height: 1; display: grid; place-items: center; }
.fit-icon { display: block; width: 14px; height: 11px; border: 2px solid currentColor; border-radius: 2px; }
/* étiquette gravée */
.tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 10px 3px 11px; border-radius: 6px;
  background: #33271f; color: #f6edd8;
  font: 600 10.5px/1.5 var(--ui); letter-spacing: .16em; text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .28), 0 1px 3px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage canvas, .stage svg { display: block; width: 100%; height: 100%; }
.stage.crisp canvas { image-rendering: pixelated; }
.viewer.outline #stageSvg path {
  fill-opacity: .14;
  stroke: #e0186c;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

/* ---------- accueil : la réclame ---------- */
/* Tant qu'aucune image n'est chargée, l'accueil occupe toute la page : ni réglages, ni commandes d'édition. */
body.home .ed, body.home .side { display: none; }
#btnColoris { margin-left: auto; }

/* ---------- nuancier : sept coloris et l'éclairage ---------- */
/* pastille bicolore : l'émail du capot et la couleur de la touche principale */
.dot, .sw { background: linear-gradient(135deg, var(--body-b) 0 50%, var(--red-a) 50%); border-radius: 50%; }
.dot { display: block; width: 18px; height: 18px; margin: auto; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .35); }
.swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 11px; }
.sw {
  width: 30px; height: 30px; padding: 0; border: 0; cursor: pointer;
  box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3.5px var(--chrome-d), 0 2px 3px 2px rgba(0, 0, 0, .2);
  transition: transform .1s;
}
.sw:hover { transform: scale(1.1); }
.sw.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 5px var(--text), 0 2px 3px 4px rgba(0, 0, 0, .2); }
.menu-name { margin: 9px 0 0; font-size: 13px; font-weight: 600; text-align: center; }
.menu {
  position: absolute; top: calc(100% + 4px); right: 12px; z-index: 20;
  width: 316px; max-width: calc(100vw - 24px);
  padding: 14px 16px 16px;
  border-radius: 16px;
  background: var(--panel); color: var(--text);
  box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3.5px var(--chrome-d), 0 12px 30px rgba(0, 0, 0, .35);
}
.menu-title { margin: 0 0 11px; font: 700 11.5px/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; }
.menu .check { margin: 10px 0 0; font-size: 13.5px; }
.menu .menu-title:not(:first-child) { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.menu .seg { display: flex; }
.menu .swatches { gap: 6px; align-items: flex-start; }
.sw-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sw-day small { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; color: var(--muted); }
.sw-day.today small { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.menu-text { margin: 0 0 12px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.menu-foot { margin: 12px 0 0; }

.empty { position: absolute; inset: 0; z-index: 3; overflow: hidden; background: var(--bg); }
/* plan de travail en Formica : boomerangs et étoiles, teintés par le coloris */
.empty::before, .empty::after { content: ""; position: absolute; inset: 0; -webkit-mask-size: 260px 260px; mask-size: 260px 260px; }
.empty::before {
  background: var(--pattern);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cpath d='M24 40c34-16 70 2 82 38-18-20-46-27-75-16zM228 150c-10 36-46 54-82 42 27-2 48-20 60-49zM150 28c36 8 56 42 46 78-4-26-22-47-52-57zM30 196c22-30 62-36 92-14-26-8-52-2-78 17z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cpath d='M24 40c34-16 70 2 82 38-18-20-46-27-75-16zM228 150c-10 36-46 54-82 42 27-2 48-20 60-49zM150 28c36 8 56 42 46 78-4-26-22-47-52-57zM30 196c22-30 62-36 92-14-26-8-52-2-78 17z'/%3E%3C/svg%3E");
}
.empty::after {
  background: var(--pattern-2);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cpath d='M72 118l3 10 10 3-10 3-3 10-3-10-10-3 10-3zM214 62l2 7 7 2-7 2-2 7-2-7-7-2 7-2zM176 226l2 7 7 2-7 2-2 7-2-7-7-2 7-2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cpath d='M72 118l3 10 10 3-10 3-3 10-3-10-10-3 10-3zM214 62l2 7 7 2-7 2-2 7-2-7-7-2 7-2zM176 226l2 7 7 2-7 2-2 7-2-7-7-2 7-2z'/%3E%3C/svg%3E");
}
.empty-scroll { position: absolute; inset: 0; z-index: 1; display: flex; overflow-y: auto; padding: 26px 24px 20px; }
.landing { margin: auto; width: 100%; max-width: 920px; text-align: center; }
/* la réclame : affiche illustrée, sur son papier crème dans les deux thèmes */
.ad { margin: 0 auto 22px; max-width: 800px; }
.ad img { display: block; width: 100%; height: auto; border: 3px solid #2f231c; border-radius: 22px; box-shadow: 0 4px 0 var(--line), 0 10px 24px rgba(0, 0, 0, .14); }
.ad figcaption { margin-top: 13px; font: 400 25px/1.15 var(--script); color: var(--title); }
.drop {
  position: relative;
  max-width: 620px; margin: 0 auto;
  border: 2px dashed var(--tick); border-radius: 26px;
  padding: 38px 40px 30px;
  background: var(--panel);
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
}
.drop:hover { border-color: var(--accent-hi); }
/* étoiles « atomiques » */
.drop::before, .drop::after {
  content: ""; position: absolute;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.drop::before { width: 44px; height: 44px; top: -20px; right: 34px; background: var(--star); }
.drop::after { width: 26px; height: 26px; bottom: 22px; left: 26px; background: var(--star-2); }
.big { font: 400 38px/1.1 var(--script); color: var(--title); margin: 0 0 8px; }
.slogan { font-weight: 700; font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--text); margin: 0 0 16px; }
.drop p { margin: 4px 0; color: var(--muted); }
.drop .big { margin-bottom: 8px; color: var(--title); }
.drop .slogan { margin-bottom: 16px; color: var(--text); }
.drop .drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
body.dropping .viewer { outline: 3px solid var(--accent-hi); outline-offset: -3px; }
body.dropping .drop { border-color: var(--accent-hi); border-style: solid; }

/* les grandes lignes : trois vignettes de réclame */
.pitch { list-style: none; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; text-align: left; }
.pitch li { padding: 15px 17px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--accent-hi); }
.pitch li:nth-child(2) { border-top-color: var(--star); }
.pitch li:nth-child(3) { border-top-color: var(--title); }
.pitch h2 { margin: 0 0 6px; font: 700 12px/1.3 var(--ui); letter-spacing: .14em; text-transform: uppercase; }
.pitch p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.landing-foot { margin: 22px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 6px 18px; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.link { font: 600 13.5px var(--ui); letter-spacing: 0; color: var(--accent-hi); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--title); }
@media (max-width: 760px) { .pitch { grid-template-columns: 1fr; } .drop { padding: 30px 20px 24px; } }

/* ---------- tableau de commande ---------- */
.side {
  width: 336px;
  flex: none;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--soft);
  padding: 4px 16px 18px 19px;
  scrollbar-width: thin; scrollbar-color: var(--key-edge) transparent;
}
.side section { padding: 14px 0 14px; border-bottom: 1px solid var(--line); }
.side section:last-of-type { border-bottom: 0; }
/* titre gravé : étoile, capitales espacées, double filet */
.side h2 {
  display: flex; align-items: center; gap: 9px;
  font: 700 11.5px/1 var(--ui); text-transform: uppercase; letter-spacing: .2em;
  color: var(--text); margin: 0 0 13px;
}
.side h2::before {
  content: ""; width: 11px; height: 11px; flex: none; background: var(--title);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.side h2::after { content: ""; flex: 1; height: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.side-top { padding: 12px 0 11px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ctl { margin-bottom: 13px; border-radius: 8px; }
.ctl-head { display: flex; align-items: center; gap: 7px; min-height: 22px; margin-bottom: 5px; }
.ctl-head label { font-weight: 600; }
.ctl-head output { margin-left: auto; }
.ctl input:disabled { opacity: .45; cursor: default; }
/* « ? » : ouvre l'explication du réglage, juste dessous */
.q {
  flex: none; width: 18px; height: 18px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--q-bg); color: #fbf3df;
  font: 700 11.5px/18px var(--ui); text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.q:hover { filter: brightness(1.25); }
.q[aria-expanded=true] { background: var(--accent-hi); color: var(--accent-text); }
.help {
  margin: 9px 0 2px; padding: 9px 12px 10px;
  border: 1px solid var(--line); border-left: 4px solid var(--accent-hi); border-radius: 10px;
  background: var(--soft);
  font-size: 12.5px; line-height: 1.42;
}
.help p { margin: 0 0 5px; }
.help p:last-child { margin-bottom: 0; }
/* réglage désigné depuis la notice */
.ctl.flash { animation: flash 1.8s ease-out; }
@keyframes flash {
  0%, 55% { box-shadow: 0 0 0 5px var(--panel), 0 0 0 8px var(--star); }
  100% { box-shadow: 0 0 0 5px var(--panel), 0 0 0 8px transparent; }
}
/* petite fenêtre de lecture */
.ctl output {
  padding: 0 8px; border-radius: 6px;
  background: var(--soft); border: 1px solid var(--line);
  color: var(--text); font-weight: 500; font-size: 12.5px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ctl output:empty { display: none; }
.hint { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.35; }

/* curseur : levier chromé dans sa fente, graduations dessous */
.ctl input[type=range] {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 34px; margin: 0;
  background: repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 10%) 8px 100% / calc(100% - 15px) 5px no-repeat;
  cursor: pointer;
}
.ctl input[type=range]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .35);
}
.ctl input[type=range]::-moz-range-track {
  height: 8px; border-radius: 4px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .35);
}
.ctl input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 24px; margin-top: -8px;
  border-radius: 5px; border: 1px solid var(--chrome-d);
  background:
    linear-gradient(var(--red-b), var(--red-b)) center / 2px 12px no-repeat,
    linear-gradient(90deg, var(--chrome-b), var(--chrome-a) 38%, var(--chrome-c) 62%, var(--chrome-b));
  box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
}
.ctl input[type=range]::-moz-range-thumb {
  box-sizing: border-box;
  width: 16px; height: 24px;
  border-radius: 5px; border: 1px solid var(--chrome-d);
  background:
    linear-gradient(var(--red-b), var(--red-b)) center / 2px 12px no-repeat,
    linear-gradient(90deg, var(--chrome-b), var(--chrome-a) 38%, var(--chrome-c) 62%, var(--chrome-b));
  box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
}

/* palette : pastilles à plat, pour ne pas fausser les couleurs */
.palette { display: flex; flex-wrap: wrap; gap: 7px; min-height: 30px; }
.chip {
  width: 30px; height: 30px; border-radius: 8px; padding: 0;
  border: 1px solid var(--chip-edge);
  cursor: pointer; position: relative;
}
.chip.sel { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.chip.merge::after, .chip.transparent::after, .chip.recolor::after {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000;
}
.chip.merge { opacity: .55; }
.chip.merge::after { content: "↷"; }
.chip.transparent::after { content: "∅"; }
.chip.recolor::after { content: "•"; }
.chip-panel {
  margin-top: 11px; padding: 11px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--soft);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08);
}
.chip-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.chip-head b { font: 600 13.5px var(--mono); }
.chip-head span:last-child { color: var(--muted); margin-left: auto; font-size: 12.5px; }
.swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--chip-edge); display: inline-block; }
.chip-panel .seg { display: flex; }
.recolor { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.recolor label { margin-right: auto; font-weight: 500; }
.recolor input[type=color] { width: 44px; height: 28px; padding: 0; border: 1px solid var(--key-edge); border-radius: 6px; background: none; cursor: pointer; }
.recolor input[type=text] {
  width: 92px; height: 28px; padding: 0 7px;
  font: 13px var(--mono);
  border: 1px solid var(--key-edge); border-radius: 6px;
  background: var(--panel); color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12);
}
.recolor input[type=text]:focus { outline: 2px solid var(--accent-hi); outline-offset: -1px; }
.recolor input[type=text].invalid { border-color: var(--lamp-err); outline-color: var(--lamp-err); }
.chip-panel .hint { margin-top: 9px; }
.chip-note { margin: 0 0 9px; font-size: 12.5px; }
.chip-title { margin: 0; font-weight: 600; }

/* pastilles numérotées quand deux couleurs sont sélectionnées pour une fusion */
.chip[data-n]::before {
  content: attr(data-n);
  position: absolute; top: -7px; right: -7px; z-index: 1;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--red-b); color: var(--red-text);
  font-size: 11px; font-weight: 700;
}
.merge-choice { display: flex; gap: 8px; margin: 10px 0 10px; }
.keep-btn {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px;
  font: inherit; color: var(--text);
  border: 1px solid var(--key-edge); border-radius: 10px;
  background: linear-gradient(var(--key-a), var(--key-b));
  box-shadow: 0 2px 0 var(--key-shadow), inset 0 1px 0 rgba(255, 255, 255, .55);
  cursor: pointer;
}
.keep-btn:hover { filter: brightness(1.04); }
.keep-btn:active { transform: translateY(2px); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25); }
.keep-btn .swatch { width: 36px; height: 36px; border-radius: 8px; }
.keep-btn b { font: 600 13px var(--mono); }
.keep-btn small { color: var(--muted); }

/* graduations chiffrées sous les curseurs */
.scale { display: flex; justify-content: space-between; margin: 1px 2px 0; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }

/* grille d'aération et plaque signalétique rivetée, au bas du tableau de commande */
.grille {
  height: 30px; margin: 10px 26px 0;
  background: repeating-linear-gradient(90deg, var(--well) 0 5px, transparent 5px 13px);
  border-radius: 4px; opacity: .8;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% 8px no-repeat, linear-gradient(#000 0 0) center / 100% 8px no-repeat, linear-gradient(#000 0 0) bottom / 100% 8px no-repeat;
  mask: linear-gradient(#000 0 0) top / 100% 8px no-repeat, linear-gradient(#000 0 0) center / 100% 8px no-repeat, linear-gradient(#000 0 0) bottom / 100% 8px no-repeat;
}
.version {
  margin: 14px 8px 0; padding: 9px 30px 8px;
  border-radius: 7px;
  color: #2f2a26; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; text-align: center;
  background:
    radial-gradient(circle at 13px 50%, #5d6068 0 1.2px, #f4f4f2 1.8px 4.2px, #7c8088 4.8px 5.4px, transparent 6px),
    radial-gradient(circle at calc(100% - 13px) 50%, #5d6068 0 1.2px, #f4f4f2 1.8px 4.2px, #7c8088 4.8px 5.4px, transparent 6px),
    linear-gradient(var(--chrome-a), var(--chrome-b) 55%, var(--chrome-c));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 0 1px var(--chrome-d), 0 2px 3px rgba(0, 0, 0, .25);
}
.version::before { content: "SVG-O-Matic · "; }
.side-legal { margin: 12px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.side-legal .link, .landing-foot .link { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.notice p { margin: 0 0 4px; line-height: 1.5; }
.notice p .link { font: inherit; font-weight: 600; }
.notice-more { margin-top: 18px !important; }
/* en usage local (fichier ouvert par double-clic), pas de serveur : pas de formulaire de contact */
body.no-contact .js-contact, body.no-contact .js-contact-wrap { display: none; }

/* ---------- formulaire de contact ---------- */
.contact-form { margin-top: 16px; }
.contact-form label { display: block; margin: 14px 0 5px; font-weight: 600; }
.contact-form label small { font-weight: 400; color: var(--muted); }
.contact-form textarea, .contact-form input[type=email] {
  display: block; width: 100%; padding: 9px 11px;
  font: 15px/1.45 var(--ui); color: var(--text);
  border: 1px solid var(--key-edge); border-radius: 10px; background: var(--soft);
}
.contact-form textarea { min-height: 150px; resize: vertical; }
.contact-form textarea:focus, .contact-form input[type=email]:focus { outline: 2px solid var(--accent-hi); outline-offset: -1px; }
.contact-form .hint { margin-top: 7px; }
/* champ piège pour les robots : hors de l'écran, hors de la tabulation, ignoré des lecteurs d'écran */
.pot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-state { min-height: 1.5em; margin: 12px 0 0 !important; font-weight: 600; }
.contact-state.bad { color: var(--lamp-err); }
.contact-actions { margin: 10px 0 0 !important; }
.contact-done { margin-top: 22px; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--lamp-ok); border-radius: 10px; background: var(--soft); }

/* ---------- notice d'utilisation ---------- */
.notice {
  width: min(680px, calc(100vw - 28px)); max-height: min(86vh, 900px);
  padding: 0; border: 0; border-radius: 20px;
  background: var(--panel); color: var(--text);
  box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 4px var(--chrome-d), 0 18px 50px rgba(0, 0, 0, .45);
  overflow-y: auto;
}
.notice::backdrop { background: rgba(24, 15, 10, .58); }
.notice-body { position: relative; padding: 28px 32px 30px; }
.notice-close { position: sticky; top: 14px; float: right; margin: -12px -14px 0 12px; background: var(--panel); z-index: 1; }
.notice h2 { margin: 0 0 6px; font: 400 36px/1.1 var(--script); color: var(--title); }
.notice .slogan { margin: 0 0 4px; font-size: 10.5px; color: var(--muted); }
.notice h3 {
  display: flex; align-items: center; gap: 9px;
  margin: 24px 0 11px;
  font: 700 11.5px/1 var(--ui); letter-spacing: .2em; text-transform: uppercase;
}
.notice h3::before {
  content: ""; width: 11px; height: 11px; flex: none; background: var(--title);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.notice h3::after { content: ""; flex: 1; height: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.notice li, .notice dd, .notice dt { line-height: 1.45; }
/* les trois gestes : pastilles numérotées */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: geste; display: grid; gap: 9px; }
.steps li { counter-increment: geste; position: relative; padding-left: 38px; }
.steps li::before {
  content: counter(geste);
  position: absolute; left: 0; top: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(var(--red-a), var(--red-b)); color: var(--red-text);
  font-weight: 700; font-size: 13.5px;
  box-shadow: 0 0 0 2px var(--chrome-c), 0 0 0 3px var(--chrome-d);
}
/* symptôme → remède */
.fixes { margin: 0; display: grid; gap: 8px; }
.fixes > div { padding: 9px 13px 10px; border: 1px solid var(--line); border-left: 4px solid var(--star); border-radius: 10px; background: var(--soft); }
.fixes dt { font-weight: 600; }
.fixes dd { margin: 2px 0 0; color: var(--muted); }
.goto {
  margin-left: 4px; padding: 1px 9px 2px;
  font: 600 12px var(--ui);
  border: 1px solid var(--key-edge); border-radius: 999px;
  background: linear-gradient(var(--key-a), var(--key-b)); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.goto:hover { filter: brightness(1.06); }
body.home .goto { display: none; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.plain li::marker { color: var(--title); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #33271f; color: #f6edd8;
  padding: 9px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500; z-index: 10; max-width: 80vw;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 4px 12px rgba(0, 0, 0, .35);
}

@media (max-width: 860px) {
  main { flex-direction: column; }
  .viewer { min-height: 52vh; }
  .side { width: auto; border-left: 0; border-top: 1px solid var(--line); box-shadow: none; padding-left: 16px; }
  .readout { flex-basis: 100%; justify-content: flex-start; padding: 0; }
  .readout .lamp { order: 0; }
  .status { text-align: left; }
}

/* ---------- téléphone ---------- */
/* La consigne de l'accueil parle du doigt, pas de la souris. */
.for-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .for-mouse { display: none; }
  .for-touch { display: block; }
}
/* Au doigt, des cibles plus larges : « ? », touches, pastilles, boutons ronds. */
@media (pointer: coarse) {
  .q { width: 28px; height: 28px; font-size: 14px; line-height: 28px; }
  .ctl-head { min-height: 30px; }
  .seg button { padding-top: 10px; padding-bottom: 11px; }
  .seg.small button { padding-top: 8px; padding-bottom: 9px; }
  .chip { width: 38px; height: 38px; }
  .btn.round { width: 40px; height: 40px; }
  .zoom .btn.round { width: 44px; height: 44px; font-size: 23px; }
  .goto { padding: 6px 12px 7px; }
  .link { padding: 6px 0; }
}
@media (max-width: 620px) {
  /* Capot rangé en lignes : la marque et les boutons ronds ; ouvrir, fermer, contours ; les trois vues ; le compteur ;
     copier et télécharger. */
  .bar { gap: 8px; padding: 8px 12px 13px; }
  .brand { order: -3; flex: 1 0 calc(100% - 112px); margin-right: 0; }
  #btnColoris { order: -2; margin-left: 0; }
  #btnHelp { order: -1; }
  #btnOpen, #btnClose { flex: 1; }
  #viewMode { order: 1; flex: 1 0 100%; }
  .readout { order: 2; }
  #btnCopy { order: 3; flex: 1; }
  #btnSave { order: 3; flex: 2; }
  /* Les deux vues l'une sous l'autre, sauf pour une image en hauteur, mieux servie côte à côte. */
  .viewer { min-height: 58vh; gap: 10px; padding: 9px; }
  .viewer.both:not(.portrait) { flex-direction: column; }
  .zoom { right: 16px; bottom: 16px; }
  .notice-body { padding: 22px 18px 24px; }
}
