:root {
    --play-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><path d="M -4 -8 L -4 8 L 9 0 z" fill="gray"/></svg>');
    --pause-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><rect x="-4" y="-8" width="4" height="16" fill="gray"/><rect x="5" y="-8" width="4" height="16" fill="gray"/></svg>');
    --prev-bar-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><rect x="-6" y="-6" width="2" height="12" fill="gray"/><path d="M 6 -6 L 6 6 L -3 0 z" fill="gray"/></svg>');
    --next-bar-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><rect x="4" y="-6" width="2" height="12" fill="gray"/><path d="M -6 -6 L -6 6 L 3 0 z" fill="gray"/></svg>');
    --volume-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"><path d="M 4 16 L 4 10 L 8 10 L 13 5 L 13 21 L 8 16 z M 15 11 L 16 10 A 7.2 7.2 0 0 1 16 16 L 15 15 A 5.8 5.8 0 0 0 15 12 z M 18 8 L 19 7 A 11.5 11.5 0 0 1 19 19 L 18 18 A 10.1 10.1 0 0 0 18 8 z" fill="gray"/></svg>');
    --unmuted-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="3 3 20 20"><path d="M 4 16 L 4 10 L 8 10 L 13 5 L 13 21 L 8 16 z M 15 11 L 16 10 A 7.2 7.2 0 0 1 16 16 L 15 15 A 5.8 5.8 0 0 0 15 12 z M 18 8 L 19 7 A 11.5 11.5 0 0 1 19 19 L 18 18 A 10.1 10.1 0 0 0 18 8 z" fill="gray"/></svg>');
    --muted-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="3 3 20 20"><path d="M 4 16 L 4 10 L 8 10 L 13 5 L 13 21 L 8 16 z" fill="gray"/></svg>');
    --menu-down-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><path d="M -4 -2 L 4 -2 L 0 3 z" fill="gray"/></svg>');
    --select-arrows-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><path d="M -4 -3 L 4 -3 L 0 -8 z M -4 3 L 4 3 L 0 8 z" fill="gray"/></svg>');
    --file-page-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-5 -21 26 26"><path d="M 2 0 L 2 -16 L 10 -16 L 14 -12 L 14 0 z M 3 -1 L 13 -1 L 13 -11 L 9 -11 L 9 -15 L 3 -15 z" fill="gray"/></svg>');
    --edit-pencil-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-5 -21 26 26"><path d="M 0 0 L 1 -4 L 4 -1 z M 2 -5 L 10 -13 L 13 -10 L 5 -2 zM 11 -14 L 13 -16 L 14 -16 L 16 -14 L 16 -13 L 14 -11 z" fill="gray"/></svg>');
    --preferences-gear-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><path d="M 5.78 -1.6 L 7.93 -0.94 L 7.93 0.94 L 5.78 1.6 L 4.85 3.53 L 5.68 5.61 L 4.21 6.78 L 2.36 5.52 L 0.27 5.99 L -0.85 7.94 L -2.68 7.52 L -2.84 5.28 L -4.52 3.95 L -6.73 4.28 L -7.55 2.59 L -5.9 1.07 L -5.9 -1.07 L -7.55 -2.59 L -6.73 -4.28 L -4.52 -3.95 L -2.84 -5.28 L -2.68 -7.52 L -0.85 -7.94 L 0.27 -5.99 L 2.36 -5.52 L 4.21 -6.78 L 5.68 -5.61 L 4.85 -3.53 M 2.92 0.67 L 2.92 -0.67 L 2.35 -1.87 L 1.3 -2.7 L 0 -3 L -1.3 -2.7 L -2.35 -1.87 L -2.92 -0.67 L -2.92 0.67 L -2.35 1.87 L -1.3 2.7 L -0 3 L 1.3 2.7 L 2.35 1.87 z" fill="gray"/></svg>');
    --customize-dial-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"> <g transform="translate(0,1)" fill="gray"> <circle cx="0" cy="0" r="6.5" stroke="gray" stroke-width="2" fill="none"/> <rect x="-1" y="-5" width="2" height="4" transform="rotate(30)"/> <circle cx="-7.79" cy="4.5" r="0.75"/> <circle cx="-9" cy="0" r="0.75"/> <circle cx="-7.79" cy="-4.5" r="0.75"/> <circle cx="-4.5" cy="-7.79" r="0.75"/> <circle cx="0" cy="-9" r="0.75"/> <circle cx="4.5" cy="-7.79" r="0.75"/> <circle cx="7.79" cy="-4.5" r="0.75"/> <circle cx="9" cy="0" r="0.75"/> <circle cx="7.79" cy="4.5" r="0.75"/> </g> </svg>');
    --export-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><path fill="gray" d="M -8 3 L -8 8 L 8 8 L 8 3 L 6 3 L 6 6 L -6 6 L -6 3 z M 0 2 L -4 -2 L -1 -2 L -1 -8 L 1 -8 L 1 -2 L 4 -2 z"/></svg>');
    --close-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><path fill="gray" d="M -8 -6 L -6 -8 L 0 -2  L 6 -8 L 8 -6 L 2 0 L 8 6 L 6 8 L 0 2 L -6 8 L -8 6 L -2 0 z"/></svg>');
    --checkmark-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="-13 -13 26 26"><path fill="gray" d="M -9 -2 L -8 -3 L -3 2 L 9 -8 L 10 -7 L -3 8 z"/></svg>');
    --drum-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="40" viewBox="0 0 32 40"> <defs> <linearGradient id="gold1" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="%237e3302"/> <stop offset="40%" stop-color="%23ffec6b"/> <stop offset="100%" stop-color="%237e3302"/> </linearGradient> <linearGradient id="gold2" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="%23faaf7d"/> <stop offset="15%" stop-color="%23fffba9"/> <stop offset="40%" stop-color="%23ffffe3"/> <stop offset="65%" stop-color="%23fffba9"/> <stop offset="100%" stop-color="%23faaf7d"/> </linearGradient> <radialGradient id="gold3" cx="0%" cy="0%" r="100%"> <stop offset="0%" stop-color="%23ffffe3"/> <stop offset="50%" stop-color="%23ffec6b"/> <stop offset="100%" stop-color="%237e3302"/> </radialGradient> <linearGradient id="red" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="%23641919"/> <stop offset="40%" stop-color="%23cd2c2c"/> <stop offset="100%" stop-color="%23641919"/> </linearGradient> <radialGradient id="membrane"> <stop offset="10%" stop-color="%23cccccc" /> <stop offset="90%" stop-color="%23f6f6f7" /> <stop offset="100%" stop-color="%23999" /> </radialGradient> </defs> <ellipse cx="16" cy="26" rx="16" ry="14" fill="rgba(0,0,0,0.5)"/> <ellipse cx="16" cy="25" rx="16" ry="14" fill="url(%23gold1)"/> <rect x="0" y="23" width="32" height="2" fill="url(%23gold1)"/> <ellipse cx="16" cy="23" rx="16" ry="14" fill="url(%23gold2)"/> <ellipse cx="16" cy="23" rx="15" ry="13" fill="url(%23red)"/> <rect x="1" y="17" width="30" height="6" fill="url(%23red)"/> <rect x="5" y="27" width="1" height="5" rx="0.5" fill="rgba(0,0,0,0.5)"/> <rect x="15" y="31" width="2" height="5" rx="1" fill="rgba(0,0,0,0.5)"/> <rect x="26" y="27" width="1" height="5" rx="0.5" fill="rgba(0,0,0,0.5)"/> <rect x="5" y="26" width="1" height="5" rx="0.5" fill="url(%23gold3)"/> <rect x="15" y="30" width="2" height="5" rx="1" fill="url(%23gold3)"/> <rect x="26" y="26" width="1" height="5" rx="0.5" fill="url(%23gold3)"/> <ellipse cx="16" cy="18" rx="15" ry="13" fill="rgba(0,0,0,0.5)"/> <ellipse cx="16" cy="16" rx="16" ry="14" fill="url(%23gold1)"/> <rect x="0" y="14" width="32" height="2" fill="url(%23gold1)"/> <ellipse cx="16" cy="14" rx="16" ry="14" fill="url(%23gold2)"/> <ellipse cx="16" cy="14" rx="15" ry="13" fill="url(%23membrane)"/> </svg>');
    --piano-key-symbol: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="15" preserveAspectRatio="none" viewBox="0 -1 32 15"> <defs> <linearGradient id="shadow" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="rgba(0,0,0,0.5)"/> <stop offset="100%" stop-color="transparent"/> </linearGradient> </defs> <rect x="-1" y="1" width="31" height="1" rx="0.6" fill="rgba(255,255,255,0.4)"/> <path d="M -1 11 L 30 11 L 30 2 L 33 -1 L 33 14 L -1 14 z" fill="rgba(0,0,0,0.7)"/> <rect x="-1" y="-1" width="19" height="15" fill="url(%23shadow)"/> </svg>');
}

.obtrusive-scrollbars,
.obtrusive-scrollbars * {
    scrollbar-width: thin;
}

.obtrusive-scrollbars::-webkit-scrollbar,
.obtrusive-scrollbars *::-webkit-scrollbar {
    width: 12px;
}

/* General Editor Styles */
.arbitstudioEditor {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    touch-action: manipulation;
    cursor: default;
    font-size: small;
    overflow: hidden;
    -webkit-touch-callout: none;
    user-select: none;
    width: 100%;
    min-height: 100%;
}

.arbitstudioEditor:focus-within {
    outline: none;
}

.arbitstudioEditor svg {
    height: 100%;
    resize: none;
}

/* Prompt  */

.promptContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* semi-transparent background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's above other content */
}

.prompt {
    background-color: var(--editor-background);
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    max-height: 80vh;
    overflow-y: auto;
}

/* Layout Areas */
.pattern-area {
    flex: 1 0 auto;
    display: flex;
    flex-direction: row;
    padding: 0.5rem 1rem 1rem 1rem;
    cursor: pointer;
    height: 60vh;
}

.settings-area {
    flex: 0 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 6px;
}

.track-area {
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    padding: 0 1rem;
}

/* Specific Area Styles */
.arbitstudioEditor .instrument-settings-area {
    padding: 0 4rem;
    width: 40vw;
}

/* Form Elements */
.arbitstudioEditor select,
.arbitstudioEditor button,
.arbitstudioEditor input[type="text"],
.arbitstudioEditor input[type="number"] {
    margin: 0;
    padding: 0 0.3em;
    height: 2em;
    border: none;
    border-radius: 0.4em;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    cursor: pointer;
}

.arbitstudioEditor select,
.arbitstudioEditor button {
    -webkit-appearance: none;
    appearance: none;
}

.arbitstudioEditor select:focus,
.arbitstudioEditor button:focus {
    outline: none;
}

.arbitstudioEditor input[type="checkbox"] {
    transform: scale(1.5);
}

/* Range Input Styles */
.arbitstudioEditor input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 2em;
    margin: 0;
    cursor: pointer;
    touch-action: pan-y;
}

.arbitstudioEditor input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.5em;
    cursor: pointer;
}

.arbitstudioEditor input[type="range"]::-webkit-slider-thumb {
    height: 2em;
    width: 0.5em;
    border-radius: 0.25em;
    background: currentColor;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -0.75em;
}

/* Button Styles */
.arbitstudioEditor button {
    position: relative;
    background-color: #444;
}

.arbitstudioEditor button.playButton,
.arbitstudioEditor button.pauseButton,
.arbitstudioEditor button.prevBarButton,
.arbitstudioEditor button.nextBarButton,
.arbitstudioEditor button.okayButton,
.arbitstudioEditor button.exportButton {
    padding-left: 2em;
}

/* Button Icons */
/* .arbitstudioEditor button::before {
    content: "";
    position: absolute;
    width: 2em;
    height: 2em;
    left: 0;
    top: 50%;
    margin-top: -1em;
    background: currentColor;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
} */

.arbitstudioEditor button.playButton::before {
    mask-image: var(--play-symbol);
    -webkit-mask-image: var(--play-symbol);
}
.arbitstudioEditor button.pauseButton::before {
    mask-image: var(--pause-symbol);
    -webkit-mask-image: var(--pause-symbol);
}
.arbitstudioEditor button.prevBarButton::before {
    mask-image: var(--prev-bar-symbol);
    -webkit-mask-image: var(--prev-bar-symbol);
}
.arbitstudioEditor button.nextBarButton::before {
    mask-image: var(--next-bar-symbol);
    -webkit-mask-image: var(--next-bar-symbol);
}
.arbitstudioEditor button.cancelButton::before {
    mask-image: var(--close-symbol);
    -webkit-mask-image: var(--close-symbol);
}
.arbitstudioEditor button.okayButton::before {
    mask-image: var(--checkmark-symbol);
    -webkit-mask-image: var(--checkmark-symbol);
}
.arbitstudioEditor button.exportButton::before {
    mask-image: var(--export-symbol);
    -webkit-mask-image: var(--export-symbol);
}

.arbitstudioEditor .mute-button::before {
    content: "";
    pointer-events: none;
    width: 100%;
    height: 100%;
    background: var(--editor-background);
    display: inline-block;
    -webkit-mask-image: var(--unmuted-symbol);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: var(--unmuted-symbol);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    background-color: white;
}

.arbitstudioEditor .mute-button.muted::before {
    background: var(--editor-background);
    -webkit-mask-image: var(--muted-symbol);
    mask-image: var(--muted-symbol);
}

/* Responsive Styles */
@media (min-width: 701px) {
    /* Container and overall layout */
    #arbitstudioEditorContainer {
        display: table;
        max-width: initial;
        overflow: hidden;
        height: 100vh;
    }

    .arbitstudioEditor {
        flex-direction: column;
    }

    /* Track and mute container */
    .arbitstudioEditor .trackAndMuteContainer {
        width: 100%;
    }

    /* Play/Pause area */
    .arbitstudioEditor .play-pause-area {
        display: flex;
        flex-direction: column;
    }

    .arbitstudioEditor .playback-bar-controls {
        display: flex;
        flex-direction: row;
        margin: 2px 0;
    }

    .arbitstudioEditor .playback-volume-controls {
        display: flex;
        flex-direction: row;
        margin: 2px 0;
        align-items: center;
    }

    .arbitstudioEditor .pauseButton,
    .arbitstudioEditor .playButton,
    .arbitstudioEditor .nextBarButton,
    .arbitstudioEditor .prevBarButton {
        flex-grow: 1;
    }

    .arbitstudioEditor .nextBarButton,
    .arbitstudioEditor .prevBarButton {
        margin-left: 10px;
    }

    /* Track area */
    .arbitstudioEditor .track-area {
        overflow-y: auto;
    }

    .play-pause-menu-area {
        width: 30vw;
    }

    /* Settings area */
    .arbitstudioEditor .settings-area {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto auto auto minmax(0, 1fr);
        grid-template-areas:
            "instrument-settings-area play-pause-area"
            "instrument-settings-area menu-area"
            "instrument-settings-area song-settings-area";
    }

    .arbitstudioEditor .instrument-settings-area {
        overflow-y: auto;
        position: relative;
    }

    .arbitstudioEditor .instrument-settings-area > .editor-controls {
        position: absolute;
        width: 100%;
    }

    .arbitstudioEditor .song-settings-area {
        overflow-y: auto;
    }

    /* Scroll bars */
    .arbitstudioEditor .barScrollBar {
        display: none;
    }

    .arbitstudioEditor .trackContainer {
        overflow-x: auto;
        scrollbar-width: auto;
    }

    .arbitstudioEditor .trackContainer::-webkit-scrollbar {
        width: 20px;
        height: 20px;
    }
    .settings-area * {
        width: 30vw;
    }
}

@media (max-width: 700px) {
    /* Overall layout */
    .arbitstudioEditor {
        display: flex;
        flex-direction: column;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: min-content 6px min-content min-content;
        grid-template-areas:
            "pattern-area"
            "."
            "track-area"
            "settings-area";
        grid-row-gap: 0;
        overflow-x: hidden;
    }

    /* Pattern area */
    .arbitstudioEditor .pattern-area {
        height: 75vh;
        width: 100%;
        padding: 0;
    }

    /* Track area */
    .arbitstudioEditor .track-area {
        flex-direction: column;
        padding: 0 0.5rem;
        margin: 1rem 0 0.5rem 0;
        gap: 1rem;
    }

    .arbitstudioEditor .trackContainer {
        overflow-x: auto;
    }

    /* Settings area */
    .arbitstudioEditor .settings-area {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: min-content min-content 1fr min-content;
        grid-template-areas:
            "play-pause-area play-pause-area"
            "menu-area instrument-settings-area"
            "song-settings-area instrument-settings-area"
            "version-area version-area";
        grid-column-gap: 8px;
        padding: 0 1rem;
        overflow-x: scroll;
    }

    .arbitstudioEditor .song-settings-area {
        display: flex;
        flex-direction: column;
    }

    .arbitstudioEditor .instrument-settings-area {
        display: flex;
        flex-direction: row;
    }

    /* Play/Pause area */
    .arbitstudioEditor .play-pause-area {
        display: flex;
        flex-direction: row;
        margin: 2px 0;
    }

    .arbitstudioEditor .playback-bar-controls {
        display: flex;
        flex-direction: row;
        flex-grow: 1;
    }

    .arbitstudioEditor .playback-volume-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-grow: 1;
        margin: 0 2px;
    }

    .arbitstudioEditor .pauseButton,
    .arbitstudioEditor .playButton,
    .arbitstudioEditor .nextBarButton,
    .arbitstudioEditor .prevBarButton {
        flex-grow: 1;
        margin: 0 2px;
    }

    /* Other areas */
    .arbitstudioEditor .play-pause-area,
    .arbitstudioEditor .menu-area,
    .arbitstudioEditor .instrument-settings-area {
        display: flex;
    }

    .play-pause-menu-area {
        margin-bottom: 1rem;
    }

    /* Scroll bars */
    .arbitstudioEditor .barScrollBar {
        display: none;
    }
}
