/* KEYBOARD */
#keyboard {
    position: relative;
    height: 110px;
    margin: 8px 0 0 0;
    background: #0f0f14; 
    border-radius: 0 0 8px 8px;
    box-sizing: border-box; 
    width: 100%;
}

#keyboard::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.45' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    filter: contrast(190%) brightness(100%);
    pointer-events: none;
    z-index: var(--z-elevated);
    border-radius: 0 0 8px 8px;
}

/* Keys */
.key {
    position: absolute; 
    border: 1px solid #555; 
    background: var(--bg-color);
    border-radius: 0 0 4px 4px; 
    transition: all 0.15s ease; 
    box-sizing: border-box;
    user-select: none; 
    -webkit-user-select: none;
    display: flex; 
    align-items: flex-end; 
    justify-content: center;
    padding-bottom: 5px; 
    font-size: 10px; 
    overflow: hidden;
    box-shadow: 0 2px 3px rgba(0,0,0,0.2);
}

.key.white {
    width: calc(100% / 14); 
    height: 100%; 
    bottom: 0;
    background: #5f5f5f;
    border-color: #000000;
    color: var(--border-color);
}

.key.black {
    width: calc(100% / 21); 
    height: 62%; 
    top: 0;
    background: #000000;
    border-color: #000000;
    z-index: var(--z-base); 
    color: var(--text-secondary);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 3px 5px rgba(0,0,0,0.5);
}

.key.active {
    background: var(--key-fixed-color, var(--key-left-color));
    color: #fff; 
    transform: scale(0.98);
}

.key.black.active { 
    background: var(--key-fixed-color, var(--key-left-color)) !important;
    color: #fff !important;
    transform: scale(0.98);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6), 0 0 12px var(--key-fixed-color, var(--key-left-color));
}

/* Pitch and Mod Wheels */
.wheel-column {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 9px;
    flex: 0 0 auto;
    padding-top: 9px;
}

.wheel-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 15px;
    position: relative;
    z-index: var(--z-above);
}

.wheel-track {
    width: 10px;
    height: 80px;
    border-radius: 8px;
    position: relative;
    overflow: visible;
    cursor: pointer;
    touch-action: none;
    box-shadow: inset 0 0 2px 0px rgb(35 35 35 / 38%), inset 1px 0 2px rgba(255, 255, 255, 0.05);
    background: #0b0b0b;
}

.wheel-wrapper:first-child .wheel-track {
    margin-left: 1px;
}

.wheel-thumb {
    position: absolute;
    width: 5px;
    height: 20px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20%;
    background: rgba(201, 201, 201, 1.0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    z-index: var(--z-base);
    transition: top 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    opacity: 0.5;
}

/* PB/MW/VIB labels already say which wheel is which, so all three share
   the one accent instead of their own hue. */
.wheel-wrapper.pitch .wheel-track {
    border-color: rgba(201, 201, 201, 0.4);
}

.wheel-wrapper.pitch .wheel-track::before {
    background: radial-gradient(80% 120% at 50% 50%, rgba(201, 201, 201, 0.45) 0%, rgba(201, 201, 201, 0) 70%);
}

.wheel-wrapper.mod .wheel-track {
    border-color: rgba(201, 201, 201, 0.4);
}

.wheel-wrapper.mod .wheel-track::before {
    background: radial-gradient(80% 120% at 50% 50%, rgba(201, 201, 201, 0.45) 0%, rgba(201, 201, 201, 0) 70%);
}

.wheel-wrapper.vib .wheel-track {
    border-color: rgba(201, 201, 201, 0.4);
}

.wheel-wrapper.vib .wheel-track::before {
    background: radial-gradient(80% 120% at 50% 50%, rgba(201, 201, 201, 0.45) 0%, rgba(201, 201, 201, 0) 70%);
}

.wheel-label {
    font-family: "JetBrains Mono", "SF Mono", "Roboto Mono", Menlo, Monaco, "Courier New", monospace;
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-secondary);
    opacity: 0.85;
}

/* Keyboard Controls Row */
.keyboard-controls-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 0;
    flex-wrap: nowrap;
}

.visualizer-row-3 .keyboard-controls-row {
    margin-top: 0;
    flex: 1;
}

.keyboard-octave-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.keyboard-octave-container #keyboard {
    transform: scaleY(0.8);
    transform-origin: top;
}

/* Keyboard Octave Switcher */
.keyboard-octave-switcher {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

.keyboard-octave-switcher .octave-button-kbd + .octave-button-kbd {
    margin-top: 0;
}

.keyboard-octave-switcher > button,
.keyboard-octave-switcher > #octaveDisplay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.keyboard-octave-switcher [data-knob-id="glideTime"] {
    flex-shrink: 0;
}

.keyboard-octave-switcher #octaveDisplay {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-family: "JetBrains Mono", "SF Mono", "Roboto Mono", Menlo, Monaco, "Courier New", monospace;
    min-width: 24px;
    text-align: center;
    padding: 2px 0;
}

/* Octave display in visualizer-row-3 - Now styled in 15-visualizer.css to match BPM/PB */

/* Row 4: PB, MW, Keyboard */
.visualizer-row-4 {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.visualizer-row-4 .wheel-column {
    flex: 0 0 auto;
}

.visualizer-row-4 .keyboard-octave-container {
    flex: 1;
    min-width: 0;
}

