/* Step3D — thème sombre inspiré de la maquette */
:root {
  --fond: #0b1322;
  --panneau: #0e1729;
  --carte: #14203a;
  --carte-bord: #1e2c4a;
  --texte: #e2e8f0;
  --gris: #7c8db0;
  --gauche: #38bdf8;
  --droit: #fb923c;
  --bassin: #b6c2d9;
  --vert: #22c55e;
  --jaune: #eab308;
  --plein: #6366f1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 300px;
  font-family: "Inter", system-ui, "Segoe UI", sans-serif;
  background: var(--fond);
  color: var(--texte);
  overflow: hidden;
}

.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }

/* ---- Panneaux latéraux ---- */
.panneau {
  background: var(--panneau);
  padding: 16px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panneau.gauche { border-right: 1px solid var(--carte-bord); }
.panneau.droite { border-left: 1px solid var(--carte-bord); }

.marque { display: flex; align-items: center; gap: 10px; }
.marque h1 { font-size: 17px; margin: 0; font-weight: 700; }
.logo {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
}
.titre-section {
  margin: 6px 0 0; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gris);
}

/* ---- Arbre sujets / visites / essais ---- */
.arbre { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.sujet {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px; border-radius: 8px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.sujet:hover { background: var(--carte); }
.sujet.ouvert { background: var(--carte); }
.badge-nb {
  font-size: 11px; font-weight: 600; color: #dbeafe;
  background: #1d4ed8; border-radius: 999px; padding: 2px 8px;
}
.visite, .essai-ligne {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 18px; border-radius: 8px; font-size: 13px;
  color: #c7d2ea; cursor: pointer;
}
.essai-ligne { padding-left: 30px; }
.visite:hover, .essai-ligne:hover { background: var(--carte); }
.essai-ligne.actif { background: #1d2b4f; color: #fff; font-weight: 600; }
.badge {
  font-size: 10.5px; font-weight: 600; border-radius: 999px; padding: 2px 8px;
}
.badge.annoté { color: #bbf7d0; background: #14532d; }
.badge.à-faire { color: #fde68a; background: #713f12; }
.groupe-cache { display: none; }
.ouvert .groupe { display: block; }
.sujet .groupe { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px; }

.bouton-large {
  font: inherit; font-weight: 600; font-size: 13.5px;
  color: var(--texte); background: var(--carte);
  border: 1px solid var(--carte-bord); border-radius: 9px;
  padding: 10px; cursor: pointer;
}
.bouton-large:hover { background: #1a2950; }

/* ---- Paramètres de l'essai ---- */
.carte {
  background: var(--carte); border: 1px solid var(--carte-bord);
  border-radius: 12px; padding: 12px;
}
.carte h2 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; }
.parametres { margin-top: auto; }
.ligne-param {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--gris); padding: 3px 0;
}
.ligne-param strong { color: var(--texte); font-weight: 600; }

/* ---- Colonne centrale ---- */
.principal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0; height: 100vh;
}
.entete-essai {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px 10px;
}
.entete-essai h2 { margin: 0; font-size: 19px; font-weight: 700; }
.entete-essai p {
  margin: 2px 0 0; font-size: 12.5px; color: var(--gris);
  font-family: "JetBrains Mono", monospace;
}
.actions { display: flex; gap: 8px; }
.bouton {
  font: inherit; font-size: 13px; font-weight: 600;
  border-radius: 9px; padding: 9px 14px; cursor: pointer;
  border: 1px solid transparent;
}
.bouton.contour {
  color: var(--texte); background: var(--carte); border-color: var(--carte-bord);
}
.bouton.contour:hover { background: #1a2950; }
.bouton.plein { color: #fff; background: var(--plein); }
.bouton.plein:hover { background: #4f46e5; }

/* ---- Vue 3D ---- */
.scene { position: relative; margin: 0 20px; border-radius: 12px; overflow: hidden; }
.scene canvas { display: block; }
.info-image {
  position: absolute; top: 12px; left: 12px;
  background: rgba(10, 17, 32, 0.85); border: 1px solid var(--carte-bord);
  border-radius: 9px; padding: 8px 11px;
  font-family: "JetBrains Mono", monospace; font-size: 12px; line-height: 1.7;
  white-space: pre-line;
}
.legende {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 14px; font-size: 12.5px; color: #c7d2ea;
  background: rgba(10, 17, 32, 0.6); border-radius: 9px; padding: 6px 10px;
}
.legende span { display: flex; align-items: center; gap: 6px; }
.puce { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.gauche-couleur { color: var(--gauche); }
.droit-couleur { color: var(--droit); }
.bassin-couleur { color: var(--bassin); }
i.puce.gauche-couleur { background: var(--gauche); }
i.puce.droit-couleur { background: var(--droit); }
i.puce.bassin-couleur { background: var(--bassin); }

/* ---- Transport ---- */
.transport {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px 8px;
}
.touches { display: flex; gap: 6px; }
.touches button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--texte);
  background: var(--carte); border: 1px solid var(--carte-bord);
  border-radius: 9px; padding: 8px 12px; cursor: pointer; min-width: 42px;
}
.touches button:hover { background: #1a2950; }
#btn-lecture { background: var(--plein); border-color: var(--plein); }
#btn-lecture:hover { background: #4f46e5; }
.temps {
  font-family: "JetBrains Mono", monospace; font-size: 15px;
  min-width: 100px; text-align: center;
}
.vitesses { margin-left: auto; display: flex; gap: 4px; }
.vitesses button {
  font: inherit; font-size: 12.5px; color: var(--gris);
  background: none; border: 0; border-radius: 7px; padding: 6px 9px; cursor: pointer;
}
.vitesses button:hover { color: var(--texte); background: var(--carte); }
.vitesses button.actif { color: #fff; background: var(--carte); font-weight: 700; }

/* ---- Frises des pas ---- */
.frises { display: flex; flex-direction: column; gap: 6px; padding: 4px 20px 14px; }
.frise-ligne { display: flex; align-items: center; gap: 10px; }
.etiquette { font-size: 12px; font-weight: 700; width: 14px; text-align: center; }
.frise {
  position: relative; flex: 1; height: 26px;
  background: var(--carte); border: 1px solid var(--carte-bord); border-radius: 8px;
  overflow: hidden;
}
.marque-frise {
  position: absolute; top: 0; bottom: 0; width: 14px;
  display: grid; place-items: center;
  font-size: 10px; cursor: pointer; user-select: none;
  transform: translateX(-50%);
}
.marque-frise.pose { padding-bottom: 8px; }
.marque-frise.pied-gauche { color: var(--gauche); }
.marque-frise.pied-droit { color: var(--droit); }
.curseur {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #fff; transform: translateX(-1px);
}

/* ---- Événements (droite) ---- */
.titre-evenements { display: flex; justify-content: space-between; align-items: baseline; }
.titre-evenements h2 { margin: 0; }
#compte-evenements { color: var(--gris); font-size: 13px; }
.grille-pose-lever {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0;
}
.grille-pose-lever .bouton { padding: 9px 6px; background: var(--panneau); border-color: var(--carte-bord); }
.grille-pose-lever .bouton:hover { background: #1a2950; }
.pose-g, .pied-gauche-texte { color: var(--gauche); }
.lever-g { color: var(--gauche); }
.pose-d, .lever-d { color: var(--droit); }

.liste-evenements {
  list-style: none; margin: 0; padding: 0;
  max-height: 46vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.liste-evenements li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
  font-size: 13px;
}
.liste-evenements li:hover { background: var(--panneau); }
.liste-evenements li .glyphe { width: 14px; text-align: center; }
.liste-evenements li .libelle { font-weight: 600; }
.liste-evenements li .details {
  margin-left: auto; color: var(--gris);
  font-family: "JetBrains Mono", monospace; font-size: 12px;
}
.liste-evenements li .supprimer {
  border: 0; background: none; color: var(--gris); cursor: pointer;
  font-size: 13px; padding: 2px 4px; border-radius: 6px; visibility: hidden;
}
.liste-evenements li:hover .supprimer { visibility: visible; }
.liste-evenements li .supprimer:hover { color: #f87171; background: #3f1d1d; }

/* ---- Raccourcis ---- */
.raccourcis .ligne-raccourci {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: #c7d2ea; padding: 4px 0;
}
kbd {
  font-family: "JetBrains Mono", monospace; font-size: 11.5px;
  background: var(--panneau); border: 1px solid var(--carte-bord);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px;
  min-width: 34px; text-align: center;
}

/* ---- Message global ---- */
.message {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #1d2b4f; color: var(--texte); border: 1px solid var(--carte-bord);
  border-radius: 10px; padding: 10px 16px; font-size: 13.5px; z-index: 50;
  max-width: 60vw;
}
.message.erreur { background: #4c1d1d; border-color: #7f1d1d; color: #fecaca; }
