:root {
    color-scheme: dark;
    --bg-base: #0b0d10;
    --bg-surface: #12151b;
    --bg-surface-raised: #181d24;
    --bg-surface-active: #222832;
    --border-subtle: #242a34;
    --border-strong: #363e4d;
    --text-primary: #f0f3f8;
    --text-secondary: #9aa5b5;
    --text-muted: #626e82;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition-fast: 0.15s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
.app-header {
    height: 54px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    flex-shrink: 0;
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
}

.brand-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.brand-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.brand-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-surface-raised);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.engine-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.engine-switch select {
    background: var(--bg-surface-raised);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
}

.engine-switch select:focus {
    border-color: var(--accent-blue);
}

/* Main Layout */
.app-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Stage Section (Left / Main) */
.stage-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
    position: relative;
}

.viewport-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #050608;
    overflow: hidden;
    padding: 6px;
}

.stage-frame-box {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    overflow: hidden;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), height 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}

.stage-frame-box.framed {
    border: 1px solid rgba(59, 130, 246, 0.35);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), 0 0 20px rgba(59, 130, 246, 0.15);
}

.visualizer-stage-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Fast Seamless Transition Flash / Dissolve Layer */
.stage-transition-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.25) 0%, rgba(14, 165, 233, 0.08) 60%, transparent 100%);
    mix-blend-mode: screen;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 6;
}

.stage-transition-overlay.flash {
    opacity: 1;
    transition: none;
}


/* Empty State / Dropzone Overlay */
.dropzone-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 13, 16, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.dropzone-overlay.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

.preset-item,
.user-preset-card {
    cursor: grab;
    user-select: none;
}

.preset-item:active,
.user-preset-card:active {
    cursor: grabbing;
}

.timeline-track-container.dragover,
.timeline-scenes-track.dragover {
    background: rgba(59, 130, 246, 0.15) !important;
    outline: 2px dashed var(--accent-blue-hover) !important;
    outline-offset: -2px;
}

.timeline-drop-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #38bdf8;
    box-shadow: 0 0 10px #38bdf8;
    pointer-events: none;
    z-index: 18;
}


.dropzone-card {
    background: var(--bg-surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    text-align: center;
    max-width: 440px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.dropzone-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-surface-raised);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    color: var(--accent-blue);
}

.dropzone-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.dropzone-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.dropzone-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* HUD Overlay */
.viewport-hud {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(18, 21, 27, 0.82);
    backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-mono);
    font-size: 11px;
    z-index: 10;
    max-width: calc(100% - 28px);
    flex-wrap: wrap;
    box-sizing: border-box;
}

.hud-btn {
    pointer-events: auto;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.15s ease;
}

.hud-btn.active {
    background: var(--accent-amber);
    color: #000;
    font-weight: 600;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hud-label {
    color: var(--text-muted);
}

.hud-val {
    color: var(--text-primary);
    font-weight: 500;
}

.hud-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: background 0.08s ease, transform 0.08s ease;
}

.hud-dot.active {
    background: var(--accent-emerald);
    transform: scale(1.4);
    box-shadow: 0 0 10px var(--accent-emerald);
}

.hud-preset-name {
    color: var(--accent-blue-hover);
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* HUD Quick Aspect Ratio Switcher */
.hud-aspect-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.45);
    padding: 2px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-aspect-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
}

.hud-aspect-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.hud-aspect-btn.active {
    color: #fff;
    background: var(--accent-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* Mobile Wide Toggle in Header */
.mobile-wide-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.mobile-wide-btn.is-wide {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-blue);
    color: #93c5fd;
}

/* Tap to Beat Ripple Overlay */
.tap-ripple-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.tap-ripple {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple-pulse 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
    border: 2px solid rgba(59, 130, 246, 0.9);
    background: radial-gradient(circle, rgba(96, 165, 250, 0.35) 0%, rgba(59, 130, 246, 0) 70%);
}

@keyframes ripple-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.8);
        opacity: 0;
    }
}

/* Timeline Sequencer Drawer (Collapsible & Zoomable) */
.timeline-drawer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: max-height 0.25s ease;
    z-index: 15;
}

.timeline-drawer.collapsed {
    display: none;
}

.timeline-header {
    height: 42px;
    background: var(--bg-surface-raised);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    gap: 12px;
}

.timeline-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

/* Zoom Controls */
.timeline-zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.zoom-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.zoom-slider {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-strong);
    border-radius: 2px;
    outline: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-blue-hover);
    cursor: pointer;
}

.zoom-preset-group {
    display: flex;
    gap: 3px;
}

.btn-zoom-preset {
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    cursor: pointer;
    font-family: var(--font-mono);
}

.btn-zoom-preset:hover,
.btn-zoom-preset.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.timeline-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Multi-Track Sequencer Viewport */
.timeline-scroll-viewport {
    height: 120px;
    position: relative;
    background: #080a0d;
    overflow-x: auto;
    overflow-y: hidden;
}

.timeline-tracks-content {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.track-label {
    position: sticky;
    left: 0;
    z-index: 12;
    background: rgba(18, 21, 27, 0.85);
    backdrop-filter: blur(4px);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 2px;
    display: inline-block;
    margin: 2px 4px;
    pointer-events: none;
}

/* Ruler Track */
.timeline-ruler-track {
    height: 20px;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: ew-resize;
    user-select: none;
}

.timeline-ruler-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: ew-resize;
}

/* Scene Track */
.timeline-scenes-track {
    height: 32px;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.scenes-container {
    position: absolute;
    inset: 0;
    left: 0;
}

.scene-block {
    position: absolute;
    top: 3px;
    bottom: 3px;
    border-radius: 3px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(99, 102, 241, 0.45) 100%);
    border: 1px solid rgba(96, 165, 250, 0.5);
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 10px;
    color: #e2e8f0;
    font-family: var(--font-mono);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: filter 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.scene-block:hover {
    filter: brightness(1.2);
    border-color: #fff;
}

.scene-block.active-scene {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.7), inset 0 0 8px rgba(56, 189, 248, 0.3) !important;
    filter: brightness(1.3);
}

.scene-block.drop-target {
    border: 2px solid var(--accent-emerald) !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.55) 0%, rgba(5, 150, 105, 0.65) 100%) !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8) !important;
    filter: brightness(1.3);
}

.scene-block.scene-shader-matrix {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(5, 150, 105, 0.45) 100%);
    border-color: rgba(52, 211, 153, 0.6);
}

.scene-block.scene-shader-oscilloscope {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.35) 0%, rgba(217, 70, 239, 0.45) 100%);
    border-color: rgba(244, 114, 182, 0.6);
}

.scene-block.scene-shader-procedural {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(217, 119, 6, 0.45) 100%);
    border-color: rgba(251, 191, 36, 0.6);
}

.scene-transition-badge {
    margin-right: 6px;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 5;
    position: relative;
}

.scene-transition-badge:hover {
    background: rgba(59, 130, 246, 0.4);
    border-color: #60a5fa;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.6);
    transform: scale(1.05);
}

.scene-transition-badge.dragging {
    background: #f59e0b !important;
    color: #0b0d10 !important;
    border-color: #fbbf24 !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.9) !important;
    cursor: grabbing;
}

.scene-transition-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: transparent;
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
    z-index: 6;
    transition: background 0.12s ease;
}

.scene-transition-handle:hover,
.scene-transition-handle.active {
    background: rgba(56, 189, 248, 0.8);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

/* Audio Track */
.timeline-audio-track {
    height: 68px;
    position: relative;
}

.timeline-track-container {
    height: 100%;
    position: absolute;
    inset: 0;
    cursor: crosshair;
}

.timeline-waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0.65;
}

.timeline-markers-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.timeline-cue-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-blue);
    pointer-events: auto;
    cursor: ew-resize;
    z-index: 8;
    touch-action: none;
    user-select: none;
    transition: transform var(--transition-fast);
}

.timeline-cue-marker:hover,
.timeline-cue-marker.selected {
    background: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
    width: 3px;
    z-index: 10;
}

.timeline-cue-marker.dragging {
    background: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
    width: 3px;
    z-index: 15;
}

.timeline-cue-pin {
    position: absolute;
    top: 0;
    left: -13px;
    min-width: 26px;
    height: 18px;
    padding: 0 4px;
    background: var(--accent-blue);
    color: white;
    font-size: 9px;
    font-family: var(--font-mono);
    border-radius: 2px 2px 4px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
    font-weight: 600;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.timeline-cue-pin:active,
.timeline-cue-marker.dragging .timeline-cue-pin {
    cursor: grabbing;
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.9);
}

.timeline-cue-del-btn {
    display: none;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 2px;
    cursor: pointer;
    border-radius: 50%;
    padding: 0 2px;
}

.timeline-cue-marker:hover .timeline-cue-del-btn,
.timeline-cue-marker.selected .timeline-cue-del-btn {
    display: inline-block;
}

.timeline-cue-del-btn:hover {
    color: #ff4d4f;
    background: rgba(255, 255, 255, 0.2);
}

.timeline-cue-marker.selected .timeline-cue-pin {
    background: var(--accent-emerald);
}

.timeline-cue-marker.drop .timeline-cue-pin,
.timeline-cue-marker.burst .timeline-cue-pin {
    background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.8);
}

.timeline-playhead {
    position: absolute;
    top: -52px;
    bottom: 0;
    width: 2px;
    background: var(--accent-rose);
    pointer-events: none;
    z-index: 15;
    left: 0%;
}

.playhead-handle {
    position: absolute;
    top: 0;
    left: -6px;
    width: 14px;
    height: 20px;
    background: var(--accent-rose);
    clip-path: polygon(0% 0%, 100% 0%, 100% 60%, 50% 100%, 0% 60%);
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.6);
}

/* Cue Inspector Bar */
.cue-inspector {
    height: 44px;
    background: var(--bg-surface-raised);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 14px;
    font-size: 12px;
    overflow-x: auto;
}

.inspector-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.inspector-label {
    color: var(--text-muted);
}

.inspector-val {
    font-family: var(--font-mono);
    color: var(--accent-blue-hover);
    font-weight: 500;
}

.input-inline-num {
    width: 48px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-align: right;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-danger-text {
    color: var(--accent-rose);
    border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger-text:hover {
    background: rgba(244, 63, 94, 0.15);
}

.knob-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}


/* Transport Bar */
.transport-bar {
    height: 56px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 14px;
    flex-shrink: 0;
    z-index: 20;
}

.transport-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
    flex-shrink: 0;
}

.transport-btn:hover {
    background: var(--accent-blue-hover);
    transform: scale(1.04);
}

.time-display {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 38px;
}

.scrubber-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    height: 28px;
}

.waveform-mini {
    position: absolute;
    inset: 4px 0;
    width: 100%;
    height: 20px;
    pointer-events: none;
    opacity: 0.35;
    border-radius: 2px;
}

.seek-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-surface-raised);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.seek-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transport-icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: var(--radius-sm);
}

.transport-icon-btn:hover {
    color: var(--text-primary);
}

.volume-slider {
    width: 72px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-surface-raised);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    cursor: pointer;
}

/* Sidebar Section (Right) */
.sidebar-section {
    width: 360px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.sidebar-tabs {
    display: flex;
    background: var(--bg-surface-raised);
    border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
    background: var(--bg-surface);
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    gap: 16px;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

/* Panel Box */
.panel-box {
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.panel-header h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.badge {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

/* User Presets */
.user-preset-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.preset-io-row {
    display: flex;
    gap: 6px;
}

.preset-io-row button,
.preset-io-row label {
    flex: 1;
}

.user-preset-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.user-preset-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color var(--transition-fast);
}

.user-preset-card:hover {
    border-color: var(--border-strong);
}

.user-preset-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.user-preset-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-preset-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.user-preset-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
}

/* Preset Browser */
.search-box {
    margin-bottom: 10px;
}

.search-box input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent-blue);
}

.preset-quick-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.preset-quick-actions button {
    flex: 1;
}

.preset-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}

.preset-item {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    box-sizing: border-box;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.preset-item:hover {
    background: var(--bg-surface-active);
    color: var(--text-primary);
}

.preset-item.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue-hover);
    font-weight: 500;
    border-left: 3px solid var(--accent-blue);
}

/* Sliders */
.slider-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 12px;
}

.slider-row label {
    width: 110px;
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
}

.slider-row input[type="range"] {
    flex: 1;
    margin: 0 10px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-surface);
    border-radius: 2px;
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
}

.slider-row span {
    width: 44px;
    text-align: right;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.select-inline {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    outline: none;
}

/* Forms & Buttons */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    outline: none;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: var(--accent-blue);
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
}

.btn-secondary {
    background: var(--bg-surface-raised);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-surface-active);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    padding: 10px;
}

.btn-icon {
    padding: 6px;
    width: 32px;
    height: 32px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
}

.btn-text:hover {
    color: var(--text-secondary);
}

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    background: linear-gradient(180deg, #181d26 0%, #10141b 100%);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 400px;
    max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 25px rgba(59, 130, 246, 0.15);
    position: relative;
}

.modal-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.modal-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.qr-code-frame {
    background: #141822;
    border: 1px solid var(--border-subtle);
    padding: 12px;
    border-radius: var(--radius-md);
    display: inline-block;
    margin: 10px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* Toast Notification System */
.app-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
}

.toast-item {
    pointer-events: auto;
    background: rgba(18, 22, 30, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toast-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-item.toast-success {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(16, 185, 129, 0.25);
}

.toast-item.toast-error {
    border-color: rgba(244, 63, 94, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(244, 63, 94, 0.25);
}

.toast-item.toast-warning {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 158, 11, 0.25);
}

.toast-item.toast-info {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(168, 85, 247, 0.25);
}

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Aspect Ratio Grid in Video Settings */
.aspect-ratio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.aspect-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.aspect-btn:hover {
    background: var(--bg-surface-active);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.aspect-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px var(--accent-glow);
}

.aspect-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aspect-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aspect-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aspect-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aspect-btn.active .aspect-title {
    color: var(--accent-blue-hover);
}

.aspect-btn.active .aspect-desc {
    color: #93c5fd;
}

.aspect-stage-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

.status-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 6px var(--accent-emerald);
}

/* Export Progress */
.export-progress-card {
    margin-top: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 6px;
    font-weight: 500;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--bg-surface-raised);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-blue);
    transition: width 0.3s ease;
}

.status-detail {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   Comprehensive Mobile Scaling & Touch Ergonomics
   ========================================================================== */

/* Prevent iOS Safari input auto-zoom on mobile text controls */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Touch device ergonomics: larger thumbs and comfortable tap targets */
@media (hover: none) and (pointer: coarse) {
    .slider-row input[type="range"]::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
    }
    .seek-slider::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }
    .zoom-slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    .btn-sm, .hud-btn {
        min-height: 36px;
    }
    .preset-item {
        min-height: 42px;
        display: flex;
        align-items: center;
    }
}

/* Pro Upgrade Top Navbar Button */
.btn-pro-upgrade {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%);
    color: #fff;
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-pro-upgrade:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.6);
}

.btn-pro-upgrade.pro-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

/* Badges & Tags */
.pro-mini-tag {
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    color: #fff;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.pro-badge {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%) !important;
    color: #fff !important;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

/* Live Canvas Recorder HUD Button */
.btn-record-live {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.15);
    color: #fff;
}

.btn-record-live:hover {
    background: rgba(244, 63, 94, 0.3);
}

.btn-record-live.recording {
    background: #f43f5e;
    color: #fff;
    border-color: #f43f5e;
    animation: record-glow 1.5s infinite;
}

@keyframes record-glow {
    0% { box-shadow: 0 0 4px rgba(244, 63, 94, 0.5); }
    50% { box-shadow: 0 0 14px rgba(244, 63, 94, 0.9); }
    100% { box-shadow: 0 0 4px rgba(244, 63, 94, 0.5); }
}

.record-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f43f5e;
    display: inline-block;
}

.btn-record-live.recording .record-dot {
    background: #fff;
    animation: record-blink 0.8s infinite alternate;
}

@keyframes record-blink {
    0% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

.record-timer {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
}

/* Beat Reactive Text Overlay Canvas */
.text-overlay-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

/* Preset Tag Pills & Star Icon */
.preset-tag-bar {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.tag-pill {
    font-size: 10px;
    padding: 3px 8px;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.tag-pill:hover,
.tag-pill.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.preset-star-btn {
    margin-right: 6px;
    cursor: pointer;
    color: #64748b;
    transition: color 0.15s ease, transform 0.15s ease;
}

.preset-star-btn:hover {
    color: #fbbf24;
    transform: scale(1.2);
}

.preset-star-btn.starred {
    color: #fbbf24;
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

/* Automation Curves Track */
.timeline-automation-track {
    height: 80px;
    position: relative;
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.automation-header-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-automation-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* Visualizer Studio PRO Paywall Modal */
.pro-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 14, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: pro-fade-in 0.25s ease;
}

@keyframes pro-fade-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.pro-modal-card {
    background: linear-gradient(180deg, #181d26 0%, #10141b 100%);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(139, 92, 246, 0.2);
    width: 100%;
    max-width: 680px;
    padding: 32px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.pro-modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.pro-modal-close:hover {
    color: #fff;
}

.pro-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.pro-sparkle-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border: 1px solid rgba(236, 72, 153, 0.4);
    color: #f472b6;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.pro-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.pro-modal-header p {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto;
}

.pro-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

@media (max-width: 560px) {
    .pro-features-grid {
        grid-template-columns: 1fr;
    }
}

.pro-feat-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.pro-feat-icon {
    font-size: 20px;
}

.pro-feat-item strong {
    font-size: 12px;
    color: #fff;
    display: block;
    margin-bottom: 2px;
}

.pro-feat-item p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.pro-pricing-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 560px) {
    .pro-pricing-cards {
        grid-template-columns: 1fr;
    }
}

.pricing-card {
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pricing-card.featured {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.15) 0%, rgba(24, 29, 38, 0.8) 100%);
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
}

.popular-ribbon {
    position: absolute;
    top: -10px;
    right: 18px;
    background: var(--accent-purple);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.pricing-tier {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.pricing-price span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.pricing-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.pro-license-activation {
    background: rgba(0, 0, 0, 0.35);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.pro-license-activation label {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.license-input-row {
    display: flex;
    gap: 8px;
    max-width: 440px;
    margin: 0 auto;
}

.license-input-row input {
    flex: 1;
    text-transform: uppercase;
    font-family: var(--font-mono);
    letter-spacing: 1px;
    font-size: 12px;
    text-align: center;
}

.license-status-msg {
    font-size: 11px;
    margin-top: 8px;
    font-weight: 500;
}

.license-status-msg.success {
    color: var(--accent-emerald);
}

.license-status-msg.error {
    color: var(--accent-rose);
}

/* ==========================================================================
   User Account Widget & Auth Modal Styles
   ========================================================================== */

.user-profile-widget {
    position: relative;
    display: inline-block;
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-subtle);
    padding: 3px 8px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-avatar-btn:hover {
    border-color: var(--accent-blue-hover);
    background: rgba(255, 255, 255, 0.08);
}

.user-avatar-initials {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-purple);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-display-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    min-width: 200px;
    z-index: 50;
    padding: 8px 0;
    animation: dropdown-fade 0.15s ease;
}

@keyframes dropdown-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-email {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.user-sync-status {
    font-size: 10px;
    color: var(--accent-emerald);
}

.user-dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 6px 0;
}

.user-dropdown-item {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-dropdown-item:hover {
    background: var(--bg-surface-raised);
    color: #fff;
}

/* Auth Modal Card */
.auth-modal-card {
    background: linear-gradient(180deg, #181d26 0%, #10141b 100%);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 420px;
    padding: 28px;
    position: relative;
    animation: pro-fade-in 0.25s ease;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 18px;
}

.auth-tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.auth-tab-btn:hover {
    color: var(--text-primary);
}

.auth-tab-btn.active {
    color: var(--accent-blue-hover);
    border-bottom-color: var(--accent-blue-hover);
}

.auth-status-msg {
    font-size: 12px;
    margin-top: 12px;
    text-align: center;
    font-weight: 500;
}

.auth-status-msg.success {
    color: var(--accent-emerald);
}

.auth-status-msg.error {
    color: var(--accent-rose);
}

/* Google Sign-In Button & Auth Divider */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #ffffff;
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    margin-bottom: 12px;
}
.btn-google:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.btn-google:active {
    transform: translateY(0);
}
.google-svg-icon {
    flex-shrink: 0;
}
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 14px 0;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}
.auth-divider span {
    padding: 0 10px;
}

/* ==========================================================================
   Ultra AI Sequence Director & Editor Styles
   ========================================================================== */

.btn-ai-director {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    color: #ffffff;
    font-weight: 600;
    border: none;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-ai-director:hover {
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.6);
    transform: translateY(-1px);
}

.btn-glow-ai {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: 1px solid rgba(167, 139, 250, 0.4);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.35);
    font-weight: 600;
}

.btn-glow-ai:hover {
    background: linear-gradient(135deg, #6366f1 0%, #9333ea 100%);
    box-shadow: 0 0 16px rgba(147, 51, 234, 0.6);
}

.ai-sparkle-badge {
    background: rgba(255, 255, 255, 0.25);
    font-size: 9px;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.ai-director-panel {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: linear-gradient(180deg, #161a24 0%, #0d1017 100%);
    border-left: 1px solid rgba(168, 85, 247, 0.4);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.7);
    animation: ai-panel-slide-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ai-panel-slide-in {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

.ai-director-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-mode-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-director-tag {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    background: linear-gradient(90deg, #c084fc, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-mode-pills {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}

.ai-mode-pill {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 3px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.ai-mode-pill:hover {
    color: var(--text-primary);
}

.ai-mode-pill.active {
    background: rgba(168, 85, 247, 0.25);
    color: #e9d5ff;
    border: 1px solid rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

.ai-settings-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-prompt-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-prompt-input-wrap {
    width: 100%;
    position: relative;
}

.ai-prompt-input {
    width: 100%;
    background: rgba(11, 13, 16, 0.9);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: #f1f5f9;
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.45;
    resize: vertical;
    min-height: 70px;
    max-height: 160px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-prompt-input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.btn-ai-generate {
    width: 100%;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
    border: 1px solid rgba(244, 114, 182, 0.4);
    box-shadow: 0 0 14px rgba(219, 39, 119, 0.4);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-ai-generate:hover {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    box-shadow: 0 0 22px rgba(236, 72, 153, 0.6);
    transform: translateY(-1px);
}

.btn-ai-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-prompt-chips-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.chips-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.ai-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    cursor: pointer;
    white-space: normal;
    text-align: left;
    transition: all 0.12s ease;
}

.ai-chip:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.45);
    color: #e9d5ff;
    transform: translateY(-1px);
}

.ai-advanced-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
}

.ai-key-details summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 11px;
}

.ai-key-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.ai-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.ai-reasoning-card {
    background: rgba(14, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: #bae6fd;
    animation: ai-panel-slide-in 0.15s ease;
}

.ai-reasoning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 4px;
    color: #38bdf8;
}

.ai-reasoning-body {
    line-height: 1.4;
    color: #e0f2fe;
}

.ai-feedback-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-ai-feedback {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-ai-feedback.like:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.btn-ai-feedback.dislike:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: #f43f5e;
    color: #f43f5e;
}

.ai-feedback-status {
    font-size: 12px;
    color: #10b981;
    margin-left: 4px;
}

/* AI Created MilkDrop Visual Card */
.ai-visual-card {
    margin-top: 14px;
    padding: 14px;
    background: linear-gradient(145deg, rgba(30, 27, 75, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.15);
    animation: fadeIn 0.25s ease-out;
}

.ai-visual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ai-visual-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: #ffffff;
}

.ai-visual-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ai-visual-title-row h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #f3e8ff;
    letter-spacing: 0.5px;
}

.ai-visual-desc {
    font-size: 12px;
    color: #cbd5e1;
    margin-bottom: 10px;
    line-height: 1.4;
}

.ai-visual-stats {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: #a78bfa;
    margin-bottom: 12px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
}

.ai-visual-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ai-visual-actions .btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
    font-size: 11px;
    padding: 6px 8px;
}

.ai-visual-code-details {
    margin-top: 8px;
    font-size: 11px;
    color: #94a3b8;
}

.ai-visual-code-details summary {
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: #c084fc;
}

.ai-visual-code-pre {
    margin-top: 8px;
    padding: 10px;
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    max-height: 180px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 10.5px;
    line-height: 1.4;
    color: #a5f3fc;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Multi-Model Selection & Concurrent Generation Styles */
.ai-models-selection-row {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 2px;
}

.ai-models-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-models-title {
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
}

.ai-models-counter {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 9999px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}

.ai-model-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-model-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    font-size: 11px;
    user-select: none;
    transition: all 0.15s ease;
}

.ai-model-chip input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: 12px;
    height: 12px;
    accent-color: #a855f7;
}

.ai-model-chip:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
}

.ai-model-chip.active {
    background: rgba(168, 85, 247, 0.22);
    border-color: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.25);
}

.model-badge.gemini {
    color: #38bdf8;
    font-weight: 600;
}

.model-badge.gemini-pro {
    color: #c084fc;
    font-weight: 600;
}

.model-badge.openai {
    color: #34d399;
    font-weight: 600;
}

.model-badge.openai-pro {
    color: #10b981;
    font-weight: 600;
}

.model-badge.builtin {
    color: #fbbf24;
    font-weight: 600;
}

.ai-model-quick-presets {
    display: flex;
    gap: 8px;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 6px;
}

.btn-xs-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 10px;
    color: #94a3b8;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.12s ease;
}

.btn-xs-link:hover {
    color: #38bdf8;
}

/* Candidate Comparison Strip in Visual Card */
.ai-candidate-selector {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: var(--radius-sm);
}

.candidate-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #cbd5e1;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.candidate-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.candidate-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    font-size: 11px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.candidate-tab:hover {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.2);
    color: #f1f5f9;
}

.candidate-tab.active {
    border-color: #38bdf8;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(168, 85, 247, 0.25));
    color: #38bdf8;
    font-weight: 700;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

/* ==========================================================================
   AI Visual Generation Mode: From Scratch vs Dive & Alter Specific Preset
   ========================================================================== */

.ai-visual-target-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: var(--radius-sm);
    padding: 10px;
    animation: fadeIn 0.18s ease;
}

.ai-target-mode-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-target-mode-label {
    font-size: 11px;
    font-weight: 700;
    color: #e2e8f0;
    min-width: 38px;
}

.ai-target-mode-pills {
    display: flex;
    gap: 4px;
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-target-mode-pill {
    flex: 1;
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ai-target-mode-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.ai-target-mode-pill.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(56, 189, 248, 0.25));
    border-color: rgba(168, 85, 247, 0.5);
    color: #f1f5f9;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.25);
}

.ai-preset-target-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-preset-target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-preset-target-title {
    font-size: 11px;
    font-weight: 600;
    color: #c084fc;
}

.ai-preset-active-indicator {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.ai-mutation-chips-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 4px;
}

.ai-mutation-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ai-mutation-chip {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #e9d5ff;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-mutation-chip:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: #c084fc;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

/* ==========================================================================
   Ultra-Experimental Zero-Reference Visualizer Buttons & Badges
   ========================================================================== */

.btn-experimental-preset {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(6, 182, 212, 0.22)) !important;
    border: 1px solid rgba(168, 85, 247, 0.55) !important;
    color: #f5f3ff !important;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.25);
}

.btn-experimental-preset:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.45), rgba(6, 182, 212, 0.45)) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.55), 0 0 24px rgba(6, 182, 212, 0.3);
}

.btn-hud-experimental {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(14, 165, 233, 0.25)) !important;
    border: 1px solid rgba(168, 85, 247, 0.5) !important;
    color: #ede9fe !important;
    font-weight: 600;
    font-size: 11px;
    padding: 3px 9px;
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.3);
}

.btn-hud-experimental:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.55), rgba(14, 165, 233, 0.45)) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
}

.btn-experimental-action {
    background: linear-gradient(135deg, #7c3aed, #0284c7) !important;
    border: 1px solid rgba(192, 132, 252, 0.6) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    letter-spacing: 0.3px;
    border-radius: var(--radius-md);
    padding: 8px 12px;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(124, 58, 237, 0.4);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
}

.btn-experimental-action:hover {
    background: linear-gradient(135deg, #8b5cf6, #0ea5e9) !important;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.65), 0 0 28px rgba(14, 165, 233, 0.4);
    transform: translateY(-1px);
}

.btn-experimental-action:active,
.btn-experimental-preset:active,
.btn-hud-experimental:active {
    transform: translateY(1px);
}

.badge-experimental {
    background: rgba(168, 85, 247, 0.22);
    border: 1px solid rgba(168, 85, 247, 0.6);
    color: #d8b4fe;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    padding: 1px 5px;
    margin-right: 6px;
}




/* Keep the workspace within the space left by the guest notice. */
body { display:flex; flex-direction:column; height:100dvh; overflow:hidden; }
#guest-edition-notice { flex:0 0 auto; }
#app { flex:1 1 0; min-height:0; height:auto; width:100%; }
.app-main, .stage-section, .viewport-wrapper { min-height:0; min-width:0; }
.app-header { height:auto; min-height:54px; flex-wrap:wrap; gap:8px; padding:8px 14px; }
.header-actions { flex-wrap:wrap; gap:8px; }
.transport-bar { min-height:56px; height:auto; flex-shrink:0; }
.viewport-hud > .hud-item { display:none; }
.preview-tools { position:static; flex-shrink:0; display:flex; flex-wrap:wrap; gap:6px; padding:6px 12px; background:var(--bg-surface); border-top:1px solid var(--border-subtle); }
.timeline-header { height:auto; min-height:42px; flex-wrap:wrap; padding:8px 10px; gap:8px; flex-shrink:0; }
.timeline-actions { flex-wrap:wrap; gap:6px; }
.timeline-actions .btn { flex:0 0 auto; white-space:nowrap; min-height:32px; padding:6px 10px; line-height:1.3; }
.timeline-zoom-controls { flex-wrap:wrap; }
.timeline-drawer { max-height:38dvh; overflow:auto; }
.timeline-scroll-viewport { flex-shrink:0; }
.btn-pro-upgrade, .btn-ai-director, .btn-glow-ai { color:#fff !important; background:linear-gradient(135deg,#7521a3,#a51e70) !important; }
.btn-pro-upgrade *, .btn-ai-director *, .btn-glow-ai * { color:#fff !important; opacity:1; }
.studio-settings { position:relative; }
.studio-settings summary { list-style:none; cursor:pointer; }
.studio-settings-menu { position:absolute; right:0; top:calc(100% + 8px); width:280px; padding:16px; background:var(--bg-surface-raised); border:1px solid var(--border-strong); border-radius:8px; z-index:100; box-shadow:0 12px 35px #0008; }
.studio-settings-menu p { font-size:12px; color:var(--text-secondary); margin-top:12px; }
.brand-logo img { display:block; }
.milkdrop-import { margin:8px 0; cursor:pointer; }

.studio-settings:not([open]) .studio-settings-menu { display:none; }
.dropzone-card { max-height:100%; overflow:auto; padding:20px; }

.custom-scene-collection .btn { margin-top:8px; }
.preset-item.custom-scene-item { align-items:flex-start; white-space:normal; min-height:68px; padding:10px; }
.custom-scene-item > span:last-child { display:block; line-height:1.4; white-space:normal; }
.custom-scene-item small { display:block; margin-top:5px; color:var(--text-secondary); font-size:11px; font-weight:400; }

/* One layout for phones and tablets: no fixed-height parent or overlapping bars. */
.guest-notice-short, #btn-back-to-preview { display:none; }
@media (max-width:960px) {
    html { scroll-padding-top:8px; }
    body { display:block; height:auto; min-height:100svh; overflow-x:hidden; overflow-y:auto; }
    #app { display:flex; flex:none; width:100%; height:auto; min-height:0; }
    #guest-edition-notice { padding:7px 12px !important; font-size:12px !important; line-height:1.4 !important; }
    .guest-notice-long { display:none; }
    .guest-notice-short { display:inline; }
    .app-header { height:auto; min-height:0; max-height:none; padding:10px 12px; flex-flow:column; align-items:stretch; overflow:visible; gap:8px; }
    .brand { width:100%; gap:8px; }
    .brand-title { font-size:15px; }
    .brand-badge { display:none !important; }
    .header-actions { width:100%; flex:none; justify-content:flex-start; gap:6px; flex-wrap:wrap; overflow:visible; }
    .header-actions .btn, .studio-settings summary { width:auto !important; height:40px !important; min-height:40px !important; max-height:none !important; padding:6px 10px !important; font-size:12px !important; }
    .header-actions .btn-text { display:inline !important; }
    .ai-sparkle-badge, .header-btn-phone { display:none !important; }
    #btn-toggle-timeline { display:inline-flex !important; }
    .studio-settings-menu { position:absolute; left:0; right:auto; width:min(280px,85vw); }
    .app-main { flex:none; display:flex; flex-direction:column; overflow:visible; }
    .stage-section, .stage-section.aspect-vertical { flex:none; width:100%; height:auto; min-height:0; max-height:none; overflow:visible; }
    .viewport-wrapper { order:0; flex:none; position:relative; width:100%; height:clamp(180px,56.25vw,340px) !important; min-height:180px; max-height:none; padding:4px !important; overflow:hidden; }
    .stage-section.aspect-vertical .viewport-wrapper { height:min(56svh,460px) !important; min-height:240px; }
    .stage-frame-box { flex-shrink:0; max-width:100%; max-height:100%; }
    .transport-bar { order:1; position:static; top:auto; bottom:auto; width:100%; height:auto !important; min-height:58px; flex-shrink:0; flex-wrap:nowrap; padding:8px; gap:8px; z-index:auto; }
    .transport-btn { width:42px; height:42px; min-width:42px; flex-shrink:0; }
    .scrubber-wrapper { flex:1; min-width:0; height:36px; }
    .time-display { flex-shrink:0; min-width:28px; font-size:11px; }
    .volume-control { display:none !important; }
    .btn-transport-open-audio { flex:none; min-width:42px; min-height:42px; padding:8px; margin-left:0 !important; }
    .btn-transport-open-audio .btn-text { display:none; }
    .viewport-hud.preview-tools { order:2; position:static; inset:auto; width:100%; max-width:none; height:auto; min-height:44px; padding:6px 8px; flex-wrap:wrap; justify-content:flex-start; gap:6px; transform:none; border-radius:0; z-index:auto; }
    .preview-tools .hud-item { display:none !important; }
    .preview-tools .hud-btn { min-height:34px; padding:6px 10px; font-size:12px; line-height:1.2; }
    .preview-tools .hud-btn .btn-text, .preview-tools #record-label { display:inline !important; }
    .hud-aspect-switcher, #btn-hud-compact-toggle { display:none !important; }
    .timeline-drawer { order:3; flex:none; width:100%; height:auto !important; min-height:0; max-height:none; overflow:visible; }
    .timeline-drawer.collapsed { display:none; }
    .timeline-header { height:auto; min-height:0; padding:10px 8px; gap:8px; flex-wrap:wrap; }
    .timeline-title-group { width:100%; flex-wrap:wrap; }
    .timeline-zoom-controls { max-width:100%; gap:4px; flex-wrap:wrap; }
    .timeline-actions { width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
    .timeline-actions .btn { min-height:44px; width:100%; white-space:normal; padding:8px; }
    .timeline-scroll-viewport { height:120px; flex:none; overflow-x:auto; }
    .cue-inspector { flex-wrap:wrap; }
    .sidebar-section { flex:none; width:100%; height:auto; min-height:0; max-height:none; overflow:visible; border-left:0; border-top:1px solid var(--border-subtle); }
    .sidebar-tabs { position:sticky; top:0; z-index:30; overflow-x:auto; flex-wrap:nowrap; }
    .tab-btn { flex:1 0 auto; min-height:44px; padding:10px; font-size:12px; }
    #btn-back-to-preview { display:inline-flex; flex:none; align-items:center; min-height:44px; padding:8px 10px; font-size:12px; border:0; border-radius:0; }
    .tab-content, .tab-content.active { flex:none; height:auto; min-height:0; overflow:visible; padding:12px; }
    .preset-list { max-height:460px; overflow-y:auto; touch-action:pan-y; }
    .preset-quick-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
    .preset-quick-actions .btn { min-height:40px; }
    .aspect-ratio-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .dropzone-card { max-height:100%; width:calc(100% - 16px); padding:12px; border-radius:8px; overflow:auto; }
    .dropzone-icon { display:none; }
    .dropzone-card h3 { font-size:17px; }
    .dropzone-card p { margin:6px 0 10px; font-size:12px; }
    .dropzone-actions { gap:6px; }
    .dropzone-actions .btn { min-height:36px; padding:6px 10px; }
    .ai-director-panel { position:fixed; inset:auto 0 0; max-height:85svh; overflow-y:auto; z-index:1000; border-radius:16px 16px 0 0; padding-bottom:max(16px,env(safe-area-inset-bottom)); }
    .auth-modal-card, .pro-modal-card, .modal-card { width:100%; max-width:calc(100vw - 20px); max-height:90svh; overflow-y:auto; }
}

@media (max-width:960px) and (max-height:520px) and (orientation:landscape) {
    .viewport-wrapper, .stage-section.aspect-vertical .viewport-wrapper { height:clamp(140px,45svh,220px) !important; min-height:140px; }
    .app-header { padding:6px 10px; gap:6px; }
}

@media (max-width:960px) {
 .timeline-zoom-controls .btn { min-width:32px; min-height:32px; }
 .zoom-preset-group button { min-height:30px; min-width:30px; }
}

.custom-motion-profiles { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.custom-motion-profiles .btn.active { border-color:var(--accent-blue); color:#dbeafe; background:#172554; }
.custom-motion-group { border-top:1px solid var(--border-subtle); padding:8px 0; }
.custom-motion-group summary { cursor:pointer; font-size:13px; font-weight:600; padding:6px 0; }
.custom-motion-slider { display:grid; grid-template-columns:minmax(0,1fr) 45px; gap:6px 10px; padding:8px 0; }
.custom-motion-slider label { grid-column:1/-1; font-size:12px; color:var(--text-secondary); }
.custom-motion-slider input { width:100%; min-width:0; height:26px; accent-color:var(--accent-blue); }
.custom-motion-slider output { font:12px var(--font-mono); align-self:center; text-align:right; }
@media(max-width:960px) { .custom-motion-slider input { height:34px; } .custom-motion-profiles .btn { min-height:40px; } }

#custom-audio-meter { display:block; width:100%; height:9px; margin:-5px 0 12px; }

.custom-motion-slider[hidden] { display:none; }

.custom-motion-group[hidden] { display:none; }
#tab-knobs .slider-row[hidden], #tab-knobs .panel-box[hidden] { display:none; }

/* Sequential studio workspace: preview, timeline, settings, actions and libraries. */
body { height:auto; min-height:100dvh; overflow-x:hidden; overflow-y:auto; }
#app { height:auto; min-height:0; flex:none; }
.app-main { display:flex; flex-direction:column; flex:none; overflow:visible; width:min(1440px,100%); margin:0 auto; }
.app-header { flex-flow:row nowrap; align-items:center; padding:10px 16px; }
.brand { width:auto; min-width:0; }
.brand-badge { display:none; }
.header-menu { position:relative; flex:none; margin-left:auto; }
.header-menu > summary { display:flex; align-items:center; justify-content:center; list-style:none; cursor:pointer; width:44px; min-height:44px; font-size:24px; }
.header-menu summary::-webkit-details-marker, .workspace-tools summary::-webkit-details-marker { display:none; }
.header-menu .header-actions { position:absolute; top:calc(100% + 8px); right:0; width:min(330px,calc(100vw - 24px)); max-height:75dvh; overflow-y:auto; padding:14px; display:flex; flex-direction:column; align-items:stretch; gap:10px; background:var(--bg-surface-raised); border:1px solid var(--border-strong); border-radius:10px; box-shadow:0 12px 35px #0009; z-index:100; }
.header-menu:not([open]) .header-actions { display:none; }
.header-menu .header-actions > .btn { width:100% !important; min-height:42px; justify-content:flex-start; }
.header-menu .header-btn-phone, .header-menu .btn-text { display:inline !important; }
.header-menu .studio-settings-menu { position:static; width:100%; margin-top:8px; box-shadow:none; padding:10px; }
.header-menu .studio-settings > summary { min-height:42px; }
.stage-section, .stage-section.aspect-vertical { flex:none; width:100%; height:auto; min-height:0; overflow:visible; background:var(--bg-base); }
.viewport-wrapper { order:0; flex:none; height:clamp(260px,55dvh,720px); min-height:0; }
.stage-section.aspect-vertical .viewport-wrapper { height:min(65dvh,720px); }
.transport-bar { order:1; position:static; }
.timeline-drawer { order:2; flex:none; max-height:none; height:auto; overflow:visible; }
.timeline-scroll-viewport { flex:none; min-height:120px; }
#timeline-settings-panel { order:3; margin:12px; }
.workspace-actions { order:4; margin:0 12px 12px; display:flex; align-items:flex-start; flex-wrap:wrap; gap:8px; }
.workspace-actions > .btn, .workspace-tools > summary { min-height:44px; padding:10px 14px; white-space:normal; }
.workspace-tools { flex:1 1 220px; min-width:0; }
.workspace-tools > summary { display:inline-flex; align-items:center; cursor:pointer; list-style:none; }
.workspace-tools-body { margin-top:10px; padding:12px; display:flex; flex-wrap:wrap; align-items:center; gap:8px; background:var(--bg-surface-raised); border:1px solid var(--border-strong); border-radius:8px; }
.workspace-tools:not([open]) .workspace-tools-body { display:none; }
.workspace-tools-body .btn { min-height:42px; padding:8px 12px; }
.workspace-tools-body .btn-text { display:inline !important; }
.workspace-tools-body #hud-aspect-switcher { display:flex !important; flex-wrap:wrap; }
#preset-library-panel { order:5; margin:0 12px 12px; }
#custom-presets-panel { order:6; margin:0 12px 12px; }
.preset-list { max-height:420px; overflow-y:auto; }
.preset-quick-actions { display:flex; flex-wrap:wrap; gap:8px; }
.preset-quick-actions .btn { min-height:42px; }
.sidebar-section { flex:none; width:100%; height:auto; overflow:visible; border-left:0; border-top:1px solid var(--border-subtle); }
.tab-content.active { flex:none; height:auto; overflow:visible; }
.stage-section > .sidebar-section { order:5; margin:0 12px 12px; width:auto; border:1px solid var(--border-subtle); border-radius:8px; overflow:hidden; }
.sidebar-section > .tab-content { display:none; }
.sidebar-section > .tab-content.active { display:flex; flex:none; height:min(68svh,720px); overflow-y:auto; padding:12px; gap:12px; }
#tab-presets.active { display:flex !important; }
#tab-presets:not(.active) { display:none !important; }
#tab-presets #preset-library-panel, #tab-presets #custom-presets-panel { order:initial; margin:0; flex-shrink:0; }
.sidebar-section > .sidebar-tabs { order:10; position:static; flex-shrink:0; border-top:1px solid var(--border-subtle); border-bottom:0; }
.sidebar-section .tab-btn { min-height:48px; border-bottom:0; border-top:2px solid transparent; }
.sidebar-section .tab-btn.active { border-top-color:var(--accent-blue); }
.pro-feature-locked:is(button,summary)::after { content:' 🔒'; font-size:11px; }
[hidden], .viewport-hud[hidden], .timeline-actions[hidden] { display:none !important; }
.stage-fullscreen-button { position:absolute; right:14px; top:14px; z-index:50; width:44px; min-height:44px; visibility:hidden; opacity:0; pointer-events:none; background:#12151bd9; }
.show-preview-controls .stage-fullscreen-button { visibility:visible; opacity:1; pointer-events:auto; }
.viewport-wrapper:fullscreen { width:100vw; height:100dvh !important; max-height:none; background:#000; }
@media(max-width:960px) {
 .app-header { flex-direction:row; }
 .viewport-wrapper { height:clamp(180px,56.25vw,440px) !important; min-height:180px; }
 .stage-section.aspect-vertical .viewport-wrapper { height:min(56svh,460px) !important; }
 .workspace-actions > .btn { flex:1 1 140px; }
 .workspace-tools { flex-basis:100%; }
 .workspace-tools-body { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
 .workspace-tools-body .btn { width:100%; }
 .workspace-tools-body #hud-aspect-switcher { grid-column:1/-1; }
 #timeline-settings-panel, #preset-library-panel, #custom-presets-panel { margin-left:8px; margin-right:8px; }
 .stage-section > .sidebar-section { margin-left:8px; margin-right:8px; }
}

/* Account forms use the same readable controls on desktop and narrow screens. */
.auth-modal-card { max-height: calc(100dvh - 32px); overflow-y: auto; }
.auth-modal-card input:is([type="text"], [type="email"], [type="password"]) {
    width: 100%; min-width: 0; box-sizing: border-box;
    padding: 11px 12px; color: var(--text-primary); background: var(--bg-surface);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
    font: inherit; font-size: 16px;
}
.auth-modal-card input:focus { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
#account-recovery .btn, #btn-forgot-password { margin-top: 10px; }
#account-email-status { margin: 8px 0 16px; overflow-wrap: anywhere; }
