/* PAGE
   (.page/.page__card/.page__header/.page__title/.page__back
   vivent dans main.css — ici juste la largeur specifique) */
.page{ --page-w: 1080px; }

.page__meta{
  max-width: 620px;
  line-height: 1.4;
}

.bingo{
  padding: 18px;
  display: grid;
  gap: 16px;
}

/* =========================
   TOOLBAR
========================= */
.bingoToolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(219,219,219,.12);
  background: rgba(12,15,16,.44);
  box-shadow: 0 16px 44px rgba(0,0,0,.30);
}

/* personnalisation des couleurs de case (cote joueur, hors menu troll) */
.bingoColorsPanel{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-top: -4px;
  border-radius: 16px;
  border: 1px solid rgba(219,219,219,.12);
  background: rgba(12,15,16,.44);
}
.bingoColorsPanel[hidden]{ display: none; }
.bingoColorsPanel__field{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: rgba(219,219,219,.70);
}
.bingoColorsPanel__field input[type="color"]{
  width: 34px;
  height: 28px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(219,219,219,.20);
  background: rgba(255,255,255,.04);
  cursor: pointer;
}

.bingoToolbar__seed{
  font-size: 12px;
  letter-spacing: .08em;
  color: rgba(219,219,219,.65);
}
.bingoToolbar__seed strong{
  color: var(--green);
  font-family: "ZombiesBrainless","LazyDog",system-ui,sans-serif;
  font-size: 15px;
  letter-spacing: .12em;
}
.bingoToolbar__mode{
  margin-left: 8px;
  color: rgba(255,190,90,.85);
  font-size: 11px;
  letter-spacing: .04em;
}
.bingoStatsCounter{
  margin: 4px 0 0;
  font-size: 10px;
  letter-spacing: .05em;
  color: rgba(219,219,219,.55);
}
.bingoStatsCounter span{
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}

.bingoToolbar__title{
  margin-left: 8px;
  color: rgba(219,219,219,.75);
  font-size: 12px;
  letter-spacing: .02em;
  font-style: italic;
}

/* =========================
   ETAPE 1 : CHOIX DU MODE
========================= */
.bingoTitleField{
  display: grid;
  gap: 6px;
  max-width: 320px;
  margin: 0 auto 18px;
  text-align: center;
  font-size: 10px;
  letter-spacing: .08em;
  color: rgba(219,219,219,.55);
}
.bingoTitleField input{
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(219,219,219,.18);
  background: rgba(12,15,16,.55);
  color: rgba(219,219,219,.92);
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 14px;
  text-align: center;
}
.bingoTitleField input:focus{
  outline: none;
  border-color: rgba(var(--green-rgb),.50);
}

/* interrupteur TROLLS ALEATOIRES (ecran de creation, OFF par defaut) */
.bingoAutoField{
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  margin: -4px auto 20px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(219,219,219,.14);
  background: rgba(12,15,16,.45);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.bingoAutoField:hover{ border-color: rgba(var(--green-rgb),.35); }
.bingoAutoField input{
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.bingoAutoField__switch{
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(219,219,219,.16);
  border: 1px solid rgba(219,219,219,.22);
  transition: background-color .2s ease, border-color .2s ease;
}
.bingoAutoField__switch::after{
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(219,219,219,.85);
  transition: transform .2s ease, background-color .2s ease;
}
.bingoAutoField input:checked + .bingoAutoField__switch{
  background: rgba(var(--green-rgb),.30);
  border-color: rgba(var(--green-rgb),.70);
}
.bingoAutoField input:checked + .bingoAutoField__switch::after{
  transform: translateX(18px);
  background: var(--green);
}
.bingoAutoField input:focus-visible + .bingoAutoField__switch{
  outline: 2px solid rgba(var(--green-rgb),.70);
  outline-offset: 2px;
}
.bingoAutoField:has(input:checked){
  border-color: rgba(var(--green-rgb),.45);
  background: rgba(var(--green-rgb),.08);
}
.bingoAutoField__text{
  display: grid;
  gap: 3px;
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: .05em;
  color: rgba(219,219,219,.88);
  text-align: left;
}
.bingoAutoField__text small{
  font-size: 10px;
  letter-spacing: .04em;
  line-height: 1.35;
  color: rgba(219,219,219,.50);
}
.bingoModes__intro{
  margin: 0 0 14px;
  text-align: center;
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: .06em;
  color: rgba(219,219,219,.65);
}
.bingoModes__grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 680px;
  margin: 0 auto;
}
.bingoModeCard{
  display: grid;
  gap: 8px;
  padding: 22px 20px;
  border-radius: 16px;
  border: 1px solid rgba(219,219,219,.14);
  background: rgba(12,15,16,.44);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.bingoModeCard:hover{
  border-color: rgba(var(--green-rgb),.45);
  background: rgba(var(--green-rgb),.08);
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.bingoModeCard__title{
  font-family: "ZombiesBrainless","LazyDog",system-ui,sans-serif;
  font-size: 18px;
  letter-spacing: .08em;
  color: var(--green);
}
.bingoModeCard__desc{
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .02em;
  color: rgba(219,219,219,.65);
}

/* =========================
   ETAPE 1B : CREATION D'UNE GRILLE PERSONNALISEE
========================= */
.bingoCustomGrid{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  max-width: 620px;
  margin: 0 auto;
}
/* une case de l'editeur = meme disposition qu'une vraie case :
   image facultative en haut (cadre "+ IMAGE"), texte en bas */
.bingoCustomSlot{
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  border-radius: 8px;
  border: 2px solid rgba(219,219,219,.16);
  background: rgba(12,15,16,.45);
  min-width: 0;
}
.bingoCustomSlot:focus-within{
  border-color: rgba(var(--green-rgb),.55);
}
.bingoCustomSlot__img{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 6px;
  border: 1px dashed rgba(219,219,219,.18);
  background: transparent;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.bingoCustomSlot__img:hover,
.bingoCustomSlot__img:focus-visible{
  outline: none;
  border-color: rgba(var(--green-rgb),.6);
  background: rgba(var(--green-rgb),.08);
}
.bingoCustomSlot.has-img .bingoCustomSlot__img{
  border-style: solid;
  border-color: transparent;
}
.bingoCustomSlot__img img{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.bingoCustomSlot__add{
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: .06em;
  color: rgba(219,219,219,.32);
}
.bingoCustomSlot__img:hover .bingoCustomSlot__add{ color: var(--green); }
.bingoCustomSlot__remove{
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(219,219,219,.25);
  background: rgba(12,15,16,.85);
  color: rgba(219,219,219,.85);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.bingoCustomSlot.has-img .bingoCustomSlot__remove{ display: flex; }
.bingoCustomSlot__remove:hover{ border-color: #e05555; color: #ff7a7a; }
.bingoCustomCell{
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 4px;
  background: rgba(0,0,0,.25);
  color: rgba(219,219,219,.92);
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 11px;
  text-align: center;
}
.bingoCustomCell:focus{
  outline: none;
}

/* selecteur d'image de la grille personnalisee */
.bingoPicker{
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,.72);
}
.bingoPicker[hidden]{ display: none; }
.bingoPicker__box{
  width: min(760px, 100%);
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(var(--green-rgb),.35);
  background: #0c0f10;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.bingoPicker__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bingoPicker__title{
  font-family: "ZombiesBrainless","LazyDog",system-ui,sans-serif;
  font-size: 18px;
  letter-spacing: .08em;
  color: var(--green);
}
.bingoPicker__close{
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(219,219,219,.2);
  background: transparent;
  color: rgba(219,219,219,.85);
  cursor: pointer;
}
.bingoPicker__close:hover{ border-color: rgba(var(--green-rgb),.6); color: var(--green); }
.bingoPicker__hint,
.bingoPicker__msg{
  margin: 0;
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .03em;
  color: rgba(219,219,219,.6);
}
.bingoPicker__msg{ padding: 20px; text-align: center; grid-column: 1 / -1; }
.bingoPicker__tabs{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bingoPicker__tab{
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(219,219,219,.16);
  background: rgba(12,15,16,.55);
  color: rgba(219,219,219,.75);
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: .05em;
  cursor: pointer;
}
.bingoPicker__tab:hover{ border-color: rgba(var(--green-rgb),.45); }
.bingoPicker__tab.is-active{
  border-color: rgba(var(--green-rgb),.7);
  background: rgba(var(--green-rgb),.14);
  color: var(--green);
}
.bingoPicker__grid{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  padding-right: 4px;
}
.bingoPicker__item{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  border: 2px solid rgba(219,219,219,.12);
  background: rgba(12,15,16,.6);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.bingoPicker__item:hover,
.bingoPicker__item:focus-visible{
  outline: none;
  border-color: rgba(var(--green-rgb),.6);
  transform: translateY(-2px);
}
.bingoPicker__item.is-active{ border-color: var(--green); }
.bingoPicker__item img{
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}
.bingoPicker__item span{
  width: 100%;
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 9px;
  line-height: 1.2;
  color: rgba(219,219,219,.7);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bingoPicker__foot{
  display: flex;
  justify-content: center;
}
.bingoCustomCell::placeholder{
  color: rgba(219,219,219,.30);
}
.bingoCustomEditor__actions{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.bingoToolbar__actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bingoBtn{
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(219,219,219,.16);
  background: rgba(12,15,16,.55);
  color: rgba(219,219,219,.88);
  font-family: "LazyDog",system-ui,sans-serif;
  letter-spacing: .05em;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.bingoBtn:hover{ border-color: rgba(var(--green-rgb),.35); }
.bingoBtn--primary{
  background: rgba(var(--green-rgb),.14);
  border-color: rgba(var(--green-rgb),.50);
  color: var(--green);
}
.bingoBtn--primary:hover{
  border-color: rgba(var(--green-rgb),.75);
  box-shadow: 0 0 0 1px rgba(var(--green-rgb),.16);
}

/* attire l'oeil sur "TELECHARGER MON BINGO" juste apres une grille terminee :
   jaune + pulsation, jusqu'a ce que le joueur clique dessus une premiere fois */
.bingoBtn--attention{
  background: rgba(255,190,90,.18);
  border-color: rgba(255,190,90,.65);
  color: #ffbe5a;
  animation: bingoAttentionPulse 1.4s ease-in-out infinite;
}
.bingoBtn--attention:hover{
  border-color: #ffbe5a;
  box-shadow: 0 0 0 1px rgba(255,190,90,.25);
}
@keyframes bingoAttentionPulse{
  0%, 100%{ box-shadow: 0 0 0 0 rgba(255,190,90,.45); }
  50%{ box-shadow: 0 0 14px 4px rgba(255,190,90,.45); }
}

/* =========================
   GRILLE
   (volontairement compacte : pensee pour tenir en incrustation
   sur un stream, pas pour remplir toute la largeur de la page)
========================= */
/* etape 2 (grille de jeu) : espacement genereux et regulier entre la barre du
   haut / la grille / le texte d'aide, pour qu'une capture OBS centree sur la
   seule grille ne "mange" jamais le texte au-dessus ou en dessous */
.bingoPlay{
  display: flex;
  flex-direction: column;
  gap: 32px;
}
/* meme piege que .bingoQuizModal plus bas : "display:flex" ci-dessus a la
   meme specificite que le "[hidden]{ display:none }" natif du navigateur et
   le charge apres, donc il gagne et la barre d'outils reste visible avant
   meme qu'une grille soit creee. Cette regle re-donne la priorite au hidden. */
.bingoPlay[hidden]{ display: none; }

.bingoGrid{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  perspective: 900px;
}

.bingoCell{
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  row-gap: 1px;
  aspect-ratio: 1 / 1;
  padding: 5px 4px 4px;
  border-radius: 10px;
  border: 2px solid rgba(219,219,219,.14);
  background: rgba(12,15,16,.45);
  cursor: pointer;
  text-align: center;
  overflow: hidden;

  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity .3s ease,
    transform .3s ease,
    border-color .18s ease,
    background .18s ease,
    box-shadow .18s ease;
}
.bingoCell.is-in{ opacity: 1; transform: translateY(0); }

.bingoCell:hover{ filter: brightness(1.12); }

.bingoCell__img{
  width: 78%;
  max-width: 68px;
  height: auto;
  max-height: 68px;
  object-fit: contain;
  pointer-events: none;
}
.bingoCell__label{
  width: 100%;
  min-height: 0;
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: .01em;
  line-height: 1.14;
  color: rgba(219,219,219,.85);
  pointer-events: none;

  /* protection anti-debordement : coupe proprement avec "..." plutot
     que de deborder de la case si le texte est trop long */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* grille personnalisee (pas d'image) : le texte seul doit occuper toute la
   case et etre parfaitement centre, pas colle en haut comme quand il ne
   remplit que la premiere des deux rangees prevues pour image+texte */
.bingoCell--noimg .bingoCell__label{
  grid-row: 1 / -1;
}

/* couleurs par categorie (memes 9 types que la banque de cases) */
/* les 9 couleurs par categorie servent de valeur par defaut ; des qu'un
   joueur choisit sa propre couleur "case non validee" (voir bingoColorsPanel),
   --bingo-unchecked-color est definie sur .bingoGrid et prend le dessus
   uniformement sur toutes les categories */
.bingoCell--fantomes{ border-color: var(--bingo-unchecked-color, rgba(150,100,215,.45)); }
.bingoCell--maps{ border-color: var(--bingo-unchecked-color, rgba(60,150,255,.45)); }
.bingoCell--tarot{ border-color: var(--bingo-unchecked-color, rgba(255,215,90,.45)); }
.bingoCell--divers{ border-color: var(--bingo-unchecked-color, rgba(80,220,210,.45)); }
.bingoCell--os{ border-color: var(--bingo-unchecked-color, rgba(219,219,219,.40)); }
.bingoCell--skins{ border-color: var(--bingo-unchecked-color, rgba(255,120,190,.45)); }
.bingoCell--photo{ border-color: var(--bingo-unchecked-color, rgba(var(--green-rgb),.45)); }
.bingoCell--video{ border-color: var(--bingo-unchecked-color, rgba(255,90,90,.45)); }
.bingoCell--audio{ border-color: var(--bingo-unchecked-color, rgba(255,165,70,.45)); }

/* =========================
   LEGENDE DES COULEURS
========================= */
.bingoLegend{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  max-width: 560px;
  margin: 0 auto;
}
.bingoLegend__item{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  letter-spacing: .05em;
  color: rgba(219,219,219,.65);
}
.bingoLegend__dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: none;
}
.bingoLegend__dot--maps{ background: rgb(60,150,255); }
.bingoLegend__dot--fantomes{ background: rgb(150,100,215); }
.bingoLegend__dot--tarot{ background: rgb(255,215,90); }
.bingoLegend__dot--divers{ background: rgb(80,220,210); }
.bingoLegend__dot--os{ background: rgb(219,219,219); }
.bingoLegend__dot--skins{ background: rgb(255,120,190); }
.bingoLegend__dot--photo{ background: rgb(61,206,97); }
.bingoLegend__dot--video{ background: rgb(255,90,90); }
.bingoLegend__dot--audio{ background: rgb(255,165,70); }

/* case cochee — personnalisable via --bingo-checked-color (voir bingoColorsPanel) */
.bingoCell.is-checked{
  background: color-mix(in srgb, var(--bingo-checked-color, var(--green)) 16%, transparent);
  border-color: var(--bingo-checked-color, var(--green));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--bingo-checked-color, var(--green)) 20%, transparent), inset 0 0 30px color-mix(in srgb, var(--bingo-checked-color, var(--green)) 15%, transparent);
}
.bingoCell.is-checked::after{
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bingo-checked-color, var(--green)) 10%, transparent);
  pointer-events: none;
}
.bingoCell.is-checked .bingoCell__label{ color: rgba(219,219,219,.98); }

/* petit eclat lumineux au moment ou une case passe cochee (pas juste un
   changement de couleur statique) */
.bingoCell.is-shining{ animation: bingoCellShinePulse .55s ease; }
@keyframes bingoCellShinePulse{
  0%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--bingo-checked-color, var(--green)) 65%, transparent); }
  45%{ box-shadow: 0 0 26px 8px color-mix(in srgb, var(--bingo-checked-color, var(--green)) 85%, transparent); }
  100%{ box-shadow: 0 0 0 1px color-mix(in srgb, var(--bingo-checked-color, var(--green)) 20%, transparent), inset 0 0 30px color-mix(in srgb, var(--bingo-checked-color, var(--green)) 15%, transparent); }
}
.bingoCell.is-shining::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.80) 48%, transparent 66%);
  background-size: 260% 260%;
  background-position: -120% -120%;
  animation: bingoCellShineSweep .55s ease;
}
@keyframes bingoCellShineSweep{
  0%{ background-position: -120% -120%; opacity: 1; }
  100%{ background-position: 120% 120%; opacity: 0; }
}

/* ligne gagnante — le halo dore doit rester APRES la pulsation (3s), pas
   juste pendant : sans valeur statique ici, la case retombe sur le
   box-shadow vert de .is-checked une fois l'animation terminee */
.bingoCell.is-winning{
  border-color: #ffbe5a;
  box-shadow: 0 0 0 1px rgba(255,190,90,.30), 0 0 20px rgba(255,190,90,.25);
  animation: bingoWinPulse 1s ease-in-out 3;
}
@keyframes bingoWinPulse{
  0%, 100%{ box-shadow: 0 0 0 1px rgba(255,190,90,.30), 0 0 20px rgba(255,190,90,.25); }
  50%{ box-shadow: 0 0 0 4px rgba(255,190,90,.55), 0 0 30px rgba(255,190,90,.45); }
}

.bingoHint{
  margin: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: .05em;
  color: rgba(219,219,219,.45);
}

/* =========================
   TOAST
========================= */
.bingoToast{
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(var(--green-rgb),.40);
  background: rgba(12,15,16,.92);
  color: var(--green);
  font-size: 12px;
  letter-spacing: .06em;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 80;
}
.bingoToast.is-visible{
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================
   BANNIERE BINGO
========================= */
/* positionnee par-dessus la grille (pas plein ecran) : spooky-bingo.js reparente cet
   element dans #bingoGrid (position:relative) une fois au demarrage */
.bingoWinBanner{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8%;
  border-radius: 14px;
  background: rgba(6,4,10,.55);
  transform: scale(.85);
  font-family: "ZombiesBrainless","LazyDog",system-ui,sans-serif;
  font-weight: lighter;
  letter-spacing: .10em;
  line-height: 1.15;
  color: rgba(255,190,90,.95);
  text-shadow: 0 0 40px rgba(255,190,90,.55), 0 0 80px rgba(255,190,90,.30);
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 20;
}
.bingoWinBanner.is-visible{
  opacity: 1;
  transform: scale(1);
}

/* =========================
   PROMPT "TELECHARGER TON BINGO ?"
   Reparente dans #bingoGrid par spooky-bingo.js (meme principe que
   .bingoWinBanner) pour rester centre par-dessus la grille. Apparait une
   seule fois, juste apres que la banniere BINGO ! s'efface, et NE se ferme
   PAS toute seule : seul un clic sur TELECHARGER ou PLUS TARD le fait.
========================= */
.bingoDownloadPrompt{
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 8%;
  background: rgba(6,4,10,.72);
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.bingoDownloadPrompt.is-visible{
  opacity: 1;
  pointer-events: auto;
}
.bingoDownloadPrompt__card{
  display: grid;
  gap: 14px;
  justify-items: center;
  max-width: 340px;
  padding: 20px 22px;
  border-radius: 14px;
  border: 1px solid rgba(255,190,90,.55);
  background: rgba(12,10,8,.92);
  box-shadow: 0 0 0 1px rgba(255,190,90,.15), 0 20px 50px rgba(0,0,0,.55), 0 0 26px rgba(255,190,90,.18);
  text-align: center;
  transform: scale(.92);
  transition: transform .25s ease;
}
.bingoDownloadPrompt.is-visible .bingoDownloadPrompt__card{
  transform: scale(1);
}
.bingoDownloadPrompt__text{
  margin: 0;
  max-width: 30ch;
  text-align: center;
  font-size: 15px;
  letter-spacing: .03em;
  line-height: 1.4;
  color: rgba(219,219,219,.95);
}
.bingoDownloadPrompt__actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* =========================
   EFFETS TROLL (declenches via le menu admin cache)
   Modele persistant : chaque effet reste actif jusqu'a ce que l'admin
   le desactive explicitement (plus d'auto-retour en arriere sur un timer).
========================= */
/* SECOUSSE : chaque case tremble seule. Trajet (3), duree (4), decalage (5),
   sens (2) et amplitude (7) varient par motifs nth-child croises : 840
   combinaisons, aucun motif visible sur 25 cases. Proprietes translate /
   rotate individuelles : ne se battent pas avec les transform des autres
   effets. Les cases en eclat / flip / vague sont exclues le temps de leur
   propre animation. --shake-intensity et --shake-speed : sur la grille. */
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop){
  animation: trollCellShakeA var(--shake-speed, 500ms) ease-in-out infinite;
}
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(3n+2){ animation-name: trollCellShakeB; }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(3n){ animation-name: trollCellShakeC; }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(4n+2){ animation-duration: calc(var(--shake-speed, 500ms) * .83); }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(4n+3){ animation-duration: calc(var(--shake-speed, 500ms) * 1.21); }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(4n){ animation-duration: calc(var(--shake-speed, 500ms) * .69); }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(5n+2){ animation-delay: calc(var(--shake-speed, 500ms) * -.2); }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(5n+3){ animation-delay: calc(var(--shake-speed, 500ms) * -.45); }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(5n+4){ animation-delay: calc(var(--shake-speed, 500ms) * -.7); }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(5n){ animation-delay: calc(var(--shake-speed, 500ms) * -.9); }
.troll-shake > .bingoCell:not(.is-shining, .is-winning, .troll-cell-flip, .troll-wave-hop):nth-child(2n){ animation-direction: reverse; }
.troll-shake > .bingoCell:nth-child(7n+2){ --sk-k: .7; }
.troll-shake > .bingoCell:nth-child(7n+3){ --sk-k: 1.25; }
.troll-shake > .bingoCell:nth-child(7n+4){ --sk-k: .85; }
.troll-shake > .bingoCell:nth-child(7n+5){ --sk-k: 1.1; }
.troll-shake > .bingoCell:nth-child(7n+6){ --sk-k: .6; }
.troll-shake > .bingoCell:nth-child(7n){ --sk-k: 1.35; }
@keyframes trollCellShakeA{
  0%, 100%{ translate: 0 0; rotate: 0deg; }
  25%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -1) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .5); rotate: -2.5deg; }
  50%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .8) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -.6); rotate: 1.8deg; }
  75%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -.4) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .9); rotate: -1.2deg; }
}
@keyframes trollCellShakeB{
  0%, 100%{ translate: 0 0; rotate: 0deg; }
  20%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .7) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .8); rotate: 2.2deg; }
  45%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -.9) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -.3); rotate: -2.8deg; }
  70%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .3) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -.9); rotate: 1deg; }
  85%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -.5) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .4); rotate: -.6deg; }
}
@keyframes trollCellShakeC{
  0%, 100%{ translate: 0 0; rotate: 0deg; }
  30%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .2) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -1); rotate: -1.5deg; }
  55%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * 1) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .5); rotate: 3deg; }
  80%{ translate: calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * -.7) calc(var(--shake-intensity, 6px) * var(--sk-k, 1) * .2); rotate: -2deg; }
}
/* secousse de la grille entiere : garde pour l'impact de l'EXPLOSION */
@keyframes trollShake{
  0%, 100%{ transform: translate(0,0) rotate(0deg); }
  20%{ transform: translate(calc(var(--shake-intensity, 22px) * -1), calc(var(--shake-intensity, 22px) * .4)) rotate(-1.4deg); }
  40%{ transform: translate(var(--shake-intensity, 22px), calc(var(--shake-intensity, 22px) * -.35)) rotate(1.4deg); }
  60%{ transform: translate(calc(var(--shake-intensity, 22px) * -.7), calc(var(--shake-intensity, 22px) * .2)) rotate(-.8deg); }
  80%{ transform: translate(calc(var(--shake-intensity, 22px) * .6), 0) rotate(.8deg); }
}

.troll-fog{
  filter: blur(var(--fog-intensity, 6px));
}

/* miroir (horizontal ou vertical selon le reglage) — la transition vit sur la
   regle de base pour que l'activation ET la desactivation soient animees */
.bingoGrid{ transition: transform .4s ease, filter .4s ease; }
.bingoGrid.troll-mirror-h{ transform: scaleX(-1); }
.bingoGrid.troll-mirror-v{ transform: scaleY(-1); }

/* disco : toutes les cases recoivent une couleur a chaque cycle (JS), aucune ne reste neutre.
   transition-delay force a 0 pour eviter que le decalage d'entree en grille (transition-delay
   inline pose a l'affichage initial) ne retarde encore les changements de couleur. */
.bingoGrid.troll-disco .bingoCell{
  transition: background .12s ease;
  transition-delay: 0s !important;
}

/* curseur fou : transition rapide pour que la case semble fuir avant que le curseur l'atteigne.
   on reprend toutes les transitions de base (pas juste transform) pour ne pas perdre
   les autres effets de survol/coche pendant que l'effet est actif */
.bingoGrid.troll-fleeing .bingoCell{
  transition:
    opacity .3s ease,
    transform var(--flee-speed, 70ms) ease-out,
    border-color .18s ease,
    background .18s ease,
    box-shadow .18s ease;
}

/* lampe de poche : rayon et durete du bord reglables (JS met a jour --troll-x/--troll-y/--flash-radius/--flash-blur) */
.trollFlashlight{
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
  background: radial-gradient(
    circle var(--flash-radius, 150px) at var(--troll-x, 50%) var(--troll-y, 50%),
    transparent 0%,
    transparent calc(100% - var(--flash-blur, 6%)),
    rgba(0,0,0,.96) 100%
  );
}

/* glitch : uniquement le scramble de texte (JS), plus aucune animation CSS de
   secousse/decoupe sur la grille elle-meme. */

/* explosion : compte a rebours CENTRE SUR LA GRILLE (pas plein ecran), flash
   "BOOM", puis fragments (contenu reel des cases : image + texte) qui tombent
   et s'empilent en bas de la grille. spooky-bingo.js place cet overlay dans #bingoGrid. */
.trollExplodeOverlay{
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-family: "ZombiesBrainless","LazyDog",system-ui,sans-serif;
  font-size: 100px;
  color: rgba(255,90,90,.95);
  text-shadow: 0 0 40px rgba(255,90,90,.60), 0 0 90px rgba(255,90,90,.30);
  background: rgba(0,0,0,.35);
  pointer-events: none;
  animation: trollCountdownPulse var(--countdown-speed, 800ms) ease-in-out infinite;
}
@keyframes trollCountdownPulse{
  0%, 100%{ transform: scale(1); opacity: .85; }
  50%{ transform: scale(1.15); opacity: 1; }
}
.trollExplodeOverlay.is-boom{
  color: rgba(255,70,40,.98);
  font-size: clamp(90px, 24vw, 190px);
  text-shadow: 0 0 70px rgba(255,90,40,.90), 0 0 140px rgba(255,90,40,.55);
  background: rgba(255,90,40,.28);
  animation: trollBoomFlash .26s ease-out;
}
@keyframes trollBoomFlash{
  0%{ transform: scale(.7); opacity: .4; }
  60%{ transform: scale(1.25); opacity: 1; }
  100%{ transform: scale(1.1); opacity: 1; }
}

.troll-explode-impact{
  animation: trollShake 90ms ease-in-out 4;
  --shake-intensity: 16px;
  --shake-speed: 90ms;
}

.bingoGrid{ position: relative; }

/* image derriere la grille (effet troll) : deborde legerement du cadre,
   reste sous les cases (z-index negatif) donc visible surtout dans les
   espaces entre les cases et sur le pourtour */
.trollBgImage{
  position: absolute;
  inset: -16px;
  z-index: -1;
  border-radius: 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease, filter .3s ease;
}

/* message chuchote (effet troll) : reste affiche tant que l'admin ne le
   desactive pas, contrairement au jumpscare qui est un declencheur ponctuel */
.trollWhisper{
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s ease;
}
.trollWhisper.is-visible{ opacity: 1; }
.trollWhisper span{
  font-family: "LazyDog","ZombiesBrainless",system-ui,sans-serif;
  font-style: italic;
  font-size: clamp(16px, 4vw, 26px);
  line-height: 1.25;
  color: rgba(219,219,219,.92);
  text-shadow: 0 0 20px rgba(var(--violet-rgb),.75), 0 0 40px rgba(var(--violet-rgb),.40);
  word-break: break-word;
  /* bandeau sombre : le texte reste lisible par-dessus les images des cases */
  max-width: 100%;
  padding: .55em 1.1em;
  border-radius: 16px;
  background: rgba(6,4,10,.82);
  border: 1px solid rgba(var(--violet-rgb),.45);
  box-shadow: 0 0 30px rgba(var(--violet-rgb),.30), 0 10px 30px rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* son du menu troll bloque par le navigateur (joueur qui n'a pas encore
   clique sur la page) : bandeau d'invitation, retire au premier clic */
.trollSoundUnlock{
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 9000;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,190,90,.55);
  background: rgba(6,4,10,.92);
  color: #ffbe5a;
  font-size: 13px;
  letter-spacing: .06em;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
}
.trollSoundUnlock.is-visible{ opacity: 1; transform: translate(-50%, 0); }

/* grille gelee par un troll anti-clic (fantome voleur, voleurs de curseur) :
   seule la case volee reste cliquable */
.troll-click-locked > .bingoCell{ cursor: not-allowed; }
.troll-click-locked > .bingoCell.is-stolen{ cursor: pointer; }

/* fantome voleur de case (effet troll) */
/* =========================
   SYSTEME DE FANTOME "VIVANT" — partage par tous les effets troll a base de
   fantome (trollGhost, trollGhostSign, moonwalk, voleur de curseur...) :
   bras qui ondulent en continu (CSS pure), yeux (pupilles) qui regardent
   dans une direction pilotee par JS via --eye-x/--eye-y, et une legere
   posture (inclinaison) qui change de temps en temps.
========================= */
.ghostSvg{ width: 100%; height: 100%; display: block; overflow: visible; }
.ghostBody{
  transition: transform .5s ease;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ghostBody.pose-lean-l{ transform: rotate(-5deg) scaleY(.97); }
.ghostBody.pose-lean-r{ transform: rotate(5deg) scaleY(.97); }
.ghostBody.pose-perk{ transform: translateY(-2px) scaleY(1.03); }

.ghostArm{
  transform-box: fill-box;
  animation: ghostArmWaveL 1.7s ease-in-out infinite;
}
.ghostArm--l{ transform-origin: 100% 0%; animation-name: ghostArmWaveL; }
.ghostArm--r{ transform-origin: 0% 0%; animation-name: ghostArmWaveR; animation-delay: .25s; }
@keyframes ghostArmWaveL{
  0%, 100%{ transform: rotate(0deg); }
  50%{ transform: rotate(16deg); }
}
@keyframes ghostArmWaveR{
  0%, 100%{ transform: rotate(0deg); }
  50%{ transform: rotate(-16deg); }
}

.ghostPupil{
  transition: transform .4s ease;
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transform: translate(calc(var(--eye-x, 0) * 1.8px), calc(var(--eye-y, 0) * 2.4px));
}

.trollGhost{
  position: absolute;
  width: 54px;
  height: 58px;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: left .9s cubic-bezier(.45,0,.2,1), top .9s cubic-bezier(.45,0,.2,1), opacity .4s ease;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.55));
  animation: trollGhostBob 1.6s ease-in-out infinite;
}
.trollGhost.is-visible{ opacity: 1; }
@keyframes trollGhostBob{
  0%, 100%{ transform: translateY(0) rotate(-2deg); }
  50%{ transform: translateY(-6px) rotate(2deg); }
}
/* pancarte "ATTRAPE MOI !" du voleur de case, visible seulement pendant qu'il tient une case */
.trollGhost .trollGhostSign__bubble{ opacity: 0; transition: opacity .3s ease; }
.trollGhost.is-holding .trollGhostSign__bubble{ opacity: 1; }

.bingoCell.is-stolen{
  z-index: 25;
  box-shadow: 0 14px 30px rgba(0,0,0,.5), 0 0 0 2px rgba(var(--green-rgb),.55);
  cursor: pointer;
}

/* fantome avec pancarte (effet troll) */
.trollGhostSign{
  position: absolute;
  width: 54px;
  height: 58px;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: left .9s cubic-bezier(.45,0,.2,1), top .9s cubic-bezier(.45,0,.2,1), opacity .4s ease;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.55));
  animation: trollGhostBob 1.6s ease-in-out infinite;
}
.trollGhostSign.is-visible{ opacity: 1; }
.trollGhostSign__bubble{
  position: absolute;
  left: 100%;
  top: -4px;
  transform: translateX(4px);
  background: #f2f0ea;
  color: #14191b;
  font-family: "LazyDog","ZombiesBrainless",system-ui,sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 5px 8px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(0,0,0,.45);
}
.trollGhostSign__bubble::after{
  content: "";
  position: absolute;
  left: -6px;
  top: 10px;
  border: 5px solid transparent;
  border-right-color: #f2f0ea;
}

/* apparition bizarre : le fantome pointe depuis un bord/coin, DECOUPE aux
   dimensions de la case elle-meme (comme s'il en sortait de l'interieur),
   oriente selon le bord (tete a l'envers en haut, couche sur le cote sur
   les bords lateraux). La direction du regard (--eye-x/--eye-y) est
   calculee en JS pour rester correcte malgre la rotation. */
.trollPeekClip{
  position: absolute;
  z-index: 24;
  overflow: hidden;
  border-radius: 10px;
  pointer-events: none;
}
.trollPeekGhost{
  position: absolute;
  width: 62%;
  aspect-ratio: 60 / 66;
  opacity: 0;
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
}
.trollPeekGhost.is-in{ opacity: 1; }
.trollPeekGhost.edge-top{ left: 50%; top: 0; transform: translate(-50%, -100%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-top.is-in{ transform: translate(-50%, -28%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-bottom{ left: 50%; bottom: 0; transform: translate(-50%, 100%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-bottom.is-in{ transform: translate(-50%, 28%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-left{ left: 0; top: 50%; transform: translate(-100%, -50%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-left.is-in{ transform: translate(-28%, -50%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-right{ right: 0; top: 50%; transform: translate(100%, -50%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-right.is-in{ transform: translate(28%, -50%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-tl{ left: 0; top: 0; transform: translate(-100%, -100%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-tl.is-in{ transform: translate(-20%, -20%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-tr{ right: 0; top: 0; transform: translate(100%, -100%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-tr.is-in{ transform: translate(20%, -20%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-bl{ left: 0; bottom: 0; transform: translate(-100%, 100%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-bl.is-in{ transform: translate(-20%, 20%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-br{ right: 0; bottom: 0; transform: translate(100%, 100%) rotate(var(--peek-angle, 0deg)); }
.trollPeekGhost.edge-br.is-in{ transform: translate(20%, 20%) rotate(var(--peek-angle, 0deg)); }

/* fantome moonwalk (effet troll) */
.trollMoonwalk{
  position: absolute;
  bottom: 14px;
  left: -60px;
  width: 50px;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
}
.trollMoonwalk.is-going{
  animation: trollMoonwalkGo 3.2s linear forwards;
}
@keyframes trollMoonwalkGo{
  0%{ opacity: 0; transform: translateX(0) scaleX(-1); }
  5%{ opacity: 1; }
  95%{ opacity: 1; }
  100%{ opacity: 0; transform: translateX(var(--walk-distance, 720px)) scaleX(-1); }
}
/* les cases flippent sur elles-memes au passage du fantome moonwalk */
.bingoGrid{ perspective: 900px; }
.bingoCell.troll-cell-flip{ animation: trollCellFlip .5s ease; }
@keyframes trollCellFlip{
  0%{ transform: rotateY(0deg); }
  50%{ transform: rotateY(180deg); }
  100%{ transform: rotateY(360deg); }
}

/* fantomes voleurs de curseur (essaim) */
.trollCursorGhost{
  position: absolute;
  z-index: 32;
  pointer-events: none;
}
.trollCursorGhost .ghostBody{ stroke: var(--ghost-accent, var(--green)); }

/* une fois l'essaim au complet, le vrai curseur systeme disparait sur la
   grille (kidnappe) et un curseur factice se balade tout seul */
.bingoGrid.troll-cursor-hidden,
.bingoGrid.troll-cursor-hidden *{
  cursor: none !important;
}
.trollFakeCursor{
  position: absolute;
  z-index: 33;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.5));
}
.trollFakeCursor.is-visible{ opacity: 1; }
.trollFakeCursor svg{ width: 100%; height: 100%; display: block; }
.trollMoonwalkStar{
  position: absolute;
  bottom: 26px;
  z-index: 29;
  font-size: 12px;
  color: #ffce6b;
  pointer-events: none;
  animation: trollStarFade 1s ease forwards;
}
@keyframes trollStarFade{
  0%{ opacity: 1; transform: translateY(0) scale(1); }
  100%{ opacity: 0; transform: translateY(10px) scale(.4); }
}

/* confettis (effet troll) */
.trollConfetti{
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  z-index: 26;
  opacity: .95;
  pointer-events: none;
  animation: trollConfettiFall linear forwards;
}
@keyframes trollConfettiFall{
  to{ transform: translateY(560px) rotate(540deg); opacity: 0; }
}

/* ballons qui montent (effet troll) */
.trollBalloon{
  position: absolute;
  bottom: -40px;
  width: 30px;
  height: 38px;
  z-index: 26;
  border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
  pointer-events: none;
  animation: trollBalloonRise 3.6s ease-in forwards;
}
.trollBalloon::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,.4);
}
@keyframes trollBalloonRise{
  0%{ transform: translate(0,0); }
  100%{ transform: translate(var(--sway,20px), -540px); opacity: 0; }
}

/* tout devient rose paillete (effet troll, version kawaii) */
.bingoGrid.troll-kawaii{ filter: hue-rotate(300deg) saturate(1.6) brightness(1.1); }
.trollKawaiiLayer{
  position: absolute;
  inset: 0;
  z-index: 27;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s ease;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,143,214,.25), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(255,200,240,.20), transparent 55%);
}
.trollKawaiiLayer.is-visible{ opacity: 1; }
.trollKawaiiSparkle{
  position: absolute;
  pointer-events: none;
  animation: trollKawaiiTwinkle 1.4s ease-in-out infinite;
}
@keyframes trollKawaiiTwinkle{
  0%, 100%{ opacity: .2; transform: scale(.6); }
  50%{ opacity: 1; transform: scale(1.3); }
}
.trollKawaiiHeart{
  position: absolute;
  z-index: 28;
  pointer-events: none;
  opacity: 0;
  animation: trollHeartFloat 3.6s ease-in forwards;
}
@keyframes trollHeartFloat{
  0%{ opacity: 0; transform: translateY(0) scale(.6); }
  10%{ opacity: 1; }
  90%{ opacity: 1; }
  100%{ opacity: 0; transform: translateY(-140px) scale(1.1); }
}

/* vague mexicaine (effet troll, plus de mouvement) */
.bingoCell.troll-wave-hop{
  animation: trollWaveHop .6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes trollWaveHop{
  0%, 100%{ transform: translateY(0) scale(1) rotate(0deg); }
  35%{ transform: translateY(-18px) scale(1.12) rotate(-4deg); }
  65%{ transform: translateY(-10px) scale(1.06) rotate(3deg); }
}

/* respiration de la grille (effet troll) */
@keyframes trollBreathe{
  0%, 100%{ transform: scale(1); }
  50%{ transform: scale(var(--breathe-scale, 1.035)); }
}
.bingoGrid.troll-breathe{
  animation: trollBreathe var(--breathe-speed, 4500ms) ease-in-out infinite;
}

.trollDebris{
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}
/* chaque fragment reutilise le gabarit .bingoCell (image + texte au meme endroit
   que l'originale) mais decoupe en petit morceau via clip-path : illusion d'un
   vrai morceau arrache. Deux phases : eclatement rapide vers l'exterieur (radial
   depuis le centre de la case), puis chute plus lente qui s'empile en bas de la grille. */
.trollFragment.bingoCell{
  position: absolute;
  cursor: default;
  pointer-events: none;
  opacity: 1;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(0,0,0,.45);
  transform: translate(0,0) rotate(0deg);
}
.trollFragment.is-bursting{ transition: transform 320ms cubic-bezier(.18,.9,.32,1); }
.trollFragment.is-falling{ transition: transform 2000ms cubic-bezier(.36,.15,.4,1); }

/* positionnee par-dessus la grille (pas plein ecran) : spooky-bingo.js reparente cet
   element dans #bingoGrid (position:relative) une fois au demarrage */
.bingoJumpscare{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(0,0,0,.85);
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .08s ease-out;
  z-index: 21;
}
.bingoJumpscare.is-visible{ opacity: 1; }

/* =========================
   MODALE DE QUIZ (mode Normal+Quiz / Personnalisee+Quiz) — partagee en temps
   reel : tous les joueurs sur le lien voient la meme question et le meme
   resultat.
========================= */
.bingoQuizModal{
  position: fixed;
  inset: 0;
  z-index: 98;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
/* le HTML pilote l'ouverture/fermeture via l'attribut natif "hidden" (spooky-bingo.js
   fait quizModal.hidden = true/false) — sans cette regle, ".bingoQuizModal{
   display:flex }" a exactement la meme specificite que la regle par defaut du
   navigateur "[hidden]{ display:none }" et gagne car chargee apres, donc la
   modale restait visible (vide) en permanence, par-dessus n'importe quel ecran */
.bingoQuizModal[hidden]{ display: none; }
.bingoQuizModal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(4,3,8,.78);
  backdrop-filter: blur(4px);
}
.bingoQuizModal__box{
  position: relative;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 22px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255,190,90,.30);
  background: rgba(12,10,16,.96);
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.bingoQuizModal__target{
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--green);
}
.bingoQuizModal__hint{
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: .10em;
  color: rgba(219,219,219,.45);
}
.bingoQuizModal__question{
  margin: 0 0 16px;
  font-family: "LazyDog", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: .01em;
  color: rgba(219,219,219,.95);
}
.bingoQuizModal__answers{
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.bingoQuizAnswer{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(219,219,219,.16);
  background: rgba(255,255,255,.03);
  font-size: 13px;
  color: rgba(219,219,219,.88);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.bingoQuizAnswer:hover{ border-color: rgba(255,190,90,.40); }

.bingoQuizAnswer input{
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(219,219,219,.35);
  background: rgba(12,15,16,.55);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.bingoQuizAnswer input[type="radio"]{ border-radius: 50%; }
.bingoQuizAnswer input[type="checkbox"]{ border-radius: 5px; }
.bingoQuizAnswer input::before{
  content: "";
  width: 9px;
  height: 9px;
  background: var(--green);
  transform: scale(0);
  transition: transform .12s ease;
}
.bingoQuizAnswer input[type="radio"]::before{ border-radius: 50%; }
.bingoQuizAnswer input[type="checkbox"]::before{
  width: 11px;
  height: 11px;
  clip-path: polygon(14% 44%, 0% 65%, 38% 100%, 100% 20%, 80% 2%, 36% 72%);
}
.bingoQuizAnswer input:checked{ border-color: var(--green); background: rgba(var(--green-rgb),.14); }
.bingoQuizAnswer input:checked::before{ transform: scale(1); }
.bingoQuizAnswer:hover input{ border-color: rgba(255,190,90,.55); }
.bingoQuizAnswer input:disabled{ cursor: default; opacity: .75; }

.bingoQuizAnswer.is-correct{
  border-color: rgba(var(--green-rgb),.65);
  background: rgba(var(--green-rgb),.14);
  color: rgba(163,255,183,.98);
}
.bingoQuizAnswer.is-correct input{ border-color: rgba(var(--green-rgb),.80); }
.bingoQuizAnswer.is-wrong{
  border-color: rgba(255,90,90,.65);
  background: rgba(255,90,90,.14);
  color: rgba(255,180,180,.98);
}
.bingoQuizAnswer.is-wrong input{ border-color: rgba(255,90,90,.80); background: rgba(255,90,90,.14); }
.bingoQuizAnswer.is-wrong input::before{ background: rgba(255,90,90,.95); }
.bingoQuizModal__result{
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: .02em;
  color: rgba(255,140,140,.95);
}
.bingoQuizModal__explanation{
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 3px solid rgba(255,190,90,.55);
  background: rgba(255,190,90,.08);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(219,219,219,.90);
}
.bingoQuizModal__actions{
  display: flex;
  justify-content: flex-end;
}
.bingoQuizModal__actions button{
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(var(--green-rgb),.50);
  background: rgba(var(--green-rgb),.14);
  color: var(--green);
  font-family: "LazyDog", system-ui, sans-serif;
  letter-spacing: .05em;
  font-size: 13px;
  cursor: pointer;
}
.bingoQuizModal__actions button:hover{
  border-color: rgba(var(--green-rgb),.75);
  box-shadow: 0 0 0 1px rgba(var(--green-rgb),.16);
}

/* =========================
   GALERIE PUBLIQUE (bingos termines par la communaute)
========================= */
.bingoGallery{
  margin-top: 12px;
  padding-top: 28px;
  border-top: 1px solid rgba(219,219,219,.12);
}
.bingoGallery__title{
  margin: 0 0 6px;
  text-align: center;
  font-family: "ZombiesBrainless","LazyDog",system-ui,sans-serif;
  font-weight: lighter;
  letter-spacing: .06em;
  font-size: 18px;
  color: #ffbe5a;
}
.bingoGallery__hint{
  margin: 0 0 18px;
  text-align: center;
  font-size: 11px;
  letter-spacing: .04em;
  color: rgba(219,219,219,.55);
}
.bingoGallery__grid{
  display: grid;
  /* auto-fit (pas auto-fill) : les colonnes vides se replient au lieu de
     rester reservees, donc peu d'images se repartissent sur toute la
     largeur au lieu de rester tassees a gauche */
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.bingoGallery__item{
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,190,90,.22);
  background: rgba(12,15,16,.4);
  cursor: pointer;

  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition:
    opacity .35s ease,
    transform .35s ease,
    border-color .15s ease,
    box-shadow .15s ease;
}
.bingoGallery__item.is-in{ opacity: 1; transform: translateY(0) scale(1); }
.bingoGallery__item:hover{
  border-color: rgba(255,190,90,.55);
  transform: translateY(-2px);
}
.bingoGallery__item img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* apercu galerie : meme modale que "TELECHARGER MON BINGO" (share-card.css)
   mais 2x plus petite — ne touche pas .shareCardModal__panel de base, qui
   doit garder sa taille pour l'aperçu de fin de partie */
.shareCardModal__panel--sm{ width: min(500px, 100%); }

.bingoGallery__more{
  display: block;
  margin: 16px auto 0;
}
.bingoGallery__more[hidden]{ display: none; }

.bingoGallery__empty{
  margin: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: .03em;
  color: rgba(219,219,219,.45);
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 720px){
  .bingo{ padding: 12px; gap: 12px; }
  .bingoPlay{ gap: 20px; }
  .bingoGrid{ gap: 5px; }
  .bingoCell{ border-radius: 9px; padding: 4px 3px 3px; }
  /* sur telephone une case fait ~60px : l'image ne doit plus se reserver
     sa taille fixe, sinon le texte n'a qu'une ligne et finit en "..."
     (ex. "VIDEO : PLANCHE OUIJA"). La rangee image devient souple
     (minmax(0,1fr)) et le texte passe en premier (auto) : l'image
     retrecit d'elle-meme quand le libelle est long. */
  .bingoCell{ grid-template-rows: minmax(0, 1fr) auto; row-gap: 2px; }
  .bingoCell__img{
    width: auto;
    height: 100%;
    min-height: 0;
    max-width: 80%;
    max-height: 52px;
  }
  .bingoCell__label{
    font-size: 9px;
    line-height: 1.08;
    letter-spacing: 0;
    -webkit-line-clamp: 4;
    /* mots longs (FANTOMATIQUE, MEADOWS...) : cesure propre, sinon coupure forcee */
    -webkit-hyphens: auto;
    hyphens: auto;
    overflow-wrap: anywhere;
  }
  .bingoLegend{ gap: 6px 12px; }
  .bingoLegend__item{ font-size: 9.5px; }
  .bingoToolbar{ flex-direction: column; align-items: stretch; }
  .bingoToolbar__actions{ justify-content: center; }
  .trollExplodeOverlay{ font-size: 64px; }
  .bingoModes__grid{ grid-template-columns: 1fr; }
  .bingoCustomGrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bingoGallery__grid{ grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

@media (prefers-reduced-motion: reduce){
  .bingoCell{ transition: opacity .01s linear, transform .01s linear; }
  .bingoGallery__item{ transition: opacity .01s linear, transform .01s linear; }
  .bingoCell.is-winning{ animation: none; }
  .bingoGrid{ transition: none; }
  .troll-shake > .bingoCell, .troll-explode-impact, .troll-breathe{ animation: none !important; }
  .trollWhisper{ transition: none; }
  .trollGhost, .trollGhostSign{ animation: none; transition: opacity .2s ease; }
  .ghostArm, .ghostBody{ animation: none; transition: none; }
  .ghostPupil{ transition: none; }
  .trollPeekGhost{ transition: opacity .2s ease; }
  .trollMoonwalk.is-going{ animation: none; opacity: 0; }
  .bingoCell.troll-cell-flip{ animation: none; }
  .bingoCell.is-shining, .bingoCell.is-shining::before{ animation: none; }
  .trollConfetti, .trollBalloon, .trollKawaiiSparkle, .trollKawaiiHeart, .bingoCell.troll-wave-hop{ animation: none; }
  .trollExplodeOverlay, .trollExplodeOverlay.is-boom{ animation: none; }
  .bingoBtn--attention{ animation: none; box-shadow: 0 0 0 1px rgba(255,190,90,.35); }
  .bingoDownloadPrompt, .bingoDownloadPrompt__card{ transition: none; }
  .trollFragment.is-bursting, .trollFragment.is-falling{ transition: none; }
}
