/* Quel énergumène es-tu ? — palette Éclat provisoire (revue à l'étape 4b). Mobile d'abord. */
:root {
  --bg: #16132e;
  --bg2: #241f4a;
  --ink: #fff8ec;
  --muted: #b9b3d9;
  --accent: #ffd23f;
  --idle: #4a4570;
  --hue: 48;               /* teinte du type affiché (posée par main.js) */
  --tc: hsl(var(--hue) 90% 64%);
  --font: 'Fredoka', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%) fixed, var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
#app {
  position: relative;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(34px, env(safe-area-inset-bottom));
}
.screen {
  position: absolute;
  inset: 0;
  padding: inherit;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  overflow-y: auto;
}
.screen[data-active] { display: flex; }

.logo {
  margin: 0;
  font-size: clamp(40px, 12.5vw, 66px);
  font-weight: 700;
  line-height: 1.02;
  color: var(--accent);
  transform: rotate(-3deg);
  text-shadow: 0 5px 0 rgba(0, 0, 0, .35);
}
.logo span { color: var(--ink); }
.sub { margin: 0; color: var(--muted); font-size: 19px; }
.friend {
  margin: 0; padding: 10px 16px; border-radius: 18px;
  background: rgba(255, 255, 255, .1); font-size: 18px; max-width: 360px;
}
.friend b { color: var(--accent); }
.disclaimer { margin: 4px 0 0; max-width: 340px; color: var(--muted); font-size: 13px; line-height: 1.35; }

.cta {
  min-width: 220px; padding: 16px 28px; border: 0; border-radius: 999px;
  background: var(--accent); color: #2a1d00; font-size: 26px; font-weight: 700;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35);
}
.cta.big { font-size: 30px; padding: 20px 40px; animation: pulse 1.4s ease-in-out infinite; }
.cta:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.cta.ghost { min-width: 0; background: rgba(255, 255, 255, .12); color: var(--ink); font-size: 20px; padding: 13px 18px; }
.row { display: flex; gap: 12px; width: min(100%, 360px); }
.row .cta { flex: 1; min-width: 0; font-size: 22px; padding: 14px 12px; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* Questions */
#quiz { justify-content: flex-start; gap: 10px; padding-top: max(16px, env(safe-area-inset-top)); }
.hud { width: 100%; display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .12); font-weight: 700; font-size: 20px;
}
.icon-btn:disabled { opacity: .3; }
.progress { flex: 1; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.progress i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .25s; }
.count { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.q { margin: 6px 0 10px; font-size: clamp(26px, 7.4vw, 34px); line-height: 1.12; min-height: 3.4em; display: grid; align-items: center; }
.opts { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.opt {
  width: 100%; padding: 16px 18px; border: 2px solid rgba(255, 255, 255, .16); border-radius: 22px;
  background: rgba(255, 255, 255, .08); font-size: 20px; font-weight: 500; line-height: 1.2; text-align: left;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3);
}
.opt:active, .opt.picked { border-color: var(--accent); background: rgba(255, 210, 63, .22); transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.opts.locked .opt { pointer-events: none; }

/* Résultat */
#result { justify-content: flex-start; padding-top: max(18px, env(safe-area-inset-top)); gap: 10px; }
.badge { margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--accent); color: #2a1d00; font-weight: 700; font-size: 16px; }
.you-are { margin: 6px 0 0; color: var(--muted); font-size: 20px; }
.r-name { margin: 0; font-size: clamp(40px, 12vw, 60px); line-height: 1; color: var(--tc); transform: rotate(-2deg); text-shadow: 0 5px 0 rgba(0, 0, 0, .35); }
.r-lines { max-width: 380px; display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.r-lines p { margin: 0; font-size: 18px; line-height: 1.25; }
.r-lines p:last-child { color: var(--tc); font-weight: 600; }
.bars { width: min(100%, 360px); display: flex; flex-direction: column; gap: 7px; margin: 4px 0 2px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 8px; font-size: 14px; text-align: left; }
.bar-row .dn { color: var(--muted); }
.bar-row .ln { font-weight: 600; font-size: 13px; min-width: 100px; text-align: right; }
.segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.segs i { height: 10px; border-radius: 5px; background: var(--idle); }
.segs i.on { background: var(--tc); }

/* Personnage en pixel art (96 px agrandis sans lissage) */
.sprite { width: 192px; height: 192px; image-rendering: pixelated; margin: 2px 0 -4px; background: transparent; }

/* Collection */
#collection { justify-content: flex-start; padding-top: max(18px, env(safe-area-inset-top)); gap: 10px; }
.coll-title { margin: 0; font-size: 34px; line-height: 1.05; color: var(--accent); }
.coll-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.coll-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 8px;
  border-radius: 16px; background: rgba(255, 255, 255, .08); color: var(--ink); font-size: 12px; line-height: 1.1;
}
.coll-cell img { width: 100%; max-width: 96px; height: auto; aspect-ratio: 1; image-rendering: pixelated; background: transparent; }
.coll-cell.lock { color: var(--muted); }
.coll-cell.lock img { filter: blur(3px) saturate(.5) brightness(.75); opacity: .85; }
#coll-secret { font-size: 15px; }

/* Bandeau d'accueil : les énergumènes floutés défilent, avec leur nom */
.strip {
  width: calc(100% + 32px); margin: 6px -16px 0; padding: 0; border: 0; background: transparent;
  color: var(--ink); overflow: hidden; display: block;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.strip-track { display: flex; width: max-content; animation: marquee 70s linear infinite; }
.strip-row { display: flex; gap: 8px; padding-right: 8px; }
.strip .coll-cell { width: 84px; flex: none; padding: 4px 2px 6px; font-size: 11px; }
.strip .coll-cell img { max-width: 64px; }
.strip-hint { margin: -2px 0 0; padding: 4px 12px; border: 0; background: transparent; color: var(--accent); font-size: 15px; font-weight: 600; }
@keyframes marquee { to { transform: translateX(-50%); } }

.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: #000c; padding: 10px 18px; border-radius: 999px; font-size: 16px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 9;
}
.toast.show { opacity: 1; }
.foot {
  position: fixed; bottom: max(6px, env(safe-area-inset-bottom)); left: 0; right: 0;
  text-align: center; font-size: 12px; color: var(--muted); opacity: .7;
}
/* ?clip=1 : écran propre pour filmer */
.clip [data-noclip] { display: none !important; }

@media (max-height: 780px) {
  .sprite { width: 144px; height: 144px; }
}
@media (max-height: 700px) {
  .sprite { width: 96px; height: 96px; margin-bottom: 0; }
  .foot { display: none; }
  .q { min-height: 0; margin-bottom: 4px; }
  .opt { padding: 12px 16px; font-size: 18px; }
  .opts { gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .cta.big { animation: none; }
  .progress i { transition: none; }
  .strip { overflow-x: auto; }
  .strip-track { animation: none; }
}
body:has(#collection[data-active]) .foot { display: none; }
