body, html {
    font-family: 'Futura', Futura, 'Trebuchet MS', Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: radial-gradient(circle at center, #0d1117, #000000);
    cursor: crosshair;
    
    /* Prevent text selection on desktop */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    
    /* Prevent unwanted touch behaviors */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    
    /* Prevent overscroll bounce on iOS */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

canvas {
    display: block;
    
    /* Prevent touch scrolling during particle interactions */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.controls, .controls-panel, .controls-container {
    position: absolute;
    top: 0;
    left: 20px;
    z-index: 100;
    color: #fff;
    font-family: 'Futura', Futura, 'Trebuchet MS', Arial, sans-serif !important;
    background: transparent;
    padding: 12px;
    border-radius: 0 0 8px 0;
    backdrop-filter: none;
    transition: opacity 0.5s ease-in-out, transform 0.5s cubic-bezier(0.4,0.2,0.2,1), pointer-events 0s;
    opacity: 1;
    width: 400px;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: hidden;
    box-sizing: border-box;
    transform: translateY(0);
    will-change: transform, opacity;
    
    /* Enhanced touch interaction */
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Close button for controls */
.controls-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(248, 81, 73, 0.2);
    border: 1px solid #f85149;
    color: #f85149;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 101;
}

.controls-close-btn:hover {
    background: rgba(248, 81, 73, 0.4);
    transform: scale(1.1);
}

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

.controls h3 {
    margin-top: 0;
    color: #58a6ff;
}

.control-group {
    margin: 10px 0;
}

.control-group label {
    display: inline-block;
    width: 120px;
    font-size: 14px;
}

.control-group input {
    width: 100px;
}

.mode-button {
    background: rgba(88, 166, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(88, 166, 255, 0.4);
    padding: 6px 12px;
    margin: 0 4px 4px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
}

.mode-button:hover {
    background: rgba(88, 166, 255, 0.3);
    border-color: #58a6ff;
    transform: none;
}

.mode-button.active {
    background: rgba(88, 166, 255, 0.4);
    border-color: #58a6ff;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.3);
}

.drag-mode {
    cursor: grab;
}

.drag-mode.dragging {
    cursor: grabbing;
}

@media (max-width: 700px), (max-device-width: 700px) {
  body, .controls, .controls *, .tab-button, .music-icon-button, .dial, .dial-container, .control-group, .tab-content, #particleCanvas {
    user-select: none !important;
    -webkit-user-select: none !important;
    -ms-user-select: none !important;
    -moz-user-select: none !important;
    touch-action: manipulation;
  }
  .controls {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    bottom: 0 !important;
    top: auto !important;
    border-radius: 16px 16px 0 0 !important;
    padding: 16px 8px 24px 8px !important;
    margin: 0 !important;
    box-sizing: border-box;
    z-index: 100;
    transform: translateY(0);
    transition: opacity 0.5s, transform 0.5s cubic-bezier(0.4,0.2,0.2,1);
    overflow-y: auto;
    max-height: 80vh;
    font-size: 18px;
  }
  .controls-tabs, .tab-content, .tab-button, .control-group, .dial-container, .dial, .tab-content.active {
    flex-wrap: wrap !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  .tab-button, .music-icon-button {
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 18px !important;
    padding: 10px 8px !important;
    margin: 0 3px 6px 0 !important;
    border-radius: 8px !important;
  }
  .dial-container {
    margin-right: 5px !important;
    margin-bottom: 10px !important;
    width: 80px !important;
    max-width: 90vw !important;
    min-width: 0 !important;
  }
  .dial {
    width: 60px !important;
    height: 60px !important;
    min-width: 0 !important;
    max-width: 80vw !important;
  }
  .tab-content {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    padding: 0 2px !important;
  }
}


/* Help indicator shown when controls are hidden */
#controls-help-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 17, 23, 0.9);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Arial', sans-serif;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(88, 166, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

/* Ensure desktop controls stay in upper-left when not mobile-enhanced */
body:not(.mobile-enhanced) .controls {
    position: absolute !important;
    top: 0 !important;
    left: 20px !important;
    bottom: auto !important;
    right: auto !important;
    width: 400px !important;
    max-width: 400px !important;
    max-height: 90vh !important;
    border-radius: 0 0 8px 0 !important;
    transform: translateY(0) !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

/* Dial Control Styles */
.dial-container {
    text-align: center;
    margin: 0;
    flex: 0 0 auto;
    min-width: 65px;
}

.dial {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(51, 51, 51, 0.8);
    position: relative;
    margin: 0 auto 6px auto;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #666;
    backdrop-filter: blur(8px);
}

.dial:hover {
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.5);
}

.dial-indicator {
    position: absolute;
    width: 2px;
    height: 20px;
    background: #58a6ff;
    top: 5px;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 2px;
    box-shadow: 0 0 5px rgba(88, 166, 255, 0.8);
    transform: translateX(-50%);
}

.dial-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
    line-height: 1;
    user-select: none;
    z-index: 5;
}

.dial-label {
    color: #ccc;
    font-size: 10px;
    margin-top: 2px;
    user-select: none;
    line-height: 1.2;
    max-width: 65px;
    word-wrap: break-word;
}

.dial-active {
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.8);
}

/* Fader Control Styles */
.fader-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 8px;
    position: relative;
}

.fader-value {
    font-size: 11px;
    color: #58a6ff;
    text-align: center;
    margin-bottom: 5px;
    min-height: 16px;
    font-weight: bold;
    font-family: 'Arial', sans-serif;
    background: rgba(13, 17, 23, 0.8);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid rgba(88, 166, 255, 0.3);
    min-width: 30px;
}

.fader {
    position: relative;
    width: 20px;
    height: 100px;
    margin: 5px 0;
    cursor: pointer;
    user-select: none;
    
    /* Prevent touch scrolling during fader interaction */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.fader-track {
    position: absolute;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #58a6ff 0%, rgba(88, 166, 255, 0.3) 50%, rgba(88, 166, 255, 0.1) 100%);
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.5);
}

.fader-handle {
    position: absolute;
    width: 18px;
    height: 12px;
    background: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 50%, #c0c0c0 100%);
    border: 1px solid #888;
    border-radius: 2px;
    left: 50%;
    transform: translateX(-50%);
    cursor: grab;
    transition: box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    bottom: 0%;
}

.fader-handle:hover {
    box-shadow: 0 2px 6px rgba(88, 166, 255, 0.5);
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 50%, #d0d0d0 100%);
}

.fader-handle.fader-active {
    cursor: grabbing;
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.8);
    background: linear-gradient(to bottom, #58a6ff 0%, #4a90d9 50%, #3a7bc8 100%);
    border-color: #58a6ff;
}

.fader-label {
    font-size: 11px;
    color: #ccc;
    text-align: center;
    margin-top: 5px;
    width: 50px;
    font-family: 'Arial', sans-serif;
}

.control-group-dials {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    align-items: flex-start;
}

.control-group-faders {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    align-items: flex-start;
}

/* Also support faders in control groups */
.control-group-faders {
    display: flex;
    flex-wrap: wrap;
    margin: 20px 0;
    justify-content: space-around;
    align-items: flex-end;
}

/* Tab Styles */
.controls-tabs {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-button {
    background: rgba(88, 166, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(88, 166, 255, 0.4);
    padding: 6px 12px;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
}

.tab-button.active, .tab-button:hover {
    background: #222c;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(88,166,255,0.08);
}

.tab-content {
    display: none;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
}

.tab-content.active {
    display: block;
}

/* Info tab should not scroll at tab level - only within info-content */
#tab-info {
    overflow-y: hidden !important;
    height: calc(90vh - 120px);
}

/* Music Icon Button Styles */
.music-icon-button {
    background: #181c24;
    color: #58a6ff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    cursor: pointer;
    outline: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(88,166,255,0.05);
}
.music-icon-button.active {
    background: #58a6ff;
    color: #fff;
    box-shadow: 0 2px 8px rgba(88,166,255,0.18);
}
.music-icon-button:focus {
    outline: 2px solid #58a6ff;
}

/* --- Loop Feature Styling --- */
.loop-btn {
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 4px;
    padding: 4px;
    margin: 1px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loop-btn.active {
    background: linear-gradient(135deg, #58a6ff 60%, #1f6feb 100%);
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 16px 4px #58a6ff88, 0 2px 8px #0004;
    animation: loop-glow 1.2s infinite alternate;
    transform: scale(1.08) rotate(-8deg);
}
@keyframes loop-glow {
    0% { box-shadow: 0 0 8px 2px #58a6ff44, 0 2px 8px #0002; }
    100% { box-shadow: 0 0 24px 8px #58a6ffcc, 0 2px 8px #0004; }
}
.loop-btn:hover {
    background: #58a6ff33;
    color: #fff;
    border-color: #58a6ff;
    transform: scale(1.12);
}

.chord-row {
    display: flex;
    align-items: center;
    padding: 0.4em 0.8em;
    margin-bottom: 0.5em;
    background: rgba(13, 17, 23, 0.6);
    border-radius: 8px;
    border: 1px solid rgba(88, 166, 255, 0.1);
}

.chord-row .loop-btn.active {
    animation: loop-row-pulse 0.7s infinite alternate;
}
@keyframes loop-row-pulse {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.25); }
}
.chord-btn {
    background: rgba(51, 51, 51, 0.8);
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 1px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 42px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
.chord-btn.empty {
    background: #2226;
    color: #888a;
    border: 1px dashed #58a6ff44;
    cursor: default;
}
.chord-btn:active {
    transform: scale(0.96);
}
.chord-btn:hover:not(.empty) {
    background: #58a6ff33;
    color: #58a6ff;
}

/* Highlight currently playing chord cell (add .playing via JS if desired) */
.chord-btn.playing {
    background: #58a6ff;
    color: #fff;
    box-shadow: 0 0 12px 2px #58a6ff99;
    animation: chord-bounce 0.3s;
}
@keyframes chord-bounce {
    0% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Add a subtle highlight to active loop rows (add .active-row via JS if desired) */
.chord-row.active-row {
    background: linear-gradient(90deg, #58a6ff22 60%, #1f6feb33 100%);
    box-shadow: 0 2px 12px #58a6ff22;
}

/* Add smooth transitions for all loop UI */
#chord-loop-rows-container, #chord-history-row {
    transition: background 0.3s, box-shadow 0.3s;
}

/* Compact selectors and horizontal layout for chord selectors */
.chord-selectors-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.compact-selector {
    padding: 4px 6px;
    background: rgba(51, 51, 51, 0.8);
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.activate-chord-btn {
    background: linear-gradient(45deg, #1f6feb, #58a6ff);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.current-chord-display {
    font-weight: bold;
    color: #58a6ff;
    font-size: 11px;
    padding: 4px 8px;
    background: rgba(88, 166, 255, 0.15);
    border-radius: 4px;
    border: 1px solid rgba(88, 166, 255, 0.4);
    backdrop-filter: blur(8px);
}

.chord-section-header {
    font-size: 0.9em;
    font-weight: 600;
    color: #58a6ff;
    margin: 10px 0 4px 0;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(88, 166, 255, 0.3);
}

/* Smaller loop buttons in rows */
.chord-row .loop-btn {
    width: 1.7em;
    height: 1.7em;
    font-size: 1em;
    margin-left: 0.3em;
    border-width: 1.5px;
}

/* Larger blank slots */
.chord-btn.empty {
    min-width: 3.5em;
    min-height: 2.2em;
    font-size: 1.1em;
}

/* Space for history/loops headers */
#chord-history-row {
    margin-bottom: 0.5em;
}
#chord-loop-rows-container {
    margin-bottom: 0.5em;
}

/* --- Drum Machine Styling --- */
.drum-machine {
    background: rgba(13, 17, 23, 0.4);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(88, 166, 255, 0.1);
}

.drum-volumes {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(88, 166, 255, 0.1);
}

.drum-vol-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.drum-vol-control label {
    font-size: 11px;
    color: #58a6ff;
    font-weight: bold;
    text-align: center;
    min-width: 40px;
}

.drum-volume-slider {
    width: 60px;
    height: 4px;
    background: #21262d;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.drum-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #58a6ff;
    border-radius: 50%;
    cursor: pointer;
}

.drum-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #58a6ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.sequencer-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drum-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: rgba(21, 26, 33, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(88, 166, 255, 0.05);
    position: relative;
}

.drum-row-header {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.drum-disclosure {
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #58a6ff;
    cursor: pointer;
    transition: transform 0.2s ease;
    font-size: 10px;
    opacity: 0.7;
    margin-right: 2px;
}

.drum-disclosure.expanded {
    transform: rotate(90deg);
}

.drum-label {
    font-size: 12px;
    color: #58a6ff;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
    flex-shrink: 0;
}

.steps-container {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
    margin-left: 15px;
    min-width: 0;
    flex: 1;
}

.step-button {
    width: 12px;
    height: 15px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    flex-shrink: 0;
    
    /* Prevent touch scrolling during step button interaction */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.step-button:hover {
    background: #30363d;
    border-color: #58a6ff;
}

.step-button.active {
    background: #58a6ff;
    border-color: #388bfd;
}

/* Velocity-based step fills using gradients */
.step-button.velocity-1 {
    background: linear-gradient(to top, #58a6ff 25%, #21262d 25%);
    border-color: #388bfd;
}

.step-button.velocity-2 {
    background: linear-gradient(to top, #58a6ff 50%, #21262d 50%);
    border-color: #388bfd;
}

.step-button.velocity-3 {
    background: linear-gradient(to top, #58a6ff 75%, #21262d 75%);
    border-color: #388bfd;
}

.step-button.velocity-4 {
    background: #58a6ff; /* 100% fill */
    border-color: #388bfd;
}

/* Hover states for velocity levels - brightened fill */
.step-button.velocity-1:hover {
    background: linear-gradient(to top, #79c0ff 25%, #30363d 25%);
    border-color: #58a6ff;
}

.step-button.velocity-2:hover {
    background: linear-gradient(to top, #79c0ff 50%, #30363d 50%);
    border-color: #58a6ff;
}

.step-button.velocity-3:hover {
    background: linear-gradient(to top, #79c0ff 75%, #30363d 75%);
    border-color: #58a6ff;
}

.step-button.velocity-4:hover {
    background: #79c0ff; /* 100% bright fill */
    border-color: #58a6ff;
}

/* Dragging state for step buttons */
.step-button.dragging {
    border-color: #f85149;
    box-shadow: 0 0 8px rgba(248, 81, 73, 0.6);
    transform: scale(1.1);
}

.step-button.beat-emphasis {
    border-color: #f85149;
    box-shadow: inset 0 0 0 1px rgba(248, 81, 73, 0.3);
}

.step-button.beat-emphasis.velocity-1 {
    background: linear-gradient(to top, #58a6ff 25%, #21262d 25%);
    border-color: #f85149;
    box-shadow: inset 0 0 0 1px rgba(248, 81, 73, 0.3);
}

.step-button.beat-emphasis.velocity-2 {
    background: linear-gradient(to top, #58a6ff 50%, #21262d 50%);
    border-color: #f85149;
    box-shadow: inset 0 0 0 1px rgba(248, 81, 73, 0.3);
}

.step-button.beat-emphasis.velocity-3 {
    background: linear-gradient(to top, #58a6ff 75%, #21262d 75%);
    border-color: #f85149;
    box-shadow: inset 0 0 0 1px rgba(248, 81, 73, 0.3);
}

.step-button.beat-emphasis.velocity-4 {
    background: #58a6ff;
    border-color: #f85149;
    box-shadow: inset 0 0 0 1px rgba(248, 81, 73, 0.3);
}

.step-button.beat-emphasis.active {
    border-color: #f85149;
    box-shadow: 0 0 8px rgba(248, 81, 73, 0.4), inset 0 0 0 1px rgba(248, 81, 73, 0.3);
}

.step-button.playing {
    background: #ffd700 !important;
    border-color: #ffed4e !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4) !important;
    animation: stepPlayPulse 0.15s ease !important;
    transform: scale(1.15) !important;
}

/* Bounce mode visualization - orange-yellow color for bouncing rows with dramatic effect */
.step-button.bouncing {
    background: #ffa500 !important;
    border-color: #ffb84d !important;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.8), 0 0 30px rgba(255, 165, 0, 0.4) !important;
    animation: stepBounceFlash 0.15s ease !important;
    transform: scale(1.15) !important;
}

/* Subtle gray indicator for bounce position on inactive steps */
.step-button.bounce-position {
    background: #7d8590 !important;
    border-color: #9ca3af !important;
    box-shadow: 0 0 8px rgba(125, 133, 144, 0.4) !important;
    transform: scale(1.05) !important;
    transition: all 0.1s ease !important;
}

@keyframes stepPlayPulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
        background: #ffd700;
    }
    50% { 
        transform: scale(1.2); 
        box-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.6);
        background: #ffed4e;
    }
    100% { 
        transform: scale(1.15); 
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4);
        background: #ffd700;
    }
}

@keyframes stepBounceFlash {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 5px rgba(255, 165, 0, 0.3);
        background: #ffa500;
    }
    50% { 
        transform: scale(1.2); 
        box-shadow: 0 0 20px rgba(255, 165, 0, 1), 0 0 40px rgba(255, 165, 0, 0.6);
        background: #ffb84d;
    }
    100% { 
        transform: scale(1.15); 
        box-shadow: 0 0 15px rgba(255, 165, 0, 0.8), 0 0 30px rgba(255, 165, 0, 0.4);
        background: #ffa500;
    }
}

@keyframes stepPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.pattern-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(88, 166, 255, 0.1);
}

.pattern-btn {
    background: #21262d;
    color: #58a6ff;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pattern-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
}

.pattern-btn:active {
    background: #58a6ff;
    color: #fff;
}

/* Drum Effect Controls */
.drum-effects {
    display: none;
    padding: 10px;
    margin-top: 8px;
    background: rgba(13, 17, 23, 0.4);
    border-radius: 4px;
    border: 1px solid rgba(88, 166, 255, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.drum-effects.expanded {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.effect-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 60px;
}

.effect-control label {
    font-size: 11px;
    color: #58a6ff;
    text-align: center;
    font-weight: bold;
}

/* Parameter Box Controls */
.param-box {
    width: 50px;
    height: 24px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    cursor: ns-resize;
    user-select: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-weight: bold;
    font-family: 'Arial', monospace;
    
    /* Prevent touch scrolling during parameter adjustment */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.param-box:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 4px rgba(88, 166, 255, 0.3);
}

.param-box.dragging {
    border-color: #58a6ff;
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.6);
    cursor: ns-resize;
}

/* Mute Button */
.drum-mute-btn {
    width: 18px;
    height: 18px;
    background: #21262d;
    color: #666;
    border: 1px solid #30363d;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    margin-right: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.drum-mute-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
}

.drum-mute-btn.muted {
    background: #f85149 !important;
    color: #fff !important;
    border-color: #f85149 !important;
}

/* Mobile responsiveness for parameter boxes */
@media (max-width: 700px), (max-device-width: 700px) {
    .param-box {
        width: 45px;
        height: 22px;
        font-size: 10px;
    }
    
    .effect-control {
        min-width: 50px;
        gap: 3px;
    }
    
    .effect-control label {
        font-size: 10px;
    }
    
    .drum-mute-btn {
        width: 16px;
        height: 16px;
        font-size: 9px;
        margin-left: 6px;
        margin-right: 6px;
    }
}

/* Dynamic Drum Machine Styles */
.add-row-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.add-row-btn {
    background: #21262d;
    color: #58a6ff;
    border: 2px dashed #30363d;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
}

.add-row-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.2);
}

.add-row-btn:active {
    background: #58a6ff;
    color: #fff;
    border-color: #58a6ff;
}

.drum-label.clickable {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.drum-label.clickable:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: #58a6ff;
}

.drum-label.no-sample {
    color: #666;
    font-style: italic;
}

.sample-selector {
    position: absolute;
    top: 100%;
    left: 60px;
    z-index: 1000;
    background: #21262d;
    border: 1px solid #58a6ff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-height: 400px;
    overflow-y: auto;
    min-width: 220px;
    width: auto;
}

.sample-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid #30363d;
    transition: background-color 0.2s ease;
}

.sample-option:last-child {
    border-bottom: none;
}

.sample-option:hover {
    background: rgba(88, 166, 255, 0.1);
}

.sample-option.no-sample-option {
    background: rgba(248, 81, 73, 0.1);
    border-bottom: 2px solid #f85149;
    font-weight: bold;
}

.sample-option.no-sample-option:hover {
    background: rgba(248, 81, 73, 0.2);
}

.sample-option .sample-name {
    color: #58a6ff;
    font-weight: bold;
}

/* Kit Headers */
.kit-header {
    padding: 10px 12px;
    background: #30363d;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    border-bottom: 1px solid #21262d;
    position: relative;
    transition: background-color 0.2s ease;
}

.kit-header:hover {
    background: #3c434d;
}

.kit-header::before {
    content: '▼';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
    font-size: 10px;
    color: #666;
}

.kit-header.collapsed::before {
    transform: translateY(-50%) rotate(-90deg);
}

.kit-header .kit-name {
    color: #fff;
}

/* Kit Containers */
.kit-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #1c2128;
}

.kit-container.expanded {
    max-height: 500px; /* Large enough for most cases */
}

.kit-container .sample-option {
    padding-left: 24px;
    background: #1c2128;
    border-bottom: 1px solid #262c36;
}

.kit-container .sample-option:hover {
    background: rgba(88, 166, 255, 0.08);
}

/* Remove kit name from individual samples since it's now in the header */
.sample-option .kit-name {
    display: none;
}

.drum-row-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 16px;
    height: 16px;
    background: #f85149;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.drum-row-remove:hover {
    opacity: 1;
}

/* Delay Note Selector */
.delay-note-selector {
    width: 30px;
    height: 24px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14pt;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin-left: 3px;
    vertical-align: middle;
    transform: translateY(-2px);
}

.delay-note-selector:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 4px rgba(88, 166, 255, 0.3);
}

/* Delay control with note selector layout */
.delay-control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.delay-controls-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Master Controls Row */
.master-controls-row {
    display: flex;
    gap: 6px;
    padding: 12px;
    margin-bottom: 15px;
    background: rgba(21, 26, 33, 0.8);
    border-radius: 6px;
    border: 1px solid rgba(88, 166, 255, 0.2);
    align-items: flex-end;
}

.master-controls-row .effect-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 60px;
}

.master-controls-row .effect-control label {
    font-size: 12px;
    color: #58a6ff;
    text-align: center;
    font-weight: bold;
}

.compact-add-btn {
    width: 50px;
    height: 24px;
    background: #21262d;
    color: #58a6ff;
    border: 2px dashed #30363d;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compact-add-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.2);
}

.compact-add-btn:active {
    background: #58a6ff;
    color: #fff;
    border-color: #58a6ff;
}

/* Noto Music Font */
.noto-music-regular {
  font-family: "Noto Music", sans-serif;
  font-weight: 400;
  font-style: normal;
}

/* Beat Division Selector Styles */
.beat-division-selector {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.beat-division-selector:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 4px rgba(88, 166, 255, 0.3);
}

.beat-division-arrow {
    width: 28px;
    height: 28px;
    background: rgba(51, 51, 51, 0.8);
    border: 2px solid #666;
    border-radius: 6px;
    color: #58a6ff;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
    backdrop-filter: blur(8px);
}

.beat-division-arrow:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
    background: rgba(88, 166, 255, 0.2);
}

.beat-division-arrow:active {
    background: rgba(88, 166, 255, 0.4);
    transform: scale(0.95);
}

.beat-division-display {
    padding: 3px 6px;
    background: rgba(51, 51, 51, 0.8);
    border-radius: 3px;
    min-width: 24px;
    text-align: center;
    font-size: 11px;
    backdrop-filter: blur(8px);
}

/* Vertical Beat Division Selector */
.beat-division-selector-vertical {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.beat-division-arrow-vertical {
    background: #30363d;
    border: 1px solid #444;
    border-radius: 3px;
    color: #58a6ff;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.8em;
    line-height: 1;
    transition: all 0.2s ease;
    min-width: 20px;
    font-weight: bold;
}

.beat-division-arrow-vertical:hover {
    background: #58a6ff;
    border-color: #58a6ff;
    color: #fff;
}

.beat-division-arrow-vertical:active {
    background: #1f6feb;
    transform: scale(0.95);
}

/* BPM Toggle Button */
.bpm-toggle {
    background: rgba(88, 166, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(88, 166, 255, 0.4);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    user-select: none;
}

.bpm-toggle:hover {
    background: rgba(88, 166, 255, 0.3);
    border-color: #58a6ff;
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
}

.bpm-toggle.active {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
    color: #fff;
}

.bmp-control-group {
    align-items: center;
}

/* Mobile responsiveness for beat division selector */
@media (max-width: 700px), (max-device-width: 700px) {
    .beat-division-selector {
        gap: 1px;
    }
    
    .beat-division-arrow {
        width: 18px;
        height: 22px;
        font-size: 11px;
    }
    
    .beat-division-display {
        min-width: 28px;
        height: 22px;
        font-size: 10px;
        padding: 0 3px;
    }
    
    .beat-division-arrow-vertical {
        padding: 2px 4px;
        font-size: 0.7em;
        min-width: 18px;
    }
    
    .bpm-toggle {
        padding: 3px 6px;
        font-size: 0.7em;
    }
}

/* Tab header styles */
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-header h2 {
    margin: 0;
    color: #58a6ff;
    font-size: 1.1em;
    font-weight: 600;
}

.help-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #333;
    color: #fff;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.help-btn:hover {
    background: #444;
    transform: scale(1.1);
}

/* Getting Started Link Styling */
.getting-started-link {
    display: block;
    color: #58a6ff;
    text-decoration: none;
    font-size: 11px;
    margin: 0 0 8px 0;
    padding: 4px 0;
    text-align: left;
    transition: color 0.2s ease;
}

.getting-started-link:hover {
    color: #68b6ff;
    text-decoration: underline;
}

/* Breadcrumb styling */
.breadcrumb-link {
    color: #58a6ff;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: #68b6ff;
    text-decoration: underline;
}

/* Info Tab Styles */
.info-container {
    height: calc(100vh - 200px);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: rgba(24, 28, 36, 0.9);
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-sizing: border-box;
}

.info-content {
    padding: 12px 12px 24px 12px;
    overflow-x: hidden !important;
    overflow-y: auto;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    scrollbar-width: auto;
    scrollbar-color: #58a6ff rgba(24, 28, 36, 0.8);
}

/* Universal Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    background: rgba(24, 28, 36, 0.9);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #58a6ff 0%, #4a9eff 100%);
    border-radius: 6px;
    border: 2px solid rgba(24, 28, 36, 0.5);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.6);
    min-height: 20px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #68b6ff 0%, #5aafff 100%);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.8);
}

::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #78c6ff 0%, #6abfff 100%);
    box-shadow: 0 0 16px rgba(88, 166, 255, 1.0);
}

::-webkit-scrollbar-track {
    background: rgba(24, 28, 36, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(48, 54, 61, 0.5);
}

::-webkit-scrollbar-corner {
    background: rgba(24, 28, 36, 0.9);
}

/* Info Content Custom Scrollbar Only */
.info-content::-webkit-scrollbar {
    width: 12px;
    background: rgba(24, 28, 36, 0.9);
    border-radius: 6px;
}

.info-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #58a6ff 0%, #4a9eff 100%);
    border-radius: 6px;
    border: 2px solid rgba(24, 28, 36, 0.5);
    box-shadow: 
        0 0 8px rgba(88, 166, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    min-height: 20px;
}

.info-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #68b6ff 0%, #5aafff 100%);
    box-shadow: 
        0 0 12px rgba(88, 166, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.info-content::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #78c6ff 0%, #6abfff 100%);
    box-shadow: 
        0 0 16px rgba(88, 166, 255, 1.0),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.info-content::-webkit-scrollbar-track {
    background: rgba(24, 28, 36, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(48, 54, 61, 0.5);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
}

.info-content::-webkit-scrollbar-corner {
    background: rgba(24, 28, 36, 0.9);
    border-radius: 6px;
}

/* Markdown Content Styles */
#infoHelpText {
    color: #ddd;
    line-height: 1.0;
    font-size: 11px;
    max-width: 100%;
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    white-space: pre-wrap;
    overflow-x: hidden;

}

#infoHelpText * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    box-sizing: border-box;
}

#infoHelpText h1 {
    font-size: 16px;
    margin: 0 0 8px;
    color: #fff;
}

#infoHelpText h2 {
    font-size: 14px;
    margin: 12px 0 6px;
    color: #fff;
    padding-bottom: 3px;
    border-bottom: 1px solid #333;
}

#infoHelpText h3 {
    font-size: 12px;
    margin: 10px 0 4px;
    color: #fff;
}

#infoHelpText h4 {
    font-size: 11px;
    margin: 8px 0 4px;
    color: #58a6ff;
}

#infoHelpText p {
    margin: 6px 0;
    font-size: 11px;
}

#infoHelpText ul, #infoHelpText ol {
    margin: 6px 0;
    padding-left: 16px;
    font-size: 11px;
}

#infoHelpText li {
    margin: 2px 0;
}

#infoHelpText code {
    background: #333;
    padding: 1px 3px;
    border-radius: 2px;
    font-family: monospace;
    font-size: 9px;
}

#infoHelpText pre {
    background: #222;
    padding: 8px;
    border-radius: 3px;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 6px 0;
    font-size: 9px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

#infoHelpText pre code {
    background: none;
    padding: 0;
    font-size: 9px;
}

#infoHelpText blockquote {
    border-left: 3px solid #444;
    margin: 6px 0;
    padding: 4px 8px;
    background: #222;
    font-size: 11px;
}

#infoHelpText b, #infoHelpText strong {
    font-size: 11px;
}

#infoHelpText em, #infoHelpText i {
    font-size: 11px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .info-container {
        height: auto;
        margin: 0 -16px;
    }
    
    .info-content {
        padding: 8px;
        height: auto;
        min-height: 50vh;
        overflow-x: hidden;
        word-break: break-word;
    }
    
    #infoHelpText {
        font-size: 10px;
    }
    
    #infoHelpText h1 {
        font-size: 14px;
    }
    
    #infoHelpText h2 {
        font-size: 12px;
    }
    
    #infoHelpText h3 {
        font-size: 11px;
    }
    
    #infoHelpText p,
    #infoHelpText ul,
    #infoHelpText ol {
        font-size: 9px;
    }
}

/* Drum Row Controls (Steps & Bounce) - now in drum-effects */
.drum-effects .effect-control .steps-input {
    width: 48px;
    padding: 3px 6px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #30363d;
    background: #21262d;
    color: #fff;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
    text-align: center;
}

.drum-effects .effect-control .steps-input:focus {
    border: 1.5px solid #58a6ff;
    box-shadow: 0 0 6px #58a6ff44;
}

.drum-effects .effect-control .bounce-toggle {
    background: #21262d;
    color: #58a6ff;
    border: 1.5px solid #30363d;
    border-radius: 4px;
    width: 50px;
    height: 24px;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border 0.2s, box-shadow 0.2s;
    outline: none;
    position: relative;
}

.drum-effects .effect-control .bounce-toggle .bounce-icon {
    font-size: 1em;
    font-family: 'Arial', sans-serif;
    pointer-events: none;
}

.drum-effects .effect-control .bounce-toggle.active {
    background: #58a6ff;
    color: #fff;
    border: 1.5px solid #58a6ff;
    box-shadow: 0 0 8px #58a6ff88;
}

.drum-effects .effect-control .bounce-toggle:hover {
    background: #58a6ff33;
    color: #fff;
    border: 1.5px solid #58a6ff;
}

/* === TONE TAB STYLING === */

/* Tone tab container - only show when active */
#tab-tone {
    display: none;
    flex-direction: column;
    gap: 20px;
}

#tab-tone.active {
    display: flex;
}

/* ADSR controls container */
#tab-tone #adsr-controls {
    background: rgba(33, 38, 45, 0.4);
    border: 1px solid rgba(125, 133, 144, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
}

/* ADSR graph container */
#tab-tone #adsr-graph-container {
    background: #21262d;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(125, 133, 144, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    
    /* Prevent touch scrolling during ADSR envelope editing */
    touch-action: none;
    -webkit-touch-callout: none;
}

/* ADSR group styling (for waveform selector) */
#tab-tone .adsr-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-left: 24px;
    padding: 15px;
    background: rgba(33, 38, 45, 0.6);
    border: 1px solid rgba(125, 133, 144, 0.2);
    border-radius: 6px;
    min-width: 140px;
}

#tab-tone .adsr-group label {
    color: #f0f6fc;
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tab-tone .adsr-group select {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    color: #f0f6fc;
    padding: 6px 8px;
    font-size: 13px;
    min-width: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tab-tone .adsr-group select:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.3);
}

#tab-tone .adsr-group select:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

#tab-tone .adsr-group select option {
    background: #21262d;
    color: #f0f6fc;
    padding: 4px;
}

/* Tone section headers */
#tab-tone .tone-section {
    margin-bottom: 12px;
}

#tab-tone .tone-section-header {
    font-size: 0.9em;
    font-weight: 600;
    color: #58a6ff;
    margin: 8px 0 6px 0;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(88, 166, 255, 0.3);
}

/* Tone tab dials now use the same styling as Particles tab dials */

/* Waveform button styling */
.waveform-button {
    width: 70px;
    height: 50px;
    background: rgba(51, 51, 51, 0.8);
    border: 2px solid #666;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    padding: 4px;
}

.waveform-button:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
}

.waveform-button.active {
    background: rgba(88, 166, 255, 0.3);
    border-color: #58a6ff;
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.5);
}

.waveform-icon {
    width: 40px;
    height: 24px;
    margin-bottom: 2px;
}

.waveform-label {
    font-size: 9px;
    color: #ccc;
    text-align: center;
    line-height: 1;
}

.waveform-button.active .waveform-label {
    color: #fff;
    font-weight: bold;
}

/* ADSR envelope graph labels styling */
#tab-tone #adsr-graph-container + div {
    color: #8b949e !important;
    font-size: 11px !important;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace !important;
    margin-top: 8px !important;
    padding: 0 5px !important;
    background: rgba(13, 17, 23, 0.4) !important;
    border-radius: 4px !important;
    border: 1px solid rgba(125, 133, 144, 0.1) !important;
}

#tab-tone #adsr-graph-container + div span {
    background: rgba(88, 166, 255, 0.1) !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    margin: 0 2px !important;
    color: #58a6ff !important;
    font-weight: 500 !important;
}

/* Responsive adjustments for tone tab */
@media (max-width: 700px), (max-device-width: 700px) {
    /* Tone tab dials now use the same responsive styling as Particles tab dials */
    
    #tab-tone #adsr-controls {
        padding: 15px;
        flex-direction: column;
        align-items: center;
    }
    
    #tab-tone .adsr-group {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
        max-width: 200px;
        align-items: center;
        text-align: center;
    }
    
    #tab-tone #adsr-graph-container {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }
    
    #tab-tone #adsr-graph-container svg {
        max-width: 100%;
        height: auto;
    }
}

/* === END TONE TAB STYLING === */

.particle-timing-controls {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.timing-control-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.particle-timing-controls label {
    display: block;
    margin-bottom: 6px;
    color: #8b949e;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.beat-division-selector-horizontal {
    display: flex;
    align-items: center;
    gap: 4px;
}

.beat-division-display {
    padding: 6px 12px;
    background: rgba(51, 51, 51, 0.8);
    border: 2px solid #666;
    border-radius: 6px;
    min-width: 40px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.bmp-control-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.param-box {
    min-width: 50px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    background: rgba(51, 51, 51, 0.8);
    border: 2px solid #666;
    border-radius: 6px;
    color: #fff;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    cursor: pointer;
}

.param-box:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
}

/* Color Palette Editor Styles */
.palette-editor {
    margin: 20px 0;
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.palette-header h3 {
    margin: 0;
    color: #58a6ff;
    font-size: 16px;
    font-weight: 600;
}

.palette-presets {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.palette-presets label {
    color: #8b949e;
    font-size: 12px;
    font-weight: 500;
    min-width: 50px;
}

.palette-preset-selector {
    flex: 1;
    background: rgba(51, 51, 51, 0.8);
    border: 2px solid #666;
    border-radius: 6px;
    color: #fff;
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.palette-preset-selector:hover {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
}

.palette-preset-selector:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

.palette-preset-selector option {
    background: #21262d;
    color: #f0f6fc;
    padding: 4px;
}

.reset-palette-btn {
    background: rgba(248, 81, 73, 0.2);
    border: 1px solid #f85149;
    color: #f85149;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.reset-palette-btn:hover {
    background: rgba(248, 81, 73, 0.4);
    transform: translateY(-1px);
}

.palette-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.palette-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.palette-row-label {
    width: 60px;
    font-size: 12px;
    color: #8b949e;
    font-weight: 500;
}

.color-picker {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: none;
    padding: 0;
}

.color-picker:hover {
    transform: scale(1.1);
    border-color: #58a6ff;
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.3);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 4px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-gradient {
    flex: 1;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.gradient-steps {
    display: flex;
    height: 100%;
}

.gradient-step {
    flex: 1;
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.gradient-step:last-child {
    border-right: none;
}

@media (max-width: 700px), (max-device-width: 700px) {
    .palette-row {
        gap: 6px;
        padding: 6px;
    }
    
    .palette-row-label {
        width: 50px;
        font-size: 11px;
    }
    
    .color-picker {
        width: 28px;
        height: 28px;
    }
    
    .color-gradient {
        height: 28px;
    }
}

/* Effects Section Styles */
.effects-container {
    border-left: 2px solid #444;
    padding-left: 12px;
    margin-top: 8px;
}

.effects-container h3 {
    margin: 0 0 6px 0;
    color: #ccc;
    font-size: 0.95em;
    font-weight: normal;
}

.effect-control {
    margin-bottom: 4px;
}

.effect-control label {
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 0.9em;
    cursor: pointer;
}

.effect-control input[type="checkbox"] {
    margin-right: 6px;
    transform: scale(1.1);
}

.single-effects .effect-control label {
    color: #999;
    font-style: italic;
    cursor: default;
}

.single-effects select {
    background: #2a2a2a !important;
    color: #999 !important;
    border-color: #444 !important;
    opacity: 0.7;
}

.glow-dial {
    margin-top: 6px !important;
}

.multi-effects .effect-control {
    margin-bottom: 4px;
}

.shape-effects-section {
    border: 1px solid #333;
    border-radius: 6px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
}

.shape-selector-container label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Radio button styling */
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 2px solid #555;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
    margin: 0 6px 0 0;
    transition: all 0.2s ease;
}

input[type="radio"]:hover {
    border-color: #58a6ff;
}

input[type="radio"]:checked {
    border-color: #58a6ff;
    background: #58a6ff;
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
}

/* Radio button labels */
.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85em;
    color: #ccc;
    transition: color 0.2s ease;
}

.radio-label:hover {
    color: #fff;
}

.radio-label input[type="radio"]:checked + span {
    color: #58a6ff;
    font-weight: 500;
}

/* Compact section styling */
.compact-section {
    background: rgba(68, 68, 68, 0.8);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.compact-section-header {
    color: #fff;
    font-weight: bold;
    font-size: 0.95em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.compact-section-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.compact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Shape selector styling improvements */
.shape-selector {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.shape-selector:hover {
    border-color: #58a6ff;
    background: #3a3a3a;
}

.shape-selector:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

/* File input styling improvements */
input[type="file"] {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]:hover {
    border-color: #58a6ff;
    background: #3a3a3a;
}

input[type="file"]::file-selector-button {
    background: #555;
    color: #fff;
    border: none;
    border-radius: 2px;
    padding: 2px 6px;
    margin-right: 6px;
    cursor: pointer;
    font-size: 0.8em;
    transition: background 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    background: #666;
}

/* Color picker styling improvements */
input[type="color"] {
    border: 1px solid #555;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

input[type="color"]:hover {
    border-color: #58a6ff;
    transform: scale(1.05);
}

/* Small button styling */
.small-btn {
    background: #666;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.small-btn:hover {
    background: #777;
    transform: translateY(-1px);
}

.small-btn:active {
    transform: translateY(0);
}

/* Fullscreen button styling */
.fullscreen-btn {
    background: #222;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #444;
}

.fullscreen-btn:hover {
    background: #333;
    border-color: #58a6ff;
    transform: translateY(-1px);
}

.fullscreen-btn:active {
    transform: translateY(0);
}

/* Slider styling for darkness control */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

input[type="range"]:hover {
    background: #3a3a3a;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #58a6ff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #58a6ff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.4);
}

/* Responsive adjustments */
@media (max-width: 700px), (max-device-width: 700px) {
    input[type="radio"] {
        width: 16px;
        height: 16px;
        margin: 0 8px 0 0;
    }
    
    .radio-label {
        font-size: 0.9em;
        gap: 8px;
    }
    
    .compact-section {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .compact-row {
        gap: 10px;
    }
    
    .shape-selector {
        min-width: 140px;
        font-size: 0.9em;
        padding: 6px 10px;
    }
}

/* Background option styling */
.background-option {
    padding: 4px 0;
    transition: all 0.2s ease;
}

.background-option input[type="file"] {
    color: #ccc;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 4px;
}

.background-option select {
    color: #ccc;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid #444;
    border-radius: 3px;
    padding: 3px 6px;
}

.background-option select:hover {
    border-color: #58a6ff;
}