/* ─── Reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --forest:     #1a2e1a;
  --forest-mid: #2d4a2d;
  --forest-lt:  #4a7c59;
  --sage:       #7ec896;
  --sage-lt:    #b8dfc5;
  --cream:      #f4f1ea;
  --cream-mid:  #e8e3d8;
  --warm-gray:  #8a8679;
  --red-trail:  #e05c4b;
  --text:       #1c1c18;
  --text-mid:   #4a4840;
  --text-lt:    #7a7870;
  --white:      #ffffff;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(26,46,26,.12);
  --shadow-md:  0 4px 16px rgba(26,46,26,.14);
  --transition: .18s ease;
}

html { font-size: 16px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─────────────────────────────────────────────── */
.app-header {
  background: var(--forest);
  color: var(--white);
  padding: .85rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-text { font-family: 'Bitter', Georgia, serif; font-size: 1.2rem; font-weight: 600; letter-spacing: -.01em; }
.logo-text em { font-style: normal; color: var(--sage); margin-left: 2px; }
.header-tagline { font-size: .75rem; color: var(--sage-lt); opacity: .8; display: none; }
@media(min-width:600px) { .header-tagline { display: block; } }

/* ─── Main layout ─────────────────────────────────────────── */
.app-main { flex: 1; max-width: 960px; margin: 0 auto; width: 100%; padding: 1.25rem 1rem 2rem; }

/* ─── Stepper ─────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: .6rem 1rem;
  box-shadow: var(--shadow-sm);
}
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: var(--radius);
  transition: var(--transition);
  color: var(--text-lt);
}
.step:hover { background: var(--cream); }
.step.active { color: var(--forest); }
.step.done { color: var(--forest-lt); }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--cream-mid);
  font-size: .7rem; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.step.active .step-num { background: var(--forest); color: var(--white); }
.step.done .step-num { background: var(--forest-lt); color: var(--white); }
.step-lbl { font-size: .8rem; font-weight: 400; }
.step-line { flex: 1; height: 1px; background: var(--cream-mid); margin: 0 .25rem; min-width: 10px; }

/* ─── Panels ─────────────────────────────────────────────── */
.panel { display: none; animation: fadeIn .22s ease; }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px) } to { opacity:1; transform:translateY(0) } }

.panel-title {
  font-family: 'Bitter', serif;
  font-size: 1.25rem; font-weight: 600;
  color: var(--forest);
  margin-bottom: .35rem;
}
.panel-sub {
  font-size: .85rem; color: var(--text-lt);
  line-height: 1.6; margin-bottom: 1.2rem;
}

/* ─── Drop zone ──────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--cream-mid);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--white);
}
.drop-zone:hover, .drop-zone.over {
  border-color: var(--forest-lt);
  background: #f0f7f2;
}
.dz-icon { color: var(--forest-lt); margin-bottom: .75rem; }
.dz-main { font-size: .95rem; color: var(--text-mid); margin-bottom: .3rem; }
.dz-sub { font-size: .82rem; color: var(--text-lt); }
.file-link { color: var(--forest-lt); cursor: pointer; text-decoration: underline; }
#file-inp { display: none; }

.thumb-wrap { margin-top: 1rem; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--cream-mid); box-shadow: var(--shadow-sm); }
.thumb-wrap img { display: block; width: 100%; max-height: 280px; object-fit: contain; background: #f8f8f8; }
.thumb-meta { font-size: .78rem; color: var(--text-lt); padding: .5rem .75rem; background: var(--cream); }

/* ─── Dual pane ──────────────────────────────────────────── */
.dual-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  height: 400px;
  margin-bottom: 1rem;
}
@media(max-width: 640px) { .dual-pane { grid-template-columns: 1fr; height: auto; } }

.pane {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--cream-mid);
  background: #e8e8e8;
  min-height: 200px;
}
@media(max-width: 640px) { .pane { height: 250px; } }

.pane-badge {
  position: absolute; top: 8px; left: 8px; z-index: 500;
  background: rgba(26,46,26,.75);
  color: var(--white);
  font-size: .68rem; padding: 2px 9px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
#jpg-map { width: 100%; height: 100%; }
/* Pas de cursor: grab par défaut sur jpg-map en mode picking */
#leaflet-map { width: 100%; height: 100%; }

.pick-hint {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(26,46,26,.8);
  color: var(--white); font-size: .72rem;
  padding: 4px 12px; border-radius: 99px;
  pointer-events: none; white-space: nowrap;
  z-index: 600; backdrop-filter: blur(4px);
}
.pick-hint strong { color: var(--sage); }

/* ─── GCP table ──────────────────────────────────────────── */
.gcp-section { background: var(--white); border-radius: var(--radius-lg); padding: .9rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.gcp-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.gcp-table th { text-align: left; padding: 4px 8px; font-size: .72rem; font-weight: 500; color: var(--text-lt); border-bottom: 1px solid var(--cream-mid); }
.gcp-table td { padding: 6px 8px; border-bottom: 1px solid var(--cream); }
.gcp-table tr.picking td { background: #edf5f1; }
.gcp-dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.gcp-del { background: none; border: none; color: var(--text-lt); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.gcp-del:hover { color: var(--red-trail); background: #fef0ee; }

.btn-add-gcp {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--forest-lt);
  color: var(--forest-lt);
  background: transparent;
  font-size: .78rem; cursor: pointer;
  transition: var(--transition);
  margin-top: .6rem;
}
.btn-add-gcp:hover { background: #edf5f1; }
.gcp-hint { font-size: .72rem; color: var(--text-lt); margin-top: .5rem; line-height: 1.5; }

/* ─── Pipette ─────────────────────────────────────────────── */
/* Image pleine largeur, loupe suit le curseur */
.pip-full-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--cream-mid);
  background: #f0f0f0;
  cursor: crosshair;
  margin-bottom: .75rem;
}
#pip-canvas {
  display: block;
  width: 100%;
  height: auto; /* hauteur proportionnelle */
  max-height: 55vh;
  object-fit: contain;
}

/* Loupe flottante — positionnée en JS près du curseur */
#pip-cursor-ui {
  position: absolute;
  pointer-events: none;
  display: none;
  width: 130px;
  background: rgba(20,35,20,.92);
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 3px 12px rgba(0,0,0,.4);
  z-index: 100;
}
#zoom-canvas {
  display: block;
  width: 96px; height: 96px;
  image-rendering: pixelated;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,.25);
}
#pip-color-chip {
  height: 16px;
  border-radius: 4px;
  margin: 4px 0 2px;
  background: #e63030;
  transition: background .05s;
}
#pip-color-label {
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  text-align: center;
}

/* Barre de confirmation sous l'image */
.pip-confirm-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: .65rem 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: .65rem;
  flex-wrap: wrap;
}
.pip-confirm-color { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 140px; }
.swatch-confirm {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--cream-mid);
  background: #e63030;
  flex-shrink: 0;
  transition: background .1s;
}
.hex-display { font-size: .9rem; font-family: monospace; color: var(--text-mid); font-weight: 500; }
.rgb-display { font-size: .72rem; color: var(--text-lt); }

.color-confirmed {
  display: flex; align-items: center; gap: 5px;
  font-size: .75rem; color: var(--forest-lt);
  background: #edf5f1; border-radius: 6px; padding: 4px 8px;
}
.cc-chip { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* Ligne de presets */
.presets-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: .75rem; flex-wrap: wrap;
}
.presets-label { font-size: .78rem; color: var(--text-lt); }
.preset {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer; transition: var(--transition);
}
.preset:hover { transform: scale(1.25); border-color: var(--white); box-shadow: 0 0 0 2px var(--forest-lt); }

.tol-row { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
.tol-row label { font-size: .82rem; color: var(--text-mid); white-space: nowrap; }
.tol-row input[type=range] { flex: 1; accent-color: var(--forest-lt); }
.tol-row span { font-size: .82rem; color: var(--text-mid); min-width: 28px; text-align: right; }

/* ─── Options grid ───────────────────────────────────────── */
.opts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.2rem; }
@media(max-width: 480px) { .opts-grid { grid-template-columns: 1fr; } }

.opt-field label { font-size: .78rem; color: var(--text-lt); display: block; margin-bottom: 4px; }
.opt-field input, .opt-field select {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--cream-mid);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  background: var(--white);
  color: var(--text);
  transition: var(--transition);
}
.opt-field input:focus, .opt-field select:focus {
  outline: none;
  border-color: var(--forest-lt);
  box-shadow: 0 0 0 3px rgba(74,124,89,.15);
}

.divider { border: none; border-top: 1px solid var(--cream-mid); margin: 1rem 0; }

/* ─── Progress & log ─────────────────────────────────────── */
.prog-block { background: var(--white); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); margin-bottom: 1rem; }
.prog-bg { height: 6px; background: var(--cream-mid); border-radius: 99px; overflow: hidden; }
.prog-bar { height: 100%; background: linear-gradient(90deg, var(--forest-lt), var(--sage)); border-radius: 99px; width: 0; transition: width .35s ease; }
.prog-label { font-size: .82rem; color: var(--text-lt); margin-top: .5rem; }
.log-area {
  font-size: .75rem; font-family: monospace;
  color: var(--text-lt);
  background: var(--cream);
  border-radius: var(--radius);
  padding: .75rem;
  max-height: 120px; overflow-y: auto;
  margin-top: .75rem;
  line-height: 1.9;
}

/* ─── Result ─────────────────────────────────────────────── */
.result-block { }
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 1rem; }
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: .9rem 1rem; box-shadow: var(--shadow-sm); text-align: center; }
.stat-val { font-family: 'Bitter', serif; font-size: 1.5rem; font-weight: 600; color: var(--forest); }
.stat-lbl { font-size: .72rem; color: var(--text-lt); margin-top: 2px; }

.result-canvas-wrap { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--cream-mid); margin-bottom: 1rem; background: #f0f0f0; }
#res-canvas { display: block; width: 100%; }
.canvas-legend { display: flex; gap: 1rem; padding: .5rem .75rem; background: var(--cream); font-size: .72rem; flex-wrap: wrap; }
.leg { display: flex; align-items: center; gap: 4px; color: var(--text-lt); }
.leg.start::before { content:''; width: 10px; height: 10px; border-radius: 50%; background: #00e676; flex-shrink: 0; }
.leg.end::before { content:''; width: 10px; height: 10px; border-radius: 50%; background: #ff1744; flex-shrink: 0; }
.leg.trace::before { content:''; width: 20px; height: 3px; background: rgba(0,200,100,.8); border-radius: 2px; flex-shrink: 0; }

.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: .75rem; }
.dl-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; border-radius: var(--radius-lg);
  border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem; font-weight: 500;
  transition: var(--transition);
}
.dl-btn.gpx { background: var(--forest); color: var(--white); }
.dl-btn.gpx:hover { background: var(--forest-mid); }
.dl-btn.kml { background: var(--white); color: var(--forest); border: 1px solid var(--forest-lt); }
.dl-btn.kml:hover { background: var(--cream); }
.restart-btn { width: 100%; justify-content: center; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  height: 38px; padding: 0 20px;
  background: var(--forest);
  color: var(--white);
  border: none; border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-primary:hover { background: var(--forest-mid); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; pointer-events: none; }
.btn-ghost {
  height: 38px; padding: 0 16px;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--cream-mid);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem; cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--cream-mid); }

.nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 1.2rem; }

/* ─── Footer ─────────────────────────────────────────────── */
.app-footer {
  background: var(--forest);
  color: rgba(255,255,255,.45);
  font-size: .72rem;
  text-align: center;
  padding: .75rem 1rem;
}
.app-footer a { color: var(--sage-lt); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }

/* ─── Map pick overlay ───────────────────────────────────── */
/* L'overlay est créé et stylisé dynamiquement dans app.js    */
/* après L.map() — il est dernier enfant de map.getContainer() */
#map-pick-overlay {
  display: none;
  pointer-events: none;
}

/* ─── Leaflet overrides ──────────────────────────────────── */
.leaflet-control-zoom a { font-family: 'DM Sans', sans-serif !important; }
.leaflet-popup-content-wrapper { border-radius: var(--radius) !important; font-family: 'DM Sans', sans-serif !important; }

/* ─── Panel IA (step 2) ──────────────────────────────────── */
.card-section {
  display: flex;
  gap: 12px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  margin-bottom: .75rem;
  box-shadow: var(--shadow-sm);
  align-items: flex-start;
}
.section-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
  width: 24px;
  text-align: center;
}
.section-body { flex: 1; min-width: 0; }
.field-label {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.field-link {
  font-size: .75rem;
  color: var(--forest-lt);
  text-decoration: none;
  font-weight: 400;
}
.field-link:hover { text-decoration: underline; }
.field-hint {
  font-size: .72rem;
  color: var(--text-lt);
  margin-top: 5px;
  line-height: 1.5;
}
.api-key-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.api-key-row input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--cream-mid);
  border-radius: var(--radius);
  font-family: monospace;
  font-size: .82rem;
  background: var(--white);
  color: var(--text);
}
.api-key-row input:focus {
  outline: none;
  border-color: var(--forest-lt);
  box-shadow: 0 0 0 3px rgba(74,124,89,.15);
}
.btn-sm {
  height: 36px;
  padding: 0 12px;
  font-size: .82rem;
}
#trace-desc {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--cream-mid);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .83rem;
  background: var(--white);
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
}
#trace-desc:focus {
  outline: none;
  border-color: var(--forest-lt);
  box-shadow: 0 0 0 3px rgba(74,124,89,.15);
}

/* Aperçu image avec overlay points IA */
.img-preview-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--cream-mid);
  margin-bottom: .75rem;
  background: #f0f0f0;
}
.img-preview-wrap img {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
}
#ai-pts-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Bouton IA principal */
#btn-extract {
  min-width: 200px;
  height: 44px;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#btn-extract:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ─── Panel détection (step 2) ───────────────────────────── */
.detect-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: .75rem;
}
@media(max-width:600px){ .detect-layout { grid-template-columns: 1fr; } }

.detect-pane { display: flex; flex-direction: column; gap: 4px; }
.detect-pane-label {
  font-size: .72rem; font-weight: 500; color: var(--text-lt);
  text-transform: uppercase; letter-spacing: .04em;
}
#mask-canvas {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--cream-mid);
  background: #eee;
}

/* Barre couleur */
.color-bar {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: .75rem 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.color-bar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }

/* Champs RGB éditables */
.rgb-inputs {
  display: flex; gap: 6px; align-items: center;
  border-left: 1px solid var(--cream-mid);
  padding-left: 10px; margin-left: 4px;
}
.rgb-inputs label {
  display: flex; flex-direction: column; align-items: center;
  font-size: .68rem; color: var(--text-lt); gap: 2px;
}
.rgb-inputs input[type=number] {
  width: 50px; height: 30px; padding: 0 4px;
  border: 1px solid var(--cream-mid);
  border-radius: var(--radius);
  font-size: .8rem; text-align: center;
  background: var(--white); color: var(--text);
}
.rgb-inputs input[type=number]:focus {
  outline: none; border-color: var(--forest-lt);
  box-shadow: 0 0 0 2px rgba(74,124,89,.15);
}

/* Filtres */
.filters-grid {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: .85rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
}
.filter-row {
  display: flex; align-items: center; gap: 10px;
}
.filter-row label {
  font-size: .8rem; color: var(--text-mid);
  min-width: 200px; display: flex; align-items: center; gap: 6px;
}
.filter-hint { font-size: .7rem; color: var(--text-lt); font-style: italic; }
.filter-row input[type=range] { flex: 1; accent-color: var(--forest-lt); }
.filter-row span { font-size: .8rem; color: var(--text-mid); min-width: 36px; text-align: right; }
@media(max-width:500px){ .filter-row { flex-wrap: wrap; } .filter-row label { min-width: unset; } }

/* ── Baguette magique (panel 2) ───────────────────────────── */
.kbd-hint { display:block; font-size:.75rem; color:var(--text-lt); margin-top:4px; }
kbd { display:inline-block; padding:1px 6px; border:1px solid var(--cream-mid); border-radius:4px; font-family:var(--font-mono,monospace); font-size:.72rem; background:var(--cream); color:var(--text-mid); }

.wand-toolbar {
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  background:var(--white); border-radius:var(--radius-lg);
  padding:.65rem 1rem; box-shadow:var(--shadow-sm); margin-bottom:.6rem;
}
.wand-tool-group { display:flex; gap:6px; }
.tool-btn {
  display:flex; align-items:center; gap:6px;
  height:34px; padding:0 12px;
  border:1px solid var(--cream-mid); border-radius:var(--radius);
  background:transparent; color:var(--text-mid); font-size:.82rem;
  cursor:pointer; transition:var(--transition);
}
.tool-btn:hover { background:var(--cream); }
.tool-btn.active { background:var(--forest); color:#fff; border-color:var(--forest); }

.wand-tol-group { display:flex; align-items:center; gap:8px; flex:1; min-width:200px; }
.wand-tol-group label { font-size:.78rem; color:var(--text-mid); white-space:nowrap; }
.wand-tol-group input[type=range] { width:90px; accent-color:var(--forest-lt); }
.wand-tol-group span { font-size:.78rem; color:var(--text-mid); min-width:24px; }
.wand-tol-group select { height:30px; padding:0 6px; border:1px solid var(--cream-mid); border-radius:var(--radius); font-size:.78rem; background:var(--white); color:var(--text); }

.wand-actions { display:flex; align-items:center; gap:10px; margin-left:auto; }
.sel-stats { font-size:.75rem; color:var(--text-lt); white-space:nowrap; }

/* Canvas baguette */
.wand-canvas-wrap {
  position:relative;
  border-radius:var(--radius-lg);
  overflow:hidden;
  border:1px solid var(--cream-mid);
  background:#ccc;
  margin-bottom:.75rem;
  user-select:none;
  touch-action:none;
}
#wand-canvas { display:block; cursor:crosshair; }

/* Loupe */
#wand-loupe {
  position:absolute; pointer-events:none; display:none;
  background:rgba(20,35,20,.9); border-radius:10px; padding:5px;
  box-shadow:0 3px 12px rgba(0,0,0,.5); z-index:100; width:90px;
}
#loupe-canvas { display:block; width:80px; height:80px; image-rendering:pixelated; border-radius:5px; border:1px solid rgba(255,255,255,.2); }
#loupe-color { height:14px; border-radius:3px; margin-top:4px; background:#0000ff; }

/* ── Pastilles couleur overlay ────────────────────────────── */
.overlay-color-label {
  display:flex; align-items:center; gap:7px;
  font-size:.78rem; color:var(--text-mid); cursor:default;
}
.overlay-color-swatches { display:flex; gap:5px; }
.ov-swatch {
  width:22px; height:22px; border-radius:50%;
  border:2px solid transparent;
  cursor:pointer; transition:transform .12s, border-color .12s;
  flex-shrink:0;
}
.ov-swatch:hover { transform:scale(1.2); }
.ov-swatch.active {
  border-color:var(--forest);
  box-shadow:0 0 0 2px var(--white), 0 0 0 4px var(--forest-lt);
}
