:root {
  --fond: #05080d;
  --fond-2: #0b1119;
  --surface: #111a26;
  --bord: #1d2a3a;
  --texte: #e6eef7;
  --texte-2: #8ea1b6;
  --accent: #39d0ff;
  --accent-2: #1d8fff;
  --chaud: #ffb347;
  --danger: #ff5c6c;
  --ok: #4ade80;
  --rayon: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(120% 80% at 50% 100%, #0a1a2b 0%, var(--fond) 60%) fixed;
  color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- connexion */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.connexion-carte { width: min(380px, 100%); text-align: center; }
.connexion h1 { margin: 18px 0 2px; font-size: 2rem; letter-spacing: .3em; font-weight: 600; }
.sous-titre { color: var(--texte-2); margin: 0 0 28px; }
form label { display: block; text-align: left; font-size: .85rem; color: var(--texte-2); margin-bottom: 14px; }
form input {
  display: block; width: 100%; margin-top: 6px; padding: 13px 14px; border-radius: 12px;
  border: 1px solid var(--bord); background: var(--fond-2); color: var(--texte); font-size: 1rem;
}
form input:focus, .composeur textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.bouton-principal {
  width: 100%; padding: 13px; border: 0; border-radius: 12px; margin-top: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #021019; font-weight: 600;
}
.erreur { color: var(--danger); min-height: 1.5em; font-size: .9rem; }
.logo-orbe { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, #0f2b40, #050a10 70%); box-shadow: 0 0 40px #39d0ff55, inset 0 0 18px #39d0ff66; }
.logo-orbe span { width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle, #e9fbff, var(--accent) 45%, #0b4d73 75%); box-shadow: 0 0 24px var(--accent); }

/* ---------------------------------------------------------------- app */
.app { height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.barre {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid #ffffff0d;
  background: #05080dcc; backdrop-filter: blur(10px);
}
.identite { display: flex; align-items: center; gap: 10px; letter-spacing: .35em; font-size: .95rem; }
.statut { width: 8px; height: 8px; border-radius: 50%; background: var(--texte-2); }
.statut.en-ligne { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.actions { display: flex; gap: 6px; }
.icone {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--bord);
  background: var(--surface); font-size: 1.1rem; display: grid; place-items: center;
}
.icone.petit { width: 44px; height: 44px; border-radius: 50%; font-size: 1rem; color: var(--texte-2); }
.icone[aria-pressed="true"] { color: var(--accent); border-color: #39d0ff66; box-shadow: 0 0 12px #39d0ff33; }

/* fil de discussion */
.fil { flex: 1; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.accueil { margin: auto; text-align: center; color: var(--texte-2); max-width: 320px; }
.exemples { font-size: .9rem; opacity: .8; font-style: italic; }
.bulle {
  max-width: min(85%, 640px); padding: 10px 14px; border-radius: var(--rayon); white-space: pre-wrap;
  overflow-wrap: anywhere; animation: apparait .2s ease-out;
}
.bulle.moi { align-self: flex-end; background: linear-gradient(135deg, #1679d6, #1d8fff); border-bottom-right-radius: 6px; }
.bulle.ako { align-self: flex-start; background: var(--surface); border: 1px solid var(--bord); border-bottom-left-radius: 6px; }
.bulle pre { white-space: pre; overflow-x: auto; background: #05080d; padding: 10px; border-radius: 10px; font-size: .85rem; margin: 8px 0; }
.bulle code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.bulle .ecouter { display: block; margin-top: 6px; border: 0; background: none; color: var(--accent); padding: 0; font-size: .85rem; }
.bulle .heure { display: block; font-size: .7rem; color: #ffffff66; margin-top: 4px; }
.bulle.attente { color: var(--texte-2); font-style: italic; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } }

/* orbe */
.zone-vocale { padding: 6px 16px 4px; text-align: center; }
.etat-vocal { min-height: 1.4em; margin: 0 0 4px; font-size: .85rem; color: var(--texte-2); letter-spacing: .02em; }
.orbe-ligne { display: flex; align-items: center; justify-content: center; gap: 16px; }
.orbe {
  --niveau: 0; position: relative; width: 92px; height: 92px; border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle, #0f2b40 0%, #050a10 70%); touch-action: none;
  box-shadow: 0 0 calc(24px + var(--niveau) * 60px) #39d0ff55, inset 0 0 22px #39d0ff44;
  transition: box-shadow .08s linear;
}
.orbe .coeur {
  position: absolute; inset: 30px; border-radius: 50%;
  background: radial-gradient(circle, #f0fcff, var(--accent) 45%, #0b4d73 78%);
  box-shadow: 0 0 26px var(--accent); transform: scale(calc(1 + var(--niveau) * .55)); transition: transform .08s linear;
}
.orbe .anneau { position: absolute; inset: 8px; border-radius: 50%; border: 2px solid #39d0ff55; }
.orbe .a2 { inset: 0; border-color: #39d0ff22; border-style: dashed; }
.orbe.ecoute .a1 { border-color: var(--accent); animation: tourne 3s linear infinite; border-top-color: transparent; }
.orbe.reflechit .a1 { border-color: var(--chaud); border-top-color: transparent; animation: tourne .8s linear infinite; }
.orbe.reflechit .coeur { background: radial-gradient(circle, #fff6e8, var(--chaud) 45%, #7a4a12 78%); box-shadow: 0 0 26px var(--chaud); }
.orbe.veille .a2 { border-color: #39d0ff66; animation: tourne 14s linear infinite; }
.orbe.veille .coeur { animation: pulse 3.5s ease-in-out infinite; }
.orbe.parle .coeur { animation: pulse 1s ease-in-out infinite; }
.orbe.parle .a2 { animation: tourne 6s linear infinite reverse; border-color: #39d0ff66; }
@keyframes tourne { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.18); } }

/* composeur */
.composeur { display: flex; gap: 8px; padding: 8px 12px 12px; align-items: flex-end; }
.composeur textarea {
  flex: 1; resize: none; max-height: 140px; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--bord);
  background: var(--fond-2); color: var(--texte); font: inherit;
}
.envoyer { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent-2); color: white; font-size: 1.1rem; }

/* panneaux */
.voile { position: fixed; inset: 0; background: #000a; z-index: 9; }
.panneau {
  position: fixed; z-index: 10; inset: auto 0 0 0; max-height: 80dvh; overflow-y: auto; background: var(--fond-2);
  border-top: 1px solid var(--bord); border-radius: 22px 22px 0 0;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); animation: monte .2s ease-out;
}
@media (min-width: 720px) { .panneau { inset: 0 0 0 auto; width: 400px; max-height: none; border-radius: 0; border-left: 1px solid var(--bord); } }
@keyframes monte { from { transform: translateY(30px); opacity: 0; } }
.panneau-tete { display: flex; align-items: center; justify-content: space-between; }
.panneau h2 { margin: 6px 0 12px; font-size: 1.1rem; }
.taches { list-style: none; padding: 0; margin: 0; }
.taches li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--bord); }
.taches input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.taches .quand { display: block; font-size: .8rem; color: var(--texte-2); }
.taches .retard { color: var(--danger); }
.menu { display: flex; flex-direction: column; gap: 8px; }
.ligne-menu { text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--bord); background: var(--surface); }
.ligne-menu.danger { color: var(--danger); }
.info { font-size: .85rem; color: var(--texte-2); margin: 2px 4px 8px; }
