/* L'ouverture d'une pochette : la scene plein ecran. */

#scene {
  position: fixed; inset: 0; z-index: 50; overflow: hidden; background: #04060c; color: #fff;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  --lueur: #ffcf4a; --pack: #d4ab3a;
}

/* ---------------------------------------------------------------- le decor -- */
.s-fond {
  position: absolute; inset: 0; transition: filter .7s ease;
  background:
    radial-gradient(ellipse 90% 60% at 50% 108%, rgba(34, 66, 140, .55), transparent 70%),
    radial-gradient(ellipse 70% 45% at 50% -12%, rgba(30, 52, 120, .5), transparent 70%),
    #04060c;
}
.s-faisceau {
  position: absolute; top: -8%; width: 60vmax; height: 150vmax; transform-origin: 50% 0;
  background: linear-gradient(180deg, rgba(190, 215, 255, .2), rgba(190, 215, 255, .05) 55%, transparent 80%);
  clip-path: polygon(47% 0, 53% 0, 100% 100%, 0 100%);
  mix-blend-mode: screen; pointer-events: none; opacity: .75; transition: opacity .8s ease;
}
.f1 { left: calc(16% - 30vmax); animation: balaie-a 7s ease-in-out infinite alternate; }
.f2 { right: calc(16% - 30vmax); animation: balaie-b 8.5s ease-in-out infinite alternate; }
@keyframes balaie-a { from { transform: rotate(-27deg); } to { transform: rotate(-9deg); } }
@keyframes balaie-b { from { transform: rotate(25deg); } to { transform: rotate(7deg); } }
.s-tribune {
  position: absolute; left: 0; right: 0; top: 0; height: 48%; opacity: .2;
  background-image: radial-gradient(circle, rgba(200, 220, 255, .55) .8px, transparent 1.5px);
  background-size: 11px 9px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 35%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 35%, transparent 100%);
}
.s-sol {
  position: absolute; left: -20%; right: -20%; bottom: -34%; height: 62%;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(60, 110, 220, .28), transparent 70%);
}
#scene.walk .s-fond { filter: brightness(.6) saturate(1.25); }
#scene.walk .s-faisceau {
  opacity: 1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--lueur) 50%, transparent),
    color-mix(in srgb, var(--lueur) 10%, transparent) 55%, transparent 82%);
  animation-duration: 2.6s;
}
#scene.walk .f1 { left: calc(34% - 30vmax); }
#scene.walk .f2 { right: calc(34% - 30vmax); }

.s-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 7; pointer-events: none; }
.s-eclair { position: absolute; inset: 0; z-index: 8; opacity: 0; pointer-events: none; mix-blend-mode: screen; }

.s-haut {
  position: absolute; top: 0; left: 0; right: 0; z-index: 9;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--haut)) 16px 0; pointer-events: none;
}
.s-titre {
  font-family: var(--police-titre); font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  font-size: 13px; color: rgba(255, 255, 255, .6);
}
.s-passer {
  pointer-events: auto; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
  color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 13px; cursor: pointer;
}

/* ------------------------------------------------------------- la pochette -- */
.s-pochette {
  position: absolute; inset: 0; z-index: 3; cursor: pointer;
  display: grid; place-content: center; justify-items: center; gap: 26px;
}
.s-poch {
  position: relative; width: min(52vw, 32vh, 250px); aspect-ratio: 200 / 280;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .6))
    drop-shadow(0 0 36px color-mix(in srgb, var(--pack) 55%, transparent));
}
.s-poch svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.s-poch-haut, .s-poch-bas {
  position: absolute; inset: 0;
  transition: transform .45s cubic-bezier(.3, .6, .3, 1), opacity .4s ease;
}
.s-poch-haut { clip-path: inset(0 0 87% 0); }
.s-poch-bas { clip-path: inset(13% 0 0 0); }
.s-pochette.pret .s-poch { animation: flotte 2.4s ease-in-out infinite; }
@keyframes flotte {
  0%, 100% { translate: 0 0; rotate: -1.5deg; }
  50% { translate: 0 -10px; rotate: 1.5deg; }
}
.pochette-reflet { animation: reflet 3.2s ease-in-out infinite; }
@keyframes reflet {
  0% { transform: skewX(-18deg) translateX(0); }
  55%, 100% { transform: skewX(-18deg) translateX(340px); }
}
.s-pochette.dechiree .s-poch { animation: none; }
.s-pochette.dechiree .s-poch-haut { transform: translate(36%, -130%) rotate(30deg); opacity: 0; }
.s-pochette.dechiree .s-poch-bas { transform: translateY(24%) scale(.9); opacity: 0; }
.s-jet {
  position: absolute; left: 6%; right: 6%; bottom: 87%; height: 0; opacity: 0; pointer-events: none;
  background: linear-gradient(0deg, #fff, color-mix(in srgb, var(--lueur) 85%, transparent) 30%, transparent);
  filter: blur(9px);
}
.s-pochette.dechiree .s-jet { animation: jet .5s ease-out forwards; }
@keyframes jet { 0% { height: 0; opacity: 1; } 60% { opacity: 1; } 100% { height: 130vh; opacity: 0; } }
.s-invite {
  margin: 0; font-family: var(--police-titre); letter-spacing: .22em; text-transform: uppercase;
  font-size: 13px; color: rgba(255, 255, 255, .8); opacity: 0; transition: opacity .3s ease;
}
.s-pochette.pret .s-invite { opacity: 1; animation: clignote 1.6s ease-in-out infinite; }
@keyframes clignote { 50% { opacity: .35; } }

/* ----------------------------------------------------------------- la table -- */
.s-table {
  position: absolute; left: 0; right: 0; top: 64px; bottom: 150px; z-index: 2;
  display: grid; grid-template-columns: repeat(var(--cols, 4), var(--w, 80px)); gap: var(--gap, 8px);
  justify-content: center; align-content: center; visibility: hidden;
}
@media (max-width: 559px) { .s-table { bottom: 190px; } }
.s-table.visible { visibility: visible; }
.s-case {
  position: relative; width: var(--w, 80px); aspect-ratio: 300 / 420; perspective: 700px;
  transition: opacity .4s ease, filter .4s ease;
}
.s-table.retrait .s-case:not(.vedette) { opacity: .08; filter: blur(2px); }
.s-case.vedette { z-index: 6; }
.s-pivot {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.35, .1, .25, 1.25);
}
.s-case.vu .s-pivot { transform: rotateY(180deg); }
.s-face-dos, .s-face-avant {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.s-face-avant { transform: rotateY(180deg); }
.s-case.lueur .s-face-dos {
  --coeur: .55;
  filter: drop-shadow(0 0 var(--force, 10px) var(--bord));
  animation: lueur .45s ease-in-out infinite alternate;
}
@keyframes lueur { to { filter: drop-shadow(0 0 calc(var(--force, 10px) * 2.3) var(--bord)); } }

.s-etiquette {
  position: absolute; left: 50%; bottom: -4px; translate: -50% 0; z-index: 2;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  font-size: clamp(8px, calc(var(--w, 80px) * .1), 12px); font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; opacity: 0; transition: opacity .3s ease .25s;
}
.s-case.vu .s-etiquette { opacity: 1; }
.s-etiquette.neuf { background: var(--accent); color: #04130d; }
.s-etiquette.doublon { background: #2a3552; color: #b9c4dd; }
.s-etiquette.vendue { background: #0b0f1a; color: #8792ad; }
.s-case.vendue .s-pivot { filter: none; }
.s-case.vendue { opacity: .3; filter: grayscale(1); }
.s-case.reine::before {
  content: ""; position: absolute; inset: -14%; z-index: -1; border-radius: 30%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--lueur) 60%, transparent), transparent);
  animation: bat 2s ease-in-out infinite;
}
@keyframes bat { 50% { opacity: .45; transform: scale(.94); } }
#scene.fini .s-case.vu { cursor: pointer; }

/* ------------------------------------------------------------------ l'entree -- */
.s-walk {
  position: absolute; inset: 0; z-index: 4; cursor: pointer;
  display: grid; grid-template-rows: auto 1fr auto auto; justify-items: center; align-items: center;
  gap: 10px; padding: calc(60px + var(--haut)) 16px calc(24px + var(--bas));
  animation: fondu .4s ease;
}
.s-walk.sort { opacity: 0; transition: opacity .35s ease; }

.w-flashs { position: absolute; inset: 0; pointer-events: none; }
.w-flashs i {
  position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; opacity: 0;
  box-shadow: 0 0 12px 4px rgba(255, 255, 255, .8); animation: flash 2.6s linear infinite;
}
@keyframes flash { 0%, 92%, 100% { opacity: 0; transform: scale(.4); } 94% { opacity: 1; transform: scale(1.5); } }

.w-indices { display: flex; gap: 8px; justify-content: center; width: 100%; max-width: 560px; min-height: 40px; }
.w-indice {
  display: flex; align-items: center; gap: 7px; min-width: 0; padding: 7px 11px; border-radius: 11px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .13); font-size: 13px;
  opacity: 0; transform: translateY(10px) scale(.8);
  transition: transform .34s cubic-bezier(.2, .9, .3, 1.3), opacity .25s ease;
}
.w-indice.range { opacity: 1; transform: none; }
.w-indice b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.w-drapeau { display: block; flex: none; width: 24px; height: 16px; border-radius: 2px; overflow: hidden; }
.w-drapeau svg, .w-ecu svg { width: 100%; height: 100%; display: block; }
.w-poste { font-family: var(--police-titre); font-weight: 800; font-size: 15px; color: var(--lueur); }
.w-ecu { display: block; flex: none; width: 18px; height: 21px; }

.w-centre {
  position: absolute; left: 50%; top: 44%; translate: -50% -50%; z-index: 3; pointer-events: none;
  display: grid; justify-items: center; gap: 16px; text-align: center; width: 92%;
  opacity: 0; transform: scale(1.7);
}
.w-centre.montre { opacity: 1; transform: none; transition: transform .32s cubic-bezier(.2, .9, .3, 1.35), opacity .14s ease; }
.w-centre.part { opacity: 0; transform: translateY(-28vh) scale(.3); transition: transform .26s ease-in, opacity .26s ease-in; }
.w-centre .w-drapeau { width: 168px; height: 112px; border-radius: 8px; box-shadow: 0 0 60px color-mix(in srgb, var(--lueur) 55%, transparent); }
.w-centre .w-poste { font-size: 104px; line-height: .9; text-shadow: 0 0 50px color-mix(in srgb, var(--lueur) 70%, transparent); }
.w-centre .w-ecu { width: 112px; height: 131px; filter: drop-shadow(0 0 34px color-mix(in srgb, var(--lueur) 55%, transparent)); }
.w-centre b {
  font-family: var(--police-titre); font-size: clamp(20px, 6vw, 30px); font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
}

.w-plateau { position: relative; width: min(62vw, 34vh, 320px); aspect-ratio: 300 / 420; }
.w-carte { position: absolute; inset: 0; opacity: 0; transform: translateY(46%) scale(.55); z-index: 1; }
.s-walk.revele .w-carte { animation: sortie 1s cubic-bezier(.16, .9, .25, 1.12) forwards; }
@keyframes sortie {
  0% { opacity: 0; transform: translateY(46%) scale(.55); filter: brightness(4); }
  30% { opacity: 1; }
  100% { opacity: 1; transform: none; filter: brightness(1); }
}
.w-rayons {
  position: absolute; left: 50%; top: 50%; width: 270%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; opacity: 0; animation: tourne 26s linear infinite;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--lueur) 32%, transparent) 0deg 7deg, transparent 7deg 20deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 22%, transparent 78%);
  mask-image: radial-gradient(closest-side, #000 22%, transparent 78%);
}
.s-walk.revele .w-rayons { opacity: .85; transition: opacity .8s ease .15s; }
.w-halo {
  position: absolute; left: 50%; top: 50%; width: 175%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--lueur) 55%, transparent), transparent 72%);
}
.s-walk.revele .w-halo { opacity: .9; transition: opacity .5s ease; animation: bat 2.4s ease-in-out infinite; }
.w-socle {
  position: absolute; left: -14%; right: -14%; bottom: -7%; height: 9%; border-radius: 50%;
  background: radial-gradient(closest-side, #fff, var(--lueur) 40%, transparent 75%);
  filter: blur(6px); opacity: .22; transition: opacity .5s ease;
}
.s-walk.revele .w-socle { opacity: 1; }

.w-legende {
  display: grid; gap: 4px; justify-items: center; text-align: center;
  opacity: 0; transform: translateY(14px); transition: opacity .5s ease .55s, transform .5s ease .55s;
}
.s-walk.revele .w-legende { opacity: 1; transform: none; }
.w-variante {
  font-family: var(--police-titre); letter-spacing: .3em; text-transform: uppercase;
  font-size: 12px; font-weight: 700; color: var(--lueur);
}
.w-nom {
  font-family: var(--police-titre); font-size: clamp(26px, 7vw, 44px); font-weight: 800;
  letter-spacing: .03em; text-transform: uppercase; line-height: 1.05;
  text-shadow: 0 0 30px color-mix(in srgb, var(--lueur) 60%, transparent);
}
.w-ligne { display: flex; gap: 12px; align-items: center; font-size: 17px; }
.w-tag { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.w-tag.neuf { background: var(--accent); color: #04130d; }
.w-tag.doublon { background: #2a3552; color: #b9c4dd; }
.w-invite { margin: 0; opacity: 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.s-walk.attend .w-invite { opacity: 1; animation: clignote 1.6s ease-in-out infinite; }

/* ------------------------------------------------------------------ le bilan -- */
.s-bas {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; gap: 12px; justify-items: center;
  padding: 14px 16px calc(14px + var(--bas));
  background: linear-gradient(0deg, rgba(4, 6, 12, .97) 62%, transparent);
  animation: monte .35s cubic-bezier(.2, .9, .3, 1);
}
.s-bilan { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; text-align: center; }
.s-bilan small { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--doux); }
.s-bilan b { font-family: var(--police-titre); font-size: 16px; white-space: nowrap; }
.s-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 640px; }
.s-actions .bouton { flex: 1 1 auto; }
@media (max-width: 559px) {
  .s-actions .bouton { font-size: 14.5px; padding: 8px 12px; }
  .s-actions .bouton[data-a="continuer"] { flex: 1 1 100%; order: 3; }
}
