body {
    margin: 0;
    padding: 0;
    font-family: 'Orbitron', 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

html {
    width: 100%;
    height: 100%;
}

#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    text-align: center;
}

#header {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

#app-title {
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 0 10px #ffffff;
    text-align: center;
    color: #ffffff;
}

#midi-status {
    display: flex;
    gap: clamp(10px, 2vw, 20px);
    justify-content: center;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
}

.status-item {
    background: rgba(255, 255, 255, 0.1);
    padding: clamp(3px, 0.5vh, 5px) clamp(6px, 1vw, 10px);
    border-radius: 5px;
    border: 1px solid #ffffff;
}

/* Controls positioned to the right of mod wheel */
#left-controls {
    position: absolute;
    top: 10%;
    left: clamp(140px, 16%, 240px);
    display: flex;
    flex-direction: column;
    gap: 1.5%;
    z-index: 100;
    width: clamp(140px, 18%, 280px);
    height: fit-content;
}

/* Controls panel - octave and transpose controls */
#controls-panel {
    position: absolute;
    top: 2%;
    left: clamp(140px, 16%, 240px);
    bottom: calc(45% + 2%);
    display: flex;
    flex-direction: column;
    gap: 1%;
    z-index: 100;
    width: clamp(100px, 10%, 122px);
}

/* Fullscreen button repositioned */
#fullscreen-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 101;
}

.control-group {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #ffffff;
    border-radius: 6px;
    padding: clamp(4px, 0.5vw, 6px);
    width: clamp(90px, 9vw, 110px);
    min-width: 80px;
}

.control-label {
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    text-transform: uppercase;
    margin-bottom: clamp(4px, 0.5vh, 8px);
    color: #cccccc;
}

.control-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid #ffffff;
    color: #ffffff;
    padding: clamp(4px, 0.5vh, 6px) clamp(6px, 0.8vw, 8px);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.control-value {
    font-weight: bold;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    min-width: clamp(24px, 2.5vw, 30px);
    text-align: center;
}

#midi-panel {
    position: absolute;
    top: 10%;
    right: 2%;
    z-index: 100;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #ffffff;
    border-radius: 8px;
    padding: clamp(4px, 1%, 8px);
    width: clamp(180px, 20%, 280px);
    display: flex;
    flex-direction: column;
    gap: 0.5%;
    height: fit-content;
    max-height: calc(100% - 45% - 12%);
}

#midi-panel::-webkit-scrollbar {
    width: 8px;
}

#midi-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#midi-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffffff 0%, #cccccc 100%);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#midi-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ffffff 0%, #aaaaaa 100%);
}

/* Firefox scrollbar styling */
#midi-panel {
    scrollbar-width: thin;
    scrollbar-color: #ffffff rgba(255, 255, 255, 0.1);
}

.device-section {
    margin-bottom: 0;
    flex-shrink: 0;
}

.device-section:last-child {
    margin-bottom: 0;
}

.device-label {
    font-size: clamp(0.55rem, 0.9vw, 0.7rem);
    text-transform: uppercase;
    margin-bottom: 2px;
    color: #cccccc;
}

.device-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid #ffffff !important;
    color: #ffffff !important;
    padding: clamp(4px, 0.5vh, 6px);
    border-radius: 4px;
    font-family: 'Orbitron', 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
}

.device-select option {
    background: rgba(50, 50, 50, 0.95) !important;
    color: #ffffff !important;
    padding: 4px 8px;
}
    font-family: inherit;
    font-size: 0.9rem;
}

#canvas-container {
    flex: 1;
    position: relative;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#keyboard-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    z-index: 50;
    display: flex;
    justify-content: stretch;
    align-items: flex-end;
    gap: 0;
    background: rgba(0, 0, 0, 0.3);
    padding: 0;
    border-top: 2px solid #ffffff;
    box-shadow: 0 -10px 30px rgba(255, 255, 255, 0.2);
    width: 100%;
    touch-action: none;
}

.piano-key {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s;
    border-radius: 0 0 4px 4px;
}

.white-key {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
    border: 1px solid #ccc;
    border-left: 2px solid #bbb;
    border-right: 2px solid #bbb;
    color: #333;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2vh;
    font-size: clamp(0.6rem, 1.5vw, 0.9rem);
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    border-radius: 0 0 8px 8px;
    box-sizing: border-box;
}

.white-key:hover {
    background: linear-gradient(180deg, #f8f8f8 0%, #e8e8e8 100%);
    transform: translateY(1px);
}

.white-key.active {
    background: linear-gradient(180deg, #ffffff 0%, #00ffff 30%, #ffffff 100%) !important;
    color: #000;
    transform: translateY(3px);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.9), inset 0 0 15px rgba(0, 255, 255, 0.3) !important;
    border-color: #00ffff !important;
}

.black-key {
    width: clamp(40px, 5vw, 80px);
    height: 58%;
    background: linear-gradient(180deg, #333 0%, #111 100%);
    border: 2px solid #000;
    color: #ffffff;
    z-index: 10;
    position: absolute;
    top: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1.5vh;
    font-size: clamp(0.5rem, 1.2vw, 0.8rem);
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
    border-radius: 0 0 6px 6px;
    transform: translateX(-50%);
}

.black-key:hover {
    background: linear-gradient(180deg, #555 0%, #333 100%);
    transform: translateX(-50%) translateY(1px);
}

.black-key.active {
    background: linear-gradient(180deg, #ff6600 0%, #333333 50%, #111111 100%) !important;
    color: #ffffff !important;
    transform: translateX(-50%) translateY(3px);
    box-shadow: 0 0 25px rgba(255, 102, 0, 0.9), inset 0 0 15px rgba(255, 102, 0, 0.3) !important;
    border-color: #ff6600 !important;
}

#note-display {
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #ffffff;
    border-radius: 12px;
    padding: clamp(10px, 2vh, 18px) clamp(16px, 2vw, 28px);
    text-align: center;
    min-width: clamp(100px, 12vw, 140px);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

#keyboard-help {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #ffffff;
    border-radius: 8px;
    padding: clamp(4px, 0.8vh, 6px) clamp(8px, 1vw, 12px);
    text-align: center;
    font-size: clamp(0.5rem, 1vw, 0.65rem);
    color: #cccccc;
    max-width: 65%;
    margin-top: clamp(8px, 1.5vh, 15px);
    margin-bottom: clamp(8px, 1.5vh, 15px);
}

/* Pitch and Mod Wheels - Top Left */
#wheel-container {
    position: absolute;
    top: 2%;
    left: 2%;
    bottom: calc(45% + 2%);
    display: flex;
    gap: clamp(8px, 1vw, 12px);
    z-index: 100;
}

.wheel-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.wheel-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    height: 100%;
}

.vertical-wheel {
    writing-mode: bt-lr; /* IE */
    -webkit-appearance: slider-vertical; /* WebKit */
    width: clamp(50px, 5vw, 70px);
    flex: 1;
    min-height: 100px;
    background: linear-gradient(180deg, #333 0%, #111 100%) !important;
    border: 2px solid #ffffff !important;
    border-radius: 16px;
    outline: none;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
    accent-color: #ffffff !important;
}

.vertical-wheel::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 40px;
    height: 12px;
    background: #ffffff !important;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    border: none !important;
}

.vertical-wheel::-moz-range-thumb {
    width: 40px;
    height: 12px;
    background: #ffffff !important;
    border-radius: 6px;
    cursor: pointer;
    border: none !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}



.wheel-value {
    font-size: clamp(0.5rem, 1vw, 0.7rem);
    color: #ffffff;
    font-weight: bold;
    min-width: clamp(24px, 2.5vw, 30px);
    text-align: center;
}

.current-note {
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: bold;
    margin-bottom: 5px;
}

.current-midi {
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    opacity: 0.8;
}

/* Fullscreen button styling - small icon */
.fullscreen-control {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    min-width: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.2s;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
    transform: translateY(-1px);
}

.fullscreen-btn:active {
    transform: translateY(0);
    background: rgba(0, 255, 255, 0.4);
}

/* Responsive adjustments for smaller screens */
@media (max-width: 1200px) {
    #keyboard-overlay {
        height: 42%;
    }
    
    #wheel-container {
        bottom: calc(42% + 2%);
    }
    
    #controls-panel {
        bottom: calc(42% + 2%);
    }
    
    #midi-panel {
        max-height: calc(100% - 42% - 12%);
    }
}

@media (max-width: 900px) {
    #keyboard-overlay {
        height: 38%;
    }
    
    #wheel-container {
        bottom: calc(38% + 2%);
    }
    
    #controls-panel {
        bottom: calc(38% + 2%);
    }
    
    #midi-panel {
        max-height: calc(100% - 38% - 12%);
        width: clamp(140px, 22%, 200px);
    }
    
    #note-display {
        top: 16%;
    }
    
    #keyboard-help {
        top: 32%;
    }
}

@media (max-width: 600px) {
    #keyboard-overlay {
        height: 35%;
    }
    
    #wheel-container {
        bottom: calc(35% + 2%);
        left: 1%;
        gap: 6px;
    }
    
    #controls-panel {
        bottom: calc(35% + 2%);
        left: clamp(100px, 14%, 150px);
    }
    
    #midi-panel {
        max-height: calc(100% - 35% - 14%);
        width: clamp(120px, 26%, 160px);
        right: 1%;
    }
    
    .vertical-wheel {
        width: clamp(35px, 6%, 50px);
        min-height: 60px;
    }
    
    #note-display {
        top: 14%;
    }
    
    #keyboard-help {
        top: 28%;
        max-width: 80%;
    }
}