html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  font-family: 'Josafronde', sans-serif;
  color: white;
  height: 100vh;
  background: linear-gradient(120deg, #d6a4a4, #c0b6f2, #a1c4fd);
  background-size: 200% 200%;
  animation: gradientMove 12s ease infinite;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 200px;
  height: 100vh;

  background: linear-gradient(
    90deg,
    rgba(75, 46, 131, 0.25) 0%,
    rgba(75, 46, 131, 0.1) 50%,
    rgba(75, 46, 131, 0) 100%
  );

  pointer-events: none;
  z-index: 1;
}

/* Animation du fond dégradé */
@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 1rem;
  z-index: 10;
}


.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 60px;
  height: 100vh;


  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 20;
  cursor: pointer;
}

.menu-bar span {
  transform: rotate(-90deg);
  color: white;
  letter-spacing: 2px;
  font-size: 0.9rem;
}



#menu-fade {
  position: fixed;
  top: 0;
  left: 0;
  width: 180px;
  height: 100vh;

  background: linear-gradient(
    90deg,
    rgba(75, 46, 131, 0.25) 0%,
    rgba(75, 46, 131, 0.15) 40%,
    rgba(75, 46, 131, 0.05) 70%,
    rgba(75, 46, 131, 0) 100%
  );

  pointer-events: none;
  z-index: 5;
}


#side-menu.open {
  transform: translateX(0);
}


#side-menu nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#side-menu a {
  color: white;
  font-size: 2rem;
  text-decoration: none;
  margin: 0.8rem 0;
}

#side-menu a:hover {
  opacity: 0.6;
}


#side-menu {
  position: fixed;
  top: 0;
  left: 0;

  width: 50%;
  height: 100vh;

  background: linear-gradient(
    90deg,
    rgba(75, 46, 131, 0.95) 0%,
    rgba(75, 46, 131, 0.6) 60%,
    rgba(75, 46, 131, 0) 100%
  );

  transform: translateX(-100%);
  transition: transform 0.4s ease;

  z-index: 10;

  display: flex;
  align-items: center;
  padding-left: 100px;
}

#side-menu.open {
  transform: translateX(0);
}

#side-menu a {
  color: white;
  font-size: 1.5rem;
}

/* ===== FIX LAYOUT ===== *
/* éviter que le contenu passe sous la barre */
main {
  margin-left: 60px;
}

h1 {
  font-size: 1.3rem;
  font-weight: 300;
  padding-left: 1vw;
  padding-top: 1vh;
}

/* Main layout */
main {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  height: 100%;
  padding-top: 5rem;
  padding-left: 5rem;
}

/* Nuage de mots */
#word-cloud {
  width: 75%;
  position: relative;
  overflow: hidden;
}

.word {
  position: absolute;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  user-select: none;
  animation: floatXY 6s ease-in-out infinite alternate;
  transition: transform 2.5s ease-in-out;
  will-change: transform;
}

.selected-word {
  cursor: pointer;
  margin-right: 8px;
  font-weight: bold;
}

.word.active {
  color: #944BBB;
}

/* Liste de musiques */
#music-list {
  display: flex;
  width: 25%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border-radius: 16px 0 0 16px;
  padding: 1rem;
  box-shadow: -4px 0 10px rgba(0, 0, 0, 0.2);
  overflow: scroll;

  display: none; /* 👈 important */
}

/* visible uniquement quand actif */
#music-list.active {
  display: flex;
  flex-direction: column;
}

#tracks li {
  list-style: none;
  padding: 0.5rem 0;
  cursor: pointer;
}

#tracks li:hover {
  text-decoration: underline;
}

#player {
  width: 100%;
margin-top: auto;
margin-bottom: 1vh;
}

#burger {
  display: none;
}

@media (max-width: 768px) {

  html, body {
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: scroll;
  }

  main {
    flex-direction: column;
    padding: 5rem 1rem 2rem 1rem;
    margin-left: 0;
    height: auto;
  }

  /* ---- TITLE SUR 2 LIGNES ---- */
  h1 {
    font-size: 1.1rem;
    line-height: 1.3;
    padding-left: 3rem;
    padding-right: 1rem;
    max-width: 90%;
    font-weight: 900;
  }

  /* FORCER 2 LIGNES */
  h1 br {
    display: block;
  }

  /* ---- WORD CLOUD ---- */
  #word-cloud {
    width: 100%;
    height: 70vh;
    overflow: hidden;
  }

  .word {
    font-size: 0.95rem;
  }

  /* ---- PLAYLIST SOUS LE NUAGE ---- */
  #music-list {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 1rem;
    border-radius: 16px;
      min-width: 0;
  }

  #tracks li {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

  /* ---- BURGER ---- */
  #burger {
    display: block;
    position: fixed;
    top: 1rem;
    left: 1rem;
    font-size: 2rem;
    z-index: 999;
  }

  #burger:hover {
    color: #944BBB;
    cursor: pointer;
  }

  .menu-bar {
    display: none;
  }

  #player {
    display: hidden;
  }
}