body {
    margin: 0;
    font-family: Arial, sans-serif;
}

#synth-container {
    position: relative;
    width: 100%;
    height: 1200px;
}

#synth-canvas {
    display: block;
    position: relative;
    z-index: 10;  /* Rope draws on top */
    pointer-events: none; /* Canvas ignores all mouse events */
}

.draggable {
    position: absolute;
    z-index: 5;   /* Elements below rope visually */
    pointer-events: auto; /* Elements receive mouse events */
    width: 150px;
    height: 100px;
    background-color: #0074b8;
    border: 2px solid #6495ed;
    border-radius: 8px;
    padding: 10px;
    cursor: move;
    user-select: none;
    touch-action: none;
    box-shadow: 0 14px 18px rgba(0, 0, 0, 0.3);
    color: white;
}

.draggable.red {
    background-color: rgba(255, 99, 71, 0.7);
    border-color: #ff6347;
}

.draggable.green {
    background-color: rgba(50, 205, 50, 0.7);
    border-color: #32cd32;
}

.rope-handle {
    position: absolute;
    width: 30px;
    height: 30px;
    background: rgba(111, 111, 111, 0.5);
    border-radius: 50%;
    z-index: 15; /* Above everything */
    pointer-events: auto; /* Handle receives clicks */
    transform: translate(-50%, -50%);
}

/* Style for input and output circles */
.input, .output {
    width: 30px;
    height: 30px;
    border-radius: 50%; /* Makes it circular */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.input {
    background-color: #000; /* Green for inputs */
    color: white;
}

.output {
    background-color: #000; /* Red for outputs */
    color: white;
    bottom: 10px;
    right: 10px;
}

/* Optional: Add hover effects */
.input:hover, .output:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* Optional: Add transition for smooth effects */
.input, .output {
    transition: all 0.2s ease;
}

/* Add these styles to your existing CSS file */

/* Container for vertical slider groups */
.vertical-slider-container {
    display: flex;
    align-items: center;
    margin: 0 10px;
    position: relative;
    justify-content: space-around;
}

/* Wrapper to establish proper height for vertical sliders */
.slider-wrapper.vertical {
    height: 100px;
    position: relative;
    margin: 10px 0;
}

/* Vertical slider specific styling */
input[type="range"][orient="vertical"] {
    writing-mode: bt-lr; /* IE */
    -webkit-appearance: slider-vertical; /* WebKit/Blink */
    width: 8px;
    height: 100px;
    padding: 0;
    accent-color: black;
    cursor: pointer;

}

/* Adjust the synth section for vertical sliders */
.synth-section {
    width: auto;
    min-width: 220px;
    height: auto;
    padding: 15px;
}

/* small */
.synth-section.small {
  min-width: 0;
  max-width: 166px;
}

.synth-section.small h2 {
  font-size: 22px;
}

.synth-section.small .slider-label {
  font-size: 8px;
}

.synth-section.small .vertical-slider-container {
  height: unset;
}

.synth-section.small .slider-wrapper.vertical, .synth-section.small input[type="range"][orient="vertical"] {
  height: 100px;
}

/*adsr small*/

.synth-section.adsr-small {
  min-width: 0;
  max-width: 330px;
}

.synth-section.small .envelope-visualization #envelopeCanvas {
  width: 150px;
  height: 60px;
}

.synth-section.adsr-small h2 {
  font-size: 22px;
}

.synth-section.adsr-small .slider-label {
  font-size: 8px;
}

.synth-section.adsr-small .vertical-slider-container {
  height: unset;
}

.synth-section.adsr-small .slider-wrapper.vertical, .synth-section.adsr-small input[type="range"][orient="vertical"] {
  height: 50px;
}

.synth-section.adsr-small .patch-cell, .synth-section.small .patch-cell {
  font-size: 8px;
}

/* Optional: Style the label */
.vertical-slider-container label {
    margin-bottom: 5px;
    font-size: 12px;
    text-align: center;
}

/* Button styling */
.control-group button {
    margin: 3px;
    padding: 4px 8px;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.control-group button.active {
    background: black;
    color: white;
}

.slider-container {
    display: flex;
    justify-content: center;
}
.control-group.waveform {
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.control-group.waveform > .waveform-container {
    display: flex;
    flex-direction: column;
}

.oscillator-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1em;
}
.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.slider-label {
    font-size: 11px;
}

.envelope-section h2 {
    text-align: center;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--accent-color);
  }
  
  /* Button styling */
  .button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
  }
  
  button {
    background-color: var(--button-bg);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
  }
  
  button:hover {
    background-color: #ccc;
    color: black;
  }
  
  button.inactive {
    opacity: 0.7;
  }
  
  button.active {
    background-color: var(--button-active);
    color: #000;
  }
  
  #envelope-reset {
    background-color: #666;
  }
  
  #envelope-reset:hover {
    background-color: #ccc;
  }
  
  /* Vertical slider styling */
  .vertical-slider-container {
    display: flex;
    justify-content: space-around;
    height: 200px;
  }
  
  .vertical-slider-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
  }
  
  .slider-label {
    margin-bottom: 10px;
    font-weight: bold;
  }
  
  .slider-value {
    margin: 10px 0;
    font-size: 12px;
    display: block;
    text-align: center;
  }
  
  /* Patch matrix styling */
  .destination-selector {
    overflow-x: auto;
  }
  
  .patch-matrix {
    width: 100%;
    border-collapse: collapse;
  }
  
  .patch-row {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0;
  }
  
  .patch-row:first-child {
    font-weight: bold;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  }
  
  .patch-label {
    flex: 1;
    min-width: 100px;
    padding: 8px;
  }
  
  .patch-cell {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    min-width: 60px;
  }
  
  /* Input styling */
  input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
  }
  
  input[type="number"] {
    width: 50px;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: white;
    padding: 4px;
    text-align: center;
  }
  
  .draggable:before {
    content: '::';
    position: absolute;
    top: 10px;
    left: 10px;
    color: #555;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 2px;
  }
  
  /* Responsive adjustments */
  @media (max-width: 600px) {
    .vertical-slider-container {
      height: 180px;
    }
    
    .patch-row {
      flex-wrap: wrap;
    }
    
    .patch-label {
      min-width: 80px;
      font-size: 14px;
    }
    
    .patch-cell {
      min-width: 50px;
    }
    
    input[type="number"] {
      width: 40px;
      font-size: 12px;
    }
  }

  .small .vertical-slider-container {
    height: 180px;
  }
  
  .small .patch-row {
    flex-wrap: wrap;
  }
  
  .small .patch-label {
    min-width: 80px;
    font-size: 14px;
  }
  
  .small .patch-cell {
    min-width: 50px;
  }
  
  .small input[type="number"] {
    width: 40px;
    font-size: 12px;
  }

/* Prevent browser touch handling on these elements */
.draggable {
  touch-action: none;
}
.input, .output {
  touch-action: none;
}

/* Prevent text selection during drag */
canvas {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.connection-highlight {
  box-shadow: 0 0 10px 5px rgba(0, 200, 0, 0.5);
  transition: box-shadow 0.2s ease;
}
