/* JEU — « 2027, votre terrain de jeu » : habillage de la carte (charte voeux-interactifs.fr : nuit, violet, bleu, or) */
@font-face { font-family: 'Lexend'; src: url('fonts/lexend-latin-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0a0b2e; overflow: hidden; }
body { font-family: Lexend, system-ui, -apple-system, 'Segoe UI', sans-serif; color: #fff; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.jeu { position: fixed; inset: 0; overflow: hidden; -webkit-user-select: none; user-select: none;
  --ease: cubic-bezier(.22, .8, .24, 1); --night: #0a0b2e; --navy: #101344; --violet: #7424df; --blue: #2854db; --gold: #e8a02a; --gold-l: #ffc466; --lav: #c3c6ea; }
.jeu-stage { position: absolute; inset: 0; touch-action: none; }
.jeu-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.4s ease .1s; outline: none; -webkit-tap-highlight-color: transparent; }
.is-ready .jeu-canvas { opacity: 1; }
.is-play .jeu-stage { cursor: grab; }
.is-play .jeu-stage:active { cursor: grabbing; }
.jeu-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* secours sans WebGL */
.jeu-fallback { display: none; position: absolute; inset: 0; background: radial-gradient(90% 70% at 50% 40%, #3a2fbe, #141653 70%, #0a0b2e); }
.jeu--nogl .jeu-fallback { display: block; }
.jeu--nogl .jeu-stage, .jeu--nogl .jeu-foot { display: none; }

/* ─── accueil ─── */
.jeu-intro { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px;
  background: radial-gradient(80% 62% at 50% 46%, rgba(10, 11, 46, .5), rgba(10, 11, 46, .88)); transition: opacity .9s var(--ease), visibility 0s .9s; }
.is-started .jeu-intro { opacity: 0; visibility: hidden; pointer-events: none; }
.jeu-intro__eyebrow { margin: 0 0 2.4vh; font-size: 12.5px; font-weight: 500; letter-spacing: .34em; text-indent: .34em; text-transform: uppercase; color: var(--lav); }
.jeu-intro__title { margin: 0; max-width: 12em; font-size: clamp(38px, 6.6vw, 96px); font-weight: 700; line-height: 1.04; letter-spacing: -.025em; text-wrap: balance; text-shadow: 0 4px 40px rgba(10, 11, 46, .6); }
.jeu-intro__title em { font-style: normal; background: linear-gradient(120deg, var(--gold-l), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.jeu-start { position: relative; margin-top: 5.2vh; display: inline-flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 26px 0 32px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(120deg, var(--gold-l), var(--gold)); color: var(--navy); font-size: 16px; font-weight: 600; letter-spacing: .02em;
  box-shadow: 0 14px 34px -12px rgba(232, 160, 42, .7); transition: transform .35s var(--ease), box-shadow .35s, opacity .4s; }
.jeu-start svg { width: 20px; height: 20px; fill: currentColor; transition: transform .35s var(--ease); }
.jeu-start[aria-disabled] { cursor: progress; opacity: .6; box-shadow: none; }
.jeu-start[aria-disabled] svg { display: none; }
.jeu-start[aria-disabled] { padding-right: 32px; }
.jeu-start:not([aria-disabled]):hover, .jeu-start:not([aria-disabled]):focus-visible { transform: translateY(-2px); box-shadow: 0 20px 40px -12px rgba(232, 160, 42, .85); }
.jeu-start:not([aria-disabled]):hover svg { transform: translateX(3px); }
.jeu-start:focus-visible, .jeu-icon:focus-visible, .jeu-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.jeu-auto { margin-top: 2.2vh; display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 18px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: #fff;
  border: 1px solid rgba(195, 198, 234, .45); background: rgba(16, 19, 68, .35); transition: background .3s, border-color .3s, opacity .4s; }
.jeu-auto svg, .jeu-demo svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.jeu-auto:hover, .jeu-auto:focus-visible { background: rgba(116, 36, 223, .55); border-color: #fff; }
.jeu-start[aria-disabled] ~ .jeu-auto { opacity: .4; pointer-events: none; }
.jeu-intro__note { display: inline-flex; align-items: center; gap: 9px; margin: 3.2vh 0 0; font-size: 12.5px; letter-spacing: .04em; color: rgba(195, 198, 234, .85); }
.jeu-intro__note svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.jeu-intro__note svg path:first-child { fill: currentColor; stroke: none; }

/* voile en haut de l'écran : les vœux restent lisibles sur la scène */
.jeu::before { content: ''; position: absolute; z-index: 2; inset: 0 0 auto 0; height: 34vh; pointer-events: none; background: linear-gradient(180deg, rgba(10, 11, 46, .62), rgba(10, 11, 46, 0)); opacity: 0; transition: opacity .8s; }
.is-play.jeu::before { opacity: 1; }

/* ─── les vœux, un par action ─── */
.jeu-say { position: absolute; left: 50%; z-index: 3; top: max(6vh, 26px); width: min(92vw, 1100px); margin: 0; transform: translateX(-50%); text-align: center; pointer-events: none;
  font-size: clamp(26px, 3.9vw, 60px); font-weight: 600; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; text-shadow: 0 3px 30px rgba(10, 11, 46, .75), 0 1px 3px rgba(10, 11, 46, .5); }
.jeu-w { display: inline-block; opacity: 0; transform: translateY(.5em) scale(.94); filter: blur(8px);
  transition: opacity .55s var(--ease), transform .7s cubic-bezier(.2, 1.3, .3, 1), filter .55s var(--ease); transition-delay: calc(var(--i) * 70ms); }
.jeu-w--em { background: linear-gradient(120deg, var(--gold-l), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: blur(8px) drop-shadow(0 3px 18px rgba(10, 11, 46, .7)); }
.jeu-say.is-in .jeu-w, .is-wish .jeu-final__wish .jeu-w { opacity: 1; transform: none; filter: blur(0); }
.jeu-say.is-in .jeu-w--em, .is-wish .jeu-final__wish .jeu-w--em { filter: drop-shadow(0 3px 18px rgba(10, 11, 46, .7)); }
.jeu-say:not(.is-in) .jeu-w { transition-duration: .35s; transition-delay: calc(var(--i) * 20ms); }

/* ─── progression (les quatre chiffres) et consigne ─── */
.jeu-foot { position: absolute; z-index: 4; left: 50%; bottom: max(3.6vh, 16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
  opacity: 0; transition: opacity .8s var(--ease); }
.is-play .jeu-foot { opacity: 1; }
.jeu-hud { display: flex; gap: 6px; padding: 7px 12px; border-radius: 999px; background: rgba(10, 11, 46, .46); border: 1px solid rgba(195, 198, 234, .26); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.jeu-hud i { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-style: normal; font-size: 16px; font-weight: 700; color: rgba(195, 198, 234, .6); border: 1.5px solid rgba(195, 198, 234, .32);
  transition: color .5s, background .5s, border-color .5s, transform .6s cubic-bezier(.2, 1.6, .3, 1), box-shadow .6s; }
.jeu-hud i.is-on { color: var(--navy); background: linear-gradient(120deg, var(--gold-l), var(--gold)); border-color: transparent; transform: scale(1.12); box-shadow: 0 0 18px rgba(255, 196, 102, .6); }
.jeu-hint { margin: 0; max-height: 0; overflow: hidden; opacity: 0; font-size: 12.5px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .92); text-shadow: 0 1px 10px rgba(10, 11, 46, .9); max-width: 92vw; text-align: center; line-height: 1.5;
  transition: opacity .6s, max-height .6s; }
.is-hint .jeu-hint { opacity: 1; max-height: 4.6em; }

/* manette tactile : visible au doigt seulement */
.jeu-stick { position: absolute; z-index: 2; left: 0; top: 0; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity .25s; --dx: 0px; --dy: 0px; }
.jeu-stick.is-on { opacity: 1; }
.jeu-stick::before { content: ''; position: absolute; width: 96px; height: 96px; left: -48px; top: -48px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .5); background: rgba(10, 11, 46, .22); }
.jeu-stick i { position: absolute; width: 40px; height: 40px; left: -20px; top: -20px; border-radius: 50%; background: linear-gradient(120deg, var(--gold-l), var(--gold)); box-shadow: 0 4px 16px rgba(10, 11, 46, .5); transform: translate(var(--dx), var(--dy)); }

/* ─── démo automatique (en jeu) ─── */
.jeu-demo { position: absolute; top: max(16px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); z-index: 7; display: none; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 13px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: #fff; border: 1px solid rgba(195, 198, 234, .4); background: rgba(10, 11, 46, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .3s, border-color .3s, color .3s; }
.is-play .jeu-demo { display: inline-flex; }
.jeu-demo:hover, .jeu-demo:focus-visible { background: rgba(116, 36, 223, .5); border-color: rgba(255, 255, 255, .7); }
.jeu-demo[aria-pressed="true"] { background: linear-gradient(120deg, var(--gold-l), var(--gold)); color: var(--navy); border-color: transparent; font-weight: 600; }
.is-auto .jeu-demo svg { animation: jeuSpin 2.4s linear infinite; }
@keyframes jeuSpin { to { transform: rotate(360deg); } }
.jeu-demo:focus-visible, .jeu-auto:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ─── son ─── */
.jeu-icon { position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 7; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(195, 198, 234, .4); background: rgba(10, 11, 46, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .3s, border-color .3s; }
.jeu-icon:hover, .jeu-icon:focus-visible { background: rgba(116, 36, 223, .5); border-color: rgba(255, 255, 255, .7); }
.jeu-icon svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.jeu-icon svg path:first-child { fill: #fff; stroke: none; }
.jeu-sound[aria-pressed="true"] .off, .jeu-sound[aria-pressed="false"] .on { display: none; }

/* ─── écran final ─── */
.jeu-final { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; text-align: center; pointer-events: none;
  padding: max(6vh, 26px) 24px max(3.6vh, 16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10, 11, 46, .8), rgba(10, 11, 46, .28) 30%, transparent 46%, transparent 62%, rgba(10, 11, 46, .82)); opacity: 0; transition: opacity 1.2s ease; }
.is-wish .jeu-final { opacity: 1; }
.jeu-final__title { margin: 0; font-size: clamp(40px, 6.8vw, 104px); font-weight: 700; line-height: 1.02; letter-spacing: -.03em; text-shadow: 0 4px 40px rgba(10, 11, 46, .7);
  opacity: 0; transform: translateY(18px) scale(.96); transition: opacity .9s var(--ease) .2s, transform 1.1s cubic-bezier(.2, 1.2, .3, 1) .2s; }
.is-wish .jeu-final__title { opacity: 1; transform: none; }
.jeu-final__wish { margin: clamp(10px, 2vh, 20px) 0 0; max-width: min(92vw, 900px); font-size: clamp(19px, 2.3vw, 34px); font-weight: 400; line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; text-shadow: 0 2px 24px rgba(10, 11, 46, .8); }
.jeu-final__wish .jeu-w { transition-delay: calc(var(--i) * 80ms + 900ms); }
.jeu-final__foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: clamp(12px, 2.2vh, 22px); }
.jeu-final__foot > * { pointer-events: auto; opacity: 0; transform: translateY(14px); transition: opacity .9s var(--ease), transform 1s var(--ease); }
.is-wish2 .jeu-final__foot > * { opacity: 1; transform: none; }
.is-wish2 .jeu-final__row { transition-delay: .25s; } .is-wish2 .jeu-credit { transition-delay: .5s; }
.jeu-final__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 14px; }
.jeu-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px 0 18px; border-radius: 999px; cursor: pointer; text-decoration: none; color: #fff; font-size: 14.5px; font-weight: 500;
  border: 1px solid rgba(195, 198, 234, .5); background: rgba(16, 19, 68, .5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .3s, border-color .3s, transform .3s var(--ease); }
.jeu-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jeu-btn:hover, .jeu-btn:focus-visible { background: rgba(116, 36, 223, .6); border-color: #fff; transform: translateY(-1px); }
.jeu-btn--gold { border-color: transparent; background: linear-gradient(120deg, var(--gold-l), var(--gold)); color: var(--navy); font-weight: 600; }
.jeu-btn--gold:hover, .jeu-btn--gold:focus-visible { background: linear-gradient(120deg, #ffd58c, var(--gold-l)); border-color: transparent; }
.jeu-credit { margin: 0; font-size: 11.5px; letter-spacing: .04em; color: rgba(195, 198, 234, .9); }
.jeu-credit a { color: inherit; text-decoration: none; }
.jeu-credit a:hover { text-decoration: underline; }
.jeu-logo { --logo-h: 46px; }
.jeu-logo img { height: var(--logo-h); width: auto; display: block; }
.jeu-logo a { display: block; }
.jeu-logo__ph { display: grid; place-items: center; height: 46px; padding: 0 22px; border-radius: 10px; border: 1px dashed rgba(255, 255, 255, .8); font-size: 12.5px; font-weight: 500; letter-spacing: .26em; text-indent: .26em; text-transform: uppercase; background: rgba(16, 19, 68, .4); }
.jeu-noscript { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 28px; font-weight: 600; }

@media (max-width: 640px) {
  .jeu-demo { padding: 0 13px 0 11px; font-size: 12.5px; }
  .jeu-say { top: max(9vh, 72px); font-size: clamp(25px, 7.4vw, 38px); }
  .jeu-hint { font-size: 11px; letter-spacing: .1em; }
  .jeu-final { padding-top: 10vh; }
  .jeu-btn { min-height: 46px; font-size: 14px; }
}
@media (max-height: 520px) {
  .jeu-intro__title { font-size: clamp(30px, 11vh, 60px); }
  .jeu-start { margin-top: 4vh; min-height: 48px; }
  .jeu-say { top: 14px; font-size: clamp(20px, 7vh, 34px); }
  .jeu-final { padding-top: 14px; }
  .jeu-final__title { font-size: clamp(28px, 11vh, 52px); }
  .jeu-final__wish { font-size: clamp(15px, 4.6vh, 22px); margin-top: 6px; }
  .jeu-logo, .jeu-credit { display: none; }
  .jeu-hud i { width: 26px; height: 26px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .jeu-w, .jeu-final__title, .jeu-final__foot > * { transition-duration: .01s !important; transition-delay: 0s !important; filter: none !important; transform: none !important; }
  .is-auto .jeu-demo svg { animation: none; }
}
