/* Conteneur global de page */
.page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  justify-content: center;  /* ← centre verticalement */
  align-items: center;      /* ← en plus, centre horizontalement */
}

/* 1) On fait de game-container un flex-child qui grandit */
.page-wrapper > .game-container {
  flex: 1;                  /* occupe toute la place entre header et footer */
  display: flex;            /* on active le flex pour ses enfants */
  flex-direction: column;   /* colonne pour empiler game-inner, form, etc. */
}

/* 1) Conteneur qui centre la barre et limite sa largeur */
.topbar-wrapper {
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 2) S’assurer que la game-topbar occupe toute la largeur de son parent */
.topbar-wrapper .game-topbar {
  width: 100%;
}

@keyframes pulse {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.3);
    opacity: 1;
  }
}

#orb-background {
  width: 100%;
  height: 100%;
  display: block;
}

/* Contenu principal (entre header et footer) */
.page-content {
  flex: 1;
}

/* Conteneur principal de jeu */
.game-container {
  margin: 0 auto;
  max-width: 850px;
  max-height: none;
  width: 100%;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  background-color: #1a1a1a;
  background-image: url('../images/voronoi-pattern.png');
  background-size: 200px 200px;     /* ← réduit le motif */
  background-repeat: repeat;        /* ← duplique l’image */
  background-position: center;
  border-left: 2px solid #000000;
  border-right: 2px solid #000000;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  color: #fff;
  text-align: center;
  box-sizing: border-box;
  padding: 0rem;
  overflow-y: auto;  
  margin: 0 auto;
  justify-content: center;    /* centre verticalement */
  position: relative; /* nécessaire pour contenir les orbes */
  z-index: 0;         /* garantit que le canvas est derrière */
  flex: 1;
  overflow: hidden;
}

/* Header (ton <header> inclus via header.php) */
header {
  flex: 0 0 auto;         /* prend sa hauteur naturelle */
}

/* Footer (ta .super-footer) */
.super-footer {
  flex: 0 0 auto;         /* prend sa hauteur naturelle */
}

/* Header principal */
header {
  margin-bottom: 0 !important;
}

/* Barre supérieure sticky */
.super-topbar {
  position: sticky;
  top: 0;
  z-index: 1001;
  background-color: #1e1e1e;
  backdrop-filter: blur(6px);
  border: 2px solid #000000;
  border-radius: 12px 12px 0 0;
  padding: 0.5rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Layout des trois zones */
.superbar-left,
.superbar-center,
.superbar-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.superbar-left  { justify-content: flex-start; }
.superbar-right { justify-content: flex-end; }

/* Logo dans la topbar */
.superbar-logo {
  height: 40px;
  max-width: 100px;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.15));
  transition: filter 0.3s ease;
}
.superbar-logo:hover {
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.25));
}

/* Titre sobre */
.superbar-title {
  font-family: 'SunsetHeavy', 'Segoe UI', 'Arial', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.5px;
}

.super-footer {
  background-color: #1e1e1e;
  backdrop-filter: blur(6px);
  border: solid 2px #000000;
  border-radius: 0 0 12px 12px;
  padding: 0.8rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 850px;
  width: 100%;
  height: 3rem;
  margin: 0 auto;
  box-sizing: border-box;
  color: #ffffff;
  font-size: 1rem;
}

.super-footer a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.super-footer a:hover {
  color: #dddddd;
}

.footer-left,
.footer-center,
.footer-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-left  { justify-content: flex-start; }
.footer-right { justify-content: flex-end; }

/* Contenu principal (entre header et footer) */
.page-content {
  flex: 1;
}

.game-interaction-box {
  width: 100%;
  margin: 0 auto; /* pour centrer la box */
  padding: 1rem;
  background-color: rgba(26, 26, 26, 0.7);
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

/* cache complètement les boxes marquées "hidden" */
.game-interaction-box.hidden {
  display: none !important;
  margin: 0;
  padding: 0;
  border: none;
}

/* 2) États de base et caché */
.box-content {
  display: none;       /* caché par défaut */
  overflow: hidden;    /* éviter débordement pendant l’anim */
  margin-top: 1rem;
  margin-bottom: auto;
}

/* 3) Classe pour l’ouverture */
.box-content.showing {
  display: block;      /* rend visible */
  animation: slideDownFade 0.4s ease forwards;
}

/* 4) Classe pour la fermeture */
.box-content.hiding {
  animation: slideUpFade 0.3s ease forwards;
}

#game-inner {
  flex: 1;               /* occupe toute la hauteur de .game-container */
  width: 100%;
  display: flex;         /* si vous voulez aussi centrer son contenu */
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;             /* s’assure d’être au-dessus du canevas */
}

/* ———————————————————————————
   2) Aligner “Générer” et “Visualiser”
————————————————————————————— */
/* Suppression de toute marge inutile */
#generate-section,
#visualize-section {
  margin-top: 0 !important;
  padding-top: 1rem !important;
}

/* Si tu as un <hr> entre les sections, donne-lui une classe et ajuste-la */
.section-divider {
  margin: 1.5rem auto !important;
  width: 80%;
  border: none;
  height: 2px;
  background: #333;
}

/* Conteneur global de page */
.page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  justify-content: center;  /* ← centre verticalement */
  align-items: center;      /* ← en plus, centre horizontalement */
}

/* 1) On fait de game-container un flex-child qui grandit */
.page-wrapper > .game-container {
  flex: 1;                  /* occupe toute la place entre header et footer */
  display: flex;            /* on active le flex pour ses enfants */
  flex-direction: column;   /* colonne pour empiler game-inner, form, etc. */
}

/* 1) Conteneur qui centre la barre et limite sa largeur */
.topbar-wrapper {
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 2) S’assurer que la game-topbar occupe toute la largeur de son parent */
.topbar-wrapper .game-topbar {
  width: 100%;
}

#orb-background-wrapper {
  position: fixed;
  inset: 0;               /* top/right/bottom/left = 0 */
  overflow: hidden;
  z-index: 0;
  pointer-events: none;   /* laisse passer les clics */
  margin: 0 auto;
  max-width: 848px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  top: 0;
  left: 0;
}
#orb-background {
  width: 100%;
  height: 100%;
  display: block;
  filter: blur(30px);
}

#orb-background {
  width: 100%;
  height: 100%;
  display: block;
}

.box-content.game-interaction-box {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  margin-bottom: 2rem;
  margin-top: 0;
}

/* Pour cacher la scrollbar sans bloquer le scroll */
.box-content.game-interaction-box::-webkit-scrollbar {
  width: 0;
}
.box-content.game-interaction-box {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.form-inner {
  overflow-x: auto;
}

/* BULLE : état caché de base */
.settings-bubble {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  visibility: hidden;
  opacity: 0;
  /* largeur responsive à 80% */
  width: 80%;
  max-width: 360px;               /* ne dépasse pas 360px sur mobile */
  background: rgba(30,30,30,0.95);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  border: 1px solid #333;
  z-index: 1500;
  text-align: center;
  transition:
    opacity 0.25s ease-out,
    transform 0.25s ease-out,
    visibility 0s linear 0.25s;   /* délai pour masquer après la transition */
}

/* BULLE : état visible */
.settings-bubble.active {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) scale(1);
  transition-delay: 0s;
}

/* Au-delà de 1024px, on élargit « desktop » */
@media (min-width: 1024px) {
  .settings-bubble {
    width: 50%;                  /* prend 50% de l’écran desktop */
    max-width: 600px;            /* ne dépasse pas 600px */
  }
}

.available-pack {
  position: relative;
}

/* Le lien “info” */
.available-pack .info-link {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #ffffff;        /* bleu */
  font-size: 1.2rem;     /* ajustable */
  text-decoration: none; /* pas de soulignement */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  line-height: 1;
}

/* Optionnel : effet hover */
.available-pack .info-link:hover {
  color: #00d2ff;
}

/* Ajuste la taille de l’icône */
.available-pack .info-link svg {
  width: 1em;
  height: 1em;
}

.rules-overlay.active {
  display: flex;
  backdrop-filter: blur(6px);
}

/* fond sombre + flou */
.pack-info-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 10000;
}

/* boîte de contenu (le “card”) */
.pack-info-content {
  background: rgba(30, 30, 30, 0.95);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
  color: #fff;             /* ou la couleur qui convient */
  position: relative;
  max-width: 90%;
  width: 400px;
  box-sizing: border-box;
}

.pack-info-content .pack-info-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #aaa;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.25rem;
  transition: color 0.2s;
}
.pack-info-content .pack-info-close:hover {
  color: #fff;
}

.pack-description {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #ccc;
  line-height: 1.4;
}

/* === Stats table : full-width + coins arrondis === */
.profile-stats{
  width: 100%;
  display: block;                 /* au lieu du grid centré */
}

.profile-stats .stats-table{
  width: 100% !important;         /* prend toute la largeur disponible */
  max-width: none !important;
  border-collapse: separate;      /* nécessaire pour border-radius sur table */
  border-spacing: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid #2a2a2a;
  border-radius: 12px;            /* coins arrondis */
  overflow: hidden;               /* clippe les coins arrondis */
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

/* cellules */
.stats-table.stats-kv th,
.stats-table.stats-kv td{
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.stats-table.stats-kv tbody tr:last-child th,
.stats-table.stats-kv tbody tr:last-child td{
  border-bottom: 0;
}

/* colonne libellé (gauche) et valeur (droite) */
.stats-table.stats-kv th{
  width: 50%;
  text-align: left;
  background: linear-gradient(90deg, rgba(0,0,0,0.35), rgba(0,0,0,0.15));
  color: #9ee7ff;                 /* petit accent */
  font-weight: 700;
  letter-spacing: .2px;
}
.stats-table.stats-kv td{
  width: 50%;
  text-align: right;
  color: #fff;
  font-weight: 800;
}

/* petit feedback au survol */
.stats-table.stats-kv tbody tr:hover{
  background: rgba(255,255,255,0.02);
}

/* mobile: empile la valeur sous le libellé si très étroit */
@media (max-width: 360px){
  .stats-table.stats-kv th, .stats-table.stats-kv td{
    display: block;
    width: 100%;
    text-align: left;
    padding: .6rem 1rem .4rem;
  }
  .stats-table.stats-kv td{
    padding-top: 0;
    opacity: .95;
  }
}


.game-container{
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;  /* inertie iOS */
  overscroll-behavior: contain;       /* limite le pull-to-refresh */
}

/* ===== Scroll visible et sobre dans .game-interaction-box ===== */

/* 0) S'assurer que la box peut scroller correctement dans un parent flex */
.game-interaction-box{
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 0;                 /* évite les blocages de scroll en flex */
  -ms-overflow-style: auto !important; /* réactive l'affichage (IE/Edge Legacy) */
  scrollbar-width: thin !important;     /* Firefox: réactive + mince */
  scrollbar-color: #7a7a7a rgba(255,255,255,0.06) !important;
}

/* 1) Annule les anciennes règles qui cachaient la scrollbar */
.game-interaction-box::-webkit-scrollbar{
  width: 10px !important;  /* remplace le width:0 précédent */
  height: 10px !important; /* pour le scroll horizontal éventuel */
}

/* 2) WebKit: style sobre gris */
.game-interaction-box::-webkit-scrollbar-track{
  background: rgba(255,255,255,0.06);
  border-left: 1px solid rgba(0,0,0,0.6);
}
.game-interaction-box::-webkit-scrollbar-thumb{
  background-color: #7a7a7a;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.game-interaction-box:hover::-webkit-scrollbar-thumb{
  background-color: #8b8b8b;
}
.game-interaction-box::-webkit-scrollbar-thumb:active{
  background-color: #9a9a9a;
}

/* 3) Option confort (iOS inertie + padding scroll-top pour ancres) */
.game-interaction-box{
  -webkit-overflow-scrolling: touch;
  scroll-padding-top: 12px;
}

.fade-form{ display:none; opacity:0; transition:opacity .25s ease; }
.fade-form.showing{ display:block; }
.fade-form.visible{ opacity:1; }


/* ——— Split du profil en 2 cartes ——— */
.profile-split{
  display: grid;
  gap: 1rem;
}

/* 2 colonnes sur écrans larges */
@media (min-width: 900px){
  .profile-split{
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* Style des deux cartes internes */
.profile-card{
  background: rgba(26,26,26,0.7);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  height: 100%;
}

/* (Option) allège le fond du conteneur principal si tu trouves le double cadre trop chargé */
/*
#box-avatar.game-interaction-box{
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
*/

.available-pack .pack-media {
  margin-bottom: 0.75rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #333;
}

.available-pack .pack-thumb {
  display: block;
  width: 100%;
  height: 140px;        /* ajuste selon ton design */
  object-fit: cover;    /* recadrage propre */
}

/* Applique le fondu fixe aux bords du contenu scrollable */
.box-content.game-interaction-box{
  /* garde ton overflow-y: auto etc. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 24px,
    black calc(100% - 24px),
    transparent 100%
  );
          mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 24px,
    black calc(100% - 24px),
    transparent 100%
  );
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
}

@keyframes giFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Anime n'importe quel élément à qui on met gi-appear */
.gi-appear {
  animation: giFadeIn .28s cubic-bezier(.22,1,.36,1) both;
  will-change: opacity, transform;
}

@media (prefers-reduced-motion: reduce){
  .gi-appear { animation: none; }
}
