/* Import Bitcount Grid Single font */
@import url('https://fonts.googleapis.com/css2?family=Bitcount+Grid+Single:wght@400&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: black;
    overflow: hidden;
    height: 100vh;
    user-select: none;
}

body.loading .piano-wrapper {
    opacity: 1 !important;
}

/* Video background */
#bg-video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -1000;
    transform: translateX(-50%) translateY(calc(-50% - 80px));
    background-size: cover;
    filter: brightness(0.7) contrast(1.1) saturate(1.2);
}

/* Main container */
.piano-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    isolation: isolate;
}

/* Piano wrapper */
.piano-wrapper {
    position: relative;
    width: 800px;
    height: 300px;
    opacity: 1 !important;
    z-index: 1000;
    filter: brightness(1.2) contrast(1.1) saturate(1.1);
    will-change: transform;
    transform: translateZ(0) translateY(100vh) translateX(0px);
    mix-blend-mode: normal;
    /* Animation will be triggered by JavaScript after loading */
}

/* Piano background - positioned independently */
.piano-background {
    position: absolute;
    width: 800px;
    height: 300px;
    background: url('pianolayout.png') center center/contain no-repeat;
    opacity: 1 !important;
    z-index: 999;
    filter: brightness(1.2) contrast(1.1) saturate(1.1);
    will-change: transform;
    transform: translateZ(0) translateY(calc(100vh + 22px));
    mix-blend-mode: normal;
    left: 50%;
    top: 50%;
    margin-left: -400px;
    margin-top: -150px;
    /* Animation will be triggered by JavaScript after loading */
}

/* SVG piano styling */
#piano-svg {
    width: 100%;
    height: auto;
    max-width: 800px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
    border-radius: 10px;
}

/* Ensure all non-interactive SVG elements are visible */
.piano-wrapper svg rect:not(.pad):not(.white-key):not(.black-key),
.piano-wrapper svg image,
.piano-wrapper svg defs,
.piano-wrapper svg pattern {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Override any default SVG styling */
.piano-wrapper svg * {
    color: inherit;
}

/* Interactive elements - hidden by default, colors only when active */
.piano-wrapper svg .pad, 
.piano-wrapper svg .white-key, 
.piano-wrapper svg .black-key {
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 0 !important;
    fill: transparent !important;
    stroke: none !important;
}

/* Make the embedded PNG background visible */
.piano-wrapper svg rect {
    opacity: 1 !important;
}

.piano-wrapper svg #pattern0_13_51 {
    opacity: 1 !important;
}

.piano-wrapper svg rect[y="45"] {
    fill: url(#pattern0_13_51) !important;
    opacity: 1 !important;
}

/* Force the background rectangle to be visible */
.piano-wrapper svg rect[width="683"][height="204"] {
    fill: url(#pattern0_13_51) !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* Hover effects */
.piano-wrapper svg .pad:hover, .piano-wrapper svg .white-key:hover, .piano-wrapper svg .black-key:hover {
    filter: brightness(1.3) saturate(1.4);
}

/* Active/pressed states - maximum specificity override with subtle colored glow */
.piano-wrapper svg#piano-svg path.pad.active,
.piano-wrapper svg path.pad.active {
    opacity: 1 !important;
    fill: #D9FF92 !important;
    stroke: none !important;
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 8px #7FB867) !important;
}

.piano-wrapper svg#piano-svg path.white-key.active,
.piano-wrapper svg path.white-key.active {
    opacity: 1 !important;
    fill: #8DE8FF !important;
    stroke: none !important;
    filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 6px #5AC5E6) !important;
}

.piano-wrapper svg#piano-svg path.black-key.active,
.piano-wrapper svg path.black-key.active {
    opacity: 1 !important;
    fill: #D58DFF !important;
    stroke: none !important;
    filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 6px #B857E6) !important;
}



/* Subtle glow animations with deeper colored shadows */
@keyframes pad-glow {
    0% { 
        fill: #D9FF92;
        filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 8px #7FB867); 
    }
    50% { 
        fill: #D9FF92;
        filter: brightness(1.3) saturate(1.4) drop-shadow(0 0 12px #6BA052); 
    }
    100% { 
        fill: #D9FF92;
        filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 8px #7FB867); 
    }
}

@keyframes white-key-glow {
    0% { 
        fill: #8DE8FF;
        filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 6px #5AC5E6); 
    }
    50% { 
        fill: #8DE8FF;
        filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 10px #3EADD1); 
    }
    100% { 
        fill: #8DE8FF;
        filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 6px #5AC5E6); 
    }
}

@keyframes black-key-glow {
    0% { 
        fill: #D58DFF;
        filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 6px #B857E6); 
    }
    50% { 
        fill: #D58DFF;
        filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 9px #A13DD1); 
    }
    100% { 
        fill: #D58DFF;
        filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 6px #B857E6); 
    }
}

.piano-wrapper svg .pad.active {
    animation: pad-glow 0.6s ease-in-out;
}

.piano-wrapper svg .white-key.active {
    animation: white-key-glow 0.6s ease-in-out;
}

.piano-wrapper svg .black-key.active {
    animation: black-key-glow 0.6s ease-in-out;
}

/* Responsive design */
@media (max-width: 768px) {
    .piano-wrapper {
        padding: 20px;
        margin: 10px;
    }
    
    #piano-svg {
        max-width: 95%;
    }
}

@media (max-height: 600px) {
    .piano-wrapper {
        max-height: 85vh;
        padding: 15px;
    }
}

/* Atmospheric effects removed for cleaner appearance */

/* Loading state */
body.loading {
    cursor: wait;
}

body.loading .piano-wrapper {
    opacity: 0.7;
    pointer-events: none;
} 

/* Loading overlay - full screen black background */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay transitions handled by JavaScript for precise timing */

/* Loading progress bar */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid #ED2CFF;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: #ED2CFF;
    transition: width 0.3s ease;
    border-radius: 1px;
}

/* Instruction text overlay */
.instruction-text {
    position: fixed;
    top: calc(50% - 100px);
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Bitcount Grid Single', monospace;
    font-size: 12px;
    color: #ED2CFF;
    text-align: center;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    font-weight: 400;
    /* Animation will be triggered by JavaScript after loading */
}

.instruction-text.hidden {
    opacity: 0;
    transition: opacity 1s ease-out;
}

/* Keyboard controls instructions */
.keyboard-controls {
    position: fixed;
    top: 50%;
    right: 50px;
    transform: translateY(calc(-50% + 318px));
    font-family: 'Bitcount Grid Single', monospace;
    font-size: 12px;
    color: #ED2CFF;
    text-align: center;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    background: rgba(0, 0, 0, 0.45);
    padding: 4px 4px 4px 8px;
    border-radius: 8px;
    border: 2px solid rgba(237, 44, 255, 0.5);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.5px;
    font-weight: 400;
    line-height: 1.4;
    width: 220px;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    white-space: nowrap;
    /* Animation will be triggered by JavaScript after loading */
    transition: opacity 0.5s ease-out;
}

.keyboard-controls.hidden {
    opacity: 0;
    visibility: hidden;
}

.keyboard-controls.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity 2s ease-out, visibility 2s ease-out;
}

.control-line {
    margin-bottom: 4px;
}

.control-header {
    font-weight: bold;
    margin-bottom: 8px;
}

/* Keyframe animations for piano entrance */
@keyframes pianoSlideUp {
    0% {
        transform: translateZ(0) translateY(100vh) translateX(0px);
        opacity: 0.7;
    }
    100% {
        transform: translateZ(0) translateY(302px) translateX(0px);
        opacity: 1;
    }
}

@keyframes pianoBackgroundSlideUp {
    0% {
        transform: translateZ(0) translateY(calc(100vh + 22px));
        opacity: 0.7;
    }
    100% {
        transform: translateZ(0) translateY(324px);
        opacity: 1;
    }
}

@keyframes fadeInText {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes fadeInKeyboardControls {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 0.5;
    }
} 