:root {
  --fond: #0f1115;
  --carte: #181b22;
  --carte-2: #20242d;
  --bord: #2a2f3a;
  --texte: #e8eaf0;
  --gris: #8b90a0;
  --accent: #2dd4a7;
  --accent-fonce: #12896b;
  --rouge: #ff6b6b;
  --orange: #f5a524;
  --arabe: "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bord);
}

.titre { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, #7ef0d0, var(--accent) 45%, var(--accent-fonce));
  box-shadow: 0 0 18px rgba(45, 212, 167, .35);
}
h1 { margin: 0; font-size: 17px; }
.sous-titre { margin: 0; color: var(--gris); font-size: 12px; }

.etats { display: flex; align-items: center; gap: 8px; }
.pastille {
  font-size: 12px; padding: 3px 10px; border-radius: 99px;
  background: var(--carte); border: 1px solid var(--bord); color: var(--gris);
}
.pastille::before { content: "● "; }
.pastille.ok { color: var(--accent); border-color: rgba(45, 212, 167, .4); }
.pastille.ko { color: var(--rouge); border-color: rgba(255, 107, 107, .4); }

select, input, button { font: inherit; color: inherit; }
select {
  background: var(--carte); border: 1px solid var(--bord); border-radius: 8px; padding: 4px 8px; max-width: 170px;
}

.alerte {
  margin: 12px 18px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(245, 165, 36, .1);
  border: 1px solid rgba(245, 165, 36, .4);
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.alerte button {
  background: var(--orange); color: #1a1205; border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600;
}
.alerte code { background: rgba(0,0,0,.3); padding: 1px 5px; border-radius: 4px; }

main {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.vide { margin: auto; text-align: center; color: var(--gris); }
.vide .exemple { font-family: var(--arabe); font-size: 22px; color: var(--texte); margin: 6px 0; }
.vide .astuce { font-size: 13px; }
@media (pointer: coarse) { .vide .astuce { display: none; } }
kbd { background: var(--carte-2); border: 1px solid var(--bord); border-radius: 4px; padding: 0 5px; font-size: 12px; }

.bulle {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  animation: entre .25s ease-out;
}
@keyframes entre { from { opacity: 0; transform: translateY(6px); } }

.bulle.moi { align-self: flex-end; background: var(--carte-2); border-bottom-right-radius: 4px; }
.bulle.bot { align-self: flex-start; background: var(--carte); border: 1px solid var(--bord); border-bottom-left-radius: 4px; }
.bulle.erreur { align-self: center; background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .4); color: #ffb3b3; font-size: 14px; }

.derja { font-family: var(--arabe); font-size: 19px; line-height: 1.7; }
.traduction { color: var(--gris); font-size: 13px; font-style: italic; margin-top: 4px; }
.meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; color: var(--gris); font-size: 12px; flex-wrap: wrap; }
.meta button {
  background: transparent; border: 1px solid var(--bord); border-radius: 99px; padding: 2px 10px; cursor: pointer; color: var(--accent);
}
.attente { color: var(--gris); }
.attente span { animation: clignote 1.2s infinite; }
.attente span:nth-child(2) { animation-delay: .2s; }
.attente span:nth-child(3) { animation-delay: .4s; }
@keyframes clignote { 50% { opacity: .2; } }

footer {
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--bord);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}

.micro {
  width: 78px; height: 78px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--accent); color: #062a20;
  display: grid; place-items: center;
  box-shadow: 0 6px 24px rgba(45, 212, 167, .35);
  transition: transform .15s, background .2s;
}
.micro svg { width: 34px; height: 34px; fill: currentColor; }
.micro:hover { transform: scale(1.04); }
.micro:active { transform: scale(.96); }
.micro.ecoute { background: var(--rouge); color: #2a0606; animation: pulse 1.2s infinite; }
.micro.occupe { background: var(--carte-2); color: var(--gris); cursor: wait; box-shadow: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, .55); }
  100% { box-shadow: 0 0 0 22px rgba(255, 107, 107, 0); }
}

.statut { margin: 0; color: var(--gris); font-size: 14px; min-height: 21px; }

.ecrire { display: flex; gap: 8px; width: 100%; max-width: 560px; }
.ecrire input {
  flex: 1; min-width: 0; background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 9px 12px;
}
.ecrire input:focus { outline: none; border-color: var(--accent); }
.ecrire button {
  background: var(--carte-2); border: 1px solid var(--bord); border-radius: 10px; padding: 0 14px; cursor: pointer;
}
.ecrire button.discret { color: var(--gris); }
