/* 199BOT - front minimal : mot-symbole, un champ, le vide pour le reste. */
:root {
  --fond: #f4f4f2;
  --texte: #3b3b3b;
  --gris: #8a8a86;
  --gris-clair: #b5b5b0;
  --trait: #d8d8d4;
  --cyan: #01aeef;
  --rouge: #d64545;
}
html[data-theme="sombre"] {
  color-scheme: dark;
  --fond: #1f1f1d;
  --texte: #e8e8e4;
  --gris: #9a9a94;
  --gris-clair: #5f5f5b;
  --trait: #3a3a37;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.55 Inter, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

header { position: sticky; top: 0; z-index: 15; padding: 26px 48px 12px; background: var(--fond); }
.marque {
  font-size: 15.6px;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--texte);
}
.marque .a { display: inline-block; perspective: 200px; }
.marque .lettre { display: inline-block; font-style: normal; letter-spacing: 0; color: var(--cyan); }
.a-bleu { color: var(--cyan); }
body.requete .marque .lettre {
  animation: pivote 1.4s linear infinite;
}
@keyframes pivote {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}
@keyframes bascule {
  from { transform: rotateX(0deg); }
  to { transform: rotateX(360deg); }
}
.marque .lettre.bascule { animation: bascule 0.9s ease-out 1; }
@media (prefers-reduced-motion: reduce) {
  body.requete .marque .lettre { animation: none; }
  .marque .lettre.bascule { animation: none; }
}

main {
  display: flex;
  flex-direction: column;
  width: min(640px, calc(100% - 96px));
  margin: 0 auto;
}
body[data-etat="accueil"] main,
body[data-etat="contact"] main { min-height: calc(100dvh - 68px); justify-content: center; }
body[data-etat="conversation"] main { min-height: calc(100dvh - 68px); }
body[data-etat="conversation"] .saisie { margin-top: auto; }
body[data-etat="contact"] #fil { display: none; }

#fil {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 10px 0 24px;
}
#fil:empty { display: none; }
.tour { min-width: 0; overflow-wrap: break-word; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-weight: 400; }
.tour .vous { margin: 0; color: var(--gris); }
.tour .reponse { margin: 0; white-space: pre-wrap; }
.bienvenue, .info { margin: 0; white-space: pre-wrap; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-weight: 400; }
.bienvenue .curseur, .info .curseur { display: inline-block; height: 1.05em; margin-left: 1px; vertical-align: text-bottom; border-left: 1px solid var(--cyan); animation: clignote 1s steps(1) infinite; }
.bienvenue a, .info a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--trait); }
.bienvenue a:hover, .info a:hover { color: var(--cyan); text-decoration-color: var(--cyan); }
@keyframes clignote { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .bienvenue .curseur, .info .curseur { animation: none; }
}
.fine { margin: 0; font: 11px/1.7 ui-monospace, Menlo, monospace; color: var(--gris); }

.saisie { position: sticky; bottom: 0; z-index: 10; padding: 14px 0 30px; background: var(--fond); font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-weight: 400; }
.saisie::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -28px;
  height: 28px;
  background: linear-gradient(180deg, transparent, var(--fond));
  pointer-events: none;
}
body[data-etat="contact"] .saisie { display: none; }
#forme { position: relative; display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid var(--gris-clair); padding: 0 2px 8px; }
#forme:focus-within { border-bottom-color: var(--cyan); }
#forme::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cyan) 50%, transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
}
#forme.attente::after { opacity: 1; animation: glide 1.1s linear infinite; }
@keyframes glide {
  from { background-position: -45% 0; }
  to { background-position: 145% 0; }
}
@media (prefers-reduced-motion: reduce) {
  #forme.attente::after { animation: none; opacity: .65; }
}
#question { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--texte); padding: 4px 0; resize: none; line-height: 1.5; max-height: 180px; overflow-y: auto; }
#question::placeholder { color: var(--gris-clair); }
.signes { display: flex; gap: 2px; }
.signes button { background: none; border: 0; padding: 4px; cursor: pointer; color: var(--gris); line-height: 0; }
.signes button:hover { color: var(--cyan); }
.dessous { display: flex; justify-content: space-between; align-items: center; min-height: 24px; padding-top: 6px; }
.piece { background: none; border: 0; padding: 0; font: 11px "IBM Plex Mono", ui-monospace, Menlo, monospace; color: var(--gris); cursor: pointer; }
.lien { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--gris); cursor: pointer; }
.lien:hover { color: var(--cyan); }
#echange { display: inline-flex; align-items: center; gap: 6px; }
#echange svg { flex: none; }
#echange.vif { color: var(--cyan); }
#commandes { position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 20; display: flex; flex-direction: column; gap: 2px; padding: 6px; background: var(--fond); border: 1px solid var(--trait); border-radius: 10px; }
#commandes[hidden] { display: none; }
.commande { display: flex; align-items: baseline; gap: 10px; border: 1px solid transparent; border-radius: 8px; background: none; padding: 6px 9px; font: inherit; color: var(--texte); cursor: pointer; text-align: left; }
.commande:hover, .commande.actif { border-color: var(--cyan); }
.commande:hover .commande-nom, .commande.actif .commande-nom { color: var(--cyan); }
.commande-resume { color: var(--gris); font-size: 12px; }

.pistes { padding: 0 0 18px; }
.pistes[hidden] { display: none; }
.pistes-titre { margin: 0 0 8px; font: 11px/1.6 ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); }
.pistes-rang { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fleche { color: var(--gris); font-size: 14px; line-height: 1; }
.piste { border: 1px solid var(--trait); border-radius: 999px; background: transparent; color: var(--texte); font: inherit; font-size: 12px; line-height: 1.45; padding: 4px 11px; cursor: pointer; text-align: left; }
.piste:hover { border-color: var(--cyan); color: var(--cyan); }
.piste.selectionne { border-color: var(--cyan); color: var(--cyan); }
.piste-saisir { border-style: dashed; }
.piste.danger { border-color: var(--rouge); background: var(--rouge); color: #fff; }
.piste.danger:hover, .piste.danger.selectionne { border-color: var(--rouge); background: #c23a3a; color: #fff; }
.suivantes { margin-top: 12px; }

#roue { position: fixed; right: 18px; bottom: 18px; z-index: 20; background: none; border: 0; padding: 6px; color: var(--gris); cursor: pointer; line-height: 0; }
#roue:hover { color: var(--cyan); }
#roue svg { transform-origin: 50% 50%; will-change: transform; }
.reglages { position: fixed; right: 18px; bottom: 62px; z-index: 20; width: 216px; padding: 14px 16px 12px; background: var(--fond); border: 1px solid var(--trait); }
.reglages[hidden] { display: none; }
.reglages-titre { margin: 0 0 8px; font: 11px/1.6 ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); }
#reglages-infos { margin-top: 14px; }
.theme-choix { display: flex; gap: 8px; margin-bottom: 4px; }
.theme-choix button { border: 1px solid var(--trait); background: transparent; color: var(--texte); font: inherit; font-size: 12px; padding: 3px 11px; cursor: pointer; }
.theme-choix button.actif { border-color: var(--cyan); color: var(--cyan); }
.reglages a { color: inherit; }
.reglages a:hover { color: var(--cyan); }
.reglages-cookies { margin: 12px 0 0; }
.consentement { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--trait); }
.consentement-texte { margin: 0; font: 11px/1.6 "IBM Plex Mono", ui-monospace, Menlo, monospace; color: var(--gris); }
.consentement-texte a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.consentement-texte a:hover { color: var(--cyan); }
.consentement-actions { margin: 7px 0 0; }
.consentement-switch { display: inline-flex; border: 1px solid var(--trait); }
.consentement-switch button { border: 0; background: transparent; color: var(--gris); font: 11px/1 "IBM Plex Mono", ui-monospace, Menlo, monospace; letter-spacing: .02em; padding: 6px 14px; cursor: pointer; }
.consentement-switch button + button { border-left: 1px solid var(--trait); }
.consentement-switch button:not(.actif):hover { color: var(--texte); }
.consentement-switch button.actif { background: var(--cyan); color: var(--fond); }

#contact { display: flex; flex-direction: column; gap: 18px; padding: 6vh 0; }
#contact[hidden] { display: none; }
#contact h2 { margin: 0; font-size: 22px; font-weight: 500; }
#form-contact { display: flex; flex-direction: column; gap: 14px; }
.rangee { display: flex; gap: 18px; }
.rangee input { flex: 1; min-width: 0; border: 0; border-bottom: 1px solid var(--gris-clair); background: transparent; font: inherit; color: var(--texte); padding: 6px 0; outline: 0; }
.rangee input:focus { border-bottom-color: var(--cyan); }
.rangee input::placeholder { color: var(--gris-clair); }
.creneaux { display: flex; flex-wrap: wrap; gap: 8px; }
.creneaux button { border: 1px solid var(--trait); background: transparent; color: var(--texte); font: inherit; font-size: 13px; padding: 4px 11px; cursor: pointer; }
.creneaux button.actif { border-color: var(--cyan); color: var(--cyan); }
.creneaux button:disabled { opacity: .4; cursor: default; }
.bouton { align-self: flex-start; border: 1px solid var(--texte); background: transparent; color: var(--texte); font: inherit; padding: 8px 18px; cursor: pointer; }
.bouton:hover { border-color: var(--cyan); color: var(--cyan); }
.bouton:disabled { opacity: .5; cursor: default; }
.retour {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: transparent;
  color: var(--gris);
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 12px;
  cursor: pointer;
}
.retour:hover { border-color: var(--cyan); color: var(--cyan); }

/* Fil d'interaction : lignes fines a gauche (desktop uniquement). Chaque
   ligne represente un bloc (saisie ou reponse), largeur selon la longueur. */
#rail { display: none; }
@media (min-width: 1000px) {
  body[data-etat="conversation"] #rail {
    display: flex;
    position: fixed;
    top: 50%;
    right: calc(50% + 360px);
    transform: translateY(-50%);
    z-index: 5;
    width: 132px;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  #rail .ligne {
    display: block;
    height: 2px;
    border-radius: 1px;
    background: linear-gradient(var(--cyan), var(--cyan)) left center / 100% 1px no-repeat;
    opacity: .35;
    cursor: pointer;
    transition: opacity .15s ease;
  }
  #rail .ligne.actif, #rail .ligne:hover {
    background-size: 100% 2px;
    opacity: 1;
  }
}

@media (min-width: 1240px) {
  body[data-etat="conversation"] #rail { right: calc(50% + 404px); }
}

/* Liaison au survol : un trait courbe grandit rapidement du rail vers le
   paragraphe, et le paragraphe est borde d'un bloc bleu fixe de 3 px sur
   toute sa hauteur. */
#trait { display: none; }
@media (min-width: 1000px) {
  body[data-etat="conversation"] #trait {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 4;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
}
#trait path {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset .28s ease-out, opacity .2s ease;
}
#trait.actif path { stroke-dashoffset: 0; opacity: .9; }
#fil .lie { position: relative; }
#fil .lie::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 1px;
  background: var(--cyan);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  #trait path { transition: none; }
  #trait.actif path { opacity: .7; }
}
.bas { margin-top: 6px; }

@media (max-width: 640px) {
  body { font-size: 18px; }
  header { padding: 16px 20px 10px; }
  .marque { font-size: 19.2px; }
  main { width: calc(100% - 32px); }
  .saisie { padding-bottom: 26px; }
  .fine { font-size: 13px; }
  .lien { font-size: 14px; }
  .piste { font-size: 13px; }
  .retour { font-size: 13px; }
  .piece { font-size: 13px; }
  .creneaux button { font-size: 16px; }
  .theme-choix button { font-size: 14px; }
  .reglages-titre { font-size: 12px; }
  #contact h2 { font-size: 26px; }
  #contact { justify-content: flex-start; }
  .rangee { flex-direction: column; gap: 10px; }
  #roue { right: 12px; bottom: 12px; }
  .reglages { right: 12px; bottom: 54px; }
}
