/* =====================================================================
   GACHA.CSS — Vue Tirage (invocation façon gacha)

   Structure HTML (dans index.html) :
     <section id="gacha-view" class="game-view gacha-view">
       .gacha-bg / .gacha-shade / .gacha-particles   -> décor (salle du trône)
       #gacha-banner   -> grande bannière (+ objet du pool + pity)
       #gacha-slots    -> les 4 bannières sélectionnables (droite)
       #gacha-pulls    -> boutons Tirage x1 / x10
       #gacha-info     -> "Tu as N tickets · X / 190 tirages cette semaine"
       #gacha-rates-btn-> bouton "Taux de tirage"
     </section>
   Tout le contenu est généré par js/gacha.js. Les fenêtres (taux, erreurs)
   réutilisent les styles .shop-modal / .shop-btn de shop.css.
   Dimensions pensées pour le cadre fixe 1600x900 (voir scale.js).
   ===================================================================== */

/* ---------- 1. DÉCOR ---------- */
.gacha-view { overflow: hidden; }
.gacha-bg {
  position: absolute; inset: 0;
  background: url('../assets/images/bg-gacha.webp') center 45% / cover no-repeat;
}
/* Voile sombre pour la lisibilité (plus fort en haut et en bas) */
.gacha-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6,4,14,.55) 0%, rgba(6,4,14,.10) 22%, rgba(6,4,14,.10) 60%, rgba(6,4,14,.70) 100%),
    radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(6,4,14,.45) 100%);
}
.gacha-particles { z-index: 1; }
.gacha-view .ol, .gacha-stage .ol, .shop-modal .gacha-ico .ol { stroke: var(--void, #090811); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

/* ---------- 2. GRANDE BANNIÈRE (gauche) ---------- */
.gacha-banner {
  position: absolute; left: 104px; top: 132px; width: 998px; height: 438px; z-index: 5;
  padding: 3px; /* épaisseur du cadre doré */
  background: linear-gradient(160deg, #fff1b8, #d8a83e 40%, #7a4a10 75%, #d8a83e);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  filter: drop-shadow(0 14px 26px rgba(0,0,0,.55));
}
.gacha-banner-inner {
  position: relative; width: 100%; height: 100%; overflow: hidden; background: #0a0620;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
}
.gacha-banner-inner img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Reflet lumineux qui traverse la bannière de temps en temps */
.gacha-banner-inner::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 120px; left: -200px; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  transform: skewX(-18deg); animation: gacha-shine 7s ease-in-out 2s infinite;
}
@keyframes gacha-shine { 0%, 70% { left: -200px; } 100% { left: 1100px; } }

/* Bandeau du bas : objet du pool (gauche) + pity (droite) */
.gacha-banner-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 74px; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; z-index: 2;
  background: linear-gradient(0deg, rgba(6,4,20,.92), rgba(6,4,20,.6) 70%, transparent);
}
.gacha-pool { display: flex; align-items: center; gap: 12px; }
.gacha-pool .gacha-ico { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #3a2a72, #180f3c 60%, #0a0620);
  box-shadow: 0 0 0 2px var(--gold-light), 0 0 0 4px rgba(9,8,17,.9), 0 0 14px 2px rgba(255,215,106,.5); }
.gacha-ico svg { width: 30px; height: 30px; }
.gacha-bar-label { display: block; font: 700 12px "Montserrat"; letter-spacing: 1.6px; color: var(--gold-light); }
.gacha-bar-main  { display: block; font: 700 16px "Cinzel", serif; color: var(--cream); text-shadow: 0 2px 6px #000; }
.gacha-bar-main em { font-style: normal; color: var(--gold-light); font-size: 13px; margin-left: 6px; }

.gacha-pity { width: 300px; }
.gacha-pity-top { display: flex; justify-content: space-between; align-items: baseline; }
.gacha-pity-top b { font: 800 15px "Cinzel", serif; color: #fff; }
.gacha-pity-track { height: 9px; margin: 5px 0 4px; border-radius: 6px; background: rgba(0,0,0,.6); border: 1px solid rgba(216,168,62,.5); overflow: hidden; }
.gacha-pity-fill { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #7a3fb0, #c95cff 55%, #ffe18a); box-shadow: 0 0 10px rgba(201,92,255,.7); transition: width .6s ease; }
.gacha-pity small { font-size: 12px; color: var(--muted); }

/* ---------- 3. BANNIÈRES SÉLECTIONNABLES (droite) ---------- */
.gacha-slots { position: absolute; left: 1174px; top: 132px; width: 376px; z-index: 5; display: flex; flex-direction: column; gap: 14px; }
.gacha-slot {
  position: relative; height: 132px; padding: 2px; text-align: left; overflow: visible;
  background: rgba(216,168,62,.45);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform .2s ease, filter .2s ease;
}
.gacha-slot-inner { display: block; position: relative; width: 100%; height: 100%; overflow: hidden; background: #0c0818;
  clip-path: polygon(11px 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%, 0 11px); }
.gacha-slot img { width: 100%; height: 100%; object-fit: cover; object-position: center 15%; display: block; }
@media (hover: hover) {
  /* Souris uniquement : au doigt il n'y a pas de survol, l'effet resterait "collé" après un appui */
  .gacha-slot:hover { transform: translateX(-6px); }
}
.gacha-slot.is-active { background: linear-gradient(160deg, #fff1b8, #d8a83e 50%, #a8741f); transform: translateX(-10px); filter: drop-shadow(0 0 14px rgba(255,215,106,.55)); }
/* Petite gemme dorée sur le bord gauche de la bannière active */
.gacha-slot.is-active::before { content: ""; position: absolute; left: 6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; z-index: 3;
  transform: rotate(45deg); background: linear-gradient(135deg, #fff1b8, #d8a83e); border: 1.5px solid var(--void); }
.gacha-slot-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 14px 8px; z-index: 2;
  font: 700 12px "Cinzel", serif; color: var(--cream); text-shadow: 0 2px 6px #000; background: linear-gradient(0deg, rgba(6,4,20,.9), transparent); }
/* Emplacements vides : "Bientôt" */
.gacha-slot.is-locked .gacha-slot-inner { display: grid; place-items: center; align-content: center; gap: 6px;
  background:
    repeating-linear-gradient(45deg, rgba(216,168,62,.06) 0 8px, transparent 8px 16px),
    radial-gradient(circle at 50% 30%, rgba(70,40,130,1), rgba(10,7,20,1)); }
.gacha-slot.is-locked svg { width: 34px; height: 34px; opacity: .8; }
.gacha-slot.is-locked b { font: 700 14px "Cinzel", serif; color: var(--cream); }
.gacha-slot.is-locked small { font-size: 12px; letter-spacing: 1.5px; color: var(--gold-light); text-transform: uppercase; }
.gacha-slot.is-shake { animation: shop-shake .4s ease; }

/* ---------- 4. BOUTONS DE TIRAGE ---------- */
.gacha-pulls { position: absolute; left: 104px; top: 590px; z-index: 5; display: flex; gap: 16px; }
.gacha-pull {
  position: relative; width: 300px; height: 82px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: linear-gradient(160deg, rgba(48,30,98,.96), rgba(12,9,26,.96));
  border: 1px solid rgba(185,200,255,.6); color: var(--cream);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  box-shadow: 0 8px 20px rgba(0,0,0,.5); transition: transform .15s ease, filter .15s ease, border-color .15s ease;
}
.gacha-pull::before { content: ""; position: absolute; inset: 3px; pointer-events: none; border: 1px solid rgba(216,168,62,.2);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px); }
.gacha-pull .gp-title { font: 800 19px "Cinzel", serif; letter-spacing: 1px; }
.gacha-pull .gp-cost { display: flex; align-items: center; gap: 6px; font: 600 12.5px "Montserrat"; color: var(--gold-light); }
.gacha-pull .gp-cost svg { width: 20px; height: 20px; }
.gacha-pull.is-low .gp-cost { color: #ff8a98; }
/* Le tirage x10 (le plus avantageux) est doré */
.gacha-pull--ten { background: linear-gradient(160deg, rgba(120,80,18,.96), rgba(30,16,4,.97)); border-color: var(--gold-light);
  box-shadow: 0 8px 20px rgba(0,0,0,.5), 0 0 18px rgba(216,168,62,.4); }
.gacha-pull--ten .gp-title { color: #fff1b8; }
.gacha-pull em { position: absolute; top: -1px; right: 12px; padding: 2px 8px; font: 800 12px "Montserrat"; font-style: normal; color: #2a1a04;
  background: linear-gradient(180deg, #fff1b8, #d8a83e); }
@media (hover: hover) {
  /* Souris uniquement : au doigt il n'y a pas de survol, l'effet resterait "collé" après un appui */
  .gacha-pull:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.15); }
}
.gacha-pull:active:not(:disabled) { transform: scale(.97); }
.gacha-pull:disabled { cursor: default; filter: grayscale(.7) brightness(.6); }

.gacha-info { position: absolute; left: 104px; top: 686px; z-index: 5; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--cream); text-shadow: 0 1px 5px #000, 0 0 8px #000; }
.gacha-info svg { width: 20px; height: 20px; }
.gacha-info b { color: var(--gold-light); }
.gacha-info i { font-style: normal; color: var(--muted); }

.gacha-rates-btn {
  position: absolute; left: 104px; top: 720px; z-index: 5; height: 38px; padding: 0 18px 0 14px; display: flex; align-items: center; gap: 8px;
  font: 700 12px "Cinzel", serif; letter-spacing: 1px; color: var(--gold-light); text-transform: uppercase;
  background: rgba(12,9,22,.88); border: 1px solid rgba(216,168,62,.55);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
  transition: transform .15s, border-color .15s, background .15s;
}
.gacha-rates-btn svg { width: 16px; height: 16px; }
@media (hover: hover) {
  /* Souris uniquement : au doigt il n'y a pas de survol, l'effet resterait "collé" après un appui */
  .gacha-rates-btn:hover { transform: translateX(4px); border-color: var(--gold-light); background: rgba(30,20,48,.95); }
}

/* ---------- 5. ANIMATIONS D'ENTRÉE (pendant la transition de vue) ---------- */
.gacha-view.is-entering .gacha-bg { animation: shop-bg-in 1.1s cubic-bezier(.22,.61,.36,1) both; }
.gacha-view.is-entering .gacha-banner { animation: shop-slide-in .6s cubic-bezier(.22,.61,.36,1) both; animation-delay: .25s; }
.gacha-view.is-entering .gacha-slot { animation: gacha-from-right .5s cubic-bezier(.22,.61,.36,1) both; animation-delay: calc(var(--i) * 80ms + 300ms); }
.gacha-view.is-entering .gacha-pulls,
.gacha-view.is-entering .gacha-info,
.gacha-view.is-entering .gacha-rates-btn { animation: shop-rise .5s ease both; animation-delay: .55s; }
@keyframes gacha-from-right { from { opacity: 0; translate: 40px 0; } to { opacity: 1; translate: 0 0; } }

/* ---------- 6. SCÈNE D'INVOCATION + RÉVÉLATION (plein cadre) ---------- */
.gacha-stage { position: absolute; inset: 0; z-index: 96; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, rgba(28,14,60,.985), rgba(4,3,10,1) 75%); animation: shop-fade .3s ease; }
.gacha-stage[hidden] { display: none; }

/* Orbe qui se charge, puis éclate dans la couleur de la rareté */
.gacha-summon { position: absolute; inset: 0; display: grid; place-items: center; --c: #b678ff; cursor: pointer; }
.gacha-rays { position: absolute; width: 900px; height: 900px; border-radius: 50%; opacity: .55;
  background: repeating-conic-gradient(from 0deg, var(--c) 0 5deg, transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 68%); mask: radial-gradient(circle, #000 0%, transparent 68%);
  animation: gacha-spin 6s linear infinite, gacha-rays-in 1.6s ease-in both; }
.gacha-orb { position: relative; width: 190px; height: 190px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #fff 0%, var(--c) 40%, rgba(20,8,50,.9) 72%);
  box-shadow: 0 0 60px 14px var(--c), inset 0 0 40px rgba(255,255,255,.5);
  animation: gacha-charge 1.6s cubic-bezier(.5,0,.8,.6) both; }
/* La banane de l'orbe se balance et pulse pendant la charge (au lieu de tourner comme l'ancienne étoile) */
.gacha-orb svg { width: 104px; height: 104px; filter: drop-shadow(0 0 10px rgba(255,225,138,.85)); animation: gacha-banana-wobble 1.1s ease-in-out infinite; }
@keyframes gacha-banana-wobble { 0%, 100% { transform: rotate(-14deg) scale(.94); } 50% { transform: rotate(14deg) scale(1.1); } }
.gacha-summon.is-burst .gacha-orb { animation: gacha-burst .6s ease-out both; }
.gacha-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.gacha-summon.is-burst .gacha-flash { animation: gacha-flash .6s ease-out; }
.gacha-skip-hint { position: absolute; bottom: 60px; font-size: 12px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; animation: gacha-blink 1.4s ease-in-out infinite; }
@keyframes gacha-spin   { to { transform: rotate(360deg); } }
@keyframes gacha-rays-in{ from { opacity: 0; transform: scale(.4); } to { opacity: .55; transform: scale(1); } }
@keyframes gacha-charge { 0% { transform: scale(.25); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.05); } }
@keyframes gacha-burst  { 0% { transform: scale(1.05); } 100% { transform: scale(9); opacity: 0; } }
@keyframes gacha-flash  { 0% { opacity: .95; } 100% { opacity: 0; } }
@keyframes gacha-blink  { 50% { opacity: .3; } }

/* Zone de résultat */
.gacha-result { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding-top: 30px; }
.gacha-result h2 { margin: 0; font: 800 26px "Cinzel", serif; letter-spacing: 3px; color: var(--gold-light); text-shadow: 0 0 18px rgba(255,215,106,.5); }
.gacha-cards { display: grid; grid-template-columns: repeat(5, 172px); gap: 16px; justify-content: center; }
.gacha-cards.is-single { grid-template-columns: 250px; }
.gacha-actions { display: flex; gap: 14px; min-height: 40px; }
.gacha-actions .shop-btn { min-width: 170px; height: 42px; }

/* Carte de récompense : retournée au fur et à mesure (3D) */
.gacha-card { --accent: #9fb0d0; --glow: rgba(159,176,208,.4); position: relative; height: 236px; perspective: 900px; }
.is-single .gacha-card { height: 330px; }
.gacha-card[data-rarity="rare"]      { --accent: #6d97ff; --glow: rgba(109,151,255,.5); }
.gacha-card[data-rarity="epic"]      { --accent: #b678ff; --glow: rgba(182,120,255,.55); }
.gacha-card[data-rarity="legendary"] { --accent: #ffd76a; --glow: rgba(255,215,106,.7); }
.gacha-card-flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3,.9,.3,1.1); }
.gacha-card.is-flipped .gacha-card-flip { transform: rotateY(180deg); }
.gacha-face, .gacha-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px); }
.gacha-back { display: grid; place-items: center; background: linear-gradient(160deg, #3a2270, #150c2e); border: 2px solid rgba(216,168,62,.7); }
/* Dos des cartes : une banane dorée, légèrement penchée */
.gacha-back svg { width: 86px; height: 86px; transform: rotate(-18deg); filter: drop-shadow(0 0 8px rgba(255,225,138,.6)); }
.gacha-face { transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; text-align: center;
  background: radial-gradient(circle at 50% 30%, var(--glow), transparent 60%), linear-gradient(170deg, #2a1a52, #0c0818);
  border: 2px solid var(--accent); box-shadow: inset 0 0 26px var(--glow); }
.gacha-face .gacha-ico { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #3a2a72, #180f3c 60%, #0a0620); box-shadow: 0 0 0 3px var(--accent), 0 0 20px 3px var(--glow); }
.gacha-face .gacha-ico svg { width: 52px; height: 52px; }
.is-single .gacha-face .gacha-ico { width: 130px; height: 130px; }
.is-single .gacha-face .gacha-ico svg { width: 82px; height: 82px; }
.gacha-face h3 { margin: 0; font: 700 14px/1.2 "Cinzel", serif; color: var(--cream); }
.is-single .gacha-face h3 { font-size: 20px; }
.gacha-face .gacha-qty { font: 800 18px "Cinzel", serif; color: var(--accent); }
.is-single .gacha-face .gacha-qty { font-size: 26px; }
.gacha-face .gacha-rar { font: 700 12px "Montserrat"; letter-spacing: 1.6px; color: var(--accent); text-transform: uppercase; }
.gacha-card.is-flipped { animation: gacha-pop .5s ease .25s; }
.gacha-card.is-flipped[data-rarity="legendary"] { animation: gacha-legend 1s ease .25s; }
@keyframes gacha-pop    { 50% { transform: scale(1.07); } }
@keyframes gacha-legend { 0%,100% { transform: scale(1); filter: none; } 30% { transform: scale(1.12); filter: drop-shadow(0 0 26px #ffd76a) brightness(1.3); } }

/* Tableau des taux (fenêtre "Taux de tirage") */
.gacha-rates { width: 560px; }
.gacha-rate-row { display: grid; grid-template-columns: 110px 60px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(216,168,62,.15); font-size: 12px; color: var(--muted); }
.gacha-rate-row b { font: 800 12px "Cinzel", serif; }
.gacha-rate-row b.r-common { color: #b8c4dc; } .gacha-rate-row b.r-rare { color: #6d97ff; }
.gacha-rate-row b.r-epic { color: #b678ff; }   .gacha-rate-row b.r-legendary { color: #ffd76a; }
.gacha-rate-row span:nth-child(2) { color: var(--cream); font-weight: 700; }
.gacha-rates ul { margin: 12px 0 18px; padding-left: 18px; font-size: 12px; line-height: 1.6; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .gacha-view *, .gacha-stage * { animation-duration: .01s !important; animation-delay: 0s !important; transition: none !important; }
}
