:root {
  color-scheme: dark;
  --fond: #0f0f12;
  --surface: #1a1a20;
  --bordure: #33333d;
  --texte: #f5f2ea;
  --muet: #9c988d;
  --accent: #ffb703;
  --danger: #e5484d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100dvh; }

.ecran {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  max-width: 32rem;
  margin: 0 auto;
}

h1 { font-size: 1.7rem; margin: 0; }
.surtitre { color: var(--muet); margin: 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; }
.muted { color: var(--muet); margin: 0; }
.petit { font-size: 0.85rem; }
.centre { text-align: center; }
.erreur { color: var(--danger); font-size: 0.9rem; margin: 0; }
.bloc { display: block; padding: 24px; }

a { color: var(--accent); }

form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
label { font-weight: 600; }

input {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 14px;
  color: var(--texte);
  font-size: 1.05rem;
  padding: 14px 16px;
  width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.cta {
  background: var(--accent);
  border: none;
  border-radius: 999px;
  color: #1a1400;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 24px;
}
.cta[disabled] { opacity: 0.45; cursor: default; }
.cta.secondaire { background: transparent; border: 1px solid var(--bordure); color: var(--texte); }

/* --- Viseur plein écran --- */

.viseur {
  position: fixed;
  inset: 0;
  max-width: none;
  padding: 0;
  justify-content: space-between;
  background: #000;
  overflow: hidden;
}

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eclair {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease-out;
}
.eclair.actif { opacity: 1; transition: none; }

.barre-haut,
.barre-bas {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 16px;
}
.barre-haut {
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  align-items: flex-start;
  justify-content: space-between;
}
.barre-bas {
  flex-direction: column;
  align-items: center;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
}

.compteur {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 14px;
  padding: 8px 14px;
}
.compteur strong { color: var(--accent); display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.compteur span { font-size: 0.75rem; }

.pastille {
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: 999px;
  color: var(--texte);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 16px;
}

.declencheur {
  align-items: center;
  background: transparent;
  border: 4px solid var(--texte);
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  height: 84px;
  justify-content: center;
  padding: 0;
  width: 84px;
}
.declencheur span {
  background: var(--texte);
  border-radius: 999px;
  height: 64px;
  width: 64px;
}
.declencheur:active span { transform: scale(0.94); }
.declencheur[disabled] { opacity: 0.35; cursor: default; }

.compte-a-rebours {
  color: var(--accent);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin: 8px 0 0;
}

/* --- Galerie --- */

#ecran-galerie { justify-content: flex-start; }

.grille {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.vignette {
  background: var(--surface);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  position: relative;
  aspect-ratio: 1;
}
.vignette img { height: 100%; object-fit: cover; width: 100%; display: block; }
.vignette figcaption {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  bottom: 0;
  color: var(--texte);
  font-size: 0.7rem;
  left: 0;
  padding: 14px 6px 4px;
  position: absolute;
  right: 0;
  text-align: left;
}

.apercu {
  align-items: center;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 10;
}
.apercu img,
.apercu video { max-height: 85dvh; max-width: 100%; object-fit: contain; }
.apercu p { color: var(--muet); font-size: 0.85rem; }

.badge-video {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  color: var(--texte);
  font-size: 0.7rem;
  left: 6px;
  padding: 2px 8px;
  position: absolute;
  top: 6px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.message {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 14px;
  padding: 14px 16px;
}
.message h2 { color: var(--accent); font-size: 0.85rem; margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.message p { margin: 0; }
.message p + p { margin-top: 8px; }

[hidden] { display: none !important; }
