/* ===== Thèmes ===== */
body[data-theme="sombre"] {
  --fond: #05070f; --texte: #e6e9f2; --doux: #a3abc2; --carte: #131929; --carte-verre: rgba(19,25,41,0.62); --bord: #222a40;
  --accent: #38bdf8; --accent-texte: #7dd3fc; --bulle-moi: #1d4ed8; --bulle-moi-texte: #ffffff;
  --voile: 5,7,15; --bulle-lui: rgba(10,13,24,0.74); --bulle-bord: rgba(255,255,255,0.13); --bulle-moi-verre: rgba(29,78,216,0.80);
  --taille: 16px; --bordure: 1px; --police: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
body[data-theme="clair"] {
  --fond: #eef1f8; --texte: #141a2b; --doux: #566079; --carte: #ffffff; --carte-verre: rgba(255,255,255,0.72); --bord: #dde2ee;
  --accent: #0284c7; --accent-texte: #0369a1; --bulle-moi: #1d4ed8; --bulle-moi-texte: #ffffff;
  --voile: 238,241,248; --bulle-lui: rgba(255,255,255,0.88); --bulle-bord: rgba(20,26,43,0.12); --bulle-moi-verre: rgba(29,78,216,0.92);
  --taille: 16px; --bordure: 1px; --police: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
body[data-theme="contraste"] {
  --fond: #000000; --texte: #ffffff; --doux: #ffe600; --carte: #000000; --carte-verre: rgba(0,0,0,0.85); --bord: #ffffff;
  --accent: #ffe600; --accent-texte: #ffe600; --bulle-moi: #ffe600; --bulle-moi-texte: #000000;
  --voile: 0,0,0; --bulle-lui: #000000; --bulle-bord: #ffffff; --bulle-moi-verre: #ffe600;
  --taille: 24px; --bordure: 4px; --police: "Atkinson Hyperlegible", Verdana, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fond); color: var(--texte); font-family: var(--police); font-size: var(--taille);
  -webkit-tap-highlight-color: transparent; overflow: hidden;
}
.ecran { position: relative; z-index: 1; height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
#ciel { position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 0; pointer-events: none; display: block; }
.ecran[hidden] { display: none; }
.invisible { position: absolute; left: -9999px; }
a { color: var(--accent-texte); text-decoration: underline; }

/* ===== Connexion ===== */
.connexion { margin: auto; width: min(360px, 90vw); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.connexion form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
#sphere-connexion { width: 220px; height: 220px; display: block; }
.nom-assistant { margin: 0; font-size: 2em; letter-spacing: 0.04em; }
label { color: var(--doux); font-size: 0.9em; }
input {
  font: inherit; color: var(--texte); background: var(--carte); border: var(--bordure) solid var(--bord);
  border-radius: 14px; padding: 0 16px; min-height: 52px; width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.bouton-principal {
  font: inherit; font-weight: 700; min-height: 52px; border-radius: 14px; border: var(--bordure) solid var(--accent);
  background: var(--accent); color: var(--fond); cursor: pointer;
}
.erreur { color: #f87171; min-height: 1.2em; margin: 0; }
body[data-theme="contraste"] .erreur { color: #ffffff; text-decoration: underline; }

/* ===== Principal ===== */
.entete { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 0 18px; }
.date { color: var(--doux); font-size: 0.82em; }
.salut { font-size: 1.6em; font-weight: 600; }
.bouton-rond {
  width: 48px; height: 48px; border-radius: 50%; border: var(--bordure) solid var(--bord);
  background: var(--carte); color: var(--texte); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
body[data-theme="contraste"] .bouton-rond { width: 64px; height: 64px; border-color: var(--accent); color: var(--accent); }

.zone-sphere { display: flex; flex-direction: column; align-items: center; padding: 4px 0 0 0; }
.bouton-sphere {
  border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 50%;
  width: min(64vw, 32dvh, 290px); aspect-ratio: 1; touch-action: manipulation;
}
.bouton-sphere:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
#sphere { width: 100%; height: 100%; display: block; }
.legende {
  margin: 6px 0 0 0; color: var(--texte); font-size: 0.82em; text-align: center; padding: 6px 14px 6px 12px; border-radius: 999px;
  background: rgba(var(--voile),0.6); border: var(--bordure) solid var(--bulle-bord); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: inline-flex; align-items: center; gap: 8px; max-width: 92vw;
}
.legende:empty { display: none; }
.legende::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; box-shadow: 0 0 8px var(--accent); }
body[data-mode="ecoute"] .legende::before { background: #ef4444; box-shadow: 0 0 10px #ef4444; animation: direct 1s ease-in-out infinite; }
body[data-mode="reflechit"] .legende::before { background: #fbbf24; box-shadow: 0 0 10px #fbbf24; animation: direct 0.6s ease-in-out infinite; }
body[data-mode="parle"] .legende::before { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
@keyframes direct { 50% { opacity: 0.25; } }
body[data-theme="contraste"] .legende { border-color: var(--accent); }
.transcription { margin: 4px 0 0 0; color: var(--doux); font-size: 0.9em; min-height: 1.3em; text-align: center; padding: 0 20px; font-style: italic; }

/* ===== Façon appli d'appel vidéo : la sphère en plein écran, la conversation par-dessus ===== */
.zone-sphere { flex: 1; min-height: 0; justify-content: flex-start; padding-top: 2dvh; }
.pied { position: relative; z-index: 2; }
.pied::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(100% + 34dvh); pointer-events: none; z-index: -1;
  background: linear-gradient(to top, rgba(var(--voile),0.96) 0%, rgba(var(--voile),0.85) 35%, rgba(var(--voile),0.45) 75%, rgba(var(--voile),0) 100%);
}
.fil {
  position: absolute; left: 0; right: 0; bottom: 100%; max-height: 40dvh; overflow-y: auto;
  padding: 36px 14px 8px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
          mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
}
.fil::-webkit-scrollbar { display: none; }
.fil > :first-child { margin-top: auto; }
.bulle { max-width: 86%; padding: 10px 14px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; animation: arrive 0.3s ease-out; font-size: 0.95em; box-shadow: 0 4px 18px rgba(0,0,0,0.25); }
/* Messages façon sous-titres World Speaking : verre sombre, net et lisible */
.bulle.moi { align-self: flex-end; background: var(--bulle-moi-verre); color: var(--bulle-moi-texte); border: var(--bordure) solid rgba(255,255,255,0.14); border-radius: 16px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.bulle.lui { align-self: flex-start; background: var(--bulle-lui); color: var(--texte); border: var(--bordure) solid var(--bulle-bord); border-radius: 16px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
body[data-theme="contraste"] .bulle.lui { border-color: var(--texte); }
.bulle.note { align-self: center; background: rgba(var(--voile),0.8); color: var(--accent-texte); font-size: 0.8em; padding: 5px 12px; border-radius: 999px; box-shadow: none; }
body[data-theme="contraste"] .bulle { box-shadow: none; }

/* Bandeau du briefing : pastilles qui défilent sur le côté */
.bandeau { display: flex; gap: 8px; overflow-x: auto; padding: 6px 14px 2px; scrollbar-width: none; }
.bandeau::-webkit-scrollbar { display: none; }
.bandeau:empty { display: none; }
.pastille {
  font: inherit; font-size: 0.8em; color: var(--texte); white-space: nowrap; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; gap: 6px; padding: 8px 13px; min-height: 40px; border-radius: 999px;
  background: rgba(var(--voile),0.75); border: var(--bordure) solid var(--bord); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pastille b { font-weight: 600; }
.pastille .point { width: 7px; height: 7px; border-radius: 50%; background: #fbbf24; }
body[data-theme="contraste"] .pastille { border-color: var(--accent); min-height: 56px; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.barre-texte { display: flex; gap: 10px; padding: 8px 14px calc(12px + env(safe-area-inset-bottom)) 14px; }
.barre-texte input { background: var(--bulle-lui); }
.barre-texte input { border-radius: 26px; }
.bouton-envoyer {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: var(--fond);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
body[data-theme="contraste"] .bouton-envoyer { width: 64px; height: 64px; }
body[data-theme="contraste"] .barre-texte input { min-height: 64px; }

.barre-texte .bouton-rond { flex-shrink: 0; width: 52px; height: 52px; }
body[data-theme="contraste"] .barre-texte .bouton-rond { width: 64px; height: 64px; }
.vignettes { align-self: flex-end; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 84%; }
.vignettes img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: var(--bordure) solid var(--bord); }
.note a { color: var(--accent-texte); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { .bulle, .briefing, .carte-action { animation: none; } }

/* ===== Météo ===== */
.meteo { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; min-height: 26px; }
.puce {
  font-size: 0.74em; padding: 4px 11px; border-radius: 999px; color: var(--texte); white-space: nowrap;
  background: linear-gradient(135deg, rgba(56,189,248,0.10), rgba(139,92,246,0.08));
  border: var(--bordure) solid rgba(125,211,252,0.28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 0 18px rgba(56,189,248,0.10); animation: flotte 7s ease-in-out infinite;
}
.puce:nth-child(2) { animation-delay: -3.5s; }
body[data-theme="clair"] .puce { background: rgba(255,255,255,0.7); border-color: var(--bord); box-shadow: none; }
body[data-theme="contraste"] .puce { background: #000; border-color: var(--accent); box-shadow: none; animation: none; }
/* Boutons du haut : en verre, posés dans l'espace */
body[data-theme="sombre"] .entete .bouton-rond {
  background: linear-gradient(135deg, rgba(56,189,248,0.10), rgba(139,92,246,0.08));
  border-color: rgba(125,211,252,0.28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 0 18px rgba(56,189,248,0.12);
}
.puce b { font-weight: 600; }

/* ===== Chiffres toujours visibles, flottant dans l'espace ===== */
.chiffres { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.chiffre {
  font: inherit; color: var(--texte); cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 1px; padding: 6px 12px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(56,189,248,0.10), rgba(139,92,246,0.08));
  border: var(--bordure) solid rgba(125,211,252,0.28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 0 18px rgba(56,189,248,0.10); animation: flotte 6s ease-in-out infinite;
}
.chiffre:nth-child(2) { animation-delay: -3s; }
.chiffre .titre { font-size: 0.66em; color: var(--doux); letter-spacing: 0.03em; }
.chiffre .valeur { font-size: 0.98em; font-weight: 600; }
.chiffre .valeur.bon { color: #86efac; }
.chiffre .valeur.mauvais { color: #fca5a5; }
body[data-theme="clair"] .chiffre { background: rgba(255,255,255,0.7); border-color: var(--bord); box-shadow: none; }
body[data-theme="clair"] .chiffre .valeur.bon { color: #15803d; }
body[data-theme="clair"] .chiffre .valeur.mauvais { color: #b91c1c; }
body[data-theme="contraste"] .chiffre { background: #000; border-color: var(--accent); box-shadow: none; animation: none; }
body[data-theme="contraste"] .chiffre .valeur.bon, body[data-theme="contraste"] .chiffre .valeur.mauvais { color: var(--texte); }
@keyframes flotte { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .chiffre, .puce, .legende::before { animation: none !important; } }

/* ===== Briefing ===== */
.briefing { align-self: stretch; display: flex; flex-direction: column; gap: 8px; animation: arrive 0.5s ease-out; }
.briefing h2 { margin: 2px 2px 0; font-size: 0.86em; font-weight: 600; color: var(--doux); letter-spacing: 0.02em; }
.grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
body[data-theme="contraste"] .grille { grid-template-columns: 1fr; }
.carte-b {
  font: inherit; color: var(--texte); text-align: left; cursor: pointer;
  background: var(--carte-verre); border: var(--bordure) solid var(--bord); border-radius: 16px; padding: 11px 13px;
  display: flex; flex-direction: column; gap: 3px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); min-height: 44px;
}
.carte-b:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.carte-b .titre { font-size: 0.74em; color: var(--doux); }
.carte-b .valeur { font-size: 1.25em; font-weight: 600; }
.carte-b .detail { font-size: 0.72em; color: var(--doux); }
.carte-b .detail.bon { color: #86efac; }
.carte-b .detail.mauvais { color: #fca5a5; }
body[data-theme="clair"] .carte-b .detail.bon { color: #15803d; }
body[data-theme="clair"] .carte-b .detail.mauvais { color: #b91c1c; }
body[data-theme="contraste"] .carte-b .detail.bon, body[data-theme="contraste"] .carte-b .detail.mauvais { color: var(--texte); }
.encours { display: flex; gap: 10px; align-items: center; background: var(--carte-verre); border: var(--bordure) solid var(--bord); border-radius: 16px; padding: 10px 13px; font-size: 0.82em; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.encours .point { width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; flex-shrink: 0; }
body[data-theme="contraste"] .encours .point { background: var(--accent); width: 14px; height: 14px; }

/* ===== Cartes d'action dans la conversation ===== */
.carte-action {
  align-self: flex-start; max-width: 84%; display: flex; gap: 10px; align-items: center; margin-top: -4px;
  background: var(--carte-verre); border: var(--bordure) solid var(--accent); border-radius: 14px; padding: 10px 12px;
  animation: arrive 0.35s ease-out; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.carte-action svg { color: var(--accent-texte); flex-shrink: 0; }
.carte-action .t { font-size: 0.82em; font-weight: 600; }
.carte-action .d { font-size: 0.74em; color: var(--doux); }

/* ===== Écran d'appel vidéo avec Ultra ===== */
.appel-barre { align-items: center; gap: 10px; padding: 12px 14px 6px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 38% 32%, #a5f3fc 0%, var(--accent) 42%, #0b2e4a 100%);
  box-shadow: 0 0 0 2px rgba(var(--voile),0.9), 0 0 0 3.5px rgba(125,211,252,0.55), 0 0 18px rgba(56,189,248,0.45);
}
body[data-theme="contraste"] .avatar { background: var(--accent); box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--accent); }
.appel-info { flex: 1; min-width: 0; }
.appel-nom { font-size: 1.15em; font-weight: 700; letter-spacing: 0.02em; margin: 0; }
.appel-etat { font-size: 0.74em; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.pt-vert { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; flex-shrink: 0; }
.appel-boutons { display: flex; gap: 8px; }
.appel-boutons .bouton-rond { width: 42px; height: 42px; }
body[data-theme="contraste"] .appel-boutons .bouton-rond { width: 60px; height: 60px; }

.infos { display: flex; gap: 6px; overflow-x: auto; padding: 4px 14px 2px; scrollbar-width: none; flex-shrink: 0; align-items: stretch; }
.infos::-webkit-scrollbar { display: none; }
.infos .meteo, .infos .chiffres { display: contents; }
.infos .puce, .infos .chiffre { flex-shrink: 0; }
.infos .puce { display: flex; align-items: center; }
.chiffre { padding: 5px 11px; border-radius: 12px; }
.chiffre .valeur { font-size: 0.9em; }
.chiffre .titre { font-size: 0.62em; }

/* La « vidéo » : Ultra en grand au centre */
.zone-sphere { position: relative; justify-content: center; padding: 0 0 6dvh; }
.bouton-sphere { width: min(88vw, 50dvh, 440px); }
.zone-sphere .legende { position: absolute; top: 10px; left: 14px; margin: 0; z-index: 3; font-size: 0.74em; letter-spacing: 0.02em; }
.vignette-toi {
  position: absolute; top: 10px; right: 14px; width: 74px; height: 98px; border-radius: 16px; z-index: 3;
  background: linear-gradient(160deg, rgba(30,41,70,0.85), rgba(10,13,24,0.9)); border: var(--bordure) solid var(--bulle-bord);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 20px rgba(0,0,0,0.35); transition: box-shadow 0.3s, border-color 0.3s;
}
.vignette-toi .initiale { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1em; color: #0b0f1a; background: linear-gradient(135deg, #fde68a, #d4a24c); }
.vignette-toi .toi { font-size: 0.66em; color: var(--doux); }
body[data-mode="ecoute"] .vignette-toi { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.5), 0 0 22px rgba(239,68,68,0.45); }
body[data-theme="clair"] .vignette-toi { background: rgba(255,255,255,0.85); }
body[data-theme="contraste"] .vignette-toi { background: #000; border-color: var(--accent); width: 90px; height: 116px; }
.transcription { position: absolute; bottom: 1dvh; left: 0; right: 0; margin: 0; z-index: 3; }

/* =====================================================================
   APPEL VIDÉO AVEC ULTRA (inspiré de World Speaking, esprit étoilé)
   ===================================================================== */
.appel { padding: 0; }
.appel .barre-appel { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px; }
.rond-conso {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%; cursor: pointer; font: inherit; color: var(--texte);
  background: rgba(var(--voile),0.85); border: 3px solid rgba(125,211,252,0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
}
.rond-conso #conso-valeur { font-size: 0.86em; font-weight: 700; }
.rond-conso .petit { font-size: 0.5em; color: var(--doux); }
.pilule-contact {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: rgba(var(--voile),0.6); border: var(--bordure) solid var(--bulle-bord); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pilule-contact .avatar { width: 40px; height: 40px; }
.appel-nom { font-size: 1.1em; }
.appel .appel-boutons { display: flex; gap: 6px; }
.appel .appel-boutons .bouton-rond { width: 42px; height: 42px; background: rgba(var(--voile),0.6); border-color: var(--bulle-bord); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
body[data-theme="contraste"] .rond-conso { border-color: var(--accent); background: #000; width: 70px; height: 70px; }
body[data-theme="contraste"] .pilule-contact { border-color: var(--accent); background: #000; }

/* Scène : infos à gauche, Ultra en vignette à droite */
.appel .scene { display: flex; gap: 12px; padding: 8px 12px 0; align-items: flex-start; flex-shrink: 0; }
.colonne-infos { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.bonjour { display: flex; flex-direction: column; }
#bonjour-texte { font-size: 1.45em; font-weight: 700; line-height: 1.15; }
.bonjour-date { font-size: 0.78em; color: var(--doux); text-transform: capitalize; }
.appel .meteo, .appel .chiffres { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; min-height: 0; }
.appel .chiffres { flex-direction: column; align-items: stretch; }
.appel .chiffre { width: 100%; padding: 8px 12px; border-radius: 14px; animation: none; }
.appel .chiffre .titre { font-size: 0.66em; }
.appel .chiffre .valeur { font-size: 1.05em; }

.vignette-ultra {
  position: relative; flex-shrink: 0; width: min(42vw, 190px); aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, rgba(30,58,110,0.55), rgba(5,7,15,0.92) 70%);
  border: 2px solid rgba(125,211,252,0.55); box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 26px rgba(56,189,248,0.22);
  display: flex; align-items: center; justify-content: center; transition: border-color 0.3s, box-shadow 0.3s;
}
.vignette-ultra .bouton-sphere { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.vignette-ultra .legende {
  position: absolute; left: 8px; right: 8px; bottom: 8px; top: auto; margin: 0; justify-content: center; font-size: 0.66em; padding: 4px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex;
}
body[data-mode="ecoute"] .vignette-ultra { border-color: #ef4444; box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 26px rgba(239,68,68,0.45); }
body[data-mode="parle"] .vignette-ultra { border-color: #22c55e; box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 26px rgba(34,197,94,0.4); }
body[data-mode="reflechit"] .vignette-ultra { border-color: #fbbf24; }
body[data-theme="clair"] .vignette-ultra { background: radial-gradient(ellipse at 50% 40%, #1e3a6e, #05070f 75%); }
body[data-theme="contraste"] .vignette-ultra { border: 4px solid var(--accent); background: #000; box-shadow: none; }

/* Pied : sous-titres, briefing et barre de commandes */
.appel .pied { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.appel .pied::before { display: none; }
.appel .fil {
  position: static; flex: 1; min-height: 0; max-height: none; overflow-y: auto; padding: 30px 12px 6px; gap: 10px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 60px); mask-image: linear-gradient(to bottom, transparent 0, #000 60px);
}
.appel .transcription { position: static; padding: 0 16px; margin: 0; min-height: 0; font-size: 0.9em; }
.appel .transcription:empty { display: none; }

/* Sous-titres façon World Speaking */
.appel .bulle { max-width: 82%; padding: 10px 14px 11px; border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.appel .bulle .qui { font-size: 0.68em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 3px; }
.appel .bulle .texte { font-size: 1.02em; line-height: 1.4; white-space: pre-wrap; }
.appel .bulle.lui { background: rgba(10,13,24,0.86); border: var(--bordure) solid rgba(125,211,252,0.22); }
.appel .bulle.lui .qui { color: var(--accent-texte); }
.appel .bulle.moi { background: rgba(10,13,24,0.72); color: var(--texte); border: var(--bordure) solid rgba(255,255,255,0.14); }
.appel .bulle.moi .qui { color: var(--doux); }
.appel .bulle.lui .texte { font-weight: 600; }
body[data-theme="clair"] .appel .bulle.lui, body[data-theme="clair"] .appel .bulle.moi { background: rgba(255,255,255,0.92); border-color: var(--bord); }
body[data-theme="contraste"] .appel .bulle.lui, body[data-theme="contraste"] .appel .bulle.moi { background: #000; border: 3px solid var(--texte); }
body[data-theme="contraste"] .appel .bulle.lui { border-color: var(--accent); }

.appel .bandeau { padding: 6px 12px 4px; }
.barre-commandes {
  display: flex; align-items: center; gap: 8px; margin: 6px 12px calc(12px + env(safe-area-inset-bottom)); padding: 8px;
  border-radius: 999px; background: rgba(var(--voile),0.82); border: var(--bordure) solid var(--bulle-bord);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 8px 26px rgba(0,0,0,0.35);
}
.barre-commandes input { flex: 1; min-width: 0; min-height: 46px; border-radius: 999px; background: transparent; border: 0; padding: 0 8px; }
.barre-commandes input:focus { outline: none; }
.bouton-commande {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; border: var(--bordure) solid var(--bulle-bord); background: transparent;
  color: var(--texte); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.bouton-commande.micro { border: 2px solid var(--accent); color: var(--accent-texte); }
body[data-mode="ecoute"] .bouton-commande.micro { background: #ef4444; border-color: #ef4444; color: #fff; }
.barre-commandes .bouton-envoyer { width: 46px; height: 46px; }
body[data-theme="contraste"] .barre-commandes { background: #000; border: 3px solid var(--accent); }
body[data-theme="contraste"] .bouton-commande, body[data-theme="contraste"] .barre-commandes .bouton-envoyer { width: 60px; height: 60px; }
body[data-theme="contraste"] .barre-commandes input { min-height: 60px; }
.vignette-ultra .legende { white-space: normal; text-align: center; line-height: 1.25; }
.appel .meteo { flex-wrap: nowrap; }
.appel .meteo .puce { font-size: 0.7em; padding: 4px 9px; }
.barre-commandes { gap: 6px; }
.barre-commandes .bouton-commande { width: 42px; height: 42px; }
.pastille.attente { cursor: default; border-color: var(--accent); }
.pastille .retirer { font: inherit; font-size: 1.2em; line-height: 1; background: transparent; border: 0; color: var(--doux); cursor: pointer; padding: 0 2px 0 6px; min-width: 28px; min-height: 28px; }
.barre-commandes { gap: 4px; padding: 6px; }
.barre-commandes .bouton-commande { width: 40px; height: 40px; }
.barre-commandes .bouton-commande svg { width: 20px; height: 20px; }
@keyframes flashb { 0% { box-shadow: 0 0 0 0 rgba(125,211,252,0.7); } 100% { box-shadow: 0 0 0 10px rgba(125,211,252,0); } }
.chiffre.flash { animation: flashb 0.9s ease-out; }

/* ===== Menu des modes ===== */
.appel .appel-boutons .bouton-mode { font-size: 1.15em; }
.menu-modes { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.55); display: flex; align-items: flex-end; justify-content: center; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.menu-modes[hidden] { display: none; }
.feuille-modes {
  width: 100%; max-width: 560px; max-height: 85dvh; overflow-y: auto; padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  background: rgba(var(--voile),0.97); border: var(--bordure) solid var(--bulle-bord); border-bottom: 0; border-radius: 24px 24px 0 0;
  animation: monte 0.25s ease-out;
}
@keyframes monte { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.tete-modes { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tete-modes h2 { margin: 0; font-size: 1.15em; }
.fermer-modes { font: inherit; font-size: 1.6em; width: 44px; height: 44px; border-radius: 50%; border: var(--bordure) solid var(--bulle-bord); background: transparent; color: var(--texte); cursor: pointer; }
.liste-modes { display: flex; flex-direction: column; gap: 8px; }
.choix-mode {
  font: inherit; color: var(--texte); text-align: left; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; min-height: 64px; border-radius: 16px; background: rgba(255,255,255,0.04); border: var(--bordure) solid var(--bulle-bord);
}
.choix-mode.actif { border: 2px solid var(--accent); background: rgba(56,189,248,0.10); }
.choix-mode .ic { font-size: 1.7em; width: 40px; text-align: center; }
.choix-mode .tx { flex: 1; display: flex; flex-direction: column; }
.choix-mode small { color: var(--doux); font-size: 0.8em; }
.choix-mode .gratuit { font-size: 0.68em; color: #86efac; border: 1px solid rgba(134,239,172,0.4); border-radius: 999px; padding: 3px 8px; }
.note-modes { color: var(--doux); font-size: 0.78em; margin: 12px 4px 0; }
body[data-theme="clair"] .choix-mode { background: #fff; }
body[data-theme="clair"] .choix-mode .gratuit { color: #15803d; border-color: #15803d; }
body[data-theme="contraste"] .choix-mode { background: #000; border: 3px solid var(--texte); }
body[data-theme="contraste"] .choix-mode.actif { border-color: var(--accent); }
body[data-theme="contraste"] .choix-mode .gratuit { color: var(--accent); border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .feuille-modes { animation: none; } }

/* ===== Les messages montent et se perdent dans l'espace, en passant derrière Ultra ===== */
.appel { position: relative; }
.appel .scene { position: absolute; top: var(--haut-entete, 76px); left: 0; right: 0; z-index: 3; pointer-events: none; }
.appel .scene .vignette-ultra { pointer-events: auto; }
.appel .pied { flex: 1; min-height: 0; }
.appel .fil {
  padding-top: 40px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 30px, rgba(0,0,0,0.12) 140px, rgba(0,0,0,0.45) 250px, #000 340px);
          mask-image: linear-gradient(to bottom, transparent 0, transparent 30px, rgba(0,0,0,0.12) 140px, rgba(0,0,0,0.45) 250px, #000 340px);
}
.appel .fil::before { content: ""; flex: 0 0 auto; min-height: 290px; }

/* Vitesse de la voix (menu des modes) */
.vitesse-voix { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--carte); border: var(--bordure) solid var(--bord); }
.vitesse-boutons { display: flex; align-items: center; gap: 10px; }
.vitesse-boutons .bouton-rond { width: 44px; height: 44px; font-size: 1.4em; font-weight: 700; }
#voix-valeur { min-width: 3.2em; text-align: center; font-weight: 700; font-size: 1.15em; font-variant-numeric: tabular-nums; }
body[data-theme="contraste"] .vitesse-boutons .bouton-rond { width: 60px; height: 60px; }

/* Ce que tu dis s'affiche en bas, juste au-dessus des commandes (plus caché en haut) */
.appel .transcription { position: relative; z-index: 4; align-self: flex-end; max-width: 80%; margin: 4px 14px 6px; padding: 8px 14px; border-radius: 18px 18px 4px 18px; background: var(--bulle-moi-verre); color: var(--bulle-moi-texte); font-style: italic; text-align: left; flex-shrink: 0; }
.appel .transcription:empty { display: none; }

/* Ce que tu dis : juste sous la vignette d'Ultra, tapé comme à la machine */
.appel .transcription { position: fixed; top: calc(var(--bas-scene, 360px) + 10px); right: 14px; left: auto; bottom: auto; z-index: 5; align-self: auto; max-width: 78%; margin: 0;
  padding: 10px 16px; border-radius: 18px 18px 4px 18px; background: var(--bulle-moi-verre); color: var(--bulle-moi-texte);
  font-family: "Courier New", ui-monospace, monospace; font-style: normal; font-size: 1em; letter-spacing: 0.01em; line-height: 1.35; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.appel .transcription::before { content: "TOI"; display: block; font-family: var(--police); font-size: 0.62em; font-weight: 700; letter-spacing: 0.12em; opacity: 0.75; margin-bottom: 3px; }
.appel .transcription.tape::after { content: ""; display: inline-block; width: 0.55em; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; background: currentColor; animation: curseur 0.9s steps(1) infinite; }
@keyframes curseur { 50% { opacity: 0; } }
.appel .transcription:empty { display: none; }

/* Espace Ultra public (réglages) */
.ultra-public { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--carte); border: var(--bordure) solid var(--bord); }
.titre-up { margin: 0 0 10px; font-size: 0.95em; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.titre-up a { font-size: 0.8em; font-weight: 500; color: var(--accent-texte); text-decoration: none; }
.up-chiffres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.up-carte { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--bord); text-align: center; }
.up-carte b { font-size: 1.25em; font-variant-numeric: tabular-nums; }
.up-carte span { font-size: 0.72em; color: var(--doux); }
.up-liste { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 40vh; overflow-y: auto; }
.up-ligne { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--bord); font-size: 0.88em; }
.up-ligne span { font-size: 0.82em; }

.feuille-modes { max-height: 88dvh; overflow-y: auto; }

/* ===== Thème « World Speaking » : nuit et or champagne ===== */
body[data-theme="ws"] {
  --fond: #0B0E13; --texte: #F4EEE4; --doux: #A7AEB7; --carte: #141820; --carte-verre: rgba(20,24,30,0.72); --bord: rgba(214,182,124,0.28);
  --accent: #D6B67C; --accent-texte: #E1BD7E; --bulle-moi: #B8935A; --bulle-moi-texte: #1B150B;
  --voile: 11,14,19; --bulle-lui: rgba(20,24,30,0.82); --bulle-bord: rgba(214,182,124,0.25); --bulle-moi-verre: rgba(214,182,124,0.92);
  --taille: 16px; --bordure: 1px; --police: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --carte-pleine: #141820; --sur-accent: #1B150B; --danger: #fca5a5;
}
body[data-theme="ws"] .bonjour, body[data-theme="ws"] .appel-nom, body[data-theme="ws"] #bonjour-texte, body[data-theme="ws"] h1, body[data-theme="ws"] h2 { font-family: "Playfair Display", Georgia, serif; }
body[data-theme="ws"] #bonjour-texte { background: linear-gradient(180deg,#F6E3B8,#D6B67C 55%,#B8935A); -webkit-background-clip: text; background-clip: text; color: transparent; }
body[data-theme="ws"] .avatar { background: radial-gradient(circle at 38% 32%, #F6E3B8 0%, #D6B67C 45%, #6b5128 100%); box-shadow: 0 0 0 2px rgba(11,14,19,0.9), 0 0 0 3.5px rgba(214,182,124,0.6), 0 0 18px rgba(214,182,124,0.4); }
body[data-theme="ws"] .vignette-ultra { background: radial-gradient(ellipse at 50% 40%, rgba(90,70,35,0.45), rgba(11,14,19,0.94) 70%); border-color: rgba(214,182,124,0.6); box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 26px rgba(214,182,124,0.22); }
body[data-theme="ws"] .bouton-envoyer, body[data-theme="ws"] .bouton-plein { background: linear-gradient(180deg,#F6E3B8,#D6B67C 55%,#B8935A); color: #1B150B; }
body[data-theme="ws"] .bulle.moi, body[data-theme="ws"] .transcription { background: linear-gradient(180deg, rgba(246,227,184,0.95), rgba(214,182,124,0.95)); color: #1B150B; }
body[data-theme="ws"] .bulle.lui { border-color: rgba(214,182,124,0.25); }
body[data-theme="ws"] .puce, body[data-theme="ws"] .pastille { background: rgba(214,182,124,0.08); border-color: rgba(214,182,124,0.3); box-shadow: none; }
body[data-theme="ws"] .encadre, body[data-theme="ws"] .mode .icone, body[data-theme="ws"] .choix button[aria-pressed="true"] { background: rgba(214,182,124,0.12); border-color: rgba(214,182,124,0.4); }
body[data-theme="ws"] .bouton-commande.micro { border-color: #D6B67C; color: #E1BD7E; }
body[data-theme="ws"] .bonjour-date { font-family: var(--police); }

/* Bandeau qui défile (mails + agenda) */
.bandeau.defile { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%); }
.bandeau .piste { display: flex; gap: 8px; width: max-content; animation: defile 20s linear infinite; }
.bandeau.defile:hover .piste, .bandeau.defile:focus-within .piste { animation-play-state: paused; }
@keyframes defile { from { transform: translateX(0); } to { transform: translateX(calc(-50% - 4px)); } }
@media (prefers-reduced-motion: reduce) { .bandeau .piste { animation: none; } .bandeau.defile { overflow-x: auto; } }

/* ===== Lexique : ce que tu peux dire à Ultra ===== */
.lexique-fond { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: rgba(5,7,15,0.86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
body[data-theme="clair"] .lexique-fond { background: rgba(238,241,248,0.94); }
body[data-theme="contraste"] .lexique-fond { background: #000; }
.lexique-page { max-width: 1240px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.lex-tete { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.lex-tete h2 { margin: 0; font-size: 1.3em; }
.lex-sous { margin: 2px 0 0; font-size: 0.82em; color: var(--doux); }
.lex-cherche { width: 100%; min-height: 48px; border-radius: 24px; padding: 0 18px; margin: 4px 0 14px; border: 1px solid var(--bord); background: rgba(255,255,255,0.04); color: var(--texte); font: inherit; }
.lex-nav { display: none; }
.lex-grille { display: grid; grid-template-columns: 1fr; gap: 12px; }
.lex-carte { border: 1px solid var(--bord); border-radius: 18px; padding: 14px 14px 8px; background: var(--carte-verre); scroll-margin-top: 12px; }
.lex-carte h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1.05em; color: var(--accent-texte); }
.lex-phrases { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 6px; }
.lex-phrase { min-height: 44px; border-radius: 22px; border: 1px solid var(--accent); background: transparent; color: var(--texte); font: inherit; font-size: 0.92em; padding: 8px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.lex-phrase:hover, .lex-phrase:focus-visible { background: rgba(125,211,252,0.12); }
.lex-phrase small { color: var(--doux); font-size: 0.82em; }
.lex-mode { flex: 1 1 210px; border-radius: 14px; }
.lex-rien { color: var(--doux); text-align: center; }
body[data-theme="contraste"] .lex-phrase { border-width: 2px; }
@media (min-width: 700px) { .lex-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) {
  .lex-corps { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
  .lex-nav { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 12px; }
  .lex-nav button { display: flex; align-items: center; gap: 10px; min-height: 44px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--texte); font: inherit; text-align: left; padding: 0 12px; cursor: pointer; }
  .lex-nav button:hover { border-color: var(--bord); background: rgba(255,255,255,0.04); }
  .lex-grille { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}

/* ===== Tablette et ordinateur : Ultra occupe toute la place ===== */
@media (min-width: 720px) {
  .ecran.appel, .appel { max-width: none; }
  .appel .bulle { max-width: 70%; }
  .vignette-ultra { width: min(34vw, 260px); }
  .appel .fil::before { min-height: 380px; }
  .appel .colonne-infos { font-size: 1.12em; }
}
@media (min-width: 1000px) and (min-aspect-ratio: 1/1) {
  .appel { display: grid; grid-template-columns: minmax(340px, 38%) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
  .appel .barre-appel { grid-column: 1 / -1; grid-row: 1; padding: 16px 24px 8px; }
  .appel .scene { position: relative; top: auto; grid-column: 1; grid-row: 2; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px; pointer-events: auto; }
  .appel .colonne-infos { flex: none; align-items: center; text-align: center; width: 100%; max-width: 420px; }
  .appel .meteo, .appel .chiffres { justify-content: center; }
  .vignette-ultra { width: min(26vw, 360px); border-radius: 28px; }
  .vignette-ultra .legende { font-size: 0.8em; }
  .appel .pied { grid-column: 2; grid-row: 2; min-height: 0; padding: 0 24px 12px 8px; border-left: var(--bordure) solid var(--bord); }
  .appel .fil { padding-top: 24px; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 70px); mask-image: linear-gradient(to bottom, transparent 0, #000 70px); }
  .appel .fil::before { min-height: 0; }
  .appel .bulle { max-width: 68%; }
  .appel .transcription { position: relative; top: auto; right: auto; align-self: flex-end; margin: 6px 16px 8px; max-width: 68%; }
  .appel .barre-commandes { max-width: none; }
}
/* Petits téléphones : 4 boutons en haut sans écraser le nom d'Ultra */
@media (max-width: 400px) { .appel .appel-boutons { gap: 4px; } .appel .appel-boutons .bouton-rond { width: 38px; height: 38px; } .appel .barre-appel { gap: 6px; } }
/* Fiche d'un testeur Ultra public (touche son nom) */
details.up-ligne summary { display: flex; flex-direction: column; cursor: pointer; list-style: none; }
details.up-ligne summary::-webkit-details-marker { display: none; }
details.up-ligne summary b::after { content: " ›"; color: var(--doux); }
details.up-ligne[open] summary b::after { content: " ⌄"; }
.up-fiche { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--bord); }
.up-fiche > div { display: flex; justify-content: space-between; gap: 10px; }
.up-code { flex-direction: column; align-items: stretch !important; gap: 6px !important; margin-top: 4px; }
.up-code code { font-family: ui-monospace, "Courier New", monospace; font-size: 1.15em; font-weight: 700; letter-spacing: 0.06em; text-align: center; padding: 8px; border-radius: 10px; border: 1px dashed var(--accent); color: var(--accent-texte); user-select: all; }
.up-copier { min-height: 40px; border-radius: 12px; border: 1px solid var(--accent); background: transparent; color: var(--accent-texte); font: inherit; font-weight: 600; cursor: pointer; }
