/* Yako - composants. Aucune couleur en dur : tout passe par tokens.css. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; height: 100%; }

body {
  margin: 0;
  height: 100%;
  background: var(--y-fond);
  color: var(--y-encre);
  font-family: var(--y-texte);
  font-size: 17px;
  line-height: 1.5;
  overflow: hidden;
}

h1, h2, h3 {
  font-family: var(--y-titre);
  font-weight: 700;
  margin: 0 0 var(--y-e3);
  overflow-wrap: anywhere;
}
h2 { font-size: 20px; line-height: 1.25; }
p { margin: 0; }
[hidden] { display: none !important; }

.y-texte-doux { color: var(--y-texte-doux); }
.y-petit { font-size: 16px; margin-top: var(--y-e3); }
.y-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Structure du chat ---------- */

.y-app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  background:
    radial-gradient(120% 50% at 50% 0%, var(--y-cyan-brume) 0%, transparent 70%),
    var(--y-fond);
}
@media (min-width: 760px) {
  body { background: var(--y-cyan-brume); }
  .y-app { border-left: 1px solid var(--y-bordure); border-right: 1px solid var(--y-bordure); }
}

.y-entete {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--y-e3);
  padding: var(--y-e3) var(--y-e4);
  padding-top: max(var(--y-e3), env(safe-area-inset-top));
  background: color-mix(in srgb, var(--y-surface) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--y-bordure);
  position: relative;
  z-index: 2;
}
.y-entete__marque { display: flex; align-items: center; gap: var(--y-e3); }
.y-entete__badges { display: flex; gap: var(--y-e2); align-items: center; justify-content: flex-end; }
#badges { display: flex; gap: var(--y-e2); flex-wrap: wrap; justify-content: flex-end; }
.y-entete__sous-titre { font-size: 14px; color: var(--y-texte-doux); line-height: 1.2; }

.y-logo { font-family: var(--y-titre); font-weight: 700; font-size: 20px; line-height: 1.2; }
.y-logo__point {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--y-cyan);
  box-shadow: 0 0 0 4px var(--y-cyan-pale);
  flex: none;
}

.y-fil {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--y-e5) var(--y-e4);
  display: flex;
  flex-direction: column;
  gap: var(--y-e3);
}

/* ---------- Messages ---------- */

.y-msg { display: flex; flex-direction: column; max-width: 100%; animation: y-apparait 200ms ease-out both; }
.y-msg--yako { align-items: flex-start; }
.y-msg--moi { align-items: flex-end; }
.y-msg--carte { width: 100%; }
.y-msg + .y-msg--moi, .y-msg--moi + .y-msg--yako { margin-top: var(--y-e2); }

.y-bulle {
  max-width: 85%;
  padding: var(--y-e3) var(--y-e4);
  border-radius: 18px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.y-msg--yako .y-bulle { background: var(--y-cyan-pale); color: var(--y-encre); border-bottom-left-radius: 6px; }
.y-msg--moi .y-bulle { background: var(--y-encre); color: var(--y-sur-encre); border-bottom-right-radius: 6px; }

.y-auteur { font-size: 13px; font-weight: 600; color: var(--y-texte-doux); margin: 0 var(--y-e2) var(--y-e1); }

/* Yako écrit… */
.y-ecrit { display: inline-flex; gap: 5px; align-items: center; min-height: 24px; }
.y-ecrit span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--y-cyan-fonce);
  animation: y-clignote 1.2s ease-in-out infinite;
}
.y-ecrit span:nth-child(2) { animation-delay: .2s; }
.y-ecrit span:nth-child(3) { animation-delay: .4s; }

/* ---------- Zone de saisie ---------- */

.y-compositeur {
  flex: none;
  padding: var(--y-e2) var(--y-e4) var(--y-e3);
  padding-bottom: max(var(--y-e3), env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--y-fond) 70%, transparent);
  display: flex;
  flex-direction: column;
  gap: var(--y-e2);
}
.y-compositeur__ligne { display: flex; align-items: flex-end; gap: var(--y-e2); }
.y-compositeur__boite {
  padding: 6px;
  background: var(--y-surface);
  border: 2px solid var(--y-bordure);
  border-radius: 30px;
  box-shadow: var(--y-ombre);
  transition: border-color .15s;
}
.y-compositeur__boite:focus-within { border-color: var(--y-cyan-fonce); }
.y-compositeur__champ {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  max-height: 160px;
  padding: 11px var(--y-e2);
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--y-encre);
  font: 400 17px/1.5 var(--y-texte);
  resize: none;
}
.y-compositeur__champ::placeholder { color: var(--y-texte-doux); }
.y-compositeur__champ:focus-visible { outline: none; }
.y-compositeur__champ:disabled { opacity: .7; }

.y-btn-rond {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid transparent;
  display: grid;
  place-items: center;
  background: var(--y-cyan);
  color: var(--y-encre);
  cursor: pointer;
  position: relative;
}
.y-btn-rond svg { width: 24px; height: 24px; }
.y-btn-rond:focus-visible { outline: 3px solid var(--y-cyan-fonce); outline-offset: 2px; }
.y-btn-rond:disabled { background: var(--y-bordure); color: var(--y-texte-doux); cursor: not-allowed; }
.y-btn-rond--secondaire { background: var(--y-fond); border-color: transparent; color: var(--y-encre); }
.y-btn-rond--secondaire:hover { border-color: var(--y-bordure); }
.y-btn-rond--secondaire:disabled { background: var(--y-fond); }
.y-btn-micro--ecoute { animation: y-halo 1.4s ease-out infinite; }

.y-btn-icone {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--y-bordure);
  background: var(--y-surface);
  color: var(--y-encre);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.y-btn-icone svg { width: 22px; height: 22px; }
.y-btn-icone:focus-visible { outline: 3px solid var(--y-cyan-fonce); outline-offset: 2px; }

/* Aperçu de la photo avant envoi */
.y-apercu {
  display: flex;
  align-items: center;
  gap: var(--y-e3);
  padding: var(--y-e2);
  border: 1px solid var(--y-bordure);
  border-radius: var(--y-rayon-btn);
  background: var(--y-fond);
}
.y-apercu img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.y-apercu p { flex: 1; font-size: 15px; color: var(--y-texte-doux); }
.y-apercu .y-lien { width: auto; min-height: 44px; }

/* ---------- Écran de chargement et profil ---------- */

.y-centre { flex: 1; display: grid; place-items: center; color: var(--y-texte-doux); }

.y-profil { flex: 1; overflow-y: auto; padding: var(--y-e5) var(--y-e4) var(--y-e6); }
.y-profil__form { display: flex; flex-direction: column; gap: var(--y-e5); max-width: 520px; margin: 0 auto; }
.y-profil h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.15; margin-bottom: var(--y-e2); }

.y-groupe { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--y-e3); }
.y-ligne-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--y-e3); }

.y-champ-bloc { display: flex; flex-direction: column; gap: var(--y-e1); font-weight: 500; }
.y-champ-bloc em { font-style: normal; font-weight: 400; color: var(--y-texte-doux); }
.y-champ-bloc small { font-size: 14px; color: var(--y-texte-doux); font-weight: 400; }
.y-champ {
  width: 100%;
  min-height: 52px;
  padding: var(--y-e3) var(--y-e4);
  border: 2px solid var(--y-bordure);
  border-radius: var(--y-rayon-btn);
  background: var(--y-surface);
  color: var(--y-encre);
  font: 400 17px/1.4 var(--y-texte);
}
.y-champ::placeholder { color: var(--y-texte-doux); opacity: .7; }
.y-champ:focus-visible { outline: 3px solid var(--y-cyan-fonce); outline-offset: 1px; }

.y-case { display: flex; gap: var(--y-e3); align-items: flex-start; font-size: 16px; cursor: pointer; }
.y-case input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--y-cyan-fonce); }

/* ---------- Photo dans une bulle ---------- */

.y-bulle-photo { max-width: 220px; border-radius: 14px; display: block; margin-bottom: var(--y-e2); }

/* ---------- Écran d'appel (seule zone sombre) ---------- */

.y-appel {
  width: 100%;
  background: var(--y-encre);
  color: var(--y-sur-encre);
  border-radius: var(--y-rayon-carte);
  padding: var(--y-e4);
}
.y-appel .y-etiquette { color: var(--y-cyan-pale); }
.y-appel__liste { list-style: none; margin: var(--y-e3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--y-e2); }
.y-appel__garage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--y-e3);
  padding: var(--y-e3);
  border-radius: var(--y-rayon-btn);
  background: var(--y-encre-clair);
}
.y-appel__garage strong { display: block; overflow-wrap: anywhere; }
.y-appel__garage p { font-size: 15px; color: var(--y-sur-encre-doux); }
.y-onde { display: inline-flex; align-items: center; gap: 3px; height: 24px; }
.y-onde span { width: 4px; height: 8px; border-radius: 2px; background: var(--y-cyan); animation: y-onde 1s ease-in-out infinite; }
.y-onde span:nth-child(2) { animation-delay: .15s; }
.y-onde span:nth-child(3) { animation-delay: .3s; }
.y-onde span:nth-child(4) { animation-delay: .45s; }
.y-appel__etat { font-size: 14px; font-weight: 600; white-space: nowrap; }
.y-appel__etat--ok { color: var(--y-succes-clair); }
.y-appel__etat--ko { color: var(--y-sur-encre-doux); }

.y-btn-lien { text-decoration: none; }
.y-appel .y-petit { color: var(--y-sur-encre-doux); font-size: 15px; }

/* ---------- Étiquette de section ---------- */

.y-etiquette {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--y-cyan-fonce);
  margin-bottom: var(--y-e2);
}
.y-etiquette--espace { margin-top: var(--y-e5); }

/* ---------- Carte ---------- */

.y-carte {
  width: 100%;
  background: var(--y-surface);
  border: 1px solid var(--y-bordure);
  border-radius: var(--y-rayon-carte);
  box-shadow: var(--y-ombre);
  padding: var(--y-e4);
}
.y-carte__tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--y-e2);
  flex-wrap: wrap;
}

/* ---------- Boutons ---------- */

.y-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--y-e2);
  width: 100%;
  min-height: 52px;
  padding: var(--y-e3) var(--y-e5);
  border-radius: var(--y-rayon-btn);
  border: 2px solid transparent;
  font: 700 17px/1.2 var(--y-texte);
  cursor: pointer;
  text-align: center;
}
.y-btn:focus-visible, .y-lien:focus-visible {
  outline: 3px solid var(--y-cyan-fonce);
  outline-offset: 2px;
}
.y-btn--primaire { background: var(--y-cyan); color: var(--y-encre); }
.y-btn--primaire:hover { background: var(--y-cyan-pale); border-color: var(--y-cyan); }
.y-btn--secondaire { background: var(--y-surface); color: var(--y-encre); border-color: var(--y-bordure); }
.y-btn--secondaire:hover { border-color: var(--y-cyan-fonce); }
.y-btn:disabled { opacity: .6; cursor: progress; }

.y-lien {
  background: none;
  border: 0;
  min-height: 48px;
  padding: var(--y-e2);
  font: 500 16px var(--y-texte);
  color: var(--y-texte-doux);
  text-decoration: underline;
  cursor: pointer;
  width: 100%;
}

/* ---------- Badges ---------- */

.y-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--y-e1) var(--y-e3);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--y-cyan-pale);
  color: var(--y-encre);
}
.y-badge::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--y-cyan-fonce);
}
.y-badge--direct::before { animation: y-clignote 1.6s ease-in-out infinite; }
.y-badge--attente { background: var(--y-attente-fond); color: var(--y-attente); }
.y-badge--attente::before { background: var(--y-attente); }
.y-badge--succes { background: var(--y-succes-fond); color: var(--y-succes); }
.y-badge--succes::before { background: var(--y-succes); }
.y-badge--alerte { background: var(--y-alerte-fond); color: var(--y-alerte); }
.y-badge--alerte::before { background: var(--y-alerte); }
.y-badge--demo { background: var(--y-encre); color: var(--y-sur-encre); }
.y-badge--demo::before { background: var(--y-cyan); }
.y-badge--neutre { background: var(--y-fond); color: var(--y-texte-doux); border: 1px solid var(--y-bordure); }
.y-badge--neutre::before { background: var(--y-texte-doux); }

/* ---------- Alertes (erreur, réseau coupé) ---------- */

.y-alerte {
  display: flex;
  gap: var(--y-e3);
  align-items: flex-start;
  padding: var(--y-e2) var(--y-e4);
  border-radius: var(--y-rayon-btn);
  background: var(--y-alerte-fond);
  color: var(--y-alerte);
  font-weight: 500;
  font-size: 16px;
}
.y-alerte--reseau { background: var(--y-attente-fond); color: var(--y-attente); }
.y-alerte__icone { font-weight: 700; flex: none; }

/* ---------- Carte de mission ---------- */

.y-etapes {
  list-style: none;
  margin: var(--y-e3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.y-etape {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--y-e3);
  padding-bottom: var(--y-e3);
}
.y-etape:last-child { padding-bottom: 0; }
.y-etape:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 2px;
  width: 2px;
  background: var(--y-bordure);
}
.y-etape--fait:not(:last-child)::after { background: var(--y-cyan); }

.y-etape__pastille {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 14px var(--y-titre);
  background: var(--y-bordure);
  color: var(--y-texte-doux);
}
.y-etape__pastille svg { width: 16px; height: 16px; }
.y-etape strong { display: block; font-weight: 700; }
.y-etape p { color: var(--y-texte-doux); font-size: 16px; }
.y-etape__titre { display: flex; flex-wrap: wrap; align-items: center; gap: var(--y-e1) var(--y-e2); }

.y-etape--fait .y-etape__pastille { background: var(--y-cyan); color: var(--y-encre); }
.y-etape--vient-de-finir .y-etape__pastille svg { animation: y-coche 200ms ease-out both; }

.y-etape--en_cours .y-etape__pastille {
  background: var(--y-surface);
  color: var(--y-cyan-fonce);
  box-shadow: inset 0 0 0 3px var(--y-cyan);
  animation: y-pulse 1.6s ease-in-out infinite;
}
.y-etape--attente .y-etape__pastille { background: var(--y-attente-fond); color: var(--y-attente); box-shadow: inset 0 0 0 3px var(--y-attente-vif); }
.y-etape--echec .y-etape__pastille { background: var(--y-alerte-fond); color: var(--y-alerte); box-shadow: inset 0 0 0 3px var(--y-alerte); }
.y-etape--a_venir strong { color: var(--y-texte-doux); font-weight: 500; }

.y-note {
  display: flex;
  gap: var(--y-e2);
  padding: var(--y-e3) var(--y-e4);
  border-radius: var(--y-rayon-btn);
  background: var(--y-cyan-brume);
  color: var(--y-encre);
  font-size: 16px;
}

/* ---------- Chiffres clés ---------- */

.y-chiffres {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: var(--y-e3);
  margin: var(--y-e4) 0;
}
.y-chiffre { display: flex; flex-direction: column; min-width: 0; }
.y-chiffre__valeur {
  font: 700 clamp(20px, 5.4vw, 32px)/1.1 var(--y-titre);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.y-chiffre__legende { font-size: 14px; color: var(--y-texte-doux); }

/* ---------- Carte de confirmation ---------- */

.y-confirmation {
  border: 2px solid var(--y-attente-vif);
  animation: y-glisse 250ms ease-out both;
}
.y-confirmation h2 { margin-bottom: var(--y-e1); }
.y-confirmation--ok { border-color: var(--y-succes); }

.y-garde-fou {
  display: flex;
  gap: var(--y-e2);
  align-items: flex-start;
  padding: var(--y-e3);
  border-radius: var(--y-rayon-btn);
  background: var(--y-succes-fond);
  color: var(--y-succes);
  font-weight: 500;
  font-size: 16px;
}
.y-garde-fou--alerte { background: var(--y-alerte-fond); color: var(--y-alerte); }

.y-actions { display: flex; flex-direction: column; gap: var(--y-e3); margin-top: var(--y-e4); }

.y-autres { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--y-e3); }
.y-autre {
  border: 1px solid var(--y-bordure);
  border-radius: var(--y-rayon-btn);
  padding: var(--y-e3) var(--y-e4);
  display: flex;
  flex-direction: column;
  gap: var(--y-e2);
}
.y-autre__ligne { display: flex; justify-content: space-between; gap: var(--y-e2); flex-wrap: wrap; }
.y-autre p { color: var(--y-texte-doux); font-size: 16px; }

/* ---------- Chargement ---------- */

.y-chargement { display: flex; align-items: center; gap: var(--y-e3); }
.y-chargement::before {
  content: "";
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 3px solid var(--y-bordure);
  border-top-color: var(--y-cyan);
  animation: y-tourne 1s linear infinite;
}

/* ---------- Mouvement ---------- */

@keyframes y-pulse {
  0%, 100% { box-shadow: inset 0 0 0 3px var(--y-cyan), 0 0 0 0 var(--y-cyan-halo); }
  50% { box-shadow: inset 0 0 0 3px var(--y-cyan), 0 0 0 8px transparent; }
}
@keyframes y-clignote { 50% { opacity: .3; } }
@keyframes y-coche { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes y-glisse { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes y-apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes y-entre-gauche { from { opacity: 0; transform: translate(-10px, 6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes y-entre-droite { from { opacity: 0; transform: translate(10px, 6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes y-cligne { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes y-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes y-anneau { from { box-shadow: 0 0 0 0 var(--y-cyan-halo); } to { box-shadow: 0 0 0 10px transparent; } }
@keyframes y-onde { 0%, 100% { height: 6px; } 50% { height: 22px; } }
@keyframes y-halo { from { box-shadow: 0 0 0 0 var(--y-cyan-halo); } to { box-shadow: 0 0 0 16px transparent; } }
@keyframes y-tourne { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Mascotte ---------- */

.y-mascotte { display: block; width: 100%; height: 100%; overflow: visible; }
.y-mascotte__corps { fill: var(--y-cyan-pale); stroke: var(--y-encre); stroke-width: 2; }
.y-mascotte__yeux { fill: var(--y-encre); transform-origin: 20px 21px; transform-box: view-box; }
.y-mascotte__trait { fill: none; stroke: var(--y-encre); stroke-width: 2; stroke-linecap: round; }
.y-mascotte__antenne { fill: var(--y-cyan); stroke: var(--y-encre); stroke-width: 1.5; }

.y-logo__mascotte { width: 40px; height: 40px; flex: none; }
.y-logo__mascotte .y-mascotte__yeux { animation: y-cligne 5s ease-in-out infinite; }

/* Pendant que Yako travaille, sa mascotte cligne des yeux et son antenne pulse. */
.y-fil--actif .y-msg--avatar:last-child .y-mascotte__yeux { animation: y-cligne 2.4s ease-in-out infinite; }
.y-fil--actif .y-msg--avatar:last-child .y-avatar { animation: y-anneau 1.6s ease-out infinite; }

/* ---------- Messages avec avatar ---------- */

.y-msg--yako:not(.y-msg--heros) {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: var(--y-e2);
  align-items: end;
  animation-name: y-entre-gauche;
}
.y-msg--moi { animation-name: y-entre-droite; }
.y-msg__corps { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.y-msg--carte .y-msg__corps { align-items: stretch; }
/* Les cartes prennent toute la largeur : pas de colonne d'avatar. */
.y-msg--yako.y-msg--carte { grid-template-columns: minmax(0, 1fr); }
.y-msg--carte .y-avatar { display: none; }
.y-msg__corps .y-bulle { max-width: 92%; }
.y-avatar {
  width: 34px; height: 34px;
  padding: 3px;
  border-radius: 50%;
  background: var(--y-surface);
  border: 1px solid var(--y-bordure);
  visibility: hidden;
}
.y-msg--avatar .y-avatar { visibility: visible; }
.y-msg--yako + .y-msg--yako { margin-top: calc(var(--y-e1) * -1); }

/* ---------- Accueil (héros) ---------- */

.y-heros {
  background: var(--y-surface);
  border: 1px solid var(--y-bordure);
  border-radius: var(--y-rayon-carte);
  box-shadow: var(--y-ombre);
  padding: var(--y-e5) var(--y-e4);
  margin-top: var(--y-e2);
}
.y-heros h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.15; margin-bottom: var(--y-e2); }
.y-heros__mascotte { width: 72px; height: 72px; margin-bottom: var(--y-e3); }
.y-heros__mascotte .y-mascotte__yeux { animation: y-cligne 4s ease-in-out infinite; }

.y-puces { display: flex; flex-wrap: wrap; gap: var(--y-e2); }
.y-puce {
  min-height: 44px;
  padding: var(--y-e2) var(--y-e4);
  border-radius: 999px;
  border: 1.5px solid var(--y-bordure);
  background: var(--y-surface);
  color: var(--y-encre);
  font: 500 16px/1.2 var(--y-texte);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.y-puce:hover { border-color: var(--y-cyan-fonce); background: var(--y-cyan-brume); }
.y-puce:active { transform: scale(.97); }
.y-puce:focus-visible { outline: 3px solid var(--y-cyan-fonce); outline-offset: 2px; }
.y-puces--compactes .y-puce { min-height: 40px; font-size: 15px; padding: 6px var(--y-e3); }

/* ---------- Profil ---------- */

.y-profil__tete { display: flex; flex-direction: column; }
.y-profil__mascotte { width: 64px; height: 64px; margin-bottom: var(--y-e3); }
.y-profil__mascotte .y-mascotte__yeux { animation: y-cligne 4s ease-in-out infinite; }
.y-groupe {
  background: var(--y-surface);
  border: 1px solid var(--y-bordure);
  border-radius: var(--y-rayon-carte);
  padding: var(--y-e4);
  box-shadow: var(--y-ombre);
}
.y-groupe legend { float: left; width: 100%; padding: 0; }
.y-groupe legend + * { clear: both; }

/* ---------- Avancement de la mission ---------- */

.y-progression {
  height: 8px;
  border-radius: 999px;
  background: var(--y-bordure);
  overflow: hidden;
  margin-top: var(--y-e2);
}
.y-progression span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--y-cyan);
  transition: width .5s ease;
}
.y-progression__texte { font-size: 14px; color: var(--y-texte-doux); margin-top: var(--y-e1); }

/* ---------- Écran d'appel : initiales ---------- */

.y-appel__garage { grid-template-columns: 40px minmax(0, 1fr) auto; }
.y-appel__initiale {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 16px var(--y-titre);
  background: var(--y-encre);
  color: var(--y-sur-encre);
  border: 2px solid var(--y-sur-encre-doux);
}
.y-appel__garage--appel .y-appel__initiale { border-color: var(--y-cyan); animation: y-anneau 1.6s ease-out infinite; }
.y-appel__garage--repondu .y-appel__initiale { border-color: var(--y-succes-clair); }

/* ---------- Confirmation réussie ---------- */

.y-succes-icone {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--y-succes-fond);
  color: var(--y-succes);
  margin-bottom: var(--y-e3);
  animation: y-pop 350ms ease-out both;
}
.y-succes-icone svg { width: 30px; height: 30px; }

@media (prefers-reduced-motion: reduce) {
  .y-progression span, .y-puce, .y-compositeur__boite { transition: none; }
}

/* ---------- Onboarding ---------- */

.y-intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  max-width: 760px; margin: 0 auto;
  background:
    radial-gradient(120% 60% at 50% 0%, var(--y-cyan-pale) 0%, transparent 70%),
    var(--y-fond);
  padding-top: env(safe-area-inset-top);
  padding-bottom: max(var(--y-e5), env(safe-area-inset-bottom));
  transition: opacity .25s ease, transform .25s ease;
}
.y-intro--sortie { opacity: 0; transform: scale(1.03); }
.y-intro__passer { position: absolute; top: max(var(--y-e3), env(safe-area-inset-top)); right: var(--y-e4); z-index: 1; width: auto; padding: var(--y-e2) var(--y-e3); }

.y-intro__piste {
  flex: 1; display: flex;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.y-intro__piste::-webkit-scrollbar { display: none; }

.y-intro__slide {
  flex: 0 0 100%; scroll-snap-align: center;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
  padding: var(--y-e7) var(--y-e5) var(--y-e4);
}
.y-intro__slide h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.15; }
.y-intro__slide .y-texte-doux { max-width: 30ch; }

.y-intro__visuel {
  position: relative;
  height: 180px; width: 100%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--y-e5);
}

/* Écran 1 : la mascotte saute et dit bonjour */
.y-intro__mascotte { width: 120px; height: 120px; }
.y-intro__mascotte .y-mascotte__yeux { animation: y-cligne 3s ease-in-out infinite; }
.y-intro__slide--active .y-intro__mascotte--saute { animation: y-saute 1.8s ease-in-out infinite; }
.y-intro__bulle {
  position: absolute; top: 12px; left: calc(50% + 48px);
  background: var(--y-surface); border: 1px solid var(--y-bordure);
  border-radius: 18px 18px 18px 4px;
  padding: var(--y-e2) var(--y-e3);
  font-weight: 700; box-shadow: var(--y-ombre);
}
.y-intro__slide--active .y-intro__bulle { animation: y-pop .5s .3s both; }

/* Écran 2 : trois façons de parler à Yako */
.y-intro__icones { gap: var(--y-e4); }
.y-intro__icone {
  display: flex; flex-direction: column; align-items: center; gap: var(--y-e2);
  font-weight: 700;
}
.y-intro__icone svg {
  width: 72px; height: 72px; padding: 20px;
  border-radius: 50%;
  background: var(--y-cyan); color: var(--y-encre);
  box-shadow: var(--y-ombre);
}
.y-intro__icone small { font-size: 15px; }
.y-intro__slide--active .y-intro__icone { animation: y-pop .5s calc(var(--i) * .15s) both; }

/* Écran 3 : appel puis coche */
.y-intro__offre {
  display: flex; align-items: center; gap: var(--y-e3);
  background: var(--y-surface); border: 1px solid var(--y-bordure);
  border-radius: var(--y-rayon-carte); box-shadow: var(--y-ombre);
  padding: var(--y-e4); text-align: left; max-width: 320px;
}
.y-intro__ondes { display: flex; align-items: center; gap: 3px; height: 24px; flex: none; }
.y-intro__ondes i { width: 4px; height: 6px; border-radius: 2px; background: var(--y-cyan); }
.y-intro__slide--active .y-intro__ondes i { animation: y-onde 1s ease-in-out infinite; }
.y-intro__ondes i:nth-child(2) { animation-delay: .15s !important; }
.y-intro__ondes i:nth-child(3) { animation-delay: .3s !important; }
.y-intro__ondes i:nth-child(4) { animation-delay: .45s !important; }
.y-intro__ondes i:nth-child(5) { animation-delay: .6s !important; }
.y-intro__coche {
  width: 36px; height: 36px; flex: none; padding: 6px;
  border-radius: 50%; background: var(--y-succes-fond); color: var(--y-succes);
}
.y-intro__coche svg { width: 100%; height: 100%; display: block; }
.y-intro__slide--active .y-intro__coche { animation: y-pop .5s .8s both; }

.y-intro__bas { display: flex; flex-direction: column; align-items: center; gap: var(--y-e4); padding: 0 var(--y-e4); }
.y-intro__bas .y-btn { width: 100%; max-width: 420px; }
.y-intro__points { display: flex; gap: var(--y-e2); }
.y-intro__points span {
  width: 8px; height: 8px; border-radius: 4px;
  background: var(--y-bordure); transition: width .2s ease, background .2s ease;
}
.y-intro__points span.y-actif { width: 24px; background: var(--y-cyan-fonce); }

@keyframes y-saute {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-14px) rotate(-6deg); }
  50% { transform: translateY(0) rotate(0); }
  65% { transform: translateY(-6px) rotate(4deg); }
}

@media (max-height: 600px) {
  .y-intro__visuel { height: 120px; margin-bottom: var(--y-e3); }
  .y-intro__mascotte { width: 88px; height: 88px; }
}
