* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.synth-container {
  width: 100%;
  max-width: 900px;
  background: rgba(30, 30, 46, 0.8);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  padding: 25px;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #e94560, #0fccce, #ffcc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(15, 204, 206, 0.3);
  letter-spacing: 2px;
}

.subtitle {
  font-size: 1.2rem;
  color: #8a8a9e;
  margin-bottom: 8px;
  font-weight: 300;
}

.tagline {
  font-size: 0.9rem;
  color: #e94560;
  font-style: italic;
  margin-bottom: 5px;
}

.control-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.control-section {
  background: rgba(40, 40, 60, 0.7);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

h2 {
  color: #0fccce;
  margin-bottom: 15px;
  font-size: 1.3rem;
  border-bottom: 1px solid #0fccce;
  padding-bottom: 8px;
}

.waveform-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.wave-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px;
  background: #2a2a3e;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.wave-btn.active {
  background: #e94560;
  box-shadow: 0 0 10px rgba(233, 69, 96, 0.7);
}

.wave-btn:hover {
  background: #3a3a4e;
}

.slider-container {
  margin-bottom: 15px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.slider {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  background: #2a2a3e;
  border-radius: 4px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0fccce;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(15, 204, 206, 0.7);
}

.scale-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.scale-btn {
  flex: 1;
  min-width: 70px;
  padding: 8px 5px;
  background: #2a2a3e;
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-size: 0.9rem;
}

.scale-btn.active {
  background: #0fccce;
  box-shadow: 0 0 8px rgba(15, 204, 206, 0.7);
}

/* IMPROVED KEYBOARD STYLING */
.keyboard-container {
  width: 100%;
  overflow-x: auto;
  position: relative;
  margin-top: 20px;
  -webkit-overflow-scrolling: touch;
}

.keyboard {
  display: flex;
  position: relative;
  height: 160px;
  min-width: min-content;
  margin: 0 auto;
  padding: 0 10px;
  touch-action: manipulation;
}

.white-key {
  width: 45px;
  height: 150px;
  background: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 0 0 5px 5px;
  margin: 0 1px;
  cursor: pointer;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  z-index: 1;
  transition:
    background 0.1s,
    transform 0.05s;
  position: relative;
  user-select: none;
  flex-shrink: 0;
}

.white-key.active {
  background: #ffcc00;
  transform: translateY(2px);
}

.black-key {
  width: 28px;
  height: 95px;
  background: #333;
  border-radius: 0 0 4px 4px;
  position: absolute;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.4);
  transition:
    background 0.1s,
    transform 0.05s;
  user-select: none;
  flex-shrink: 0;
}

.black-key.active {
  background: #ff6600;
  transform: translateY(2px);
}

.key-label {
  position: absolute;
  bottom: 10px;
  width: 100%;
  text-align: center;
  font-size: 0.7rem;
  color: #333;
  pointer-events: none;
}

.black-key .key-label {
  color: #fff;
}

.octave-separator {
  width: 3px;
  height: 140px;
  background: linear-gradient(to bottom, transparent, #0fccce, transparent);
  margin: 0 5px;
  flex-shrink: 0;
  align-self: center;
}

.visualizer {
  width: 100%;
  height: 120px;
  background: rgba(20, 20, 35, 0.8);
  border-radius: 10px;
  margin-top: 20px;
  overflow: hidden;
  position: relative;
}

canvas {
  width: 100%;
  height: 100%;
}

.footer {
  text-align: center;
  margin-top: 20px;
  color: #8a8a9e;
  font-size: 0.9rem;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .control-panel {
    grid-template-columns: 1fr;
  }

  .keyboard {
    height: 140px;
  }

  .white-key {
    width: 35px;
    height: 130px;
  }

  .black-key {
    width: 22px;
    height: 80px;
  }

  .key-label {
    font-size: 0.6rem;
    bottom: 5px;
  }

  .octave-separator {
    height: 120px;
  }
}

@media (max-width: 480px) {
  .synth-container {
    padding: 15px;
  }

  .title {
    font-size: 2.5rem;
  }

  .keyboard {
    height: 120px;
  }

  .white-key {
    width: 30px;
    height: 110px;
  }

  .black-key {
    width: 18px;
    height: 70px;
  }

  .key-label {
    font-size: 0.5rem;
  }

  .octave-separator {
    height: 100px;
  }
}

/* Keyboard scrolling hint */
.keyboard-scroll-hint {
  text-align: center;
  color: #8a8a9e;
  font-size: 0.8rem;
  margin-top: 5px;
  display: none;
}

@media (max-width: 480px) {
  .keyboard-scroll-hint {
    display: block;
  }
}
