/* Harmonia — Hardware Device Theme */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Global scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1a1a1a; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #666; }
html { scrollbar-width: thin; scrollbar-color: #444 #1a1a1a; }

body {
    background: #111;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    padding: 16px;
    margin: 0;
    font-size: 13px;
    min-width: 0;
}

/* ========== CHASSIS ========== */
.chassis {
    background: linear-gradient(170deg, #1e1e1e 0%, #141414 50%, #0d0d0d 100%);
    border-radius: 10px;
    padding: 10px 14px 14px;
    position: relative;
    box-shadow:
        0 0 0 2px #0a0a0a,
        0 0 0 3px #333,
        0 0 0 5px #0a0a0a,
        0 8px 32px rgba(0,0,0,0.8),
        0 2px 8px rgba(0,0,0,0.6);
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
}
.chassis::-webkit-scrollbar { height: 6px; }
.chassis::-webkit-scrollbar-track { background: #1a1a1a; border-radius: 3px; }
.chassis::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
.chassis::-webkit-scrollbar-thumb:hover { background: #666; }
.chassis::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 1px,
        rgba(255,255,255,0.008) 1px,
        rgba(255,255,255,0.008) 2px
    );
    pointer-events: none;
}

/* ========== BRAND BAR ========== */
.brand-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding: 2px 4px;
    min-width: 700px;
}
.power-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, #4caf50, #2e7d32);
    box-shadow: 0 0 6px rgba(76,175,80,0.6), 0 0 12px rgba(76,175,80,0.3);
    border: 1px solid #1a3a1a;
}
/* LED tick flash — short bright pulse on ::before dot */
.led-btn.led-tick::before {
    animation: ledTickPulse 0.15s ease-out;
}
/* Recording — slow smooth breathing pulse */
.led-btn.rec-glow::before {
    animation: recBreathPulse 1.6s ease-in-out infinite;
}
@keyframes recBreathPulse {
    0%, 100% {
        background: radial-gradient(circle, #ffffff, #ff3333);
        box-shadow: 0 0 12px rgba(255,80,80,1), 0 0 24px rgba(255,50,50,0.7);
        transform: translateY(-50%) scale(1.3);
    }
    50% {
        background: radial-gradient(circle, #ff3333, #cc0000);
        box-shadow: 0 0 6px rgba(255,50,50,0.6), 0 0 12px rgba(255,50,50,0.3);
        transform: translateY(-50%) scale(1);
    }
}
@keyframes ledTickPulse {
    0% {
        background: radial-gradient(circle, #ffffff, #ff3333);
        box-shadow: 0 0 12px rgba(255,80,80,1), 0 0 24px rgba(255,50,50,0.7);
        transform: translateY(-50%) scale(1.4);
    }
    100% {
        background: radial-gradient(circle, #ff3333, #cc0000);
        box-shadow: 0 0 6px rgba(255,50,50,0.6), 0 0 12px rgba(255,50,50,0.3);
        transform: translateY(-50%) scale(1);
    }
}
.brand-logo {
    font-weight: 800;
    font-size: 1.1em;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #ddd;
    text-shadow: 0 0 8px rgba(255,255,255,0.15), 0 1px 0 #000;
}
.brand-model {
    font-size: 0.85em;
    color: #999;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-left: 4px;
}
.brand-version {
    font-size: 0.75em;
    color: #888;
    letter-spacing: 1px;
}
.brand-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    color: #888;
}
.brand-user img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}
.brand-user .username {
    color: #ccc;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-size: 0.9em;
    text-shadow: 0 0 8px rgba(255,255,255,0.1);
}
.brand-user .signout-btn {
    font-size: 1em;
    padding: 2px 6px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #888;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}
.brand-user .signout-btn:hover {
    color: #f44336;
    border-color: #f44336;
}

/* ========== CALCULATOR LCD DISPLAY ========== */
.calc-lcd {
    flex: 1 1 0;
    min-width: 200px;
}
.calc-lcd-screen {
    background: #0c1a0c;
    border-top: 3px solid #060606;
    border-left: 3px solid #060606;
    border-bottom: 3px solid #3a3a3a;
    border-right: 3px solid #3a3a3a;
    border-radius: 4px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 0;
    box-shadow:
        inset 0 2px 12px rgba(0,0,0,0.8),
        inset 0 -1px 2px rgba(255,255,255,0.02),
        0 1px 0 rgba(80,80,80,0.15);
    position: relative;
    overflow: hidden;
}
.calc-lcd-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(100,200,100,0.03) 0%,
        transparent 40%,
        transparent 60%,
        rgba(0,0,0,0.1) 100%
    );
    pointer-events: none;
}
.calc-lcd-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.08) 2px,
        rgba(0,0,0,0.08) 4px
    );
    pointer-events: none;
}
.calc-lcd-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 5px;
    min-width: 36px;
    flex-shrink: 0;
}
.calc-lcd-segment.calc-lcd-msg {
    flex: 1 1 0;
    min-width: 80px;
    align-items: flex-end;
    overflow: hidden;
}
.calc-lcd-msg .calc-lcd-value.marquee {
    display: inline-block;
    animation: lcd-marquee 8s linear infinite;
}
@keyframes lcd-marquee {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
.calc-lcd-label {
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.65em;
    color: #3a6b3a;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 2px;
}
.calc-lcd-value {
    font-family: 'Orbitron', 'Consolas', 'Courier New', monospace;
    font-size: 1.15em;
    font-weight: 500;
    color: #66ff66;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(102,255,102,0.4), 0 0 20px rgba(102,255,102,0.15);
    line-height: 1;
    white-space: nowrap;
}
.calc-lcd-dot {
    color: #2a4a2a;
    font-size: 1.2em;
    padding: 0 2px;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 2px;
}
/* Message segment */
.calc-lcd-msg .calc-lcd-value {
    font-size: 0.8em;
    letter-spacing: 1px;
}

/* ========== DASHBOARD BAR ========== */
.dashboard {
    background: linear-gradient(to bottom, #161616, #0e0e0e);
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), inset 0 -1px 0 rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.4);
    position: relative;
    min-width: 700px;
}

/* Control group */
.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.control-group .group-label {
    color: #777;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    text-shadow: 0 0 6px rgba(255,255,255,0.08);
}
.control-group .controls {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Hardware-style buttons */
.hw-btn {
    font-size: 0.7em;
    padding: 5px 8px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #ccc;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    min-width: 26px;
    text-align: center;
    transition: all 0.1s;
}
.hw-btn:hover {
    color: #f44336;
    border-color: #f44336;
}
.hw-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 1px 3px rgba(0,0,0,0.3);
}

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500&display=swap');

/* LCD-style value display */
.hw-val {
    color: #61dafb;
    font-weight: bold;
    font-size: 0.8em;
    min-width: 32px;
    text-align: center;
    padding: 4px 6px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.5);
}

/* Hardware select dropdown */
.hw-select {
    font-size: 0.85em;
    padding: 4px 8px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
    text-align: center;
    text-align-last: center;
}
.hw-select::-webkit-scrollbar { width: 6px; }
.hw-select::-webkit-scrollbar-track { background: #1a1a1a; border-radius: 3px; }
.hw-select::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
.hw-select::-webkit-scrollbar-thumb:hover { background: #666; }
.hw-select option {
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 6px 8px;
    font-size: 1em;
}

/* Separator line */
.separator {
    width: 1px;
    height: 32px;
    background: linear-gradient(to bottom, transparent, #444, transparent);
    margin: 0 4px;
    flex-shrink: 0;
}

/* LED push buttons */
.led-btn {
    font-size: 0.65em;
    padding: 5px 10px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #666;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    padding-left: 20px;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.led-btn::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #222;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
    transition: all 0.15s;
}
.led-btn:hover {
    color: #f44336;
    border-color: #f44336;
}
.led-btn.on:hover {
    color: #f44336;
    border-color: #f44336;
}
.led-btn.on {
    color: #ddd;
    border-color: #555;
}
.led-btn.on::before {
    background: radial-gradient(circle, #ff3333, #cc0000);
    border-color: #ff4444;
    box-shadow: 0 0 6px rgba(255,50,50,0.6), 0 0 12px rgba(255,50,50,0.3);
}
.led-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 1px 3px rgba(0,0,0,0.3);
}

/* Hide checkbox inputs used as backing store for LED buttons */
.dashboard input[type="checkbox"],
.hidden-toggle {
    display: none !important;
}

/* ========== FOCUS LED (in dashboard) ========== */
.focus-led-btn {
    font-size: 0.65em;
    padding: 5px 10px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #666;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
    cursor: default;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    padding-left: 20px;
    min-width: 110px;
    text-align: center;
}
.focus-led-btn::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #222;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
    transition: all 0.15s;
}
.focus-led-btn.active {
    color: #ddd;
    border-color: #555;
}
.focus-led-btn.active::before {
    background: radial-gradient(circle, #4caf50, #2e7d32);
    border-color: #4caf50;
    box-shadow: 0 0 6px rgba(76,175,80,0.6), 0 0 12px rgba(76,175,80,0.3);
}
.focus-led-btn.inactive {
    color: #888;
}
.focus-led-btn.inactive::before {
    background: radial-gradient(circle, #f44336, #c62828);
    border-color: #f44336;
    box-shadow: 0 0 6px rgba(244,67,54,0.6), 0 0 12px rgba(244,67,54,0.3);
}

/* ========== KEYBOARD AREA ========== */
.keyboard-area {
    background: linear-gradient(to bottom, #0a0a0a, #111);
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 6px 8px 8px;
    margin-bottom: 4px;
    text-align: center;
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.03);
    overflow: hidden;
    min-width: 700px;
}

#pianoKeyboardContainer {
    flex: none;
    width: 100%;
    min-width: 0;
    display: flex;
    height: 200px;
    border: 1px solid #555;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background-color: #ccc;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

/* ========== PIANO KEYS ========== */
.piano-key {
    border: 1px solid #333;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.04s, box-shadow 0.04s, border-color 0.04s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-size: 0.7em;
    padding-bottom: 3px;
}

.white-key {
    background: linear-gradient(to bottom, #e8e8e8, #f5f5f5 40%, #fff 60%, #f0f0f0);
    color: #333;
    height: 100%;
    width: calc(100% / 22);
    z-index: 1;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 -2px 4px rgba(0,0,0,0.08);
}
.white-key:active {
    background: linear-gradient(to bottom, #ddd, #eee);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(1px);
}

.black-key {
    background: linear-gradient(to bottom, #222, #444);
    color: #eee;
    height: 60%;
    width: calc(100% / 22 * 0.6);
    position: absolute;
    z-index: 2;
    border: 1px solid #111;
    border-radius: 0 0 3px 3px;
    transition: none;
}

/* Black key positions */
.black-key[data-note="49"] { left: calc(100% / 22 * 0.7); }
.black-key[data-note="51"] { left: calc(100% / 22 * 1.7); }
.black-key[data-note="54"] { left: calc(100% / 22 * 3.7); }
.black-key[data-note="56"] { left: calc(100% / 22 * 4.7); }
.black-key[data-note="58"] { left: calc(100% / 22 * 5.7); }
.black-key[data-note="61"] { left: calc(100% / 22 * (7 + 0.7)); }
.black-key[data-note="63"] { left: calc(100% / 22 * (7 + 1.7)); }
.black-key[data-note="66"] { left: calc(100% / 22 * (7 + 3.7)); }
.black-key[data-note="68"] { left: calc(100% / 22 * (7 + 4.7)); }
.black-key[data-note="70"] { left: calc(100% / 22 * (7 + 5.7)); }
.black-key[data-note="73"] { left: calc(100% / 22 * (14 + 0.7)); }
.black-key[data-note="75"] { left: calc(100% / 22 * (14 + 1.7)); }
.black-key[data-note="78"] { left: calc(100% / 22 * (14 + 3.7)); }
.black-key[data-note="80"] { left: calc(100% / 22 * (14 + 4.7)); }
.black-key[data-note="82"] { left: calc(100% / 22 * (14 + 5.7)); }

.piano-key:hover { background-color: #ddd; }
.black-key:hover { background-color: #555; }

/* Scale — playable / disabled / root */
.white-key.playable-key {
    background: linear-gradient(to bottom, #e8e8e8, #f5f5f5 40%, #fff 60%, #f0f0f0) !important;
}
.black-key.playable-key {
    background: linear-gradient(to bottom, #1a1a1a, #2a2a2a) !important;
    color: #eee !important;
}
.piano-key.disabled-key { cursor: pointer; }
.white-key.disabled-key {
    background: repeating-linear-gradient(-45deg, #d0d0d0, #d0d0d0 3px, #aaa 3px, #aaa 6px) !important;
    color: #888 !important;
}
.black-key.disabled-key {
    background: repeating-linear-gradient(-45deg, #555, #555 3px, #333 3px, #333 6px) !important;
    color: #999 !important;
}
.white-key.playable-key.root-key {
    background: linear-gradient(to bottom, #e8dfa0, #f0e8a0 40%, #FFF3C4 60%, #ede0a0) !important;
}
.black-key.playable-key.root-key {
    background: linear-gradient(to bottom, #b8960a, #d4a80e) !important;
    color: #fff !important;
}

/* Pressed keys — full gold fill (MUST come after playable/root to win cascade) */
.piano-key.key-pressed,
.piano-key.key-pressed-midi,
.piano-key.key-pressed-keyboard,
.piano-key.playable-key.key-pressed,
.piano-key.playable-key.key-pressed-midi,
.piano-key.playable-key.key-pressed-keyboard,
.piano-key.playable-key.root-key.key-pressed,
.piano-key.playable-key.root-key.key-pressed-midi,
.piano-key.playable-key.root-key.key-pressed-keyboard,
.piano-key.disabled-key.key-pressed,
.piano-key.disabled-key.key-pressed-midi,
.piano-key.disabled-key.key-pressed-keyboard {
    background: #ffb300 !important;
    color: #fff !important;
    border-color: #ff8f00 !important;
    box-shadow: 0 0 18px rgba(255, 179, 0, 0.9), inset 0 0 12px rgba(255, 220, 0, 0.4) !important;
}
/* Only raise z-index on pressed black keys so white keys don't cover them */
.black-key.key-pressed,
.black-key.key-pressed-midi,
.black-key.key-pressed-keyboard {
    z-index: 3 !important;
    border-color: #111 !important;
    box-shadow: 0 0 14px rgba(255, 179, 0, 0.7) !important;
}

/* Key labels */
.key-label {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: bold;
    font-family: monospace;
    pointer-events: none;
    user-select: none;
    opacity: 0.9;
    text-shadow: 0 1px 1px rgba(0,0,0,0.4);
    line-height: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.white-key .key-label { color: #333; }
.black-key .key-label { color: #ddd; bottom: 3px; font-size: 10px; }
.key-char { font-size: 13px; font-weight: bold; }
.key-note { font-size: 9px; font-weight: normal; opacity: 0.7; }
.black-key .key-char { font-size: 11px; }
.black-key .key-note { font-size: 8px; }
.hide-labels .key-label { display: none !important; }

/* ========== PANELS ========== */
.panel-row {
    display: flex;
    gap: 3px;
    margin-top: 3px;
    flex-wrap: nowrap;
    min-width: 700px;
}
.panel {
    background: linear-gradient(to bottom, #1a1a1a, #0d0d0d);
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 8px rgba(0,0,0,0.5);
    min-width: 0;
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #2a2a2a;
}
.panel-title {
    color: #ccc;
    font-weight: 700;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 6px rgba(255,255,255,0.1);
}
.close-btn {
    margin-left: auto;
    width: 18px;
    height: 18px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #666;
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 0.6em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    transition: all 0.1s;
    padding: 0;
    line-height: 1;
}
.close-btn:hover {
    color: #ff4444;
    border-color: #ff4444;
}

/* Panel buttons */
.panel-btn {
    font-size: 0.65em;
    padding: 4px 10px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #999;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    transition: all 0.1s;
}
.panel-btn:hover {
    color: #f44336;
    border-color: #f44336;
}
.panel-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 1px 3px rgba(0,0,0,0.3);
}

/* Chord buttons — hardware beveled */
.chord-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    margin: 2px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    border: 1px solid #444;
    border-radius: 3px;
    color: #ccc;
    font-size: 0.72em;
    text-align: center;
    box-shadow: 0 2px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
    cursor: pointer;
    transition: all 0.1s;
    min-width: 46px;
    height: 38px;
    box-sizing: border-box;
    overflow: hidden;
    font-weight: 600;
}
.chord-btn:hover {
    border-color: #f44336;
    color: #f44336;
}
.chord-btn:active {
    transform: scale(0.95);
}
.chord-btn.highlight {
    background: linear-gradient(to bottom, #1a3040, #0d1820);
    border-color: rgba(97,218,251,0.4);
    color: #61dafb;
    box-shadow: 0 2px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(97,218,251,0.08), 0 0 6px rgba(97,218,251,0.1);
}
.chord-roman { font-weight: bold; color: #61dafb; font-size: 1.1em; }
.chord-name { font-size: 0.8em; color: #999; margin-top: 2px; }
.chord-btn-extra { }
.chord-btn-extra:hover { }
.chord-btn-dim { opacity: 0.75; }
.chord-btn-dim:hover { opacity: 1; }
.chord-shortcut { font-size: 0.65em; color: #888; margin-top: 2px; opacity: 0.7; }

/* Legend */
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: #bbb;
    margin: 3px 0;
}
.legend-swatch {
    width: 22px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid #555;
    display: inline-block;
    flex-shrink: 0;
}

/* Shortcuts panel */
.shortcuts-content {
    font-size: 0.85em;
    color: #b0b0b0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.6;
}
.shortcuts-content span.shortcut-key {
    color: #61dafb;
    font-family: 'Consolas', monospace;
}
.shortcuts-content kbd {
    display: inline-block;
    background: linear-gradient(to bottom, #333, #222);
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.95em;
    font-family: 'Consolas', monospace;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
    line-height: 1.5;
    min-width: 16px;
    text-align: center;
}

/* Editor area */
.editor-area {
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    padding: 4px 6px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.7em;
    color: #666;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}

.hw-select-panel {
    font-size: 0.85em;
    padding: 3px 6px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
}
.hw-select::-webkit-scrollbar { width: 6px; }
.hw-select::-webkit-scrollbar-track { background: #1a1a1a; border-radius: 3px; }
.hw-select::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
.hw-select::-webkit-scrollbar-thumb:hover { background: #666; }
.hw-select-panel option {
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 6px 8px;
    font-size: 1em;
}

/* Status lines */
.status-line {
    font-size: 0.7em;
    margin: 3px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green {
    background: radial-gradient(circle, #4caf50, #2e7d32);
    box-shadow: 0 0 4px rgba(76,175,80,0.5);
}

/* MIDI info row */
.midi-info {
    font-size: 0.85em;
    color: #999;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.midi-info label {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== CODE EDITOR WRAPPER (CodeMirror 6) ========== */
#codeEditorWrapper {
    overflow: hidden;
    border-radius: 4px;
}
#codeEditorWrapper .cm-editor {
    border-radius: 4px;
}
#codeEditorWrapper .cm-scroller {
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
}
#codeEditorWrapper .cm-scroller::-webkit-scrollbar { width: 6px; }
#codeEditorWrapper .cm-scroller::-webkit-scrollbar-track { background: #1a1a1a; border-radius: 3px; }
#codeEditorWrapper .cm-scroller::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
#codeEditorWrapper .cm-scroller::-webkit-scrollbar-thumb:hover { background: #666; }

/* ========== AUTOCOMPLETE (sound dropdown in MIDI Coder) ========== */
.autocomplete-container {
    position: relative;
    min-width: 200px;
}
.dropdown-input-wrapper {
    display: flex;
    align-items: center;
    background-color: #3a3f46;
    border: 1px solid #5a5f66;
    border-radius: 3px;
}
#soundTypeInput {
    padding: 4px 8px;
    background: transparent;
    color: #f0f0f0;
    border: none;
    font-size: 0.9em;
    flex: 1;
    cursor: pointer;
}
#soundTypeInput:focus { outline: none; }
.dropdown-input-wrapper:focus-within {
    border-color: #61dafb;
    box-shadow: 0 0 3px rgba(97, 218, 251, 0.3);
}
.dropdown-toggle {
    background: transparent;
    border: none;
    color: #c0c0c0;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.8em;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dropdown-toggle:hover { color: #61dafb; }
.dropdown-toggle.open { transform: rotate(180deg); }
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #3a3f46;
    border: 1px solid #5a5f66;
    border-top: none;
    border-radius: 0 0 3px 3px;
    z-index: 1000;
    display: none;
}
.autocomplete-results.show { display: block; }
.search-input {
    width: 100%;
    padding: 6px 8px;
    background-color: #2a2f36;
    color: #f0f0f0;
    border: none;
    border-bottom: 1px solid #4a4f56;
    font-size: 0.9em;
    box-sizing: border-box;
}
.search-input:focus {
    outline: none;
    background-color: #1a1f26;
    border-bottom-color: #61dafb;
}
.dropdown-options { max-height: 200px; overflow-y: auto; }
.autocomplete-item {
    padding: 6px 8px;
    cursor: pointer;
    font-size: 0.9em;
    color: #f0f0f0;
    border-bottom: 1px solid #4a4f56;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.selected { background-color: #61dafb; color: #2a2f36; }
.autocomplete-item.highlighted { background-color: #555; }

/* ========== MISC COMPAT ========== */
kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 0.85em;
    font-family: monospace;
    color: #f0f0f0;
    background-color: #3a3f46;
    border: 1px solid #5a5f66;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.3);
    min-width: 16px;
    text-align: center;
}

button { cursor: pointer; }

#keyboard-help-panel summary::-webkit-details-marker { display: none; }
#keyboard-help-panel[open] summary span:first-child { transform: rotate(90deg); }

#midi-status-row {
    display: flex;
    gap: 3px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.piano-column-wrapper {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-width: 0;
}
