*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #080510;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    color: #e0e0e0;
}

/* Synth layout */
.synth-container {
    width: 100vw;
    height: 100vh;       /* fallback for browsers without dvh */
    height: 100dvh;      /* dynamic viewport: accounts for the mobile URL bar */
    display: flex;
    flex-direction: column;
    background: #080510;
}

.canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.canvas-area canvas {
    position: absolute;   /* fill the (position:relative) area reliably, even when
                             the container height is auto on mobile */
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* HUD panel — bottom left in controls area (opposite drum pads) */
.hud-panel {
    position: absolute;
    left: 20px;
    bottom: 14px;
    display: flex;
    gap: 16px;
    align-items: flex-end;
    z-index: 10;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-label {
    font-size: 0.5rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
    font-family: monospace;
    text-transform: uppercase;
}

.hud-value {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 0 10px rgba(120, 80, 255, 0.3);
    font-family: monospace;
}

.hud-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 84px;
    height: 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    cursor: pointer;
    margin-top: 4px;
}
.hud-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgb(150, 110, 255);
    box-shadow: 0 0 8px rgba(120, 80, 255, 0.6);
    cursor: pointer;
}
.hud-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: rgb(150, 110, 255);
    box-shadow: 0 0 8px rgba(120, 80, 255, 0.6);
    cursor: pointer;
}
.hud-slider:focus-visible {
    box-shadow: 0 0 0 2px rgba(150, 110, 255, 0.7);
}

/* Dimmed out-of-scale keys — dimmed but still legible (text opacity is
   raised separately below so element-opacity × text-opacity stays readable) */
.synth-key.out-of-scale {
    opacity: 0.55;
}

.synth-key.out-of-scale .key-letter {
    color: rgba(255, 255, 255, 0.6);
}

.synth-key.out-of-scale .key-note {
    color: rgba(255, 255, 255, 0.55);
}

/* Loop track strip across the top */
.loop-tracks {
    display: flex;
    justify-content: center;
    gap: 8px;
    /* reserve space on the left for the fixed .view-title so loop track 1
       isn't overlapped by the PIANO ROLL / THEREMIN label */
    padding: 10px 24px 10px 144px;
    background: rgba(255, 255, 255, 0.015);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.loop-track {
    flex: 1;
    max-width: 120px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
    transition: all 0.15s ease;
}

.loop-track .loop-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: rgba(255, 255, 255, 0.04);
    transition: none;
    pointer-events: none;
}

.loop-track .loop-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    z-index: 1;
}

.loop-track .loop-label {
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    z-index: 1;
}

.loop-track .loop-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    z-index: 1;
    flex-shrink: 0;
}

/* Recording state */
.loop-track.loop-recording {
    border-color: rgba(255, 60, 60, 0.5);
    background: rgba(255, 60, 60, 0.08);
}

.loop-track.loop-recording .loop-num {
    color: rgba(255, 100, 100, 0.9);
}

.loop-track.loop-recording .loop-label {
    color: rgba(255, 100, 100, 0.7);
}

.loop-track.loop-recording .loop-status-dot {
    background: #ff3c3c;
    animation: pulse-dot 0.4s ease infinite alternate;
}

.loop-track.loop-recording .loop-progress {
    background: rgba(255, 60, 60, 0.14);
}

/* Playing state */
.loop-track.loop-playing {
    border-color: rgba(80, 255, 120, 0.35);
    background: rgba(80, 255, 120, 0.04);
}

.loop-track.loop-playing .loop-num {
    color: rgba(80, 255, 120, 0.8);
}

.loop-track.loop-playing .loop-label {
    color: rgba(80, 255, 120, 0.5);
}

.loop-track.loop-playing .loop-status-dot {
    background: #50ff78;
    animation: pulse-dot 0.8s ease infinite alternate;
}

.loop-track.loop-playing .loop-progress {
    background: rgba(80, 255, 120, 0.06);
}

/* Muted state */
.loop-track.loop-muted {
    border-color: rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.01);
    opacity: 0.4;
}

.loop-track.loop-muted .loop-num {
    color: rgba(255, 255, 255, 0.6);
}

.loop-track.loop-muted .loop-label {
    color: rgba(255, 255, 255, 0.45);
}

.loop-track.loop-muted .loop-status-dot {
    background: rgba(255, 180, 0, 0.5);
}

/* Soloed track — distinct cyan ring so it reads apart from plain "playing" */
.loop-track.loop-solo {
    border-color: rgba(80, 220, 255, 0.7);
    background: rgba(80, 220, 255, 0.07);
    box-shadow: 0 0 0 1px rgba(80, 220, 255, 0.4) inset;
}
.loop-track.loop-solo .loop-num { color: rgba(120, 230, 255, 0.95); }
.loop-track.loop-solo .loop-label { color: rgba(120, 230, 255, 0.7); }
.loop-track.loop-solo .loop-status-dot {
    background: #50dcff;
    animation: pulse-dot 0.8s ease infinite alternate;
}

/* Silenced because another track is soloed — dim like muted but blue-tinged */
.loop-track.loop-silenced { opacity: 0.4; }
.loop-track.loop-silenced .loop-status-dot { background: rgba(80, 220, 255, 0.3); }

/* Long-press-to-clear: a red wash grows across the tile over the hold time so
   the destructive gesture is visible and deliberate (matches LOOP_LONGPRESS_MS). */
.loop-track.arming-clear::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255, 60, 60, 0.55), rgba(255, 90, 60, 0.4));
    transform: scaleX(0);
    transform-origin: left center;
    animation: loop-clear-fill 650ms linear forwards;
    pointer-events: none;
    z-index: 2;
}
@keyframes loop-clear-fill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes pulse-dot {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

/* Controls row: keyboard centered, drums pinned right */
.controls-area {
    display: flex;
    align-items: flex-end;
    padding: 10px 20px 14px;
    background: linear-gradient(to top, rgba(10, 6, 20, 0.95), transparent);
    position: relative;
}

/* Keyboard area */
.keyboard-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 0 auto;
}

.key-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

/* Stagger rows like a real QWERTY keyboard */
.key-row.top-row {
    margin-left: 72px;
}
.key-row.home-row {
    margin-left: 42px;
}
.key-row.bottom-row {
    margin-left: 0;
}

.synth-key {
    width: 52px;
    height: 48px;
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.08s ease;
}

.synth-key .key-letter {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.08s;
}

.synth-key .key-note {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
    margin-top: 1px;
    transition: color 0.08s;
}

.synth-key:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Active (pressed) state */
.synth-key.active {
    background: hsla(var(--key-hue), 80%, 50%, 0.25);
    border-color: hsla(var(--key-hue), 80%, 60%, 0.6);
    box-shadow:
        0 0 15px hsla(var(--key-hue), 80%, 50%, 0.3),
        0 0 30px hsla(var(--key-hue), 80%, 50%, 0.15),
        inset 0 0 15px hsla(var(--key-hue), 80%, 50%, 0.1);
    transform: scale(0.95);
}

.synth-key.active .key-letter {
    color: hsla(var(--key-hue), 90%, 80%, 1);
    text-shadow: 0 0 10px hsla(var(--key-hue), 90%, 60%, 0.8);
}

.synth-key.active .key-note {
    color: hsla(var(--key-hue), 80%, 70%, 0.8);
}

/* Drum pad grid: 4 columns (kick | 3x3), pinned far right */
.drum-pad-grid {
    display: grid;
    grid-template-columns: 52px 52px 52px 52px;
    grid-template-rows: 48px 48px 48px;
    gap: 4px;
    position: absolute;
    right: 20px;
    bottom: 14px;
}

.drum-pad {
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.06s ease;
}

.drum-pad.drum-kick {
    grid-column: 1;
    grid-row: 1 / 4;
}

.drum-pad .drum-num {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.55);
}

.drum-pad .drum-name {
    font-size: 0.55rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.05em;
    transition: color 0.06s;
}

.drum-pad:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.drum-pad.active {
    background: hsla(var(--drum-hue), 80%, 50%, 0.3);
    border-color: hsla(var(--drum-hue), 80%, 60%, 0.6);
    box-shadow:
        0 0 15px hsla(var(--drum-hue), 80%, 50%, 0.4),
        0 0 30px hsla(var(--drum-hue), 80%, 50%, 0.2),
        inset 0 0 15px hsla(var(--drum-hue), 80%, 50%, 0.15);
    transform: scale(0.93);
}

.drum-pad.active .drum-name {
    color: hsla(var(--drum-hue), 90%, 80%, 1);
    text-shadow: 0 0 8px hsla(var(--drum-hue), 90%, 60%, 0.8);
}

/* Piano roll cursor styles */
.canvas-area canvas.cursor-resize-ew {
    cursor: ew-resize;
}
.canvas-area canvas.cursor-grab {
    cursor: grab;
}

/* Blazor error UI */
#blazor-error-ui {
    background: #1a0a0a;
    color: #ff4444;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    position: fixed;
    text-align: center;
    z-index: 1000;
    display: none;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 10px;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Recording indicator */
.rec-indicator {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 100;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.rec-indicator .rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff3c3c;
    animation: pulse-dot 0.5s ease infinite alternate;
}
.rec-indicator .rec-label {
    font-family: monospace;
    font-size: 0.7rem;
    color: #ff3c3c;
    letter-spacing: 0.15em;
}

/* Effects Panel */
.effects-panel {
    position: absolute;
    left: 20px;
    bottom: 60px;
    z-index: 20;
    background: rgba(10, 7, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 10px;
    min-width: 140px;
}

.effects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.effects-title {
    font-family: monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.7);
}

.effects-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 4px;
}

.effects-toggle:hover {
    color: rgba(255, 255, 255, 0.6);
}

.effects-sliders {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.effects-panel.collapsed .effects-sliders {
    display: none;
}

.fx-slider {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fx-slider label {
    font-family: monospace;
    font-size: 0.5rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.65);
    min-width: 36px;
    text-align: right;
}

.fx-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    width: auto;
    min-width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
}

.fx-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(120, 80, 255, 0.7);
    cursor: pointer;
}

.fx-slider input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(120, 80, 255, 0.7);
    cursor: pointer;
    border: none;
}

.fx-slider.eq-section label {
    color: rgba(255, 200, 80, 0.7);
}

.fx-slider.eq-section input[type="range"]::-webkit-slider-thumb {
    background: rgba(255, 200, 80, 0.7);
}

.fx-slider.eq-section input[type="range"]::-moz-range-thumb {
    background: rgba(255, 200, 80, 0.7);
}

/* FX Presets row */
.fx-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.fx-preset-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-family: monospace;
    font-size: 0.45rem;
    letter-spacing: 0.1em;
    padding: 3px 6px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.fx-preset-btn:hover {
    background: rgba(120, 80, 255, 0.15);
    border-color: rgba(120, 80, 255, 0.4);
    color: rgba(255, 255, 255, 0.7);
}

/* Drum Sequencer */
.drum-sequencer {
    position: absolute;
    right: 20px;
    top: -4px;
    transform: translateY(-100%);
    z-index: 20;
    width: 560px;
    background: rgba(10, 7, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
}

.seq-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.seq-title {
    font-family: monospace;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.7);
    flex: 1;
}

.seq-toggle, .seq-clear {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-family: monospace;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    padding: 4px 9px;
    cursor: pointer;
}

.seq-toggle:hover, .seq-clear:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
}

.seq-toggle.seq-on {
    background: rgba(80, 255, 120, 0.15);
    border-color: rgba(80, 255, 120, 0.4);
    color: rgba(80, 255, 120, 0.8);
}

.seq-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.seq-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.seq-label {
    font-family: monospace;
    font-size: 0.5rem;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.7);
    width: 48px;
    text-align: right;
    padding-right: 6px;
    flex-shrink: 0;
}

.seq-step {
    flex: 1 1 0;
    min-width: 16px;
    height: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.06s;
}

.seq-step:hover {
    background: rgba(255, 255, 255, 0.08);
}

.seq-step.seq-step-bar {
    margin-left: 8px;
}

.seq-step.step-active {
    background: rgba(255, 160, 40, 0.5);
    border-color: rgba(255, 160, 40, 0.7);
}

.seq-step.step-current {
    box-shadow: 0 0 4px rgba(80, 255, 120, 0.6);
    border-color: rgba(80, 255, 120, 0.5);
}

.seq-step.step-active.step-current {
    background: rgba(255, 200, 40, 0.7);
    box-shadow: 0 0 6px rgba(255, 200, 40, 0.5);
}

/* =========================================================================
   SAVE/LOAD MODAL
   ========================================================================= */
.hud-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.hud-btn:hover {
    background: rgba(120, 80, 255, 0.2);
    border-color: rgba(120, 80, 255, 0.4);
    color: rgba(255, 255, 255, 0.8);
}

.sl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.sl-panel {
    background: #12101c;
    border: 1px solid rgba(120, 80, 255, 0.25);
    border-radius: 8px;
    width: 460px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.sl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sl-title {
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.6);
}

.sl-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}
.sl-close:hover {
    color: rgba(255, 255, 255, 0.7);
}

.sl-save-row {
    display: flex;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sl-name-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 10px;
    color: #e0e0e0;
    font-family: monospace;
    font-size: 0.8rem;
    outline: none;
}
.sl-name-input:focus {
    border-color: rgba(120, 80, 255, 0.4);
}
.sl-name-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.sl-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.55);
    font-family: monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.sl-btn:hover {
    background: rgba(120, 80, 255, 0.2);
    border-color: rgba(120, 80, 255, 0.4);
    color: rgba(255, 255, 255, 0.85);
}

.sl-btn-save {
    background: rgba(120, 80, 255, 0.15);
    border-color: rgba(120, 80, 255, 0.3);
}

.sl-btn-del:hover {
    background: rgba(255, 60, 60, 0.2);
    border-color: rgba(255, 60, 60, 0.4);
    color: rgba(255, 120, 120, 0.9);
}

.sl-list {
    overflow-y: auto;
    max-height: 45vh;
    padding: 8px 18px;
}

.sl-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.15);
    font-family: monospace;
    font-size: 0.75rem;
    padding: 24px 0;
}

.sl-song-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.sl-song-row:last-child {
    border-bottom: none;
}

.sl-song-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sl-song-name {
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sl-song-date {
    font-family: monospace;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.2);
}

.sl-song-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.sl-import-row {
    padding: 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* =========================================================================
   ACCESSIBILITY — FOCUS VISIBILITY
   Bright accent ring for keyboard users only (:focus-visible, not :focus,
   so mouse/touch users don't get rings). Tuned to read on the #080510 bg.
   ========================================================================= */
.synth-key:focus-visible,
.drum-pad:focus-visible,
.seq-step:focus-visible,
.loop-track:focus-visible,
button:focus-visible,
.hud-btn:focus-visible,
.fx-preset-btn:focus-visible,
.effects-toggle:focus-visible,
.seq-toggle:focus-visible,
.seq-clear:focus-visible,
.sl-btn:focus-visible,
.sl-close:focus-visible,
input[type="range"]:focus-visible,
.fx-slider input[type="range"]:focus-visible,
.sl-name-input:focus-visible {
    outline: 2px solid hsl(265, 90%, 72%);
    outline-offset: 2px;
    box-shadow: 0 0 10px rgba(150, 110, 255, 0.55);
}

/* Range thumbs: also light up the thumb itself for clarity */
.fx-slider input[type="range"]:focus-visible::-webkit-slider-thumb {
    background: hsl(265, 95%, 78%);
    box-shadow: 0 0 8px rgba(150, 110, 255, 0.8);
}
.fx-slider input[type="range"]:focus-visible::-moz-range-thumb {
    background: hsl(265, 95%, 78%);
    box-shadow: 0 0 8px rgba(150, 110, 255, 0.8);
}

/* =========================================================================
   TOUCH — kill 300ms tap delay & double-tap zoom on interactive controls
   ========================================================================= */
.synth-key,
.drum-pad,
.seq-step,
.loop-track,
button,
.hud-btn,
.fx-preset-btn,
.effects-toggle,
.seq-toggle,
.seq-clear,
.sl-btn,
.sl-close,
.help-fab,
.help-close {
    touch-action: manipulation;
}

/* =========================================================================
   RESPONSIVE / TOUCH LAYOUT
   The app is a wide instrument; on narrow or coarse-pointer devices we keep
   it operable: scrollable controls, ≥44px tap targets, nothing clipped.
   ========================================================================= */
@media (pointer: coarse), (max-width: 820px) {
    /* ===== Touch-first: show note names, hide the computer-key letters ===== */
    .synth-key .key-letter { display: none; }
    .synth-key .key-note {
        font-size: 0.95rem;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.9);
        margin-top: 0;
        letter-spacing: 0.02em;
    }
    /* A real (hardware / Bluetooth) keypress brings the letter hints back. */
    body.has-hw-keyboard .synth-key .key-letter { display: block; }
    body.has-hw-keyboard .synth-key .key-note {
        font-size: 0.5rem; font-weight: 400; color: rgba(255, 255, 255, 0.6);
    }
    /* Drop the physical-keyboard stagger — it just pushes keys off a phone. */
    .key-row.top-row, .key-row.home-row, .key-row.bottom-row { margin-left: 0; }

    /* ===== Bottom controls stack vertically instead of clipping in a row ===== */
    .controls-area {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        overflow: visible;
        padding: 8px 10px 18px;
    }

    /* Keyboard fills the width; keys flex so a row never runs off-screen. */
    .keyboard-area { margin: 0; width: 100%; gap: 6px; }
    .key-row { width: 100%; gap: 5px; }
    .synth-key {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        height: 54px;
    }

    /* Drum pads: a centred grid below the keyboard (no longer pinned off-screen). */
    .drum-pad-grid {
        position: static;
        right: auto;
        bottom: auto;
        margin: 2px auto 0;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(3, 52px);
        gap: 6px;
        width: 100%;
        max-width: 420px;
    }
    .drum-pad .drum-name { font-size: 0.62rem; }
    .drum-pad .drum-num { font-size: 0.55rem; }

    /* HUD readouts wrap into centred, tappable chips. */
    .hud-panel {
        position: static;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 16px;
        padding: 6px 8px;
    }

    /* Floating panels: keep them within a phone screen when opened. */
    .drum-sequencer { width: 96vw; max-width: 560px; }
    .effects-panel { max-width: 92vw; }
    .neck-panel, .piano-panel { width: 94vw !important; max-width: 560px; }
    .maker-panel { width: 94vw !important; max-width: 400px; max-height: 70vh; }
    .neck-canvas { height: 130px; }
    .piano-canvas { height: 108px; }
    /* Touch-size the panel header controls. */
    .neck-btn, .neck-close, .seq-close { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }

    /* ===== Loop strip: keep track size, scroll sideways ===== */
    .loop-tracks {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        gap: 6px;
        padding: 6px 10px;
        padding-right: 60px; /* clear the floating ? button in the top-right */
    }
    .loop-track {
        flex: 0 0 auto;
        width: 92px;
        min-height: 42px;
        max-width: none;
    }

    /* ===== Comfortable tap targets ===== */
    .hud-btn, .sl-btn, .fx-preset-btn, .seq-toggle, .seq-clear,
    .effects-toggle, .sl-close, .tool-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* =========================================================================
   HELP OVERLAY (NEW module — vanilla JS toggles `hidden` attr + `.open`)
   ========================================================================= */

/* Floating "?" button, bottom-right, above all controls */
.help-fab {
    position: fixed;
    right: 16px;
    top: 12px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    background: rgba(120, 80, 255, 0.22);
    border: 1px solid rgba(150, 110, 255, 0.5);
    color: rgba(255, 255, 255, 0.85);
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5),
                0 0 16px rgba(120, 80, 255, 0.25);
    transition: all 0.15s ease;
}
.help-fab:hover {
    background: rgba(120, 80, 255, 0.35);
    border-color: rgba(150, 110, 255, 0.8);
    color: #fff;
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.55),
                0 0 24px rgba(120, 80, 255, 0.45);
}
.help-fab:active {
    transform: scale(0.93);
}

/* Full-viewport dim backdrop, centers the panel. Above the FAB. */
.help-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 2, 10, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.18s ease;
}
.help-overlay[hidden] {
    display: none;
}
/* When opened via `.open`, fade/scale in (JS adds `.open` after un-hiding) */
.help-overlay:not(.open) {
    opacity: 0;
}
.help-overlay:not(.open) .help-panel {
    transform: scale(0.96);
}

/* The dialog card */
.help-panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    overflow: auto;
    background: #12101c;
    border: 1px solid rgba(120, 80, 255, 0.25);
    border-radius: 12px;
    padding: 22px 26px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.65);
    transform: scale(1);
    transition: transform 0.18s ease;
}

.help-title {
    font-family: monospace;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 16px;
    padding-right: 40px; /* clear the × */
}

.help-section {
    display: block;
    margin-bottom: 18px;
}
.help-section:last-child {
    margin-bottom: 0;
}

.help-section-title {
    font-family: monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: hsl(265, 85%, 78%);
    margin-bottom: 8px;
}

.help-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.help-row:last-child {
    border-bottom: none;
}

/* Monospace "key cap" chip. The JS sets .help-keys text directly (e.g.
   "Shift+[ / Shift+]"), so the span itself is styled as the cap. If markup
   ever nests <kbd>/.help-key children, those inherit the same cap look. */
.help-keys,
.help-keys kbd,
.help-keys .help-key {
    display: inline-block;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 2px 7px;
    font-family: monospace;
    font-size: 0.7rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}

.help-desc {
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.82);
    text-align: right;
}

/* × close button, top-right of the panel */
.help-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
}
.help-close:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.06);
}

/* =========================================================================
   Top-left view title + top-right toolbar
   ========================================================================= */
.view-title {
    position: fixed;
    top: 18px;                /* sit in the top loop-bar, left of the tracks */
    left: 16px;
    z-index: 30;
    font-family: monospace;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: rgba(180, 140, 255, 0.92);
    text-shadow: 0 0 18px rgba(120, 80, 255, 0.35);
    pointer-events: none;
    user-select: none;
}

.top-toolbar {
    position: fixed;
    top: 64px;
    right: 20px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 2px;
}

.tool-btn {
    font-family: monospace;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    padding: 7px 11px;
    min-height: 32px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(18, 14, 28, 0.85);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.15s;
}
.tool-btn:hover {
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(150, 110, 255, 0.5);
}
.tool-btn.active {
    color: #fff;
    border-color: rgba(150, 110, 255, 0.9);
    background: rgba(90, 60, 180, 0.5);
    box-shadow: 0 0 14px rgba(120, 80, 255, 0.35);
}
.tool-btn-dim {
    opacity: 0.4;
}

/* =========================================================================
   Instruments hidden by default → theremin runs full-screen.
   The KEYS / PADS toolbar toggles add `.shown` to reveal them.
   ========================================================================= */
.keyboard-area { display: none; }
.keyboard-area.shown { display: flex; }
.drum-pad-grid { display: none; }
.drum-pad-grid.shown { display: grid; }

/* =========================================================================
   Clickable HUD readouts + drop-up pick menu
   ========================================================================= */
.picker-trigger {
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s;
}
.picker-trigger:hover {
    background: rgba(150, 110, 255, 0.12);
}
.picker-trigger.has-popup {
    background: rgba(150, 110, 255, 0.2);
}
.picker-trigger .hud-value {
    text-decoration: underline;
    text-decoration-color: rgba(150, 110, 255, 0.4);
    text-underline-offset: 3px;
}

.hud-popup {
    position: fixed;
    z-index: 1050;
    min-width: 140px;
    padding: 5px;
    border-radius: 9px;
    background: rgba(16, 13, 26, 0.97);
    border: 1px solid rgba(150, 110, 255, 0.4);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-overflow-scrolling: touch;   /* momentum scroll on iOS */
    overscroll-behavior: contain;        /* don't scroll the page behind it */
    touch-action: pan-y;                 /* allow vertical drag-scroll on touch */
}
.hud-popup-item {
    font-family: monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    padding: 7px 12px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.78);
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
}
.hud-popup-item:hover,
.hud-popup-item.highlighted {
    background: rgba(150, 110, 255, 0.22);
    color: #fff;
}
.hud-popup-item.active {
    color: rgba(180, 140, 255, 1);
}
.hud-popup-item.active::before {
    content: '\2022  ';
    color: rgba(180, 140, 255, 0.9);
}

/* =========================================================================
   Floating FX / drum-seq windows (draggable + resizable, hidden by default)
   ========================================================================= */
.effects-panel,
.drum-sequencer {
    display: none;
    transform: none;          /* neutralise old anchored transforms when floating */
    bottom: auto;             /* JS controls top/left via position:fixed */
    right: auto;
    resize: none;
}
.effects-panel.open,
.drum-sequencer.open {
    display: block;
}
.effects-header,
.seq-header {
    cursor: move;
    user-select: none;
}
.effects-header .effects-toggle,
.seq-header button {
    cursor: pointer;
}
.effects-panel.dragging,
.drum-sequencer.dragging,
.effects-panel.resizing,
.drum-sequencer.resizing {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    border-color: rgba(150, 110, 255, 0.6);
}

.win-resize-grip {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    touch-action: none;
    background:
        linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 60%, transparent 60%,
        transparent 72%, rgba(255, 255, 255, 0.25) 72%, rgba(255, 255, 255, 0.25) 82%, transparent 82%);
    border-bottom-right-radius: 8px;
}

.seq-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0 2px;
}
.seq-close:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* ===== Touch / phone hardening (mobile audit 2026-06-14) ===== */
@media (pointer: coarse) {
    /* C2: keep content out from under the notch / gesture bar. */
    .loop-tracks { padding-top: calc(8px + env(safe-area-inset-top)); margin-right: 56px; }
    .controls-area { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

    /* C1: when revealed instruments make the UI taller than the viewport (esp.
       landscape), let the page scroll rather than clip controls off-screen. */
    html, body { overflow-y: auto; height: auto; -webkit-overflow-scrolling: touch; }
    .synth-container { height: auto; min-height: 100dvh; }
    .canvas-area { min-height: 44dvh; }   /* theremin stays playable even when scrolled */

    /* C4: move the toggle toolbar OUT of the theremin play area — flow it into
       the bottom controls block instead of floating over the canvas. */
    .top-toolbar {
        position: static;
        max-width: none;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        order: -1;            /* above the HUD readouts in the bottom block */
    }
    /* Dock the view title into the bottom block too, so the top stays clean
       (just the loop strip + help button). */
    .view-title {
        position: static;
        order: -2;
        text-align: center;
        width: 100%;
        font-size: 0.85rem;
        top: auto;
        left: auto;
        padding-top: 2px;
    }

    /* I2: park the help button in the gap reserved at the top-right (loops have
       margin-right above), so it never sits on a loop track or the drum pads. */
    .help-fab { top: calc(8px + env(safe-area-inset-top)); right: 10px; bottom: auto; }

    /* I4: comfortable fixed-width keys; the whole keyboard scrolls sideways. */
    .keyboard-area.shown {
        overflow-x: auto;
        align-items: flex-start;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .key-row { width: max-content; justify-content: flex-start; }
    .synth-key { flex: 0 0 auto; width: 46px; }

    /* C3: drum sequencer fits the screen; its grid scrolls; bigger step targets. */
    .drum-sequencer { width: calc(100vw - 32px); max-width: 560px; }
    .seq-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .seq-row { width: max-content; }
    .seq-step { flex: 0 0 auto; width: 26px; height: 26px; }
    .seq-label { position: sticky; left: 0; background: rgba(10, 7, 20, 0.95); z-index: 1; }

    /* M2: bump the smallest labels so they're readable/aimable on a phone. */
    .tool-btn { font-size: 0.7rem; min-height: 40px; padding: 8px 11px; }
    .fx-preset-btn { font-size: 0.62rem; }

    /* M3: fatter range thumb/track so FX sliders are grabbable by finger. */
    .fx-slider input[type="range"] { height: 8px; }
    .fx-slider input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
    .fx-slider input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; }
}

/* =========================================================================
   Guitar neck — live-mirror floating panel + tab-import modal
   ========================================================================= */
.neck-panel {
    display: none;
    position: absolute;            /* SynthWindow sets position:fixed + left/top inline */
    z-index: 20;
    width: 480px;
    background: rgba(10, 7, 20, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 10px;
}
.neck-panel.open { display: block; }
.neck-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px; cursor: move; user-select: none;
}
.neck-title {
    flex: 1; font-family: monospace; font-size: 0.62rem; letter-spacing: 0.1em;
    color: rgba(180, 140, 255, 0.9); cursor: pointer;
}
/* Instrument selector — compact, distinct accent so it reads apart from the tuning */
.neck-inst {
    flex: 0 0 auto; font-weight: 700; color: rgba(120, 200, 255, 0.95);
    text-decoration: underline; text-underline-offset: 3px; padding-right: 8px;
}
.neck-chord-trigger {
    font-family: monospace; font-size: 0.6rem; letter-spacing: 0.1em;
    color: rgba(120, 255, 170, 0.88); cursor: pointer; flex-shrink: 0;
    text-decoration: underline; text-underline-offset: 3px; padding: 0 4px;
}
.neck-btn {
    font-family: monospace; font-size: 0.6rem; letter-spacing: 0.08em;
    padding: 4px 9px; border-radius: 5px; cursor: pointer; touch-action: manipulation;
    border: 1px solid rgba(150, 110, 255, 0.4); background: rgba(90, 60, 180, 0.25); color: rgba(255, 255, 255, 0.85);
}
.neck-btn:hover { background: rgba(120, 80, 255, 0.4); }
.neck-close {
    background: none; border: none; color: rgba(255, 255, 255, 0.4);
    cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px;
}
.neck-close:hover { color: rgba(255, 255, 255, 0.85); }
.neck-canvas { display: block; width: 100%; height: 170px; border-radius: 6px; }

/* Drum-kit mirror panel — narrower, taller (kit is squarer than the neck) */
.drumkit-panel { width: 360px; }
.drumkit-panel .neck-canvas { height: 300px; background: rgba(8, 6, 14, 0.5); }
.drumkit-hint { flex: 1; font-size: 0.5rem !important; color: rgba(255,255,255,0.4) !important; text-align: right; }

/* Ocarina mirror panel */
.ocarina-panel { width: 340px; }
.ocarina-canvas { height: 280px; background: rgba(8, 6, 14, 0.5); }
.ocarina-title { flex: 0 0 auto; }
.ocarina-hint { flex: 1; font-size: 0.5rem !important; color: rgba(255,255,255,0.4) !important; text-align: right; }
.ocarina-mode {
    font-family: monospace; font-size: 0.55rem; letter-spacing: 0.08em;
    color: rgba(255,255,255,0.45); cursor: pointer; padding: 2px 6px; border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.12);
}
.ocarina-mode.active { color: #fff; background: rgba(90,60,180,0.5); border-color: rgba(150,110,255,0.7); }
.ocarina-songbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 6px; }
.ocarina-songbar[hidden] { display: none; }
.ocarina-tr { font-size: 0.55rem !important; padding: 3px 8px !important; }
.ocarina-banner { font-family: monospace; font-size: 0.58rem; flex-basis: 100%; color: rgba(255,255,255,0.6); }
.ocarina-banner.good { color: hsl(140,70%,62%); }
.ocarina-banner.warn { color: hsl(40,90%,62%); }
.ocarina-banner.bad { color: hsl(0,80%,66%); }
.piano-panel { width: 600px; }
.piano-canvas { display: block; width: 100%; height: 130px; border-radius: 6px; }

.neck-modal {
    position: fixed; inset: 0; z-index: 1100;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
}
.neck-modal[hidden] { display: none; }
.neck-modal-panel {
    width: min(560px, 92vw); max-height: 86vh; overflow: auto;
    background: #12101c; border: 1px solid rgba(150, 110, 255, 0.4);
    border-radius: 12px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
}
.neck-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.neck-modal-head h2 { font-family: monospace; font-size: 1rem; letter-spacing: 0.08em; color: rgba(200, 170, 255, 0.95); }
.neck-modal-close { background: none; border: none; color: rgba(255, 255, 255, 0.55); font-size: 1.4rem; cursor: pointer; }
.neck-modal-row { display: flex; align-items: center; gap: 10px; font-family: monospace; font-size: 0.72rem; color: rgba(255, 255, 255, 0.6); margin-bottom: 8px; }
.neck-tune-pick { color: rgba(180, 140, 255, 1); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.neck-modal-text {
    width: 100%; height: 220px; resize: vertical;
    font-family: monospace; font-size: 0.8rem; line-height: 1.3; color: #d8d2e8;
    background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px; padding: 10px; white-space: pre; overflow: auto;
}
.neck-modal-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.neck-import-status { font-family: monospace; font-size: 0.72rem; color: rgba(180, 140, 255, 0.85); }
.neck-convert {
    border: 1px solid rgba(150, 110, 255, 0.22); border-radius: 8px;
    padding: 10px 12px; margin: 6px 0 12px; background: rgba(120, 80, 255, 0.06);
}
.neck-section-title {
    font-family: monospace; font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: rgba(180, 140, 255, 0.7); margin: 4px 0 8px;
}

/* =========================================================================
   Instrument Maker (live preset editor) floating panel
   ========================================================================= */
.maker-panel {
    display: none;
    position: absolute;            /* SynthWindow controls position:fixed + left/top */
    z-index: 20;
    width: 340px;
    max-height: 80vh;
    flex-direction: column;
    background: rgba(10, 7, 20, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 10px;
}
.maker-panel.open { display: flex; }
.maker-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; cursor: move; user-select: none; }
.maker-title { flex: 1; font-family: monospace; font-size: 0.62rem; letter-spacing: 0.1em; color: rgba(180, 140, 255, 0.9); }
.maker-mini {
    font-family: monospace; font-size: 0.58rem; padding: 3px 7px; border-radius: 4px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.78);
    touch-action: manipulation;
}
.maker-mini:hover { background: rgba(150, 110, 255, 0.35); color: #fff; }
.maker-saverow { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.maker-name {
    flex: 1; min-width: 0; font-family: monospace; font-size: 0.7rem; padding: 5px 8px; border-radius: 5px;
    background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.12); color: #e0d8f0;
}
.maker-status { font-family: monospace; font-size: 0.6rem; color: rgba(120, 255, 170, 0.88); min-height: 12px; margin-bottom: 4px; }
.maker-body { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.maker-section { border-top: 1px solid rgba(255, 255, 255, 0.06); padding: 3px 0; }
.maker-sec-head { font-family: monospace; font-size: 0.58rem; letter-spacing: 0.14em; color: rgba(180, 140, 255, 0.7); cursor: pointer; padding: 3px 0; }
.maker-sec-head::before { content: '\25be  '; }
.maker-section.collapsed .maker-sec-head::before { content: '\25b8  '; }
.maker-section.collapsed .maker-sec-body { display: none; }
.maker-ctl { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.maker-ctl label { width: 86px; flex-shrink: 0; font-family: monospace; font-size: 0.58rem; color: rgba(255, 255, 255, 0.72); text-align: right; }
.maker-ctl input[type="range"] {
    flex: 1; min-width: 0; height: 4px; -webkit-appearance: none; appearance: none;
    background: rgba(255, 255, 255, 0.1); border-radius: 2px; outline: none; touch-action: pan-y;
}
.maker-ctl input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: rgba(150, 110, 255, 0.9); cursor: pointer; }
.maker-ctl input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: rgba(150, 110, 255, 0.9); border: none; cursor: pointer; }
.maker-val { width: 46px; flex-shrink: 0; font-family: monospace; font-size: 0.58rem; color: rgba(255, 255, 255, 0.55); text-align: right; }
.maker-pick { flex: 1; font-family: monospace; font-size: 0.62rem; color: rgba(120, 255, 170, 0.85); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

