:root {
  --ground: #F4F1F8;
  --surface: #FFFFFF;
  --surface-2: #ECE6F3;
  --ink: #1C1624;
  --muted: #6F6680;
  --line: #E0D8EA;
  --btn: #1C1624;
  --btn-ink: #FFFFFF;
  --focus: #8B5CF6;
  --sky-opacity: .55;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Onest", "Helvetica Neue", system-ui, sans-serif;
  --radius: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #110D16;
    --surface: #1A1521;
    --surface-2: #251E2F;
    --ink: #F5F0FA;
    --muted: #A99FB8;
    --line: #2F2739;
    --btn: #F5F0FA;
    --btn-ink: #110D16;
    --focus: #C4A8FF;
    --sky-opacity: .32;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  overflow-x: hidden;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Ciel d'aura en arrière-plan */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky i {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  filter: blur(80px); opacity: var(--sky-opacity);
  animation: drift 26s ease-in-out infinite alternate;
}
.sky i:nth-child(1) { background: #FF7EB6; top: -30vmax; left: -25vmax; }
.sky i:nth-child(2) { background: #8B5CF6; top: -20vmax; right: -35vmax; animation-delay: -8s; }
.sky i:nth-child(3) { background: #FFD23F; bottom: -45vmax; left: -10vmax; opacity: calc(var(--sky-opacity) * .6); animation-delay: -16s; }
@keyframes drift { to { transform: translate(6vmax, 5vmax) scale(1.08); } }

.top, .shell, .foot { width: 100%; max-width: 480px; margin-inline: auto; padding-inline: 20px; }
.top { padding-block: 18px 4px; }
.brand { font: 800 1.35rem/1 var(--display); text-decoration: none; letter-spacing: -.02em; }
.brand span { color: #FF4D3D; }
.shell { flex: 1; padding-block: 12px 32px; display: flex; flex-direction: column; gap: 28px; }
.foot { padding-block: 8px 24px; color: var(--muted); font-size: .8rem; text-align: center; letter-spacing: .02em; }
.loading { color: var(--muted); }

/* Typographie */
h1, h2, h3 { font-family: var(--display); letter-spacing: -.025em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.05rem, 9vw, 2.75rem); line-height: 1.02; font-weight: 800; }
h2 { font-size: 1.45rem; line-height: 1.12; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.lede { color: var(--muted); font-size: 1.075rem; margin: 0; max-width: 34ch; }
.eyebrow { font: 600 .72rem/1 var(--body); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* Orbe d'aura */
.orb {
  --c1: #FFD23F; --c2: #FF7EB6; --c3: #8B5CF6;
  width: min(62vw, 250px); aspect-ratio: 1; border-radius: 50%; margin-inline: auto;
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,.85), transparent 22%),
    radial-gradient(circle at 70% 70%, var(--c3), transparent 62%),
    radial-gradient(circle at 25% 75%, var(--c2), transparent 60%),
    radial-gradient(circle at 60% 25%, var(--c1), transparent 58%),
    var(--c2);
  box-shadow: 0 30px 80px -20px var(--c2), inset 0 -18px 40px rgba(0,0,0,.12);
  animation: breathe 6s ease-in-out infinite;
  display: grid; place-items: center; font-size: 3.4rem;
}
.orb.small { width: 132px; font-size: 2.4rem; }
.orb.locked { filter: blur(14px) saturate(1.2); }
@keyframes breathe { 50% { transform: scale(1.045) rotate(4deg); } }

/* Formulaires et boutons */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.field {
  width: 100%; padding: 17px 20px; border-radius: 18px;
  border: 1.5px solid var(--line); background: var(--surface);
  font-size: 1.1rem; font-weight: 500;
}
.field::placeholder { color: var(--muted); font-weight: 400; }
.field:focus { outline: none; border-color: var(--focus); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--btn); color: var(--btn-ink);
  font: 700 1rem/1.1 var(--body); text-decoration: none;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.soft { background: var(--surface-2); color: var(--ink); }
.btn.aura {
  background: linear-gradient(100deg, #FF4D3D, #FF7EB6 45%, #8B5CF6);
  color: #fff;
}
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .9rem; }
.error { color: #D6284A; font-size: .9rem; margin: 0; }

/* Accueil */
.hero { display: flex; flex-direction: column; gap: 18px; padding-top: 8px; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: how; }
.how li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; counter-increment: how; }
.how li::before {
  content: counter(how); width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--ground);
  font: 700 .85rem/1 var(--display);
}
.how strong { display: block; }
.how span { color: var(--muted); font-size: .94rem; }
.resume { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 18px; background: var(--surface); text-decoration: none; font-weight: 600; }

/* Carte (canvas) */
.card-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.card-canvas {
  width: min(100%, 300px); aspect-ratio: 9 / 16; height: auto; border-radius: 26px;
  box-shadow: 0 30px 60px -25px rgba(28, 22, 36, .55); background: var(--surface-2);
}
.card-caption { color: var(--muted); font-size: .8rem; margin: 0; }

/* Panneaux */
.panel { background: var(--surface); border-radius: var(--radius); padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.linkbox {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 16px;
  background: var(--surface-2); font-weight: 600; font-size: .95rem;
}
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--body); }
.linkbox .btn { padding: 11px 16px; font-size: .9rem; flex: none; }
.share-ask { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; }
.ask-thumb { width: 92px; height: auto; aspect-ratio: 9 / 16; border-radius: 12px; background: var(--surface-2); box-shadow: 0 10px 24px -12px rgba(28, 22, 36, .5); }
.howto { margin: 0; padding-left: 20px; color: var(--muted); font-size: .92rem; display: grid; gap: 4px; }

/* Progression vers le déblocage */
.meter { display: flex; gap: 8px; justify-content: center; }
.meter i { width: 44px; height: 8px; border-radius: 99px; background: var(--line); }
.meter i.on { background: linear-gradient(90deg, #FF7EB6, #8B5CF6); }

/* Vote */
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #FF9A1F, #FF7EB6, #8B5CF6); transition: width .35s ease; }
.qhead { display: flex; justify-content: space-between; align-items: center; }
.qtitle { font: 700 1.55rem/1.15 var(--display); letter-spacing: -.02em; text-wrap: balance; margin: 0; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.swatch {
  aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; position: relative;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.7), transparent 30%), var(--c);
  box-shadow: 0 10px 24px -10px var(--c);
  transition: transform .15s ease;
}
.swatch:hover { transform: scale(1.06); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--ground), 0 0 0 7px var(--ink); }
.swatch span { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); font-size: .72rem; color: var(--muted); white-space: nowrap; }
.swatches { row-gap: 34px; padding-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tiles.one { grid-template-columns: 1fr; }
.tiles.emoji { grid-template-columns: repeat(4, 1fr); }
.tile {
  padding: 16px 14px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: .98rem; text-align: left; cursor: pointer; line-height: 1.25;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.tiles.emoji .tile { font-size: 2rem; text-align: center; padding: 14px 0; }
.tile:active { transform: scale(.97); }
.tile[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--ground); }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }

/* Résultats */
.result-head { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.section { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .94rem; font-weight: 600; }
.bar b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar i { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i::after { content: ""; display: block; height: 100%; width: var(--w); background: var(--ink); border-radius: inherit; }
.spectrum { display: flex; height: 22px; border-radius: 99px; overflow: hidden; }
.spectrum span { background: var(--c); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.quotes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.quotes li { display: flex; justify-content: space-between; gap: 12px; padding: 13px 16px; border-radius: 16px; background: var(--surface); font-weight: 500; }
.quotes b { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.plus { background: linear-gradient(145deg, #2A1B3D, #1C1624); color: #F5F0FA; }
.plus .muted { color: #BBAFCB; }
.plus ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: #E4DBEF; font-size: .94rem; }
.plus .btn { background: #F5F0FA; color: #1C1624; }

/* Révélation animée (plein écran, toujours sombre : c'est une scène) */
body.locked { overflow: hidden; }
.reveal {
  position: fixed; inset: 0; z-index: 20; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(circle at 50% 42%, #33204A 0%, #150E1D 62%, #0B0710 100%);
  color: #F5F0FA; text-align: center;
  animation: reveal-in .4s ease both;
}
@keyframes reveal-in { from { background-color: transparent; transform: scale(1.03); } }
.reveal .eyebrow { color: #BBAFCB; }
.reveal .sparks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.reveal .burst {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 42%, rgba(255,255,255,.95), rgba(255,255,255,.35) 25%, transparent 55%);
}
.reveal.flash .burst { animation: burst .8s ease-out; }
@keyframes burst { 15% { opacity: 1; } 100% { opacity: 0; } }

.reveal-stage { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.reveal-stage h2 { font-size: clamp(1.7rem, 7vw, 2.2rem); color: #F5F0FA; }
.reveal-hint { margin: 0; color: #BBAFCB; animation: hint 1.6s ease-in-out infinite; }
@keyframes hint { 50% { opacity: .45; } }
.reveal-orb {
  border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%;
  transform: scale(.82); transition: transform 1.1s cubic-bezier(.2, .8, .2, 1);
}
.reveal-orb .orb {
  width: min(60vw, 250px); filter: blur(22px) saturate(1.35);
  transition: filter 1.1s cubic-bezier(.2, .8, .2, 1), box-shadow 1.1s ease;
  animation: breathe 2.2s ease-in-out infinite;
}
.reveal.go .reveal-orb { transform: scale(1.3); }
.reveal.go .reveal-orb .orb { filter: blur(0) saturate(1.1); box-shadow: 0 0 120px 30px var(--c2), 0 0 40px var(--c1); animation-duration: .5s; }
.reveal.go .reveal-stage h2, .reveal.go .reveal-hint, .reveal.go .reveal-stage .eyebrow { opacity: 0; transition: opacity .4s ease; animation: none; }

.reveal-result { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 340px; position: relative; }
.reveal-title {
  margin: 0; font: 800 clamp(1.25rem, 5.6vw, 1.6rem)/1.1 var(--display); letter-spacing: -.02em; text-wrap: balance;
  opacity: 0; transform: translateY(12px); transition: opacity .5s ease .35s, transform .5s ease .35s;
}
.reveal-card {
  width: min(100%, 62dvh * 9 / 16, 300px);
  opacity: 0; transform: scale(.35) rotate(-8deg);
  transition: transform .8s cubic-bezier(.18, 1.35, .35, 1), opacity .25s ease;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
}
.reveal.show .reveal-card { opacity: 1; transform: none; }
.reveal.show .reveal-title { opacity: 1; transform: none; }
.reveal-actions { display: grid; gap: 10px; width: 100%; opacity: 0; transition: opacity .4s ease .7s; }
.reveal.show .reveal-actions { opacity: 1; }
.reveal-close { background: rgba(255, 255, 255, .12); color: #F5F0FA; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0)); transform: translateX(-50%);
  background: var(--ink); color: var(--ground); padding: 12px 18px; border-radius: 99px;
  font-weight: 600; font-size: .92rem; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); z-index: 30;
  max-width: calc(100% - 32px); text-align: center;
}

.fade-in { animation: fadein .35s ease both; }
@keyframes fadein { from { transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
