/* ═══════════════════════════════════════════════════════════════════════════
   Charte PartenarIA — noir, or, blanc casse. Toute l'interface se tient en
   retrait : elle borde la scene sans jamais la couvrir.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --noir:      #030303;
  --or:        #c9a96e;
  --or-chaud:  #d4a574;
  --or-clair:  #e8d8c4;
  --texte:     #e8e4df;
  --sourdine:  #8b8681;
  --ligne:     rgba(201, 169, 110, 0.16);
  --voile:     rgba(6, 6, 6, 0.72);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--noir);
  color: var(--texte);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

canvas#scene { display: block; width: 100%; height: 100%; }

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

/* ── Titre ─────────────────────────────────────────────────────────────── */
.titre {
  position: fixed;
  top: 26px; left: 32px;
  pointer-events: none;
  animation: paraitre 1.4s 0.3s both;
}
.titre-principal {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 13px;
  font-weight: 500;
  color: var(--texte);
}
.titre-second {
  margin-top: 7px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--sourdine);
}

/* ── L'etat courant ────────────────────────────────────────────────────── */
.etat {
  position: fixed;
  top: 26px; right: 32px;
  text-align: right;
  pointer-events: none;
  animation: paraitre 1.4s 0.5s both;
}
.etat-libelle {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  transition: color 0.5s ease;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.28);
}
.etat-libelle.or {
  color: var(--or-clair);
  text-shadow: 0 0 22px rgba(212, 165, 116, 0.42);
}
.etat-detail {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--sourdine);
}

/* ── Pupitre de commandes ──────────────────────────────────────────────── */
.pupitre {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 20px;
  background: var(--voile);
  border: 1px solid var(--ligne);
  border-radius: 3px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: monter 1.2s 0.6s both;
  max-width: calc(100vw - 48px);
  flex-wrap: wrap;
  justify-content: center;
}

.separateur { width: 1px; height: 22px; background: var(--ligne); }

.bouton {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 15px;
  min-width: 108px;
  background: transparent;
  border: 1px solid rgba(201, 169, 110, 0.34);
  border-radius: 2px;
  color: var(--or-clair);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.bouton:hover { background: rgba(201, 169, 110, 0.1); border-color: var(--or); color: #fff; }
.glyphe { font-size: 9px; line-height: 1; letter-spacing: 0; }

.frise { position: relative; width: min(38vw, 420px); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: rgba(232, 228, 223, 0.16);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--or-clair);
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.75);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--or-clair);
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.75);
  cursor: pointer;
}

/* Les trois elevations, marquees sur la frise. */
.jalons { position: absolute; inset: 0; pointer-events: none; }
.jalon {
  position: absolute;
  top: 50%;
  width: 1px; height: 13px;
  margin-top: -6.5px;
  background: rgba(212, 165, 116, 0.6);
}
.jalon::after {
  content: attr(data-nom);
  position: absolute;
  top: -19px; left: 50%;
  transform: translateX(-50%);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 8px;
  letter-spacing: 0.14em;
  color: rgba(212, 165, 116, 0.75);
  white-space: nowrap;
}

.horloge {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--texte);
  min-width: 82px;
  text-align: right;
}
.horloge i { color: var(--sourdine); font-style: normal; font-size: 10px; }

.vitesses, .vues { display: flex; gap: 5px; }

.puce {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--sourdine);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9px;
  cursor: pointer;
  transition: color 0.22s, border-color 0.22s, background 0.22s;
}
.puce:hover { color: var(--texte); border-color: var(--ligne); }
.puce--active {
  color: var(--or-clair);
  border-color: rgba(201, 169, 110, 0.42);
  background: rgba(201, 169, 110, 0.08);
}

.bascule {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9px;
  color: var(--sourdine);
  cursor: pointer;
  user-select: none;
}
.bascule:hover { color: var(--texte); }
.bascule input { accent-color: var(--or); cursor: pointer; }

/* ── Aide ──────────────────────────────────────────────────────────────── */
.aide {
  position: fixed;
  left: 32px; bottom: 26px;
  width: 268px;
  padding: 17px 19px 15px;
  background: var(--voile);
  border: 1px solid var(--ligne);
  border-radius: 3px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: paraitre 1.4s 1.1s both;
  transition: opacity 0.45s, transform 0.45s;
}
.aide.repliee {
  animation: none;          /* sinon `paraitre ... both` fige l'opacite a 1 */
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}
.aide-titre {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 9px;
  color: var(--or);
  margin-bottom: 11px;
}
.aide dl {
  margin: 0;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 5px 10px;
  font-size: 11px;
  font-weight: 300;
}
.aide dt {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--or-clair);
  text-transform: uppercase;
}
.aide dd { margin: 0; color: var(--sourdine); }
.aide-note {
  margin: 13px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--ligne);
  font-size: 10.5px;
  font-weight: 300;
  line-height: 1.55;
  color: var(--sourdine);
}
.aide-fermer {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: var(--sourdine);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
}
.aide-fermer:hover { color: var(--texte); }

/* ── Chargement ────────────────────────────────────────────────────────── */
.chargement {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--noir);
  z-index: 10;
  transition: opacity 0.8s ease;
}
.chargement.parti { opacity: 0; pointer-events: none; }
.chargement span {
  width: 34px; height: 34px;
  border: 1px solid rgba(201, 169, 110, 0.22);
  border-top-color: var(--or);
  border-radius: 50%;
  animation: tourner 1.1s linear infinite;
}

@keyframes tourner { to { transform: rotate(360deg); } }
@keyframes paraitre { from { opacity: 0; } to { opacity: 1; } }
@keyframes monter {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 900px) {
  .aide { display: none; }
  .frise { width: min(52vw, 300px); }
  .vues { display: none; }
}

/* ── Intégrée dans une page ────────────────────────────────────────────── */
body.integre .pupitre {
  bottom: 14px;
  gap: 12px;
  padding: 9px 15px;
}
body.integre .bouton { padding: 6px 12px; min-width: 96px; }
body.integre .frise { width: min(34vw, 300px); }
body.integre .etat { top: 16px; right: 20px; }
body.integre .etat-libelle { font-size: 13px; }

/* ── Ce que la souris designe ──────────────────────────────────────────── */
/* Un libelle en HTML plutot qu'une texture : le texte reste net a toute
   distance, et il n'y a rien a redessiner quand la camera bouge. */
.survol {
  position: fixed;
  top: 0; left: 0;
  transform: translate(-50%, -140%);
  padding: 7px 13px;
  background: rgba(6, 6, 6, 0.86);
  border: 1px solid rgba(201, 169, 110, 0.3);
  border-radius: 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 10px;
  font-weight: 500;
  color: var(--or-clair);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
}
.survol.visible { opacity: 1; }
.survol.ia {
  color: #a8c2ff;
  border-color: rgba(127, 166, 255, 0.4);
  text-shadow: 0 0 14px rgba(127, 166, 255, 0.55);
}
.survol.singularite {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.34);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
}

canvas#scene.designe { cursor: pointer; }
