* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #1a0b2e 0%, #0f0523 100%);
  color: #fff;
  overflow: hidden;
}

.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(90deg, #8b00ff 0%, #ff006e 50%, #00f5ff 100%);
  padding: 1rem 2rem;
  box-shadow: 0 4px 20px rgba(255, 0, 110, 0.3);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title {
  font-size: 1.8rem;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.header-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.volume-slider {
  width: 100px;
}

.btn-clear, .btn-help {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-clear:hover, .btn-help:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Palette */
.palette {
  width: 280px;
  background: rgba(26, 11, 46, 0.9);
  backdrop-filter: blur(10px);
  border-right: 2px solid rgba(255, 0, 110, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.palette-header {
  padding: 1rem;
  border-bottom: 2px solid rgba(255, 0, 110, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.palette-header h3 {
  font-size: 1.2rem;
  color: #00f5ff;
}

.btn-collapse, .btn-expand-palette, .btn-expand-visualizer {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.3s;
}

.btn-collapse:hover, .btn-expand-palette:hover, .btn-expand-visualizer:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-expand-palette {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}

.btn-expand-visualizer {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}

.palette-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.palette-section {
  margin-bottom: 1.5rem;
}

.palette-section h4 {
  font-size: 0.9rem;
  color: #ffbe0b;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.module-btn, .preset-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 0, 110, 0.3), rgba(0, 245, 255, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.7rem;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  text-align: left;
}

.module-btn:hover, .preset-btn:hover {
  background: linear-gradient(135deg, rgba(255, 0, 110, 0.5), rgba(0, 245, 255, 0.5));
  transform: translateX(5px);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.5);
}

/* Canvas */
.canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #1a0b2e 0%, #0f0523 100%);
}

.connections-layer {
  pointer-events: none;
}

.connection-cable {
  filter: drop-shadow(0 0 5px currentColor);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Module */
.module {
  position: absolute;
  width: 240px;
  background: rgba(15, 5, 35, 0.95);
  border: 2px solid;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  cursor: move;
  transition: box-shadow 0.3s;
}

.module:hover {
  box-shadow: 0 10px 50px rgba(255, 0, 110, 0.3);
}

.module-header {
  padding: 0.7rem;
  border-radius: 13px 13px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  user-select: none;
}

.module-header:active {
  cursor: grabbing;
}

.module-title {
  font-weight: 700;
  font-size: 1rem;
  color: white;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.module-close {
  background: rgba(0, 0, 0, 0.3);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: all 0.3s;
}

.module-close:hover {
  background: rgba(255, 0, 0, 0.5);
  transform: rotate(90deg);
}

.module-body {
  padding: 1rem;
  display: flex;
  gap: 1rem;
  position: relative;
}

.module-jacks-left, .module-jacks-right {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  justify-content: center;
}

.module-jacks-left {
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
}

.module-jacks-right {
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
}

.jack {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.jack:hover {
  background: rgba(0, 245, 255, 0.5);
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.8);
  transform: scale(1.2);
}

.jack.connecting {
  background: rgba(255, 190, 11, 0.8);
  box-shadow: 0 0 20px rgba(255, 190, 11, 1);
  animation: glow 0.5s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.module-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0 1.5rem;
}

.control-knob, .control-slider, .control-select {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-knob label, .control-slider label, .control-select label {
  font-size: 0.8rem;
  color: #ffbe0b;
  font-weight: 600;
  text-transform: uppercase;
}

.knob, .slider {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  outline: none;
  -webkit-appearance: none;
}

.knob::-webkit-slider-thumb, .slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #ff006e, #00f5ff);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

.knob::-moz-range-thumb, .slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #ff006e, #00f5ff);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
  border: none;
}

.knob-value, .slider-value {
  font-size: 0.75rem;
  color: #00f5ff;
  text-align: center;
  font-weight: 600;
}

.select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem;
  border-radius: 5px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.select option {
  background: #1a0b2e;
  color: white;
}

/* Visualizer */
.visualizer-panel {
  width: 320px;
  background: rgba(26, 11, 46, 0.9);
  backdrop-filter: blur(10px);
  border-left: 2px solid rgba(255, 0, 110, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.visualizer-header {
  padding: 1rem;
  border-bottom: 2px solid rgba(255, 0, 110, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.visualizer-header h3 {
  font-size: 1.2rem;
  color: #00f5ff;
}

.visualizer-canvas {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

/* Control Panel */
.control-panel {
  background: rgba(26, 11, 46, 0.95);
  padding: 1rem 2rem;
  border-top: 2px solid rgba(255, 0, 110, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
}

.btn-play {
  background: linear-gradient(135deg, #06ffa5, #00f5ff);
  border: none;
  color: #1a0b2e;
  padding: 0.8rem 2rem;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 5px 20px rgba(6, 255, 165, 0.3);
}

.btn-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 30px rgba(6, 255, 165, 0.5);
}

.btn-play.playing {
  background: linear-gradient(135deg, #ff006e, #ffbe0b);
  animation: playing 1s ease-in-out infinite;
}

@keyframes playing {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.panel-info {
  color: #00f5ff;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Help overlay */
.help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.help-content {
  background: linear-gradient(135deg, #1a0b2e, #0f0523);
  padding: 2rem;
  border-radius: 20px;
  max-width: 500px;
  border: 2px solid rgba(0, 245, 255, 0.5);
  box-shadow: 0 10px 50px rgba(0, 245, 255, 0.3);
}

.help-content h2 {
  color: #00f5ff;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.help-content p {
  margin-bottom: 0.8rem;
  line-height: 1.6;
  color: #fff;
}

.btn-close-help {
  background: linear-gradient(135deg, #ff006e, #00f5ff);
  border: none;
  color: white;
  padding: 0.8rem 2rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  margin-top: 1rem;
  transition: all 0.3s;
}

.btn-close-help:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 245, 255, 0.5);
}

/* Footer */
.footer {
  background: rgba(15, 5, 35, 0.8);
  padding: 0.8rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer a {
  color: #00f5ff;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
}

.footer a:hover {
  color: #ff006e;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 245, 255, 0.5);
}