/* App Archie — chat mobile : ce qui n'est propre qu'au fil et à la saisie. Jetons et composants
   communs (ciel, en-tête, pastille, bouton, carte) : kit.css. */
/* fil */
.fil { flex: 1; overflow-y: auto; padding: 8px 16px 14px; display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24px); mask-image: linear-gradient(180deg, transparent 0, #000 24px); }
.fil::before { content: ''; flex: 1; }
.fil:has(> .vide)::before { display: none; }       /* fil vide : le bloc se centre (margin: auto) */               /* colle les messages en bas quand le fil est court */
.vide { text-align: center; color: var(--encre-douce); font-size: var(--t-m); line-height: 1.6; margin: auto; padding: 0 26px; max-width: 340px;
  text-shadow: 0 1px 6px rgba(8,18,12,.85); animation: monte var(--d-3) var(--ressort-doux) both; }
.vide .sceau { margin-bottom: 16px; }
.vide strong { display: block; font-family: var(--police-titre); font-size: var(--t-xl); font-weight: 600; letter-spacing: -.02em; color: var(--encre); margin-bottom: 6px; }
.jour { align-self: center; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(214,246,228,.9);
  padding: 4px 12px; border-radius: var(--rond); background: rgba(8,28,22,.55); border: 1px solid rgba(170,240,210,.14); }

/* message : entrée en ressort depuis le coin de sa bulle. .lot = arrivée en masse (chargement) : simple fondu */
.msg { position: relative; max-width: 86%; display: flex; flex-direction: column; gap: 6px; --voix: var(--menthe);
  animation: entree var(--d-3) var(--ressort) both; }
.msg.moi { align-self: flex-end; align-items: flex-end; transform-origin: 100% 100%; }
.msg.archie { align-self: flex-start; transform-origin: 0 100%; }
.msg.lot { animation: fondu var(--d-1) linear both; }
.msg.cible::after { content: ''; position: absolute; inset: -8px; border-radius: 30px; pointer-events: none;
  border: 2px solid var(--or-clair); box-shadow: 0 0 28px rgba(233,206,150,.45), inset 0 0 18px rgba(233,206,150,.18);
  animation: cible 2.4s var(--sortie) both; }
.entete-msg { display: flex; align-items: center; gap: 9px; padding-left: 1px; text-shadow: 0 1px 4px rgba(8,18,12,.8); }
.qui { font-family: var(--police-titre); font-size: var(--t-m); font-weight: 600; letter-spacing: -.005em; color: color-mix(in srgb, var(--voix) 45%, #FBF6E6); }
.quand { font-size: 10.5px; color: var(--encre-douce); font-variant-numeric: tabular-nums; letter-spacing: .02em; text-shadow: 0 1px 4px rgba(8,18,12,.8); }

/* bulles : verre dense sans flou (une seule surface floutée dans le fil serait déjà trop au défilement) */
.bulle { padding: 12px 16px; font-size: var(--t-corps); line-height: var(--il-corps); overflow-wrap: anywhere; white-space: pre-wrap; }
.archie .bulle { background: var(--verre-dense); color: #F2ECDC; border-radius: var(--rayon-bulle-archie);
  border: 1px solid color-mix(in srgb, var(--voix) 36%, rgba(170,240,210,.12));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--voix) 46%, transparent), 0 16px 30px -18px color-mix(in srgb, var(--voix) 60%, transparent), var(--ombre-2); }
.moi .bulle { background: var(--verre-or); border: 1px solid var(--or-bord); color: #FAF3DE; border-radius: var(--rayon-bulle-moi);
  box-shadow: inset 0 1px 0 rgba(255,236,190,.3), 0 16px 30px -18px rgba(216,179,106,.6), var(--ombre-2); }
.bulle a { color: var(--or-clair); text-decoration-thickness: 1px; }
.bulle .mention { color: color-mix(in srgb, var(--voix) 40%, #fff); font-weight: 560; padding: 1px 7px; margin: 0 -1px; border-radius: var(--rond);
  background: color-mix(in srgb, var(--voix) 16%, transparent); }
.msg.attente .bulle { opacity: .72; }
.msg.echec { cursor: pointer; }
.msg.echec .bulle { border-style: dashed; border-color: rgba(232,150,116,.85); box-shadow: 0 16px 30px -18px rgba(201,138,106,.7), var(--ombre-2); }
.msg .statut { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; font-size: var(--t-xs); color: var(--encre-douce); padding: 0 4px; text-shadow: 0 1px 4px rgba(8,18,12,.8); }
.msg .statut::before { content: ''; width: 13px; height: 13px; background: currentColor;
  -webkit-mask: var(--ic-horloge) center / contain no-repeat; mask: var(--ic-horloge) center / contain no-repeat; animation: pouls 1.8s ease-in-out infinite; }
.msg.echec .statut { color: var(--erreur); }
.msg.echec .statut::before { -webkit-mask-image: var(--ic-alerte); mask-image: var(--ic-alerte); animation: none; }
.msg.echec:active .bulle { transform: scale(.97); }

/* médias */
.media { position: relative; border-radius: 20px 22px 20px 24px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--voix) 30%, rgba(170,240,210,.16));
  background: rgba(8,28,22,.7); max-width: 100%; box-shadow: var(--ombre-2); }
.media img, .media video { display: block; max-width: 100%; max-height: 62vh; cursor: zoom-in; animation: fondu var(--d-2) linear both; }
.media video { cursor: auto; }
.media audio { display: block; width: 264px; max-width: 100%; margin: 10px; height: 40px; }
.media .doc { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 12px 16px; font-size: var(--t-m); color: var(--or-clair); text-decoration: none; }
.media span.doc { color: var(--erreur); }
.media .patiente { position: relative; display: grid; place-items: center; width: 232px; height: 148px; max-width: 100%; overflow: hidden; color: var(--encre-faible);
  background: rgba(170,240,210,.05); }
.media .patiente::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); animation: reflet 1.7s ease-in-out infinite;
  background: linear-gradient(100deg, transparent 20%, rgba(190,255,225,.13) 50%, transparent 80%); }
.media .patiente .ic { width: 26px; height: 26px; animation: pouls 2.2s ease-in-out infinite; }

/* cartes à boutons : avant (ressort décalé), pendant (.en-cours), après (.choisi, les autres s'effacent) */
.boutons { display: flex; flex-direction: column; gap: 8px; }
.boutons .rangee { animation: monte var(--d-2) var(--ressort-doux) both .12s; }
.boutons .rangee:nth-child(2) { animation-delay: calc(.12s + var(--d-decale)); } .boutons .rangee:nth-child(3) { animation-delay: calc(.12s + var(--d-decale) * 2); }
.boutons .bouton { flex: 1 1 auto; }
.boutons.tranche .bouton:not(.choisi) { opacity: .3; }

/* Archie travaille */
.travail { align-self: flex-start; margin: 0 16px 8px; display: flex; align-items: center; gap: 5px; padding: 9px 15px;
  border-radius: var(--rond); font-size: var(--t-s); color: rgba(244,239,223,.9); background: var(--verre-dense);
  border: 1px solid var(--verre-bord); box-shadow: var(--liseré), var(--ombre-1), var(--halo-menthe);
  transform-origin: 0 100%; animation: entree var(--d-3) var(--ressort) both; }
.travail i { width: 6px; height: 6px; border-radius: 50%; background: var(--menthe); box-shadow: 0 0 6px rgba(143,216,184,.8); animation: rebond 1.2s ease-in-out infinite; }
.travail i:nth-child(2) { animation-delay: .15s; } .travail i:nth-child(3) { animation-delay: .3s; }
.travail span { margin-left: 6px; }

/* saisie */
.saisie { padding: 6px 12px calc(env(safe-area-inset-bottom) + 14px); position: relative; }
.champ { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 20px; border-radius: 30px 32px 30px 31px;
  background: var(--verre); border: 1px solid var(--verre-bord); -webkit-backdrop-filter: var(--flou-2); backdrop-filter: var(--flou-2);
  box-shadow: inset 0 1px 0 rgba(210,255,232,.28), var(--ombre-3); transition: border-color var(--d-1) linear, box-shadow var(--d-1) linear; }
.champ:focus-within { border-color: rgba(216,179,106,.65); box-shadow: inset 0 1px 0 rgba(255,236,190,.3), var(--ombre-3), 0 0 0 3px rgba(216,179,106,.12); }
textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--encre);
  font: inherit; font-size: 16px; line-height: 1.4; padding: 11px 0; max-height: 132px; }
textarea { scrollbar-width: none; }
textarea::-webkit-scrollbar { display: none; }
textarea::placeholder { color: var(--encre-faible); font-size: 14px; letter-spacing: -.01em; }
.envoyer { position: relative; width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; cursor: pointer; display: grid; place-items: center; padding: 0;
  border: 1px solid rgba(191,232,210,.55); background: radial-gradient(circle, rgba(143,216,184,.45), rgba(20,45,35,.9) 75%);
  box-shadow: var(--halo-menthe); transition: opacity var(--d-1) linear, transform var(--d-2) var(--ressort), box-shadow var(--d-1) linear; }
.envoyer span { width: 32px; height: 32px; border-radius: 50%; background: url('assets/hub-core.png') center / cover; transition: transform var(--d-2) var(--ressort); }
.envoyer:disabled { opacity: .42; box-shadow: none; }
.envoyer:disabled span { transform: scale(.86); }
.envoyer:not(:disabled):active { transform: scale(.9); transition-duration: var(--d-appui); box-shadow: 0 0 34px rgba(143,216,184,.75); }

/* @voix */
.voix { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); margin: 0; padding: 10px; list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px; border-radius: var(--rayon-tuile); background: var(--grain), var(--verre-reflet), rgba(9, 27, 22, 0.97);
  border: 1px solid var(--verre-bord-fort); box-shadow: var(--liseré), var(--ombre-3); max-height: 38vh; overflow-y: auto;
  transform-origin: 20% 100%; animation: entree var(--d-2) var(--ressort-doux) both; }
.voix li { animation: pose var(--d-2) var(--ressort-doux) both; }
.voix li:nth-child(2) { animation-delay: 20ms; } .voix li:nth-child(3) { animation-delay: 40ms; } .voix li:nth-child(4) { animation-delay: 60ms; }
.voix li:nth-child(5) { animation-delay: 80ms; } .voix li:nth-child(6) { animation-delay: 100ms; } .voix li:nth-child(n+7) { animation-delay: 120ms; }
.voix button { border: 1px solid rgba(170,240,210,.3); background: rgba(170,240,210,.08); border-radius: var(--rond); min-height: 44px;
  padding: 8px 14px; font-size: var(--t-m); cursor: pointer; display: flex; gap: 6px; align-items: center; transition: transform var(--d-2) var(--ressort); }
.voix button:active { background: rgba(216,179,106,.22); border-color: var(--or-bord); transform: scale(.94); transition-duration: var(--d-appui); }

/* accueil : relier l'appareil */
.accueil { position: fixed; inset: 0; z-index: var(--z-accueil); display: grid; place-items: center; padding: 24px;
  background: rgba(5,12,9,.6); -webkit-backdrop-filter: var(--flou-1); backdrop-filter: var(--flou-1); }

.visionneuse { position: fixed; inset: 0; z-index: var(--z-visionneuse); display: grid; place-items: center; background: rgba(4,10,7,.94); cursor: zoom-out;
  animation: fondu var(--d-1) linear both; }
.visionneuse img { max-width: 100%; max-height: 100%; animation: monte var(--d-3) var(--ressort-doux) both; }
.visionneuse::after { content: ''; position: absolute; top: calc(env(safe-area-inset-top) + 16px); right: 16px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--encre) ; -webkit-mask: var(--ic-fermer) center / 22px no-repeat; mask: var(--ic-fermer) center / 22px no-repeat; opacity: .85; }

@keyframes entree { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes cible { 0% { opacity: 0; transform: scale(1.08); } 18%, 60% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }
@keyframes reflet { to { transform: translateX(100%); } }
