/**
 * Track Mixer Component Styles (ported from track-mixer-styles.css)
 * Professional track mixing interface with per-track controls
 */

/* Track Mixer Styles (ported from previous injected CSS) */
.track-mixer,
.track-mixer * {
    margin: 0 !important;
}

/* Keep explicit button/select/.track-controls padding live; other mixer layout boxes remain reset. */
.track-mixer,
.track-mixer *:not(.track-controls):not(.track-tape):not(.drum-lcd):not(button):not(select) {
    padding: 0 !important;
}

.track-mixer *:not(button):not(select):not(.drum-lcd) {
    border: 0 !important;
}

.track-mixer {
    --lane-gap: 6px;
    --lane-start-offset: 0px;
    --mixer-row-height: var(--tracklane-row-height, 64px);
    --sketch-add-track-footer-height: 44px;
    position: fixed;
    top: var(--transport-topbar-height, 60px);
    left: 0;
    width: 424px;
    /* Never wider than the viewport: below 424px the rail would overflow and
     * the lane reservation would subtract more width than the lanes have. */
    max-width: 100vw;
    height: auto;
    max-height: calc(100vh - var(--transport-topbar-height, 60px) - var(--keyboard-height, 150px) - var(--statusbar-height, 28px) - 8px);
    background: linear-gradient(180deg, #101216 0%, #0d0f12 100%);
    font-family: var(--font-system, system-ui, -apple-system, 'Segoe UI', sans-serif);
    font-size: 13px;
    color: var(--text-1, #fff);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    will-change: transform;
    overflow: hidden;
    contain: layout paint style;
    /* Arrangement band. The rail is the lane band's left gutter, so it sits
     * directly above the lanes (7) and below every inspector occupant — the
     * MIDI editor (9) and the instrument panel (11). At 1100 it painted over
     * both, which covered the MIDI editor's Close button at narrow widths and
     * clipped the instrument rack's leftmost module (invariant I7). Its height
     * is bound to the lane band in syncMixerPanelHeightToLanes(). */
    z-index: 8;
    transform: translateX(-100%);
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
}

.track-mixer.track-mixer--sketch {
    width: 424px;
    max-width: 100vw;
}

.track-mixer.visible {
    transform: translateX(0);
}

/* Arrangement suppression — an open instrument editor owns the workspace
 * (song surface at the top, user/sampler surfaces at the bottom). Rather than
 * let it overlap the lane band, the arrangement steps aside while it is open.
 * `mixerOpen` is untouched, so closing it restores the lanes as they were and
 * the Mixer toolbar button is the visible way back. Hidden means inert:
 * display none plus pointer-events none, so nothing here can intercept a click. */
body.cb-arrangement-suppressed .track-mixer,
body.cb-arrangement-suppressed .mixer-visual-panel,
body.cb-arrangement-suppressed .tracklane-overlay,
body.cb-arrangement-suppressed .tracklanes-top-gap-cover,
body.cb-arrangement-suppressed .tracklanes-playhead-layer,
body.cb-arrangement-suppressed .sketch-add-track-row {
    display: none !important;
    pointer-events: none !important;
}

/*
 * ChordBuddy CRT beside the transport progress surface. Warm red/magenta
 * phosphor identity, kept from the original panel. It runs two mode families:
 * measured analysers while music sounds, and the retro identity screens when
 * it does not (see MixerVisualPanelTheme.js).
 *
 * `contain` plus `overflow: hidden` clip descendant paint to this box, so all
 * glow is drawn inside the canvas (ctx.shadowBlur), never as an outer shadow.
 * Scanlines are drawn in-canvas too, rather than as a stacked pseudo-element,
 * so nothing is layered on top of the measurements.
 *
 * Geometry is inline-written by MixerVisualPanel.setGeometry; the values here
 * are only the pre-script fallback.
 */
.mixer-visual-panel {
    position: fixed;
    top: var(--transport-topbar-height, 60px);
    left: 0;
    width: 424px;
    height: var(--transport-progress-height, 45px);
    min-height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(25, 28, 32, 0.96), rgba(9, 10, 12, 0.98)),
        #050606;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.48),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    color: #ff4938;
    font: 500 11px/1 var(--font-mono, monospace);
    overflow: hidden;
    /* NOT part of the workspace stack: this widget lives in the ruler band
     * (top = topbar height, height = progress height) and must paint over the
     * transport/progress chrome at z-index 1000. It is vertically disjoint
     * from the inspector stack (8/9/11), which begins below the ruler. */
    z-index: 1101;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    cursor: pointer;
    contain: layout paint style;
}

.mixer-visual-panel.visible {
    transform: translateX(0);
}

.mixer-visual-panel:hover {
    border-color: rgba(255, 90, 74, 0.22);
}

.mixer-visual-panel:focus-visible {
    outline: none;
    border-color: rgba(255, 122, 92, 0.55);
}

.mixer-visual-panel:focus-visible .mixer-visual-panel__canvas {
    box-shadow: inset 0 0 0 2px rgba(255, 90, 74, 0.75);
}

/*
 * Screen bezel with the panel's warm inner glow. The canvas is opaque and
 * paints above it, so this shows as the 1px ring plus the surround.
 */
.mixer-visual-panel::before {
    content: '';
    position: absolute;
    inset: 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at 50% 90%, rgba(255, 73, 56, 0.14), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 18%);
    border-radius: 6px;
    pointer-events: none;
}

.mixer-visual-panel__canvas {
    position: absolute;
    inset: 8px;
    display: block;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 6px;
    background: #050303;
}

@media (prefers-reduced-motion: reduce) {
    .mixer-visual-panel {
        transition: none;
    }
}

.mixer-backing-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--lane-gap);
}

.mixer-backing-scroll::before {
    content: '';
    display: none;
    height: var(--lane-start-offset);
    flex: 0 0 var(--lane-start-offset);
}

.mixer-backing-scroll::-webkit-scrollbar {
    width: 8px;
}

.mixer-backing-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
}

.tracklane-overlay,
.tracklanes-top-gap-cover {
    background: var(--glass-surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.tracklane-glass-backdrop,
.tracklanes-gap {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ── Console channel strip ─────────────────────────────────────────────
   [scribble tape: number / name / role] [control column: worded caps,
   plus the pattern-window line on drum lanes]. Machined face: dark seam
   below, hairline highlight above, engraved type on the caps. */
.mixer-track {
    flex: 0 0 auto;
    overflow: hidden;
    height: var(--mixer-row-height);
    display: flex;
    align-items: stretch;
    background: linear-gradient(180deg, #1b1e24 0%, #121419 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        inset 0 -1px 0 rgba(0, 0, 0, 0.55);
    transition: background 0.2s ease;
}

.mixer-track:hover {
    background: linear-gradient(180deg, #1e2127 0%, #14161b 100%);
}

/* Scribble-strip tape: the lane's exact palette color carries identity.
   Content budget at the 64px melodic row (tape inner = 64 − 10 margin −
   6 padding = 48px): number 7.5 + gap 2 + two name lines 23.6 + gap 2 +
   role 6.5 = 41.6px — two-line names and the role line always fit. */
.track-tape {
    flex: none;
    width: 120px;
    margin: 5px 0 5px 5px !important;
    border-radius: 4px;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 45%),
        color-mix(in srgb, var(--lane-color, #8fa4b8) 64%, #191c21);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -6px 12px rgba(0, 0, 0, 0.22),
        0 1px 2px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 3px 9px;
    min-width: 0;
    transition: filter 0.2s ease, box-shadow 0.25s ease;
}

.track-tape-number {
    font: 800 7.5px/1 var(--font-mono, monospace);
    letter-spacing: 0.1em;
    color: color-mix(in srgb, var(--lane-ink, rgba(12, 13, 16, 0.92)) 62%, transparent);
}

.track-name {
    color: var(--lane-ink, #0e0f12);
    font-weight: 700;
    font-size: 10.5px;
    line-height: 1.12;
    letter-spacing: 0.005em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: anywhere;
}

.track-title {
    font: 700 6.5px/1 var(--font-mono, monospace);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--lane-ink, rgba(12, 13, 16, 0.92)) 66%, transparent);
    white-space: nowrap;
    overflow: hidden;
}

/* Live activity belongs to the tape, not a button: sounding rows glow. */
.mixer-track.track-sounding:not(.track-off) .track-tape {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -6px 12px rgba(0, 0, 0, 0.18),
        0 0 12px color-mix(in srgb, var(--lane-color, #8fa4b8) 55%, transparent);
}

.mixer-track.track-off .track-tape {
    filter: saturate(0.35) brightness(0.72);
}

.mixer-track.implicitly-muted .track-tape {
    filter: saturate(0.22) brightness(0.58);
}

/* Hidden (backing) lanes read quieter on the tape without touching controls. */
.mixer-track.track-backing .track-tape {
    filter: saturate(0.55) brightness(0.82);
}

.mixer-track.track-off.track-backing .track-tape,
.mixer-track.implicitly-muted.track-backing .track-tape {
    filter: saturate(0.25) brightness(0.6);
}

.control-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
    min-width: 0;
}

.mixer-track.backing-track .control-row {
    justify-content: flex-start;
}

.track-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding: 6px 10px 6px 9px;
    box-sizing: border-box;
}

/* DRUMS section tag: overlays the first drum strip's top edge with zero
   layout height, so rail rows stay y-aligned with their tracklanes. */
.mixer-track.drum-track--first {
    position: relative;
}

.mixer-track.drum-track--first::after {
    content: 'DRUMS';
    position: absolute;
    top: 1px;
    left: 134px;
    font: 700 6.5px/1 var(--font-mono, monospace);
    letter-spacing: 0.26em;
    color: rgba(126, 215, 196, 0.62);
    pointer-events: none;
}

.control-row select {
    min-width: 110px;
}

.control-row .selector-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.58);
    white-space: nowrap;
}

.control-row select:focus {
    box-shadow: 0 0 0 2px rgba(106, 169, 255, 0.2);
}

.control-row .ui-slider {
    flex: 0 0 90px;
    width: 90px;
}

.volume-value {
    min-width: 36px;
    text-align: right;
    color: #cfcfcf;
    font-size: 11px;
    opacity: 0.9;
}

/* ── Engraved hardware caps ────────────────────────────────────────────
   Shared cap primitive for MUTE / SOLO / SHOW-HIDE (and the drum Loop /
   Seq caps below), in three tiers rather than a binary:
     DARK    — the control is not engaged (mute off, solo off, loop off).
     FULL    — engaged: the cap floods with its state colour and the
               lettering flips dark, so a glance across the rail reads every
               engaged control at once. Full-fill rather than a status LED.
     DIM TINT— the same hue at a soft wash, for a control whose "other" state
               is still meaningful rather than off. Only Show/Hide uses it,
               because a hidden track is still heard and still drawn faintly;
               see the contract at that rule for why it is not a dark cap.
   JS keeps writing plain textContent — states ride on data-* attributes
   exactly as before. */
.power-btn,
.solo-btn,
.role-btn {
    background: linear-gradient(180deg, #2c2f36 0%, #1e2126 55%, #191c21 100%);
    border: 1px solid #060708;
    color: #9aa3b0;
    font: 700 8.5px/1 var(--font-mono, monospace);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.7);
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    min-width: 60px;
    height: 26px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 2px 3px rgba(0, 0, 0, 0.5);
}

.power-btn:hover,
.solo-btn:hover,
.role-btn:hover {
    background: linear-gradient(180deg, #33363e 0%, #23262c 55%, #1d2026 100%);
    color: #cfd6df;
}

.power-btn:active,
.solo-btn:active,
.role-btn:active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
    transform: translateY(0.5px);
}

/* ON states — the cap becomes the colour. Engraved text inverts to the
   dark face colour so the word stays legible at full saturation. */
.power-btn[data-muted="true"] {
    background: linear-gradient(180deg, #ffc65a 0%, var(--status-warn, #f5b33c) 100%);
    border-color: #7a5410;
    color: #241802;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 0 10px rgba(245, 179, 60, 0.35),
        0 2px 3px rgba(0, 0, 0, 0.5);
}

.power-btn[data-muted="true"]:hover {
    background: linear-gradient(180deg, #ffd075 0%, #ffbe45 100%);
    color: #241802;
}

.solo-btn[data-active="true"] {
    background: linear-gradient(180deg, #56a6ff 0%, var(--accent, #3891ff) 100%);
    border-color: #10396e;
    color: #06182e;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 10px rgba(56, 145, 255, 0.4),
        0 2px 3px rgba(0, 0, 0, 0.5);
}

.solo-btn[data-active="true"]:hover {
    background: linear-gradient(180deg, #6fb4ff 0%, #4c9dff 100%);
    color: #06182e;
}

/* Sketch-mode record-arm cap: guarded square, ring dot. Hollow when off,
 * solid red when armed, pulsing while actively recording. */
.arm-btn {
    background: linear-gradient(180deg, #2c2f36 0%, #191c21 100%);
    border: 1px solid #060708;
    border-radius: 5px;
    cursor: pointer;
    width: 34px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 2px 3px rgba(0, 0, 0, 0.5);
}
.arm-btn:hover {
    background: linear-gradient(180deg, #33363e 0%, #1d2026 100%);
}
.arm-btn .arm-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #596273;
    transition: all 0.15s ease;
}
.arm-btn:hover .arm-dot {
    border-color: rgba(255, 70, 92, 0.75);
}
/* Armed floods red like the other engaged caps; the dot inverts to the
   dark face so the record eye still reads on the filled cap. */
.arm-btn[data-armed="true"] {
    background: linear-gradient(180deg, #ff6d80 0%, #ff465c 100%);
    border-color: #7d1524;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 10px rgba(255, 70, 92, 0.45),
        0 2px 3px rgba(0, 0, 0, 0.5);
}
.arm-btn[data-armed="true"] .arm-dot {
    background: #2a060d;
    border-color: rgba(42, 6, 13, 0.85);
    box-shadow: none;
}
.arm-btn[data-armed="true"]:hover {
    background: linear-gradient(180deg, #ff8496 0%, #ff5c70 100%);
}
/* Recording pulses the filled cap itself — the dot is dark ink on red now,
   so a glow on the dot would not read. */
body.sketch-recording .arm-btn[data-armed="true"] {
    animation: arm-pulse 0.9s ease-in-out infinite;
}
@keyframes arm-pulse {
    0%, 100% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.4),
            0 0 8px rgba(255, 70, 92, 0.45),
            0 2px 3px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.4),
            0 0 18px rgba(255, 70, 92, 1),
            0 2px 3px rgba(0, 0, 0, 0.5);
    }
}
@media (prefers-reduced-motion: reduce) {
    body.sketch-recording .arm-btn[data-armed="true"] {
        animation: none;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.4),
            0 0 18px rgba(255, 70, 92, 1),
            0 2px 3px rgba(0, 0, 0, 0.5);
    }
}

/* Persistent Sketch-only lane footer, spanning the mixer and timeline. */
.sketch-add-track-row {
    --sketch-add-track-footer-height: 44px;
    display: none;
    justify-content: center;
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    width: 100vw;
    height: var(--sketch-add-track-footer-height);
    box-sizing: border-box;
    padding: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.10) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    background: rgba(12, 14, 17, 0.72);
    /* Part of the arrangement unit, so it shares the rail's layer (8): above
     * the lanes it footers, below the MIDI editor (9) and instrument panels
     * (11). At 1102 it painted over both inspectors whenever they met. */
    z-index: 8;
}
.track-mixer.track-mixer--sketch.visible + .sketch-add-track-row {
    display: flex;
}
.sketch-add-track-button,
.sketch-add-drums-button,
.sketch-place-groove-button {
    background: rgba(255, 255, 255, 0.035);
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    padding: 0 16px;
    border-radius: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
    font-size: 12px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sketch-add-track-button {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}
.sketch-add-track-button:hover,
.sketch-add-drums-button:hover,
.sketch-place-groove-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}
.sketch-add-track-button:focus-visible,
.sketch-add-drums-button:focus-visible,
.sketch-place-groove-button:focus-visible {
    outline: 2px solid rgba(116, 199, 255, 0.95);
    outline-offset: 2px;
}

.sketch-add-track-button,
.sketch-add-drums-button {
    flex: 1 1 0;
}

.sketch-add-drums-button {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sketch-place-groove-button {
    flex: 1.2 1 0;
    color: rgba(218, 243, 239, 0.9);
    background: rgba(126, 215, 196, 0.06);
}

/* ── Drum groove line ──────────────────────────────────────────────────
   Second control line on sketch drum strips: ‹ [LCD pattern window] ›
   plus worded Loop / Seq caps. The LCD shares the topbar position
   display's family (dark glass, warm amber readout). */
.drum-clip-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.drum-clip-control {
    height: 26px;
    min-width: 0;
    padding: 0 7px;
    border: 1px solid #060708;
    border-radius: 5px;
    color: #9aa3b0;
    background: linear-gradient(180deg, #2c2f36 0%, #1e2126 55%, #191c21 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 2px 3px rgba(0, 0, 0, 0.5);
    font: 700 8.5px/1 var(--font-mono, monospace);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.7);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.15s ease, color 0.15s ease;
}

.drum-clip-control:hover,
.drum-clip-control:focus-visible {
    background: linear-gradient(180deg, #33363e 0%, #23262c 55%, #1d2026 100%);
    color: #cfd6df;
    outline: none;
}

/* Pattern steppers hug the LCD window. */
.drum-clip-control--previous,
.drum-clip-control--next {
    flex: none;
    width: 22px;
    padding: 0;
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
}

.drum-lcd {
    flex: 1 1 auto;
    min-width: 0;
    height: 26px;
    padding: 0 7px !important;
    border: 1px solid #060708 !important;
    border-radius: 5px;
    background: #0c0e11;
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.75),
        0 1px 0 rgba(255, 255, 255, 0.06);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
}

.drum-lcd__name {
    flex: 1 1 auto;
    min-width: 0;
    font: 700 9px/1 var(--font-mono, monospace);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffb648;
    text-shadow: 0 0 5px rgba(255, 182, 72, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drum-lcd__index {
    flex: none;
    font: 600 8px/1 var(--font-mono, monospace);
    color: rgba(255, 182, 72, 0.5);
}

.drum-lcd[data-empty] .drum-lcd__name {
    color: rgba(255, 182, 72, 0.45);
    text-shadow: none;
}

/* Loop / Seq caps fill with the drum-family mint when engaged, matching
   the melodic caps' full-fill logic. */
/* Kept narrow so the pattern window keeps the width it needs to spell a
   pattern name — the fill colour, not size, carries these two. */
.drum-clip-control--loop,
.drum-clip-control--sequence {
    flex: none;
    min-width: 0;
    padding: 0 8px;
}

.drum-clip-control--loop[data-active="true"],
.drum-clip-control--sequence[data-active="true"] {
    background: linear-gradient(180deg, #9fecdb 0%, #7ed7c4 100%);
    border-color: #14544a;
    color: #06231c;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 0 10px rgba(126, 215, 196, 0.35),
        0 2px 3px rgba(0, 0, 0, 0.5);
}

.drum-clip-control--loop[data-active="true"]:hover,
.drum-clip-control--sequence[data-active="true"]:hover {
    background: linear-gradient(180deg, #b4f3e6 0%, #91e2d0 100%);
    color: #06231c;
}

.track-clip[data-repeat-cycle-ticks]::after {
    content: "LOOP";
    position: absolute;
    right: 9px;
    bottom: 3px;
    padding: 1px 4px;
    border: 1px solid rgba(14, 34, 36, 0.48);
    border-radius: 2px;
    color: rgba(12, 26, 27, 0.86);
    background: rgba(230, 255, 252, 0.42);
    font-size: 7px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.07em;
    pointer-events: none;
}

.track-clip-cycle-separators {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.track-clip-repeat-source,
.track-clip-repeat-ghosts {
    position: absolute;
    inset-block: 0;
    left: 0;
    pointer-events: none;
}

.track-clip-repeat-source {
    z-index: 1;
    border-right: 1px solid rgba(232, 255, 252, 0.58);
    background: rgba(126, 215, 196, 0.045);
}

.track-clip.selected .track-clip-repeat-source {
    box-shadow: inset 0 0 0 2px rgba(230, 255, 255, 0.92);
}

.track-clip-repeat-ghosts {
    right: 0;
    z-index: 1;
}

.track-clip-repeat-ghost {
    position: absolute;
    inset-block: 0;
    box-sizing: border-box;
    border-left: 1px dashed rgba(150, 175, 176, 0.42);
    background:
      linear-gradient(rgba(12, 17, 18, 0.48), rgba(12, 17, 18, 0.48)),
      repeating-linear-gradient(
        -45deg,
        transparent 0 8px,
        rgba(204, 222, 222, 0.045) 8px 9px
      );
}

.track-clip-cycle-separator {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 0;
    border-left: 1px dashed rgba(12, 29, 31, 0.38);
}

.track-clip-meter-change-badge {
    position: absolute;
    z-index: 2;
    top: 3px;
    right: 8px;
    padding: 1px 4px;
    border: 1px solid rgba(67, 42, 13, 0.42);
    border-radius: 2px;
    color: rgba(48, 29, 8, 0.88);
    background: rgba(255, 213, 148, 0.76);
    font-size: 7px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.03em;
    pointer-events: none;
}
.sketch-add-track-button__plus {
    font-size: 16px;
    line-height: 1;
    font-weight: 600;
}

/* Disabled mute for practice-role */
.power-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Show/Hide cap — the one DIM-TINT cap in the rail, and the reason that tier
   exists (see the primitive's contract above).
 *
 * The real contract, from resolveLaneState() in TracklanesOverlayLanes.js and
 * the tooltips this same file's JS writes:
 *   show — full-colour notes, and the track becomes the practice / wait-mode
 *          target (TrackRegistryMutations sets practiceTrackId), so this is
 *          not a purely visual switch.
 *   hide — faint REFERENCE notes, still audible unless muted.
 *
 * Neither state is "off": a hidden track is still heard and still drawn, only
 * quieter on both channels. So both states carry the green, and brightness
 * carries the difference — full colour for the practised track, a soft wash
 * for the one riding along. Silence belongs to Mute's amber, a separate axis;
 * a dark cap here would read as "off" and misdescribe a track you can hear.
 * Track names carry these two literal words, so the label is the state and
 * the colour is the reinforcement.
 */
.backing-visibility-toggle[data-visibility="show"],
.backing-role-toggle[data-role="practice"] {
    background: linear-gradient(180deg, #6ceb9b 0%, var(--status-ok, #4ade80) 100%);
    border-color: #12592f;
    color: #0a2413;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 0 10px rgba(74, 222, 128, 0.32),
        0 2px 3px rgba(0, 0, 0, 0.5);
}

.backing-visibility-toggle[data-visibility="show"]:hover,
.backing-role-toggle[data-role="practice"]:hover {
    background: linear-gradient(180deg, #85f2ae 0%, #5ce68d 100%);
    color: #0a2413;
}

/* The [data-role] halves below are not dead: MixerControlsStateMethods and
   MixerControlsPaintMethods write data-visibility and the legacy data-role in
   lockstep, and session configs persisted before the rename still hydrate
   role-only. They retire when that legacy read path does. */
.backing-visibility-toggle[data-visibility="hide"],
.backing-role-toggle[data-role="backing"] {
    background: linear-gradient(180deg, var(--status-ok-bg-soft, rgba(74, 222, 128, 0.2)) 0%, rgba(74, 222, 128, 0.12) 100%);
    border-color: rgba(74, 222, 128, 0.42);
    color: #cfeeda;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 3px rgba(0, 0, 0, 0.5);
}

.backing-visibility-toggle[data-visibility="hide"]:hover,
.backing-role-toggle[data-role="backing"]:hover {
    background: linear-gradient(180deg, rgba(74, 222, 128, 0.3) 0%, rgba(74, 222, 128, 0.2) 100%);
    border-color: rgba(74, 222, 128, 0.6);
    color: #e6f7ed;
}

/* KNOWN UNSTYLED STATE: visibility that Solo derived (data-practice-origin=
   "solo", set by _updatePracticeOrigins) is indistinguishable from a choice
   the user made by hand — it only differs in the tooltip. Brightness is spent
   across the three tiers, so distinguishing it needs a different channel
   (border dash or a second hue) and is a design call, not a CSS tidy-up. */

/* Pressed feedback, re-applied after every engaged fill. The shared
   :active rule above is (0,2,0) and loses to the later state rules at equal
   specificity, which silently flattened the press on every lit cap — amber
   mute, blue solo, both greens, and the mint drum caps. Attribute selectors
   here take these to (0,3,0) so the press always wins. */
.power-btn[data-muted]:active,
.solo-btn[data-active]:active,
.role-btn[data-visibility]:active,
.role-btn[data-role]:active,
.drum-clip-control[data-active]:active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
    transform: translateY(0.5px);
}

/* Keyboard focus is an outline, never a box-shadow: every engaged state sets
   its own box-shadow later in the cascade and would erase a shadow-based
   ring. Outline cannot be overridden by those fills. */
.power-btn:focus-visible,
.solo-btn:focus-visible,
.role-btn:focus-visible,
.arm-btn:focus-visible,
.drum-clip-control:focus-visible {
    outline: 2px solid var(--accent, #3891ff);
    outline-offset: 2px;
}

/* Muted / implicitly-muted rows dim their IDENTITY (tape filters above),
   never their controls — a dimmed cap reads as disabled, and every cap
   stays live. The struck name is the extra implicit-mute signal. */
.mixer-track.implicitly-muted .track-name {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    text-decoration-color: color-mix(in srgb, var(--lane-ink, rgba(12, 13, 16, 0.92)) 65%, transparent);
}

.tracklane-row .tracklane-tint {
    transition: opacity 0.2s ease, background 0.2s ease;
}

.tracklane-row .tracklane-dim {
    transition: opacity 0.2s ease, background 0.2s ease;
}

.tracklane-overlay .tracklane-row .tracklane-name {
    opacity: 0.85;
}

/* DAW-row pairing: lane and matching mixer-track read as one continuous row.
   Hover state is mirrored across both halves from JS by walking
   [data-track-id] pairs on pointerover/out. */
.mixer-track.row-hover,
.tracklane-row.row-hover {
    outline: 1px solid rgba(255, 255, 255, 0.18);
    outline-offset: -1px;
}

/* Phase 4: DOM clip overlay layer.
   Sits above the WebGL note canvas (z-index 2) but below tint/dim overlays
   (z-index 3+). The WebGL renderer owns the clip body underneath notes; these
   DOM nodes are the interaction shell, label, and resize handles. */
.tracklane-row .tracklane-clips-layer {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    z-index: 2;
}

.tracklane-overlay .tracklane-row.has-track-clips .tracklane-name {
    /* Hide immediately so the clip-owned label never overlaps the lane name. */
    opacity: 0;
}

.track-clip {
    position: absolute;
    top: 6%;
    bottom: 6%;
    background: transparent;
    border: 1px solid rgba(235, 241, 245, 0.42);
    border-radius: 3px;
    cursor: grab;
    box-sizing: border-box;
    overflow: hidden;
    transition: border-color 0.12s ease, outline-color 0.12s ease, opacity 0.12s ease;
}

.track-clip:hover {
    border-color: rgba(246, 250, 252, 0.82);
}

.track-clip.dragging {
    cursor: grabbing;
    background: rgba(104, 185, 188, 0.18);
    border-color: rgba(156, 231, 232, 0.9);
    border-style: dashed;
    opacity: 0.72;
}

.track-clip.selected {
    border: 2px solid #e6ffff;
    outline: 1px solid rgba(45, 104, 108, 0.9);
    outline-offset: 1px;
}

.track-clip.selected:hover {
    border-color: #ffffff;
}

.tracklane-row.lane-muted .track-clip {
    border-color: #747b85;
}

.tracklane-row.lane-muted .track-clip .track-clip-label,
.tracklane-row.lane-hidden .track-clip .track-clip-label {
    color: #f0f2f4;
}

.tracklane-row.lane-hidden .track-clip {
    border-color: #646a73;
    background: repeating-linear-gradient(
        -45deg,
        transparent 0 8px,
        rgba(255, 255, 255, 0.035) 8px 9px
    );
}

.tracklane-row.lane-hidden.lane-muted .track-clip {
    border-color: #555b64;
    border-style: dashed;
}

.tracklane-row.lane-muted .track-clip .track-clip-label::before,
.tracklane-row.lane-hidden .track-clip .track-clip-label::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 13px;
    margin-right: 5px;
    padding: 0 3px;
    border: 1px solid currentColor;
    color: inherit;
    font-size: 8px;
    line-height: 1;
    letter-spacing: 0.04em;
}

.tracklane-row.lane-muted .track-clip .track-clip-label::before {
    content: "M";
}

.tracklane-row.lane-hidden .track-clip .track-clip-label::before {
    content: "H";
}

.tracklane-row.lane-hidden.lane-muted .track-clip .track-clip-label::before {
    content: "H·M";
}

.track-clip-selection-marquee {
  position: absolute;
  inset-block: 4px;
  border: 1px solid rgba(94, 213, 255, 0.9);
  border-radius: 4px;
  background: rgba(94, 213, 255, 0.13);
  pointer-events: none;
  z-index: 4;
}

.track-clip .track-clip-label {
    position: absolute;
    top: 2px;
    left: 5px;
    right: 7px;
    height: 14px;
    font-size: 10px;
    line-height: 14px;
    color: rgba(245, 249, 255, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    text-shadow: none;
}

.track-clip.track-clip--dark-label .track-clip-label {
    color: #101315;
}

.track-clip .track-clip-resize {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7px;
    cursor: ew-resize;
    background: transparent;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.track-clip:hover .track-clip-resize,
.track-clip.selected .track-clip-resize {
    opacity: 1;
}

.track-clip .track-clip-resize.left {
    left: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.56);
}

.track-clip .track-clip-resize.right {
    right: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.56);
}

.tracklane-row--compact .track-clip {
    top: 2px;
    bottom: 2px;
}

.tracklane-row--compact .track-clip .track-clip-label {
    top: 50%;
    height: 12px;
    font-size: 9px;
    line-height: 12px;
    transform: translateY(-50%);
}

.tracklane-row--compact .track-clip .track-clip-resize {
    display: none;
}

.tracklane-row--compact .track-clip[data-repeat-cycle-ticks]::after {
    display: none;
}

.tracklane-row--compact .track-clip-cycle-separator {
    top: 1px;
    bottom: 1px;
    border-left-color: rgba(12, 29, 31, 0.28);
}

/* ── Lane Edit button (sketch backing rows only) ──────────────────────── */
.edit-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    cursor: pointer;
    height: 22px;
    padding: 0 8px;
    font-size: 10px;
    color: rgba(203, 213, 225, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.edit-btn:hover {
    background: rgba(74, 163, 255, 0.12);
    border-color: rgba(74, 163, 255, 0.35);
    color: #fff;
}

/* Compact instrument/preset dropdowns on sketch backing lanes share the
   same height as arm/edit so the control row stays flush. */
.mixer-track.backing-track .backing-instrument-select,
.mixer-track.backing-track .backing-preset-select {
    height: 22px;
    font-size: 10px;
    padding: 0 4px;
    max-width: 110px;
}

/* ────────────────────────────────────────────────────────────
   CAPTURE LANDING ZONE
   Lives next to .track-clip on purpose: the dashed slot is a
   preview of the clip that is about to exist, so the two must
   share one visual language.

   D4 — an accepting lane tints in ITS OWN colour, supplied as
   --carry-tint by the carry gesture. The border carries the
   meaning at full palette value (contrast is stable across all
   32 palette entries); the fill is decoration at low alpha.
   No --carry-tint means the destination has no track yet, which
   falls back to the neutral pending white rather than guessing
   the next palette slot.
   ──────────────────────────────────────────────────────────── */
.tracklane-row--carry-target {
    --carry-tint: 255, 255, 255;
    box-shadow: inset 0 0 0 1px rgba(var(--carry-tint), 0.55);
    background-image: linear-gradient(rgba(var(--carry-tint), 0.08), rgba(var(--carry-tint), 0.08));
}

.tracklane-row--carry-blocked {
    box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.62);
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(192, 57, 43, 0.18) 0 6px,
        transparent 6px 12px
    );
}

.tracklane-carry-slot {
    position: absolute;
    top: 5%;
    bottom: 5%;
    z-index: 5;
    border: 2px dashed rgba(var(--carry-tint, 255, 255, 255), 0.95);
    border-radius: 3px;
    background: rgba(var(--carry-tint, 255, 255, 255), 0.16);
    pointer-events: none;
    box-sizing: border-box;
}

.tracklane-carry-slot[hidden] {
    display: none;
}

.tracklane-carry-slot__label {
    position: absolute;
    top: 3px;
    left: 0;
    padding: 3px 6px;
    border-radius: 0 3px 3px 0;
    background: rgba(var(--carry-tint, 255, 255, 255), 0.95);
    color: #06202a;
    font: 600 9px/1 var(--font-mono);
    letter-spacing: 0.05em;
    white-space: nowrap;
}
