/* ========================================
   Music Visualizer V2 — App Styles
   DEPENDENCY: design-system.css MUST be loaded before this file.
   ======================================== */

/* Legacy aliases for backward compatibility with visualizer.js/fx.js
   All new code should use design-system tokens directly. */
:root {
    --bg: var(--color-void);
    --glass-bg: var(--glass-bg);
    --glass-border: var(--glass-border);
    --text-primary: var(--color-stardust);
    --text-secondary: var(--color-comet);
    --accent: var(--color-violet);
    --accent-glow: var(--color-violet-glow);
    --transition-fast: var(--ease-normal);
    --transition-spring: var(--ease-spring);
    --transition-smooth: var(--ease-luxury);
}

body {
    background: var(--color-void);
    color: var(--color-stardust);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    cursor: default;
}

/* Hide cursor only when interactively requested (idle) */
body.hide-cursor {
    cursor: none;
}

/* Force UI elements to ALWAYS show cursor */
.landing-screen,
.controls-overlay,
.controls-overlay,
.drop-overlay {
    cursor: default;
}

/* Ensure interactive elements have pointers */
button,
label,
input {
    cursor: pointer;
}

/* ---- Canvas ---- */
#visualizer-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    background: #000;
    transition: opacity 0.8s var(--ease-luxury), visibility 0.8s var(--ease-luxury);
    overflow: hidden;
}

/* Visualizer stays full screen behind the dashboard HUD */

#visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ---- Premium Landing Screen ---- */
.landing-screen {
    position: absolute;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-void);
    overflow: hidden;
    transition: opacity var(--ease-dramatic), visibility var(--ease-dramatic);
}

.landing-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.05);
}

/* Fullscreen Particle Canvas (Landing) */
#particle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.landing-content {
    position: relative;
    z-index: 20;
    width: 100%;
    max-width: 1200px;
    padding: 0 var(--space-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xl);
}

.landing-hero {
    text-align: center;
    animation: fadeInUp var(--ease-dramatic) forwards;
}

.hero-badge {
    display: inline-block;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-violet-subtle);
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: var(--radius-pill);
    color: var(--color-violet);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    margin-bottom: var(--space-lg);
    backdrop-filter: blur(5px);
}

.landing-title-premium {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: var(--weight-light);
    margin-bottom: var(--space-md);
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.05em;
    min-height: 1.5em;
    overflow: hidden;
    padding-top: 20px;
}

/* Base styles for individual letters */
.landing-title-premium .letter {
    display: inline-flex;
    background: linear-gradient(to right, var(--color-stardust) 10%, var(--color-violet) 50%, var(--color-stardust) 90%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    line-height: 1.2;
    transform-origin: bottom center;
    will-change: transform, opacity, filter;

    /* Unique animation using the CSS variable --i defined in HTML */
    animation:
        letterReveal 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards,
        letterShine 8s linear infinite,
        letterBreathe 6s ease-in-out infinite alternate;

    /* Stagger the start time of the animations based on the letter index */
    animation-delay: calc(0.06s * var(--i)), calc(0.06s * var(--i) + 0.8s), calc(0.5s * var(--i) + 0.8s);
}

@keyframes letterShine {
    to {
        background-position: 200% center;
    }
}

@keyframes letterBreathe {
    0% {
        text-shadow: 0 0 0px var(--color-violet-glow);
        transform: translateY(0);
    }

    100% {
        text-shadow: 0 0 15px var(--color-violet-glow);
        transform: translateY(-5px) scale(1.02);
    }
}

@keyframes letterReveal {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(20px) rotateX(-90deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
    }
}


.landing-subtitle {
    font-family: var(--font-body);
    font-size: var(--text-md);
    font-weight: var(--weight-light);
    color: var(--color-comet);
    letter-spacing: var(--tracking-wider);
    max-width: 600px;
    margin: 0 auto;
    line-height: var(--leading-relaxed);
}

/* CTA Grid */
.cta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    width: 100%;
}

.cta-card {
    position: relative;
    border-radius: var(--radius-2xl);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: all var(--ease-luxury);
    cursor: pointer;
    opacity: 0;
    animation: cardReveal var(--ease-dramatic) forwards;
}

.cta-card:nth-child(1) {
    animation-delay: 0.8s;
}

.cta-card:nth-child(2) {
    animation-delay: 0.9s;
}

.cta-card:nth-child(3) {
    animation-delay: 1.0s;
}

@keyframes cardReveal {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
        filter: blur(5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}


.cta-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--glass-border-active);
    transform: translateY(-8px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.cta-card.featured {
    background: linear-gradient(135deg, var(--color-violet-subtle) 0%, rgba(255, 255, 255, 0.03) 100%);
    border-color: rgba(167, 139, 250, 0.3);
}

.cta-card.featured:hover {
    border-color: var(--color-violet);
    box-shadow: 0 0 50px var(--color-violet-glow);
}

.cta-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2xl) var(--space-xl);
    height: 100%;
    text-align: center;
    gap: var(--space-md);
}

.cta-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    color: var(--color-stardust);
    margin-bottom: var(--space-sm);
    transition: all var(--ease-luxury);
}

.cta-card:hover .cta-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--color-violet);
    color: var(--color-void);
}

.cta-icon.featured-icon {
    background: var(--color-violet);
    color: var(--color-void);
    box-shadow: var(--shadow-glow);
}

.cta-card h3 {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-wide);
}

.cta-card p {
    font-size: var(--text-sm);
    color: var(--color-comet);
    line-height: var(--leading-normal);
}

.cta-button {
    margin-top: auto;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    transition: all var(--ease-smooth);
}

.cta-card:hover .cta-button {
    background: var(--color-stardust);
    color: var(--color-void);
}

.cta-button.primary {
    background: var(--color-violet);
    color: var(--color-void);
}

.cta-card.featured:hover .cta-button.primary {
    background: var(--color-stardust);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

/* Extra Actions */
.extra-actions {
    display: flex;
    gap: var(--space-xl);
}

.extra-actions>.minimal-btn:nth-child(1) {
    animation-delay: 1s;
}

.extra-actions>.minimal-btn:nth-child(2) {
    animation-delay: 1.1s;
}

.extra-actions>.minimal-btn:nth-child(3) {
    animation-delay: 1.2s;
}

.rec-ready-lp.active {
    color: var(--color-danger) !important;
    opacity: 1 !important;
}

.rec-ready-lp.active .rec-dot-inner {
    background: var(--color-danger);
    box-shadow: 0 0 10px var(--color-danger);
    animation: rec-blink 1s infinite alternate;
}

.rec-ready-lp.active span {
    text-shadow: 0 0 10px var(--color-danger-glow);
}


.minimal-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: none;
    color: var(--color-comet);
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    transition: color var(--ease-smooth);
    opacity: 0;
    animation: cardReveal var(--ease-dramatic) forwards;
}

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

/* Landing Logo (Centered) */
.landing-logo-container {
    position: absolute;
    bottom: var(--space-2xl);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-nav);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80px;
}

.landing-logo {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.8;
    filter: brightness(0) invert(1);
    transition: all 0.8s var(--transition-smooth);
}

.landing-logo-link,
.mobile-logo-link {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.landing-logo-link:hover,
.mobile-logo-link:hover {
    opacity: 0.7;
}

.landing-screen:hover .landing-logo {
    opacity: 0.8;
}

@keyframes fadeInLogo {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* Dual Logo Layout for Landing Section */
.dual-logo-layout {
    width: auto !important;
    gap: var(--space-lg);
}

.dual-logo-layout .landing-logo {
    width: auto;
    height: 48px;
    opacity: 0.8;
    animation: fadeInLogo 1.5s ease 1.3s forwards both;
}

.dual-logo-layout .logo-divider {
    color: var(--glass-border-hover);
    font-size: var(--text-4xl);
    font-weight: var(--weight-light);
    font-family: var(--font-heading);
    animation: fadeInLogo 1.5s ease 1.4s forwards both;
}

.dual-logo-layout .yebura-icon {
    height: 40px;
}


@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 900px) {
    .cta-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .landing-content {
        gap: 2rem;
        padding-top: 4rem;
        padding-bottom: 8rem;
        overflow-y: auto;
    }

    .landing-title-premium {
        font-size: 4rem;
    }
}

/* ---- Drop Overlay ---- */
.drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px dashed var(--accent);
    transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.drop-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.drop-message {
    text-align: center;
    color: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

.drop-message p {
    margin-top: 1rem;
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* ---- Floating Logo ---- */
.floating-logo {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: auto;
    /* Auto height for image */
    max-width: 80%;
    z-index: 10;
    opacity: 0.9;
    pointer-events: none;
}

/* ---- Pattern Label (center overlay) ---- */
.pattern-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 60;
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0);
    text-shadow: 0 0 30px var(--accent-glow);
    pointer-events: none;
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

.pattern-label.show {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(96, 165, 250, 0.2);
}



/* ---- Controls Overlay ---- */
.controls-overlay {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 1.25rem 1.5rem;
    background: transparent;
    transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.controls-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.controls-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 0.75rem;
    border-radius: 3rem;
    background: rgba(10, 10, 15, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(40px) saturate(220%);
    -webkit-backdrop-filter: blur(40px) saturate(220%);
    transition: all var(--transition-smooth);
}

/* Bar Sections */
.bar-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.bar-playback {
    flex: 1;
    min-width: 0;
}

.bar-source,
.bar-tools {
    flex-shrink: 0;
}

.bar-recording {
    flex-shrink: 0;
}

.menu-divider {
    width: 1px;
    height: 24px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.12), transparent);
    flex-shrink: 0;
    margin: 0 0.25rem;
}

.ctrl-btn {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
    /* Important for centering */
}

.ctrl-btn .hidden {
    display: none !important;
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.ctrl-btn.active {
    color: var(--accent);
    background: rgba(167, 139, 250, 0.2);
    box-shadow: 0 0 15px var(--accent-glow);
}

.ctrl-btn:focus {
    outline: none;
}


.play-btn {
    position: relative;
}

.play-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.play-btn #icon-play {
    margin-left: 3px;
    /* visual center push */
}

/* Pause icon is geometrically centered by purely absolute positioning */
.play-btn #icon-pause {
    margin: 0;
}

/* ---- Track Info ---- */
.track-info {
    flex-shrink: 1;
    min-width: 0;
    padding: 0 0.25rem;
}

#track-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

/* ---- Progress Bar ---- */
.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.time-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 2.5em;
}

.progress-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: height var(--transition-fast);
}

.progress-bar:hover {
    height: 6px;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), #60a5fa);
    width: 0%;
    transition: width 0.1s linear;
}

/* ---- Dynamics Slider ---- */
/* ---- Dynamics Slider & Volume Control ---- */
.dynamics-control,
.volume-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.5rem;
    flex-shrink: 0;
}

.dynamics-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dynamics-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dynamics-slider:hover {
    background: rgba(255, 255, 255, 0.18);
}

.dynamics-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.dynamics-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 16px var(--accent-glow);
}

.dynamics-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px var(--accent-glow);
}

.dynamics-value {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 2.5em;
    text-align: right;
}

/* ---- Auto-Rotation Toggle (old styles removed — unified in dashboard section) ---- */

.auto-rotate-label {
    font-size: 0.65rem;
    letter-spacing: 0.04em;
}

/* ---- Auto FX Toggle Style ---- */
.toggle-row {
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: all var(--transition-fast);
}

.toggle-row:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.auto-fx-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.auto-fx-toggle input {
    display: none;
}

.toggle-track {
    position: relative;
    width: 32px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.35, 1.15);
}

.auto-fx-toggle input:checked+.toggle-track {
    background: var(--accent);
}

.auto-fx-toggle input:checked+.toggle-track::after {
    transform: translateX(14px);
}

.auto-fx-toggle:hover .toggle-track {
    background: rgba(255, 255, 255, 0.2);
}

.auto-fx-toggle input:checked:hover+.toggle-track {
    background: var(--accent-glow);
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ---- Utilities ---- */
.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes breathing-bg {
    0% {
        background-size: 100% 100%;
        filter: brightness(1);
    }

    100% {
        background-size: 120% 120%;
        filter: brightness(1.2);
    }
}

/* Micro-Interactions */
button:active,
.ctrl-btn:active,
.pattern-dot:active {
    transform: scale(0.95);
}




/* ---- Responsive ---- */
@media (max-width: 640px) {
    .landing-title {
        font-size: 2rem;
    }

    .controls-bar {
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }

    .track-info {
        display: none;
    }

    .dynamics-control {
        display: none;
    }



    .pattern-label {
        font-size: 1rem;
    }
}

/* ---- Auto-Hide State ---- */
body.hide-cursor {
    cursor: none;
}

body.hide-cursor:not(.recording) .controls-overlay,
body.modal-open .controls-overlay {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(20px);
}

/* Ensure controls are visible when recording, regardless of mouse movement or dashboard */
body.recording .controls-overlay {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}



.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Firefox */
.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
}

/* Volume Button (Mute) */
.volume-btn,
.speed-btn,
.dynamics-btn {
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
}

.volume-btn svg,
.speed-btn svg,
.dynamics-btn svg {
    pointer-events: none;
}


/* ---- Volume Vertical Popup ---- */
.volume-control,
.dynamics-control {
    position: relative;
}

.volume-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 36px;
    height: 110px;
    background: rgba(20, 20, 30, 0.9);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
    padding: 10px 0 15px 0;
    pointer-events: none;
}

/* Invisible bridge to prevent hover gap */
.volume-popup::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    right: 0;
    height: 15px;
}

.volume-control:hover .volume-popup,
.volume-control:focus-within .volume-popup,
.dynamics-control:hover .volume-popup,
.dynamics-control:focus-within .volume-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Vertical Slider via Rotation */
.volume-slider-vertical {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    /* Length when rotated */
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
    transform: rotate(-90deg);
}

/* ---- Speed Control (Copied from Volume) ---- */
.speed-control {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
}





.speed-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 36px;
    height: 110px;
    background: rgba(20, 20, 30, 0.9);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
    padding: 10px 0 15px 0;
}

/* Bridge */
.speed-popup::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    right: 0;
    height: 15px;
}

.speed-control:hover .speed-popup,
.speed-control:focus-within .speed-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.speed-slider-vertical {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
    transform: rotate(-90deg);
}

#speed-value {
    width: 48px;
    /* Fixed width to prevent layout shift between 'Random' and '32 Bars' */
    text-align: center;
    margin-left: 4px;
}



.volume-slider-vertical:focus-visible,
.speed-slider-vertical:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.volume-slider-vertical::-webkit-slider-thumb,
.speed-slider-vertical::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: transform 0.2s ease;
}

.volume-slider-vertical::-webkit-slider-thumb:hover,
.speed-slider-vertical::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider-vertical::-moz-range-thumb,
.speed-slider-vertical::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Ensure all generic interactive elements in the controls overlay are clickable */
#controls-overlay button,
#controls-overlay input,
#controls-overlay select,
#controls-overlay label {
    pointer-events: auto;
}

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

body {
    background-color: #050505;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    /* App-like feel */
}

/* Dashboard styles moved to the end of the file for HUD integration */

.dashboard-container::-webkit-scrollbar {
    width: 4px;
}

.dashboard-container::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.select-arrow {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(255, 255, 255, 0.4);
    pointer-events: none;
}


.panel {
    margin-bottom: 0;
}

.panel h2 {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.15em;
    margin-bottom: 15px;
    font-weight: 500;
    text-transform: uppercase;
}

.panel p.subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: -10px;
    margin-bottom: 15px;
}



.pattern-select-wrap {
    position: relative;
    width: 100%;
    margin-top: 5px;
}

.db-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.db-select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.db-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.db-select option {
    background: #0f0f15;
    color: #fff;
    padding: 10px;
}

.select-arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 6px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    pointer-events: none;
    opacity: 0.5;
}

.fader-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: flex-start;
    padding-top: 5px;
}

.fader {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: all var(--transition-fast);
}

.fader:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.fader label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.1em;
    font-weight: 600;
    text-transform: uppercase;
}

.fader .input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fader input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    transition: background var(--transition-fast);
}

.fader input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.1);
}

.fader input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fader input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--accent);
}

.fader .value {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    width: 40px;
    text-align: right;
    font-family: 'Outfit', monospace;
    font-weight: 600;
}

.toggle-wrap {
    margin-top: 4px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

.toggle-wrap label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    width: auto;
}

.toggle-wrap input[type="checkbox"] {
    accent-color: var(--accent);
}

.fx-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 5px;
}

/* FX Button styles consolidated at end */

.fx-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.fx-btn:active,
.fx-btn.active {
    background: rgba(255, 51, 102, 0.3);
    border-color: #ff3366;
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.4);
    transform: scale(0.95);
}

.transport-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.transport-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 15px;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 45%;
}

.transport-btn span {
    display: inline-block;
}

.transport-btn svg {
    opacity: 0.7;
}

.transport-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.record-btn:hover {
    background: rgba(255, 51, 51, 0.1);
    border-color: rgba(255, 51, 51, 0.5);
}

.record-btn.active {
    background: rgba(255, 51, 51, 0.2);
    border-color: #ff3333;
    animation: flash-border 1s infinite alternate;
}

.rec-dot {
    width: 8px;
    height: 8px;
    background: #ff3333;
    border-radius: 50%;
    display: inline-block;
}

.record-btn.active .rec-dot {
    animation: pulse-dot 1s infinite alternate;
}

@keyframes flash-border {
    0% {
        border-color: rgba(255, 51, 51, 0.3);
    }

    100% {
        border-color: rgba(255, 51, 51, 0.8);
        box-shadow: 0 0 15px rgba(255, 51, 51, 0.4);
    }
}

@keyframes pulse-dot {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 1;
        box-shadow: 0 0 10px #ff3333;
    }
}

.record-status {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    font-family: 'Outfit', monospace;
    color: #ff3333;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.record-actions {
    display: flex;
    width: 100%;
    gap: 10px;
    margin-top: 10px;
}

.save-btn:hover {
    background: rgba(51, 255, 153, 0.1);
    border-color: #33ff99;
    color: #33ff99;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.midi-status {
    margin-top: 20px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    font-family: 'Outfit', monospace;
}

@media (max-width: 768px) {
    .dashboard-container {
        width: 100%;
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }
}

/* SPLIT SCREEN LAYOUT ADDITIONS — overridden below */

/* ========================================
   DASHBOARD DESIGN SYSTEM (MASTER V4)
   ======================================== */
:root {
    --db-bg: rgba(6, 6, 9, 0.7);
    --db-panel-bg: rgba(255, 255, 255, 0.03);
    --db-border: rgba(255, 255, 255, 0.08);
    --db-accent: #a78bfa;
    --db-accent-glow: rgba(167, 139, 250, 0.4);
    --db-text-main: rgba(255, 255, 255, 0.95);
    --db-text-muted: rgba(255, 255, 255, 0.45);
    --db-radius-lg: 2.5rem;
    --db-radius-md: 1.5rem;
    --db-radius-sm: 1rem;
    --db-shadow: 0 40px 100px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --transition-smooth: 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

#dashboard-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.8s cubic-bezier(0.2, 1, 0.3, 1), opacity 0.5s ease;
}

#dashboard-overlay:not(.hidden) {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.4);
}

.dashboard-container {
    width: 95%;
    max-width: 1300px;
    height: auto;
    max-height: 92vh;
    background: var(--db-bg);
    border: 1px solid var(--db-border);
    border-radius: var(--db-radius-lg);
    box-shadow: var(--db-shadow);
    backdrop-filter: blur(60px) saturate(210%);
    -webkit-backdrop-filter: blur(60px) saturate(210%);
    padding: 2rem 2.5rem;
    padding-top: 0.75rem;
    position: relative;
    transform: translate(var(--move-x, 0), var(--move-y, 0)) scale(1);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
}

#dashboard-overlay.hidden .dashboard-container {
    transform: translate(var(--move-x, 0), calc(var(--move-y, 0) + 60px)) scale(0.95);
    opacity: 0;
}

/* ---- Scrollbar Refinement ---- */
.dashboard-container::-webkit-scrollbar {
    width: 6px;
}

.dashboard-container::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.dashboard-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ---- Drag Handle ---- */
.dashboard-drag-handle {
    width: 100%;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    opacity: 0.15;
    transition: opacity 0.3s ease;
}

.dashboard-drag-handle:hover {
    opacity: 0.5;
}

.dashboard-drag-handle:active {
    cursor: grabbing;
}

.handle-dots {
    width: 32px;
    height: 3px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    position: relative;
}

.handle-dots::before,
.handle-dots::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background: inherit;
    border-radius: inherit;
}

.handle-dots::before {
    top: -6px;
}

.handle-dots::after {
    top: 6px;
}

/* ---- Layout Grid ---- */
.db-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "video deck"
        "global fx"
        "lfo  lfo";
    gap: 1rem;
    flex-grow: 0;
    min-height: 0;
}

/* ---- Panels ---- */
.panel {
    background: var(--db-panel-bg);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--db-radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.4s ease;
    position: relative;
    overflow: visible;
}

.panel:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.panel h2 {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: var(--db-text-muted);
    text-transform: uppercase;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel h2::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--db-accent);
    box-shadow: 0 0 10px var(--db-accent);
}

.deck-panel {
    grid-area: deck;
}

.deck-row {
    display: flex;
    gap: 1rem;
}

.deck-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.db-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--db-text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.deck-group .patterns-panel {
    grid-area: unset;
    flex: 1;
}

.color-panel {
    flex-shrink: 0;
}

.global-panel {
    grid-area: global;
}

.fx-panel {
    grid-area: fx;
}

.lfo-panel {
    grid-area: lfo;
    padding: 1.25rem;
    overflow: visible;
}

/* ---- Layer Mixer Panel ---- */
.layer-mixer-panel {
    grid-area: video;
    padding: 1.25rem;
}

/* Segmented Control */
.segmented-control {
    position: relative;
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 3px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.segmented-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    bottom: 3px;
    width: calc(33.33% - 4px);
    background: var(--db-accent);
    border-radius: 9px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
    z-index: 1;
    box-shadow: 0 0 15px var(--db-accent-glow);
}

.segmented-btn {
    position: relative;
    flex: 1;
    padding: 0.6rem 0;
    border: none;
    background: transparent;
    color: var(--db-text-muted);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
}

.segmented-btn.active {
    color: #000;
}

/* Crossfade Section */
.crossfade-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.crossfade-indicator-wrap {
    width: 100%;
    margin-bottom: 0.25rem;
}

.crossfade-indicator {
    position: relative;
    height: 32px;
    /* Taller for better control */
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: ew-resize;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.crossfade-indicator:hover {
    border-color: var(--db-accent);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5), 0 0 15px var(--db-accent-glow);
}

.crossfade-indicator:active {
    cursor: grabbing;
}


.crossfade-indicator-fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--db-accent), #60a5fa);
    opacity: 0.8;
}

.crossfade-indicator-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

/* Crossfade indicator labels styling remains in visualizer.js updateUI */

/* Mixer Options Grid */
.mixer-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: center;
}

.option-col {
    display: flex;
    align-items: center;
}

/* Video Upload & Playlist */
.video-upload-row {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.5rem;
}

.video-upload-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--db-text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-upload-btn:hover {
    border-color: var(--db-accent);
    background: rgba(167, 139, 250, 0.05);
    color: #fff;
}

.video-clear-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 80, 80, 0.05);
    border: 1px solid rgba(255, 80, 80, 0.1);
    border-radius: 8px;
    color: rgba(255, 80, 80, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.video-clear-btn:hover {
    background: rgba(255, 80, 80, 0.15);
    color: #ff5050;
    transform: translateY(-1px);
}

.video-playlist {
    margin-top: 0.75rem;
    max-height: 140px;
    overflow-y: auto;
    padding-right: 4px;
}

.video-playlist::-webkit-scrollbar {
    width: 3px;
}

.video-playlist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.video-playlist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-playlist-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

.video-playlist-item.active {
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.video-playlist-item .playlist-index {
    font-family: 'Outfit', sans-serif;
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--db-accent);
    opacity: 0.6;
}

.video-playlist-item.active .playlist-index {
    color: var(--db-accent);
}

.video-playlist-item .playlist-playing-icon {
    display: none;
    color: var(--db-accent);
    animation: pulse-playing 1s infinite alternate;
}

.video-playlist-item.active .playlist-playing-icon {
    display: inline;
}

.video-playlist-item.active .playlist-index-num {
    display: none;
}

@keyframes pulse-playing {
    0% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.video-playlist-item .playlist-name {
    flex: 1;
    font-size: 0.6rem;
    color: var(--db-text-muted);
    font-family: 'Outfit', monospace;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-playlist-item.active .playlist-name {
    color: #fff;
}

.video-playlist-item .playlist-remove-btn {
    width: 18px;
    height: 18px;
    min-width: 18px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0;
    padding: 0;
}

.video-playlist-item:hover .playlist-remove-btn {
    opacity: 1;
}

.video-playlist-item .playlist-remove-btn:hover {
    color: #ff5050;
    background: rgba(255, 80, 80, 0.15);
}

/* ---- Pattern / Color Selects ---- */
.pattern-select-wrap {
    position: relative;
}

.db-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: var(--db-radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.db-select:hover {
    border-color: var(--db-accent);
    background: rgba(0, 0, 0, 0.5);
}

.db-select:focus {
    outline: none;
    border-color: var(--db-accent);
    box-shadow: 0 0 20px var(--db-accent-glow);
}

.select-arrow {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2.5px solid var(--db-text-muted);
    border-bottom: 2.5px solid var(--db-text-muted);
    transform: translateY(-60%) rotate(45deg);
    pointer-events: none;
}

/* Palette Preview */
.palette-preview {
    display: flex;
    gap: 3px;
    margin-top: 0.75rem;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    opacity: 0.8;
}

.palette-color {
    flex: 1;
    height: 100%;
}

/* ---- Toggles (Refactored to fix double-toggle bug) ---- */
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.db-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    width: 100%;
}

.db-toggle-label:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Dedicated Switch Component */
.db-toggle-switch {
    position: relative;
    width: 32px;
    height: 18px;
    margin-left: auto;
    flex-shrink: 0;
}

.db-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.db-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.db-toggle-slider::before {
    content: "";
    position: absolute;
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background: rgba(255, 255, 255, 0.5);
    transition: .3s cubic-bezier(0.18, 0.89, 0.35, 1.15);
    border-radius: 50%;
}

.db-toggle-switch input:checked+.db-toggle-slider {
    background: var(--db-accent);
}

.db-toggle-switch input:checked+.db-toggle-slider::before {
    transform: translateX(14px);
    background: #fff;
    box-shadow: 0 0 6px var(--db-accent-glow);
}

.db-toggle-label svg {
    flex-shrink: 0;
    color: var(--db-text-muted);
    transition: color 0.3s ease;
}

.db-toggle-label:has(input:checked) svg {
    color: var(--db-accent);
}

.db-toggle-label span {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--db-text-muted);
}

.db-toggle-label:has(input:checked) span {
    color: #fff;
}

/* Specific adjustment for FX Header Toggle */
.auto-fx-hdr-toggle {
    width: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.6rem;
    margin-left: auto;
}


.auto-rotate-toggle svg {
    flex-shrink: 0;
    color: var(--db-text-muted);
    transition: all 0.3s ease;
}

.auto-rotate-toggle span {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--db-text-muted);
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.auto-rotate-toggle:has(input:checked) svg {
    color: var(--db-accent);
    filter: drop-shadow(0 0 8px var(--db-accent-glow));
}

.auto-rotate-toggle:has(input:checked) span {
    color: #fff;
}

/* ---- Speed Control ---- */
.db-speed-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
}

.label-row .db-mini-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.db-mini-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--db-text-muted);
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    padding: 0;
}

.db-mini-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.db-mini-btn.active {
    background: var(--db-accent);
    border-color: var(--db-accent);
    color: #000;
    box-shadow: 0 0 15px var(--db-accent-glow);
}

.db-mini-btn .hidden {
    display: none !important;
}

/* ---- Faders ---- */
.fader-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.fader {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.fader label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--db-text-muted);
    text-transform: uppercase;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: var(--db-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tap-btn {
    width: auto;
    height: auto;
    padding: 6px 12px;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    border-radius: 6px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.25);
    background: var(--db-accent);
    box-shadow: 0 0 20px var(--db-accent-glow);
}

.fader .value {
    font-family: 'Outfit', monospace;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--db-accent);
    min-width: 3ch;
    text-align: right;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ---- FX Grid ---- */
.fx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
}

.fx-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--db-radius-sm);
    padding: 0.8rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.fx-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--db-accent) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.fx-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.fx-fn:hover::before {
    opacity: 0.05;
}

.fx-icon {
    width: 24px;
    height: 24px;
    color: var(--db-text-muted);
    transition: all 0.4s ease;
    z-index: 1;
}

.fx-btn:hover .fx-icon {
    color: #fff;
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 0 8px var(--db-accent-glow));
}

.fx-btn .name {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--db-text-muted);
    z-index: 1;
    text-align: center;
    transition: 0.3s ease;
}

.fx-btn:hover .name {
    color: #fff;
}

.fx-btn.active {
    background: var(--db-accent);
    border-color: var(--db-accent);
    box-shadow: 0 0 40px var(--db-accent-glow), inset 0 0 15px rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.fx-btn.active .fx-icon,
.fx-btn.active .name {
    color: #000;
    filter: none;
}

/* ---- LFO Rack ---- */
.lfo-slots-v2 {
    display: flex;
    gap: 1rem;
    margin-top: 0;
}

.lfo-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--db-radius-sm);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: border-color 0.3s ease;
}

.lfo-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.lfo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lfo-toggle-v2 {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--db-text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lfo-toggle-v2.active {
    background: #00ffaa;
    color: #000;
    border-color: #00ffaa;
    box-shadow: 0 0 20px rgba(0, 255, 170, 0.4);
}

.lfo-target-v2 {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
}

.lfo-visualizer-container {
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.lfo-playhead {
    width: 3px;
    background: #00ffaa;
    box-shadow: 0 0 15px #00ffaa;
}

.lfo-controls-grid {
    display: grid;
    gap: 0.5rem;
}

.btn-group-row button {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--db-text-muted);
    border-radius: 6px;
    padding: 0.4rem;
    transition: 0.2s ease;
}

.btn-group-row button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.btn-group-row button.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

/* ---- Shortcuts Overlay ---- */
.shortcuts-overlay {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    transition: 0.5s ease;
}

.shortcuts-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.shortcuts-container {
    width: 95%;
    max-width: 1300px;
    background: var(--db-bg);
    border: 1px solid var(--db-border);
    border-radius: 4rem;
    padding: 4rem 6rem;
    box-shadow: var(--db-shadow);
    backdrop-filter: blur(80px) saturate(220%);
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(1);
    transition: 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.shortcuts-overlay.hidden .shortcuts-container {
    transform: scale(0.9) translateY(60px);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 3.5rem;
}

.shortcuts-header h2 {
    font-size: 1rem;
    letter-spacing: 0.4em;
    color: var(--db-accent);
    font-weight: 800;
}

.close-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--db-text-muted);
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 51, 102, 0.15);
    border-color: #ff3366;
    color: #ff3366;
    transform: rotate(90deg);
}

.visual-keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 0;
}

.key-cap {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--db-text-muted);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
}

/* Key Widths */
.med-wide {
    width: 90px;
}

.wide {
    width: 108px;
}

.extra-wide {
    width: 140px;
}

/* Specific Spacing for Spacing/Vibe */
.key-cap[data-key="Shift"]:first-child {
    margin-right: 12px;
}

.key-cap[data-key="Shift"]:last-child {
    margin-left: 12px;
}

.key-cap[data-key="CapsLock"],
.key-cap[data-key="Tab"],
.key-cap[data-key="Esc"] {
    margin-right: 12px;
}

.key-cap[data-key="Enter"],
.key-cap[data-key="Backspace"] {
    margin-left: 12px;
}

.space-bar {
    width: 340px;
    margin: 0 16px;
}

.key-cap span {
    font-size: 0.55rem;
    opacity: 0.6;
    font-weight: 600;
    text-transform: uppercase;
    pointer-events: none;
}

.key-cap:hover,
.key-cap.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--db-accent);
    color: #fff;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.key-cap.active {
    background: var(--db-accent-glow);
    transform: translateY(2px) scale(0.95);
    transition: all 0.1s ease;
}

.key-cap.cat-sys {
    color: var(--db-accent);
}

.key-cap.cat-fx {
    color: #f472b6;
}

.key-cap.cat-nav {
    color: #60a5fa;
}

.kb-info-panel {
    margin-top: 4.5rem;
    padding: 1.5rem 3rem;
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--db-text-muted);
    letter-spacing: 0.15em;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 400px;
    text-align: center;
    transition: all 0.3s ease;
}

/* ---- Countdown ---- */
.countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    pointer-events: none;
}

.countdown-text {
    font-size: 18rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 80px var(--db-accent-glow);
    animation: countdown-pulse 1s ease infinite;
}

@keyframes countdown-pulse {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* ---- REC Status Integrated ---- */
.rec-status-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: rgba(255, 0, 85, 0.12);
    border-radius: 24px;
    height: 40px;
    border: 1px solid rgba(255, 0, 85, 0.25);
}

.rec-status-menu.hidden {
    display: none !important;
}

.rec-timer-menu {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
}

.rec-dot-menu {
    width: 10px;
    height: 10px;
    background: #ff0055;
    box-shadow: 0 0 15px #ff0055;
    border-radius: 50%;
    animation: rec-blink 1s infinite alternate;
}

@keyframes rec-blink {
    from {
        opacity: 0.3;
        transform: scale(0.85);
    }

    to {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Fixes for main UI while Dashboard is open */
body.dashboard-open #drop-overlay {
    opacity: 0.2;
    pointer-events: none;
}

/* ---- Panel Header Row ---- */
.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.lfo-header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.fx-subtitle-inline {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.05em;
    font-weight: 500;
    margin-left: auto;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--db-text-muted);
}

.title-with-icon h2 {
    margin: 0;
}

.title-with-icon h2::before {
    display: none;
}

/* ---- Recording Btn in Menu ---- */
.rec-btn-menu {
    position: relative;
}

.rec-icon-wrap {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rec-dot-inner {
    width: 12px;
    height: 12px;
    background: #ff0055;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.rec-btn-menu:hover .rec-dot-inner {
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.6);
    transform: scale(1.1);
}

.rec-btn-menu.recording {
    background: rgba(255, 0, 85, 0.2);
}

.rec-btn-menu.recording .rec-dot-inner {
    border-radius: 3px;
    width: 10px;
    height: 10px;
    animation: rec-blink 1s infinite alternate;
}

.rec-label-pulsing {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #ff0055;
    animation: rec-blink 1s infinite alternate;
}

/* ---- LFO fader row ---- */
.lfo-fader-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fader-icon {
    color: var(--db-text-muted);
    flex-shrink: 0;
    opacity: 0.6;
}

.lfo-val-display {
    font-family: 'Outfit', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--db-accent);
    min-width: 3ch;
    text-align: right;
}

/* ---- Sync Btn V2 ---- */
.sync-btn-v2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    width: auto;
    padding: 6px 12px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sync-btn-v2.active {
    background: #00ffaa;
    border-color: #00ffaa;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 170, 0.4);
}

.sync-btn-v2.active svg {
    stroke: #000;
}

/* ---- Auto FX Label in Header ---- */
.auto-fx-label {
    width: auto !important;
    padding: 0.4rem 0.75rem;
    font-size: 0.6rem;
    border-radius: 8px;
    position: relative;
}

/* ---- LFO Canvas ---- */
.lfo-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.lfo-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    transition: left 0.05s linear;
}

/* ---- Btn Group Row ---- */
.btn-group-row {
    display: flex;
    gap: 6px;
}

.btn-group-row button {
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

/* ========================================
   LAYER MIXER / CROSSFADE STYLES
   ======================================== */

/* Triple toggle for PTL / LAYER / VID */
.triple-toggle {
    display: flex;
    gap: 4px;
}

.triple-toggle .source-toggle-btn {
    flex: 1;
    padding: 0.55rem 0.5rem;
    font-size: 0.65rem;
    gap: 0.35rem;
    letter-spacing: 0.1em;
}

/* Crossfade Section */
.crossfade-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem 0;
    animation: fadeInUp 0.4s ease;
    transition: opacity 0.3s ease, max-height 0.4s ease;
}

.crossfade-section.hidden {
    display: none;
}

/* Gradient Indicator Bar */
.crossfade-indicator-wrap {
    position: relative;
}

.crossfade-indicator {
    position: relative;
    width: 100%;
    height: 28px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--db-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.crossfade-indicator-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg,
            rgba(167, 139, 250, 0.7) 0%,
            rgba(96, 165, 250, 0.5) 50%,
            rgba(244, 114, 182, 0.7) 100%);
    transition: clip-path 0.15s ease;
    clip-path: inset(0 100% 0 0);
}

.crossfade-indicator-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    pointer-events: none;
}

/* Crossfade Slider Row */
.crossfade-slider-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crossfade-endpoint {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--db-text-muted);
    min-width: 2em;
    text-align: center;
    flex-shrink: 0;
}

.crossfade-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg,
            rgba(167, 139, 250, 0.4),
            rgba(96, 165, 250, 0.3),
            rgba(244, 114, 182, 0.4));
    outline: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.crossfade-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.crossfade-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.crossfade-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
}

/* Options Row */
.crossfade-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.auto-mix-toggle {
    flex-shrink: 0;
}

.blend-mode-wrap {
    flex-shrink: 0;
}

.blend-mode-select {
    font-size: 0.65rem;
    padding: 0.35rem 0.6rem;
    min-width: 70px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--db-text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.blend-mode-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.blend-mode-select:focus {
    outline: none;
    border-color: var(--db-accent);
}

/* Layer mode active glow */
.source-toggle-btn[id="db-src-layer"].active {
    background: linear-gradient(135deg, var(--db-accent), rgba(244, 114, 182, 0.8));
    border-color: transparent;
    color: #000;
    box-shadow: 0 0 25px var(--db-accent-glow), 0 0 15px rgba(244, 114, 182, 0.3);
}

/* ========================================
   Hand Tracker — Camera PiP & Status UI
   ======================================== */

/* PiP Preview Container */
.hand-tracker-preview {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 100;
    width: 168px;
    border-radius: var(--radius-xl);
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 4px;
}

.hand-tracker-preview.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

/* Preview Canvas */
.ht-preview-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: calc(var(--radius-xl) - 4px);
    background: #000;
}

/* Status Dot */
.ht-status-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    z-index: 2;
}

.ht-status-dot.detected {
    background: #00ffaa;
    box-shadow: 0 0 8px rgba(0, 255, 170, 0.6), 0 0 20px rgba(0, 255, 170, 0.2);
    animation: ht-pulse 2s ease-in-out infinite;
}

@keyframes ht-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Label */
.ht-label {
    text-align: center;
    padding: 4px 0 6px;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-comet, rgba(255, 255, 255, 0.5));
    font-family: var(--font-heading, 'Inter', sans-serif);
}

/* Camera toggle button active state */
#btn-camera-toggle.active {
    color: #00ffaa;
    background: rgba(0, 255, 170, 0.15);
    box-shadow: 0 0 12px rgba(0, 255, 170, 0.3);
}

#btn-camera-toggle.active:hover {
    background: rgba(0, 255, 170, 0.25);
}