/* ============================================================
   GenBox — Musique et effets sonores
   Panneau de composition à droite, morceaux au centre.
   ============================================================ */

.music-layout { display: flex; width: 100%; min-height: 0; }

/* ---------- centre : les morceaux ---------- */
.music-results { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.music-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  padding: var(--s3) var(--s5);
  border-bottom: 1px solid var(--line-soft);
  background: var(--base);
}
.music-title { font-size: var(--fs-md); font-weight: 600; }
.music-sub { font-size: var(--fs-sm); color: var(--tx3); margin-top: 2px; }
.music-head-actions { display: flex; align-items: center; gap: var(--s2); }

.music-modes {
  display: flex;
  gap: 3px;
  background: var(--void);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-full);
  padding: 3px;
}
.music-mode {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--tx3);
  padding: 6px 15px;
  border-radius: var(--r-full);
  transition: background var(--speed), color var(--speed);
}
.music-mode:hover { color: var(--tx2); }
.music-mode.active { background: var(--violet); color: var(--void); }

.music-tracks {
  flex: 1;
  overflow-y: auto;
  padding: var(--s4) var(--s5) var(--s6);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

/* ---------- une piste ---------- */
.track {
  background: var(--base);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--speed), background var(--speed);
}
.track.playing { border-color: var(--violet-dim); background: color-mix(in oklab, var(--violet) 6%, var(--base)); }
.track.pending { opacity: 0.72; }

.track-top { display: flex; align-items: center; gap: var(--s3); }
.track-play {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--violet);
  flex: none;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--speed);
}
.track-play:hover { background: var(--violet-hi); }
.track-play .ico-play {
  width: 0; height: 0;
  border-left: 11px solid var(--void);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  margin-left: 3px;
}
.track-play.is-playing { background: var(--raised); }
.track-play.is-playing .ico-play {
  width: 10px; height: 13px;
  border: none;
  border-left: 3.5px solid var(--tx);
  border-right: 3.5px solid var(--tx);
  margin-left: 0;
}

.track-id { flex: 1; min-width: 0; }
.track-name { font-size: var(--fs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

/* Forme d'onde : barres statiques, la progression colore la partie lue. */
.track-wave { display: flex; align-items: center; gap: 2px; height: 40px; flex: none; cursor: pointer; }
.track-wave i { display: block; width: 3px; border-radius: 2px; background: var(--line); transition: background var(--speed); }
.track-wave i.played { background: var(--violet); }
.track-time { font-family: var(--mono); font-size: var(--fs-xs); color: var(--tx3); flex: none; min-width: 76px; text-align: right; }

/* Volume — n'apparaît que sur la piste en cours de lecture, puisqu'un seul
   lecteur est partagé. Réglé à 60 % par défaut : les fichiers générés sortent
   souvent très fort. */
.track-volume { display: flex; align-items: center; gap: 7px; flex: none; }

/* Contrôle fixe des en-têtes (page Musique et galerie Sons) : accessible même
   quand rien ne joue, puisqu'un seul lecteur est partagé. */
.volume-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  background: var(--void);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-full);
  padding: 5px 12px 5px 9px;
}
.vol-icon {
  width: 20px; height: 20px;
  flex: none;
  position: relative;
  color: var(--tx3);
}
.vol-icon::before {
  content: "";
  position: absolute; left: 3px; top: 6px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 4px 6px 4px 0;
  border-color: transparent currentColor transparent transparent;
}
.vol-icon::after {
  content: "";
  position: absolute; left: 10px; top: 6px;
  width: 6px; height: 8px;
  border: 1.5px solid currentColor;
  border-left: none;
  border-radius: 0 6px 6px 0;
}
.vol-icon:hover { color: var(--tx); }
.vol-icon.muted { color: var(--tx3); opacity: 0.5; }
.vol-icon.muted::after { border-color: transparent; }
.vol-slider { width: 72px; }

.track-lyrics {
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: var(--tx3);
  background: var(--void);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  white-space: pre-line;
  max-height: 92px;
  overflow-y: auto;
}
.track-lyrics b { color: var(--violet-txt); font-weight: 500; }

.track-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.track-actions button {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--tx2);
  background: var(--raised);
  padding: 6px 11px;
  border-radius: var(--r-sm);
  transition: background var(--speed), color var(--speed);
}
.track-actions button:hover { background: var(--hover); color: var(--tx); }
.track-actions button.danger:hover { background: var(--danger-tint); color: var(--danger-txt); }

/* ---------- panneau de composition ---------- */
.music-compose {
  width: 372px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--base);
  border-left: 1px solid var(--line-soft);
  min-height: 0;
}
.compose-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}
/* ---------- aide des réglages ---------- */
.compose-help {
  background: var(--void);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.compose-help summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--tx2);
  list-style: none;
}
.compose-help summary::-webkit-details-marker { display: none; }
.compose-help summary::before { content: "?"; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; background: var(--raised); color: var(--tx3);
  font-size: 10px; font-weight: 700; margin-right: 8px; }
.compose-help[open] summary { margin-bottom: 10px; }
.compose-help-body { display: flex; flex-direction: column; gap: 11px; }
.help-row { display: flex; flex-direction: column; gap: 3px; }
.help-title { font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.help-row p { font-size: var(--fs-xs); color: var(--tx3); line-height: 1.55; text-wrap: pretty; }
.help-yes, .help-no {
  font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  padding: 1px 6px; border-radius: var(--r-xs);
}
.help-yes { background: var(--ok-tint); color: var(--ok-txt); }
.help-no { background: var(--raised); color: var(--tx3); }
.help-foot { font-size: var(--fs-xs); color: var(--tx3); line-height: 1.5; border-top: 1px solid var(--line-soft); padding-top: 9px; }

/* Compteur de caractères : discret, sauf quand la limite est franchie. */
.char-count { font-family: var(--mono); font-size: 10px; color: var(--tx3); margin-left: auto; }
.char-count.over { color: var(--danger-txt); font-weight: 600; }
textarea.over-limit { border-color: var(--danger); }

.compose-group { display: flex; flex-direction: column; gap: var(--s2); }
.compose-group.unsupported { display: none; }
.compose-group-head { display: flex; align-items: center; gap: var(--s2); }
.compose-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx3);
}
.compose-mini { font-size: var(--fs-sm); font-weight: 500; color: var(--violet); align-self: flex-start; }
.compose-mini:hover { color: var(--violet-hi); }
.compose-scroll textarea { resize: none; }
.compose-scroll textarea.mono { font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.7; }

/* ---------- moteurs ---------- */
.engine-list { display: flex; flex-direction: column; gap: 6px; }
.engine {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: var(--void);
  cursor: pointer;
  transition: border-color var(--speed), background var(--speed);
}
.engine:hover { border-color: var(--line); }
.engine.on { border-color: var(--violet-dim); background: color-mix(in oklab, var(--violet) 12%, var(--void)); }
.engine.off { opacity: 0.5; cursor: not-allowed; }
.engine-bullet { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.engine.on .engine-bullet { background: var(--violet); }
.engine-text { flex: 1; min-width: 0; }
.engine-name { font-size: 13px; font-weight: 600; }
.engine-desc { font-size: var(--fs-xs); color: var(--tx3); margin-top: 1px; line-height: 1.4; }
.engine-price { font-family: var(--mono); font-size: 10.5px; color: var(--terra-txt); flex: none; }

/* ---------- étiquettes cliquables ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  background: var(--raised);
  color: var(--tx2);
  transition: background var(--speed), color var(--speed);
}
.tag:hover { background: var(--violet); color: var(--void); }

/* ---------- structure par sections ---------- */
.section-list { display: flex; flex-direction: column; gap: 6px; }
.section-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  background: var(--void);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 7px 9px;
}
.section-row input, .section-row select { padding: 5px 8px; font-size: var(--fs-xs); border: none; background: transparent; }
.section-row select { width: 92px; flex: none; font-family: var(--mono); color: var(--violet-txt); padding-right: 20px; background-position: calc(100% - 8px) 52%, calc(100% - 4px) 52%; }
.section-row input.sec-style { flex: 1; min-width: 0; }
.section-row input.sec-dur { width: 54px; flex: none; font-family: var(--mono); text-align: right; }
.section-row button {
  flex: none;
  width: 20px; height: 20px;
  border-radius: var(--r-xs);
  color: var(--tx3);
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.section-row button:hover { background: var(--danger-tint); color: var(--danger-txt); }

/* ---------- réglages ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 5px 0; }
.range-block { display: flex; flex-direction: column; gap: 7px; margin-top: var(--s2); }
.range-head { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--tx2); }
.range-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--tx3); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); align-items: end; }

.ref-drop {
  display: block;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  padding: var(--s4);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--tx3);
  cursor: pointer;
  transition: border-color var(--speed), background var(--speed);
}
.ref-drop:hover { border-color: var(--violet); background: var(--violet-tint); color: var(--tx2); }

/* ---------- pied ---------- */
.compose-foot {
  flex: none;
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line-soft);
}
.compose-go { width: 100%; padding: 12px; font-size: var(--fs); }
.compose-note {
  font-size: var(--fs-xs);
  color: var(--tx3);
  text-align: center;
  margin-top: var(--s2);
  line-height: 1.5;
  text-wrap: pretty;
}

@media (max-width: 1200px) {
  .music-compose { width: 330px; }
}
@media (max-width: 900px) {
  .music-layout { flex-direction: column; overflow-y: auto; }
  .music-compose { width: 100%; border-left: none; border-top: 1px solid var(--line-soft); }
  .compose-scroll { overflow: visible; }
}
@media (max-width: 768px) {
  .music-head { padding: var(--s3); }
  .music-tracks { padding: var(--s3) var(--s3) 70px; }
  .track-wave { display: none; }
}
