body {
    margin: 0;
    padding: 0;
    font-family: 'Source Code Pro', monospace;
    background: rgb(0, 0, 0);
    color: white;
}

/* Completely disable pointer events on EigenSpace when Modal Studio is active */
body.scene-modalstudio #eigenspace-app {
    pointer-events: none !important;
}

body.scene-modalstudio #eigenspace-app * {
    pointer-events: none !important;
}

#container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

#header {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    padding: 5px;
    margin: 0px;
    z-index: 9999;
}

#header h1 {
    margin: 0px;
    padding: 0px;
    font-size: 30px;
    font-weight: 300;
}

#header h3 {
    margin: 0px;
    padding: 0px;
    font-size: 16px;
    font-weight: normal;
}

#header p {
    margin: 0px 0px 0px 0px;
    padding: 5px;
    font-size: 18px;
}

#controls {
    text-align: center;
    padding: 10px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.05);
    margin: 5px auto;
    border-radius: 8px;
    max-width: 300px;
}

#controls label {
    margin-right: 10px;
    font-weight: bold;
}

#controls select {
    padding: 5px 10px;
    font-size: 16px;
    font-family: 'Source Code Pro', monospace;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#controls select:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
}

#click-output {
    text-align: center;
    font-size: 16px;
    padding: 10px;
    margin: 0px 0px 0px 0px;
    background: rgba(0, 0, 0, 1);
    border-radius: 5px;
}

#plot {
    flex: 1;
    width: 100%;
    /* max-width: 100vw; */
    /* overflow: hidden; */
    z-index: 1;
}

/* Plotly legend styling - rounded corners */
.legend {
    border-radius: 20px !important;
}

.legendtext {
    border-radius: 4px !important;
}

.legendtoggle {
    border-radius: 4px !important;
}

#progress-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.0);
    padding: 40px 60px;
    border-radius: 15px;
    z-index: 1000;
}

#progress-bar {
    width: 50vw;
    height: 20px;
    margin: 10px auto;
    background: rgb(0, 0, 0);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#progress-bar::before {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(90deg, rgb(0, 65, 205), rgb(5, 213, 255));
    border-radius: 10px;
    width: var(--progress, 1%);
    position: absolute;
    left: 0;
    top: 0;
}

#progress-text {
    font-size: 18px;
    margin-top: 5px;
    color: white;
}

.progress {
    text-align: center;
    padding: 5px;
    font-size: 25px;
    margin: 0px;
    color: white;
}

#audio-gui-container,
#eigenspace-audio-gui {
    position: fixed;
    top: 5px;
    left: 10px;
    width: 350px;
    height: 320px;
    border-radius: 20px;
    z-index: 100;
    font-family: 'Source Code Pro', monospace;
    /* box-shadow: 1px 1px 5px rgba(108, 108, 108, 0.75); */
}

/* Modal Studio audio GUI uses its own positioning from modal_studio_style.css (bottom-left) */

#chord-visualization-container {
    width: 350px;
    height: 640px;
    background: rgba(0, 0, 0, 0.0);
    position: fixed;
    top: 300px;
    left: 10px;
    z-index: 100;
    border-radius: 20px;
}

#colorbar-container {
    /* background: rgba(0, 0, 0, 0); */
    position: fixed;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    z-index: 100;
    font-family: 'Source Code Pro', monospace;
}

#colorbar-container canvas {
    border-radius: 20px;
}

/* Hidden state for slider when in Full 3D mode */
#colorbar-container.hidden {
    right: -200px;
}

/* Switch to Full 3D View */
#viz-mode-toggle {
    position: fixed;
    top: 5px;
    right: 282px;
    box-sizing: border-box;
    /* Consistent sizing */
    /* transform: translateX(-50%); */
    background: rgba(0, 111, 229, 0.8);
    border: none;
    color: white;
    padding: 7px 20px;
    font-size: 12px;
    font-family: 'Source Code Pro', monospace;
    font-weight: normal;
    border-radius: 5px;
    cursor: pointer;
    z-index: 9999;
    line-height: 1;
    transition: all 0.2s ease;
}

#viz-mode-toggle:hover {
    background: rgba(0, 111, 229, 1);
    /* transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); */
}

/* Modal Studio Navigation Button - positioned dynamically to the left of viz-mode-toggle */
#nav-to-modalstudio {
    position: fixed;
    top: 5px;
    right: calc(282px + 1px); /* 282px is viz-mode-toggle right position + 1px gap */
    background: rgba(0, 111, 229, 0.8);
    border: none;
    color: white;
    padding: 7px 20px;
    font-size: 12px;
    font-family: 'Source Code Pro', monospace;
    font-weight: normal;
    border-radius: 5px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease; /* Only transition background, not position */
    line-height: 1;
}

#nav-to-modalstudio:hover {
    background: rgba(0, 111, 229, 1);
}

/* Scene-specific display handled by JavaScript switchScene() */

/* Chord Grid Toggle Button */
#grid-toggle {
    position: fixed;
    top: 5px;
    right: 161px;
    width: 120px;
    /* Fixed total width including padding (92px content + 40px padding) */
    box-sizing: border-box;
    /* Include padding in width calculation */
    justify-content: center;
    /* Center the content within fixed width */
    /* Position to the left of info button */
    background: rgba(0, 111, 229, 0.8);
    border: none;
    color: white;
    padding: 7px 20px;
    font-size: 12px;
    font-family: 'Source Code Pro', monospace;
    font-weight: normal;
    border-radius: 5px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

#grid-toggle:hover {
    background: rgba(0, 111, 229, 1);
}

/* Position Plotly's modebar (node visibility toggles) to top-right */
.modebar {
    position: fixed !important;
    top: 60px !important;
    right: 15px !important;
    z-index: 150 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    border-radius: 6px !important;
    padding: 4px !important;
}

.modebar-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
    margin: 2px !important;
}

.modebar-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}



/* ============================================================================
   INFO OVERLAY STYLING - Enhanced Visual Effects
   ============================================================================ */

/* Info overlay backdrop */
#info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Info panel container */
.info-panel {
    background: rgb(255, 250, 240);
    border: none;
    border-radius: 10px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow-y: auto !important;
    /* scrollbar-width: thin !important; */
    scrollbar-color: rgba(209, 209, 209, 0.8) rgba(240, 240, 240, 0.0) !important;
}

/* Info panel content styling */
.info-panel .header-section {
    text-align: center;
    margin-bottom: 30px;
}

.info-panel .main-title {
    color: rgba(16, 16, 16, 1);
    font-family: 'Source Code Pro', monospace;
    font-size: 30px;
    margin: 0 0 5px 0;
    font-weight: 600;
}

.info-panel .subtitle {
    color: rgba(16, 16, 16, 1);
    font-family: 'Source Code Pro', monospace;
    font-size: 15px;
    letter-spacing: 1px;
    font-weight: 600;
}

.info-panel .content-section {
    color: rgba(16, 16, 16, 1);
    font-family: 'Source Code Pro', monospace;
    font-size: 14px;
    line-height: 1.8;
}

.info-panel .section {
    margin-bottom: 25px;
}

.info-panel .section h3 {
    color: rgba(16, 16, 16, 1);
    font-size: 16px;
    margin: 0 0 10px 0;
    font-weight: 600;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.info-panel .section p {
    margin: 0 0 10px 0;
}

.info-panel .section ul {
    margin: 0 0 10px 20px;
    padding: 0;
}

.info-panel .section li {
    margin-bottom: 8px;
}

.info-panel .alpha-color {
    color: rgb(255, 119, 0);
}

.info-panel .beta-color {
    color: rgb(86, 173, 0);
}

.info-panel .gamma-color {
    color: rgb(0, 128, 255);
}

.info-panel .root-color {
    color: rgba(0, 0, 0, 1);
}

.info-panel strong {
    color: rgba(0, 0, 0, 1);
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.info-panel .formula {
    display: block;
    text-align: center;
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    font-style: italic;
    background: rgb(255, 250, 240);
    padding: 8px 12px;
    margin: 8px auto;
    border-radius: 10px;
    max-width: fit-content;
}

.info-panel .technical-note {
    background: rgb(233, 233, 233);
    padding: 15px;
    border-radius: 20px;
    margin-top: 20px;
    font-size: 14px;
}

.info-panel .close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid rgba(150, 150, 150, 0.5);
    color: rgba(150, 150, 150, 1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
}

.info-panel .button-section {
    text-align: center;
    margin-top: 30px;
}

.info-panel .got-it-btn {
    background: rgba(31, 125, 255, 1);
    border: none;
    color: white;
    padding: 12px 40px;
    font-size: 14px;
    font-family: 'Source Code Pro', monospace;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
}

.info-panel .eigenspace-image {
    text-align: center;
    margin: 10px 0;
    padding: 0px;
    background: rgba(250, 250, 250, 0.7);
    border-radius: 20px;
    border: 0px solid rgba(200, 200, 200, 0.5);
}

.info-panel .eigenspace-image img {
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.info-panel .image-caption {
    margin: 10px 0 0 0;
    font-size: 12px;
    color: rgba(100, 100, 100, 1);
    font-style: italic;
}

.info-panel strong {
    color: rgba(0, 0, 0, 1);
    /* Pure black for more contrast */
}

/* Responsive design */
@media screen and (max-width: 768px) {
    #info-overlay>div {
        padding: 20px 20px !important;
        max-width: 95% !important;
        font-size: 12px !important;
    }

    #info-overlay h1 {
        font-size: 22px !important;
    }

    #info-overlay h3 {
        font-size: 14px !important;
        font-weight: normal !important;
    }

    #info-button {
        bottom: 10px !important;
        right: 10px !important;
        padding: 8px 16px !important;
        font-size: 12px !important;
    }
}

@media screen and (max-width: 480px) {
    #info-overlay>div {
        padding: 20px 15px !important;
        border-radius: 15px !important;
    }

    #info-overlay h1 {
        font-size: 18px !important;
    }

    #info-overlay ul {
        margin-left: 20px !important;
    }
}

/* Selection styling */
#info-overlay ::selection {
    background: rgb(255, 255, 255);
    color: white;
}

#info-overlay ::-moz-selection {
    background: rgba(0, 0, 0, 0.0);
    color: white;
}

/* Link styling (if you add any links) */
#info-overlay a {
    color: rgb(0, 83, 167);
    text-decoration: none;
    /* border-bottom: 1px solid rgba(5, 213, 255, 0.3); */
    transition: all 0.2s ease;
}

#info-button {
    position: fixed;
    top: 5px;
    right: 91px;
    background: rgba(0, 111, 229, 0.8);
    border: none;
    color: white;
    padding: 7px 20px;
    font-size: 12px;
    font-family: 'Source Code Pro', monospace;
    font-weight: light;
    border-radius: 5px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    line-height: 1;
}

#info-button:hover {
    background: rgba(0, 111, 229, 1);
}

/* ============================================================================
   MIDI/MPE PANEL STYLING
   ============================================================================ */

/* MIDI toggle button - positioned next to info button */
#midi-toggle {
    position: fixed;
    top: 5px;
    right: 10px;
    width: 80px;
    /* Fixed total width including padding (92px content + 40px padding) */
    box-sizing: border-box;
    /* Include padding in width calculation */
    justify-content: center;
    /* Center the content within fixed width */
    /* Position to the left of info button */
    background: rgba(0, 111, 229, 0.8);
    border: none;
    color: white;
    padding: 7px 20px;
    font-size: 12px;
    font-family: 'Source Code Pro', monospace;
    font-weight: light;
    border-radius: 5px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

#midi-toggle:hover {
    background: rgba(0, 111, 229, 1);
}

#midi-toggle .midi-icon {
    font-size: 12px;
    line-height: 1;
}

.midi-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 400px;
    background: rgba(23, 23, 23, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 9998;
    opacity: 0;
    font-weight: normal;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: 'Source Code Pro', monospace;
}

.midi-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.midi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.midi-title {
    font-size: 16px;
    font-weight: 600;
    color: rgba(250, 250, 250, 1);
    letter-spacing: 0.5px;
}

.midi-close-btn {
    background: transparent;
    border: 1px solid rgba(150, 150, 150, 0.3);
    color: rgba(150, 150, 150, 1);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.midi-close-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.05);
}

.midi-content {
    padding: 20px;
}

/* Status indicator */
.midi-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(150, 150, 150, 0.5);
    box-shadow: 0 0 8px rgba(150, 150, 150, 0.3);
    transition: all 0.3s ease;
}

.status-indicator.connected {
    background: rgba(0, 255, 100, 1);
    box-shadow: 0 0 12px rgba(0, 255, 100, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

#status-text {
    color: rgba(250, 250, 250, 1);
    flex: 1;
}

/* External MIDI Piano toggle button (on main page) - only when NOT inside panel */
#midi-piano-toggle:not(.midi-piano-btn) {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(76, 175, 80, 0.8);
    border: none;
    color: white;
    padding: 7px 20px;
    font-size: 11px;
    font-family: 'Source Code Pro', monospace;
    font-weight: 300;
    border-radius: 8px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.2s ease;
}

#midi-piano-toggle:not(.midi-piano-btn):hover {
    background: rgba(76, 175, 80, 1);
}

#midi-piano-toggle:not(.midi-piano-btn).disabled {
    background: rgba(158, 158, 158, 0.8);
}

#midi-piano-toggle:not(.midi-piano-btn).disabled:hover {
    background: rgba(158, 158, 158, 1);
}

.midi-piano-section {
    margin-top: 16px;
    margin-bottom: 12px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.midi-piano-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: rgb(11, 174, 17);
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Source Code Pro', monospace;
}

.midi-piano-btn:hover {
    background: rgb(24, 185, 29);
}

.midi-piano-btn.disabled {
    background: rgba(158, 158, 158, 0.8);
}

.midi-piano-btn.disabled:hover {
    background: rgba(158, 158, 158, 1);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Device selection */
.midi-device-section {
    margin-bottom: 20px;
}

.midi-device-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: rgba(200, 200, 200, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Custom dropdown styles */
.custom-dropdown {
 
    position: relative;
    width: 100%;
    cursor: pointer;
    user-select: none;
    border-radius: 8px;
}

.dropdown-selected {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.5); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px !important;
    color: rgba(250, 250, 250, 1);
    font-family: 'Source Code Pro', monospace;
    font-size: 13px;
    transition: all 0.2s ease;
}

.dropdown-selected:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.7);
}

.dropdown-options {
    position: absolute;
    border-radius: 8px;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

.dropdown-option {
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(250, 250, 250, 1);
    font-family: 'Source Code Pro', monospace;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-option:hover {
    background: rgba(0, 128, 255, 0.779);
}

.dropdown-option:last-child {
    border-bottom: none;
}

/* Device selector row with refresh button */
.device-selector-row {
    display: flex;
    gap: 5px;
    align-items: stretch;
}

.midi-device-container {
    flex: 1;
}

.midi-refresh-btn {
    background: rgb(20, 20, 20);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 4px;
    color: rgba(250, 250, 250, 1);
    font-size: 25px;
    width: 33px;
    height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.midi-refresh-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.7);
    /* transform: scale(1.05); */
}

/* .midi-refresh-btn:active {
    transform: scale(0.95);
} */

/* Info section */
.midi-info {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 12px;
    color: rgba(200, 200, 200, 1);
    z-index: 10000;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-value {
    color: rgba(5, 213, 255, 1);
    font-weight: 600;
}

/* Panic button */
.midi-panic-btn {
    width: 100%;
    padding: 10px;
    background: rgb(255, 170, 0);
    /* border: 1px solid rgba(255, 170, 0, 0.849); */
    border: none;
    color: rgb(38, 38, 38);
    font-family: 'Source Code Pro', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.midi-panic-btn:hover {
    background: rgb(255, 200, 0);
    border: none;
    /* border-color: rgb(255, 200, 0); */
    /* color: rgb(255, 255, 255); */
}

.midi-panic-btn:active {
    background: rgb(255, 50, 3);
    color: rgb(211, 211, 211);
    transform: scale(0.99);
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .midi-panel {
        width: 90%;
        max-width: 400px;
    }

    #midi-toggle {
        bottom: 70px;
        left: 10px;
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* Scrollbar styling for device list */
.midi-select::-webkit-scrollbar {
    width: 8px;
}

.midi-select::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.midi-select::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.midi-select::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}