/* ==========================================================================
   Kit PWA — styles du bouton « Installer l'app » et de l'aide illustrée.
   Adapter seulement les 5 couleurs ci-dessous (ou les relier aux variables du site).
   Aucune image ni police externe ; compatible CSP style-src 'self'.
   ========================================================================== */
:root {
  /* Reliées aux variables de style.css (clair et sombre déjà gérés). */
  --pwa-fond: var(--field);   /* fond discret (bouton de fermeture) */
  --pwa-carte: var(--panel);  /* fond du bouton et de la fenêtre */
  --pwa-encre: var(--ink);    /* texte */
  --pwa-doux: var(--muted);   /* texte secondaire */
  --pwa-trait: var(--line);   /* bordure du bouton */
}

.installer {
  font: inherit; font-size: .9rem; font-weight: 500; color: var(--pwa-encre); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; flex: none;
  min-height: 2.5rem; padding: .3rem .85rem .3rem .65rem; border-radius: 999px;
  background: var(--pwa-carte); border: 1px solid var(--pwa-trait);
}
.installer:hover { border-color: var(--pwa-encre); }
.installer svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.aide-installer {
  width: min(26rem, calc(100% - 1.5rem)); max-width: none; padding: 0; border: 0; border-radius: 20px; overflow: visible;
  background: var(--pwa-carte); color: var(--pwa-encre); box-shadow: 0 12px 40px rgba(30, 20, 10, .25);
}
.aide-installer::backdrop { background: rgba(27, 23, 20, .5); }
.aide-contenu { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; padding: 1.25rem 1.25rem .9rem; border-radius: inherit; }
.aide-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; margin: 0 0 .85rem; }
.aide-installer h2 { font-size: 1.25rem; margin: .2rem 0 0; }
.aide-fermer {
  flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; margin: -.25rem -.35rem 0 0; padding: 0;
  border: 0; border-radius: 50%; background: var(--pwa-fond); color: var(--pwa-encre); cursor: pointer;
}
.aide-fermer svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.aide-installer h2:focus { outline: none; }
.aide-etapes { margin: 0; padding: 0; list-style: none; counter-reset: etape; display: grid; gap: .8rem; }
.aide-etapes li { counter-increment: etape; position: relative; padding-left: 2.3rem; }
.aide-etapes li::before {
  content: counter(etape); position: absolute; left: 0; top: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem; background: var(--pwa-encre); color: var(--pwa-carte);
}
.aide-texte { margin: 0; line-height: 1.45; }
.aide-doux { color: var(--pwa-doux); }
.aide-precision { margin: .2rem 0 0; font-size: .88rem; line-height: 1.4; color: var(--pwa-doux); }
.aide-note { margin: .85rem 0 0; font-size: .9rem; line-height: 1.45; color: var(--pwa-doux); }
.aide-icone { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -.25em; fill: none; stroke: var(--pwa-encre); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Mini-maquettes de Safari : gris neutres façon iOS, le bouton à toucher entouré en bleu. */
.maquette {
  --m-fond: #F2F2F4; --m-objet: #FFFFFF; --m-encre: #1C1C1E; --m-gris: #8E8E93; --m-bleu: #0A84FF;
  margin-top: .45rem; max-width: 17rem; font-size: .8rem; line-height: 1.2; color: var(--m-encre);
  background: var(--m-fond); border-radius: 14px; padding: .35rem;
}
.m-ico { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.m-barre { display: flex; align-items: center; gap: .4rem; }
.m-barre.m-icones { justify-content: space-around; padding: .55rem .45rem; color: var(--m-bleu); }
.m-rond { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--m-objet); flex: none; }
.m-adresse { flex: 1; min-width: 0; display: flex; align-items: center; gap: .35rem; height: 2.1rem; padding: 0 .55rem 0 .3rem; border-radius: 999px; background: var(--m-objet); }
.m-url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.m-cible {
  display: inline-grid; place-items: center; min-width: 1.75rem; height: 1.75rem; padding: 0 .3rem; border-radius: 999px; flex: none;
  color: var(--m-bleu); font-weight: 600; box-shadow: 0 0 0 2.5px var(--m-bleu); background: color-mix(in srgb, var(--m-bleu) 12%, var(--m-objet));
}
.m-icones .m-cible { background: var(--m-objet); }
.m-liste { display: grid; gap: .3rem; }
.m-ligne { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 1.9rem; padding: .25rem .7rem; border-radius: 10px; background: var(--m-objet); }
.m-flou { opacity: .55; }
.m-trait { width: 55%; height: .45rem; border-radius: 4px; background: #D1D1D6; }
.m-carre { width: .95rem; height: .95rem; border-radius: 4px; background: #D1D1D6; }
.m-choix { font-weight: 600; box-shadow: 0 0 0 2.5px var(--m-bleu); }
.m-entete { background: none; padding: .15rem .25rem; }
.m-gris { color: var(--m-bleu); opacity: .6; }
.m-interrupteur { width: 2.1rem; height: 1.25rem; border-radius: 999px; background: #34C759; position: relative; flex: none; }
.m-interrupteur::after { content: ""; position: absolute; right: .12rem; top: .12rem; width: 1rem; height: 1rem; border-radius: 50%; background: #fff; }
@media (prefers-color-scheme: dark) {
  .aide-installer { box-shadow: 0 0 0 1px var(--pwa-trait); }
  .maquette { --m-fond: #2C2C2E; --m-objet: #3A3A3C; --m-encre: #F2F2F7; --m-gris: #98989F; }
  .m-trait, .m-carre { background: #545458; }
}

/* iPhone + Safari : fenêtre en bas, flèche vers la barre de Safari. */
.aide-installer.aide-bas { margin: auto auto 3.2rem; }
.aide-bas .aide-contenu { max-height: calc(100dvh - 4.5rem); }
.aide-fleche { position: fixed; bottom: .35rem; width: 2.6rem; height: 2.6rem; color: #fff; transform: translateX(-50%); }
.aide-fleche svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.vers-menu .aide-fleche { left: 26.5%; }
.vers-partager .aide-fleche { left: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .aide-fleche { animation: aide-rebond 1.1s ease-in-out infinite; }
  @keyframes aide-rebond { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, .45rem); } }
}
/* Bouton flottant (si CONFIG.emplacement est introuvable) */
.installer-flottant {
  position: fixed; z-index: 20; left: max(1rem, env(safe-area-inset-left)); bottom: max(1rem, env(safe-area-inset-bottom));
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}

/* Mobile : bouton réduit à l'icône (le nom reste annoncé par aria-label). Retirer si la place ne manque pas. */
@media (max-width: 34rem) {
  .installer:not(.installer-flottant) { width: 2.5rem; padding: 0; gap: 0; }
  .installer:not(.installer-flottant) .installer-texte { display: none; }
}

@media print { .installer, .aide-installer { display: none !important; } }
