/* microVJ — operator console
   Calm, high-contrast dark UI. Local fonts, custom components, no external deps. */

@font-face {
    font-family: 'Manrope';
    src: url('fonts/Manrope/Manrope-VariableFont_wght.ttf') format('truetype');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Julius Sans One';
    src: url('fonts/Julius_Sans_One/JuliusSansOne-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Special Gothic Expanded One';
    src: url('fonts/Special_Gothic_Expanded_One/SpecialGothicExpandedOne-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Julius Sans One', 'Manrope', sans-serif;
    --font-brand: 'Special Gothic Expanded One', 'Manrope', sans-serif;

    --bg: #0b0c0f;
    --bg-soft: #101216;
    --bg-elevated: #15171c;
    --surface: #171a20;
    --surface-2: #1d2027;
    --surface-3: #242831;

    --border: rgba(255, 255, 255, 0.075);
    --border-strong: rgba(255, 255, 255, 0.14);

    --text: #eceef3;
    --text-secondary: #aab0bd;
    --text-muted: #737987;

    --accent: #e6b25b;
    --accent-strong: #f2c574;
    --accent-soft: rgba(230, 178, 91, 0.14);
    --selected: #8ab4ff;
    --selected-soft: rgba(138, 180, 255, 0.14);
    --success: #79c9a3;
    --danger: #e07a7a;
    --danger-soft: rgba(224, 122, 122, 0.13);
    --warning: #e6b25b;

    --pad-color-1: #e6b25b;
    --pad-color-2: #e08a6d;
    --pad-color-3: #8ab4ff;
    --pad-color-4: #b39df0;
    --pad-color-5: #79c9a3;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.48);
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --header-h: 64px;
    --console-h: 48px;
    --side-width: 400px;
}

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

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    user-select: none;
}

.operator-window {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

input,
textarea {
    user-select: text;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

::selection {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

.hidden-input {
    display: none;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

svg.icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
        color 0.16s var(--ease), transform 0.16s var(--ease);
}

.btn:hover {
    color: var(--text);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #1a1408;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: #1a1408;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #1a0b0b;
}

.btn-danger:hover {
    background: #e88b8b;
    border-color: #e88b8b;
    color: #1a0b0b;
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    gap: 6px;
}

.btn-block {
    width: 100%;
}

.btn.learning {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    animation: soft-pulse 1.4s ease-in-out infinite;
}

.btn-label {
    display: inline;
}

/* ---------- Inputs ---------- */
.input,
.combobox-input,
.select-input {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.input:hover,
.combobox-input:hover {
    border-color: var(--border-strong);
}

.input:focus,
.combobox-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.input-sm {
    width: 108px;
    height: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.output,
.mono-value {
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}

/* ---------- Custom range ---------- */
input[type='range'] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    background: transparent;
    cursor: pointer;
}

input[type='range']::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: var(--surface-3);
}

input[type='range']::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--surface-3);
}

input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    margin-top: -5.5px;
    border-radius: 50%;
    background: var(--text);
    border: 3px solid var(--bg);
    box-shadow: 0 0 0 1px var(--border-strong);
    transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}

input[type='range']::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--text);
    border: 3px solid var(--bg);
    box-shadow: 0 0 0 1px var(--border-strong);
}

input[type='range']:hover::-webkit-slider-thumb {
    background: var(--accent);
    transform: scale(1.1);
}

input[type='range']:focus-visible {
    outline: none;
}

input[type='range']:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 2px var(--accent);
}

/* ---------- Header ---------- */
.app-header {
    height: var(--header-h);
    flex-shrink: 0;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.brand-mark {
    font-family: var(--font-brand);
    font-size: 19px;
    line-height: 1;
    letter-spacing: 0.02em;
    color: var(--text);
    white-space: nowrap;
}

.brand-mark span {
    color: var(--accent);
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tempo {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.tempo-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.stepper {
    display: flex;
    align-items: center;
    gap: 2px;
}

.stepper-btn {
    width: 20px;
    height: 24px;
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.stepper-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

#bpm-input {
    width: 42px;
    height: 24px;
    background: transparent;
    border: none;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    appearance: textfield;
    -moz-appearance: textfield;
}

#bpm-input::-webkit-inner-spin-button,
#bpm-input::-webkit-outer-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

#bpm-input:focus {
    outline: none;
    color: var(--accent);
}

.beat-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.3;
    animation: beat-pulse 0.5s ease-out infinite;
}

.midi-status {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s var(--ease);
}

.midi-status .led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.2s var(--ease);
}

.midi-status.connected {
    color: var(--success);
}

.midi-status.connected .led {
    background: var(--success);
}

.monitor-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.mon-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex: 0 0 auto;
}

.mon-label {
    color: var(--text-muted);
    font-weight: 600;
}

.mon-value {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mon-value.ok {
    color: var(--success);
}

.mon-value.warn {
    color: var(--warning);
}

.mon-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.mon-dot.online {
    background: var(--success);
}

button.mon-chip {
    cursor: pointer;
    transition: border-color 0.16s var(--ease), color 0.16s var(--ease);
}

button.mon-chip:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
}

.dropdown {
    position: relative;
}

.chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.16s var(--ease);
}

.dropdown.open .chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 288px;
    padding: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    display: none;
    z-index: 300;
}

.dropdown.open .dropdown-menu {
    display: block;
    animation: menu-in 0.16s var(--ease-out);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-align: left;
    transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.dropdown-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.dropdown-item .icon {
    color: var(--text-muted);
}

.dropdown-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.dropdown-title {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text);
}

.dropdown-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.dropdown-sep {
    height: 1px;
    margin: 5px 8px;
    background: var(--border);
}

.controls-toggle {
    display: none;
}

.scrim {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(4, 5, 7, 0.62);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
}

.scrim.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Workspace / stage ---------- */
.workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--side-width);
    overflow: hidden;
    position: relative;
}

.stage {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 20px 0;
    overflow: hidden;
}

.stage-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding-bottom: 14px;
    flex-shrink: 0;
}

.stage-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: var(--text);
}

.stage-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stage-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ---------- Pad grid ---------- */
.pad-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-auto-rows: minmax(56px, 1fr);
    gap: 8px;
    align-content: stretch;
    padding: 2px 4px 14px 0;
}

.pad {
    position: relative;
    min-width: 0;
    display: grid;
    grid-template-columns: clamp(30px, 32%, 96px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 7px;
    row-gap: 1px;
    padding: 6px 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
        transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.pad::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--pad-color, var(--accent));
    opacity: 0;
    transition: opacity 0.15s var(--ease);
}

.pad:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.pad:hover::before {
    opacity: 0.55;
}

.pad.state-loaded::before {
    opacity: 1;
}

.pad.selected {
    border-color: var(--selected);
    box-shadow: 0 0 0 1px var(--selected);
}

.pad.state-loaded .pad-name {
    color: var(--text);
}

.pad.state-playing,
.pad.state-looping {
    background: var(--surface-2);
}

.pad.state-playing {
    border-color: var(--accent);
}

.pad.state-looping {
    border-color: var(--pad-color, var(--accent));
}

.pad-header {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    min-height: 13px;
}

.pad-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.pad-flags {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pad-midi {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface-3);
    padding: 1px 4px;
    border-radius: 4px;
}

.pad-state {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--surface-3);
    transition: background 0.15s var(--ease);
}

.pad.state-loaded .pad-state {
    background: var(--pad-color, var(--accent));
}

.pad.state-playing .pad-state {
    background: var(--accent);
    animation: soft-pulse 1s ease-in-out infinite;
}

.pad.state-looping .pad-state {
    background: var(--pad-color, var(--accent));
    animation: soft-pulse 1s ease-in-out infinite;
}

.pad-preview {
    grid-column: 1;
    grid-row: 2;
    min-height: 26px;
    border-radius: 7px;
    background: var(--bg-soft);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.icon-video {
    width: clamp(20px, 45%, 48px);
    height: auto;
    opacity: 0.22;
    color: var(--text-muted);
}

.pad-info {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
}

.pad-name {
    font-size: 10.5px;
    line-height: 1.2;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pad.state-empty .pad-name {
    color: var(--text-muted);
    font-weight: 500;
}

.pad-duration {
    font-size: 9.5px;
    line-height: 1.2;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.pad-progress {
    grid-column: 1 / -1;
    grid-row: 3;
    height: 2px;
    margin-top: 2px;
    background: var(--surface-3);
    border-radius: 999px;
    overflow: hidden;
}

.pad-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--pad-color, var(--accent));
    transition: width 0.12s linear;
}

.pad.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* ---------- Side panel ---------- */
.side-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-soft);
    border-left: 1px solid var(--border);
    overflow: hidden;
}

.side-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
    padding: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 11px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.tab-btn:hover {
    color: var(--text);
    background: var(--surface);
}

.tab-btn.active {
    color: var(--text);
    background: var(--surface-2);
    box-shadow: var(--shadow-card);
}

.side-panel-close {
    display: none;
}

.panel-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.tab-panel {
    display: none;
    padding: 18px;
}

.tab-panel.active {
    display: block;
    animation: panel-in 0.18s var(--ease-out);
}

.panel-intro {
    margin-bottom: 16px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 400;
    color: var(--text);
}

.section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ---------- Library ---------- */
.library-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.library-toolbar .btn {
    flex-shrink: 0;
}

.library-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0 8px;
    font-size: 11px;
    color: var(--text-muted);
}

#library-count {
    font-variant-numeric: tabular-nums;
}

.video-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 38px 18px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    transition: border-color 0.16s var(--ease), background 0.16s var(--ease),
        color 0.16s var(--ease);
}

.drop-zone.hidden {
    display: none;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.drop-zone-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.drop-zone-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.drop-zone-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.drop-zone-hint {
    font-size: 11.5px;
    margin-top: 2px;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: grab;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
        transform 0.15s var(--ease);
}

.video-item:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.video-item:active {
    cursor: grabbing;
    transform: scale(0.995);
}

.video-item.filtered-out {
    display: none;
}

.video-thumb {
    width: 64px;
    height: 38px;
    border-radius: 7px;
    background: var(--bg-soft);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.video-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.video-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    font-size: 10.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.video-remove {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    flex-shrink: 0;
    background: transparent;
    border: 1px solid transparent;
    font-size: 16px;
    line-height: 1;
    transition: border-color 0.15s var(--ease), color 0.15s var(--ease),
        background 0.15s var(--ease);
}

.video-remove:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}

/* ---------- Search combobox / autocomplete ---------- */
.combobox {
    position: relative;
    flex: 1 1 150px;
    min-width: 0;
    display: flex;
    align-items: center;
}

.combobox-icon {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.combobox-input {
    padding-left: 32px;
}

.combobox-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 250;
    max-height: 240px;
    overflow-y: auto;
    padding: 5px;
    list-style: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    display: none;
}

.combobox.open .combobox-list {
    display: block;
    animation: menu-in 0.14s var(--ease-out);
}

.combobox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}

.combobox-option:hover,
.combobox-option.active {
    background: var(--surface-2);
    color: var(--text);
}

.combobox-option-thumb {
    width: 34px;
    height: 20px;
    border-radius: 4px;
    background: var(--bg-soft);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.combobox-option-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combobox-empty {
    padding: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Pad editor fields ---------- */
.selection-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.selection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.selection-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.selection-label {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.selection-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.field-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.field-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.field-block {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

/* ---------- Switch ---------- */
.switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.switch .toggle-switch {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.switch-track {
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    position: relative;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}

.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: transform 0.16s var(--ease), background 0.16s var(--ease);
}

.switch .toggle-switch:checked + .switch-track {
    background: var(--accent);
    border-color: var(--accent);
}

.switch .toggle-switch:checked + .switch-track .switch-thumb {
    transform: translateX(18px);
    background: #1a1408;
}

.switch .toggle-switch:focus-visible + .switch-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Color selector ---------- */
.color-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 2px solid transparent;
    position: relative;
    transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}

.color-btn:hover {
    transform: scale(1.06);
}

.color-btn.active {
    border-color: var(--text);
}

.color-btn[data-color='1'] { background: var(--pad-color-1); }
.color-btn[data-color='2'] { background: var(--pad-color-2); }
.color-btn[data-color='3'] { background: var(--pad-color-3); }
.color-btn[data-color='4'] { background: var(--pad-color-4); }
.color-btn[data-color='5'] { background: var(--pad-color-5); }

.midi-note-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Accordion + effect sliders ---------- */
.accordion {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    list-style: none;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.accordion-head::-webkit-details-marker {
    display: none;
}

.accordion-head:hover {
    color: var(--text);
    background: var(--surface-2);
}

.accordion-title {
    flex: 1;
}

.accordion-chevron {
    width: 7px;
    height: 7px;
    margin-right: 3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.18s var(--ease);
    flex-shrink: 0;
}

.accordion[open] .accordion-chevron {
    transform: rotate(225deg);
}

.accordion-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 12px 12px;
}

.param-slider {
    display: flex;
    align-items: center;
    gap: 10px;
}

.param-slider label {
    width: 104px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.param-slider input[type='range'] {
    flex: 1;
    min-width: 0;
}

.param-slider .value {
    width: 52px;
    flex-shrink: 0;
    text-align: right;
    font-size: 11px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.glitch-param {
    display: none;
}

.midi-indicator {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: inline-grid;
    place-items: center;
    color: var(--text-muted);
    cursor: pointer;
    border: 1px solid transparent;
    flex-shrink: 0;
    transition: color 0.15s var(--ease), background 0.15s var(--ease),
        border-color 0.15s var(--ease);
}

.midi-indicator svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.midi-indicator:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.midi-indicator.armed {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent);
    animation: soft-pulse 1.4s ease-in-out infinite;
}

.midi-indicator.mapped {
    color: var(--success);
}

.glitch-toggle {
    width: 100%;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-soft);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 650;
    transition: border-color 0.16s var(--ease), background 0.16s var(--ease),
        color 0.16s var(--ease);
}

.glitch-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.glitch-toggle.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-midi-learn {
    margin-top: 4px;
}

/* ---------- Custom select ---------- */
.custom-select {
    position: relative;
    width: 100%;
    flex: 1;
    min-width: 0;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 12.5px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.custom-select:hover {
    border-color: var(--border-strong);
}

.custom-select.open {
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.custom-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-chevron {
    width: 14px;
    height: 14px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    transition: transform 0.16s var(--ease);
    flex-shrink: 0;
}

.custom-select.open .custom-select-chevron {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: fixed;
    z-index: 400;
    max-height: 240px;
    overflow-y: auto;
    padding: 5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    display: none;
}

.custom-select.open .custom-select-menu {
    display: block;
    animation: menu-in 0.14s var(--ease-out);
}

.custom-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 9px;
    border-radius: 6px;
    text-align: left;
    font-size: 12px;
    color: var(--text-secondary);
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
    background: var(--surface-2);
    color: var(--text);
    outline: none;
}

.custom-select-option.selected {
    color: var(--accent);
}

.custom-select-option.selected::after {
    content: '✓';
    font-size: 11px;
}

.custom-select-option:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.custom-select-option:disabled::after {
    content: '';
}

/* ---------- Transitions ---------- */
.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
        color 0.15s var(--ease);
}

.chip:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.chip.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.info-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.info-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--text-muted);
    flex-shrink: 0;
}

.info-card-icon svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.info-card p {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---------- Scenes ---------- */
.scene-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 10px;
    font-size: 12px;
}

.scene-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: panel-in 0.18s var(--ease-out);
}

.scene-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.scene-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scene-date {
    font-size: 10.5px;
    color: var(--text-muted);
}

.scene-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    transition: border-color 0.15s var(--ease), color 0.15s var(--ease),
        background 0.15s var(--ease);
}

.scene-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.scene-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.scene-btn[data-action='remove']:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}

/* ---------- Mixer ---------- */
.mixer {
    height: clamp(176px, 23vh, 220px);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    min-height: 0;
}

.mixer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mixer-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mixer-title h2 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 400;
    color: var(--text);
}

.badge {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-variant-numeric: tabular-nums;
}

.mixer-actions {
    display: flex;
    gap: 8px;
}

.mixer-body {
    flex: 1;
    min-height: 0;
    display: flex;
}

.mixer-channels {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    overflow-x: auto;
    align-items: stretch;
}

.mixer-empty {
    margin: auto;
    color: var(--text-muted);
    font-size: 12px;
}

.mixer-channel {
    width: 92px;
    min-width: 92px;
    height: 100%;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: channel-in 0.2s var(--ease-out);
}

.channel-preview {
    width: 100%;
    height: 42px;
    border-radius: 7px;
    background: var(--bg-soft) center / cover no-repeat;
    flex-shrink: 0;
}

.channel-name {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-controls {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.fader-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.fader-container label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
}

.channel-opacity {
    flex: 1;
    width: 6px !important;
    height: auto;
    min-height: 40px;
    writing-mode: vertical-lr;
    direction: rtl;
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    accent-color: var(--accent);
}

.fader-value {
    font-size: 10px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.channel-buttons {
    display: flex;
    gap: 5px;
}

.btn-mute,
.btn-solo {
    flex: 1;
    height: 24px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    transition: border-color 0.15s var(--ease), color 0.15s var(--ease),
        background 0.15s var(--ease);
}

.btn-mute:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-solo:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-mute.active {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-solo.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.master-preview {
    width: clamp(150px, 13vw, 196px);
    flex-shrink: 0;
    margin: 12px 16px 12px 0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 0;
}

.master-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.preview-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

#preview-canvas {
    width: 100%;
    flex: 1;
    min-height: 0;
    background: #000;
    border-radius: 8px;
}

/* ---------- Console ---------- */
.console-bar {
    height: var(--console-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 80;
}

.console-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}

.console-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.console-prompt {
    color: var(--accent);
    font-size: 18px;
    line-height: 1;
}

#command-input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 4px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 12.5px;
    outline: none;
}

#command-input::placeholder {
    color: var(--text-muted);
}

.command-output {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.command-output:empty {
    display: none;
}

.command-output > div {
    padding: 1px 0;
    white-space: pre-wrap;
}

/* ---------- Modals ---------- */
.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 5, 7, 0.68);
    backdrop-filter: blur(6px);
    transition: opacity 0.18s var(--ease), visibility 0.18s var(--ease);
}

.modal-shell.hidden {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
}

.modal-shell:not(.hidden) .modal {
    animation: modal-in 0.2s var(--ease-out);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 0;
}

.eyebrow {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}

.modal-head h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 400;
    line-height: 1.15;
    color: var(--text);
}

.modal-desc {
    padding: 10px 24px 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
    max-width: 66ch;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 24px 24px;
}

/* Workspace modal */
.workspace-modal {
    width: min(780px, 100%);
    max-height: min(88vh, 800px);
    overflow-y: auto;
    padding-bottom: 0;
}

.workspace-progress {
    height: 6px;
    margin: 18px 24px 0;
    background: var(--surface-3);
    border-radius: 999px;
    overflow: hidden;
}

.workspace-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.25s var(--ease);
}

.workspace-status {
    margin: 8px 24px 0;
    font-size: 11.5px;
    color: var(--text-muted);
    min-height: 16px;
}

.workspace-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 18px 24px 0;
}

.workspace-block h3 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.workspace-checks,
.workspace-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.workspace-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 11.5px;
}

.ws-label {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ws-value {
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
}

.workspace-row.ok .ws-value {
    color: var(--success);
}

.workspace-row.bad .ws-value {
    color: var(--danger);
}

.workspace-row.muted {
    opacity: 0.55;
}

.workspace-profile {
    margin: 18px 24px 0;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Keyboard shortcuts modal */
.keyboard-modal {
    width: min(880px, 100%);
    max-height: min(88vh, 800px);
    overflow-y: auto;
    padding-bottom: 24px;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 26px;
    padding: 20px 24px 0;
}

.shortcut-section h3 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    margin-bottom: 6px;
}

kbd {
    padding: 4px 7px;
    border-radius: 5px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.shortcut-item span {
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: right;
}

/* Dialog */
.dialog {
    width: min(440px, 100%);
}

.dialog-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 24px 0;
}

.dialog-field .input {
    height: 38px;
}

.dialog .modal-actions {
    padding-top: 20px;
}

/* ---------- Toasts ---------- */
.toast-region {
    position: fixed;
    top: calc(var(--header-h) + 14px);
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(340px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: var(--shadow-pop);
    transform: translateX(12px);
    opacity: 0;
    transition: transform 0.2s var(--ease-out), opacity 0.2s var(--ease);
}

.toast.show {
    transform: none;
    opacity: 1;
}

.toast-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 4px;
    flex-shrink: 0;
}

.toast-success .toast-dot {
    background: var(--success);
}

.toast-error .toast-dot {
    background: var(--danger);
}

.toast-warn .toast-dot {
    background: var(--warning);
}

.toast-message {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.toast-close {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* ---------- Animations ---------- */
@keyframes beat-pulse {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.3; transform: scale(0.85); }
}

@keyframes soft-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes panel-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@keyframes menu-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.99); }
    to { opacity: 1; transform: none; }
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

@keyframes channel-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 999px;
    border: 3px solid var(--bg-soft);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
}

/* ---------- Responsive ---------- */
@media (max-width: 1600px) {
    .mon-chip[data-priority='3'] {
        display: none;
    }
}

@media (max-width: 1400px) {
    .mon-chip[data-priority='2'] {
        display: none;
    }

    .brand-sub {
        display: none;
    }

    .stage {
        padding: 16px 16px 0;
    }

    .pad-grid {
        gap: 8px;
    }
}

@media (max-width: 1180px) {
    :root {
        --side-width: 360px;
    }

    .header-actions .btn-ghost .btn-label {
        display: none;
    }

    .param-slider label {
        width: 88px;
    }
}

@media (max-width: 1100px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .side-panel {
        position: fixed;
        top: var(--header-h);
        right: 0;
        bottom: 0;
        width: min(420px, 92vw);
        z-index: 95;
        transform: translateX(105%);
        transition: transform 0.22s var(--ease);
        box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
    }

    .side-panel.open {
        transform: none;
    }

    .controls-toggle {
        display: inline-flex;
    }

    .side-panel-close {
        display: inline-flex;
    }

    .stage {
        padding-right: 20px;
    }
}

@media (max-width: 900px) {
    .app-header {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 10px;
        padding: 0 12px;
    }

    .monitor-bar {
        display: none;
    }

    .pad-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .stage-head {
        align-items: flex-start;
    }

    .stage-hint {
        display: none;
    }
}

@media (max-width: 720px) {
    .app-header {
        height: auto;
        min-height: var(--header-h);
        grid-template-columns: auto 1fr;
        grid-template-areas:
            'brand actions'
            'tools tools';
        padding: 8px 12px;
        row-gap: 8px;
    }

    .brand { grid-area: brand; }
    .header-tools { grid-area: tools; }
    .header-actions { grid-area: actions; }

    .tempo {
        height: 34px;
    }

    .side-panel {
        top: 0;
        z-index: 110;
    }

    .midi-status {
        height: 34px;
    }

    .app-header .header-actions .btn-label {
        display: none;
    }

    .brand-mark {
        font-size: 17px;
    }

    .stage {
        padding: 12px 12px 0;
    }

    .stage-title {
        font-size: 18px;
    }

    .pad-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 7px;
        padding-right: 0;
    }

    .pad {
        padding: 7px;
    }

    .pad-name {
        font-size: 9.5px;
    }

    .midi-note-row {
        gap: 6px;
    }

    .shortcuts-grid,
    .workspace-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .master-preview {
        width: 120px;
        margin-right: 12px;
    }

    .mixer-channels {
        padding: 10px 12px;
    }

    .toast-region {
        top: 118px;
        right: 12px;
    }
}

@media (max-width: 520px) {
    .midi-status {
        display: none;
    }

    .stage-actions .btn-label {
        display: none;
    }

    .mixer {
        height: 190px;
    }

    .master-preview {
        display: none;
    }

    .modal-shell {
        padding: 12px;
    }

    .modal-head {
        padding: 18px 18px 0;
    }

    .modal-desc {
        padding: 8px 18px 0;
    }

    .modal-actions {
        padding: 16px 18px 18px;
    }

    .shortcuts-grid {
        padding: 16px 18px 0;
    }

    .workspace-progress,
    .workspace-status,
    .workspace-columns,
    .workspace-profile {
        margin-left: 18px;
        margin-right: 18px;
    }

    .dialog-field {
        padding: 14px 18px 0;
    }

    .console-brand {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}