/* Mise en page : une colonne centrée, pensée pour un téléphone (390 px), largeur limitée sur ordinateur. */
:root {
  --fond: #0F0F0F;
  --texte: #FFFFFF;
  --texte-doux: #A8A8A3;
  --ligne: rgba(255, 255, 255, 0.18);
  --accent: #00C853;          /* vert vif, remplacé par la valeur du fichier quiz.json */
  --sur-accent: #0F0F0F;
  --titre: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --corps: "Inter", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--corps);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
img { max-width: 100%; }

.app {
  max-width: 520px;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* En-tête : retour | logo | espace, puis la barre de progression */
.entete {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  row-gap: 14px;
  padding-block: 18px 6px;
}
.logo { grid-column: 2; justify-self: center; width: 150px; height: auto; display: block; }
.retour {
  grid-column: 1; grid-row: 1;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--texte);
  display: grid; place-items: center;
  cursor: pointer;
}
.retour:hover { background: rgba(255, 255, 255, 0.08); }
.progression {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 3px;
  background: var(--ligne);
  overflow: hidden;
}
.progression span {
  display: block; height: 100%; width: 0;
  background: var(--texte);
  border-radius: 3px;
  transition: width 0.35s ease;
}

/* Écran : contenu centré verticalement et horizontalement */
.ecran {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding-block: 24px 48px;
  text-align: center;
}
.ecran.entree { animation: entree 0.35s ease both; }
@keyframes entree { from { opacity: 0.001; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.etape {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texte-doux);
}
.question {
  margin: 0;
  font-family: var(--titre);
  font-weight: 700;
  font-size: clamp(27px, 7.4vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  max-width: 16ch;
}
.texte-intro { margin: 0; color: var(--texte-doux); max-width: 34ch; text-wrap: pretty; }
.bloc-titre { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* Réponses en bulles (pilules) */
.options { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.options.grille { display: grid; grid-template-columns: repeat(3, 1fr); }
.bulle {
  min-height: 56px;
  padding: 12px 22px;
  border: 1.5px solid var(--texte);
  border-radius: 999px;
  background: transparent;
  color: var(--texte);
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
  touch-action: manipulation;
}
.options.grille .bulle { padding-inline: 8px; }
@media (hover: hover) { .bulle:hover { background: rgba(255, 255, 255, 0.08); } }
.bulle:active { transform: scale(0.97); }
.bulle.choisie, .bulle.choisie:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--sur-accent);
  font-weight: 600;
}
.bulle:focus-visible, .retour:focus-visible, .carte-lien:focus-visible, .curseur:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.bulle.principale { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 600; min-width: 220px; }
.bulle.secondaire { min-width: 220px; }

/* Curseur du budget */
.budget { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 22px; }
.budget-valeur {
  font-family: var(--titre); font-weight: 700;
  font-size: 52px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.budget-bornes { display: flex; justify-content: space-between; font-size: 14px; color: var(--texte-doux); }
.curseur {
  --pct: 0%;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 36px;
  background: transparent; margin: 0; cursor: pointer;
}
.curseur::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(to right, var(--accent) 0 var(--pct), var(--texte) var(--pct) 100%);
}
.curseur::-moz-range-track { height: 6px; border-radius: 6px; background: var(--texte); }
.curseur::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.curseur::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; margin-top: -12px;
  border-radius: 50%; background: var(--texte);
  border: 4px solid var(--accent);
}
.curseur::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--texte); border: 4px solid var(--accent);
}

/* Page résultat */
.ecran.resultat { justify-content: flex-start; gap: 28px; }
.resume { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.resume div {
  border: 1.5px solid var(--ligne); border-radius: 20px;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.resume small { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--texte-doux); }
.resume strong { font-family: var(--titre); font-size: 26px; line-height: 1.1; }
.conseils { width: 100%; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.conseils li {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 15px; line-height: 1.45;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}
.conseils li::before {
  content: ""; flex: none; width: 8px; height: 8px; margin-top: 7px;
  border-radius: 50%; background: var(--accent);
}
.note { margin: 0; font-size: 15px; color: var(--texte-doux); max-width: 36ch; }

.cartes { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; text-align: left; }
.carte { position: relative; min-width: 0; }
.carte-lien { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; min-width: 0; border-radius: 16px; }
.carte-photo { box-shadow: inset 0 0 0 0 var(--accent); transition: box-shadow 0.2s ease; }
.carte.gardee .carte-photo { box-shadow: 0 0 0 3px var(--accent); }
.garder {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 12px 6px 10px;
  border: 0; border-radius: 999px;
  background: rgba(15, 15, 15, 0.72);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--texte);
  font-size: 13px; font-weight: 600;
  cursor: pointer; touch-action: manipulation;
}
.garder svg path { fill: transparent; transition: fill 0.15s ease; }
.garder[aria-pressed="true"] { background: var(--accent); color: var(--sur-accent); }
.garder[aria-pressed="true"] svg path { fill: currentColor; }
.garder:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.carte-photo {
  aspect-ratio: 1 / 1; width: 100%; max-width: 100%;
  border-radius: 16px; overflow: hidden;
  background: #1C1C1C;
}
.carte-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carte-texte { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.carte-marque { font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--texte-doux); }
.carte-nom {
  font-size: 15px; line-height: 1.3; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.carte-ligne { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 2px; font-size: 14px; }
.carte-taille { border: 1px solid var(--ligne); border-radius: 999px; padding: 1px 9px; color: var(--texte-doux); }
.carte-prix { font-weight: 600; font-variant-numeric: tabular-nums; }

.chargement { display: flex; flex-direction: column; align-items: center; gap: 18px; color: var(--texte-doux); }
.rond { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ligne); border-top-color: var(--accent); animation: tourne 0.8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

.mode-test {
  font-size: 12px; color: var(--texte-doux);
  border: 1px dashed var(--ligne); border-radius: 999px; padding: 4px 12px;
}

.note.petite { font-size: 14px; margin-top: -14px; }
.bouton-lien { display: grid; place-items: center; text-decoration: none; }
.accroche {
  margin: 0; font-size: 14px; color: var(--texte);
  display: inline-flex; align-items: center; gap: 8px;
}
.accroche::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* Bouton panier : reste collé en bas de l'écran pendant qu'on fait défiler les idées */
.barre-panier {
  position: sticky; bottom: 0; z-index: 5;
  width: calc(100% + 40px); margin-inline: -20px;
  display: flex; justify-content: center;
  padding: 18px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, rgba(15, 15, 15, 0), var(--fond) 40%);
}
.barre-panier .bulle { width: 100%; max-width: 380px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); }
.lien-fleche {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 6px 4px;
  border: 0; background: transparent; color: var(--texte);
  font-size: 17px; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--ligne); text-underline-offset: 6px;
}
.lien-fleche svg { transition: transform 0.2s ease; }
@media (hover: hover) { .lien-fleche:hover svg { transform: translateX(4px); } }
.lien-fleche:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Page des avantages Noël */
.boutons { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.avec-icone { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.page-avantages .avantages { max-width: 380px; }
.avantages {
  width: 100%; text-align: left; margin: 0;
  border: 1.5px solid var(--ligne); border-radius: 22px;
  padding: 20px 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.avantages h2 { margin: 0; font-family: var(--titre); font-size: 20px; line-height: 1.2; }
.avantages { list-style: none; gap: 16px; }
.avantages li { display: flex; flex-direction: column; gap: 1px; padding-left: 18px; position: relative; font-size: 15px; line-height: 1.4; }
.avantages li::before { content: ""; position: absolute; left: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.avantages strong { font-weight: 600; }
.avantages span { color: var(--texte-doux); }

@media (min-width: 700px) {
  .app { max-width: 760px; }
  .ecran:not(.resultat) > * { max-width: 420px; }
  .cartes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .resume { max-width: 520px; }
  .conseils { max-width: 620px; }
  .logo { width: 170px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
