/* Page invité : téléphone d'abord. */
.ecran { max-width: 520px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); min-height: 100dvh; }

/* --- Accueil : l'affiche --- */
.affiche { position: relative; text-align: center; padding: 28px 0 8px; font-family: var(--titre); line-height: .86; user-select: none; }
.affiche-nom { color: var(--vif); font-size: min(34vw, 170px); letter-spacing: .01em; }
.affiche-ligne { display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.affiche-turns { color: var(--moyen); font-size: min(19vw, 96px); }
.affiche-18 { color: var(--vif); font-size: min(26vw, 130px); }
.affiche-script {
  position: absolute; left: 0; right: 0; top: 46%; transform: rotate(-6deg);
  font-size: min(10vw, 50px); color: var(--encre); line-height: 1;
}
.champ-nom { display: block; margin: 22px 0 18px; }
.champ-nom-haut { display: flex; align-items: flex-end; justify-content: space-between; margin: 0 4px 6px 6px; }
.champ-nom-haut label { font-size: 1.6rem; }

/* La petite tête d'Irina qui parle */
.irina { position: relative; }
.irina-tete {
  display: block; width: 72px; height: 72px; padding: 0; border-radius: 50%; background: #fff; border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(60,10,30,.25); animation: irina-appel 1.6s ease-out infinite; overflow: visible;
}
.irina-tete img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.irina-tete.deja { animation-duration: 4s; }
.irina-tete.parle { animation: irina-parle .5s ease-in-out infinite alternate; }
@keyframes irina-appel {
  0% { box-shadow: 0 4px 12px rgba(60,10,30,.25), 0 0 0 0 rgba(255,255,255,.95); }
  70%, 100% { box-shadow: 0 4px 12px rgba(60,10,30,.25), 0 0 0 14px rgba(255,255,255,0); }
}
@keyframes irina-parle { from { transform: rotate(-4deg) scale(1.04); } to { transform: rotate(3deg) scale(1.04); } }
.irina-bulle {
  position: absolute; right: 0; bottom: calc(100% + 12px); z-index: 4; width: min(270px, calc(100vw - 48px));
  background: #fff; color: var(--encre); border-radius: 18px 18px 4px 18px; padding: 12px 14px; font-size: 1rem; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(60,10,30,.2); transform-origin: bottom right; animation: irina-bulle .22s ease-out;
}
.irina-bulle::after { content: ""; position: absolute; right: 26px; bottom: -9px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; }
.irina-bulle button { display: block; margin: 10px 0 0 auto; }
@keyframes irina-bulle { from { transform: scale(.6); opacity: 0; } }
.gros-boutons { display: grid; gap: 14px; }
.gros { font-size: min(1.2rem, 4.6vw); white-space: nowrap; padding: 22px 16px; border-radius: var(--rayon); box-shadow: 0 8px 22px rgba(254, 48, 172, .25); }
.gros .icone { font-size: 1.6rem; }
.gros:active { transform: scale(.98); }
.lien { display: block; margin: 18px auto 0; background: none; color: var(--vif); text-decoration: underline; padding: 8px; }
.signature { text-align: center; color: var(--vif); font-size: 1.35rem; font-weight: 700; margin: 26px 0 0; }

/* --- Aperçu --- */
#ecran-apercu { display: flex; flex-direction: column; padding-top: 12px; }
.apercu-haut { text-align: center; margin-bottom: 10px; }
.pastille { display: inline-block; background: var(--blanc); border-radius: 999px; padding: 4px 14px; font-weight: 700; }
.apercu-media { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.apercu-media img, .apercu-media video {
  max-width: 100%; max-height: calc(100dvh - 250px); border-radius: 12px; background: #fff;
  border: 10px solid #fff; border-bottom-width: 34px; box-shadow: 0 10px 30px rgba(0,0,0,.18); transform: rotate(-1.5deg);
}
.apercu-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.apercu-actions button { padding: 14px 8px; white-space: nowrap; }
.apercu-actions #bouton-valider { grid-column: 1 / -1; font-size: 1.2rem; padding: 18px; }

/* --- Galerie --- */
.barre-haut { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 0 4px; }
.barre-haut h1 { margin: 0; font-size: 2rem; color: var(--vif); font-weight: 700; }
.barre-haut > :first-child { justify-self: start; }
.barre-haut > :last-child { justify-self: end; }
.petit { padding: 8px 14px; font-size: .9rem; }
.aide { text-align: center; margin: 4px 0 14px; }
.galerie { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-bottom: 100px; }
.tuile { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #fff; cursor: pointer; }
.tuile img, .tuile video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s, opacity .15s; }
.tuile .coche {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--vif); color: #fff; display: grid; place-items: center; font-size: .9rem; font-weight: 800;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.tuile.non-choisie .coche { background: rgba(255,255,255,.75); color: transparent; }
.tuile.non-choisie img, .tuile.non-choisie video { opacity: .45; transform: scale(.92); }
.tuile .info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: .72rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); font-weight: 600;
}
.tuile.bloquee { cursor: not-allowed; }
.tuile.bloquee .coche { display: none; }
.tuile .sans-apercu, .case .sans-apercu { width: 100%; height: 100%; display: grid; place-items: center; font-size: 2rem; background: var(--blanc); }
.tuile .supprimer {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; padding: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
}
.barre-bas {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--pale) 35%); display: flex; justify-content: center;
}
.envoyer { width: 100%; max-width: 488px; font-size: 1.2rem; padding: 18px; box-shadow: 0 8px 22px rgba(254, 48, 172, .35); }

/* --- Envoi : le mini-mur et l'envol des photos --- */
#ecran-envoi { padding: 0; max-width: none; display: flex; flex-direction: column; overflow: hidden; }
.mini-mur {
  position: relative; height: 46dvh; background: #e9a7bd url("briques.jpg") center / cover;
  box-shadow: inset 0 -12px 24px rgba(0,0,0,.12);
}
.envol { position: relative; flex: 1; }
.volante {
  position: fixed; z-index: 5; background: #fff; padding: 5px 5px 16px; border-radius: 3px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: transform 1.1s cubic-bezier(.3, .1, .2, 1), box-shadow 1.1s;
  will-change: transform;
}
.volante img, .volante .sans-apercu { width: 100%; height: 100%; object-fit: cover; display: block; }
.volante .sans-apercu { display: grid; place-items: center; font-size: 1.6rem; background: var(--blanc); }
.volante.attend { animation: flotte 1.4s ease-in-out infinite alternate; }
.volante.posee { box-shadow: 0 3px 8px rgba(0,0,0,.28); }
.volante.posee::before {
  content: ""; position: absolute; top: -5px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff9bd5, var(--vif) 55%, #a0106a); box-shadow: 0 2px 3px rgba(0,0,0,.4);
  animation: punaise .35s ease-out;
}
.volante.partie { opacity: 0; transition: transform 1.2s ease-in, opacity 1.2s ease-in; }
.volante.echec { outline: 3px solid var(--erreur); }
@keyframes flotte { from { translate: 0 0; } to { translate: 0 -8px; } }
@keyframes punaise { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.envoi-bas { padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); text-align: center; display: grid; gap: 10px; }
.envoi-etat { font-family: var(--script); font-weight: 700; font-size: 2rem; color: var(--vif); margin: 0; }
.envoi-bas p { margin: 0; }
.jauge { height: 10px; border-radius: 99px; background: var(--blanc); overflow: hidden; }
.jauge-remplie { height: 100%; width: 0; background: var(--vif); transition: width .3s; }

/* --- Fenêtre de confirmation et messages --- */
.voile { position: fixed; inset: 0; background: rgba(28, 18, 24, .45); display: grid; place-items: center; padding: 20px; z-index: 10; }
.boite { background: var(--pale); border-radius: var(--rayon); padding: 24px 20px 18px; width: 100%; max-width: 360px; text-align: center; }
.boite-texte { font-family: var(--script); font-weight: 700; font-size: 1.8rem; margin: 0 0 18px; line-height: 1.2; }
/* Bouton secondaire bien foncé : on voit tout de suite qu'il est cliquable */
.fonce { background: #c4127f; color: #fff; }
.boite-nom { margin: -6px 0 16px; }
.boite-nom p { margin: 0 0 10px; }
.boite-nom input { width: 100%; box-sizing: border-box; text-align: center; }
/* Quand on propose le prénom, les deux boutons s'empilent (« Envoyer en anonyme » est long) */
.avec-nom .boite-actions { grid-template-columns: 1fr; }
.avec-nom #confirmation-oui { order: -1; }
.boite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: var(--encre); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: .95rem; max-width: 90vw; text-align: center;
}

/* --- Accueil : le lien vers la galerie --- */
.lien-galerie {
  display: block; width: 100%; margin: 14px 0 0; padding: 16px; font-size: 1.05rem;
  background: transparent; color: var(--vif); border: 2.5px solid var(--vif);
}

/* --- 5. La galerie : comme la galerie photo du téléphone --- */
#ecran-envoyes { max-width: 820px; padding: 0 0 calc(90px + env(safe-area-inset-bottom)); --colonnes: 4; }
.galerie-haut {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 10px 12px; background: color-mix(in srgb, var(--pale) 92%, transparent); backdrop-filter: blur(8px);
}
.galerie-haut h1 { margin: 0; font-size: 1.7rem; color: var(--vif); white-space: nowrap; }
.galerie-haut > :first-child { justify-self: start; }
.galerie-haut > :last-child { justify-self: end; }
.galerie-section { margin-top: 10px; }
.section-titre { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.section-titre h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.compte { color: var(--doux); font-weight: 600; font-size: .9rem; }
.groupe-nom { padding: 14px 12px 6px; font-family: var(--script); font-weight: 700; font-size: 1.5rem; color: #c4127f; }
.groupe-jour { padding: 14px 12px 6px; font-weight: 800; font-size: .95rem; text-transform: capitalize; }
.groupe-nom small { font-family: inherit; font-size: .9rem; color: var(--doux); margin-left: 6px; }

/* Boutons groupés (taille, tri) */
.segments { display: inline-flex; background: var(--blanc); border-radius: 999px; padding: 3px; gap: 2px; }
.segments button { padding: 6px 10px; font-size: .82rem; border-radius: 999px; background: transparent; color: var(--encre); }
.segments button.actif { background: var(--vif); color: #fff; }
.segments svg { display: block; width: 18px; height: 18px; fill: currentColor; }

/* La mosaïque : carrés serrés, bord à bord, comme sur un téléphone */
.mosaique { display: grid; grid-template-columns: repeat(var(--colonnes), 1fr); gap: 2px; }
.case {
  position: relative; aspect-ratio: 1; overflow: hidden; background: #f1c9d3; cursor: pointer;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.case img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; pointer-events: none; }
.case .duree { position: absolute; right: 5px; bottom: 4px; color: #fff; font-size: .72rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.case .heure { position: absolute; left: 5px; bottom: 4px; color: #fff; font-size: .7rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.case .rond {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
  background: rgba(0,0,0,.25); box-shadow: 0 1px 3px rgba(0,0,0,.35); display: none; place-items: center; color: #fff; font-size: .8rem; font-weight: 800;
}
.selection .case .rond { display: grid; }
.case.choisie .rond { background: var(--vif); }
.case.choisie .rond::after { content: "✓"; }
.case.choisie img { transform: scale(.86); }
.case.choisie { background: #f6b3d6; }
.lien-petit { background: none; color: var(--vif); padding: 4px 6px; font-size: .9rem; font-weight: 700; }
.vide { text-align: center; padding: 10px 16px; }
.vide p { margin: 0 0 10px; color: var(--doux); }
.aide-galerie { text-align: center; font-size: .78rem; margin: 6px 12px 0; }

/* Barre de sélection (en bas) */
.barre-selection {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--blanc); box-shadow: 0 -6px 20px rgba(60,10,30,.15);
}
.barre-selection #nb-choisis { font-weight: 700; }
.actions-selection { display: flex; gap: 8px; }
.danger { background: var(--erreur); color: #fff; }

/* Plein écran */
.visionneuse { position: fixed; inset: 0; z-index: 20; background: #000; color: #fff; touch-action: none; }
.vis-scene { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .25s ease-out, opacity .25s; }
.vis-scene img, .vis-scene video { max-width: 100vw; max-height: 100dvh; object-fit: contain; display: block; }
.vis-haut, .vis-bas {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; z-index: 2;
}
.vis-haut { top: 0; padding-top: calc(12px + env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.55), transparent); font-size: .9rem; }
.vis-bas { bottom: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.6)); }
#vis-nom { font-size: 1.8rem; }
#vis-heure { font-size: .9rem; opacity: .85; text-align: right; }
.vis-scene img { transform-origin: center; will-change: transform; }
.visionneuse.zoomee .vis-bas, .visionneuse.zoomee .vis-haut span { opacity: 0; transition: opacity .2s; }
.vis-boutons { display: flex; gap: 10px; }
#vis-telecharger svg { width: 22px; height: 22px; display: block; margin: auto; }
#vis-telecharger, #vis-fermer { background: rgba(255,255,255,.15); color: #fff; width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.vis-fleche { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; background: rgba(255,255,255,.12); color: #fff;
  width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 1.8rem; line-height: 1; }
.vis-fleche.gauche { left: 10px; } .vis-fleche.droite { right: 10px; }
@media (hover: none) { .vis-fleche { display: none; } }
.ouverte-visionneuse { overflow: hidden; }

/* Accueil : rappel des envois pas encore partis */
.bandeau-reserve {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 12px 14px;
  background: var(--blanc); border: 2.5px solid var(--vif); border-radius: 18px; font-weight: 700; font-size: .95rem;
}
.bandeau-reserve button { white-space: nowrap; }
.arreter { display: block; margin: 10px auto 0; background: transparent; color: var(--doux); text-decoration: underline; }

/* Fenêtre « Installer l'appli » */
.installer-icone { border-radius: 16px; box-shadow: 0 4px 14px rgba(60,10,30,.15); margin-bottom: 8px; }
.installer-texte { margin: -8px 0 18px; }
.etapes-ios { text-align: left; margin: 0 0 16px; padding-left: 22px; line-height: 1.6; font-size: 1rem; }
#installer-non.cache + #installer-oui { grid-column: 1 / -1; }
