/* Eva : une présence chaleureuse, pas un outil. Nuit prune, lumière pêche et corail. */
:root {
  --nuit: #24121f; --nuit2: #3b1a2e; --creme: #fbeee4; --doux: #d9bfb3; --corail: #ff8f70; --peche: #ffd2a8; --rose: #d9577f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); color: var(--creme); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(120% 70% at 50% 18%, #5a2440 0%, var(--nuit2) 38%, var(--nuit) 75%) fixed, var(--nuit);
}
button { font: inherit; color: inherit; cursor: pointer; }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--peche); outline-offset: 3px; }

/* ---- L'orbe : le visage de Eva ---- */
.orbe {
  position: relative; width: 196px; height: 196px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff3e6 0%, var(--peche) 22%, var(--corail) 55%, var(--rose) 100%);
  box-shadow: 0 0 60px 8px rgba(255, 143, 112, .35), inset -12px -18px 40px rgba(120, 30, 70, .45), inset 10px 12px 30px rgba(255, 255, 255, .35);
  animation: souffle 5s ease-in-out infinite;
}
.orbe .halo { position: absolute; inset: -18px; border-radius: 50%; border: 1px solid rgba(255, 210, 168, .35); animation: onde 4s ease-out infinite; pointer-events: none; }
.orbe .halo.h2 { animation-delay: 2s; }
.orbe .coeur { width: 46px; height: 46px; color: rgba(60, 14, 34, .72); }
.orbe:active { transform: scale(.97); }
@keyframes souffle { 0%, 100% { transform: scale(1); filter: saturate(1); } 50% { transform: scale(1.035); filter: saturate(1.12); } }
@keyframes onde { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .orbe, .orbe .halo, #appel .appel-avatar, #appel .appel-avatar::before { animation: none !important; } }

/* ---- L'accueil ---- */
#accueil { min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 0; }
.haut { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 0; }
.marque { font-family: var(--serif); font-size: 1.25rem; letter-spacing: .04em; color: var(--peche); }
.outils { display: flex; gap: 6px; }
.petit { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .06); display: grid; place-items: center; }
.petit svg { width: 22px; height: 22px; color: var(--doux); }
.presence { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 4vh 24px 2vh; }
.bonjour { margin: 0; font-family: var(--serif); font-size: clamp(1.7rem, 7vw, 2.3rem); font-weight: 400; text-align: center; }
.invite { margin: 4px 0 0; color: var(--doux); font-size: 1rem; }
.note { margin: 0; min-height: 1.3em; color: var(--peche); font-size: .95rem; text-align: center; }

.fil { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 16px 12px; max-width: 640px; width: 100%; margin: 0 auto; }
.fil p { margin: 0; padding: 10px 14px; border-radius: 18px; max-width: 86%; line-height: 1.4; font-size: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.fil .moi { align-self: flex-end; background: rgba(255, 143, 112, .2); border-bottom-right-radius: 6px; }
.fil .elle { align-self: flex-start; background: rgba(255, 255, 255, .07); border-bottom-left-radius: 6px; }
.fil .attend { color: var(--doux); }

.saisie { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(36, 18, 31, .92) 30%); max-width: 640px; width: 100%; margin: 0 auto; }
.saisie input { flex: 1; min-width: 0; height: 48px; padding: 0 18px; border-radius: 24px; border: 1px solid rgba(255, 210, 168, .22); background: rgba(255, 255, 255, .06); color: var(--creme); font: inherit; font-size: 1rem; }
.saisie input::placeholder { color: #b49a90; }
.saisie button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--corail); color: var(--nuit); display: grid; place-items: center; }
.saisie button svg { width: 22px; height: 22px; }

/* ---- La porte (connexion) ---- */
.porte { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.porte .orbe { width: 120px; height: 120px; margin-bottom: 10px; }
.porte h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 2.6rem; color: var(--peche); }
.porte .sous { margin: 0 0 18px; color: var(--doux); }
.porte form { display: flex; flex-direction: column; gap: 10px; width: min(340px, 100%); text-align: left; }
.porte label { color: var(--doux); font-size: .95rem; }
.porte input { height: 54px; padding: 0 16px; border-radius: 16px; border: 1px solid rgba(255, 210, 168, .3); background: rgba(255, 255, 255, .06); color: var(--creme); font: 600 1.15rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.porte button { height: 54px; border-radius: 16px; border: 0; background: linear-gradient(135deg, var(--peche), var(--corail)); color: var(--nuit); font-weight: 650; font-size: 1.05rem; }
.porte button:disabled { opacity: .6; }
.erreur { margin: 4px 0 0; min-height: 1.3em; color: #ffb4a6; }

/* ---- L'appel (public/appel.js) : plein écran, l'orbe vit selon l'état ---- */
body.en-appel { overflow: hidden; }
#appel {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(22px + env(safe-area-inset-bottom));
  background: radial-gradient(120% 70% at 50% 30%, #63284a 0%, var(--nuit2) 40%, var(--nuit) 80%), var(--nuit);
}
#appel .appel-tete { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#appel .appel-avatar {
  position: relative; width: 210px; height: 210px; border-radius: 50%; margin: 3vh 0 10px;
  background: radial-gradient(circle at 35% 30%, #fff3e6 0%, var(--peche) 22%, var(--corail) 55%, var(--rose) 100%);
  box-shadow: 0 0 70px 10px rgba(255, 143, 112, .35), inset -12px -18px 40px rgba(120, 30, 70, .45), inset 10px 12px 30px rgba(255, 255, 255, .35);
  animation: souffle 5s ease-in-out infinite; transition: box-shadow .4s;
}
#appel .appel-avatar::before { content: ""; position: absolute; inset: -16px; border-radius: 50%; border: 2px solid rgba(255, 210, 168, .0); }
#appel[data-etat="ecoute"] .appel-avatar::before { border-color: rgba(255, 210, 168, .55); animation: onde 1.8s ease-out infinite; }
#appel[data-etat="envoi"] .appel-avatar { animation: souffle 1.6s ease-in-out infinite; filter: brightness(.95); }
#appel[data-etat="parle"] .appel-avatar { animation: parle .5s ease-in-out infinite alternate; box-shadow: 0 0 110px 22px rgba(255, 143, 112, .55), inset -12px -18px 40px rgba(120, 30, 70, .4), inset 10px 12px 30px rgba(255, 255, 255, .4); }
#appel[data-etat="muet"] .appel-avatar { filter: grayscale(.6) brightness(.8); animation: none; }
@keyframes parle { from { transform: scale(1); } to { transform: scale(1.06); } }
#appel h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 2rem; color: var(--peche); }
#appel .appel-etat { margin: 0; font-size: 1.15rem; }
#appel .appel-detail { margin: 0; min-height: 1.2em; color: var(--doux); font-size: .95rem; text-align: center; max-width: 30em; }
#appel .appel-minuterie { color: #b49a90; font-variant-numeric: tabular-nums; font-size: .9rem; }
#appel .appel-fil { width: min(560px, 100%); flex: 1; overflow-y: auto; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
#appel .appel-fil p { margin: 0; line-height: 1.4; color: var(--creme); }
#appel .appel-fil b { color: var(--peche); font-weight: 600; }
#appel .appel-ecran { width: min(560px, 100%); max-height: 30vh; overflow-y: auto; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .07); line-height: 1.45; }
#appel .appel-entendu { margin: 0; min-height: 1.3em; color: var(--doux); font-style: italic; text-align: center; }
#appel .appel-gestes { display: flex; gap: 40px; align-items: center; }
#appel .appel-gestes button { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; font-size: .85rem; color: var(--doux); }
#appel .appel-gestes svg { width: 30px; height: 30px; padding: 18px; box-sizing: content-box; border-radius: 50%; background: rgba(255, 255, 255, .1); color: var(--creme); }
#appel .appel-micro[aria-pressed="true"] svg { background: var(--creme); color: var(--nuit); }
#appel .appel-raccrocher svg { background: #e0475b; color: #fff; }
#appel .appel-commencer { height: 56px; padding: 0 28px; border-radius: 28px; background: linear-gradient(135deg, var(--peche), var(--corail)) !important; color: var(--nuit) !important; font-weight: 650; font-size: 1.05rem !important; }
[hidden] { display: none !important; } /* les boutons de l'appel ont display:flex : hidden doit gagner */
.fil { padding-bottom: 24px; }
.fil p { scroll-margin-bottom: 96px; } /* la dernière bulle ne passe pas sous la barre de saisie */
