@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 30%, #1a1a2e, #16213e);
  padding: 20px;
}

.wrapper {
  max-width: 1400px; /* légèrement plus large pour accueillir 9 effets */
  width: 100%;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 40px;
  padding: 30px;
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* En-tête (inchangé) */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 20px;
}

.title {
  color: #fff;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(0, 200, 255, 0.3);
}

.controls {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}

.octave-control {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 18px;
  border-radius: 40px;
  border: 1px solid #3a4a6a;
}

.octave-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #2a3a5a;
  color: white;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 10px rgba(0,0,0,0.3);
}

.octave-btn:hover {
  background: #4a6a9a;
  transform: scale(1.08);
}

.octave-btn:active {
  transform: scale(0.95);
}

.octave-info {
  color: #ccddee;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
}

#current-octave {
  color: #88aaff;
  font-size: 24px;
  font-weight: 700;
  min-width: 30px;
  text-align: center;
  text-shadow: 0 0 8px #4488ff;
}

.waveform-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ddd;
  font-size: 14px;
}

#waveform-select {
  background: #1e2a3a;
  color: white;
  border: 1px solid #4a6a8a;
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

/* ===== Effets : un seul conteneur flex ===== */
.effects-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  justify-content: space-between; /* espacement homogène */
}

.effect {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(20, 30, 45, 0.7);
  border-radius: 16px;
  padding: 12px 8px;
  border: 1px solid rgba(100, 150, 255, 0.2);
  flex: 0 1 auto;
  width: 114px; /* largeur fixe pour uniformité */
  transition: 0.2s;
}

.effect:hover {
  background: rgba(30, 45, 70, 0.8);
  border-color: #4a8cff;
}

.effect-btn {
  width: 100%;
  background: #2a3a50;
  border: none;
  color: #ccc;
  padding: 8px 0;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.effect-btn.active-button {
  background: #3a6ea5;
  color: white;
  border-color: #8ab2ff;
  box-shadow: 0 0 15px #3a6ea5;
}

.effect-slider {
  width: 90px;
  height: 5px;
  -webkit-appearance: none;
  background: #2a4050;
  border-radius: 5px;
  outline: none;
}

.effect-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 15px #3a8cff;
  border: 2px solid #3a8cff;
  transition: 0.1s;
}

.effect-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.effect-slider:disabled {
  opacity: 0.3;
}
.effect-slider:disabled::-webkit-slider-thumb {
  background: #aaa;
  border-color: #666;
  box-shadow: none;
}

/* Piano (inchangé) */
.piano-container {
  width: 100%;
  overflow-x: auto;
  margin: 25px 0 15px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px 0;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

.piano {
  display: flex;
  justify-content: center;
  min-width: max-content;
  padding: 0 15px;
}

.white-key, .black-key {
  position: relative;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.06s ease;
  border-radius: 0 0 10px 10px;
}

.white-key {
  width: 70px;
  height: 220px;
  background: linear-gradient(to bottom, #f8f9fc, #e0e5ec);
  border: 1px solid #8a9aa5;
  margin-right: 1px;
  box-shadow: inset 0 -5px 0 #b0c0c8, 0 8px 15px rgba(0,0,0,0.3);
  color: #1a2a3a;
  z-index: 1;
}

.black-key {
  width: 44px;
  height: 140px;
  background: linear-gradient(145deg, #1e2a3a, #0f1a22);
  border: 1px solid #000;
  margin: 0 -22px 0 -22px;
  box-shadow: inset 0 -3px 0 #000, 0 10px 15px rgba(0,0,0,0.5);
  color: #e0e8ff;
  z-index: 2;
}

.white-key.active,
.white-key.pressed {
  background: linear-gradient(to bottom, #c8dbff, #a0b8ff);
  transform: translateY(5px);
  box-shadow: inset 0 -2px 0 #6a8ad0, 0 8px 12px rgba(0,0,0,0.2);
  color: #000;
}

.black-key.active,
.black-key.pressed {
  background: linear-gradient(145deg, #3a4e6a, #1f2e3e);
  transform: translateY(5px);
  box-shadow: inset 0 -2px 0 #0a1a2a, 0 10px 15px rgba(0,0,0,0.5);
  color: white;
}

.instructions {
  text-align: center;
  color: rgba(220, 230, 255, 0.7);
  font-size: 13px;
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

/* ===== RESPONSIVE ===== */
/* Très grands écrans : tous les effets tiennent déjà sur une ligne */
@media screen and (max-width: 1300px) {
  .wrapper { max-width: 1200px; }
}

/* Passage à 2 lignes si nécessaire */
@media screen and (max-width: 1100px) {
  .effects-row { justify-content: center; }
  .effect { width: 105px; }
}

/* Tablette : 2 lignes */
@media screen and (max-width: 900px) {
  .effect { width: 100px; }
}

/* Mobile : 1 colonne */
@media screen and (max-width: 700px) {
  .effects-row {
    flex-direction: column;
    align-items: center;
  }
  .effect {
    width: 100%;
    max-width: 300px;
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 15px;
  }
  .effect-btn {
    width: auto;
    margin-bottom: 0;
    padding: 6px 16px;
  }
  .effect-slider { width: 140px; }
  .white-key, .black-key { font-size: 0; }
}

@media screen and (max-width: 480px) {
  .wrapper { padding: 20px; }
  .white-key { width: 40px; height: 140px; }
  .black-key { width: 24px; height: 85px; margin: 0 -12px; }
  .octave-btn { width: 32px; height: 32px; font-size: 20px; }
  .effect { max-width: 100%; }
}