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

:root {
    /* Base HSV-inspired color system */
    --accent-hue: 25;
    --accent-saturation: 100%;
    --accent-lightness: 63%;
    
    /* Derived accent colors */
    --accent-color: hsl(var(--accent-hue), var(--accent-saturation), var(--accent-lightness));
    --accent-secondary: hsl(var(--accent-hue), var(--accent-saturation), calc(var(--accent-lightness) - 3%));
    
    /* Light mode colors (default) */
    --bg-color: #f5e6d3;
    --surface-color: #f5e6d3;
    --text-primary: #5c4633;
    --text-secondary: #8b7355;
    --shadow-dark: #d4c4b0;
    --shadow-light: #ffffff;
    --border-radius: 20px;
    
    /* Light direction for neomorphic shadows (angle in degrees) */
    --light-angle: 135deg; /* Top-left by default */
    --shadow-x: -3px; /* X offset based on angle */
    --shadow-y: -3px; /* Y offset based on angle */
    --shadow-x-inverse: 3px;
    --shadow-y-inverse: 3px;
    
    /* Gradient hue values - set by color scheme selector */
    --gradient-hue-1: calc(var(--accent-hue) - 30);
    --gradient-hue-2: calc(var(--accent-hue) - 15);
    --gradient-hue-3: var(--accent-hue);
    --gradient-hue-4: calc(var(--accent-hue) + 15);
    --gradient-hue-5: calc(var(--accent-hue) + 180);
    --gradient-hue-6: calc(var(--accent-hue) + 165);
    --gradient-hue-7: calc(var(--accent-hue) + 195);
    --gradient-hue-8: calc(var(--accent-hue) + 210);
    
    /* Multi-hue vibrant gradient colors - using dynamic hues */
    --gradient-color-1: hsl(var(--gradient-hue-1), 95%, 80%);
    --gradient-color-2: hsl(var(--gradient-hue-2), 90%, 75%);
    --gradient-color-3: hsl(var(--gradient-hue-3), 95%, 70%);
    --gradient-color-4: hsl(var(--gradient-hue-4), 90%, 75%);
    --gradient-color-5: hsl(var(--gradient-hue-5), 95%, 80%);
    --gradient-color-6: hsl(var(--gradient-hue-6), 90%, 75%);
    --gradient-color-7: hsl(var(--gradient-hue-7), 95%, 80%);
    --gradient-color-8: hsl(var(--gradient-hue-8), 90%, 85%);
    
    /* Melody-reactive colors - will be dynamically updated */
    --melody-hue-1: 180;
    --melody-hue-2: 240;
    --melody-hue-3: 300;
    --melody-hue-4: 60;
}

/* Dark mode colors */
body.dark-mode {
    --bg-color: #2a2420;
    --surface-color: #2a2420;
    --text-primary: #f5e6d3;
    --text-secondary: #c4b5a3;
    --shadow-dark: #1a1410;
    --shadow-light: #3a3430;
    
    /* Multi-hue darker vibrant gradient - using dynamic hues */
    --gradient-color-1: hsl(var(--gradient-hue-1), 75%, 30%);
    --gradient-color-2: hsl(var(--gradient-hue-2), 70%, 25%);
    --gradient-color-3: hsl(var(--gradient-hue-3), 75%, 28%);
    --gradient-color-4: hsl(var(--gradient-hue-4), 70%, 30%);
    --gradient-color-5: hsl(var(--gradient-hue-5), 75%, 32%);
    --gradient-color-6: hsl(var(--gradient-hue-6), 70%, 30%);
    --gradient-color-7: hsl(var(--gradient-hue-7), 75%, 35%);
    --gradient-color-8: hsl(var(--gradient-hue-8), 70%, 35%);
}

body.dark-mode .player-card {
    background: rgba(42, 36, 32, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .footer {
    background: rgba(42, 36, 32, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark mode adjustments for gradient layers */
body.dark-mode::before {
    opacity: 0.5;
    mix-blend-mode: soft-light;
}

body.dark-mode::after {
    opacity: 0.3;
    mix-blend-mode: overlay;
}

body {
    font-family: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Complex multi-layered mesh gradient with blend modes */
    background: 
        /* Base conic gradient */
        conic-gradient(from 45deg at 50% 50%,
            var(--gradient-color-1) 0deg,
            var(--gradient-color-2) 45deg,
            var(--gradient-color-3) 90deg,
            var(--gradient-color-4) 135deg,
            var(--gradient-color-5) 180deg,
            var(--gradient-color-6) 225deg,
            var(--gradient-color-7) 270deg,
            var(--gradient-color-8) 315deg,
            var(--gradient-color-1) 360deg);
    background-size: 200% 200%;
    background-position: 50% 50%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-primary);
    transition: background 0.5s ease;
    overflow-x: hidden;
    position: relative;
}

/* Layer 1: Melody-reactive radial gradients with screen blend mode */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 30%, 
            hsl(var(--melody-hue-1), 90%, 65%) 0%, 
            transparent 55%),
        radial-gradient(ellipse at 80% 20%, 
            hsl(var(--melody-hue-2), 85%, 68%) 0%, 
            transparent 50%),
        radial-gradient(ellipse at 60% 80%, 
            hsl(var(--melody-hue-3), 88%, 70%) 0%, 
            transparent 52%),
        radial-gradient(ellipse at 15% 75%, 
            hsl(var(--melody-hue-4), 92%, 67%) 0%, 
            transparent 48%);
    background-size: 450% 450%, 380% 380%, 420% 420%, 400% 400%;
    background-position: 0% 50%, 50% 0%, 100% 50%, 50% 100%;
    animation: layer1-move 30s ease-in-out infinite;
    mix-blend-mode: screen;
    opacity: 0.7;
    pointer-events: none;
    z-index: 1;
}

/* Layer 2: Additional radial gradients with multiply blend mode */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 40% 40%, 
            var(--gradient-color-2) 0%, 
            transparent 45%),
        radial-gradient(circle at 70% 65%, 
            var(--gradient-color-5) 0%, 
            transparent 48%),
        radial-gradient(circle at 25% 85%, 
            var(--gradient-color-3) 0%, 
            transparent 42%),
        radial-gradient(circle at 85% 35%, 
            var(--gradient-color-7) 0%, 
            transparent 50%);
    background-size: 350% 350%, 320% 320%, 380% 380%, 340% 340%;
    background-position: 25% 75%, 75% 25%, 10% 60%, 90% 40%;
    animation: layer2-move 35s ease-in-out infinite reverse;
    mix-blend-mode: multiply;
    opacity: 0.4;
    pointer-events: none;
    z-index: 2;
}

/* Layer 3: Instrument-reactive gradients for each instrument */
.gradient-layer-drums,
.gradient-layer-bass,
.gradient-layer-piano,
.gradient-layer-guitar,
.gradient-layer-melody {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(80px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    will-change: transform, opacity;
}

.gradient-layer-drums {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 100, 100, 0.6) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.gradient-layer-bass {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(100, 150, 255, 0.5) 0%, transparent 70%);
    top: 50%;
    left: 20%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.gradient-layer-piano {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(255, 200, 100, 0.5) 0%, transparent 70%);
    top: 30%;
    right: 20%;
    transform: translate(50%, -50%);
    z-index: 3;
}

.gradient-layer-guitar {
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(150, 255, 150, 0.5) 0%, transparent 70%);
    top: 70%;
    right: 30%;
    transform: translate(50%, -50%);
    z-index: 3;
}

.gradient-layer-melody {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 150, 255, 0.6) 0%, transparent 70%);
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

/* Active state for instrument layers */
.gradient-layer-drums.active { opacity: 0.8; transform: translate(-50%, -50%) scale(1.2); }
.gradient-layer-bass.active { opacity: 0.7; transform: translate(-50%, -50%) scale(1.15); }
.gradient-layer-piano.active { opacity: 0.7; transform: translate(50%, -50%) scale(1.15); }
.gradient-layer-guitar.active { opacity: 0.7; transform: translate(50%, -50%) scale(1.15); }
.gradient-layer-melody.active { opacity: 0.85; transform: translate(-50%, -50%) scale(1.25); }

/* Container for all content to sit above gradient layers */
.container {
    position: relative;
    z-index: 10;
}

/* Performance mode - disable expensive effects for low-end devices */
body.performance-mode::before,
body.performance-mode::after {
    display: none;
}

body.performance-mode .gradient-layer-drums,
body.performance-mode .gradient-layer-bass,
body.performance-mode .gradient-layer-piano,
body.performance-mode .gradient-layer-guitar,
body.performance-mode .gradient-layer-melody {
    display: none;
}

body.performance-mode {
    background: linear-gradient(135deg, 
        var(--gradient-color-1) 0%, 
        var(--gradient-color-4) 50%, 
        var(--gradient-color-5) 100%);
    background-size: 100% 100%;
    animation: none;
}

body.performance-mode .player-card,
body.performance-mode .visualizer,
body.performance-mode .info-item,
body.performance-mode .control-section,
body.performance-mode .info-section,
body.performance-mode .settings-section,
body.performance-mode .theme-section {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

@keyframes layer1-move {
    0% {
        background-position: 0% 50%, 50% 0%, 100% 50%, 50% 100%;
    }
    25% {
        background-position: 40% 80%, 80% 40%, 70% 70%, 30% 30%;
    }
    50% {
        background-position: 80% 60%, 60% 80%, 40% 90%, 90% 40%;
    }
    75% {
        background-position: 50% 20%, 20% 50%, 80% 30%, 70% 80%;
    }
    100% {
        background-position: 0% 50%, 50% 0%, 100% 50%, 50% 100%;
    }
}

@keyframes layer2-move {
    0% {
        background-position: 25% 75%, 75% 25%, 10% 60%, 90% 40%;
    }
    30% {
        background-position: 60% 90%, 90% 60%, 50% 40%, 40% 50%;
    }
    60% {
        background-position: 85% 45%, 45% 85%, 70% 70%, 30% 30%;
    }
    100% {
        background-position: 25% 75%, 75% 25%, 10% 60%, 90% 40%;
    }
}

@keyframes mesh-gradient-move {
    0% {
        background-position: 0% 50%, 50% 0%, 100% 50%, 50% 100%, 0% 0%;
    }
    20% {
        background-position: 30% 70%, 70% 30%, 80% 60%, 20% 80%, 25% 25%;
    }
    40% {
        background-position: 70% 80%, 90% 50%, 50% 90%, 10% 40%, 50% 50%;
    }
    60% {
        background-position: 90% 40%, 40% 90%, 20% 70%, 60% 10%, 75% 75%;
    }
    80% {
        background-position: 50% 20%, 20% 60%, 40% 30%, 80% 70%, 50% 50%;
    }
    100% {
        background-position: 0% 50%, 50% 0%, 100% 50%, 50% 100%, 0% 0%;
    }
}

body.drum-beat {
    background-size: 220% 220%;
}

body.drum-beat::before {
    animation: layer1-move 30s ease-in-out infinite, drum-pulse-layer1 0.3s ease;
}

body.drum-beat::after {
    animation: layer2-move 35s ease-in-out infinite reverse, drum-pulse-layer2 0.3s ease;
}

@keyframes drum-pulse-layer1 {
    0% {
        background-size: 450% 450%, 380% 380%, 420% 420%, 400% 400%;
        opacity: 0.7;
    }
    50% {
        background-size: 480% 480%, 410% 410%, 450% 450%, 430% 430%;
        opacity: 0.85;
    }
    100% {
        background-size: 450% 450%, 380% 380%, 420% 420%, 400% 400%;
        opacity: 0.7;
    }
}

@keyframes drum-pulse-layer2 {
    0% {
        background-size: 350% 350%, 320% 320%, 380% 380%, 340% 340%;
        opacity: 0.4;
    }
    50% {
        background-size: 380% 380%, 350% 350%, 410% 410%, 370% 370%;
        opacity: 0.5;
    }
    100% {
        background-size: 350% 350%, 320% 320%, 380% 380%, 340% 340%;
        opacity: 0.4;
    }
}

.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-card {
    background: rgba(245, 230, 211, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--border-radius);
    padding: 25px 25px;
    box-shadow: 
        calc(var(--shadow-x-inverse) * 3) calc(var(--shadow-y-inverse) * 3) 16px var(--shadow-dark),
        calc(var(--shadow-x) * 3) calc(var(--shadow-y) * 3) 16px var(--shadow-light);
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Desktop Bento Box Layout */
@media (min-width: 1024px) {
    .container {
        max-width: 1400px;
    }
    
    .player-card {
        padding: 30px;
        gap: 15px;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: auto auto 1fr auto;
        grid-auto-rows: minmax(120px, auto);
    }
    
    /* Header spans full width */
    .player-card > .title {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    
    .player-card > .subtitle {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    
    /* Visualizer takes up most space - left side, tall */
    .player-card > .visualizer {
        grid-column: 1 / 3;
        grid-row: 3 / 5;
        min-height: 500px;
    }
    
    /* Playback section - top right */
    .player-card > .control-section {
        grid-column: 3 / 5;
        grid-row: 3;
    }
    
    /* Current State - right side */
    .player-card > .info-section {
        grid-column: 3 / 5;
        grid-row: 4;
    }
    
    /* Music Settings - bottom left */
    .player-card > .settings-section {
        grid-column: 1 / 3;
        grid-row: 5;
    }
    
    /* Appearance - bottom right, spans 1 column */
    .player-card > .theme-section {
        grid-column: 3 / 4;
        grid-row: 5;
    }
    
    /* Audio section - bottom far right */
    .player-card > .audio-section {
        grid-column: 4 / 5;
        grid-row: 5;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .player-card {
        grid-template-columns: 1fr 1fr;
    }
    
    .player-card > .title,
    .player-card > .subtitle,
    .player-card > .visualizer {
        grid-column: 1 / -1;
    }
}

.title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    text-align: center;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

.visualizer {
    background: rgba(245, 230, 211, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px 15px;
    box-shadow: 
        inset calc(var(--shadow-x-inverse) * 1.3) calc(var(--shadow-y-inverse) * 1.3) 8px rgba(212, 196, 176, 0.3),
        inset calc(var(--shadow-x) * 1.3) calc(var(--shadow-y) * 1.3) 8px rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 250px;
    height: 100%;
}

.visualizer-header {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}

.visualizer-mode-btn,
.record-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.visualizer-mode-btn:hover,
.record-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.visualizer-mode-btn.active {
    background: var(--accent-color);
    color: white;
}

.record-btn.recording {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.3);
}

.record-btn.recording .record-icon {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.spectrum-visualizer {
    width: 100%;
    height: 220px;
    border-radius: 10px;
}

/* Section containers with visualizer-style styling */
.control-section,
.info-section,
.settings-section,
.theme-section {
    background: rgba(245, 230, 211, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 18px 15px;
    box-shadow: 
        inset 4px 4px 8px rgba(212, 196, 176, 0.3),
        inset -4px -4px 8px rgba(255, 255, 255, 0.3);
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
    text-align: center;
}

body.dark-mode .visualizer {
    background: rgba(42, 36, 32, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset 4px 4px 8px rgba(26, 20, 16, 0.5),
        inset -4px -4px 8px rgba(58, 52, 48, 0.3);
}

body.dark-mode .visualizer-mode-btn,
body.dark-mode .record-btn {
    background: rgba(50, 50, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .visualizer-mode-btn:hover,
body.dark-mode .record-btn:hover {
    background: rgba(70, 70, 70, 0.9);
}

body.dark-mode .control-section,
body.dark-mode .info-section,
body.dark-mode .settings-section,
body.dark-mode .theme-section {
    background: rgba(42, 36, 32, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset 4px 4px 8px rgba(26, 20, 16, 0.5),
        inset -4px -4px 8px rgba(58, 52, 48, 0.3);
}

.layer-visualizer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    flex: 1;
    justify-content: space-evenly;
}

@media (min-width: 1024px) {
    .layer-visualizer {
        max-width: 100%;
        gap: 20px;
    }
}

.layer-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.layer-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-bars {
    display: flex;
    gap: 8px;
    flex: 1;
    align-items: flex-end;
    height: 40px;
}

@media (min-width: 1024px) {
    .layer-bars {
        height: 60px;
        gap: 12px;
    }
    
    .layer-label {
        font-size: 0.85rem;
        min-width: 70px;
    }
}

.layer-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--accent-color), var(--accent-secondary));
    border-radius: 4px;
    height: 10px;
    transition: height 0.1s ease, opacity 0.1s ease;
    opacity: 0.3;
}

.layer-bar.active {
    opacity: 1;
    animation: bar-pulse 0.3s ease;
}

@keyframes bar-pulse {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.2);
    }
}

.wave-container {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.wave {
    width: 8px;
    height: 50px;
    background: linear-gradient(180deg, var(--accent-color), var(--accent-secondary));
    border-radius: 4px;
    animation: wave-pulse 0.8s ease-in-out infinite;
    opacity: 0.6;
}

.wave:nth-child(1) {
    animation-delay: 0s;
    animation-duration: 0.9s;
}

.wave:nth-child(2) {
    animation-delay: 0.1s;
    animation-duration: 0.75s;
}

.wave:nth-child(3) {
    animation-delay: 0.2s;
    animation-duration: 0.85s;
}

.wave:nth-child(4) {
    animation-delay: 0.3s;
    animation-duration: 0.95s;
}

.wave:nth-child(5) {
    animation-delay: 0.4s;
    animation-duration: 0.8s;
}

.wave:nth-child(6) {
    animation-delay: 0.5s;
    animation-duration: 0.9s;
}

.wave:nth-child(7) {
    animation-delay: 0.6s;
    animation-duration: 0.85s;
}

.wave:nth-child(8) {
    animation-delay: 0.7s;
    animation-duration: 0.75s;
}

.wave:nth-child(9) {
    animation-delay: 0.05s;
    animation-duration: 0.95s;
}

.wave:nth-child(10) {
    animation-delay: 0.15s;
    animation-duration: 0.8s;
}

.wave:nth-child(11) {
    animation-delay: 0.25s;
    animation-duration: 0.9s;
}

.wave:nth-child(12) {
    animation-delay: 0.35s;
    animation-duration: 0.85s;
}

@keyframes wave-pulse {
    0%, 100% {
        height: 50px;
        opacity: 0.6;
    }
    50% {
        height: 120px;
        opacity: 1;
    }
}

.wave.playing {
    animation-play-state: running;
}

.wave.paused {
    animation-play-state: paused;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.control-btn {
    background: var(--surface-color);
    border: none;
    border-radius: 50px;
    padding: 18px 50px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    justify-content: center;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

.control-btn.playing {
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}

.play-icon {
    font-size: 1.2rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    background: var(--surface-color);
    padding: 15px 20px;
    border-radius: 50px;
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
}

.volume-label {
    font-size: 1.3rem;
    cursor: pointer;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: var(--surface-color);
    outline: none;
    border-radius: 10px;
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-color);
    cursor: pointer;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
}

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

.volume-slider::-webkit-slider-thumb:active {
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.volume-slider::-moz-range-track {
    height: 8px;
    background: var(--surface-color);
    border-radius: 10px;
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.volume-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-color);
    cursor: pointer;
    border: none;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.volume-slider::-moz-range-thumb:active {
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.volume-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 38px;
    text-align: right;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    background: var(--surface-color);
    padding: 15px 20px;
    border-radius: 50px;
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
}

.control-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: var(--surface-color);
    outline: none;
    border-radius: 10px;
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.slider.compact-slider {
    height: 6px;
    min-width: 100px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-color);
    cursor: pointer;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
}

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

.slider::-webkit-slider-thumb:active {
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.slider::-moz-range-track {
    height: 8px;
    background: var(--surface-color);
    border-radius: 10px;
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-color);
    cursor: pointer;
    border: none;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.slider::-moz-range-thumb:active {
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.key-select {
    flex: 1;
    background: var(--surface-color);
    border: none;
    border-radius: 10px;
    padding: 8px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
    font-family: 'Outfit', sans-serif;
}

.key-select:hover {
    transform: translateY(-1px);
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.key-select:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.color-scheme-select {
    flex: 1;
    background: var(--surface-color);
    border: none;
    border-radius: 10px;
    padding: 8px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
    font-family: 'Outfit', sans-serif;
}

.color-scheme-select:hover {
    transform: translateY(-1px);
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.color-scheme-select:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.slider-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: right;
}

.info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.info-item {
    background: rgba(245, 230, 211, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: 15px;
    box-shadow: 
        3px 3px 6px rgba(212, 196, 176, 0.3),
        -3px -3px 6px rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 140px;
}

body.dark-mode .info-item {
    background: rgba(42, 36, 32, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        3px 3px 6px rgba(26, 20, 16, 0.5),
        -3px -3px 6px rgba(58, 52, 48, 0.3);
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.footer {
    text-align: center;
    padding: 15px 20px;
    background: rgba(245, 230, 211, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--border-radius);
    box-shadow: 
        6px 6px 12px rgba(212, 196, 176, 0.3),
        -6px -6px 12px rgba(255, 255, 255, 0.3);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.upcoming-melody {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 15px;
    background: var(--surface-color);
    border-radius: 15px;
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.melody-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.melody-notes {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.theme-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.theme-control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-color);
    padding: 8px 15px;
    border-radius: 12px;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
}

.theme-control-group.compact {
    padding: 6px 12px;
}

.theme-control-group.compact-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
}

.theme-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-picker {
    width: 50px;
    height: 35px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: var(--surface-color);
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
    transition: transform 0.2s ease;
}

.color-picker:hover {
    transform: scale(1.05);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 4px;
}

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

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

.theme-toggle {
    background: var(--surface-color);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
    font-size: 1.3rem;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.theme-toggle:active {
    transform: translateY(0);
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.performance-toggle {
    background: var(--surface-color);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
    font-size: 1.3rem;
}

.performance-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.performance-toggle:active,
.performance-toggle.active {
    transform: translateY(0);
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.performance-toggle.active .performance-icon {
    filter: grayscale(100%);
    opacity: 0.7;
}

/* Audio Section */
.audio-section {
    background: rgba(245, 230, 211, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 
        inset calc(var(--shadow-x-inverse) * 1.3) calc(var(--shadow-y-inverse) * 1.3) 8px rgba(212, 196, 176, 0.3),
        inset calc(var(--shadow-x) * 1.3) calc(var(--shadow-y) * 1.3) 8px rgba(255, 255, 255, 0.3);
}

body.dark-mode .audio-section {
    background: rgba(42, 36, 32, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset calc(var(--shadow-x-inverse) * 1.3) calc(var(--shadow-y-inverse) * 1.3) 8px rgba(26, 20, 16, 0.5),
        inset calc(var(--shadow-x) * 1.3) calc(var(--shadow-y) * 1.3) 8px rgba(58, 52, 48, 0.3);
}

.audio-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

@media (max-width: 480px) {
    .player-card {
        padding: 30px 20px;
    }
    
    .title {
        font-size: 1.6rem;
    }
    
    .control-btn {
        padding: 15px 40px;
        font-size: 1rem;
        min-width: 160px;
    }
    
    .info {
        flex-direction: column;
    }
    
    .info-item {
        width: 100%;
    }
    
    .upcoming-melody {
        flex-direction: column;
        gap: 5px;
    }
    
    .melody-notes {
        font-size: 0.8rem;
    }
    
    .theme-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .theme-control-group {
        width: 100%;
        justify-content: center;
    }
    
    .volume-control {
        padding: 12px 12px;
        gap: 8px;
    }
    
    .volume-value {
        min-width: 35px;
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    body {
        padding: 15px;
    }
    
    .player-card {
        padding: 25px 11px;
    }
    
    .title {
        font-size: 1.4rem;
    }
    
    .volume-control {
        padding: 10px;
        gap: 8px;
        border-radius: 40px;
    }
    
    .volume-value {
        min-width: 30px;
        font-size: 0.8rem;
    }
    
    .volume-label {
        font-size: 1.1rem;
    }
}

/* Spatial Audio Modal */
.spatial-audio-btn {
    background: var(--surface-color);
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 
        3px 3px 6px var(--shadow-dark),
        -3px -3px 6px var(--shadow-light);
    transition: all 0.2s ease;
}

.spatial-audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
}

.spatial-audio-btn:active {
    transform: translateY(0);
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

.spatial-audio-btn .spatial-icon {
    font-size: 1.3rem;
}

.spatial-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.spatial-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.spatial-modal-content {
    background: rgba(245, 230, 211, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.spatial-modal-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.8rem;
    color: var(--text-primary);
    margin: 0;
}

.spatial-modal-close {
    background: none;
    border: none;
    font-size: 2.5rem;
    color: var(--text-primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.spatial-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.spatial-modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

.spatial-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1)),
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.03) 0px,
            rgba(0, 0, 0, 0.03) 1px,
            transparent 1px,
            transparent 40px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.03) 0px,
            rgba(0, 0, 0, 0.03) 1px,
            transparent 1px,
            transparent 40px
        );
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.spatial-listener {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
}

.spatial-instrument {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: move;
    user-select: none;
    z-index: 2;
    transition: transform 0.1s ease;
}

.spatial-instrument:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.spatial-instrument.dragging {
    opacity: 0.8;
    z-index: 10;
}

.spatial-instrument.muted {
    opacity: 0.4;
}

.instrument-icon {
    font-size: 2.5rem;
    margin-bottom: 2px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.instrument-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.9);
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.mute-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 3px;
    transition: all 0.2s ease;
}

.mute-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
}

.mute-btn.muted {
    background: rgba(255, 0, 0, 0.2);
}

.spatial-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.spatial-controls .control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.spatial-controls .control-label {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    min-width: 120px;
}

.preset-select {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-select:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--accent-color);
}

.spatial-controls .slider {
    flex: 1;
    min-width: 100px;
}

.spatial-controls .slider-value {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

.spatial-info {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.spatial-info p {
    margin-bottom: 8px;
}

.spatial-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Dark mode adjustments for spatial modal */
body.dark-mode .spatial-audio-btn {
    background: var(--surface-color);
    color: var(--text-primary);
}

body.dark-mode .spatial-modal-content {
    background: rgba(42, 36, 32, 0.95);
}

body.dark-mode .spatial-stage {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05)),
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.05) 0px,
            rgba(255, 255, 255, 0.05) 1px,
            transparent 1px,
            transparent 40px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.05) 0px,
            rgba(255, 255, 255, 0.05) 1px,
            transparent 1px,
            transparent 40px
        );
}

body.dark-mode .instrument-label {
    background: rgba(50, 50, 50, 0.9);
    color: var(--text-primary);
}

body.dark-mode .mute-btn {
    background: rgba(50, 50, 50, 0.9);
}

body.dark-mode .mute-btn:hover {
    background: rgba(70, 70, 70, 1);
}

body.dark-mode .spatial-controls {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .preset-select {
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .preset-select:hover {
    background: rgba(70, 70, 70, 1);
}

@media (max-width: 768px) {
    .spatial-audio-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .spatial-audio-btn .spatial-icon {
        font-size: 1.2rem;
    }
    
    .spatial-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .spatial-modal-title {
        font-size: 1.4rem;
    }
    
    .spatial-modal-body {
        padding: 15px;
    }
    
    .instrument-icon {
        font-size: 2rem;
    }
    
    .instrument-label {
        font-size: 0.7rem;
    }
    
    .mute-btn {
        width: 25px;
        height: 25px;
        font-size: 0.9rem;
    }
}
