/* Goob Nonna - Synthesizer Styles */
/* Palette: charcoal case, warm cream panels, colorful module accents */

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

body {
  background: #1e1814;
  color: #e8e4dc;
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
  min-width: 900px;
  user-select: none;
}

/* Synth Container */
#synth {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px;
}

/* Controls in title strip */
.popover-btn {
  display: block;
  width: 100%;
  background: none;
  border: 1px solid #4a4a50;
  border-radius: 3px;
  color: #ccc;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  text-align: center;
  margin-bottom: 6px;
}

.popover-btn:hover {
  background: #3a3a40;
  color: #fff;
}

.popover-switch {
  margin-bottom: 6px;
}

.popover-switch .switch-label {
  color: #ccc;
}

.guide-link {
  color: #c49a40;
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 3px 8px;
  border: 1px solid #4a4a50;
  border-radius: 3px;
  transition: background 0.1s;
}

.guide-link:hover {
  background: #3a3a40;
  color: #e8e4dc;
}

.preset-selector select {
  background: #1c1c1e;
  color: #e8e4dc;
  border: 1px solid #4a4a50;
  padding: 3px 8px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.midi-btn {
  background: #1c1c1e;
  border: 1px solid #4a4a50;
  color: #e8e4dc;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
}

.midi-btn:hover {
  background: #3a3a40;
}

.midi-btn[aria-pressed="true"] {
  border-color: #5dbb63;
  color: #8fe096;
}

.kebab-btn {
  background: none;
  border: 1px solid #4a4a50;
  color: #888;
  font-size: 16px;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 3px;
  line-height: 1;
}

.kebab-btn:hover {
  color: #fff;
  background: #3a3a40;
}

.back-popover {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 200;
  background: #222;
  border: 1px solid #4a4a50;
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  min-width: 200px;
}

.back-popover .guide-link {
  display: block;
  text-align: center;
  margin-bottom: 8px;
  padding: 6px 10px;
}

.back-popover.hidden {
  display: none;
}

.back-popover .panel-back {
  background: transparent;
  border: none;
  padding: 0;
  flex: none;
}

.back-popover .panel-back h2 {
  color: #999;
  border-bottom-color: #4a4a50;
  font-size: 10px;
}

.back-popover .jack-label {
  color: #ccc;
}

/* Panel Area */
.panel-area {
  position: relative;
  background: #e8e2d4;
  border: 2px solid #3a3a40;
  padding: 5px;
  min-height: 400px;
}

/* Panel Row */
.panel-row {
  display: flex;
  gap: 2px;
  align-items: stretch;
  min-width: 0;
}

/* Individual Panel */
.panel {
  background: #ddd7c8;
  border: 1px solid #b8b0a0;
  padding: 8px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel h2 {
  font-size: 12px;
  text-align: center;
  color: #2a2520;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid #b8b0a0;
  padding-bottom: 3px;
  margin-bottom: 2px;
  font-weight: bold;
}

.panel h3 {
  font-size: 11px;
  color: #2a2520;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: bold;
}

.panel-section {
  border-top: 1px solid #c8c0b0;
  padding-top: 4px;
}

/* Panel colors: a different color per section (terracotta, olive, cream on espresso) */
.panel-arp-seq {
  flex: 1 1 120px;
  background: #d98463;
}
.panel-arp-seq .switch-option {
  font-size: 9px;
  padding: 2px 3px;
}
.panel-arp-seq .button-label {
  font-size: 8px;
}
.panel-arp-seq h2 { color: #2a1610; }
.panel-arp-seq .knob-label { color: #2a1610; }
.panel-arp-seq .knob-value { color: #2a1610; }
.panel-arp-seq .switch-label { color: #2a1610; }
.panel-arp-seq .button-label { color: #2a1610; }
.panel-arp-seq .jack-label { color: #2a1610; }
.jack-row.jack-row-top {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.rate-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.knob-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: flex-start;
}
.knob-row-wide {
  justify-content: space-between;
  margin-top: auto;
}

.panel-modulation {
  flex: 1.4 1 170px;
  background: #2f2622;
}
.panel-modulation h2 { color: #fff; border-bottom-color: #4a4a50; }
.panel-modulation h3 { color: #fff; font-weight: bold; }
.panel-modulation .knob-label { color: #fff; }
.panel-modulation .switch-label { color: #fff; }
.panel-modulation .knob-value { color: #fff; }
.panel-modulation .jack-label { color: #fff; }
.panel-modulation .jack-row { border-top-color: #4a4a50; }
.panel-modulation .jack-output-label .jack-label {
  color: #222;
  background: #fff;
  padding: 1px 4px;
  border-radius: 2px;
}
.mod-amt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
  justify-items: center;
}

.panel-modulation .mod-pitch .knob-label { color: #c4cc8a; }
.panel-modulation .mod-cutoff .knob-label { color: #e3b04b; }
.panel-modulation .mod-pw .knob-label {
  color: #222;
  background: #fff;
  padding: 1px 4px;
  border-radius: 2px;
  display: inline-block;
}

.panel-oscillators {
  flex: 2.3 1 280px;
  background: #a3ad6a;
}
.panel-oscillators h2 { color: #1f2414; }
.panel-oscillators h3 { color: #1f2414; }
.panel-oscillators .knob-label { color: #1f2414; }
.panel-oscillators .knob-value { color: #1f2414; }
.panel-oscillators .switch-label { color: #1f2414; }
.panel-oscillators .jack-label { color: #1f2414; }

.osc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  align-items: start;
  justify-items: center;
  padding: 4px;
  position: relative;
  overflow: visible;
}
.osc-grid .switch-body {
  flex-wrap: nowrap;
}
.osc-grid .switch-option {
  padding: 3px 3px;
  font-size: 10px;
  white-space: nowrap;
}

/* Bigger waveform unicode symbols */
.wave-switch .switch-option {
  font-size: 16px;
  padding: 2px 5px;
}
.osc-grid::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: #2a3018;
}
.osc-grid h2 {
  text-align: center;
  margin: 0;
  padding: 2px 0;
  border-bottom: 1px solid #5c6634;
}

.jack-pair {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.sync-cell {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sync-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #8a5a00;
  background: #3a3a3e;
  color: #aaa;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.sync-button:hover {
  background: #4a4a4e;
}
.sync-button.active {
  background: #e8820c;
  color: #fff;
  border-color: #ffaa33;
  box-shadow: 0 0 12px rgba(232, 130, 12, 0.6);
}

.sync-freq-row {
  grid-column: 1 / -1;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 0;
  width: 70%;
}

.sync-line {
  flex: 1;
  height: 2px;
  background: #2a3018;
  margin: 0 4px;
}

.panel-mixer {
  flex: 0.8 1 100px;
  background: #2f2622;
}
.panel-mixer h2 { color: #fff; border-bottom-color: #4a4a50; }
.panel-mixer .knob-label { color: #fff; }
.panel-mixer .knob-value { color: #fff; }
.panel-mixer .jack-label { color: #fff; }
.panel-mixer .mixer-osc .knob-label { color: #c4cc8a; }
.panel-mixer .jack-output-label .jack-label {
  color: #222;
  background: #fff;
  padding: 1px 4px;
  border-radius: 2px;
}

.panel-utilities {
  flex: 0.8 1 100px;
  background: #2f2622;
}
.panel-utilities h2 { color: #fff; border-bottom-color: #4a4a50; }
.panel-utilities .knob-label { color: #fff; }
.panel-utilities .knob-value { color: #fff; }
.panel-utilities .jack-label { color: #fff; }
.panel-utilities .jack-output-label .jack-label {
  color: #222;
  background: #fff;
  padding: 1px 4px;
  border-radius: 2px;
}

.mult-section {
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px solid #4a4a50;
  margin-bottom: 4px;
}
.mult-label {
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  text-transform: uppercase;
  margin-top: 2px;
}

.util-divider {
  border-top: 1px solid #4a4a50;
  margin: 2px 0;
}

.mult-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  justify-items: center;
  padding: 8px;
  position: relative;
}

.mult-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.mult-lines line {
  stroke: #888;
  stroke-width: 1.5;
}
.mult-grid .jack-container {
  z-index: 1;
}

.panel-filter {
  flex: 1.1 1 130px;
  background: #ead09a;
}
.panel-filter h2 { color: #2e2210; }
.panel-filter .knob-label { color: #2e2210; }
.panel-filter .knob-value { color: #2e2210; }
.panel-filter .switch-label { color: #2e2210; }
.panel-filter .jack-label { color: #2e2210; }
.panel-filter .jack-output-label .jack-label {
  color: #222;
  background: #fff;
  padding: 1px 4px;
  border-radius: 2px;
}

.filter-jacks-wide {
  justify-content: space-between !important;
  width: 100%;
}

.filter-jacks-narrow {
  justify-content: center !important;
  gap: 16px !important;
  width: 80%;
  margin: -4px auto 0;
  flex-wrap: nowrap !important;
}

/* Big cutoff knob */
.filter-cutoff-knob .knob {
  width: 56px;
  height: 56px;
}

.filter-cutoff-knob .knob-pointer {
  height: 22px;
}

.filter-connect-line {
  width: 2px;
  height: 10px;
  background: #3a2c14;
  margin: 0 auto;
}

.panel-envelope {
  flex: 1 1 120px;
  background: #2f2622;
}
.panel-envelope h2 { color: #fff; border-bottom-color: #4a4a50; margin-bottom: 10px; }
.panel-envelope .slider-label { color: #fff; }
.panel-envelope .knob-label { color: #fff; }
.panel-envelope .knob-value { color: #fff; }
.panel-envelope .jack-label { color: #fff; }
.panel-envelope .jack-output-label .jack-label {
  color: #222;
  background: #fff;
  padding: 1px 4px;
  border-radius: 2px;
}

.env-adsr {
  display: flex;
  gap: 12px;
  flex: 1;
  align-items: stretch;
}

.env-knob-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
}

.env-sustain-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

.sustain-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: stretch;
  margin: 14px 0;
}

.sustain-tall {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sustain-tall .slider-track {
  width: 44px;
  height: calc(100% - 20px);
  margin: 10px auto;
  background: transparent;
  border-radius: 3px;
  overflow: visible;
}

.sustain-tall .slider-fill {
  display: none;
}

.sustain-tall .slider-thumb {
  left: -4px;
  width: 52px;
  height: 22px;
  background: #111;
  border: none;
  border-radius: 3px;
}

.sustain-tall .slider-thumb::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 5px;
  right: 5px;
  height: 2px;
  background: #fff;
  transform: translateY(-50%);
}

.sustain-grads {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  pointer-events: none;
  padding: 4px 0;
}

.sustain-grad {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.sustain-grad-major {
  background: rgba(255, 255, 255, 0.3);
}

.panel-output {
  flex: 0.9 1 110px;
  background: #2f2622;
}
.panel-output h2 { color: #fff; border-bottom-color: #4a4a50; }
.panel-output .knob-label { color: #fff; }
.panel-output .knob-value { color: #fff; }
.panel-output .switch-label { color: #fff; }
.panel-output .switch-option {
  font-size: 9px;
  padding: 2px 3px;
}
.panel-output .jack-label { color: #fff; }

/* Spring Reverb sub-section — red box with black text */
.reverb-section {
  background: #c04040;
  border-radius: 4px;
  padding: 8px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.reverb-section h3 {
  color: #1a1a1e;
  font-size: 10px;
  font-weight: bold;
  text-align: center;
  margin: 0;
}
.reverb-section .knob-label { color: #1a1a1e !important; }
.reverb-section .knob-value { color: #1a1a1e !important; }

.panel-controller {
  flex: 0 0 80px;
}

.panel-controller {
  flex: 0 0 80px;
}

/* Knob */
.knob-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.knob {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2a2a2e;
  border: 2px solid #1a1a1e;
  position: relative;
  cursor: grab;
  transition: box-shadow 0.1s;
}

.knob:hover {
  box-shadow: 0 0 6px rgba(196, 154, 64, 0.3);
}

.knob.active {
  cursor: grabbing;
  box-shadow: 0 0 8px rgba(196, 154, 64, 0.5);
}

.knob-pointer {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 2px;
  height: 14px;
  background: #e8e4dc;
  transform: translateX(-50%);
  border-radius: 1px;
}

.knob-label {
  font-size: 10px;
  color: #2a2520;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  font-weight: bold;
}

.knob-value {
  font-size: 11px;
  color: #2a2520;
  text-align: center;
  font-weight: bold;
}

/* Switch Control */
.switch-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.switch-label {
  font-size: 10px;
  color: #2a2520;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}

.switch-body {
  display: flex;
  gap: 1px;
  background: #1a1a1e;
  border-radius: 3px;
  padding: 1px;
}

.switch-option {
  font-size: 11px;
  padding: 3px 4px;
  color: #bbb;
  cursor: pointer;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: bold;
  transition: all 0.1s;
}

.switch-option:hover {
  color: #fff;
}

.switch-option.active {
  background: #3a3a40;
  color: #e8e4dc;
}

/* Slider (ADSR) */
.slider-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.slider-label {
  font-size: 10px;
  color: #2a2520;
  text-transform: uppercase;
  font-weight: bold;
}

.slider-track {
  width: 16px;
  height: 80px;
  background: #1a1a1e;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.slider-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #6a6258;
  border-radius: 0 0 3px 3px;
  pointer-events: none;
}

.slider-thumb {
  position: absolute;
  left: -3px;
  width: 22px;
  height: 8px;
  background: #e8e4dc;
  border: 1px solid #2a2520;
  border-radius: 2px;
  transform: translateY(50%);
  pointer-events: none;
}

.sliders-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Jack */
.jack-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.jack {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1a1a1e;
  border: 2px solid #3a3a40;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.1s;
}

.jack:hover {
  border-color: #c49a40;
}

.jack-output {
  border-color: #c04040;
}

.jack-input {
  border-color: #4060a0;
}

.jack-both {
  border-color: #7a7a7a;
}

.jack-hole {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0a0a0a;
}

.jack.connected {
  box-shadow: 0 0 4px rgba(196, 154, 64, 0.5);
}

.jack-label {
  font-size: 9px;
  color: #2a2520;
  text-transform: uppercase;
  text-align: center;
  max-width: 55px;
  line-height: 1.2;
  font-weight: bold;
  white-space: nowrap;
}

.jack-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 4px;
  border-top: 1px solid #c8c0b0;
  margin-top: auto;
}

/* Button */
.button-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.synth-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3a3a40;
  border: 2px solid #2a2a2e;
  cursor: pointer;
  transition: all 0.1s;
}

.synth-button:hover {
  background: #4a4a50;
}

.synth-button.active {
  background: #c04040;
  border-color: #d05050;
}

/* Light button color variants */
.light-green .synth-button.active {
  background: #40c040;
  border-color: #50d050;
  box-shadow: 0 0 8px rgba(64, 192, 64, 0.5);
}
.light-blue .synth-button.active {
  background: #4080e0;
  border-color: #5090f0;
  box-shadow: 0 0 8px rgba(64, 128, 224, 0.5);
}
.light-yellow .synth-button.active {
  background: #d98463;
  border-color: #e8957a;
  box-shadow: 0 0 8px rgba(217, 132, 99, 0.5);
}

.button-label {
  font-size: 9px;
  color: #2a2520;
  text-transform: uppercase;
  font-weight: bold;
}

/* Terracotta button labels in keyboard area to match sequencer */
.keyboard-left-controls .button-label { color: #d98463; }

/* Blue glide label */
.glide-knob .knob-label { color: #c4cc8a; }
.glide-knob .knob-value { color: #c4cc8a; }  /* sits on the dark keyboard panel */

.buttons-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

/* LED */
.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a1010;
  border: 1px solid #2a0808;
  transition: background 0.1s;
}

.led.on {
  background: var(--led-color, #ff0000);
  box-shadow: 0 0 6px var(--led-color, #ff0000);
}

/* Wheel */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.wheel-label {
  font-size: 10px;
  color: #e8e4dc;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}

.wheel-track {
  width: 22px;
  height: 140px;
  background: #1a1a1e;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.wheel-thumb {
  position: absolute;
  left: -2px;
  width: 26px;
  height: 16px;
  background: #e8e4dc;
  border: 1px solid #bbb;
  border-radius: 3px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-mark {
  width: 14px;
  height: 2px;
  background: #1a1a1e;
  border-radius: 1px;
}

.wheel-pitch .wheel-label { color: #c4cc8a; }

/* Title strip between panels and keyboard */
.synth-title-strip {
  background: #1e1814;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.title-left {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.title-right {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.title-goob {
  font-size: 20px;
  font-weight: bold;
  color: #c4cc8a;
  letter-spacing: 3px;
}

.title-nonna {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 3px;
}

.title-subtitle {
  font-size: 9px;
  color: #888;
  letter-spacing: 2px;
  margin-left: 10px;
  text-transform: uppercase;
}

/* Keyboard Area — controls sit alongside keyboard */
.keyboard-area {
  padding: 6px;
  background: #2f2622;
  border: 2px solid #3a3a40;
  border-top: none;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.keyboard-left-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  flex-shrink: 0;
}

.keyboard-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kb-buttons-section {
  display: flex;
  gap: 6px;
  align-items: center;
}

.triple-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.triple-label {
  font-size: 8px;
  font-weight: bold;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.triple-label-above {
  color: #fff;
}

.triple-label-below {
  color: #fff;
}

.keyboard-wheels {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 8px;
}

.keyboard {
  display: flex;
  position: relative;
  height: 260px;
  flex: 1;
}

.key {
  position: relative;
  cursor: pointer;
  transition: background 0.05s;
  flex: 1;
}

.white-key {
  min-width: 0;
  height: 260px;
  background: #f5f2eb;
  border: 1px solid #999;
  border-radius: 0 0 3px 3px;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
}

.white-key:hover {
  background: #eae6dd;
}

.white-key.active {
  background: #ddd8cc;
}

.black-key {
  width: var(--bk-width, 28px);
  height: 160px;
  background: #1a1a1a;
  border: 1px solid #111;
  border-radius: 0 0 2px 2px;
  margin-left: calc(var(--bk-width, 28px) / -2);
  margin-right: calc(var(--bk-width, 28px) / -2);
  flex: 0 0 auto;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
}

.black-key:hover {
  background: #2a2a2a;
}

.black-key.active {
  background: #3a3a3a;
}

/* Key labels — bigger and bolder */
.key-label {
  font-size: 11px;
  font-weight: bold;
  color: #222;
  pointer-events: none;
}

.black-key .key-label {
  color: #eee;
  font-size: 9px;
}

/* Hover tooltip system */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a2e;
  color: #e8e4dc;
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #4a4a50;
  white-space: nowrap;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  margin-bottom: 4px;
  animation: tooltip-fade-in 0.3s ease 0.4s both;
}

@keyframes tooltip-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Patch Cable Overlay */
.patch-cable-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.patch-cable {
  pointer-events: stroke;
  cursor: pointer;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.patch-cable:hover {
  stroke-width: 6 !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.patch-cable.pending {
  stroke-dasharray: 8 4;
  opacity: 0.7;
}

/* Narrower windows: two even rows of four panels, rather than OUTPUT wrapping onto a row of its own. Below
   900 px (a phone held upright) the page keeps that 900 px layout and scrolls sideways, as Meow Piano does. */
@media (max-width: 1400px) {
  .panel-row { flex-wrap: wrap; }
  .panel-row > .panel { flex: 1 1 calc(25% - 2px); }
}

/* Toast notification */
.synth-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #eee;
  padding: 6px 16px;
  border-radius: 4px;
  font: 12px/1.4 'IBM Plex Mono', monospace;
  letter-spacing: 0.5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}
.synth-toast.visible {
  opacity: 1;
}

/* footer: contact and version (stamped by the deploy workflow) */
.app-foot { text-align: center; font: 11px/1.6 system-ui, sans-serif; color: #9a9a9a; padding: 8px 16px 16px; }
.app-foot a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Touch: a drag on a knob, slider or wheel turns it instead of scrolling the page; the keys play on a tap and
   scroll sideways on a swipe; buttons don't wait for a double-tap zoom */
.knob, .slider-track, .wheel-track { touch-action: none; }
.keyboard { touch-action: pan-x; }
.synth-button, .switch-option, .jack { touch-action: manipulation; }

/* On-page sound check (js/ui/diagnostics.js): errors, and with ?debug the audio's state */
.diag { position: fixed; left: 8px; right: 8px; top: 8px; max-height: 33vh; overflow-y: auto; z-index: 10000; background: #2a1610; color: #f3e6d8;
  border: 1px solid #d98463; border-radius: 4px; padding: 6px 10px; font: 12px/1.4 ui-monospace, monospace;
  white-space: pre-wrap; }
.diag[hidden] { display: none; }

/* Touchscreens: until the sound is on, a button over the keys turns it on (a key can't; see soundButton) */
.keyboard-area { position: relative; }
.sound-on { position: absolute; inset: 0; z-index: 5; margin: 0; border: 2px solid #d98463; border-radius: 4px;
  background: rgba(47, 38, 34, 0.86); color: #f3e6d8; font: bold 18px/1.2 system-ui, sans-serif; letter-spacing: 1px;
  cursor: pointer; touch-action: manipulation; }
.sound-on[hidden] { display: none; }

/* A phone held upright: the page stays phone-width and the synth, at its 900 px layout, scrolls sideways in
   its own box (as in Meow Piano), rather than the whole page panning */
@media (max-width: 899.98px) {
  body { min-width: 0; }
  #synth { overflow-x: auto; padding: 4px; }
  #synth > :not(h1) { min-width: 880px; }
}
