/* LEGO Montage Studio - une seule famille de caractères (Baloo 2, comme le simulateur VinciBot),
   l'orange de VinciBot réservé aux actions principales, la scène 3D bleu-gris au centre de tout. */
@font-face { font-family: "Baloo 2"; font-weight: 500; font-display: swap; src: url(vendor/fonts/baloo-2-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 600; font-display: swap; src: url(vendor/fonts/baloo-2-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(vendor/fonts/baloo-2-latin-700-normal.woff2) format("woff2"); }

:root {
  --orange: #f07c22; --orange-fonce: #cf6410; --orange-pale: #fdeede;
  --encre: #1f2a37; --gris: #5d6978; --trait: #d7dde5; --papier: #f3f5f8; --blanc: #ffffff;
  --scene: #c4cfdc;                      /* fond de la vue 3D : bleu-gris, jamais blanc */
  --vert: #18794e; --vert-pale: #e1f4e9; --rouge: #c93c3c; --rouge-pale: #fdeae8;
  --x: #d64545; --y: #2f9e44; --z: #2f6fd6;
  --ombre: 0 6px 22px rgba(31, 42, 55, .16);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.simple .avance { display: none !important; }
body:not(.simple) .simple-seul { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 500 15px/1.35 "Baloo 2", "Segoe UI", system-ui, sans-serif; color: var(--encre); background: var(--papier);
  display: flex; flex-direction: column; overflow: hidden; }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.ic { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- boutons et champs */
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 4px 12px;
  background: var(--blanc); border: 1px solid var(--trait); border-radius: 9px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, background-color .12s; }
button:hover { border-color: var(--encre); }
button:disabled { opacity: .42; cursor: default; border-color: var(--trait); }
button.principal { background: var(--orange); border-color: var(--orange); color: #fff; }
button.principal:hover { background: var(--orange-fonce); border-color: var(--orange-fonce); }
button.danger { color: var(--rouge); }
button.danger:hover { border-color: var(--rouge); background: var(--rouge-pale); }
button.icone { padding: 4px; width: 34px; }
button.large { width: 100%; margin-top: 6px; justify-content: flex-start; text-align: left; line-height: 1.2; padding: 7px 12px; }
button.principal.large { justify-content: center; padding: 9px; }
select, input[type=text], input[type=search], textarea { border: 1px solid var(--trait); border-radius: 9px; padding: 6px 10px;
  background: var(--blanc); width: 100%; min-height: 34px; }
select:hover, input[type=text]:hover, input[type=search]:hover, textarea:hover { border-color: var(--gris); }
textarea { resize: vertical; line-height: 1.35; }
h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.aide { color: var(--gris); font-size: 14px; margin: 6px 0; }
.erreur { color: var(--rouge); font-size: 14px; margin: 8px 0 0; }
.pousse { flex: 1; }

/* ---------------------------------------------------------------- en-tête */
header { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--blanc); border-bottom: 1px solid var(--trait); }
.marque { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 19px; white-space: nowrap; letter-spacing: -.01em; }
.marque .logo { width: 46px; height: 18px; }
.marque .logo rect { fill: var(--orange); }
.marque .logo circle { fill: var(--blanc); }
header #titre { flex: 1 1 220px; max-width: 380px; font-weight: 600; background: var(--papier); border-color: transparent; }
header #titre:hover, header #titre:focus { background: var(--blanc); border-color: var(--trait); }
header .actions { display: flex; gap: 6px; }
.menu { position: relative; }
.deroulant { position: absolute; top: 40px; left: 0; z-index: 40; background: var(--blanc); border: 1px solid var(--trait);
  border-radius: 12px; box-shadow: var(--ombre); min-width: 320px; max-height: 60vh; overflow: auto; padding: 6px; }
.deroulant.a-droite { left: auto; right: 0; padding: 10px 14px; width: 330px; }
.deroulant.a-droite p { margin: 6px 0; }
.deroulant .projet { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.deroulant .projet:hover { background: var(--papier); }
.deroulant .projet b { flex: 1; font-weight: 600; }
.deroulant .projet small { color: var(--gris); font-size: 13px; }
.deroulant .projet .x { border: 0; background: none; color: var(--gris); min-height: 26px; padding: 2px 6px; }
.deroulant .projet .x:hover { color: var(--rouge); }
.deroulant .projet.fichier { border-bottom: 1px solid var(--trait); border-radius: 8px 8px 0 0; margin-bottom: 4px; }
.bascule { display: flex; background: var(--papier); border-radius: 10px; padding: 3px; }
.bascule button { border: 0; background: none; color: var(--gris); min-height: 28px; padding: 2px 12px; border-radius: 8px; }
.bascule button.actif { background: var(--encre); color: #fff; }

/* ---------------------------------------------------------------- panneaux */
main { flex: 1; display: flex; min-height: 0; position: relative; overflow: hidden; }
aside { width: 322px; background: var(--blanc); display: flex; flex-direction: column; min-height: 0; flex: none; }
#gauche { border-right: 1px solid var(--trait); }
#droite { border-left: 1px solid var(--trait); width: 344px; }
aside section { padding: 12px 14px 18px; overflow-y: auto; flex: 1; }
.onglets { display: flex; gap: 3px; margin: 10px 12px 0; padding: 3px; background: var(--papier); border-radius: 11px; }
.onglets button[data-onglet] { flex: 1; border: 0; background: none; color: var(--gris); min-height: 32px; padding: 3px 6px; border-radius: 8px; white-space: nowrap; }
.onglets button[data-onglet].actif { background: var(--blanc); color: var(--encre); box-shadow: 0 1px 3px rgba(31, 42, 55, .14); }
#fermer-droite { display: none; border: 0; background: none; }
.ligne { display: block; margin: 9px 0 4px; font-size: 14px; color: var(--gris); }
.ligne select { margin-top: 3px; color: var(--encre); }
label { display: block; margin: 9px 0; font-size: 14px; color: var(--gris); }
label input, label textarea { margin-top: 3px; color: var(--encre); }
.carte { background: var(--papier); border-radius: 14px; padding: 12px 14px 14px; margin-bottom: 12px; }
.champ-titre { font-size: 14px; color: var(--gris); margin-bottom: 5px; }

/* puces : choix de la zone, filtres de catégorie */
.puces { display: flex; flex-wrap: wrap; gap: 5px; }
.puces button { min-height: 30px; padding: 2px 11px; border-radius: 15px; font-weight: 600; font-size: 14px; }
.puces button.actif { background: var(--encre); border-color: var(--encre); color: #fff; }
.puces.fines { margin: 10px 0 2px; }
.puces.fines button { min-height: 26px; padding: 1px 9px; font-size: 13px; font-weight: 500; background: var(--papier); border-color: transparent; }
.puces.fines button:hover { border-color: var(--gris); }
.puces.fines button.actif { background: var(--orange-pale); border-color: var(--orange); color: var(--orange-fonce); font-weight: 600; }
#zones.inactif { opacity: .4; }
.note-cible { margin: 8px 0 0; padding: 6px 10px; border-radius: 9px; background: var(--vert-pale); color: var(--vert); font-size: 14px; font-weight: 600; line-height: 1.25; }
#btn-trou.actif { background: var(--encre); border-color: var(--encre); color: #fff; }
#btn-trou.choisi { background: var(--vert-pale); border-color: var(--vert); color: var(--vert); }
#vue.vise canvas { cursor: crosshair !important; }
.recherche { position: relative; margin-top: 12px; }
.recherche .ic { position: absolute; left: 10px; top: 9px; color: var(--gris); pointer-events: none; }
.recherche input { padding-left: 34px; }

/* le bac de pièces */
#palette h4 { margin: 14px 0 6px; font-size: 14px; font-weight: 700; }
.grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.piece { position: relative; border-radius: 12px; padding: 4px 4px 7px; text-align: center; cursor: pointer; font-size: 13px;
  line-height: 1.15; background: var(--papier); border: 1px solid transparent; transition: border-color .12s, background-color .12s; }
.piece:hover { border-color: var(--orange); background: var(--orange-pale); }
.piece .img { height: 64px; border-radius: 9px; background: var(--scene) center/contain no-repeat; margin-bottom: 5px; }
.piece .reste { position: absolute; top: 7px; right: 7px; background: var(--blanc); color: var(--encre); border-radius: 9px;
  padding: 0 6px; font-size: 12px; font-weight: 700; line-height: 18px; }
.piece::after { content: "+"; position: absolute; left: 7px; top: 7px; width: 20px; height: 20px; border-radius: 50%; background: var(--orange);
  color: #fff; font-weight: 700; line-height: 20px; opacity: 0; transition: opacity .12s; }
.piece:hover::after { opacity: 1; }
.piece.vide { opacity: .5; cursor: not-allowed; }
.piece.vide:hover { border-color: transparent; background: var(--papier); }
.piece.vide::after { display: none; }
.piece.vide .reste { background: var(--rouge); color: #fff; }
#palette .rien { color: var(--gris); padding: 14px 2px; }

.dents { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 4px; }
.dents select { width: auto; padding: 4px 6px; }
.dents button { padding: 2px 10px; min-height: 30px; }
.dents .fl { color: var(--gris); }

/* ---------------------------------------------------------------- la scène 3D */
#centre { flex: 1; position: relative; min-width: 0; background: var(--scene); }
#vue { position: absolute; inset: 0; }
#vue canvas { display: block; }
body.simple #vue.sur-piece canvas { cursor: grab; }
body.simple #vue.tire canvas { cursor: grabbing; }
.barre.haut { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; pointer-events: none; }
.barre.haut > * { pointer-events: auto; }
.groupe { display: inline-flex; }
.groupe button { border-radius: 0; margin-left: -1px; }
.groupe button:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.groupe button:last-child { border-radius: 0 9px 9px 0; }
.groupe button:hover { position: relative; z-index: 1; }
#vues-rapides button.actif { background: var(--encre); border-color: var(--encre); color: #fff; position: relative; z-index: 1; }
.coche { display: inline-flex; align-items: center; gap: 6px; margin: 0; min-height: 34px; color: var(--encre); font-size: 15px; font-weight: 600;
  background: var(--blanc); border: 1px solid var(--trait); border-radius: 9px; padding: 0 11px; cursor: pointer; }
.coche input { margin: 0; accent-color: var(--orange); width: 15px; height: 15px; }
#vues-rapides button { padding: 4px 9px; }
.pastille { border-radius: 17px; padding: 3px 13px; margin-left: auto; }
.pastille::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.pastille.ok { color: var(--vert); }
.pastille.ko { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.pastille.ko:hover { border-color: #8f2222; }
.pastille.vide { display: none; }

/* le quai : bulle de message, outils de la pièce, lecture */
.quai { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center;
  gap: 8px; width: max-content; max-width: calc(100% - 24px); pointer-events: none; }
.quai > * { pointer-events: auto; }
.bulle { background: var(--encre); color: #fff; border-radius: 18px; padding: 6px 16px; max-width: 560px; text-align: center; font-weight: 600;
  box-shadow: var(--ombre); opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; pointer-events: none; }
.bulle.visible { opacity: 1; transform: none; }
.bulle.alerte { background: var(--rouge); }
.bulle:empty { display: none; }
.panneau-outils { background: var(--blanc); border-radius: 16px; padding: 8px 12px 10px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
#outils-simple { align-items: center; gap: 5px; padding: 7px 12px 10px; }
.nom-piece { font-weight: 700; }
body:not(.simple) #btn-photo span { display: none; }
body:not(.simple) #btn-photo { padding: 4px; width: 34px; }
body:not(.simple) .barre.haut { gap: 6px; }
.rangee { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.rangee select { width: auto; padding: 4px 8px; }
.titre-outil { display: flex; gap: 10px; align-items: baseline; }
.titre-outil b { font-weight: 700; }
.titre-outil span { color: var(--gris); font-size: 13.5px; }
.etiq { font-weight: 600; color: var(--gris); min-width: 64px; }
.ax { box-shadow: inset 0 -3px 0 var(--x); } .ay { box-shadow: inset 0 -3px 0 var(--y); } .az { box-shadow: inset 0 -3px 0 var(--z); }
.sep { width: 8px; }
.lecture { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; background: var(--blanc); border-radius: 23px;
  padding: 6px 8px 6px 16px; box-shadow: var(--ombre); }
.lecture .etiq { min-width: 0; margin-right: 4px; }
.lecture .src { border-radius: 17px; padding: 3px 14px 3px 10px; }
.lecture .src .ic { fill: currentColor; stroke-width: 1.5; width: 15px; height: 15px; }
.lecture .src.actif { background: var(--orange); border-color: var(--orange); color: #fff; }
.lecture .coche { border: 0; background: none; padding: 0 6px; font-weight: 500; }
.lecture input[type=range] { accent-color: var(--orange); width: 110px; }
#chargement { position: absolute; left: 50%; top: 68px; transform: translateX(-50%); background: var(--encre); color: #fff; padding: 6px 16px;
  border-radius: 18px; pointer-events: none; font-weight: 600; }

/* écran de départ */
#depart { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: min(600px, calc(100% - 28px));
  background: var(--blanc); border-radius: 20px; padding: 22px 24px 16px; box-shadow: var(--ombre); }
#depart h2 { margin: 0 0 2px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
#depart p { margin: 0 0 14px; color: var(--gris); }
#depart .choix { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
#depart .choix button { justify-content: flex-start; text-align: left; gap: 11px; padding: 8px 12px 8px 8px; border-radius: 14px; font-weight: 500; line-height: 1.2;
  color: var(--gris); font-size: 14px; }
#depart .choix button:hover { border-color: var(--orange); background: var(--orange-pale); }
#depart .choix img { width: 62px; height: 52px; border-radius: 9px; object-fit: cover; flex: none; background: var(--scene); }
#depart .choix b { display: block; font-size: 16.5px; font-weight: 700; color: var(--encre); }
#depart-vide { border: 0; background: none; color: var(--gris); font-weight: 500; text-decoration: underline; margin: 0 auto; display: flex; }
#depart-vide:hover { color: var(--encre); }

/* ---------------------------------------------------------------- vérifications */
#bilan { border-radius: 14px; padding: 11px 14px; font-weight: 600; margin-bottom: 10px; line-height: 1.3; }
#bilan.ok { background: var(--vert-pale); color: var(--vert); }
#bilan.ko { background: var(--rouge-pale); color: var(--rouge); }
#bilan.vide { background: var(--papier); color: var(--gris); font-weight: 500; }
.bloc { border-top: 1px solid var(--trait); }
.bloc summary { display: flex; align-items: center; gap: 8px; padding: 10px 2px; cursor: pointer; font-weight: 700; list-style: none; }
.bloc summary::-webkit-details-marker { display: none; }
.bloc summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--gris); border-bottom: 2px solid var(--gris);
  transform: rotate(-45deg); transition: transform .12s; margin: 0 4px 0 2px; }
.bloc[open] summary::before { transform: rotate(45deg); }
.compte { margin-left: auto; min-width: 24px; text-align: center; border-radius: 11px; padding: 0 8px; font-size: 13px; font-weight: 700; line-height: 22px;
  background: var(--papier); color: var(--gris); }
.compte.ok { background: var(--vert-pale); color: var(--vert); }
.compte.ko { background: var(--rouge); color: #fff; }
.compte:empty { display: none; }
.liste { padding-bottom: 8px; }
.liste .item { display: flex; gap: 8px; padding: 5px 4px; border-radius: 8px; font-size: 14.5px; line-height: 1.3; }
.liste .item.clic { cursor: pointer; }
.liste .item.clic:hover { background: var(--papier); }
.liste .item .p { flex: 1; }
.liste .item small { color: var(--gris); font-size: 13px; }
.liste .item .manque { color: var(--rouge); }
.puce { flex: none; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; line-height: 18px;
  text-align: center; background: var(--vert); margin-top: 1px; }
.puce.ko { background: var(--rouge); }
.puce.info { background: var(--gris); }
.liste .rien { color: var(--gris); font-size: 14.5px; padding: 2px 4px 4px; }

/* ---------------------------------------------------------------- vues et PDF */
#onglet-sorties p { margin: 0 0 10px; }
.progres { height: 8px; background: var(--papier); border-radius: 4px; overflow: hidden; margin-top: 14px; }
#tache-barre { height: 100%; width: 5%; background: var(--orange); transition: width .5s; }
#tache-etape { font-weight: 600; margin: 6px 0; }
#tache-journal { background: var(--encre); color: #d7dee6; padding: 9px; border-radius: 10px; font: 12px/1.4 Consolas, monospace;
  max-height: 150px; overflow: auto; white-space: pre-wrap; margin: 0; }
#resultats img { width: 100%; border-radius: 10px; border: 1px solid var(--trait); margin-top: 10px; cursor: zoom-in; display: block; }
#resultats a.fichier { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--trait); border-radius: 9px; margin-top: 8px;
  text-decoration: none; color: var(--encre); font-weight: 600; }
#resultats a.fichier:hover { border-color: var(--encre); }
#resultats .ok { color: var(--vert); margin: 8px 0 0; } #resultats .ko { color: var(--rouge); margin: 8px 0 0; }

/* ---------------------------------------------------------------- écrans plus étroits */
@media (max-width: 1180px) {
  #droite { position: absolute; right: 0; top: 0; bottom: 0; z-index: 30; transform: translateX(105%); transition: transform .2s; box-shadow: var(--ombre); }
  body.droite-ouverte #droite { transform: none; }
  #fermer-droite { display: inline-flex; flex: none; }
  .pastille.vide { display: inline-flex; color: var(--gris); }
  aside { width: 286px; }
  #btn-photo span { display: none; }
  #btn-photo { padding: 4px; width: 34px; }
  .panneau-outils button { padding: 4px 9px; }
  .rangee { gap: 4px; }
}
@media (max-width: 900px) {
  aside { width: 252px; }
  #droite { width: min(344px, 92vw); }
  .grille { grid-template-columns: repeat(2, 1fr); }
  header .actions button span, .marque span, #btn-photo span { display: none; }
  header .actions button { padding: 4px 9px; }
  .lecture .etiq { display: none; }
  .rangee { justify-content: center; }
  #depart .choix { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
