/* Roue de la fortune de la boîte vide (partials/roue_encart.html,
   core/roue.py). Chargée seulement quand la roue s'affiche.

   Thème « Grand format » : la roue est un objet, mêmes couleurs en clair et
   en sombre (jante encre, ampoules citron) ; tout le texte autour suit les
   jetons du thème (--t1, --border…). Seul le disque tourne (calque composité,
   transform CSS piloté par static/js/roue.js) : 60 images/s sans repeindre
   le SVG. Le dessin reste lisible et jouable sans JavaScript. */

.roue {
  --roue-encre: #0B0E2A;
  --roue-citron: #DDF247;
  --roue-klein: #002FA7;
  max-width: 560px; margin: 1.4rem auto 1.5rem; padding-top: 1.2rem;
  border-top: 1px solid var(--border); text-align: left; position: relative;
}
.roue-top { display: flex; align-items: flex-start; gap: .5rem; }
.roue-titre {
  flex: 1; margin: 0; font-family: var(--ff-head); font-size: 1.02rem; font-weight: 800;
  line-height: 1.35; color: var(--t1); text-wrap: balance;
}
.roue-close-f { margin: -.55rem -.55rem 0 0; }
.roue-close {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border: 0; border-radius: 10px; background: none; color: var(--t3); cursor: pointer;
}
.roue-close:hover { color: var(--t1); background: var(--soft); }
.roue-close:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }

.roue-corps {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: .9rem;
  align-items: start;      /* le résultat s'allonge vers le bas : la roue ne bouge pas */
}
@media (min-width: 540px) {
  .roue-corps { grid-template-columns: minmax(210px, 252px) minmax(0, 1fr); gap: 1.5rem; }
  .roue-texte { padding-top: 2.4rem; }
}

/* ── Scène : disque, décor, pointeur, bouton central ───────────────────── */
.roue-scene {
  position: relative; width: 100%; max-width: 272px; aspect-ratio: 1; margin: 6px auto 0;
  isolation: isolate; container-type: inline-size;
}
.roue-halo {
  position: absolute; inset: -9%; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--roue-citron) 38%, transparent),
                              color-mix(in srgb, var(--neon) 14%, transparent) 62%, transparent 74%);
  opacity: .45; transform: scale(.94);
  transition: opacity .5s ease, transform .5s ease;
}
.roue-svg, .roue-deco { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.roue-svg {
  will-change: transform; transform-origin: 50% 50%;
  filter: drop-shadow(0 10px 18px rgba(6, 8, 30, .28));
}
.roue-deco { pointer-events: none; }
.roue-jante { fill: var(--roue-encre); stroke: color-mix(in srgb, var(--neon) 45%, transparent); stroke-width: 1.5; }
.roue-seg { stroke: none; transition: filter .3s ease; }
.roue-sep { stroke: var(--roue-encre); stroke-width: 1.4; stroke-opacity: .55; }
.roue-moyeu { fill: var(--roue-encre); }
.roue-lab {
  font-family: var(--ff-head); font-weight: 800; letter-spacing: -.01em;
  pointer-events: none; user-select: none;
}
.roue-lab-n { font-weight: 900; letter-spacing: -.04em; }
.roue-lab-u { font-weight: 700; letter-spacing: .01em; }
.roue-amp { fill: var(--roue-citron); }
.roue-amp.is-alt { fill: #FFFFFF; opacity: .55; }

/* Pointeur : un rabat d'enveloppe suspendu en haut, qui bascule à chaque case */
.roue-pointeur {
  position: absolute; top: -7%; left: 50%; width: 14%; height: auto; margin-left: -7%;
  z-index: 2; transform-origin: 50% 12%; will-change: transform;
  filter: drop-shadow(0 3px 3px rgba(6, 8, 30, .35));
}
.roue-pointeur-f { fill: var(--roue-citron); stroke: var(--roue-encre); stroke-width: 2.4; stroke-linejoin: round; }
.roue-pointeur-l { fill: none; stroke: var(--roue-encre); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.roue-form { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; pointer-events: none; }
.roue-go {
  pointer-events: auto; width: 29%; aspect-ratio: 1; border-radius: 50%; padding: 0;
  border: 3px solid var(--roue-encre); cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #F4FF9A, var(--roue-citron) 55%, #B9CC1E);
  color: var(--roue-encre); font: 900 clamp(.66rem, 5.4cqi, .95rem)/1 var(--ff-head); letter-spacing: -.02em;
  box-shadow: 0 0 0 3px var(--roue-citron), 0 6px 16px rgba(6, 8, 30, .35);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .18s ease;
  display: grid; place-items: center; text-align: center;
}
.roue-go-t { padding: 0 .15rem; white-space: nowrap; }
.roue-go:hover:not(:disabled) { transform: scale(1.07); box-shadow: 0 0 0 3px var(--roue-citron), 0 0 0 9px color-mix(in srgb, var(--roue-citron) 30%, transparent), 0 8px 20px rgba(6, 8, 30, .4); }
.roue-go:active:not(:disabled) { transform: scale(.95); }
.roue-go:focus-visible { outline: 3px solid var(--neon); outline-offset: 5px; }
.roue-go:disabled { cursor: default; background: #E7E9FD; color: #535878; box-shadow: 0 0 0 3px #C9CEF5, 0 4px 10px rgba(6, 8, 30, .25); font-size: clamp(.62rem, 5cqi, .86rem); }
/* Invitation discrète à jouer (une seule respiration lente, rien d'autre ne bouge) */
.roue:not(.is-fini):not(.is-tourne) .roue-go { animation: roue-respire 2.6s ease-in-out 1.2s 3; }
@keyframes roue-respire { 50% { box-shadow: 0 0 0 3px var(--roue-citron), 0 0 0 12px color-mix(in srgb, var(--roue-citron) 22%, transparent), 0 6px 16px rgba(6, 8, 30, .35); } }

/* Pendant la rotation : halo plus vif, ampoules qui chassent */
.roue.is-tourne .roue-halo { opacity: 1; transform: scale(1.02); }
.roue.is-tourne .roue-amp { animation: roue-chasse .34s steps(1) infinite; }
.roue.is-tourne .roue-amp.is-alt { animation-delay: -.17s; }
@keyframes roue-chasse { 0% { fill: var(--roue-citron); opacity: 1; } 50% { fill: #FFFFFF; opacity: .5; } }

/* Gain : ampoules en fête, case gagnante qui s'éclaire, onde de choc */
.roue.is-gagne .roue-amp { animation: roue-chasse .22s steps(1) 10; }
.roue.is-gagne .roue-amp.is-alt { animation-delay: -.11s; }
.roue-seg.is-gagnant { filter: brightness(1.18) saturate(1.1); animation: roue-eclat .5s ease-in-out 4 alternate; }
@keyframes roue-eclat { to { filter: brightness(1.45) saturate(1.2); } }
.roue-onde {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none; z-index: 1;
  border: 3px solid var(--roue-citron); opacity: 0;
  animation: roue-onde .9s cubic-bezier(.2, .7, .3, 1) forwards;
}
.roue-onde.is-2 { animation-delay: .18s; border-color: #fff; }
@keyframes roue-onde { 0% { transform: scale(.8); opacity: .95; } 100% { transform: scale(1.35); opacity: 0; } }

/* Perdu : la roue soupire (léger balancement), rien de criard */
.roue.is-perdu .roue-halo { opacity: .25; }

/* ── Texte, résultat ───────────────────────────────────────────────────── */
.roue-texte { min-width: 0; }
.roue-accroche { margin: 0; font-size: .92rem; line-height: 1.55; color: var(--t2); max-width: 46ch; }
.roue-resultat:empty { display: none; }
.roue-resultat { margin-top: .8rem; }
.roue-res {
  border-radius: 14px; padding: .95rem 1rem 1rem; background: var(--card);
  border: 1px solid var(--border);
  animation: roue-entree .55s cubic-bezier(.2, .9, .3, 1.25) both;
}
.roue-res.is-gain {
  background: var(--roue-encre); color: #EEF0FF; border-color: var(--roue-encre);
  box-shadow: 0 0 0 3px var(--roue-citron) inset;
}
@keyframes roue-entree { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.roue-res-t { margin: 0; font-family: var(--ff-head); font-weight: 900; font-size: 1.12rem; line-height: 1.25; color: var(--t1); text-wrap: balance; }
.roue-res.is-gain .roue-res-t { color: var(--roue-citron); font-size: 1.28rem; }
.roue-res-p { margin: .35rem 0 0; font-size: .86rem; line-height: 1.5; color: var(--t2); }
.roue-res.is-gain .roue-res-p { color: rgba(238, 240, 255, .82); }
.roue-code { display: flex; align-items: stretch; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.roue-code-v {
  flex: 1 1 10ch; display: flex; align-items: center; justify-content: center; min-height: 48px;
  padding: .3rem .8rem; border-radius: 10px; background: #fff; color: var(--roue-encre);
  font-family: var(--ff-mono); font-size: 1.22rem; font-weight: 700; letter-spacing: .14em;
  user-select: all; white-space: nowrap;
}
.roue-code-v .ch { display: inline-block; }
.roue-copier {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 48px; padding: 0 1rem;
  border: 0; border-radius: 10px; background: var(--roue-citron); color: var(--roue-encre);
  font: 800 .88rem/1 var(--ff-head); cursor: pointer;
}
.roue-copier:hover { filter: brightness(1.06); }
.roue-copier:focus-visible, .roue-cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.roue-copier.is-ok { background: #fff; }
.roue-res-date { margin: .55rem 0 0; font-size: .8rem; color: rgba(238, 240, 255, .75); }
.roue-cta {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: .75rem; padding: 0 1.1rem;
  border-radius: 10px; background: #3B48E6; color: #fff; font-weight: 800; font-size: .9rem;
  text-decoration: none;
}
.roue-cta:hover { background: #2433D6; color: #fff; }
.roue-res-note { margin: .5rem 0 0; font-size: .76rem; line-height: 1.45; color: rgba(238, 240, 255, .7); }
.roue-res.is-perdu { border-left: 4px solid var(--neon); }
.roue-res.is-refus { border-left: 4px solid var(--t3); }
.roue-mention { margin: .8rem 0 0; font-size: .74rem; color: var(--t3); }
.roue-mention a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.roue-mention a:hover { color: var(--t1); }

/* Confettis : calque plein écran, retiré à la fin */
.roue-confettis { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9999; }

@media (max-width: 539px) {
  .roue-scene { max-width: 248px; }
  .roue-texte { text-align: center; }
  .roue-accroche { margin-inline: auto; }
  .roue-res { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .roue-go, .roue-halo, .roue-seg { transition: none; }
  .roue:not(.is-fini):not(.is-tourne) .roue-go,
  .roue.is-tourne .roue-amp, .roue.is-gagne .roue-amp, .roue-seg.is-gagnant,
  .roue-res, .roue-onde { animation: none; }
  .roue-onde { display: none; }
}

/* Refus (déjà joué, réseau) : le disque s'estompe, aucune case n'est mise en avant. */
.roue.is-refuse .roue-svg { filter: grayscale(.85) opacity(.55); transition: filter .4s ease; }
