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

body {
  font-family: 'Hammersmith One', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1d1f21;
  color: #c5c8c6;
  height: 100vh;
  overflow: hidden;
}

.container {
  display: flex;
  height: 100vh;
}

/* Left Pane - Text Editor */
.left-pane {
  flex: 1;
  background: #282a2e;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #161719;
}

.pane-header {
  padding: 12px 20px;
  background: #1d1f21;
  border-bottom: 1px solid #161719;
  font-size: 13px;
  font-weight: 500;
  color: #969896;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-title {
  color: #969896;
}

.header-spacer {
  flex: 1;
}

/* Sequencer transport controls in header */
.sequencer-transport-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sequencer-transport-header .transport-label {
  font-size: 11px;
  color: #636567;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.sequencer-transport-header .transport-btn {
  background: #282a2e;
  border: 1px solid #373b41;
  border-radius: 4px;
  color: #969896;
  font-size: 10px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sequencer-transport-header .transport-btn:hover {
  border-color: #5fd3bc;
  color: #5fd3bc;
}

.sequencer-transport-header .transport-btn.playing {
  background: #2d4a44;
  border-color: #5fd3bc;
  color: #5fd3bc;
}

.sequencer-transport-header .stop-btn:hover {
  border-color: #ff8c66;
  color: #ff8c66;
}

.editor-tabs {
  display: flex;
  gap: 0;
}

.editor-tabs .tab {
  background: none;
  border: none;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 13px;
  color: #636567;
  cursor: pointer;
  transition: color 0.15s;
}

.editor-tabs .tab:hover {
  color: #969896;
}

.editor-tabs .tab.active {
  color: #5fd3bc;
}

.tab-content.hidden {
  display: none;
}

#sequencer-editor {
  flex: 1;
  padding: 20px;
  font-family: 'Hammersmith One', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: #282a2e;
  color: #c5c8c6;
  outline: none;
  overflow: auto;
}

.sequencer-text {
  outline: none;
  white-space: pre-wrap;
  min-height: 100%;
}

#parameters {
  flex: 1;
  padding: 20px;
  font-family: 'Hammersmith One', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: #282a2e;
  color: #c5c8c6;
  outline: none;
  overflow: auto;
}

/* Block structure */
.block {
  min-height: 1.6em;
  position: relative;
}

.block-content {
  outline: none;
  white-space: pre;
  color: #c5c8c6;
  caret-color: #5fd3bc;
}

/* Syntax highlighting */
.syntax-key {
  color: #f0c674;
}

.syntax-string {
  color: #5fd3bc;
}

.syntax-number {
  color: #ffa07a;
}

.syntax-oscillator {
  color: #81a2be;
}

/* Right Pane - Controls */
.right-pane {
  width: 320px;
  background: #1d1f21;
  overflow-y: auto;
  padding: 20px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Note Display */
.note-display {
  background: #1d1f21;
  border-bottom: 1px solid #373b41;
  padding: 15px;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  color: #5fd3bc;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -20px -20px 0 -20px;
}

#note-display-text {
  font-family: monospace;
}

/* Track Visualizer - shown during sequencer playback */
.track-visualizer {
  position: relative;
  background: #1d1f21;
  border-bottom: 1px solid #373b41;
  padding: 12px 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  justify-content: center;
  gap: 8px;
  margin: -20px -20px 0 -20px;
  flex-shrink: 0;
}

.track-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #282a2e;
  border: 1px solid #373b41;
  border-radius: 6px;
  padding: 6px 12px;
  min-width: 80px;
  transition: border-color 0.08s ease-out, background 0.08s ease-out;
}

.track-indicator .light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.3;
  flex-shrink: 0;
  transition: opacity 0.08s ease-out, box-shadow 0.08s ease-out;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
}

.track-indicator.active {
  background: #2a2c30;
  border-color: #4a4e54;
}

.track-indicator.active .light {
  opacity: 1;
}

.track-indicator .label {
  font-size: 11px;
  color: #636567;
  text-transform: lowercase;
  letter-spacing: 0.3px;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.08s ease-out;
}

.track-indicator.active .label {
  color: #c5c8c6;
}

/* Compact keyboard button (shown during sequencer playback) */
.keyboard-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #282a2e;
  border: 1px solid #373b41;
  border-radius: 6px;
  padding: 8px 14px;
  margin: 0 auto 15px auto;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.keyboard-compact:hover {
  border-color: #5fd3bc;
  background: #2a2c30;
}

.keyboard-compact:focus {
  border-color: #ff8c66;
  background: #2a2c30;
  box-shadow: 0 0 0 2px rgba(255, 140, 102, 0.2);
}

.keyboard-compact .keyboard-icon {
  font-size: 14px;
  color: #5fd3bc;
}

.keyboard-compact .keyboard-compact-label {
  font-size: 11px;
  color: #969896;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.keyboard-compact:focus .keyboard-compact-label {
  color: #ff8c66;
}

.controls-section {
  flex-shrink: 0;
}

.controls-section.hidden {
  display: none;
}

.controls-section h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #969896;
  margin-bottom: 16px;
  font-weight: 600;
}

.controls-section h2.default-param {
  color: #6b6d70;
  font-style: italic;
}

.controls-section h2.default-param::before {
  content: "• ";
  color: #5fd3bc;
}

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

.slider-container label {
  display: block;
  font-size: 12px;
  color: #5fd3bc;
  margin-bottom: 6px;
  font-weight: 500;
}

.slider-value {
  display: inline-block;
  margin-left: 12px;
  font-size: 12px;
  color: #ffa07a;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
  font-family: 'Courier New', monospace;
}

select {
  width: 100%;
  padding: 8px 12px;
  background: #282a2e;
  border: 1px solid #373b41;
  border-radius: 4px;
  color: #c5c8c6;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

select:focus {
  border-color: #5fd3bc;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  background: #373b41;
  outline: none;
  border-radius: 2px;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #ff8c66;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #ffa07a;
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #ff8c66;
  cursor: pointer;
  border-radius: 50%;
  border: none;
  transition: all 0.15s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  background: #ffa07a;
  transform: scale(1.1);
}

/* Scrollbar styling */
.right-pane::-webkit-scrollbar {
  width: 8px;
}

.right-pane::-webkit-scrollbar-track {
  background: #1d1f21;
}

.right-pane::-webkit-scrollbar-thumb {
  background: #373b41;
  border-radius: 4px;
}

.right-pane::-webkit-scrollbar-thumb:hover {
  background: #4a4e54;
}

#parameters::-webkit-scrollbar {
  width: 8px;
}

#parameters::-webkit-scrollbar-track {
  background: #282a2e;
}

#parameters::-webkit-scrollbar-thumb {
  background: #373b41;
  border-radius: 4px;
}

#parameters::-webkit-scrollbar-thumb:hover {
  background: #4a4e54;
}

/* Virtual Keyboard Panel */
.keyboard-panel {
  background: #1d1f21;
  padding: 15px;
  margin: 0 -20px 10px -20px;
  border-bottom: 1px solid #373b41;
}

.keyboard-panel h2 {
  margin-bottom: 12px;
}

#virtual-keyboard {
  background: #282a2e;
  border: 2px solid #373b41;
  border-radius: 4px;
  padding: 16px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

#virtual-keyboard:hover {
  border-color: #5fd3bc;
}

#virtual-keyboard:focus {
  border-color: #ff8c66;
  background: #2a2c30;
}

.keyboard-hint {
  font-size: 11px;
  color: #969896;
  text-align: center;
  margin-bottom: 12px;
}

.keyboard-layout {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.key-label {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  color: #5fd3bc;
  background: #373b41;
  border: 1px solid #4a4e54;
  border-radius: 3px;
  padding: 6px 8px;
  min-width: 20px;
  text-align: center;
  transition: all 0.1s ease;
  user-select: none;
}

.key-label.active {
  background: #ff8c66;
  color: #1d1f21;
  border-color: #ffa07a;
  transform: translateY(1px);
  box-shadow: 0 0 8px rgba(255, 140, 102, 0.4);
}

.key-label.has-definition {
  background: #5a3a2a;
  border-color: #ff8c66;
  color: #ff8c66;
  box-shadow: 0 0 6px rgba(255, 140, 102, 0.4);
  font-weight: bold;
}

.key-label.has-definition.active {
  background: #ff8c66;
  border-color: #ffa07a;
  box-shadow: 0 0 8px rgba(255, 140, 102, 0.4);
}

/* Command Modal */
#command-modal {
  position: absolute;
  background: #282a2e;
  border: 1px solid #5fd3bc;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  width: 350px;
  max-height: 400px;
  z-index: 1001;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#command-modal.hidden {
  display: none;
}

#command-search {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid #373b41;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  background: #2a2c30;
  color: #c5c8c6;
  font-family: 'Hammersmith One', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#command-search::placeholder {
  color: #969896;
}

#command-list {
  overflow-y: auto;
  max-height: 350px;
}

.command-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #373b41;
  transition: background-color 0.15s ease;
}

.command-item:hover {
  background-color: #2a2c30;
}

.command-item.selected {
  background-color: #373b41;
  border-left: 3px solid #5fd3bc;
  padding-left: 13px;
}

.command-item.no-results {
  color: #969896;
  cursor: default;
  text-align: center;
}

.command-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: #5fd3bc;
}

.command-description {
  font-size: 12px;
  color: #969896;
}

/* Command list scrollbar */
#command-list::-webkit-scrollbar {
  width: 8px;
}

#command-list::-webkit-scrollbar-track {
  background: #282a2e;
}

#command-list::-webkit-scrollbar-thumb {
  background: #373b41;
  border-radius: 4px;
}

#command-list::-webkit-scrollbar-thumb:hover {
  background: #4a4e54;
}

/* Pulse animation for highlighting changes */
@keyframes pulse {
  0% {
    background-color: transparent;
  }
  50% {
    background-color: rgba(95, 211, 188, 0.3);
  }
  100% {
    background-color: transparent;
  }
}

.pulse-highlight {
  animation: pulse 0.6s ease-in-out;
}

.persistent-highlight {
  background-color: rgba(95, 211, 188, 0.3);
}

/* Sequencer Controls */
.sequencer-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.sequencer-transport {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sequencer-transport button {
  background: #373b41;
  border: none;
  color: #c5c8c6;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: background 0.15s;
}

.sequencer-transport button:hover {
  background: #4a4e54;
}

.sequencer-transport button.playing {
  background: #5fd3bc;
  color: #1d1f21;
}

.step-indicator {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.step-indicator .step {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background: #373b41;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #636567;
}

.step-indicator .step.active {
  background: #5fd3bc;
  color: #1d1f21;
}

.step-indicator .step.rest {
  background: #2a2c30;
}

.track-section {
  margin-top: 15px;
}

.track-label {
  font-size: 12px;
  color: #5fd3bc;
  margin-bottom: 6px;
  text-transform: lowercase;
}

/* Help Button in Header */
.header-help-btn {
  background: #282a2e;
  border: 1px solid #373b41;
  border-radius: 50%;
  color: #969896;
  font-size: 12px;
  font-weight: bold;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  margin-left: 10px;
}

.header-help-btn:hover {
  background: #373b41;
  color: #5fd3bc;
  border-color: #5fd3bc;
}

/* Help Modal */
.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.help-modal.hidden {
  display: none;
}

.help-modal-content {
  background: #1d1f21;
  border: 1px solid #373b41;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #373b41;
  flex-shrink: 0;
}

.help-tabs {
  display: flex;
  gap: 4px;
}

.help-tab {
  background: transparent;
  border: none;
  color: #969896;
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.help-tab:hover {
  background: #282a2e;
  color: #c5c8c6;
}

.help-tab.active {
  background: #373b41;
  color: #5fd3bc;
}

.help-close-btn {
  background: transparent;
  border: none;
  color: #636567;
  font-size: 22px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  transition: color 0.15s ease;
}

.help-close-btn:hover {
  color: #ff8c66;
}

.help-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.help-content {
  display: none;
}

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

.help-content h2 {
  font-size: 18px;
  color: #5fd3bc;
  margin: 0 0 12px 0;
  font-weight: 600;
}

.help-content h3 {
  font-size: 14px;
  color: #c5c8c6;
  margin: 20px 0 8px 0;
  font-weight: 600;
}

.help-content h4 {
  font-size: 12px;
  color: #969896;
  margin: 0 0 6px 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.help-content p {
  font-size: 13px;
  color: #969896;
  line-height: 1.5;
  margin: 8px 0;
}

.help-content pre {
  background: #282a2e;
  border: 1px solid #373b41;
  border-radius: 4px;
  padding: 12px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
  color: #c5c8c6;
  overflow-x: auto;
  margin: 10px 0;
  white-space: pre-wrap;
}

.help-content code {
  background: #282a2e;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
  color: #5fd3bc;
}

.help-content ul {
  margin: 10px 0;
  padding-left: 20px;
}

.help-content li {
  font-size: 13px;
  color: #969896;
  line-height: 1.6;
  margin: 4px 0;
}

.help-content li strong {
  color: #c5c8c6;
}

.help-table {
  margin: 12px 0;
}

.help-table table {
  width: 100%;
  border-collapse: collapse;
}

.help-table td {
  padding: 6px 10px;
  font-size: 12px;
  border-bottom: 1px solid #2a2c30;
}

.help-table td:first-child {
  width: 40%;
  color: #c5c8c6;
}

.help-table td:last-child {
  color: #969896;
}