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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    color: white;
    overflow: hidden;
    height: 100vh;
}

.visualizer-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.visualizer-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    z-index: 100;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.visualizer-container:hover .visualizer-header {
    transform: translateY(0);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(45deg, #64ffda, #40e0d0, #00bcd4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ffa726;
    transition: all 0.3s ease;
}

.status-dot.active {
    background-color: #66bb6a;
    animation: pulse 2s infinite;
}

.status-dot.error {
    background-color: #ef5350;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
}

.audio-level {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.level-bar {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.level-fill {
    height: 100%;
    background: linear-gradient(90deg, #66bb6a, #ffa726, #ef5350);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease-out;
}

/* Main Visualization Area */
.visualization-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#visualizerCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

/* Activation Overlay */
.activation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.activation-overlay.hidden {
    display: none;
}

.activation-content {
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

.activation-icon {
    font-size: 128px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.activation-content h2 {
    font-size: 28px;
    margin-bottom: 16px;
    background: linear-gradient(45deg, #64ffda, #40e0d0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.activation-content p {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 32px;
    line-height: 1.5;
}

.capture-button {
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.capture-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.capture-button:active {
    transform: translateY(0);
}

/* Info Panel */
.info-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    min-width: 200px;
    font-size: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

.info-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Show info panel on hover when visible setting is enabled */
.visualizer-container:hover .info-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    opacity: 0.7;
}

.info-value {
    font-weight: 600;
    color: #64ffda;
}

.control-button {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: white;
}

.control-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.control-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stop-button:not(:disabled) {
    background: rgba(239, 83, 80, 0.2);
    border-color: rgba(239, 83, 80, 0.5);
    color: #ef5350;
}

.stop-button:hover:not(:disabled) {
    background: rgba(239, 83, 80, 0.3);
}

.settings-button {
    background: rgba(255, 167, 38, 0.2);
    border-color: rgba(255, 167, 38, 0.5);
    color: #ffa726;
}

.settings-button:hover {
    background: rgba(255, 167, 38, 0.3);
}

.fullscreen-button {
    background: rgba(100, 255, 218, 0.2);
    border-color: rgba(100, 255, 218, 0.5);
    color: #64ffda;
}

.fullscreen-button:hover {
    background: rgba(100, 255, 218, 0.3);
}

.fps-counter {
    font-size: 12px;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
}

/* Settings Click Area - invisible full screen for click-outside */
.settings-click-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 160;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-click-area.open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

/* Settings Backdrop - only covers area behind panel */
.settings-backdrop {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    z-index: 150;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.settings-backdrop.open {
    right: 0;
    pointer-events: auto;
}

/* Settings Panel - transparent to show backdrop blur */
.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    backdrop-filter: blur(8px);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 200;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(45deg, #64ffda, #40e0d0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-settings {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-settings:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.settings-content {
    padding: 0 24px 24px;
}

/* Collapsible Settings Sections */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 8px 0;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.settings-section h4:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 8px;
    padding-right: 8px;
}

.section-toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.6);
}

.settings-section.collapsed .section-toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 1000px; /* Large enough for any content */
    opacity: 1;
}

.settings-section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

/* Special handling for nested sections like Linear Bars Position */
.settings-subsection {
    margin-top: 16px;
    padding-left: 16px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.settings-subsection h5 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 6px 0;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.settings-subsection h5:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 8px;
    padding-right: 8px;
}

.subsection-toggle-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.5);
}

.settings-subsection.collapsed .subsection-toggle-icon {
    transform: rotate(-90deg);
}

.subsection-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 500px;
    opacity: 1;
}

.settings-subsection.collapsed .subsection-content {
    max-height: 0;
    opacity: 0;
}

/* Theme Picker */
.theme-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-option:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.theme-option.active {
    border-color: #64ffda;
    background: rgba(100, 255, 218, 0.1);
}

.theme-preview {
    width: 40px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.default-theme {
    background: linear-gradient(90deg, #64ffda, #40e0d0, #00bcd4);
}

.neon-theme {
    background: linear-gradient(90deg, #ff00ff, #00ffff, #ffff00);
}

.sunset-theme {
    background: linear-gradient(90deg, #ff6b6b, #ffa726, #ffeb3b);
}

.ocean-theme {
    background: linear-gradient(90deg, #2196f3, #03dac6, #4caf50);
}

.theme-option span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* Toggle Switches */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-item input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-item input[type="checkbox"]:checked + .toggle-slider {
    background: #64ffda;
}

.toggle-item input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

/* Sliders */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.slider-container label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #64ffda;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(100, 255, 218, 0.3);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #64ffda;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(100, 255, 218, 0.3);
}

/* Select Dropdowns */
.select-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.select-container label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.settings-select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.settings-select:focus {
    border-color: #64ffda;
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.2);
}

.settings-select option {
    background: #1a1a2e;
    color: white;
}

/* Color Picker Styles */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.color-picker-container label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    width: 60px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.color-picker:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

.color-picker:focus {
    border-color: #64ffda;
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.2);
}

/* Remove default color picker styling in webkit browsers */
.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 4px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.reset-color-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-color-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

/* Recording Controls */
.recording-setup {
    margin-bottom: 20px;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.input-container label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.input-container input[type="text"] {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-container input[type="text"]:focus {
    border-color: #64ffda;
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.2);
}

.input-container input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.recording-options {
    margin-bottom: 12px;
}

.recording-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.record-button {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.record-button.start {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #4caf50;
}

.record-button.start:hover:not(:disabled) {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.7);
}

.record-button.stop {
    background: rgba(239, 83, 80, 0.2);
    border: 1px solid rgba(239, 83, 80, 0.5);
    color: #ef5350;
}

.record-button.stop:hover:not(:disabled) {
    background: rgba(239, 83, 80, 0.3);
    border-color: rgba(239, 83, 80, 0.7);
}

.record-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.recording-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: rgba(239, 83, 80, 0.1);
    border: 1px solid rgba(239, 83, 80, 0.3);
    border-radius: 6px;
    font-size: 14px;
    color: #ef5350;
    margin-bottom: 12px;
}

.recording-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #64ffda;
}

.recording-indicator {
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Reset Button */
.reset-button {
    width: 100%;
    padding: 12px;
    background: rgba(239, 83, 80, 0.2);
    border: 1px solid rgba(239, 83, 80, 0.5);
    border-radius: 6px;
    color: #ef5350;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-button:hover {
    background: rgba(239, 83, 80, 0.3);
    border-color: rgba(239, 83, 80, 0.7);
}

/* Responsive adjustments for settings panel */
@media (max-width: 600px) {
    .settings-panel {
        width: 100vw;
        right: -100vw;
    }
    
    .settings-backdrop {
        width: 100vw;
        right: -100vw;
    }
    
    .theme-picker {
        grid-template-columns: 1fr;
    }
    
    .header-left h1 {
        font-size: 18px;
    }
    
    .header-left,
    .header-center,
    .header-right {
        flex: none;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }
    
    .visualizer-header {
        flex-wrap: wrap;
    }
}