/* =========================
   VALLSERA — Mobile-First UI
   ========================= */

:root {
  --cta: #2fa4a9;
  --cta-2: #39b6bb;
  --text: #0b0f14;
  --text-soft: rgba(10,14,18,.62);
  --glass: rgba(255,255,255,.56);
  --glass-strong: rgba(255,255,255,.85);
  --glass-stroke: rgba(255,255,255,.30);
  --shadow: 0 20px 60px rgba(0,0,0,.22);
  --shadow-strong: 0 18px 50px rgba(0,0,0,.30);
  --bg-image: url("./assets/bg.jpg");
}

/* Empêche le rebond et le scroll parasite sur mobile */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh; /* Dynamic Viewport Height */
  overflow: hidden;
  background-color: #000;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  position: fixed; /* Bloque le défilement iOS */
}

/* Background qui couvre tout l'écran, placé derrière tout */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center center;
  z-index: -2;
}

/* Voile sombre pour la lisibilité */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.4) 100%);
  z-index: -1;
  pointer-events: none;
}

/* UI Principale */
#ui {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Centre la carte verticalement */
  padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom) 20px;
  box-sizing: border-box;
  transition: opacity 0.4s ease;
}

/* Logo centré en haut */
.brand-center {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 60;
  pointer-events: none;
}

.brand-center img {
  width: 55vw;
  max-width: 280px;
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
}

/* Carte Glassmorphism */
.card {
  width: 100%;
  max-width: 360px;
  background: var(--glass-strong);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--glass-stroke);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.hint {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.hint + .hint {
  border-top: 1px solid rgba(0,0,0,0.08);
}

.step {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  font-weight: 900;
}

/* Bouton Démarrer */
#startButton {
  margin-top: 20px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--cta-2), var(--cta));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: var(--shadow-strong);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#startButton:active {
  transform: scale(0.98);
}

.fineprint {
  margin-top: 12px;
  font-size: 11px;
  text-align: center;
  color: var(--text-soft);
  line-height: 1.4;
}

/* Bouton Son Flottant */
#soundButton.sound-btn {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(25px + env(safe-area-inset-bottom));
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  cursor: pointer;
}

#soundButton.sound-btn::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cta);
  box-shadow: 0 0 10px var(--cta);
}

/* Status et Canvas */
.status {
  position: fixed;
  left: 15px;
  top: calc(15px + env(safe-area-inset-top));
  padding: 6px 12px;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 10px;
  border-radius: 20px;
  z-index: 40;
}

canvas {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10;
}

/* Overlay Vidéo Plein Écran */
.fs {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fs.hidden { display: none; }

.fs-video {
  width: 100%;
  max-height: 100%;
}

.fs-close {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top));
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  z-index: 10001;
}

/* Ajustements Paysage Mobile */
@media (max-height: 500px) {
  .brand-center img { width: 120px; }
  .card { padding: 15px; max-height: 80dvh; overflow-y: auto; }
}