:root {
  --fond: #f3f5f8;
  --carte: #ffffff;
  --texte: #1c2430;
  --discret: #6b7685;
  --bordure: #dde2e9;
  --entete: #0b2f5e;
  --principal: #1556a8;
  --principal-texte: #ffffff;
  --succes: #15803d;
  --danger: #b91c1c;
  --rayon: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #11161d;
    --carte: #1b232e;
    --texte: #e8edf3;
    --discret: #98a3b3;
    --bordure: #2c3644;
    --entete: #0b1016;
    --principal: #3b82f6;
    --succes: #22a35a;
    --danger: #ef4444;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

.entete {
  background: var(--entete);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.logo { height: 40px; width: auto; align-self: flex-start; display: block; }
.entete .sous-titre { color: #f7a43a; opacity: 1; font-weight: 600; }
.sous-titre { font-size: 13px; opacity: .7; }

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}
.ecran { display: flex; flex-direction: column; gap: 14px; }

.carte {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 16px;
}
.boite-courante { text-align: center; }
.boite-titre { font-size: 30px; font-weight: 800; }
.discret { color: var(--discret); font-size: 14px; }
.centre { text-align: center; }
.aide { color: var(--discret); font-size: 15px; line-height: 1.45; margin: 0; }

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--rayon);
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  user-select: none;
  width: 100%;
  display: block;
}
.btn.grand { padding: 22px 16px; font-size: 20px; }
.btn.principal { background: var(--principal); color: var(--principal-texte); }
.btn.secondaire { background: var(--carte); color: var(--texte); border: 1px solid var(--bordure); }
.btn.succes { background: var(--succes); color: #fff; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }

.rangee { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.lien {
  background: none; border: 0; padding: 8px; font-size: 14px;
  color: var(--discret); text-decoration: underline; cursor: pointer;
}
.lien.danger { color: var(--danger); }

.vignettes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.vignettes:empty { display: none; }
.vignette {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bordure);
}
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette button {
  position: absolute; top: 4px; right: 4px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.65); color: #fff;
  font-size: 16px; line-height: 30px; padding: 0; cursor: pointer;
}

.precedentes { text-align: center; }

.resume-total { font-size: 22px; font-weight: 700; text-align: center; }
.resume-liste { list-style: none; padding: 0; margin: 10px 0 0; }
.resume-liste li {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-top: 1px solid var(--bordure);
}

.video-cadre {
  position: relative;
  border-radius: var(--rayon);
  overflow: hidden;
  background: #000;
  aspect-ratio: 3 / 4;
}
.video-cadre video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viseur {
  position: absolute; inset: 18%;
  border: 3px solid rgba(255,255,255,.85);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
}

progress { width: 100%; height: 16px; accent-color: var(--principal); }

.erreur {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--rayon);
  padding: 12px 14px;
  font-size: 15px;
}

.gros-check {
  width: 72px; height: 72px; margin: 4px auto 10px;
  border-radius: 50%; background: var(--succes); color: #fff;
  font-size: 40px; line-height: 72px; font-weight: 700;
}

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #111; color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; max-width: 90vw; text-align: center;
}

/* Aide à l'installation */
.installer { border: 2px solid var(--principal); display: flex; flex-direction: column; gap: 10px; }
.installer-titre { font-weight: 700; font-size: 18px; }
.etapes { margin: 0; padding-left: 22px; line-height: 1.6; font-size: 16px; }
.aide.petit { font-size: 13px; }
.ico-partager { display: inline-block; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 4px; font-size: 13px; }
.installer .lien { align-self: center; }
