/* =========================
   Variables globales
========================= */
:root {
  --primary-gradient: linear-gradient(180deg, #9333ea, #1c1a39);
  --primary-color: #4f46e5;
  --secondary-color: #9333ea;
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --text-light: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-color: #fbbf24;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  scrollbar-width: 0;
}

body {
  background-color: #1c1a39; /* fond sombre mais pas noir total */
  background-image: none;
  transition: background-image 1s ease, background-color 1s ease;
  color: var(--text-light);
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body.ready {
  background: var(--primary-gradient);
}


body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body.noselect {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Canvas d’arrière-plan */
#backgroundCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -2; /* toujours tout derrière */
  background: transparent;
  display: block;
    opacity: 0;
  transition: opacity 1s ease;
}

#backgroundCanvas.active {
  opacity: 1;
}


/* =========================
   Reset + Base
========================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", sans-serif;
}

body a {
  text-decoration: none;
  color: inherit;
}

body p {
  font-size: 1rem;
  line-height: 1.5;
}

/* =========================
   Topbar & Welcome
========================= */
.home {
  background: transparent;
  margin-top: 50px;
}

.topbar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 100px 20px; /* réduit padding large */
  position: relative;
  z-index: 0; /* devant décorations */
  flex-wrap: wrap;
  gap: 20px;
}

.welcome h3 {
  margin: 0;
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-light);
}

.welcome p {
  color: var(--text-muted);
  max-width: 600px;
}

/* Namebar */
.namebar-link .namebar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 8px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: background 0.3s ease, transform 0.3s ease;
}

.namebar-link .namebar:hover {
  background: #273449;
  transform: scale(1.3);
}

.namebar img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--secondary-color);
}

/* =========================
   Rooms section
========================= */
.rooms-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.room-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 25px;
}

.room-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  position: relative;
  z-index: 0; /* devant décorations */
}

.room-card:hover {
  transform: translateY(-1px);
}

.room-image-wrapper {
  position: relative;
  height: 180px;
}

.room-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-overlay {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.room-overlay h4 {
  font-size: 1.2rem;
}

.room-description {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.join-button {
  display: block;
  text-align: center;
  margin: 15px;
  padding: 10px;
  background: var(--primary-color);
  color: white;
  font-weight: bold;
  border-radius: var(--radius);
  transition: opacity 0.3s ease;
  position: relative;
  z-index: 0; /* devant décorations */
}

.join-button:hover {
  opacity: 0.85;
}

/* =========================
   Features section
========================= */
.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 20px;
  padding: 100px 20px; /* réduit padding large */
  position: relative;
  z-index: 0; /* devant décorations */
}

.feature-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  flex: 1 1 260px; /* flexible width */
  max-width: 320px;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-card img {
  width: 60px;
  margin-bottom: 12px;
}

.feature-card h4 {
  margin-bottom: 8px;
  color: var(--accent-color);
}

/* Fond dégradé dynamique */
.rooms {
  position: relative;
  z-index: 0; /* devant décorations */
  padding: 40px 20px;
  overflow: hidden;
  background: transparent;
}

/* =========================
   Décorations flottantes
========================= */
.decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1; /* entre canvas (-2) et contenu (0) */
}

.decor-icon {
  position: absolute;
  opacity: 0.8;
  width: 120px;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
  animation: float 6s ease-in-out infinite;
  pointer-events: auto; /* pour que clic soit détecté */
  user-select: none;
  transition: left 0.5s ease, top 0.5s ease;
  cursor:default;
}



.decor-icon:hover {
  cursor: default;
  transform: scale(1.1);
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.6));
}

.icon-gamepad {
  top: 30%;
  left: 10%;
  animation-delay: 0s;
}

.icon-trophy {
  top: 50%;
  right: 5%;
  animation-delay: 2s;
}

.icon-globe {
  top: 10%;
  right: 25%;
  animation-delay: 1s;
}


/* =========================
   Animation flottante
========================= */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
}

/* =========================
   Responsive
========================= */
@media (max-width: 1024px) {
  .topbar {
    padding: 60px 20px;
    justify-content: center;
    gap: 15px;
  }

  .welcome h3 {
    font-size: 1.75rem;
  }

  .features {
    padding: 80px 15px;
    gap: 15px;
  }

  .feature-card {
    max-width: 280px;
  }
}

@media (max-width: 768px) {

    .decor-icon {
      display: none !important;
    }
    
  .topbar {
    flex-direction: column;
    padding: 40px 15px;
  }

  .welcome h3 {
    font-size: 1.5rem;
    text-align: center;
  }

  .welcome p {
    font-size: 0.9rem;
    text-align: center;
    max-width: 100%;
  }

  .namebar-link .namebar {
    justify-content: center;
    width: 100%;
  }

  .rooms-container {
    padding: 0 10px;
  }

  .room-image-wrapper {
    height: 140px;
  }

  .join-button {
    margin: 10px auto;
    max-width: 200px;
  }

  .features {
    flex-direction: column;
    padding: 60px 10px;
    justify-content: center;
    align-items: center;
  }

}

@media (max-width: 480px) {
  .topbar {
    padding: 30px 10px;
  }

  .welcome h3 {
    font-size: 1.3rem;
  }

  .room-image-wrapper {
    height: 120px;
  }

  .room-overlay h4 {
    font-size: 1rem;
  }

  .room-description {
    font-size: 0.8rem;
  }

  .join-button {
    padding: 8px;
    font-size: 0.9rem;
  }

  .feature-card img {
    width: 50px;
  }

  .feature-card h4 {
    font-size: 1rem;
  }
}
