:root {
  --bg-1: #1b1a3a;
  --bg-2: #2b1f3d;
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.72);
  --text-faint: rgba(255, 255, 255, 0.45);
  --accent: #e8a6d6;
  --accent-strong: #f2bfe4;
  --accent-ink: #1b1a3a;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(232, 166, 214, 0.14);
  --border: rgba(232, 166, 214, 0.45);
  --accent-text: var(--accent);       /* accent employé comme couleur de texte */
  --key-bg: transparent;
  --key-text: var(--accent);
  --selected-bg: var(--surface-hover);
  --selected-text: var(--text);
  --selected-key-bg: var(--accent);
  --selected-key-text: var(--accent-ink);
  --track: rgba(255, 255, 255, 0.14);
  --focus: var(--accent-strong);
  --radius: 6px;
  --gutter: clamp(16px, calc(8vw - 12px), 72px);   /* marge latérale, suit la largeur de l'iframe */
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Thème vert (version avec CTA).
   Le jaune n'est lisible sur le vert qu'en aplat (2,4:1 en texte) : il sert de
   fond, avec un texte vert très foncé (9,5:1). Le blanc sur #049481 fait 3,8:1,
   donc pas de texte blanc atténué ; les cartes de réponse sont assombries pour
   monter le texte à 5,5:1. */
html[data-theme="vert"] {
  --bg-1: #049481;
  --bg-2: #049481;
  --text: #ffffff;
  --text-dim: #ffffff;
  --text-faint: #ffffff;
  --accent: #efcb21;
  --accent-strong: #f6da5a;
  --accent-ink: #0d2b27;
  --accent-text: #ffffff;
  --surface: rgba(0, 0, 0, 0.2);
  --surface-hover: rgba(0, 0, 0, 0.3);
  --border: rgba(255, 255, 255, 0.55);
  --key-bg: var(--accent);
  --key-text: var(--accent-ink);
  --selected-bg: var(--accent);
  --selected-text: var(--accent-ink);
  --selected-key-bg: var(--accent-ink);
  --selected-key-text: var(--accent);
  --track: rgba(0, 0, 0, 0.22);
  --focus: #ffffff;
}
html[data-theme="vert"] .kicker {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
}
html[data-theme="vert"] .lead,
html[data-theme="vert"] .conclusion p,
html[data-theme="vert"] .meta,
html[data-theme="vert"] .hint,
html[data-theme="vert"] .progress-label,
html[data-theme="vert"] .gauge-note { font-weight: 500; }
html[data-theme="vert"] .key { border-color: var(--accent); }
html[data-theme="vert"] .photo.selected .label { background: var(--accent); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: linear-gradient(170deg, var(--bg-1) 0%, var(--bg-2) 100%) fixed;
  background-color: var(--bg-1);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--gutter) 96px;
}
.screen {
  width: 100%;
  max-width: 720px;
  animation: enter 0.45s cubic-bezier(.2, .7, .2, 1) both;
}
.screen.leaving { animation: leave 0.25s ease-in both; }
@keyframes enter { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: translateY(-20px); } }

h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.1; margin: 0 0 20px; }
h1 { font-size: clamp(2.4rem, 7vw, 3.6rem); }
h2 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
p { margin: 0 0 16px; }
.lead { font-size: 1.1rem; color: var(--text-dim); max-width: 560px; }
.kicker {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.rule { width: 100%; max-width: 400px; height: 1px; background: var(--text); opacity: .8; margin: 28px 0; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 1rem var(--sans);
  padding: 12px 22px; border-radius: var(--radius); border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  transition: background .15s, transform .15s;
  text-decoration: none;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: scale(.98); }
.hint { font-size: 0.8rem; color: var(--text-faint); margin-left: 12px; }
.hint kbd { font-family: var(--sans); font-weight: 700; }
.meta { font-size: .85rem; color: var(--text-faint); margin-top: 18px; }

/* Questions */
.q-num { display: flex; align-items: center; gap: 8px; color: var(--accent-text); font-weight: 600; font-size: .95rem; margin-bottom: 10px; }
.q-num svg { width: 14px; height: 14px; }
.q-text { font-size: clamp(1.25rem, 3.6vw, 1.6rem); font-weight: 500; line-height: 1.35; margin: 0 0 28px; }

.choices { display: flex; flex-direction: column; gap: 10px; max-width: 600px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  font: 500 1rem/1.4 var(--sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 14px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.choice:hover { background: var(--surface-hover); }
.choice:focus-visible, .photo:focus-visible, .btn:focus-visible, .nav button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.key {
  flex: none; display: inline-grid; place-items: center;
  min-width: 24px; height: 24px; padding: 0 4px; margin-top: -1px;
  font-size: .75rem; font-weight: 700;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--key-bg); color: var(--key-text);
}
.choice.selected { background: var(--selected-bg); color: var(--selected-text); border-color: var(--accent); }
.choice.selected .key, .photo.selected .key { background: var(--selected-key-bg); color: var(--selected-key-text); border-color: var(--selected-key-bg); }
.choice.selected.blink { animation: blink .32s steps(2) 1; }
@keyframes blink { 50% { background: transparent; } }
.check { margin-left: auto; opacity: 0; flex: none; }
.choice.selected .check { opacity: 1; }

.photos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.photo {
  position: relative; padding: 0; cursor: pointer; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; color: inherit; transition: border-color .15s, transform .15s;
}
.photo:hover { transform: translateY(-2px); border-color: var(--accent); }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.photo .label { display: flex; align-items: center; justify-content: center; padding: 8px; }
.photo.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* Bottom navigation */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 12px var(--gutter); background: linear-gradient(to top, var(--bg-2) 60%, transparent);
  transition: opacity .3s;
}
.nav[hidden] { display: none; }
.progress { flex: 1; max-width: 320px; }
.progress-label { font-size: .78rem; color: var(--text-dim); margin-bottom: 6px; }
.bar { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.arrows { margin-left: auto; display: flex; gap: 2px; }
.arrows button {
  width: 36px; height: 32px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
}
.arrows button:first-child { border-radius: 4px 0 0 4px; }
.arrows button:last-child { border-radius: 0 4px 4px 0; }
.arrows button:disabled { opacity: .35; cursor: default; }

/* Loading */
.loading { text-align: center; }
.dots { display: inline-flex; gap: 8px; margin-top: 12px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .2; transform: scale(.8); } 50% { opacity: 1; transform: none; } }

/* Results */
#app.results { align-items: flex-start; padding-bottom: 64px; }
.section { margin-bottom: 56px; }
.gauge { max-width: 560px; margin: 28px 0 10px; }
.gauge-value { font-family: var(--serif); font-size: clamp(3.4rem, 12vw, 5rem); line-height: 1; color: var(--accent-text); }
.gauge-bar { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; margin-top: 14px; }
.gauge-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1.6s cubic-bezier(.2,.7,.2,1); }
.gauge-note { font-size: .85rem; color: var(--text-faint); margin-top: 8px; }

.conclusion p { color: var(--text-dim); max-width: 600px; font-size: 1.05rem; }
.conclusion strong { color: var(--text); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

@media (max-width: 640px) {
  #app { padding-top: 32px; }
  .photos { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .photo .label { padding: 6px; }
  .hint { display: none; }
}
@media (max-width: 300px) {
  .photos { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}
