/* Stable Pattern controls and clear instrument identity — 1.5 */
body.compose-refined-ui .controls .pattern-group {
    display: grid;
    grid-template-columns: auto auto auto auto minmax(0,1fr);
    align-items: center;
    gap: 7px;
    height: auto;
    min-height: 36px;
    padding: 5px 8px;
    overflow: visible;
    white-space: nowrap;
}

body.compose-refined-ui .pattern-group > .title-pattern {
    margin: 0;
    color: #00e676;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1;
}

body.compose-refined-ui .pattern-action-row {
    display: grid;
    grid-template-columns: repeat(7,minmax(46px,1fr));
    gap: 4px;
    min-width: 0;
    align-items: center;
}

body.compose-refined-ui .pattern-action-row > .btn-pattern,
body.compose-refined-ui .pattern-tools,
body.compose-refined-ui .pattern-tools > summary {
    width: 100%;
    min-width: 0;
    height: 26px;
    min-height: 26px;
    padding: 0 5px;
    box-sizing: border-box;
    justify-content: center;
    font-size: 9px;
    white-space: nowrap;
}

body.compose-refined-ui .pattern-tools { padding: 0; }
body.compose-refined-ui #cancelPatternLoadBtn[hidden] {
    display: block !important;
    visibility: hidden;
    pointer-events: none;
}

body.compose-refined-ui .focus-workspace {
    grid-template-columns: 158px minmax(0,1fr) 184px;
}

body.compose-refined-ui #view-seq .panel-header-row {
    gap: 5px;
    margin-bottom: 5px;
    padding-bottom: 5px;
}

body.compose-refined-ui #view-seq .header-left { gap: 5px; }
body.compose-refined-ui #view-seq .header-left h2 {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-size: 11px;
}

.instrument-model-tag {
    padding: 3px 4px;
    border: 1px solid currentColor;
    border-radius: 3px;
    font-family: monospace;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0;
    opacity: 0.8;
}

body.compose-refined-ui #view-seq .editor-inline-controls { padding-inline: 5px; gap: 4px; }
body.compose-refined-ui #view-seq .btn-clear-all { padding-inline: 6px; }
body.compose-refined-ui #view-seq .tool-btn,
body.compose-refined-ui #view-seq .second-tool { padding-inline: 6px; }

.compose-sound-bar {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(5,minmax(0,1fr)) 58px;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-bottom: 5px;
    padding: 5px 7px;
    border: 1px solid #30303b;
    border-radius: 5px;
    background: #1b1920;
}

.second-synth-panel .compose-sound-bar { background: #201c17; }
.compose-sound-control { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.compose-sound-caption { display: flex; justify-content: space-between; gap: 5px; font-size: 9px; color: #a6a6b3; white-space: nowrap; }
.compose-sound-caption output { color: #df9ce9; font-family: monospace; font-size: 9px; }
.second-synth-panel .compose-sound-caption output { color: #ffc473; }
.compose-sound-control input[type="range"] { width: 100%; min-width: 0; height: 20px; touch-action: pan-y; }
.compose-sound-control input::-webkit-slider-thumb { background: #e040fb; }
.second-synth-panel .compose-sound-control input::-webkit-slider-thumb { background: #ffb74d; }
.compose-sound-control input::-moz-range-thumb { background: #e040fb; }
.second-synth-panel .compose-sound-control input::-moz-range-thumb { background: #ffb74d; }
.compose-sound-details > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border: 1px solid #5e3b64;
    border-radius: 4px;
    background: #2a202e;
    color: #e5b4eb;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.compose-sound-details > summary::-webkit-details-marker { display: none; }
.second-synth-panel .compose-sound-details > summary { border-color: #72532d; color: #ffce88; background: #30271b; }
.compose-sound-details[open] > summary { border-color: #fff; }
.compose-sound-expanded {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: min(560px,100%);
    padding: 12px;
    border: 1px solid #66506e;
    border-radius: 7px;
    background: #1b1921;
    box-shadow: 0 14px 35px #000b;
    box-sizing: border-box;
}
.second-synth-panel .compose-sound-expanded { background: #211d18; border-color: #79603b; }
.compose-sound-expanded strong { color: #eee; font-size: 12px; }
.compose-sound-expanded p { margin: 5px 0 10px; color: #a7a3ae; font-size: 10px; line-height: 1.4; }
.compose-advanced-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 18px; }
.compose-sound-expanded p.compose-sound-hint { margin: 10px 0 0; color: #8f8a97; }

@media (max-width:1180px) {
    body.tablet-layout.compose-refined-ui .controls .pattern-group {
        grid-template-columns: auto auto minmax(0,1fr);
        grid-template-areas: "pattern-title pattern-status pattern-status" "pattern-edit pattern-launch pattern-actions";
        gap: 5px 7px;
        padding: 6px;
    }
    body.tablet-layout.compose-refined-ui .pattern-action-row {
        grid-template-columns: repeat(7,minmax(42px,1fr));
        gap: 3px;
    }
    body.tablet-layout.compose-refined-ui .pattern-action-row > .btn-pattern,
    body.tablet-layout.compose-refined-ui .pattern-tools,
    body.tablet-layout.compose-refined-ui .pattern-tools > summary {
        height: 44px;
        min-height: 44px;
        padding-inline: 3px;
        font-size: 9px;
    }
    body.tablet-layout.compose-refined-ui .btn-pattern.slot-launch { min-width: 40px; padding-inline: 8px; }
    body.tablet-layout.compose-refined-ui .pattern-group select { width: 44px; padding-inline: 6px; }
    body.compose-refined-ui .focus-workspace { grid-template-columns: 130px minmax(0,1fr) 154px; }
    body.compose-refined-ui .compose-sound-caption { flex-direction: column; gap: 0; }
}

@media (max-width:920px) {
    body.compose-refined-ui .focus-workspace { display: flex; }
    body.compose-refined-ui .focus-editor-stage { min-height: 640px; }
}

@media (max-width:767px) {
    body.compose-refined-ui .controls .pattern-group {
        grid-template-columns: auto 1fr;
        gap: 6px;
        padding: 6px;
    }
    body.compose-refined-ui .pattern-status { min-width: 0; flex-wrap: wrap; }
    body.compose-refined-ui .pattern-launch-group { justify-content: flex-end; }
    body.compose-refined-ui .pattern-action-row { grid-column: 1 / -1; grid-template-columns: repeat(7,minmax(0,1fr)); }
    body.compose-refined-ui .pattern-action-row > .btn-pattern,
    body.compose-refined-ui .pattern-tools,
    body.compose-refined-ui .pattern-tools > summary { height: 40px; min-height: 40px; padding-inline: 1px; font-size: 8px; }
    .compose-sound-bar { gap: 5px; }
    .compose-sound-caption { flex-direction: column; }
}

/* The main header is the sole Pattern surface; Perform keeps its own scenes. */
body.compose-refined-ui.performance-view-active .controls .pattern-group { display: none; }
