/* Écran d'ouverture en plein écran. --c = couleur du pack. */
#overlay.scene { --c: #8f6bff; user-select: none; display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden auto;
  background: #06060a; }
.scene-sign { position: fixed; right: -4vw; bottom: -8vh; z-index: 0; font-size: min(70vh, 55vw); font-weight: 900; line-height: 1; color: transparent; -webkit-text-stroke: 1.5px color-mix(in srgb, var(--c) 42%, transparent); pointer-events: none; user-select: none; }
body:has(#overlay.scene:not([hidden])) { overflow: hidden; }
.particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.particles i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: var(--c); opacity: 0; animation: rise 7s linear infinite; }
@keyframes rise { 25% { opacity: .7; } to { transform: translateY(-28vh); opacity: 0; } }

.scene-bar { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 14px 18px; }
.scene-back { justify-self: start; background: none; border: 0; color: #c9c7d8; font-weight: 700; }
.scene-title { display: flex; align-items: center; gap: 10px; }
.scene-title b { font-size: 24px; color: var(--c); }
.scene-title h2 { margin: 0; font-size: 20px; }
.scene-tools { justify-self: end; display: flex; align-items: center; gap: 10px; }
.scene-wallet { display: flex; padding: 9px 4px; border-radius: 99px; background: #ffffff10; border: 1px solid #ffffff1c; font-weight: 800; white-space: nowrap; }
.scene-wallet span { padding: 0 12px; }
.scene-wallet span + span { border-left: 1px solid #ffffff22; }
.round { width: 44px; height: 44px; border-radius: 50%; background: #ffffff10; border: 1px solid #ffffff1c; }

.scene-stage { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 16px 20px; text-align: center; }
.hint { margin: 0; color: #aaa7ba; }
.pity { margin: 0; color: #8d899e; font: 13px ui-monospace, Consolas, monospace; }

/* Booster en 3D qui flotte */
.pedestal { display: flex; flex-direction: column; align-items: center; perspective: 1100px; }
.float { transform-style: preserve-3d; animation: float 5s ease-in-out infinite; }
.float.held { animation-play-state: paused; }
.float.opening { animation: none; }
@keyframes float { 0%, 100% { transform: translateY(0) rotateY(-9deg) rotateX(2deg); } 50% { transform: translateY(-12px) rotateY(9deg) rotateX(-1deg); } }
.booster { position: relative; height: clamp(250px, 56vh, 540px); aspect-ratio: 2 / 3; max-width: 86vw; user-select: none; --cut: 15%; }
.booster-top, .booster-body { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.booster-top { clip-path: inset(0 0 85% 0); transform-origin: 80% 10%; }
.booster-body { clip-path: inset(15% 0 0 0); }
.booster-theme { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); padding: 2px 14px; border-radius: 99px; white-space: nowrap; background: #062a1cee; border: 1px solid #2ee88a; font-size: 13px; font-weight: 800; }
.shadow { width: 190px; height: 20px; margin-top: 14px; border-radius: 50%; background: #000; filter: blur(9px); }

/* Ligne à déchirer et point blanc */
.cut-zone { position: absolute; left: 4%; right: 4%; top: calc(var(--cut) - 28px); height: 56px; cursor: grab; touch-action: none; }
.cut-zone::before { content: ''; position: absolute; left: 0; right: 0; top: 27px; border-top: 2px dashed #ffffffb0; }
.cut-line { position: absolute; top: 25px; left: 0; width: 0; height: 6px; border-radius: 6px; background: #fff; box-shadow: 0 0 14px 3px #fff; }
.handle { position: absolute; top: 18px; left: 5%; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px #ffffff35, 0 0 16px 4px #fff; pointer-events: none; animation: slide 2.2s ease-in-out infinite; }
@keyframes slide { 50% { margin-left: 34px; } }
.held .handle { animation: none; }
.booster.torn .cut-zone, .booster.torn .booster-theme { display: none; }
.booster.torn .booster-top { animation: tear-top .75s ease-in forwards; }
.booster.torn .booster-body { animation: drop .45s .35s ease-in forwards; }
@keyframes tear-top { to { transform: translate(90px, -90px) rotate(24deg); opacity: 0; } }
@keyframes drop { to { transform: translateY(70px); opacity: 0; } }

.quantity { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: #12121a; border: 1px solid #ffffff1c; }
.quantity button { min-width: 66px; padding: 8px 14px; border: 0; border-radius: 99px; background: none; color: #c9c7d8; font-weight: 800; }
.quantity button.on { background: var(--c); color: #0c0a10; }
.open-btn { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-width: 240px; padding: 12px 30px; border: 0; border-radius: 99px; background: var(--c); color: #0c0a10; font-weight: 900; font-size: 18px; }
.open-btn small { padding-left: 14px; border-left: 1px solid #0003; font: 700 13px ui-monospace, Consolas, monospace; }

.scene .single { width: min(300px, 70vw, 40vh); }
.scene .reveal { max-width: 1000px; width: 100%; margin: auto; align-self: center; }

@media (max-width: 700px) {
  .scene-bar { grid-template-columns: 1fr auto; padding: 10px 12px; }
  .scene-title { grid-row: 2; grid-column: 1 / -1; justify-content: center; }
  .scene .slot { width: 30%; }
}

/* ---------- Le halo de la déchirure : à la couleur de la plus grosse rareté, il monte depuis la déchirure ---------- */
.burst { position: absolute; left: 0; right: 0; top: var(--cut); bottom: 0; z-index: 6; pointer-events: none; }
.burst::before, .burst i { content: ''; position: absolute; opacity: 0; }
/* le trait de lumière sur la déchirure */
.burst::before { left: 6%; right: 6%; top: -2px; height: 4px; border-radius: 99px; background: #fff;
  box-shadow: 0 0 10px 3px var(--rc), 0 0 22px 6px color-mix(in srgb, var(--rc) 55%, transparent);
  animation: trait 1.5s ease-out forwards; }
/* la montée de lumière, de la déchirure vers le haut */
.burst i { left: 10%; right: 10%; bottom: 100%; height: 46%; transform-origin: 50% 100%;
  background: linear-gradient(0deg, #fff, var(--rc) 14%, color-mix(in srgb, var(--rc) 45%, transparent) 55%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28% 72%, transparent); mask-image: linear-gradient(90deg, transparent, #000 28% 72%, transparent);
  animation: coulee 1.5s cubic-bezier(.3, .6, .4, 1) forwards; }
@keyframes trait { 0% { opacity: 0; transform: scaleX(.2); } 14% { opacity: 1; transform: scaleX(1); } 60% { opacity: .9; } 100% { opacity: 0; transform: scaleX(.8); } }
@keyframes coulee { 0% { opacity: 0; transform: translateY(0) scaleY(0); } 18% { opacity: .9; } 62% { opacity: .75; transform: translateY(0) scaleY(1); } 100% { opacity: 0; transform: translateY(-32%) scaleY(1); } }

/* ---------- Révélation, une carte à la fois ---------- */
.scene-stage.revelation { gap: 6px; }
.compte { position: absolute; left: 20px; top: 0; margin: 0; color: #8d899e; font: 700 20px ui-monospace, Consolas, monospace; }
.compte b { color: #fff; font: italic 900 38px var(--titre); }
.paquet { position: relative; width: min(330px, 68vw, 34vh); aspect-ratio: 5 / 7; margin: 16px 0 12px; touch-action: pan-y; }
.paquet::before { content: ''; position: absolute; inset: -16px; border: 1px dashed #ffffff22; border-radius: 28px; pointer-events: none; }
/* la lumière douce derrière la carte, à sa couleur */
.paquet::after { content: ''; position: absolute; inset: -22% -38%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rc) 34%, transparent), transparent); }
.paquet .dessous { position: absolute; inset: 0; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--rc) 55%, #22202c); background: #14121c;
  transform: translate(calc(var(--n) * 6px), calc(var(--n) * -6px)) rotate(calc(var(--n) * .7deg)); }
.paquet .single { position: relative; width: 100%; margin: 0; perspective: 1100px; }
/* la carte arrive de dos : elle ne se retourne que quand le joueur le demande */
.tourne { position: relative; transform-style: preserve-3d; transform: rotateY(180deg); transition: transform .45s cubic-bezier(.3, .7, .3, 1); cursor: pointer; }
.tourne.retournee { transform: rotateY(0deg); }
.face-avant, .face-dos { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face-dos { position: absolute; inset: 0; transform: rotateY(180deg); }
.face-dos .back { display: block; height: 100%; }
.face-avant .card:hover { transform: none; }
.carte-infos { min-height: 104px; }
.carte-infos.cachee { visibility: hidden; }
.carte-infos p, .carte-infos h3 { margin: 0; }
.carte-rarete { color: var(--rc); font: 900 15px var(--titre); text-transform: uppercase; letter-spacing: .06em; }
.carte-infos h3 { font: italic 900 clamp(20px, 3.6vh, 32px) var(--titre); line-height: 1.15; }
.carte-serie { color: #aaa7ba; font-size: 14px; }
.carte-nouvelle { color: var(--gold, #ffc83d); font-weight: 900; }
.carte-doublon { color: #4fd8f0; font-weight: 800; }
.vignettes { display: flex; gap: 7px; max-width: 92vw; padding: 4px; overflow-x: auto; scrollbar-width: none; }
.vignettes span { flex: none; width: 31px; height: 43px; overflow: hidden; border-radius: 5px; border: 1px solid #ffffff1c; background: #14121c; }
.vignettes span.vue { border: 2px solid var(--rc); background: color-mix(in srgb, var(--rc) 30%, #14121c); }
.vignettes img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.suite { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px; }
.suite-aide { padding: 6px; border: 0; background: none; color: #8d899e; font-size: 14px; }
.suite-tout, .recap-bouton { padding: 12px 22px; border: 1px solid #ffffff26; border-radius: 99px; background: #14141d; color: #fff; font-weight: 800; }
.suite-tout:hover, .recap-bouton:hover { border-color: var(--c); }
.suite-clavier { margin: 0; color: #6c687d; font: 12px ui-monospace, Consolas, monospace; }
@media (hover: none) { .suite-clavier { display: none; } }

/* ---------- Récapitulatif en éventail ---------- */
.scene-stage.recap { justify-content: flex-start; gap: 14px; padding-bottom: 40px; }
.recap > :not(.recap-halo) { position: relative; flex: none; }
.recap-halo { position: absolute; left: 50%; top: 80px; width: min(900px, 100%); height: min(520px, calc(100% - 80px)); transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rc) 80%, transparent), color-mix(in srgb, var(--rc) 34%, transparent) 55%, transparent); }
.recap-titre { margin: 6px 0 0; font: italic 900 clamp(28px, 5vw, 50px) var(--titre); text-transform: uppercase; }
.recap-bilan { margin: 0; padding: 6px 16px; border-radius: 99px; background: #0000008c; font-size: 14px; }
.eventail-prises { display: flex; justify-content: center; align-items: center; width: 100%; padding: 44px 0 30px; }
.eventail-prises .prise { position: relative; flex: none; width: min(200px, 18.5vw); margin: 0 -2px;
  transform: translateY(calc(var(--ecart) * var(--ecart) * 11px)) rotate(calc(var(--ecart) * 5.5deg));
  animation: arrive .45s ease-out both; }
.eventail-prises .prise.meilleure { width: min(240px, 22vw); z-index: 2; }
.eventail-prises .meilleure .card { box-shadow: 0 0 34px color-mix(in srgb, var(--rc) 80%, transparent); }
@keyframes arrive { from { opacity: 0; translate: 0 36px; } }
.prise { position: relative; }
.prise .card:hover { transform: none; }
.prise-badges { position: absolute; left: 0; right: 0; top: -13px; z-index: 5; display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; transform: translateY(calc(-100% + 26px)); pointer-events: none; }
.badge-nouveau, .badge-meilleure { padding: 2px 11px; border-radius: 99px; font-size: 12px; font-weight: 900; white-space: nowrap; box-shadow: 0 3px 10px #0009; }
.badge-nouveau { background: #fff; color: #14101f; }
.badge-meilleure { background: #14101f; border: 1px solid var(--rc); color: var(--rc); }
.recap .reveal { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 12px; width: 100%; max-width: 1000px; margin: 0 0 6px; }
.recap .reveal .prise { width: 124px; }
.recap-boutons { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
/* Sur ordinateur, le récap tient dans la hauteur de l'écran : les cartes rapetissent avec la fenêtre. */
@media (min-width: 641px) {
  .scene-stage.recap { gap: clamp(6px, 1.4vh, 14px); padding-bottom: 14px; }
  .recap-titre { margin: 0; font-size: clamp(24px, min(5vw, 5.5vh), 50px); }
  .eventail-prises { padding: clamp(26px, 5vh, 44px) 0 clamp(12px, 2.8vh, 30px); }
  .eventail-prises .prise { width: min(200px, 18.5vw, 23vh); }
  .eventail-prises .prise.meilleure { width: min(240px, 22vw, 27.5vh); }
}
/* Fenêtre basse (petit portable) : on resserre aussi le sachet, la carte et la barre du haut. */
@media (min-width: 641px) and (max-height: 680px) {
  .scene-bar { padding: 8px 18px; }
  .scene-stage { gap: 7px; padding-bottom: 8px; }
  .booster { height: clamp(230px, 49vh, 540px); }
  .paquet { width: min(330px, 68vw, 29vh); margin: 14px 0 8px; }
  .carte-infos { min-height: 92px; }
  .scene-stage.recap { gap: 6px; padding-bottom: 8px; }
  .eventail-prises { padding: 28px 0 10px; }
  .eventail-prises .prise { width: min(200px, 18.5vw, 20vh); }
  .eventail-prises .prise.meilleure { width: min(240px, 22vw, 24vh); }
}
@media (max-width: 640px) {
  .compte { left: 14px; font-size: 15px; }
  .compte b { font-size: 26px; }
  .eventail-prises { padding: 40px 0 24px; }
  .eventail-prises .prise { width: 22vw; margin: 0 -3.4vw; }
  .eventail-prises .prise.meilleure { width: 33vw; margin: 0 -2vw; }
  .eventail-prises .badge-nouveau, .eventail-prises .badge-meilleure { padding: 1px 7px; font-size: 10px; }
  .recap .reveal .prise { width: 29%; }
}
