/* =========================================================
   Revotek - PWA Jeu Concours (Salon SPACE)
   Charte : Devil's Grass #3FAD59 - Ninja #000306 - Urbanist
   ========================================================= */

/* --- Typographie Urbanist (auto-hebergee, offline-friendly) --- */
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/Urbanist-VariableFont.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/Urbanist-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1E9F, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --brand: #3fad59;          /* Primaire - CTA, liens, mises en avant */
  --brand-dark: #329247;     /* Hover */
  --brand-tint: #e6f4ea;     /* Fond leger vert */
  --bg: #f5f4ee;             /* Fond principal */
  --bg-alt: #ffffff;         /* Cartes */
  --text: #000306;           /* Texte */
  --muted: #6c737c;          /* Texte secondaire */
  --danger: #aa0000;         /* Erreurs (Heartbeat) */
  --border: #e2e1d9;
  --radius: 8px;             /* Radius boutons */
  --shadow: 0 10px 30px rgba(0, 3, 6, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 3, 6, 0.14);
  --maxw: 640px;
  --font: "Urbanist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Empeche le zoom/selection intempestifs en mode kiosque iPad */
input, textarea, select, button { font-family: inherit; font-size: 16px; }
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------------------------------------------------------
   Ecrans (vues) - une seule visible a la fois
   --------------------------------------------------------- */
.screen { display: none; flex: 1; }
.screen.is-active { display: flex; flex-direction: column; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* ---------------------------------------------------------
   En-tete / logo
   --------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 20px 20px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 22px; letter-spacing: -0.02em;
}
.logo .leaf {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); display: grid; place-items: center;
  color: #fff; font-weight: 900;
}
.logo img { height: 42px; width: auto; display: block; }

/* ---------------------------------------------------------
   Ecran d'accueil
   --------------------------------------------------------- */
/* Bloc d'accroche (remplace l'illustration) */
.hero {
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 40vh;
}
.hero-title {
  font-size: 50px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.02;
  color: var(--brand);
}
.hero-text {
  margin: 22px auto 0;
  max-width: 34ch;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
/* Surlignage facon etiquette : fond vert (comme le titre), texte blanc */
.hl {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 1.7em;
  padding: 3px 12px;
  border-radius: 8px;
  max-width: 100%;
  line-height: 1.15;
  text-align: center;
  transform: rotate(-2.5deg);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hero-text .hl:nth-of-type(2) { transform: rotate(2.5deg); }
.home-cta { margin-top: 22px; }
.home-note {
  margin-top: 14px; text-align: center; color: var(--muted); font-size: 13px;
}
.home-note a { color: var(--brand); font-weight: 600; }

/* ---------------------------------------------------------
   Boutons
   --------------------------------------------------------- */
.btn {
  appearance: none; border: none; cursor: pointer;
  width: 100%;
  border-radius: var(--radius);
  padding: 18px 22px;
  font-weight: 700; font-size: 18px;
  transition: transform 0.06s ease, background 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost { background: transparent; color: var(--brand); font-weight: 700; width: auto; padding: 10px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------
   Animation du bouton d'accueil "Participer" (attire l'oeil)
   - pulsation douce + halo
   - reflet brillant qui balaie le bouton
   --------------------------------------------------------- */
#btn-participate,
#btn-submit {
  position: relative;
  overflow: hidden;
  transform-origin: center;
  animation: cta-pulse 2.4s ease-in-out infinite;
}
#btn-participate > *,
#btn-submit > * { position: relative; z-index: 1; }
#btn-participate::after,
#btn-submit::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 45%;
  height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
  transform: skewX(-20deg);
  z-index: 0;
  animation: cta-shine 3.4s ease-in-out infinite;
}
#btn-participate:hover,
#btn-submit:hover { background: var(--brand-dark); }
#btn-participate:active,
#btn-submit:active { animation: none; transform: scale(0.985); }
/* Pas d'animation quand le bouton est desactive (soumission en cours) */
#btn-submit:disabled { animation: none; }
#btn-submit:disabled::after { animation: none; display: none; }

@keyframes cta-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 10px 26px rgba(63, 173, 89, 0.35), 0 0 0 0 rgba(63, 173, 89, 0.45);
  }
  50% {
    transform: scale(1.025);
    box-shadow: 0 16px 40px rgba(63, 173, 89, 0.5), 0 0 0 12px rgba(63, 173, 89, 0);
  }
}
@keyframes cta-shine {
  0% { left: -75%; }
  55%, 100% { left: 135%; }
}

/* Accessibilite : desactive l'animation si l'utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
  #btn-participate,
  #btn-participate::after,
  #btn-submit,
  #btn-submit::after { animation: none; }
}

/* ---------------------------------------------------------
   Formulaire
   --------------------------------------------------------- */
.form-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.form-header h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.back-btn {
  appearance: none; border: 1.5px solid var(--border); background: var(--bg-alt);
  width: 44px; height: 44px; border-radius: var(--radius);
  font-size: 20px; cursor: pointer; flex: none; color: var(--text);
}

.card {
  background: var(--bg-alt); border-radius: 16px; padding: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}

.field { margin-bottom: 16px; }
.field.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field.grid-2 { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
label .req { color: var(--danger); }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.input {
  width: 100%; padding: 14px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: #fff; color: var(--text);
  outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(63, 173, 89, 0.18); }
.input.invalid { border-color: var(--danger); }
.error-msg { color: var(--danger); font-size: 12px; margin-top: 4px; display: none; }
.error-msg.show { display: block; }

/* Consentements RGPD */
.consent { display: flex; gap: 12px; align-items: flex-start; margin-top: 6px; }
.consent input[type="checkbox"] {
  width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--brand);
}
.consent label { font-weight: 500; font-size: 13.5px; margin: 0; color: var(--text); }
.consent a { color: var(--brand); font-weight: 700; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.form-actions { margin-top: 22px; }
.legal-mini { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.legal-mini a { color: var(--brand); }

/* ---------------------------------------------------------
   Confort tactile "kiosque" (evite selections/menus parasites)
   --------------------------------------------------------- */
body {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* Les champs de saisie doivent rester selectionnables/editables */
.input, textarea, select {
  -webkit-user-select: text;
  user-select: text;
}
/* Le champ focalise remonte au-dessus du clavier iPad */
html { scroll-padding-bottom: 140px; }
.field, .consent { scroll-margin-bottom: 140px; }

/* ---------------------------------------------------------
   Optimisations iPad (portrait & paysage)
   --------------------------------------------------------- */
@media (min-width: 768px) {
  /* Largeur exploitee + marge basse (safe-area home indicator) */
  #screen-form .container {
    max-width: 720px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }

  /* Lisibilite a distance (stand) */
  .form-header h1 { font-size: 30px; }
  label { font-size: 16px; }
  .hint { font-size: 13px; }
  .consent label { font-size: 15px; line-height: 1.4; }
  .legal-mini, .error-msg { font-size: 13px; }

  /* Cibles tactiles plus genereuses */
  .input { padding: 16px 16px; font-size: 17px; }
  .consent input[type="checkbox"] { width: 28px; height: 28px; }
  .consent { gap: 14px; }
  .back-btn { width: 48px; height: 48px; font-size: 22px; }
  .field { margin-bottom: 18px; }
}

/* Paysage : exploiter la largeur pour reduire le scroll vertical */
@media (min-width: 900px) and (orientation: landscape) {
  #screen-form .container { max-width: 860px; }
}

/* ---------------------------------------------------------
   Formulaire multi-etapes (facon Typeform) - une question / ecran
   --------------------------------------------------------- */
#screen-form .container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 16px;
}

/* Barre de progression + compteur */
.form-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}
.progress { flex: 1; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 12.5%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.progress-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

/* Zone des etapes : occupe toute la hauteur, sans scroll pour une question */
#lead-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.step { display: none; }
.step.is-current {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-height: 0;
  animation: step-in 0.35s ease both;
}
@keyframes step-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .step.is-current { animation: none; }
  .progress-fill { transition: none; }
}

.step-q {
  display: block;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 20px;
}
.step .input { font-size: 20px; padding: 18px 16px; }
.step .hint { margin-top: 10px; font-size: 14px; }
.step .error-msg { font-size: 14px; }

.step-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.step-actions .btn {
  width: auto;
  min-width: 220px;
  padding: 16px 30px;
}
.key-hint { font-size: 13px; color: var(--muted); }
.key-hint kbd {
  font-family: inherit;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* Sur grand ecran, questions encore plus lisibles */
@media (min-width: 768px) {
  .step-q { font-size: 34px; }
  .step .input { font-size: 22px; }
}

/* Etape finale (consentements) : tout centre */
.step[data-field="consentGame"] { text-align: center; align-items: center; }
.step[data-field="consentGame"] .consent {
  justify-content: center;
  text-align: left;      /* le libelle reste lisible ligne a ligne */
  max-width: 560px;
  width: 100%;
}
.step[data-field="consentGame"] .error-msg {
  margin-left: 0 !important;
  text-align: center;
}
.step[data-field="consentGame"] .step-actions { justify-content: center; }
.step[data-field="consentGame"] .legal-mini { max-width: 560px; }

/* ---------------------------------------------------------
   Ecran succes
   --------------------------------------------------------- */
.success { align-items: center; justify-content: center; text-align: center; }
/* Le conteneur doit etre une colonne flex pour centrer les boites
   a largeur limitee (sinon .success p max-width se colle a gauche) */
.container.success { display: flex; flex-direction: column; }
.success .checkmark {
  width: 96px; height: 96px; border-radius: 50%; background: var(--brand-tint);
  display: grid; place-items: center; margin: 0 auto 22px;
}
.success .checkmark svg { width: 52px; height: 52px; stroke: var(--brand); }
.success h1 { font-size: 30px; font-weight: 800; }
.success p { color: var(--muted); margin-top: 10px; max-width: 420px; }
.success .home-cta { margin-top: 30px; width: 100%; max-width: 320px; }
.countdown { font-weight: 700; color: var(--brand); }

/* ---------------------------------------------------------
   Page admin et mentions (pages separees)
   --------------------------------------------------------- */
.page { max-width: 900px; margin: 0 auto; padding: 30px 20px 60px; }
.page h1 { font-size: 30px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.02em; }
.page h2 { font-size: 20px; font-weight: 800; margin: 26px 0 8px; }
.page h3 { font-size: 16px; font-weight: 700; margin: 18px 0 6px; }
.page p, .page li { color: #1c1f22; margin-bottom: 8px; }
.page ul { padding-left: 20px; }
.page a { color: var(--brand); font-weight: 600; }
.lede { color: var(--muted); margin-bottom: 20px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.toolbar .btn { width: auto; padding: 12px 18px; font-size: 15px; }

.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; flex: 1; min-width: 140px;
}
.stat .num { font-size: 34px; font-weight: 800; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--brand-tint); font-weight: 700; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
.badge-yes { color: var(--brand); font-weight: 700; }
.badge-no { color: var(--muted); }

/* Verrou admin */
.lock { max-width: 360px; margin: 60px auto; text-align: center; }
.lock .card { padding: 30px; }
.pin-input { letter-spacing: 8px; text-align: center; font-size: 24px; }

/* Utilitaires */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
footer.site {
  text-align: center; color: var(--muted); font-size: 12px; padding: 20px;
}
footer.site a { color: var(--brand); }
