/* Performance Mode Styles - Volumetric-style VJ Interface */

:root {
    --bg-dark: #0a0a0f;
    --bg-panel: #111118;
    --bg-layer: #141420;
    --bg-layer-border: #1e1e30;
    --text-primary: #e4e4e7;
    --text-secondary: #71717a;
    --text-muted: #52525b;
    --accent-primary: #8b5cf6;
    --accent-secondary: #ec4899;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-cyan: #22d3ee;
    --border-color: #27272a;
    --cell-empty: #1a1a28;
    --cell-shader: #2a2a44;
    --cell-active-border: #f59e0b;
    --transition-speed: 0.15s;
    --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ========== BODY ========== */
body.performance-mode {
    background-color: var(--bg-dark) !important;
    background-image: none !important;
    color: var(--text-primary);
    font-family: var(--font-heading);
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100vh;
    height: 100dvh;
    width: 100vw !important;
    max-width: 100vw !important;
}

/* ========== TOP TOOLBAR ========== */
.perf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    min-height: 48px;
    height: auto;
    box-sizing: border-box;
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
}

.perf-sub-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f0f16;
    border-bottom: 1px solid var(--border-color);
    padding: 6px 16px;
    min-height: 40px;
    height: auto;
    box-sizing: border-box;
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
}

.perf-toolbar-left,
.perf-toolbar-center,
.perf-toolbar-right,
.perf-sub-toolbar .perf-toolbar-left,
.perf-sub-toolbar .perf-toolbar-center,
.perf-sub-toolbar .perf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.perf-toolbar-left {
    flex: 1;
}

.perf-toolbar-center {
    flex-shrink: 0;
}

.perf-toolbar-right {
    flex: 1;
    justify-content: flex-end;
}

.tb-separator {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 4px;
}

.tb-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.tb-value {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-primary);
    min-width: 32px;
}

.tb-btn {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.12s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    background: var(--bg-layer);
    color: var(--text-secondary);
}

.tb-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.tb-play-toggle {
    background: var(--accent-success);
    border-color: var(--accent-success);
    color: #fff;
    min-width: 70px;
}

.tb-play-toggle:hover {
    background: #059669;
}

.tb-play-toggle.playing {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.tb-tap {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.3);
    color: var(--accent-cyan);
}

.tb-tap:hover {
    background: rgba(34, 211, 238, 0.25);
}

.tb-tap.flash {
    background: rgba(34, 211, 238, 0.5);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.4);
}

.tb-action {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--accent-primary);
}

.tb-action:hover {
    background: rgba(139, 92, 246, 0.25);
}

.tb-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.tb-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.tb-launch {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: #fff;
    font-weight: 700;
}

.tb-launch:hover {
    opacity: 0.85;
}

.tb-input-number {
    width: 52px;
    padding: 4px 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
}

.tb-input-number:focus {
    border-color: var(--accent-primary);
}

.tb-select {
    padding: 4px 24px 4px 8px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--bg-dark);
    color: var(--accent-cyan);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%2371717a' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.15s;
}

.tb-select:hover {
    border-color: var(--accent-cyan);
    background-color: rgba(34, 211, 238, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%2322d3ee' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E");
}

.tb-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.tb-select option {
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 8px;
}

/* Grouped tempo controls */
.tempo-control-group {
    display: inline-flex;
    align-items: stretch;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    height: 28px;
    transition: all 0.2s;
}

.tempo-control-group:hover {
    border-color: rgba(34, 211, 238, 0.4);
}

.is-playing .tempo-control-group {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.tempo-control-group .tb-select {
    border: none;
    border-radius: 0;
    height: 100%;
    background-color: transparent;
    padding-right: 22px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.tempo-control-group .tb-select:hover {
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.05);
}

.tempo-control-group .tb-input-number {
    border: none;
    border-left: 1px solid var(--border-color);
    border-radius: 0;
    height: 100%;
    background-color: transparent;
    width: 58px;
    padding: 0 4px;
}

.tempo-control-group .tb-input-number:focus {
    background: rgba(139, 92, 246, 0.1);
}

.tb-slider {
    width: 100px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    height: 20px;
}

.tb-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

.tb-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    margin-top: -5px;
    cursor: pointer;
}

/* Nav links in toolbar */
.nav-links {
    display: flex;
    gap: 10px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    transition: color 0.15s;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* ========== MAIN LAYOUT ========== */
.perf-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    width: 100%;
    max-width: 100vw;
}

.perf-layers-area {
    flex: 1 1 0%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    width: 0;
    position: relative;
    /* Added for background positioning */
}

.performance-mode.ui-hidden .perf-bg-output-container {
    pointer-events: auto;
}

.performance-mode.ui-hidden #layers-container,
.performance-mode.ui-hidden .perf-sidebar,
.performance-mode.ui-hidden .toggle-panel-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#layers-container,
.perf-sidebar,
.toggle-panel-btn {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.perf-bg-output-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.perf-bg-output-container canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

#layers-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    position: relative;
    /* Ensure it stays above background */
    z-index: 1;
}

.tb-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* ========== SIDEBARS ========== */
.perf-sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    flex-shrink: 0;
    flex-grow: 0;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

.perf-sidebar-left {
    border-right: 1px solid var(--border-color);
    transition: width 0.2s ease, min-width 0.2s ease, max-width 0.2s ease, opacity 0.2s ease;
}

.perf-sidebar-left.collapsed {
    width: 0;
    min-width: 0;
    max-width: 0;
    overflow: hidden;
    border-right: none;
    opacity: 0;
    padding: 0;
}

.perf-sidebar-right {
    border-left: 1px solid var(--border-color);
    transition: width 0.2s ease, min-width 0.2s ease, max-width 0.2s ease, opacity 0.2s ease;
}

.perf-sidebar-right.collapsed {
    width: 0;
    min-width: 0;
    max-width: 0;
    overflow: hidden;
    border-left: none;
    opacity: 0;
    padding: 0;
}

.toggle-panel-btn {
    position: relative;
    z-index: 10;
    width: 20px;
    min-width: 20px;
    flex-shrink: 0;
    background: var(--bg-panel);
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.toggle-panel-btn:hover {
    background: var(--bg-layer);
    color: var(--accent-primary);
}

.toggle-panel-left {
    border-right: 1px solid var(--border-color);
    border-left: none;
}

.toggle-panel-right {
    border-left: 1px solid var(--border-color);
}

.sidebar-section {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.library-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

.params-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    padding-bottom: 80px;
    /* Increased bottom padding to prevent content from being cut off */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-dark);
}

#params-content-area {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    /* Ensure it grows and stays in flow */
    min-height: min-content;
}

.shader-library-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

.sidebar-section h3 {
    margin: 0 0 8px 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    font-weight: 700;
    font-family: var(--font-mono);
}

#selected-cell-info {
    padding: 10px;
    background: var(--bg-dark);
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
    line-height: 1.4;
}

#selected-cell-info strong {
    color: var(--accent-cyan);
    font-size: 1rem;
    display: block;
    margin-bottom: 2px;
}

.params-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 0 auto;
    /* Allow it to grow with content */
    width: 100%;
}

.params-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.param-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 8px 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.param-tab:hover {
    color: var(--text-primary);
}

.param-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.param-control {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.param-control label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.param-control input[type="range"] {
    width: 100%;
}

/* Search */
#search-shader {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    box-sizing: border-box;
    margin-bottom: 8px;
}

#search-shader:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Shader Library Cards */
.shader-card {
    background-color: #1e1e2e;
    border: 1px solid #3a3a5c;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    transition: transform 0.2s, border-color 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-height: 80px;
    touch-action: manipulation;
}

.shader-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.shader-card:active {
    cursor: grabbing;
    transform: scale(0.98);
}

/* Mobile selected state - glowing purple border to show shader is selected for assignment */
.shader-card.mobile-selected {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.6), inset 0 0 8px rgba(139, 92, 246, 0.15) !important;
    transform: scale(1.03);
}

/* Touch drag cursor */
#touch-drag-cursor {
    position: fixed;
    background: rgba(139, 92, 246, 0.9);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
    z-index: 99999;
    display: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    backdrop-filter: none;
}

.shader-preview {
    width: 100%;
    height: 60px;
    background: #2a2a4a;
    min-height: 60px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shader-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
    -webkit-touch-callout: none;
}

.shader-preview-label {
    position: relative;
    z-index: 0;
    color: #c0c0e0;
    font-size: 0.65rem;
    font-weight: 700;
    text-align: center;
    padding: 0.3rem;
    word-break: break-word;
    line-height: 1.3;
    max-width: 100%;
}

.shader-name {
    padding: 0.35rem 0.25rem;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    color: #d0d0e8;
    background-color: #1a1a2e;
    border-top: 1px solid #3a3a5c;
}

/* ========== LAYER ROW ========== */
.layer-row {
    display: flex;
    background: var(--bg-layer);
    border: 1px solid var(--bg-layer-border);
    border-radius: 8px;
    transition: opacity 0.2s, filter 0.2s, border-color 0.2s;
    min-width: 0;
    width: 100%;
    position: relative;
}

.layer-row.collapsed .layer-controls {
    padding: 4px 8px;
    gap: 4px;
}

.layer-row.collapsed .layer-cells-area {
    display: flex;
    align-items: center;
    padding: 4px;
}

.layer-row.collapsed .grid-cell {
    width: 50px;
    height: 36px;
    min-width: 50px;
}

.layer-row.collapsed .grid-cell-name {
    display: none;
}

.layer-row.collapsed .layer-opacity-row,
.layer-row.collapsed .layer-blend-select,
.layer-row.collapsed .layer-tempo-row,
.layer-row.collapsed .layer-name-row {
    display: none;
}

.layer-row.collapsed .layer-col-buttons {
    display: none;
}

.layer-row.layer-muted {
    opacity: 0.35;
    filter: saturate(0.2);
}

.layer-row.layer-muted .layer-controls {
    border-right-color: rgba(239, 68, 68, 0.3);
}

/* Layer controls (left panel of each row) */
.layer-controls {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 2px solid var(--accent-cyan);
    background: var(--bg-panel);
    box-sizing: border-box;
}

.layer-header {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.layer-name-row {
    width: 100%;
    padding: 2px 0;
}

.layer-label {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.layer-ms-buttons {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.btn-mute,
.btn-solo {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    border: 1px solid;
    text-align: center;
    user-select: none;
}

.btn-mute {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.btn-mute:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-mute.active {
    background: rgba(239, 68, 68, 0.4);
    border-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.btn-solo {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.25);
    color: #eab308;
}

.btn-solo:hover {
    background: rgba(234, 179, 8, 0.2);
}

.btn-solo.active {
    background: rgba(234, 179, 8, 0.4);
    border-color: #eab308;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.4);
}

/* Collapse button */
.btn-collapse {
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    border: 1px solid rgba(34, 211, 238, 0.25);
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent-cyan);
    user-select: none;
    text-align: center;
}

.btn-collapse:hover {
    background: rgba(34, 211, 238, 0.2);
    border-color: var(--accent-cyan);
}

/* Hover delete button (top-right corner of layer row, appears on hover) */
.btn-hover-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    padding: 0;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, background 0.12s;
    z-index: 10;
    line-height: 1;
}

.layer-row:hover .btn-hover-delete {
    opacity: 1;
}

.btn-hover-delete:hover {
    background: rgba(239, 68, 68, 0.5);
    border-color: #ef4444;
}

/* Active shader thumbnail in layer header - click to deselect row */
.layer-active-thumb {
    width: 40px;
    height: 40px;
    min-width: 40px;
    flex-shrink: 0;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(34, 211, 238, 0.4);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(34, 211, 238, 0.15);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.layer-active-thumb:hover {
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.layer-active-thumb::after {
    content: '×';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(239, 68, 68, 0.82);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.layer-active-thumb:hover::after {
    opacity: 1;
}

.layer-active-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.layer-active-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 211, 238, 0.1);
    font-size: 0.55rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    text-transform: uppercase;
}

/* Close (delete) layer button */
.btn-close-layer {
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    user-select: none;
    text-align: center;
    line-height: 1;
}

.btn-close-layer:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}

/* Opacity slider row */
.layer-opacity-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.layer-opacity-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    height: 16px;
}

.layer-opacity-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

.layer-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: var(--accent-cyan);
    margin-top: -4px;
    cursor: pointer;
}

.layer-opacity-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

/* Tempo multiplier row */
.layer-tempo-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tempo-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid rgba(34, 211, 238, 0.15);
    width: 100%;
    justify-content: center;
}

.tempo-btn {
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    min-width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.tempo-btn.tempo-divide {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.tempo-btn.tempo-divide:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}

.tempo-btn.tempo-multiply {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.tempo-btn.tempo-multiply:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: #10b981;
}

.tempo-indicator {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    text-align: center;
    min-width: 34px;
    padding: 3px 6px;
    background: rgba(34, 211, 238, 0.08);
    border-radius: 4px;
    border: 1px solid rgba(34, 211, 238, 0.2);
}

/* Blend mode select */
.layer-blend-select {
    width: 100%;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 5px 6px;
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    outline: none;
}

.layer-blend-select:focus {
    border-color: var(--accent-primary);
}

/* Layer cells area (right side, scrollable horizontally) */
.layer-cells-area {
    flex: 1 1 0%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px;
    display: flex;
    align-items: center;
    min-width: 0;
    width: 0;
}

.layer-cells-grid {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Per-layer column add/remove buttons */
.layer-col-buttons {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-left: 4px;
    flex-shrink: 0;
}

.layer-col-btn {
    padding: 3px 8px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    border: 1px solid;
    user-select: none;
    text-align: center;
    min-width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-col-btn.col-add {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--accent-primary);
}

.layer-col-btn.col-add:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: var(--accent-primary);
}

.layer-col-btn.col-remove {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.layer-col-btn.col-remove:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

/* ========== GRID CELLS ========== */
.grid-cell {
    width: 130px;
    height: 95px;
    background: var(--cell-empty);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    cursor: pointer;
    position: relative;
    transition: all 0.1s;
    overflow: hidden;
    border: 2px solid transparent;
    box-sizing: border-box;
    flex-shrink: 0;
}

.grid-cell:hover {
    border-color: var(--text-secondary);
}

.grid-cell.active {
    border-color: var(--cell-active-border);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.grid-cell.selected {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.grid-cell.has-shader {
    background: var(--cell-shader);
    color: #fff;
}

.grid-cell-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.grid-cell-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 4px 5px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
    box-sizing: border-box;
}

.btn-delete-cell {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    background: rgba(239, 68, 68, 0.75);
    color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    z-index: 25;
    opacity: 0;
    transition: all 0.15s ease;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Hide delete buttons when row is collapsed to avoid accidental clicks */
.layer-row.collapsed .btn-delete-cell,
.layer-row.collapsed .btn-hover-delete {
    display: none !important;
}

.grid-cell:hover .btn-delete-cell {
    opacity: 1;
}

.btn-delete-cell:hover {
    background: #ef4444;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.grid-cell.drag-over {
    border-color: var(--accent-secondary);
    background: rgba(236, 72, 153, 0.15);
}

/* ========== SCROLLBAR ========== */
.perf-layers-area::-webkit-scrollbar,
.layer-cells-area::-webkit-scrollbar,
.shader-library-grid::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.perf-layers-area::-webkit-scrollbar-track,
.layer-cells-area::-webkit-scrollbar-track,
.shader-library-grid::-webkit-scrollbar-track {
    background: transparent;
}

.perf-layers-area::-webkit-scrollbar-thumb,
.layer-cells-area::-webkit-scrollbar-thumb,
.shader-library-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.perf-layers-area::-webkit-scrollbar-thumb:hover,
.layer-cells-area::-webkit-scrollbar-thumb:hover,
.shader-library-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ========== GENERAL SLIDER RESET ========== */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    margin-top: -5px;
    cursor: pointer;
}

/* ========== BUTTON RESET ========== */
button {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: 1px solid transparent;
}

.btn-secondary {
    background: var(--accent-danger);
    color: #fff;
    border: none;
}

.btn-secondary:hover {
    background: #dc2626;
}

/* ========== TEXT INPUT IN TOOLBAR ========== */
.tb-input-text {
    width: 140px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
}

.tb-input-text:focus {
    border-color: var(--accent-primary);
}

/* ========== SESSIONS MODAL ========== */
.perf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.perf-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 480px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.perf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.perf-modal-header h3 {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.sessions-list {
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-layer);
    border: 1px solid var(--bg-layer-border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.session-item:hover {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.08);
}

.session-item-info {
    flex: 1;
    min-width: 0;
}

.session-item-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item-date {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.session-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.session-delete-btn {
    padding: 3px 8px;
    font-size: 0.6rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    transition: all 0.12s;
}

.session-delete-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}

.sessions-empty {
    text-align: center;
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ========== LAYER REORDER BUTTONS ========== */
.layer-reorder-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 4px;
}

.btn-reorder {
    padding: 2px 7px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    border: 1px solid rgba(34, 211, 238, 0.25);
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent-cyan);
    user-select: none;
    text-align: center;
    line-height: 1;
}

.btn-reorder:hover {
    background: rgba(34, 211, 238, 0.25);
    border-color: var(--accent-cyan);
}

.btn-reorder:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ========== LAYER RENAME ========== */
.layer-label-input {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-dark);
    border: 1px solid var(--accent-cyan);
    border-radius: 4px;
    padding: 2px 6px;
    outline: none;
    width: 100px;
}

.layer-label {
    cursor: pointer;
}

.layer-label:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

/* ========== LIBRARY FILTER ========== */
.library-filter-row {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.filter-btn {
    flex: 1;
    font-size: 0.6rem;
    padding: 4px 6px;
    text-align: center;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ========== FULLSCREEN BUTTON ========== */
.tb-fullscreen {
    background: rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.3);
    color: var(--accent-cyan);
    font-size: 1rem;
    padding: 4px 8px;
    line-height: 1;
    flex-shrink: 0;
}

.tb-fullscreen:hover {
    background: rgba(34, 211, 238, 0.25);
    border-color: var(--accent-cyan);
}

/* ========== RENDERPREV TOGGLE ========== */
.renderprev-toggle {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    white-space: nowrap;
    user-select: none;
}

.renderprev-toggle.on {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #10b981 !important;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.2);
}

.renderprev-toggle.off {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #ef4444 !important;
}

/* ========== BUFFER / PASSES SECTION IN PARAMS PANEL ========== */
.param-section {
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.param-section-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-primary);
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.param-buffer-group {
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 6px;
    gap: 4px;
}

.param-buffer-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.param-buffer-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.param-buffer-slot-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--text-secondary);
    width: 24px;
    flex-shrink: 0;
}

.param-buffer-select {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 2px 4px;
    cursor: pointer;
}

.param-buffer-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.param-image-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.param-image-url-input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    padding: 3px 5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.param-image-url-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.param-image-url-input::placeholder {
    color: var(--text-muted);
}

.param-image-clear-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 3px;
    color: #ef4444;
    font-size: 0.6rem;
    padding: 2px 5px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.param-image-clear-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

.param-image-upload-btn {
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 3px;
    color: var(--accent-cyan);
    font-size: 0.65rem;
    padding: 2px 5px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    font-weight: 700;
}

.param-image-upload-btn:hover {
    background: var(--bg-hover);
}

/* Performance Auth Integration */
#perf-auth-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: 10px;
    gap: 8px;
}

#perf-auth-wrapper #auth-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

#perf-auth-wrapper #user-info {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

#perf-auth-wrapper .auth-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0 12px;
    height: 30px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-weight: 700;
}

#perf-auth-wrapper .auth-button:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
}

#perf-auth-wrapper #username-display {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: bold;
    margin-right: 5px;
}

.param-image-upload-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ========== TOUCH DRAG CURSOR ========== */
#touch-drag-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    padding: 8px 14px;
    background: rgba(139, 92, 246, 0.92);
    border: 2px solid var(--accent-primary);
    border-radius: 20px;
    color: #fff;
    font-weight: 700;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.6);
    transform: translate(-50%, -120%);
    display: none;
    white-space: nowrap;
}

/* ========== AUTH IN TOOLBAR ========== */
#perf-auth-wrapper {
    display: flex;
    align-items: center;
}

/* Force static positioning when inside performance toolbar */
.perf-toolbar #auth-container {
    position: static !important;
    top: auto !important;
    right: auto !important;
    z-index: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.perf-toolbar .auth-buttons {
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

/* Hide the icon used in global header/floating mode */
.perf-toolbar .auth-icon {
    display: none !important;
}

/* Force controls/user-info to be visible and horizontal */
.perf-toolbar .auth-controls,
.perf-toolbar .user-info {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    min-width: 0 !important;
}

/* Hide the little triangle arrow */
.perf-toolbar .auth-controls::before,
.perf-toolbar .user-info::before {
    display: none !important;
}

/* Style the buttons to look like toolbar buttons */
.perf-toolbar .auth-button {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.12s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    background: var(--bg-layer);
    color: var(--text-secondary);
    width: auto !important;
    gap: 6px;
    text-transform: uppercase;
    justify-content: center;
}

.perf-toolbar .auth-button:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
    background: var(--bg-layer);
    transform: none !important;
    box-shadow: none !important;
}

.perf-toolbar .username-display {
    color: var(--accent-primary) !important;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 8px;
    border: none !important;
    padding: 0 !important;
    width: auto !important;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    text-shadow: none !important;
    background: transparent !important;
}

/* SVG icons in buttons */
.perf-toolbar .auth-button svg {
    width: 12px;
    height: 12px;
}

/* Nested Collapsible Sections for Parameters */
.param-section-collapsible {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
}

.param-section-collapsible[open] {
    padding-bottom: 0px;
}

.param-section-title {
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-primary) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    border-bottom: 1px solid transparent;
}

.param-section-title::-webkit-details-marker {
    display: none;
}

.param-section-collapsible[open] .param-section-title {
    border-bottom-color: var(--border-color);
}

.pass-collapsible {
    margin: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.02);
}

.pass-summary {
    padding: 6px 10px;
    cursor: pointer;
    list-style: none !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pass-summary::-webkit-details-marker {
    display: none;
}

.caret {
    display: inline-block;
    transition: transform 0.15s ease-out;
    font-size: 10px;
    width: 12px;
    text-align: center;
    color: var(--text-secondary);
}

details[open]>summary .caret {
    transform: rotate(90deg);
}

.pass-content {
    padding: 2px 12px 12px 12px;
}

.param-buffer-group {
    margin-bottom: 0px !important;
    border: none !important;
    background: none !important;
}

/* ========== DRAG AND DROP HIGHLIGHTS ========== */
.grid-cell.drag-over {
    border-color: var(--accent-cyan) !important;
    background: rgba(34, 211, 238, 0.2);
    box-shadow: inset 0 0 10px rgba(34, 211, 238, 0.3);
}

.layer-row.drag-over-row {
    border-color: var(--accent-primary) !important;
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
    z-index: 5;
}

/* ========== NAVIGATION LINKS ========== */
.perf-nav-links {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.tb-nav-link {
    font-size: 0.9rem !important;
    padding: 4px 8px !important;
    text-decoration: none !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.tb-nav-link:hover {
    background: rgba(139, 92, 246, 0.2) !important;
    border-color: var(--accent-primary) !important;
}

/* ========== MOBILE HELPERS ========== */
.perf-mobile-only {
    display: none !important;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {

    .perf-hide-mobile {
        display: none !important;
    }

    .perf-mobile-only {
        display: flex !important;
    }

    button.perf-mobile-only,
    a.perf-mobile-only {
        display: inline-flex !important;
    }

    /* === TOOLBAR === */
    .perf-toolbar {
        height: auto;
        min-height: 44px;
        padding: 6px 8px;
        gap: 6px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .perf-toolbar-left {
        flex: 1;
        gap: 4px;
        overflow: hidden;
    }

    .perf-nav-links {
        gap: 2px;
    }

    .tb-nav-link {
        font-size: 0.8rem !important;
        padding: 4px 6px !important;
    }

    #play-toggle-btn {
        min-width: 55px;
        font-size: 0.65rem;
        padding: 5px 8px;
    }

    #bpm-input {
        width: 42px;
        font-size: 0.7rem;
        padding: 3px 4px;
    }

    #tap-btn {
        font-size: 0.65rem;
        padding: 4px 8px;
    }

    #perf-mobile-menu-btn {
        font-size: 1rem;
        padding: 4px 8px;
        flex-shrink: 0;
    }

    /* === MOBILE COLLAPSIBLE TOOLBAR === */
    .perf-mobile-toolbar {
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border-color);
        padding: 8px;
        flex-direction: column;
        gap: 8px;
        flex-shrink: 0;
    }

    .perf-mobile-toolbar-row {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
    }

    .perf-mobile-toolbar-row .tb-input-number {
        width: 48px;
    }

    .perf-mobile-toolbar-row .tb-btn {
        flex: 1;
        justify-content: center;
        font-size: 0.65rem;
        padding: 6px 4px;
    }

    .perf-mobile-toolbar-row .tb-input-text {
        flex: 1;
        width: auto;
    }

    /* === MOBILE TABS === */
    .perf-mobile-tabs {
        display: flex !important;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border-color);
        gap: 0;
        flex-shrink: 0;
    }

    .perf-mobile-tab {
        flex: 1;
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        color: var(--text-secondary);
        padding: 10px 6px;
        font-family: var(--font-mono);
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        cursor: pointer;
        transition: all 0.2s;
        text-align: center;
        white-space: nowrap;
    }

    .perf-mobile-tab:hover {
        color: var(--text-primary);
    }

    .perf-mobile-tab.active {
        color: var(--accent-primary);
        border-bottom-color: var(--accent-primary);
        background: rgba(139, 92, 246, 0.08);
    }

    /* === MAIN LAYOUT === */
    .perf-main {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        position: relative;
        background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.05), transparent),
            radial-gradient(circle at bottom left, rgba(236, 72, 153, 0.05), transparent);
    }

    /* Hide desktop toggle buttons */
    .toggle-panel-btn {
        display: none !important;
    }

    /* === SIDEBARS => FULL WIDTH PANELS === */
    .perf-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        display: none !important;
    }

    .perf-sidebar.mobile-active {
        display: flex !important;
        flex: 1;
        overflow: hidden !important;
        /* Prevent nested scrollbars */
    }

    /* Library full height on mobile */
    .perf-sidebar.mobile-active .library-section,
    .perf-sidebar.mobile-active .params-section {
        flex: 1;
        overflow-y: auto !important;
        /* Allow scrolling on mobile */
        padding: 12px 12px 100px 12px !important;
    }

    /* === LAYERS AREA === */
    .perf-layers-area {
        display: none;
        width: 100%;
        flex: 1;
        padding: 10px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .perf-layers-area.mobile-active {
        display: flex;
        flex-direction: column;
        height: 100%;
        padding-bottom: 100px !important;
    }

    /* === LAYER ROW PREMIUM MOBILE === */
    .layer-row {
        flex-direction: column;
        border-radius: 12px;
        background: rgba(30, 30, 50, 0.4);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: 1px solid rgba(255, 255, 255, 0.08);
        margin-bottom: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        transition: transform 0.2s, border-color 0.2s;
    }

    .layer-row:active {
        transform: scale(0.99);
    }

    .layer-controls {
        width: 100%;
        min-width: 100%;
        padding: 12px;
        gap: 10px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "header header"
            "name name"
            "opacity opacity"
            "blend ms"
            "tempo tempo";
        background: rgba(0, 0, 0, 0.2);
    }

    .layer-header {
        grid-area: header;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2px;
    }

    .layer-name-row {
        grid-area: name;
        margin: 0;
    }

    .layer-label {
        font-size: 0.9rem;
        font-weight: 800;
        color: var(--accent-cyan);
        text-shadow: 0 0 8px rgba(34, 211, 238, 0.3);
    }

    .layer-active-thumb {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border: 2px solid rgba(139, 92, 246, 0.5);
    }

    .layer-opacity-row {
        grid-area: opacity;
        display: flex;
        align-items: center;
        gap: 10px;
        background: rgba(255, 255, 255, 0.03);
        padding: 6px 10px;
        border-radius: 8px;
    }

    .layer-opacity-slider {
        flex: 1;
        height: 30px;
    }

    .layer-opacity-value {
        font-size: 0.8rem;
        min-width: 35px;
        color: var(--accent-primary);
        font-weight: 700;
    }

    .layer-blend-select {
        grid-area: blend;
        font-size: 0.75rem;
        padding: 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 6px;
        width: 100%;
    }

    /* Reuse M/S buttons and tempo but more compact */
    .layer-ms-buttons {
        grid-area: ms;
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
    }

    .btn-close-layer {
        background: rgba(239, 68, 68, 0.1) !important;
        border: 1px solid rgba(239, 68, 68, 0.3) !important;
        color: #ef4444 !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem !important;
        padding: 0 !important;
        margin-left: auto;
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
    }

    .layer-tempo-row {
        grid-area: tempo;
        margin-top: 4px;
        background: rgba(255, 255, 255, 0.05);
        padding: 8px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .tempo-controls-wrapper {
        justify-content: space-between;
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .btn-mute,
    .btn-solo {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 8px;
        flex: 1;
        margin: 0;
        text-transform: uppercase;
        font-weight: 800;
    }

    .btn-mute.active {
        background: #ef4444 !important;
        color: white !important;
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    }

    .btn-solo.active {
        background: #eab308 !important;
        color: white !important;
        box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
    }

    .tempo-btn {
        padding: 8px 10px;
        height: 36px;
        font-size: 0.75rem;
        min-width: 46px;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 6px;
        color: var(--text-primary);
    }

    .tempo-indicator {
        font-size: 0.7rem;
        min-width: 35px;
    }

    /* Layer cells area - more compact */
    .layer-cells-area {
        padding: 8px 6px;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        display: block !important;
        min-height: 110px;
        /* Reduced to be more compact */
        background: rgba(0, 0, 0, 0.25);
        -webkit-overflow-scrolling: touch;
        width: 100%;
        box-sizing: border-box;
    }

    .layer-cells-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px;
        width: max-content !important;
        /* Critical to prevent collapsing */
        height: 85px;
        /* Shorter for more compactness */
        align-items: stretch;
    }

    /* Grid cells - ultra compact for mobile */
    .grid-cell {
        width: 115px !important;
        height: 80px !important;
        min-width: 115px !important;
        flex-shrink: 0 !important;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        background: #0d0d15;
        position: relative;
        overflow: hidden !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    }

    /* FORCE visibility of images and their containers */
    .grid-cell div {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0;
        left: 0;
        display: block !important;
    }

    .grid-cell img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .grid-cell.active-step {
        border: 2px solid var(--accent-primary) !important;
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
        transform: scale(1.02);
        z-index: 2;
    }

    /* Ensure names are visible and contrasty */
    .grid-cell-name {
        position: absolute !important;
        bottom: 0;
        left: 0;
        width: 100%;
        font-size: 0.65rem !important;
        padding: 4px 6px !important;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%) !important;
        font-weight: 800 !important;
        color: #fff !important;
        z-index: 50 !important;
        /* Force to top */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        box-sizing: border-box;
        pointer-events: none;
    }

    /* Better collapsed row for mobile */
    .layer-row.collapsed .layer-controls {
        grid-template-areas: "header name blend" !important;
        grid-template-columns: auto 1fr 100px !important;
        align-items: center !important;
        padding: 4px 10px !important;
        border-bottom: none !important;
        gap: 10px !important;
    }

    .layer-row.collapsed .layer-name-row {
        display: block !important;
        grid-area: name;
        margin: 0 !important;
    }

    .layer-row.collapsed .layer-name-row .layer-label-input {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        font-size: 0.85rem !important;
    }

    .layer-row.collapsed .layer-blend-select {
        display: block !important;
        grid-area: blend;
        padding: 4px !important;
        font-size: 0.7rem !important;
    }

    .layer-row.collapsed .layer-opacity-row,
    .layer-row.collapsed .layer-ms-buttons,
    .layer-row.collapsed .layer-tempo-row {
        display: none !important;
    }

    /* Collapsed row refined cells area */
    .layer-row.collapsed .layer-cells-area {
        min-height: 60px !important;
        padding: 4px 6px !important;
    }

    .layer-row.collapsed .grid-cell {
        width: 85px !important;
        height: 50px !important;
        min-width: 85px !important;
    }

    /* === MOBILE TABS DASHBOARD STYLE - FIXED TO BOTTOM === */
    .perf-mobile-tabs {
        display: flex !important;
        position: fixed;
        bottom: 12px;
        left: 12px;
        right: 12px;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: none;
        padding: 6px;
        border-radius: 18px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
        z-index: 1000;
        margin: 0;
    }

    .perf-mobile-tab {
        flex: 1;
        padding: 12px 4px;
        border-radius: 14px;
        border: none !important;
        font-size: 0.75rem;
        font-weight: 700;
        color: var(--text-secondary);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .perf-mobile-tab.active {
        background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
        color: white;
        box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5);
    }

    /* === LAUNCH BUTTON MOBILE REFINEMENT === */
    .tb-launch {
        background: linear-gradient(135deg, #f59e0b, #d97706) !important;
        color: white !important;
        font-weight: 800 !important;
        border-radius: 12px !important;
        padding: 10px 16px !important;
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    }

    #launch-output-btn {
        margin-right: 8px;
    }

    /* === SELECTED SHADER INDICATOR MOBILE === */
    #mobile-shader-indicator {
        bottom: 95px !important;
        /* Above bottom tabs */
        background: rgba(139, 92, 246, 0.95) !important;
        backdrop-filter: none !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        padding: 14px 24px !important;
        border-radius: 30px !important;
        font-size: 14px !important;
        box-shadow: 0 10px 30px rgba(139, 92, 246, 0.6) !important;
        animation: slideUpPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    @keyframes slideUpPulse {
        from {
            transform: translate(-50%, 50px);
            opacity: 0;
        }

        to {
            transform: translate(-50%, 0);
            opacity: 1;
        }
    }

    .ind-hint {
        color: rgba(255, 255, 255, 0.8) !important;
        display: block;
        margin-top: 2px;
    }

    /* Adjust main content for bottom tabs */
    .perf-main {
        padding-bottom: 90px;
    }

    /* === PARAMS PANEL MOBILE === */
    .params-tabs {
        gap: 0;
    }

    .param-tab {
        font-size: 0.6rem;
        padding: 8px 4px;
    }

    #selected-cell-info {
        font-size: 0.8rem;
        padding: 8px;
    }

    .param-control label {
        font-size: 0.65rem;
    }

    .param-control input[type="range"] {
        height: 24px;
    }

    .param-control input[type="range"]::-webkit-slider-thumb {
        height: 18px;
        width: 18px;
    }

    /* === SHADER LIBRARY CARDS MOBILE REFINED === */
    .shader-library-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 8px;
    }

    .shader-card {
        min-height: 140px;
        /* Much taller for visibility */
        border-radius: 12px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }

    .shader-preview {
        height: 100px;
        /* Solid height for thumbnails */
        min-height: 100px;
        background: #000;
    }

    .shader-name {
        font-size: 0.75rem;
        padding: 8px 4px;
        font-weight: 700;
        text-align: center;
    }

    /* === MODAL MOBILE === */
    .perf-modal {
        width: 95vw;
        max-height: 80vh;
    }

    .perf-modal-header {
        padding: 10px 12px;
    }

    .session-item {
        padding: 8px 10px;
        gap: 8px;
    }

    /* === SEARCH === */
    #search-shader {
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    /* === FILTER === */
    .lib-filter-btn {
        font-size: 0.6rem;
        padding: 6px 4px;
    }

    .lib-tab {
        padding: 6px 4px;
    }

    .lib-tab-label {
        font-size: 0.65rem;
        font-weight: 600;
    }

    /* === FX PANEL === */
    .fx-drop-zone {
        padding: 12px;
    }

    .fx-item {
        padding: 6px 8px;
    }

    /* Hide all desktop/redundant delete buttons on mobile */
    .btn-hover-delete,
    .layer-delete-btn,
    .btn-reorder,
    .layer-reorder-buttons {
        display: none !important;
    }

    .btn-delete-cell {
        opacity: 1 !important;
        background: rgba(239, 68, 68, 0.5) !important;
        border-radius: 4px !important;
        z-index: 110 !important;
    }

    /* Hide delete buttons on mobile when collapsed */
    .layer-row.collapsed .btn-delete-cell,
    .layer-row.collapsed .btn-close-layer {
        display: none !important;
    }

    /* === MOBILE SEQUENCER HEADER (NEW STICKY) === */
    #mobile-sequencer-header {
        position: sticky !important;
        top: -1px !important;
        z-index: 500 !important;
        margin-bottom: 6px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
        border-radius: 0 0 12px 12px !important;
    }

    #mobile-sequencer-header .tb-btn {
        padding: 10px 4px !important;
        font-weight: 800;
        border-radius: 8px;
        letter-spacing: 0.05em;
    }

    /* === MOBILE TOOLBAR STYLING === */
    .perf-mobile-toolbar {
        background: rgba(15, 23, 42, 0.98) !important;
        backdrop-filter: none;
        padding: 16px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    .perf-mobile-toolbar-row {
        gap: 12px !important;
        margin-bottom: 12px;
    }

    /* === COMPACTNESS FIXES === */
    .layer-row {
        margin-bottom: 8px !important;
        padding: 6px !important;
        background: rgba(20, 20, 32, 0.98) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px !important;
    }

    .layer-controls {
        padding: 4px 8px !important;
        border-bottom: none !important;
    }

    /* Better collapsed row for mobile - ULTRA COMPACT */
    .layer-row.collapsed .layer-controls {
        grid-template-areas: "header name blend" !important;
        grid-template-columns: auto 1fr 100px !important;
        align-items: center !important;
        padding: 2px 8px !important;
        gap: 10px !important;
    }

    .layer-row.collapsed .layer-name-row {
        display: block !important;
        grid-area: name;
        margin: 0 !important;
    }

    .layer-row.collapsed .layer-label-input {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        font-size: 0.85rem !important;
        color: var(--accent-primary) !important;
        font-weight: 700 !important;
    }

    .layer-row.collapsed .layer-label {
        font-size: 0.85rem !important;
        color: var(--accent-primary) !important;
    }

    .layer-row.collapsed .layer-blend-select {
        display: block !important;
        grid-area: blend;
        padding: 2px 4px !important;
        font-size: 0.7rem !important;
        height: 26px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .layer-row.collapsed .layer-cells-area {
        min-height: 50px !important;
        padding: 2px 6px !important;
        margin-top: 2px !important;
    }

    .layer-row.collapsed .grid-cell {
        width: 80px !important;
        height: 45px !important;
        min-width: 80px !important;
    }

    /* Ensure shader names on cells are highly visible */
    .grid-cell-name {
        z-index: 100 !important;
        font-size: 0.65rem !important;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.4) 80%, transparent 100%) !important;
        padding: 4px 6px !important;
    }

    /* === CHAT SECTION === */
    .chat-panel {
        padding: 4px;
    }

    /* === REORDER BUTTONS === */
    .layer-reorder-buttons {
        flex-direction: row;
        gap: 4px;
    }

    .btn-reorder {
        padding: 4px 8px;
    }

    /* === LAYER NAME ROW === */
    .layer-name-row .layer-label-input {
        width: 100%;
    }
}


/* === RADIAL QUICK MENU === */
.qm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: none;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qm-overlay.active {
    display: block;
    opacity: 1;
}

#shader-quick-menu {
    position: fixed;
    z-index: 10000;
    width: 220px;
    height: 220px;
    pointer-events: none;
    display: none;
    user-select: none;
    transform: translate(-50%, -50%);
}

#shader-quick-menu.active {
    display: block;
    pointer-events: auto;
}

.qm-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.7);
    z-index: 10;
    animation: qmCenterFade 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.qm-item {
    position: absolute;
    width: 70px;
    height: 70px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

#shader-quick-menu.active .qm-item {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.qm-item-sequencer {
    top: 15%;
    left: 50%;
}

.qm-item-layer-fx {
    top: 75%;
    left: 15%;
}

.qm-item-global-fx {
    top: 75%;
    left: 85%;
}

.qm-item:active {
    background: #8b5cf6;
    transform: translate(-50%, -50%) scale(1.15) !important;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.8);
    border-color: rgba(255, 255, 255, 0.6);
}

.qm-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.qm-label {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    line-height: 1;
}

@keyframes qmCenterFade {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.qm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: none;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qm-overlay.active {
    display: block;
    opacity: 1;
}

#shader-quick-menu {
    position: fixed;
    z-index: 10000;
    width: 220px;
    height: 220px;
    pointer-events: none;
    display: none;
    user-select: none;
    transform: translate(-50%, -50%);
}

#shader-quick-menu.active {
    display: block;
    pointer-events: auto;
}

.qm-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.7);
    z-index: 10;
    animation: qmCenterFade 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.qm-item {
    position: absolute;
    width: 70px;
    height: 70px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

#shader-quick-menu.active .qm-item {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.qm-item-sequencer {
    top: 15%;
    left: 50%;
}

.qm-item-layer-fx {
    top: 75%;
    left: 15%;
}

.qm-item-global-fx {
    top: 75%;
    left: 85%;
}

.qm-item:active {
    background: #8b5cf6;
    transform: translate(-50%, -50%) scale(1.15) !important;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.8);
    border-color: rgba(255, 255, 255, 0.6);
}

.qm-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.qm-label {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    line-height: 1;
}

@keyframes qmCenterFade {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}