/* Music Player Styles */

:root {
    /* Color Palette */
    --rich-black: #03071eff;
    --chocolate-cosmos: #37071eff;
    --rosewood: #37071fff;
    --penn-red: #9d0208ff;
    --engineering-orange: #d00000ff;
    --sinopia: #dc2f02ff;
    --persimmon: #e85d04ff;
    --princeton-orange: #f48c06ff;
    --orange-web: #faa307ff;
    --selective-yellow: #ffba08ff;
    --snow-white: #FFFFFF;
    --celestial-teal: #84DCC6;
    --mint-breeze: #A5FFD6;
    --peach-blush: #FFA69E;
    --coral-rose: #FF686B;
    --sapphire-blue: #2364AA;
    --midnight-navy: #13283F;
}

#music-player-container {
    /* Enhanced glass morphism background */
    background: linear-gradient(135deg, 
        rgba(50, 48, 49, 0.85) 0%,
        rgba(30, 30, 30, 0.75) 50%,
        rgba(45, 45, 45, 0.85) 100%) !important;
    backdrop-filter: blur(15px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(15px) saturate(1.2) !important;
    color: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 
        0 8px 32px 0 rgba(31, 38, 135, 0.37),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* Header with close button */
.music-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
}

.music-player-header h2 {
    margin: 0;
    font-size: 1.2em;
    color: #fff;
}

#close-music-player {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#close-music-player:hover {
    opacity: 1;
}

/* Game stats display */
.game-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 20px;
    font-size: 1.2em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.score-display, .combo-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-label, .combo-label {
    color: #999;
}

#score, #combo {
    color: var(--orange-web);
    font-size: 1.3em;
    transition: transform 0.3s ease;
    /* Glass text glow effect */
    text-shadow: 
        0 0 10px currentColor,
        0 0 20px rgba(250, 163, 7, 0.5);
}

#score.score-pop {
    animation: scorePop 0.5s ease;
}

@keyframes scorePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--selective-yellow); }
    100% { transform: scale(1); }
}

/* Achievement popup with glass morphism */
.achievement-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Glass morphism background */
    background: linear-gradient(135deg, 
        rgba(237, 93, 4, 0.85) 0%,
        rgba(250, 163, 7, 0.85) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: white;
    padding: 20px 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.5em;
    font-weight: bold;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.achievement-popup.show {
    opacity: 1;
    animation: achievementBounce 0.6s ease;
}

@keyframes achievementBounce {
    0% { transform: translate(-50%, -50%) scale(0.5); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Instrument container */
.instrument-container, #instrument-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    overflow: hidden;
    touch-action: none;
    /* Make background transparent for glass effect */
    background: transparent !important;
}

/* SVG styling */
.instrument-container svg, #instrument-container svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Make SVG background transparent for glass effect */
#instrument-container svg rect[fill="#232323"] {
    fill: transparent !important;
}

/* Alternative: make it semi-transparent if full transparency doesn't work */
#instrument-container svg > g > rect {
    fill: rgba(35, 35, 35, 0.3) !important;
}

/* Musical note styles with glass morphism */
.note {
    cursor: pointer;
    touch-action: none;
    -webkit-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Glass morphism base state */
    fill: rgba(255, 255, 255, 0.05);
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
    filter: blur(0.5px);
    opacity: 0.8;
}

.note:hover {
    /* Enhanced glass effect on hover */
    fill: rgba(255, 255, 255, 0.08) !important;
    stroke: rgba(255, 255, 255, 0.2) !important;
    stroke-width: 2;
    filter: blur(0px) drop-shadow(0 0 20px currentColor);
    opacity: 1 !important;
    transform: scale(1.05);
}

.note.active {
    /* Active glass state with glow */
    fill: rgba(255, 255, 255, 0.12) !important;
    stroke: rgba(255, 255, 255, 0.3) !important;
    stroke-width: 3;
    filter: blur(0px) drop-shadow(0 0 30px currentColor) drop-shadow(0 0 60px currentColor);
    opacity: 1 !important;
    transform: scale(1.1);
}

/* Visual effects */
.ripple {
    pointer-events: none;
}

.note-label {
    position: absolute;
    color: white;
    font-size: 2em;
    font-weight: bold;
    text-shadow: 
        0 0 20px rgba(0, 0, 0, 0.8),
        0 0 40px currentColor;
    animation: noteLabelFade 0.5s ease forwards;
    pointer-events: none;
    z-index: 100;
    /* Glass text effect */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

@keyframes noteLabelFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5) translateY(-30px);
    }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 1s ease-out forwards;
    /* Glass morphism particle effect */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-shadow: 0 0 10px currentColor;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0.5);
    }
}

/* Desktop styles - music player in interactive pane */
@media (min-width: 768px) {
    body.music-player-open #interactive-pane {
        display: flex !important;
        justify-content: center;
        align-items: center;
        /* Glass morphism background to match */
        background: rgba(50, 48, 49, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    body.music-player-open #storybook-container {
        display: none !important;
    }
    
    body.music-player-open #music-player-container {
        display: flex !important;
        max-width: 440px;
        max-height: 90vh;
        height: auto;
        width: auto;
        aspect-ratio: 440 / 956;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        border-radius: 8px;
        overflow: hidden;
    }
    
    /* Hide header and game stats in desktop side panel */
    body.music-player-open .music-player-header {
        display: none !important;
    }
    
    body.music-player-open .game-stats {
        display: none !important;
    }
    
    /* Adjust instrument container for constrained size */
    body.music-player-open #instrument-container {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 0;
    }
    
    body.music-player-open #instrument-container svg {
        max-width: 100%;
        max-height: 100%;
        height: auto;
        width: auto;
    }
}

/* Mobile styles - fullscreen */
@media (max-width: 767px) {
    #music-player-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
    }
    
    .game-stats {
        font-size: 1em;
        gap: 20px;
        padding: 15px;
    }
    
    .achievement-popup {
        font-size: 1.2em;
        padding: 15px 30px;
    }
}

/* Combo display effects with enhanced glow */
.combo-display.combo-active #combo {
    color: var(--selective-yellow);
    text-shadow: 
        0 0 10px var(--orange-web),
        0 0 20px var(--orange-web),
        0 0 30px rgba(250, 163, 7, 0.5);
    animation: comboPulse 0.3s ease;
    filter: drop-shadow(0 0 5px currentColor);
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Sound wave visualization with glass effect */
.sound-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    pointer-events: none;
    opacity: 0.3;
    /* Glass morphism wave effect */
    background: linear-gradient(to top, 
        rgba(255, 255, 255, 0.05) 0%,
        transparent 100%);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Loading state with glass effect */
.instrument-container.loading::after {
    content: "Loading instrument...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    /* Glass loading text */
    background: rgba(50, 48, 49, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Cantrip activation popup animation */
@keyframes cantripPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1) translateY(-50px);
    }
}

/* Add glass morphism styles for cantrip popup */
.cantrip-popup {
    /* Glass morphism background */
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}