/**
 * MPK4 Device Frame - Reusable styling for MPK Mini IV device visualization
 *
 * This provides the silver/gray device frame styling that mimics the physical device.
 * Import this along with theme.css for consistent device visualization.
 */

/* ============================================
   Device Frame Container
   ============================================ */

.device-frame {
    background: linear-gradient(135deg, #d4d0ca 0%, #c8c4be 50%, #b8b4ae 100%);
    border-radius: 16px;
    padding: 4px;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.4),
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.1);
    overflow: visible;
}

.device-inner {
    background: linear-gradient(135deg, #c8c4be 0%, #bbb7b1 100%);
    border-radius: 12px;
    padding: 16px 14px 20px 14px;
    border: 3px solid var(--mpk4-device-accent-color, #c75050);
    overflow: visible;
}

/* ============================================
   Device Layout
   ============================================ */

.device-top {
    display: grid;
    grid-template-columns: auto auto min-content auto;
    gap: 12px;
    margin-bottom: 16px;
    align-items: start;
}

/* Left column: Logo + Wheels */
.left-column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    height: 220px;
}

.brand {
    display: flex;
    align-items: center;
}

.brand img {
    height: 28px;
}

.model-name {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    text-align: right;
    margin-bottom: 4px;
}

.model-name .mini {
    font-weight: 400;
    font-size: 15px;
    color: #666;
}

.pads-section {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 220px;
}

.screen-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
    height: 220px;
}

/* Screen panel - raised container with screen, encoder, and buttons */
.screen-panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: flex-start;
    background: #c8c4be;
    padding: 6px 10px 0 10px;
    border-radius: 8px;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.1),
        0 4px 8px rgba(0,0,0,0.3);
    box-sizing: border-box;
    height: 100%;
}

/* Push screen-buttons to the bottom of the panel, aligned with other button rows */
.screen-panel .screen-buttons {
    margin-top: auto;
    margin-bottom: 6px;
}

.screen-panel .model-name {
    font-size: 14px;
    margin-bottom: 0;
    text-align: center;
}

.screen-panel .model-name .mini {
    font-size: 11px;
}

/* Main encoder button */
.main-encoder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #8a3535;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-top: 4px;
    box-shadow:
        inset 0 1px 2px rgba(0,0,0,0.3),
        0 1px 2px rgba(0,0,0,0.2);
}

.encoder-knob {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4a4a4a 0%, #333 100%);
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.2),
        0 2px 4px rgba(0,0,0,0.3);
}

.main-encoder:hover .encoder-knob {
    background: linear-gradient(145deg, #555 0%, #3a3a3a 100%);
}

.main-encoder:active .encoder-knob {
    background: linear-gradient(145deg, #333 0%, #2a2a2a 100%);
}

/* Encoder buttons (-/+) below encoder */
.encoder-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 4px;
}

/* Screen buttons (SHIFT, PLUGIN/DAW) - inside raised section at bottom */
.screen-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 4px;
}

.keyboard-section {
    margin-top: 8px;
}

.knobs-section {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    height: 220px;
}

/* Knobs Display - raised container like pads */
.knobs-display {
    background: #c8c4be;
    padding: 10px 8px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.1),
        0 4px 8px rgba(0,0,0,0.3);
    height: 176px;
    box-sizing: border-box;
}

/* ============================================
   Silver Container Style (for pads, screen)
   ============================================ */

.silver-container {
    background: #c8c4be;
    padding: 12px;
    border-radius: 8px;
    display: inline-block;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.1),
        0 4px 8px rgba(0,0,0,0.3);
    overflow: visible;
}

/* ============================================
   Pads Display
   ============================================ */

.pads-display {
    background: #c8c4be;
    padding: 12px;
    border-radius: 8px;
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.1),
        0 4px 8px rgba(0,0,0,0.3);
    overflow: visible;
    position: relative;
    height: 176px;
    box-sizing: border-box;
}

.pads-edit-btn {
    display: none !important;
}

.pad-labels-row {
    display: grid;
    grid-template-columns: repeat(4, 60px);
    gap: 8px;
    user-select: none;
    -webkit-user-select: none;
}

.pad-labels-row .pad-label {
    display: flex;
    align-items: baseline;
    gap: 2px;
    position: relative;
    min-height: 12px;
}

.pad-labels-row .pad-num {
    font-size: 9px;
    font-weight: 700;
    color: #333;
    flex-shrink: 0;
    width: 8px;
}

.pad-labels-row .pad-name {
    font-size: 5px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.1px;
    white-space: nowrap;
}

.pad-labels-row.top {
    margin-bottom: 2px;
}

.pad-labels-row.bottom {
    margin-top: 2px;
}

.pads-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    overflow: visible;
}

/* Pad housing - contains the fixed red ring */
.pad {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    /* Red border ring - part of the housing, doesn't move */
    border: 3px solid var(--pad-border-color, #8a3535);
    /* LED ring color shows here, between border and rubber surface */
    background: var(--pad-led-color, #1a1a1a);
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    /* LED underglow variables */
    --pad-led-color: #1a1a1a;
    --pad-led-intensity: 0;
    transition: background 0.15s ease-out;
}

/* Underglow LED layer - ambient glow behind the housing */
.pad::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 12px;
    background: var(--pad-led-color);
    opacity: var(--pad-led-intensity);
    filter: blur(12px);
    z-index: -1;
    transition: all 0.15s ease-out;
    pointer-events: none;
}

/* Rubber pad surface - gray, doesn't change color */
.pad::after {
    content: '';
    position: absolute;
    /* Inset creates gap where LED ring color shows */
    inset: 3px;
    border-radius: 2px;
    /* Always gray rubber surface */
    background: linear-gradient(145deg, #6a6a6a 0%, #5a5a5a 30%, #4a4a4a 100%);
    box-shadow:
        inset 0 2px 3px rgba(255,255,255,0.15),
        inset 0 -2px 4px rgba(0,0,0,0.3),
        0 1px 2px rgba(0,0,0,0.4);
    transition: all 0.08s ease-out;
    /* Rubber texture */
    background-image:
        linear-gradient(145deg, #6a6a6a 0%, #5a5a5a 30%, #4a4a4a 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.05) 2px,
            rgba(0,0,0,0.05) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.05) 2px,
            rgba(0,0,0,0.05) 4px
        );
}

.pad:hover::after {
    transform: translateY(-1px);
    box-shadow:
        inset 0 2px 3px rgba(255,255,255,0.25),
        inset 0 -2px 4px rgba(0,0,0,0.2),
        0 3px 6px rgba(0,0,0,0.4);
}

.pad:active::after,
.pad.active::after {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.3),
        0 0px 2px rgba(0,0,0,0.2);
}

/* When pressed, intensify the underglow */
.pad:active,
.pad.active {
    --pad-led-intensity: 0.8;
}

/* Lit pads always show underglow */
.pad.lit {
    --pad-led-intensity: 0.6;
}

/* Glow intensifies when pad is lit AND pressed */
.pad.lit:active,
.pad.lit.active {
    --pad-led-intensity: 1;
    box-shadow: 0 0 25px var(--pad-led-color, transparent);
}

/* ============================================
   Screen Display
   ============================================ */

.screen-display {
    background: #c8c4be;
    padding: 12px;
    border-radius: 8px;
    display: inline-block;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.1),
        0 4px 8px rgba(0,0,0,0.3);
}

.screen-preview {
    background: #1a1a1a;
    border-radius: 4px;
    padding: 6px 8px;
    width: 14ch;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    box-shadow:
        inset 0 2px 6px rgba(0,0,0,0.8),
        0 1px 0 rgba(255,255,255,0.1);
    overflow: hidden;
}

.screen-line {
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    display: inline-block;
}

.screen-line.scrolling {
    animation: scroll-text 6s linear infinite;
}

@keyframes scroll-text {
    0%, 25% { transform: translateX(0); }
    75%, 100% { transform: translateX(calc(-100% + 14ch)); }
}

.screen-line.line0 {
    color: var(--mpk4-screen-header-color, #00d4aa);
    font-weight: 600;
}

.screen-line.line1,
.screen-line.line2 {
    color: #ffffff;
}

/* ============================================
   Knobs Display
   ============================================ */

.knobs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 8px;
}

.knob-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 2px;
    user-select: none;
    -webkit-user-select: none;
}

/* Label below the knob */
.knob-label-row {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2px;
    margin-top: 2px;
    width: 44px;
}

.knob-number {
    font-size: 11px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.knob-label {
    font-size: 7px;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1;
}

/* Outer container - visible red ring */
.knob-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    /* Red/burgundy ring matching hardware */
    background: #8a3535;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 1px 2px rgba(0,0,0,0.3),
        0 1px 2px rgba(0,0,0,0.2);
}

.knob {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    /* Lighter grey base matching hardware */
    background: #606060;
    position: relative;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.3);
}

.knob:active,
.knob.dragging {
    cursor: grabbing;
}

/* Textured ridged edge - thin teeth on outer edge only */
.knob::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: repeating-conic-gradient(
        from 0deg,
        #6a6a6a 0deg 2deg,
        #4a4a4a 2deg 4deg
    );
    /* Only show ridges on outer edge */
    mask: radial-gradient(circle, transparent 85%, black 85%);
    -webkit-mask: radial-gradient(circle, transparent 85%, black 85%);
}

/* Inner cap - large flat silver/grey top */
.knob::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #7a7a7a;
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.25),
        inset 0 -1px 2px rgba(0,0,0,0.2);
}

.knob.active {
    box-shadow:
        0 2px 4px rgba(0,0,0,0.4),
        0 0 10px rgba(255, 180, 120, 0.25);
}

/* Position indicator - small white notch */
.knob-indicator {
    position: absolute;
    width: 2px;
    height: 4px;
    background: linear-gradient(to bottom, #fff 0%, #ddd 100%);
    border-radius: 1px;
    top: 4px;
    left: 50%;
    transform-origin: center 13px;
    z-index: 2;
    margin-left: -1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* ============================================
   Pitch/Mod Wheels
   ============================================ */

.wheels-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    padding: 10px;
    background: #c8c4be;
    border-radius: 8px;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.1),
        0 4px 8px rgba(0,0,0,0.3);
    height: 176px;
    box-sizing: border-box;
}

.wheels-section .brand {
    margin-bottom: 4px;
}

.wheels-section .brand img {
    height: 20px;
    width: auto;
}

.wheels-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: flex-start;
}

.wheel-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.wheel-label {
    font-size: 6px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

/* Wheel housing - red border ring like knobs/pads */
.wheel-housing {
    width: 32px;
    height: 110px;
    border: 3px solid #8a3535;
    border-radius: 6px;
    background: #1a1a1a;
    position: relative;
    overflow: hidden;
    cursor: ns-resize;
    user-select: none;
    -webkit-user-select: none;
}

/* Track groove effect */
.wheel-track {
    position: absolute;
    inset: 2px;
    background: linear-gradient(
        to right,
        #0a0a0a 0%,
        #1a1a1a 20%,
        #1a1a1a 80%,
        #0a0a0a 100%
    );
    border-radius: 2px;
    overflow: hidden;
}

/* Wheel surface - moves up/down in the track */
.wheel-surface {
    position: absolute;
    left: 2px;
    right: 2px;
    height: 40%;
    /* Position based on --wheel-position: 0 = center, -1 = top, 1 = bottom */
    top: calc(30% + var(--wheel-position, 0) * 28%);
    transition: top 0.05s ease-out;
    border-radius: 3px;
    /* Ridged texture - horizontal lines */
    background:
        linear-gradient(to bottom,
            rgba(255,255,255,0.2) 0%,
            transparent 10%,
            transparent 90%,
            rgba(0,0,0,0.3) 100%
        ),
        repeating-linear-gradient(
            180deg,
            #7a7a7a 0px,
            #6a6a6a 2px,
            #5a5a5a 4px,
            #6a6a6a 6px,
            #7a7a7a 8px
        );
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.3),
        inset 0 -1px 2px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.5);
}

/* Center notch/line indicator */
.wheel-surface::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    height: 3px;
    background: linear-gradient(to bottom, #888 0%, #555 100%);
    border-radius: 1px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.3),
        0 1px 2px rgba(0,0,0,0.5);
}

.wheel-housing:hover .wheel-surface {
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.4),
        inset 0 -1px 2px rgba(0,0,0,0.3),
        0 2px 6px rgba(0,0,0,0.6);
}

.wheel-housing.active .wheel-surface {
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.2),
        inset 0 -1px 2px rgba(0,0,0,0.4),
        0 1px 3px rgba(0,0,0,0.4);
}

/* ============================================
   Screen Buttons (edit button)
   ============================================ */

.screen-buttons {
    display: flex;
    gap: 4px;
}

.edit-btn {
    background: rgba(0,0,0,0.15);
    color: #666;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-btn:hover {
    background: rgba(0,0,0,0.25);
    color: #333;
}

.edit-btn svg {
    width: 12px;
    height: 12px;
}

/* ============================================
   Audio Controls (below device)
   ============================================ */

.audio-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 0;
    padding: 16px 0 14px;
    width: 100%;
}

.audio-enable-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #c75050 0%, #a03030 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow:
        0 4px 12px rgba(199, 80, 80, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.audio-enable-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(199, 80, 80, 0.5),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

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

.audio-enable-btn .audio-icon {
    width: 28px;
    height: 28px;
}

.audio-enable-btn .audio-waves {
    opacity: 0.5;
}

.audio-enable-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

.audio-enable-btn.loading .audio-label::after {
    content: '...';
    animation: loading-dots 1s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Enabled state - green with active waves */
.audio-enable-btn.enabled {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow:
        0 4px 12px rgba(46, 204, 113, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.audio-enable-btn.enabled:hover {
    box-shadow:
        0 6px 20px rgba(46, 204, 113, 0.5),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.audio-enable-btn.enabled .audio-waves {
    opacity: 1;
    animation: pulse-waves 1.5s ease-in-out infinite;
}

@keyframes pulse-waves {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Muted state - grayed out */
.audio-enable-btn.muted {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.audio-enable-btn.muted .audio-waves {
    opacity: 0.2;
}

/* ============================================
   Selectors Row (Instrument + Drum Kit)
   ============================================ */

.selectors-row {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.3s;
    position: relative;
    margin: 0 auto;
    width: fit-content;
    max-width: calc(100% - 32px);
    padding: 14px 18px;
    border: 2px solid transparent;
    border-radius: 12px;
}

.selectors-row.enabled {
    opacity: 1;
    pointer-events: auto;
}

.selectors-row[data-mode="main"] {
    border-color: rgba(45, 212, 191, 0.55);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.15) inset;
}

.selectors-row[data-mode="bass"] {
    border-color: rgba(245, 158, 11, 0.65);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2) inset;
}

.selectors-row[data-mode="main"] .instrument-selector:first-child .selector-label {
    color: #7be9d9;
}

.selectors-row[data-mode="bass"] .instrument-selector:nth-child(2) .selector-label {
    color: #ffd27a;
}

.selectors-row[data-mode="main"] .instrument-selector:first-child .selector-select {
    border-color: #2dd4bf;
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.2);
}

.selectors-row[data-mode="bass"] .instrument-selector:nth-child(2) .selector-select {
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.24);
}

.instrument-selector,
.kit-selector,
.pattern-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Pattern player controls */
.pattern-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #444 0%, #333 100%);
    border: 2px solid #555;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.pattern-btn svg {
    width: 14px;
    height: 14px;
}

.pattern-btn:hover:not(:disabled) {
    border-color: #777;
    background: linear-gradient(135deg, #555 0%, #444 100%);
    color: #fff;
}

.pattern-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pattern-btn.playing {
    background: linear-gradient(135deg, #c75050 0%, #8a3535 100%);
    border-color: #c75050;
    color: #fff;
}

.pattern-btn.playing .play-icon {
    display: none;
}

.pattern-btn.playing .stop-icon {
    display: block !important;
}

.pattern-btn.loop-btn.active {
    background: linear-gradient(135deg, #3a7ca5 0%, #2a5a7a 100%);
    border-color: #4a9bc5;
    color: #fff;
}

/* Pattern track toggles */
.pattern-track-toggles {
    display: flex;
    gap: 4px;
}

.track-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #333 0%, #222 100%);
    border: 2px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.track-toggle input {
    display: none;
}

.track-toggle .toggle-icon {
    color: #555;
    transition: color 0.2s;
}

.track-toggle:hover {
    border-color: #666;
}

.track-toggle input:checked + .toggle-icon.drums-icon {
    color: #ff6b6b;
}

.track-toggle input:checked + .toggle-icon.keys-icon {
    color: #4ecdc4;
}

/* BPM control */
.bpm-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bpm-input {
    width: 50px;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #333 0%, #222 100%);
    border: 2px solid #444;
    border-radius: 4px;
    text-align: center;
    -moz-appearance: textfield;
}

.bpm-input::-webkit-outer-spin-button,
.bpm-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bpm-input:focus {
    outline: none;
    border-color: #c75050;
}

.bpm-label {
    font-size: 10px;
    color: #666;
    font-weight: 500;
}



/* Keyboard section with overlay controls */
.keyboard-section {
    position: relative;
    z-index: 1;
}

/* Overlay controls positioned on the keyboard case */
.keyboard-overlay-controls {
    position: absolute;
    bottom: 8px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    z-index: 100;
    pointer-events: auto;
}

/* Status indicator in keyboard section */
.keyboard-overlay-controls mpk4-status {
    transform: scale(0.75);
    transform-origin: left center;
}

.mode-indicator-row {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

/* Compact audio button (for keyboard overlay) */
.audio-enable-btn.compact {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 7px;
    background: #444;
    border: 2px solid #666;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.audio-enable-btn.compact .audio-icon {
    width: 14px;
    height: 14px;
}

.audio-enable-btn.compact .audio-waves {
    opacity: 0.3;
}

.audio-enable-btn.compact.enabled {
    background: rgba(39, 174, 96, 0.9);
    border-color: rgba(39, 174, 96, 0.5);
}

.audio-enable-btn.compact.enabled .audio-waves {
    opacity: 1;
}

.audio-enable-btn.compact.muted {
    background: rgba(231, 76, 60, 0.9);
    border-color: rgba(231, 76, 60, 0.5);
}

.audio-enable-btn.compact.loading {
    background: rgba(243, 156, 18, 0.9);
    border-color: rgba(243, 156, 18, 0.5);
}

/* Compact keyboard mode toggle button (for keyboard overlay) */
.keyboard-mode-btn.compact {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: #2dd4bf;
    border: 2px solid #7be9d9;
    border-radius: 6px;
    color: #052e2b;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.3),
        0 0 0 1px rgba(255,255,255,0.08) inset;
}

.keyboard-mode-btn.compact:hover {
    background: #5fe3d3;
}

.keyboard-mode-btn.compact.main-mode {
    background: #2dd4bf;
    border-color: #7be9d9;
    color: #052e2b;
}

.keyboard-mode-btn.compact.bass-mode {
    background: #f59e0b;
    border-color: #ffd27a;
    color: #3b2200;
}

.keyboard-mode-btn.compact.bass-mode:hover {
    background: #ffb737;
}

.keyboard-mode-btn .mode-icon {
    display: flex;
    align-items: center;
}

.keyboard-mode-btn .mode-instrument {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.18);
    font-size: 9px;
    letter-spacing: 0.25px;
}

.keyboard-mode-btn.compact.bass-mode .mode-instrument {
    background: rgba(0, 0, 0, 0.2);
}

/* Keyboard bass mode visual */
mpk4-keyboard.bass-mode {
    --key-active-color: #f7b731;
}

.pattern-select {
    min-width: 120px;
    max-width: 200px;
    flex: 1;
    font-size: 11px;
    padding: 6px 8px;
}

/* Pattern section layout */
.pattern-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-top: 12px;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.3s;
}

.selectors-row.enabled ~ .pattern-section {
    opacity: 1;
    pointer-events: auto;
}

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

.pattern-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pattern-rows {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.pattern-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 180px;
}

/* Full pattern row - spans full width and stands out */
.full-pattern-row {
    width: 100%;
    flex: none;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.full-pattern-row .full-pattern-select {
    flex: 1;
    max-width: 300px;
}

.full-pattern-row .pattern-icon.full-icon {
    color: #27ae60;
}

.pattern-label {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    width: 40px;
    flex-shrink: 0;
}

.pattern-transport {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pattern-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pattern-icon.drums-icon {
    color: #ff6b6b;
}

.pattern-icon.bass-icon {
    color: #f7b731;
}

/* Mute button styling */
.pattern-mute-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.pattern-mute-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.pattern-mute-btn .pattern-label {
    width: auto;
}

/* Muted state */
.pattern-row.muted .pattern-mute-btn {
    opacity: 0.4;
}

.pattern-row.muted .pattern-icon {
    color: #555 !important;
}

.pattern-row.muted .pattern-label {
    text-decoration: line-through;
    color: #555;
}

.pattern-row.muted .pattern-select {
    opacity: 0.5;
}

.pattern-icon.keys-icon {
    color: #4ecdc4;
}

.selector-label {
    font-size: 13px;
    font-weight: 500;
    color: #888;
}

.selector-select {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #444 0%, #333 100%);
    border: 2px solid #555;
    border-radius: 8px;
    cursor: pointer;
    min-width: 160px;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.selector-select:hover {
    border-color: #777;
    background: linear-gradient(135deg, #555 0%, #444 100%);
}

.selector-select:focus {
    outline: none;
    border-color: #c75050;
    box-shadow: 0 0 0 3px rgba(199, 80, 80, 0.2);
}

.selector-select:disabled {
    opacity: 0.6;
    cursor: wait;
}

.selector-select option {
    background: #333;
    color: #fff;
    padding: 8px;
}

.selector-select optgroup {
    background: #2a2a2a;
    color: #aaa;
    font-style: normal;
    font-weight: 600;
    padding: 4px 0;
}

/* ============================================
   Overlay Modal
   ============================================ */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    background: linear-gradient(135deg, #c8c4be 0%, #bbb7b1 100%);
    border-radius: 12px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.2s;
}

.overlay.active .overlay-content {
    transform: translateY(0);
}

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

.overlay-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.close-btn {
    background: var(--mpk4-device-accent-color, #c75050);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.close-btn:hover {
    background: #b04040;
    transform: scale(1.1);
}

/* ============================================
   CSS Custom Properties (defaults)
   ============================================ */

:root {
    --mpk4-device-accent-color: #c75050;
    --mpk4-screen-header-color: #00d4aa;
}

/* ============================================
   Responsive Styles - Mobile & Tablet Landscape
   ============================================ */

/* Prevent text selection on touch devices for interactive elements */
@media (pointer: coarse) {
    .pad, .knob, .wheel-housing, mpk4-keyboard {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Large tablets in landscape (e.g., iPad Pro) */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    .device-inner {
        padding: 12px 16px 16px;
    }

    .device-top {
        gap: 12px;
    }

    .brand img {
        height: 24px;
        width: auto;
    }

    .model-name {
        font-size: 16px;
    }

    .model-name .mini {
        font-size: 12px;
    }
}

/* Medium tablets in landscape (e.g., iPad, Galaxy Tab) */
@media screen and (max-width: 900px) and (orientation: landscape) {
    .device-inner {
        padding: 10px 14px 14px;
    }

    .device-top {
        gap: 10px;
    }

    /* Scale down wheels */
    .wheel-housing {
        width: 28px;
        height: 100px;
    }

    .wheels-section {
        padding: 8px;
        gap: 8px;
    }

    /* Scale down pads */
    .pad {
        width: 52px;
        height: 52px;
    }

    .pad-labels-row {
        grid-template-columns: repeat(4, 52px);
        gap: 6px;
    }

    .pads-grid {
        gap: 6px;
    }

    .pads-display {
        padding: 10px;
    }

    /* Scale down knobs */
    .knob-ring {
        width: 44px;
        height: 44px;
    }

    .knob {
        width: 36px;
        height: 36px;
    }

    .knob-indicator {
        transform-origin: center 14px;
        height: 4px;
    }

    .knobs-grid {
        gap: 8px 6px;
    }

    .knob-label-row {
        width: 44px;
    }

    .knob-label {
        font-size: 6px;
    }

    .knob-number {
        font-size: 10px;
    }
}

/* Small tablets and large phones in landscape */
@media screen and (max-width: 800px) and (orientation: landscape) {
    .device-frame {
        border-radius: 12px;
        padding: 3px;
    }

    .device-inner {
        border-radius: 10px;
        padding: 8px 12px 12px;
        border-width: 2px;
    }

    .device-top {
        gap: 8px;
        margin-bottom: 10px;
    }

    .brand img {
        height: 20px;
    }

    .model-name {
        font-size: 14px;
    }

    .model-name .mini {
        font-size: 10px;
    }

    /* Scale down wheels further */
    .wheel-housing {
        width: 24px;
        height: 80px;
        border-width: 2px;
    }

    .wheels-section {
        padding: 6px;
        gap: 6px;
        border-radius: 6px;
    }

    .wheel-surface {
        height: 35%;
    }

    /* Scale down pads further */
    .pad {
        width: 46px;
        height: 46px;
        border-width: 2px;
        border-radius: 4px;
    }

    .pad-labels-row {
        grid-template-columns: repeat(4, 46px);
        gap: 5px;
    }

    .pad-labels-row .pad-num {
        font-size: 8px;
        width: 7px;
    }

    .pad-labels-row .pad-name {
        font-size: 4px;
    }

    .pads-grid {
        gap: 5px;
    }

    .pads-display {
        padding: 8px;
        border-radius: 6px;
    }

    .pads-edit-btn {
        bottom: 2px;
        right: 2px;
    }

    .edit-btn {
        padding: 3px;
    }

    .edit-btn svg {
        width: 10px;
        height: 10px;
    }

    /* Scale down knobs further */
    .knob-ring {
        width: 38px;
        height: 38px;
    }

    .knob {
        width: 30px;
        height: 30px;
    }

    .knob-indicator {
        transform-origin: center 12px;
        height: 3px;
        top: 4px;
    }

    .knobs-grid {
        gap: 6px 5px;
    }

    .knob-label-row {
        width: 38px;
        margin-top: 1px;
    }

    .knob-label {
        font-size: 5px;
        letter-spacing: 0.2px;
    }

    .knob-number {
        font-size: 9px;
        bottom: -1px;
        left: -3px;
    }

    /* Screen section */
    .screen-and-status {
        gap: 4px;
    }

    .screen-buttons {
        gap: 2px;
    }
}

/* Phones in landscape (most common use case) */
@media screen and (max-width: 700px) and (orientation: landscape) {
    .device-frame {
        border-radius: 10px;
        padding: 2px;
    }

    .device-inner {
        border-radius: 8px;
        padding: 6px 10px 10px;
    }

    .device-top {
        gap: 6px;
        margin-bottom: 8px;
    }

    .brand img {
        height: 18px;
    }

    .model-name {
        font-size: 12px;
    }

    .model-name .mini {
        font-size: 9px;
    }

    /* Wheels - keep functional but smaller */
    .wheel-housing {
        width: 22px;
        height: 70px;
    }

    .wheels-section {
        padding: 5px;
        gap: 5px;
    }

    /* Pads - minimum touch-friendly size (44px) */
    .pad {
        width: 44px;
        height: 44px;
    }

    .pad-labels-row {
        grid-template-columns: repeat(4, 44px);
        gap: 4px;
    }

    .pads-grid {
        gap: 4px;
    }

    .pads-display {
        padding: 6px;
    }

    /* Knobs - minimum touch-friendly size */
    .knob-ring {
        width: 36px;
        height: 36px;
    }

    .knob {
        width: 28px;
        height: 28px;
    }

    .knob-indicator {
        transform-origin: center 11px;
        top: 3px;
    }

    .knobs-grid {
        gap: 5px 4px;
    }

    .knob-label-row {
        width: 36px;
    }

    .knob-label {
        font-size: 4px;
    }

    .knob-number {
        font-size: 8px;
    }

    /* Keyboard section */
    .keyboard-section {
        margin-top: 6px;
    }
}

/* Very small phones in landscape */
@media screen and (max-width: 600px) and (orientation: landscape) {
    .device-inner {
        padding: 5px 8px 8px;
    }

    .device-top {
        gap: 5px;
        margin-bottom: 6px;
    }

    /* Hide brand logo on very small screens to save space */
    .brand {
        display: none;
    }

    /* Adjust left column without logo */
    .left-column {
        gap: 4px;
    }

    /* Smaller wheels */
    .wheel-housing {
        width: 20px;
        height: 60px;
    }

    .wheels-section {
        padding: 4px;
        gap: 4px;
    }

    /* Pads at minimum viable touch size */
    .pad {
        width: 40px;
        height: 40px;
    }

    .pad-labels-row {
        grid-template-columns: repeat(4, 40px);
        gap: 3px;
    }

    /* Hide pad labels on very small screens */
    .pad-labels-row .pad-name {
        display: none;
    }

    .pad-labels-row .pad-label {
        justify-content: center;
    }

    .pads-grid {
        gap: 3px;
    }

    .pads-display {
        padding: 5px;
    }

    /* Hide edit buttons on very small screens */
    .pads-edit-btn,
    .screen-buttons {
        display: none;
    }

    /* Knobs at minimum size */
    .knob-ring {
        width: 32px;
        height: 32px;
    }

    .knob {
        width: 24px;
        height: 24px;
    }

    .knob-indicator {
        transform-origin: center 9px;
        height: 3px;
        width: 2px;
        top: 2px;
    }

    .knobs-grid {
        gap: 4px 3px;
    }

    .knob-label-row {
        width: 32px;
    }

    /* Hide knob labels on very small screens */
    .knob-label {
        display: none;
    }

    .knob-number {
        font-size: 7px;
        position: static;
    }

    .knob-label-row {
        justify-content: center;
        margin-top: 0;
    }

    /* Model name */
    .model-name {
        font-size: 10px;
    }

    .model-name .mini {
        font-size: 8px;
    }

    .keyboard-section {
        margin-top: 4px;
    }
}

/* Ultra-small screens - hide non-essential elements */
@media screen and (max-width: 500px) and (orientation: landscape) {
    /* Hide wheels on ultra-small screens */
    .wheels-section {
        display: none;
    }

    .left-column {
        display: none;
    }

    /* Simplify layout to just pads, screen, knobs */
    .device-top {
        grid-template-columns: auto min-content auto;
    }
}

/* ============================================
   Audio Controls - Responsive
   ============================================ */

@media screen and (max-width: 800px) and (orientation: landscape) {
    .audio-controls {
        gap: 12px;
        margin-top: 16px;
    }

    .audio-enable-btn {
        padding: 12px 24px;
        font-size: 16px;
        border-radius: 10px;
    }

    .audio-enable-btn .audio-icon {
        width: 24px;
        height: 24px;
    }

    .selectors-row {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .selector-label {
        font-size: 12px;
    }

    .selector-select {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 140px;
        padding-right: 32px;
    }
}

@media screen and (max-width: 600px) and (orientation: landscape) {
    .audio-controls {
        gap: 10px;
        margin-top: 12px;
    }

    .audio-enable-btn {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 8px;
        gap: 8px;
    }

    .audio-enable-btn .audio-icon {
        width: 20px;
        height: 20px;
    }

    .selectors-row {
        gap: 12px;
    }

    .instrument-selector,
    .kit-selector,
    .pattern-controls {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .pattern-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .bpm-input {
        width: 50px;
        padding: 4px 6px;
        font-size: 11px;
    }

    .track-toggle {
        width: 24px;
        height: 24px;
    }

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

    .selector-select {
        padding: 8px 10px;
        font-size: 11px;
        min-width: 120px;
        padding-right: 28px;
        border-radius: 6px;
    }

    .pattern-btn {
        width: 30px;
        height: 30px;
    }
}

/* ============================================
   Overlay Modal - Responsive
   ============================================ */

@media screen and (max-width: 800px) and (orientation: landscape) {
    .overlay-content {
        max-width: 90%;
        max-height: 85vh;
        padding: 16px;
        border-radius: 10px;
    }

    .overlay-header {
        margin-bottom: 12px;
    }

    .overlay-title {
        font-size: 12px;
    }

    .close-btn {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
}

@media screen and (max-width: 600px) and (orientation: landscape) {
    .overlay-content {
        padding: 12px;
        border-radius: 8px;
    }

    .overlay-title {
        font-size: 11px;
    }

    .close-btn {
        width: 22px;
        height: 22px;
        font-size: 14px;
    }
}

/* ============================================
   Touch-friendly hover states
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices - rely on active states */
    .pad:hover::after {
        transform: none;
        box-shadow:
            inset 0 2px 3px rgba(255,255,255,0.25),
            inset 0 -2px 4px rgba(0,0,0,0.2),
            0 2px 4px rgba(0,0,0,0.3);
    }

    .wheel-housing:hover .wheel-surface {
        box-shadow:
            inset 0 1px 2px rgba(255,255,255,0.3),
            inset 0 -1px 2px rgba(0,0,0,0.3),
            0 2px 4px rgba(0,0,0,0.5);
    }

    .audio-enable-btn:hover {
        transform: none;
    }

    .selector-select:hover {
        border-color: #555;
        background: linear-gradient(135deg, #444 0%, #333 100%);
    }

    /* Stronger active states for touch feedback */
    .pad:active::after,
    .pad.active::after {
        transform: translateY(2px);
        box-shadow:
            inset 0 3px 6px rgba(0,0,0,0.4),
            0 0px 1px rgba(0,0,0,0.2);
    }

    .audio-enable-btn:active {
        transform: scale(0.98);
    }

    .knob:active,
    .knob.dragging {
        box-shadow:
            0 2px 4px rgba(0,0,0,0.5),
            0 0 15px rgba(255, 180, 120, 0.4);
    }
}

/* ============================================
   Device Buttons (Hardware Buttons)
   ============================================ */

.device-btn {
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #8a3535;
    border-radius: 4px;
    color: #ccc;
    font-size: 6px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    padding: 4px 6px;
    /* Fixed size for all buttons */
    width: 44px;
    height: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transition: all 0.1s;
    font-family: inherit;
    line-height: 1.1;
}

.device-btn:hover {
    background: linear-gradient(145deg, #3a3a3a 0%, #2a2a2a 100%);
}

.device-btn:active,
.device-btn.active {
    background: linear-gradient(145deg, #1a1a1a 0%, #0a0a0a 100%);
    transform: translateY(1px);
}

.device-btn.accent {
    background: linear-gradient(145deg, #5a4a2a 0%, #3a3020 100%);
    border-color: #8a7535;
}

.device-btn.accent:hover {
    background: linear-gradient(145deg, #6a5a3a 0%, #4a4030 100%);
}

.device-btn[data-action="automation"] {
    color: #ff4444;
}

.device-btn .btn-num {
    font-size: 7px;
    color: #888;
    font-weight: 700;
}

.device-btn .btn-label {
    font-size: 5px;
    text-align: center;
    line-height: 1.2;
}

.device-btn .btn-icon {
    width: 12px;
    height: 12px;
    display: block;
    font-size: 10px;
    line-height: 1;
}

.device-btn[data-action="continue"] .btn-icon {
    width: 16px;
    height: 16px;
}

.device-btn.record .btn-icon {
    font-size: 14px;
    color: #ff4444;
}

.device-btn[data-action="automation"] .btn-icon {
    font-size: 14px;
    color: #ff4444;
}

.device-btn .btn-icon.play-stop {
    font-size: 8px;
}

.device-btn .btn-icon.record-dot {
    font-size: 12px;
}

/* Red Accent Line */
.red-accent-line {
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        #8a3535 10%,
        #c75050 50%,
        #8a3535 90%,
        transparent 100%
    );
    margin: 4px 0;
}

/* ============================================
   Button Row Layouts
   ============================================ */

/* Common styles for all button rows */
.wheel-buttons,
.pads-buttons,
.screen-bottom-buttons,
.knobs-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 8px;
}

/* Constrain knobs buttons to fit within knobs display width */
.knobs-buttons {
    max-width: 100%;
}

.knobs-buttons .device-btn {
    width: 40px;
    min-width: 40px;
    padding: 4px 4px;
}

/* Screen top buttons (+/-) - positioned above the main button row */
.screen-top-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 4px;
    margin-bottom: 4px;
}

.knobs-buttons .device-btn {
    font-size: 10px;
}

.knobs-buttons .device-btn.record {
    color: #ff4444;
}

/* ============================================
   Firmware Info Display
   ============================================ */

.firmware-info {
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-top: 12px;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.firmware-info.visible {
    opacity: 1;
}

/* ============================================
   Device Buttons - Responsive
   ============================================ */

/* Medium tablets in landscape */
@media screen and (max-width: 900px) and (orientation: landscape) {
    .device-btn {
        min-height: 22px;
        padding: 3px 5px;
        font-size: 5px;
    }

    .pads-buttons .device-btn {
        min-height: 24px;
    }

    .knobs-buttons .device-btn {
        min-height: 22px;
        font-size: 9px;
    }
}

/* Small tablets and large phones in landscape */
@media screen and (max-width: 800px) and (orientation: landscape) {
    .device-btn {
        min-height: 20px;
        padding: 2px 4px;
        border-width: 1px;
        border-radius: 3px;
    }

    .wheel-buttons {
        gap: 4px;
        margin-top: 6px;
    }

    .wheel-buttons-labels span {
        font-size: 3px;
    }

    .pads-buttons {
        gap: 3px;
        margin-top: 6px;
    }

    .pads-buttons .device-btn {
        min-height: 22px;
    }

    .screen-top-buttons,
    .screen-bottom-buttons {
        gap: 3px;
    }

    .screen-top-buttons {
        margin-top: 6px;
    }

    .screen-top-buttons .device-btn,
    .screen-bottom-buttons .device-btn {
        min-height: 20px;
        font-size: 5px;
    }

    .knobs-buttons {
        gap: 3px;
        margin-top: 6px;
    }

    .knobs-buttons .device-btn {
        min-height: 22px;
        font-size: 8px;
    }

    .knobs-buttons-labels span {
        font-size: 3px;
    }

    .red-accent-line {
        margin: 3px 0;
    }
}

/* Phones in landscape */
@media screen and (max-width: 700px) and (orientation: landscape) {
    .device-btn {
        min-height: 18px;
        font-size: 4px;
    }

    .wheel-buttons {
        gap: 3px;
        margin-top: 5px;
    }

    .pads-buttons .device-btn {
        min-height: 20px;
    }

    .screen-top-buttons .device-btn,
    .screen-bottom-buttons .device-btn {
        min-height: 18px;
    }

    .knobs-buttons .device-btn {
        min-height: 20px;
        font-size: 7px;
    }
}

/* Very small phones in landscape */
@media screen and (max-width: 600px) and (orientation: landscape) {
    .wheel-buttons-labels {
        display: none;
    }

    .pads-buttons .device-btn {
        min-height: 18px;
        font-size: 4px;
    }

    .screen-top-buttons .device-btn,
    .screen-bottom-buttons .device-btn {
        min-height: 16px;
        font-size: 5px;
    }

    .knobs-buttons .device-btn {
        min-height: 18px;
        font-size: 6px;
    }

    .knobs-buttons-labels {
        display: none;
    }

    .red-accent-line {
        margin: 2px 0;
        height: 1px;
    }
}

/* Ultra-small screens */
@media screen and (max-width: 500px) and (orientation: landscape) {
    .wheel-buttons,
    .wheel-buttons-labels {
        display: none;
    }
}
