:root {
  --fond: #13151a;
  --carte: #1c1f27;
  --trait: #2c313d;
  --texte: #e8e9ee;
  --doux: #9aa1b1;
  --accent: #4f8cff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--trait);
}
h1 { font-size: 19px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; color: var(--doux); text-transform: uppercase; letter-spacing: .04em; }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
.carte {
  background: var(--carte); border: 1px solid var(--trait); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.cache { display: none; }
.aide { color: var(--doux); font-size: 14px; }
.alerte { color: #ff8a8a; }
.ligne { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.bouton {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  border-radius: 10px; padding: 12px 16px; font-size: 16px; cursor: pointer;
  text-decoration: none; text-align: center;
}
.bouton:disabled { opacity: .5; cursor: default; }
.bouton.gris { background: #39404f; }
.bouton.rouge { background: #b7343b; }
.bouton.mini { padding: 6px 10px; font-size: 14px; border-radius: 8px; }
.fichier { display: inline-block; }
label { display: block; margin: 12px 0 6px; color: var(--doux); font-size: 14px; }
.case { display: flex; align-items: center; gap: 10px; color: var(--texte); font-size: 16px; margin: 10px 0; }
.case input { width: 20px; height: 20px; }
input[type=password], input[type=text], textarea, select {
  width: 100%; background: #11131a; color: var(--texte);
  border: 1px solid var(--trait); border-radius: 10px; padding: 12px; font-size: 16px;
}
select { appearance: none; cursor: pointer; }
#estimation {
  margin-top: 14px; padding: 10px 12px; background: #11131a;
  border: 1px solid var(--trait); border-radius: 10px; color: var(--texte); font-size: 14px;
}

/* dépôt */
#depot {
  border: 2px dashed #3d465a; border-radius: 14px; background: #11131a;
  padding: 38px 16px; text-align: center; cursor: pointer; transition: .15s;
}
#depot:hover, #depot:focus { border-color: var(--accent); background: #141824; outline: none; }
#depot.survol { border-color: var(--accent); background: #16203a; }
.depot-titre { font-size: 20px; font-weight: 600; margin-bottom: 6px; }

#cadre { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
#base { max-width: 100%; height: auto; border-radius: 8px; display: block; }
#morceaux, #calque { position: absolute; inset: 0; }
#morceaux { pointer-events: none; }
img.morceau { position: absolute; display: block; }
#calque { width: 100%; height: 100%; }
.barre { background: #11131a; border-radius: 8px; height: 12px; overflow: hidden; }
#jauge { background: var(--accent); height: 100%; width: 0; transition: width .4s; }
.lien { color: var(--doux); font-size: 14px; }

/* liste des défauts */
#liste-defauts { margin-top: 12px; }
.defaut {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--trait);
}
.defaut .coche { width: 20px; height: 20px; flex: 0 0 auto; }
.defaut .num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: #ffd23b;
  color: #13151a; font-weight: 700; font-size: 13px; display: flex;
  align-items: center; justify-content: center;
}
.defaut .txt { flex: 1 1 auto; padding: 8px; font-size: 14px; }
.defaut .conf { flex: 0 0 auto; color: var(--doux); font-size: 13px; min-width: 56px; text-align: right; }

/* comparateur avant / après */
#comparateur {
  position: relative; width: 100%; height: min(70vh, 680px);
  background: #0d0f14; border-radius: 10px; overflow: hidden;
  touch-action: none; cursor: grab; user-select: none;
}
.cmp-couche { position: absolute; inset: 0; overflow: hidden; }
.cmp-couche img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; transform-origin: 0 0; pointer-events: none;
  -webkit-user-drag: none; user-select: none;
}
#cmp-haut { clip-path: inset(0 0 0 50%); }
#cmp-barre {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6); transform: translateX(-1px);
}
#cmp-barre span {
  position: absolute; top: 50%; left: 50%; width: 34px; height: 34px;
  margin: -17px 0 0 -17px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,.6);
}
#cmp-barre span::before {
  content: "↔"; position: absolute; inset: 0; color: #13151a;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.cmp-etiq {
  position: absolute; top: 8px; padding: 3px 9px; border-radius: 8px;
  background: rgba(0,0,0,.55); font-size: 13px; color: #fff; pointer-events: none;
}
.cmp-etiq.gauche { left: 8px; }
.cmp-etiq.droite { right: 8px; }

@media (max-width: 600px) {
  main { padding: 10px; }
  .carte { padding: 12px; }
  .defaut { flex-wrap: wrap; }
  .defaut .txt { flex: 1 1 100%; order: 3; }
  #comparateur { height: 60vh; }
}
