/* Jetons du design validé par Jon (maquettes design/kit.mjs). */
:root {
  --bg: #f2f1f9; --card: #fff; --ink: #27264a; --muted: #8988a8; --line: #ecebf5;
  --violet: #6b5ce6; --lav: #a79bff; --lav-soft: #ece9ff;
  --teal: #2e8c8f; --teal-soft: #dcefef;
  --green: #2fb67c; --green-soft: #ddf5ea;
  --amber: #d98a1f; --amber-soft: #fdf0da;
  --red: #e0567a; --red-soft: #fce3ea;
  --grad: linear-gradient(135deg, #6b5ce6 0%, #a79bff 100%);
  --sh: 0 10px 24px rgba(108, 100, 170, 0.13), -4px -4px 12px rgba(255, 255, 255, 0.9);
  --sh-btn: 0 10px 22px rgba(107, 92, 230, 0.35);
  --nav-h: 92px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #root { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Nunito Variable', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: var(--violet); }

.ecran {
  position: relative; max-width: 480px; min-height: 100%; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px);
  display: flex; flex-direction: column;
}
.ecran.sans-nav { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }
.rangee { display: flex; align-items: center; gap: 12px; }
textarea.champ, textarea.zone-texte { font: inherit; font-weight: 700; }
.pousse { flex-grow: 1; min-width: 0; }
.gap { flex-shrink: 0; }

.carte { background: var(--card); border-radius: 24px; box-shadow: var(--sh); }
.titre-page { font-size: 24px; font-weight: 800; letter-spacing: -0.2px; }
.titre-section { font-size: 16px; font-weight: 800; }
.discret { color: var(--muted); font-weight: 600; }

.rond { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 22px;
  background: var(--card); box-shadow: var(--sh); flex-shrink: 0; }
.pastille { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 6px; border-radius: 22px;
  background: var(--card); box-shadow: var(--sh); font-size: 14px; font-weight: 700; min-width: 0; flex: 0 1 auto; margin-left: 0; }
.pastille.a-droite { margin-left: auto; }
.pastille .initiales, .avatar { display: flex; align-items: center; justify-content: center; border-radius: 16px;
  background: var(--grad); color: #fff; font-weight: 800; flex-shrink: 0; }
.pastille .initiales { width: 32px; height: 32px; font-size: 12px; }
.pastille .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.puce { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--lav-soft); color: var(--violet); }
.puce.teal { background: var(--teal-soft); color: var(--teal); }
.puce.violet { background: #ebe8ff; color: var(--violet); }
.puce.vert { background: var(--green-soft); color: var(--green); }
.puce.gris { background: #f1f0f8; color: var(--muted); }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 22px;
  border-radius: 27px; font-size: 16px; font-weight: 800; width: 100%; }
.btn.primaire { background: var(--grad); color: #fff; box-shadow: var(--sh-btn); }
.btn.secondaire { background: var(--card); color: var(--violet); box-shadow: var(--sh); }
.btn.blanc { background: #fff; color: var(--violet); min-height: 50px; font-size: 15.5px; }
.btn:disabled { background: #dcdaea; color: #fff; box-shadow: none; cursor: default; }
.btn.petit { width: auto; min-height: 44px; padding: 0 16px; font-size: 13px; border-radius: 22px; background: var(--lav-soft); color: var(--violet); }

.champ { width: 100%; height: 54px; padding: 0 18px; border-radius: 18px; border: 2px solid transparent; outline: none;
  background: var(--card); box-shadow: var(--sh); font-size: 16px; font-weight: 700; }
.champ:focus { border-color: var(--lav); }
.erreur { padding: 12px 14px; border-radius: 16px; background: var(--red-soft); color: #b03358; font-size: 13.5px; font-weight: 700; }
.bulle { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: 18px; background: var(--lav-soft);
  font-size: 13px; font-weight: 600; line-height: 19px; color: #4a4480; text-wrap: pretty; }

.hero { padding: 18px; border-radius: 26px; background: var(--grad); box-shadow: var(--sh-btn); color: #fff; }
.hero.calme { background: var(--teal-soft); box-shadow: var(--sh); color: #1f4e55; }
.hero h2 { margin: 0; font-size: 21px; line-height: 26px; font-weight: 800; }
.hero p { margin: 2px 0 0; font-size: 13.5px; font-weight: 700; opacity: 0.85; }

.tuiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tuile { display: flex; align-items: center; gap: 12px; height: 76px; padding: 0 14px; border-radius: 20px; text-align: left; }
.tuile .icone, .icone-boite { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 14px; background: var(--lav-soft); color: var(--violet); flex-shrink: 0; }
.tuile .n { font-size: 22px; font-weight: 800; line-height: 24px; }
.tuile .lib { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tuile.vide .n { color: #c4c2da; }

.ligne { display: flex; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--line); }
.ligne:last-child { border-bottom: 0; }
.ligne .t { font-size: 14.5px; font-weight: 800; }
.ligne .s { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.etat-ok { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--green); }
.etat-ok::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--green); }

.barre { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.barre > i { display: block; height: 100%; border-radius: 4px; background: var(--grad); }
.barre.claire { background: rgba(255, 255, 255, 0.28); }
.barre.claire > i { background: #fff; }

.nav { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 12px 10px 0; display: flex; align-items: flex-start;
  justify-content: space-around; background: var(--card); border-radius: 30px 30px 0 0; box-shadow: 0 -8px 24px rgba(108, 100, 170, 0.12); }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; min-height: 48px;
  font-size: 11px; font-weight: 600; color: var(--muted); }
.nav button.actif { color: var(--violet); font-weight: 800; }
.nav .micro { width: 64px; height: 64px; margin-top: -34px; border-radius: 32px; background: var(--grad); color: #fff;
  box-shadow: var(--sh-btn); border: 5px solid var(--bg); justify-content: center; }

.voile { position: fixed; inset: 0; z-index: 10; background: rgba(39, 38, 74, 0.35); display: flex; align-items: flex-end; justify-content: center; }
.feuille { width: 100%; max-width: 480px; max-height: 88%; overflow-y: auto; padding: 22px 20px calc(env(safe-area-inset-bottom) + 24px);
  border-radius: 30px 30px 0 0; background: var(--bg); }
.niche { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left; border-radius: 24px; }
.niche.choisie { outline: 2.5px solid var(--violet); outline-offset: -2.5px; }
.avatar { width: 56px; height: 56px; border-radius: 20px; font-size: 17px; }
.tirets { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 60px; border-radius: 24px;
  border: 2px dashed #cfcbea; color: var(--violet); font-size: 14.5px; font-weight: 800; }

/* ── Enregistrer : file et prompteur ─────────────────────────────────────── */
.prise { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 10px 14px; border-radius: 20px; }
.prise .rang { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 15px;
  background: var(--lav-soft); color: var(--violet); font-size: 13px; font-weight: 800; flex-shrink: 0; }
.zone-texte { width: 100%; min-height: 220px; padding: 16px 18px; border-radius: 18px; border: 2px solid transparent; outline: none; resize: vertical;
  background: var(--card); box-shadow: var(--sh); font: inherit; font-size: 15px; font-weight: 600; line-height: 22px; }
.zone-texte:focus { border-color: var(--lav); }

.prompteur { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; color: #fff;
  background: linear-gradient(180deg, #1c1838 0%, #2b2359 100%);
  padding: calc(env(safe-area-inset-top) + 16px) 22px calc(env(safe-area-inset-bottom) + 22px); }
.prompteur .haut { display: flex; align-items: center; justify-content: space-between; min-height: 44px; flex-shrink: 0; }
.prompteur .fermer { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 22px; background: rgba(255, 255, 255, 0.1); }
.prompteur .chrono { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 16px; background: rgba(224, 86, 122, 0.18);
  font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.prompteur .chrono i { width: 8px; height: 8px; border-radius: 4px; background: #ff6b8e; }
.prompteur .chrono.en-pause i { background: #f6c46b; }
.prompteur .segments { display: flex; gap: 6px; margin-top: 12px; flex-shrink: 0; }
.prompteur .segments span { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.prompteur .segments span.fait { background: linear-gradient(90deg, #a79bff, #6fd3d0); }
.prompteur .segments span.courant { background: #a79bff; }
.prompteur .etat { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-top: 12px; flex-shrink: 0;
  font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, 0.7); }
.prompteur .jauge { display: flex; align-items: center; gap: 3px; }
.prompteur .jauge span { width: 4px; height: 12px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.prompteur .jauge span.on { background: #6fd3d0; }
.prompteur .jauge span.fort { background: #ff6b8e; }
.prompteur .local { color: #7fe0b5; display: flex; align-items: center; gap: 5px; }

/* le texte : défilement LIBRE au doigt (natif, avec inertie), aucune vitesse imposée */
.prompteur .texte { position: relative; flex: 1; min-height: 0; margin-top: 8px; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 0 6px 60vh 0;
  mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 72%, transparent 100%); }
.prompteur .texte::-webkit-scrollbar { display: none; }
.prompteur .phrase { margin: 0 0 22px; font-size: 27px; font-weight: 800; line-height: 38px; text-wrap: pretty; color: rgba(255, 255, 255, 0.34); transition: color 0.2s; }
.prompteur .phrase.courante { color: #fff; }
.prompteur .phrase.pause { font-size: 18px; line-height: 24px; color: rgba(185, 176, 255, 0.7); }
.prompteur .phrase.fin-paragraphe { margin-bottom: 52px; }
.prompteur .silence { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.prompteur .silence b { font-size: 72px; font-weight: 800; line-height: 1; }
.prompteur .aide { margin: 10px 0 16px; text-align: center; font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.6); flex-shrink: 0; }
.prompteur .commandes { display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; }
.prompteur .cmd, .prompteur .central { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.prompteur .cmd { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; font-size: 12.5px; font-weight: 800; color: rgba(255, 255, 255, 0.7); }
.prompteur .cmd > span { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 32px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.14); color: #fff; }
.prompteur .cmd.reprends { color: #f6c46b; }
.prompteur .cmd.reprends > span { background: rgba(246, 196, 107, 0.16); border-color: rgba(246, 196, 107, 0.55); color: #f6c46b; }
.prompteur .cmd.reprends.flash > span { background: rgba(246, 196, 107, 0.5); }
.prompteur .central { display: flex; align-items: center; justify-content: center; width: 88px; height: 88px; border-radius: 44px; color: #fff;
  background: var(--grad); box-shadow: 0 0 0 8px rgba(167, 155, 255, 0.18), 0 14px 30px rgba(107, 92, 230, 0.5); }

/* ── Affiliés ────────────────────────────────────────────────────────────── */
.compteurs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.compteur { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 70px; border-radius: 18px; }
.compteur b { font-size: 21px; font-weight: 800; }
.compteur span { font-size: 11px; font-weight: 700; opacity: 0.85; }
.puce.ambre { background: var(--amber-soft); color: var(--amber); }
.puce.rouge { background: var(--red-soft); color: var(--red); }
.bascule { display: flex; align-items: center; width: 50px; height: 30px; padding: 3px; border-radius: 15px; background: #d9d8e6; flex-shrink: 0; }
.bascule.on { background: var(--green); justify-content: flex-end; }
.bascule i { width: 24px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 2px 5px rgba(39, 38, 74, 0.25); }
.lettre { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 14px; background: var(--lav-soft); font-size: 16px; font-weight: 800; flex-shrink: 0; }

/* ── Prompteur : consignes du test du nettoyeur (à ne pas lire à voix haute) ── */
.prompteur .phrase.consigne, .prompteur .phrase.consigne.courante { font-size: 16px; line-height: 23px; font-weight: 700; color: #f6c46b;
  padding: 10px 14px; border-radius: 14px; background: rgba(246, 196, 107, 0.12); border: 1px solid rgba(246, 196, 107, 0.35); }

/* ── Écoute ──────────────────────────────────────────────────────────────── */
.tuile:disabled { cursor: default; }
.onde { display: flex; align-items: center; height: 10px; border-radius: 5px; background: #e6e4f3; overflow: hidden; position: relative; }
.onde > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--grad); }
.onde > b { position: absolute; top: 0; bottom: 0; width: 3px; background: #f3b6c6; }
.coupe { display: flex; align-items: center; gap: 10px; min-height: 66px; padding: 8px 12px; border-radius: 20px; }
.coupe .jouer { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 20px; background: var(--lav-soft); color: var(--violet); flex-shrink: 0; }
.coupe .quoi { font-size: 12px; font-weight: 800; color: var(--violet); }
.coupe.doute .quoi { color: var(--amber); }
.coupe .dit { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coupe.annulee .dit { color: var(--muted); }
.coupe .retire { color: var(--red); text-decoration: line-through; }
.lien-brut { font-size: 12px; font-weight: 800; color: var(--muted); padding: 6px 2px; }
.barre-actions { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; gap: 12px;
  padding: 16px 20px calc(env(safe-area-inset-bottom) + 22px); background: linear-gradient(180deg, rgba(242, 241, 249, 0) 0%, var(--bg) 30%); }
