/* Xeno — interface minimale. Palette eThunder.
   Principe : rien a l'ecran qui ne serve. L'orbe dit l'etat, pas du texte. */
:root {
  --fond: #050505;
  --fond-2: #08080b;
  --surface: rgba(22, 22, 28, 0.7);
  --bord: rgba(255, 255, 255, 0.07);
  --bord-fort: rgba(255, 255, 255, 0.13);

  --violet: #b48eff;
  --bleu: #8ba4ff;
  --vert: #00d294;
  --rouge: #fb2c36;

  --texte: #ececf1;
  --texte-faible: #6e6e80;

  --titre: "Poppins", "Segoe UI", system-ui, sans-serif;
  --corps: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--corps);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ============================================================== connexion */
#connexion {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 100;
  background:
    radial-gradient(900px 560px at 50% -8%, rgba(180, 142, 255, 0.16), transparent 68%),
    var(--fond);
}

.carte-connexion {
  width: min(92vw, 340px);
  padding: 40px 30px;
  background: rgba(18, 18, 23, 0.85);
  border: 1px solid var(--bord-fort);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  box-shadow: 0 0 60px -20px rgba(180, 142, 255, 0.55);
  text-align: center;
}

.marque {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.03em;
  margin: 0 0 26px;
  background: linear-gradient(115deg, var(--violet), var(--bleu));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.marque.petite { font-size: 20px; margin: 0; }

.champ {
  width: 100%;
  padding: 13px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bord-fort);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.champ:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(180, 142, 255, 0.14);
}

.bouton-primaire {
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  color: #150720;
  background: linear-gradient(115deg, var(--violet), var(--bleu));
  transition: filter 0.16s, transform 0.16s;
}
.bouton-primaire:hover { filter: brightness(1.08); }
.bouton-primaire:active { transform: translateY(1px); }
.bouton-primaire:disabled { opacity: 0.5; }

.erreur { margin-top: 12px; min-height: 18px; font-size: 12.5px; color: var(--rouge); }

/* ============================================================== structure */
#app { display: none; height: 100%; }
#app.actif {
  display: grid;
  grid-template-columns: 0 1fr;
  transition: grid-template-columns 0.28s ease;
}
#app.actif.aside-ouvert { grid-template-columns: 250px 1fr; }

aside {
  background: var(--fond-2);
  border-right: 1px solid var(--bord);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.entete-aside { padding: 20px 16px 14px; border-bottom: 1px solid var(--bord); }

.bouton-neuf {
  width: 100%;
  margin-top: 14px;
  padding: 9px 12px;
  background: transparent;
  color: var(--violet);
  border: 1px solid rgba(180, 142, 255, 0.3);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s;
}
.bouton-neuf:hover { background: rgba(180, 142, 255, 0.09); }

.liste { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }

.element {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--texte-faible);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.element:hover { background: rgba(255, 255, 255, 0.04); color: var(--texte); }
.element.actif {
  background: rgba(180, 142, 255, 0.12);
  color: var(--texte);
  box-shadow: inset 2px 0 0 var(--violet);
}
.element .titre { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.element .supprimer {
  opacity: 0; border: 0; background: none; color: var(--texte-faible); padding: 2px 4px;
}
.element:hover .supprimer { opacity: 1; }
.element .supprimer:hover { color: var(--rouge); }

.pied-aside {
  padding: 11px 16px;
  border-top: 1px solid var(--bord);
  font-size: 11.5px;
  color: var(--texte-faible);
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
}
.pied-aside button { background: none; border: 0; color: var(--texte-faible); font-size: 11.5px; }
.pied-aside button:hover { color: var(--rouge); }

main {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 0;
  background:
    radial-gradient(760px 520px at 50% 42%, rgba(150, 108, 235, 0.20), transparent 70%),
    radial-gradient(1300px 820px at 50% 8%, rgba(120, 84, 200, 0.13), transparent 72%),
    var(--fond);
}

/* ================================================================ bandeau */
.bandeau {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px 0;
  z-index: 3;
}

.icone {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: 9px;
  color: var(--texte-faible);
  transition: color 0.16s, border-color 0.16s;
}
.icone svg { width: 16px; height: 16px; }
.icone:hover { color: var(--texte); border-color: var(--bord-fort); }

.infos {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--texte-faible);
  opacity: 0.55;
  transition: opacity 0.3s;
}
.infos:hover { opacity: 1; }
.infos .heure { font-variant-numeric: tabular-nums; }
.infos .meteo { display: flex; align-items: center; gap: 4px; }
.infos .separateur { width: 1px; height: 11px; background: var(--bord-fort); }

/* =================================================================== orbe */
.scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  min-height: 0;
}

/* La seule phrase de l'ecran. Elle s'efface des que l'echange commence :
   on ne dit bonjour qu'une fois. */
.salut {
  margin: 0;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  color: var(--texte-faible);
  text-align: center;
  padding: 0 24px;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.salut.parti {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.halo {
  position: absolute;
  top: 50%; left: 50%;
  width: 620px; height: 620px;
  margin: -310px 0 0 -310px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 142, 255, 0.17) 0%, transparent 60%);
  filter: blur(70px);
  opacity: 0.5;
  transition: opacity 0.45s, transform 0.45s;
  pointer-events: none;
}
.scene.ecoute .halo { opacity: 1; transform: scale(1.1); }
.scene.reflechit .halo { opacity: 0.7; }
.scene.parle .halo {
  opacity: 0.9;
  background: radial-gradient(circle, rgba(139, 164, 255, 0.24) 0%, transparent 62%);
}
.scene.coupe .halo {
  opacity: 0.35;
  background: radial-gradient(circle, rgba(251, 44, 54, 0.16) 0%, transparent 62%);
}

#orbe {
  position: relative;
  width: min(52vh, 380px);
  height: min(52vh, 380px);
  z-index: 1;
}

/* L'orbe suffit a dire l'etat : aucun texte affiche. */
.etat-orbe { display: none; }

/* ================================================================= carnet */
/* Rien de la conversation n'est affiche. Seul ce que Xeno decide d'ecrire
   apparait ici, comme des notes prises au fil de l'echange. */
.carnet-zone {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-height: 42vh;
  padding: 0 20px;
  overflow: hidden;
  z-index: 2;
}

#carnet {
  max-width: 660px;
  width: 100%;
  margin: 0 auto;
  overflow-y: auto;
  padding: 4px 2px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 44px);
}

.feuille {
  border-left: 2px solid rgba(180, 142, 255, 0.35);
  padding: 2px 0 2px 16px;
  margin-bottom: 22px;
  animation: apparait 0.5s ease both;
}
@keyframes apparait {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.feuille h2 {
  font-family: var(--titre);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--violet);
  margin: 0 0 8px;
}

.feuille .corps {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14.5px;
  color: var(--texte);
  line-height: 1.72;
}

/* Le stylo, tant que la note s'ecrit. */
.feuille.ecrit .corps::after {
  content: "\258D";
  color: var(--violet);
  animation: clignote 1s steps(2) infinite;
  margin-left: 1px;
}
@keyframes clignote { 50% { opacity: 0; } }

/* ================================================================= saisie */
/* La barre ne doit pas exister tant qu'on parle. Elle reste la, discrete,
   et ne reprend sa presence qu'au survol ou quand on ecrit dedans. */
.zone-saisie { padding: 10px 20px 22px; z-index: 3; }
.zone-saisie .boite-saisie { opacity: 0.34; transition: opacity 0.35s ease; }
.zone-saisie:hover .boite-saisie,
.zone-saisie .boite-saisie:focus-within { opacity: 1; }

.boite-saisie {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 7px;
  align-items: center;
  background: rgba(18, 18, 24, 0.5);
  border: 1px solid var(--bord);
  border-radius: 17px;
  padding: 7px 7px 7px 9px;
  backdrop-filter: blur(20px);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.boite-saisie:focus-within {
  border-color: rgba(180, 142, 255, 0.4);
  box-shadow: 0 0 40px -14px rgba(180, 142, 255, 0.7);
}

.rond {
  flex: 0 0 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--bord);
  border-radius: 11px;
  background: transparent;
  color: var(--texte-faible);
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}
.rond svg { width: 16px; height: 16px; }
.rond:hover { color: var(--texte); border-color: var(--bord-fort); }
.rond.actif {
  color: var(--violet);
  border-color: rgba(180, 142, 255, 0.45);
  background: rgba(180, 142, 255, 0.11);
}
.rond.coupe {
  color: var(--rouge);
  border-color: rgba(251, 44, 54, 0.38);
  background: rgba(251, 44, 54, 0.09);
}
.rond.envoi {
  border: 0;
  color: #150720;
  background: linear-gradient(115deg, var(--violet), var(--bleu));
}
.rond.envoi:hover { filter: brightness(1.1); }
.rond.envoi:disabled { opacity: 0.3; cursor: not-allowed; }

#saisie {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  resize: none;
  max-height: 130px;
  padding: 7px 4px;
}
#saisie::placeholder { color: var(--texte-faible); opacity: 0.5; }

.alerte {
  max-width: 720px;
  margin: 0 auto 9px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  background: rgba(251, 44, 54, 0.09);
  border: 1px solid rgba(251, 44, 54, 0.3);
  color: #ff8a90;
}

::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

@media (max-width: 760px) {
  #app.actif.aside-ouvert { grid-template-columns: 0 1fr; }
  aside { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 20; }
  #app.actif.aside-ouvert aside { box-shadow: 0 0 50px rgba(0, 0, 0, 0.7); }
  #orbe { width: min(42vh, 280px); height: min(42vh, 280px); }
  .scene { gap: 24px; }
  .fil-zone { max-height: 26vh; }
}

/* ============================================================= diagnostic */
/* Ctrl + Maj + D. Invisible tant qu'on ne le demande pas. */
#diag {
  position: fixed;
  left: 14px;
  bottom: 14px;
  max-width: 42vw;
  margin: 0;
  padding: 11px 13px;
  z-index: 40;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #9fe8c9;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid rgba(0, 210, 148, 0.3);
  border-radius: 10px;
  pointer-events: none;
}

/* ==================================================== cartes d'action
   Bandes horizontales empilees dans le fil. Chaque couleur porte un sens :
   violet = Xeno, sombre = un fait, vert = la voie douce, orange = la ferme. */
.carte-x {
  position: relative;
  margin: 0 0 10px;
  padding: 13px 16px;
  border-radius: 13px;
  border: 1px solid var(--bord);
  background: rgba(20, 20, 26, 0.72);
  animation: carteEntre 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes carteEntre {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
}

.cx-gauche { min-width: 0; }
.cx-titre { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.cx-detail { font-size: 11.5px; color: var(--texte-faible); margin-top: 2px; }

/* --- fiche de dossier : les faits, avec le chiffre a droite */
.carte-x.dossier {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}
.carte-x.dossier .cx-droite { text-align: right; flex-shrink: 0; }
.cx-valeur {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cx-alerte {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  color: #ffd479;
  background: rgba(255, 183, 77, 0.15);
  border: 1px solid rgba(255, 183, 77, 0.34);
}

/* --- choix : une bande cliquable par option */
.carte-x.choix { padding: 0; border: 0; background: none; }
.cx-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 13px 16px;
  border-radius: 13px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 30, 38, 0.75);
  transition: transform 0.16s, filter 0.16s, box-shadow 0.16s;
}
.cx-option:hover:not(:disabled) { transform: translateX(3px); filter: brightness(1.13); }
.cx-option:disabled { opacity: 0.4; cursor: not-allowed; }
.cx-option.choisi { opacity: 1; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.cx-fleche { font-size: 17px; opacity: 0.65; flex-shrink: 0; }

.cx-option.doux {
  background: linear-gradient(100deg, #0f7a5a, #12996f);
  border-color: rgba(0, 210, 148, 0.45);
}
.cx-option.ferme {
  background: linear-gradient(100deg, #b06a10, #d98c1c);
  border-color: rgba(255, 183, 77, 0.5);
}
.cx-option.doux .cx-detail,
.cx-option.ferme .cx-detail { color: rgba(255, 255, 255, 0.78); }

/* --- brouillon : le message pret a partir */
.carte-x.brouillon {
  border-color: rgba(0, 210, 148, 0.4);
  background: rgba(10, 34, 27, 0.6);
}
.cx-etiquette {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vert);
  margin-bottom: 7px;
}
.cx-corps {
  font-size: 13.5px;
  line-height: 1.66;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cx-pied {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 11px;
  margin-top: 13px;
}
.cx-note { font-size: 11px; color: var(--texte-faible); }
.cx-note.rate { color: #ff8a90; }
.cx-bouton {
  padding: 9px 17px;
  border: 0;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  color: #23103d;
  background: linear-gradient(112deg, #d9c2ff, #b48eff);
  transition: filter 0.15s, transform 0.15s;
}
.cx-bouton:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.cx-bouton:disabled { cursor: default; opacity: 0.75; }
.carte-x.brouillon.fait { border-color: rgba(0, 210, 148, 0.75); }

/* Le fil de cartes a besoin de plus de place que le seul carnet. */
.carnet-zone { max-height: 58vh; }
