/* General page setup */
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    /* Prevent scrollbars */
}

body {
    background-color: #1a1a1a;
    /* Very dark grey */
    display: flex;
    /* Used for centering if needed, but videoContainer handles positioning */
    justify-content: center;
    align-items: center;
    font-family: Helvetica, sans-serif;
    /* Add a default font */
}

/* Container for video and controls */
#videoContainer {
    position: absolute;
    /* Center using absolute positioning */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    /* Take full width */
    height: 100%;
    /* Take full height */
    /* Apply aspect ratio constraints */
    max-width: calc(100vh * (16 / 9));
    /* Max width based on 16:9 aspect ratio relative to height */
    max-height: calc(100vw * (9 / 16));
    /* Max height based on 16:9 aspect ratio relative to width */
    background-color: #000;
    /* Black background for letter/pillarboxing */
}


/* Video player styling */
#videoPlayer {
    display: block;
    /* Remove extra space below video */
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Scale video while preserving aspect ratio */
}

/* Play button styling */
#playButton {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* --- Dynamic Circular Shape --- */
    width: 17vmin;
    height: 17vmin;
    border-radius: 50%;
    padding: 0;
    font-size: 4vmin;
    /* --- Appearance --- */
    background-color: rgba(0, 0, 0, 0.5);
    color: hsl(191, 100%, 50%);
    border: none;
    cursor: pointer;
    /* --- Content Centering --- */
    display: flex;
    justify-content: center;
    align-items: center;
    /* --- Stacking --- */
    z-index: 5;
    transition: background-color 0.2s ease;
    /* --- Add Text Glow --- */
    text-shadow: 0 0 7px hsla(191, 100%, 50%, 0.8),
        0 0 14px hsla(191, 100%, 50%, 0.7);

}

/* Apply flicker ONLY when button is enabled and NOT loading */
#playButton:not([disabled]) {
    /* Use the new animation name and a faster duration */
    animation: buzzFlicker 0.1s infinite linear;
    /* Adjust duration (e.g., 0.2s to 0.5s) */
}


#playButton:disabled {
    cursor: default;
    background-color: rgba(50, 50, 50, 0.37);
    color: #aaa;
    text-shadow: none;
    /* Remove glow when disabled */

    /* Ensure flicker stops when disabled */
    animation: none;
    /* Override the flicker animation */
}


#playButton:hover:not([disabled]) {
    background-color: rgba(0, 0, 0, 0.65);
    /* Darken on hover when enabled */
    /* Ensure flicker stops when disabled */
    animation: none;
    /* Override the flicker animation */
}

/* --- Style the LOADING text specifically --- */

#playButton.loading {
    /* --- Change the text color --- */
    color: hsl(0, 100%, 65%);
    /* --- Change the font size --- */
    font-size: 2.5vmin;
    /* Adjust as needed */
    /* --- Optional: Adjust the text glow for the loading state --- */
    text-shadow: 0 0 4px hsla(0, 100%, 65%, 0.8),
        0 0 8px hsla(0, 100%, 65%, 0.6);

    /* --- Explicitly apply animation for loading state --- */
    /* This ensures the flicker runs even with the .loading class */
    animation: buzzFlicker 0.1s infinite linear;

    /* --- Optional: Change background if desired during loading --- */
    /* background-color: rgba(20, 20, 20, 0.6); */
}

/* --- Loading Overlay and SVG Spinner Styles --- */

#loadingOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Center the spinner SVG */
    display: flex;
    justify-content: center;
    align-items: center;
    /* Stacking and Interaction */
    z-index: 10;
    /* Ensure it's above video and play button */
    pointer-events: none;
    /* Allow clicks to pass through to the button underneath */
    /* Optional: Dim background while loading */
    /* background-color: rgba(0, 0, 0, 0.5); */
}

/* Hide the original progress bar if it's still in the HTML */
#loadingProgress {
    display: none;
}

/* The SVG container for the spinner */
#loadingSpinner {
    /* Match the size of the play button */
    width: 16vmin;
    height: 16vmin;
    /* Start drawing from the top (12 o'clock) instead of the side (3 o'clock) */
    transform: rotate(-90deg);
    overflow: visible;
    /* Prevent stroke from being clipped */
}

/* Common styles for both the track and the moving snake */
#loadingTrack,
#loadingSnake {
    cx: 50;
    /* Center X within the SVG's viewBox */
    cy: 50;
    /* Center Y within the SVG's viewBox */
    r: 48;
    /* Radius (must be less than 50 to account for stroke width, e.g., 50 - stroke-width/2) */
    fill: none;
    /* We only want the outline */
    stroke-width: 4;
    /* Thickness of the line - adjust for desired "pixel" size */
}

/* The background track of the circle */
#loadingTrack {
    stroke: hsla(0, 0%, 27%, 0.24);
    /* Dark grey color for the track */
}

/* The moving "snake" part that shows progress */
#loadingSnake {
    stroke: #00CFFF;
    /* Adjusted blue towards cyan */
    /* stroke-dasharray and stroke-dashoffset are controlled by JavaScript */
    transition: stroke-dashoffset 0.1s linear;
    /* Smooth animation between progress updates */

    /* --- Update the Glow Effect Color --- */
    /* drop-shadow(x-offset y-offset blur-radius color) */
    filter: drop-shadow(0 0 5px #66e3ff) drop-shadow(0 0 10px #9aecff);
    /* Cyan-tinted blue glow */
}

/* Optional: Adjust common styles if needed (no color change here) */
#loadingTrack,
#loadingSnake {
    cx: 50;
    cy: 50;
    r: 48;
    /* Radius (50 - stroke-width/2) */
    fill: none;
    stroke-width: 4;
    /* Keep a decent thickness */
}

/* Optional: Adjust track color if desired */
#loadingTrack {
    stroke: hsla(0, 0%, 27%, 0.201);
    /* Keep the track dark grey, or change if you like */
    /* ... other track styles ... */
}

@keyframes buzzFlicker {

    0%,
    100% {
        opacity: 1;
        /* text-shadow removed */
    }

    50% {
        opacity: 0.85;
        /* Adjust this value (0.8 to 0.95) for desired dip */
        /* text-shadow removed */
    }
}

/* Existing styles.css content might be here */

/* Visually hidden class for accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Credits Button */
#creditsButton {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.3);
    /* Semi-transparent black */
    color: rgb(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    cursor: pointer;
    z-index: 1001;
    /* Ensure it's above video player and loading overlay */
    font-family: Helvetica, sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    transition: background-color 0.3s;
}

#creditsButton:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Modal styles */
.modal {
    display: none;
    /* Hidden by default, will be changed to 'flex' by JS */
    position: fixed;
    z-index: 2000;
    /* Sit on top of everything */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.7);
    /* Dark overlay */
    justify-content: center;
    /* Center modal-content horizontally */
    align-items: center;
    /* Center modal-content vertically */
}

.modal-content {
    background-image: url('img/credit_shot.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Set width and height to be ~85% of the viewport */
    width: 85vw;
    height: 85vh;

    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* Aligns .credits-text-container to the bottom */
    align-items: center;
    /* Centers .credits-text-container horizontally */
    padding: 3vh 3vw;
    /* Overall responsive padding inside the modal */
    box-sizing: border-box;
}

.credits-text-container {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    /* Shadow for better readability on image */
    text-align: center;
    font-family: Helvetica, sans-serif;
    /* Reactive font size */
    font-size: 2vmin;
    /* Scales with the smaller of viewport width/height. Adjust as needed. */
    line-height: 1.2;
    /* Restored a sensible line-height */

    width: 100%;
    /* Take full width of the padded area in modal-content */
    /* Constrain to roughly the lower third of the modal's height */
    max-height: 40%;
    /* Percentage of the .modal-content's height */
    overflow-y: hidden;
    /* Scroll if content exceeds this 30% height */
    padding-bottom: 1vh;
    /* Small padding at the very bottom of the text */
}

.credits-text-container p {
    margin: 0.25vmin 0;
    /* Responsive margin for paragraphs */
    font-weight: 300;
    /* Make paragraph text (like names) light/thin */
}

.credits-text-container strong {
    display: block;
    /* Makes the role/title take its own line */
    margin-bottom: 0.25vmin;
    /* Responsive margin */
    font-weight: bold;
    /* Make titles (Dancers, Score, etc.) bold */
}

/* Close button for the modal */
.close-button {
    color: #fff;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 30px;
    /* Vertically center the '×' */
    text-align: center;
    /* Horizontally center the '×' */
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.close-button:hover,
.close-button:focus {
    background-color: rgba(255, 255, 255, 0.3);
    color: #000;
    /* Darker color on hover for contrast */
    text-decoration: none;
}

/* Instructions Button */
#instructionsButton {
    position: fixed;
    top: 20px;
    left: 20px;
    /* Positioned on the left */
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.3);
    color: rgb(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    cursor: pointer;
    z-index: 1001;
    /* Same as creditsButton */
    font-family: Helvetica, sans-serif;
    /* Same as creditsButton */
    font-size: 14px;
    text-transform: uppercase;
    transition: background-color 0.3s;
}

#instructionsButton:hover {
    background-color: rgba(255, 255, 255, 0.2);
    /* Same as creditsButton */
}

/* Instructions Modal - inherits from .modal for basic display/overlay */
.instructions-modal-content {
    background-image: url('img/instructions_bg.jpg');
    /* Specific background */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Dimensions similar to credits modal */
    width: 85vw;
    height: 85vh;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    /* Center the text container within the modal */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3vh 3vw;
    box-sizing: border-box;
}

.instructions-text-container {
    color: black;
    /* Changed text color to black */
    text-align: left;
    /* Center align paragraphs */
    font-family: Helvetica, sans-serif;
    /* Same font as credits text */
    font-size: 1.8vmin;
    /* Responsive font size, adjust as needed */
    line-height: 1.4;
    /* Increased line height for readability */
    width: 95%;
    /* Increased width to take up more of the frame */
    max-width: 1550px;
    /* Adjusted max-width accordingly */
    max-height: 100%;
    /* Max height for the text area */
    overflow-y: auto;
    /* Add scrollbar if content overflows */
    padding: 2vmin 3vmin;
    box-sizing: border-box;
    border-radius: 6px;
}

.instructions-text-container p,
.instructions-text-container li {
    margin: 1vmin 0;
    /* Spacing between paragraphs/list items */
    font-weight: 300;
    /* Light/thin for regular text */
}

/* Style for main bolded headings */
.instructions-text-container .instructions-section-title {
    font-size: 2.2vmin;
    /* Larger font size for section titles */
    font-weight: bold;
    margin-top: 2.5vmin;
    margin-bottom: 1vmin;
}

/* Ensure other explicitly bolded text is also bold */
.instructions-text-container strong {
    font-weight: bold;
}

.instructions-text-container ul {
    list-style-position: inside;
    /* Keeps bullets aligned with text better for center align */
    padding-left: 0;
    /* Remove default padding as text-align center handles it */
    text-align: left;
    /* Align list items to the left for readability */
    margin-left: auto;
    /* Helps center the block of list items */
    margin-right: auto;
    /* Helps center the block of list items */
    max-width: 100%;
    /* Prevent list from becoming too wide */
}

.instructions-text-container code {
    background-color: rgba(255, 255, 255, 0.15);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: "Courier New", Courier, monospace;
}

/* Close button for the instructions modal (can reuse .close-button if identical) */
/* Creating a specific one for clarity, but can be merged if styles are the same */
.close-instructions-button {
    color: #fff;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 30px;
    /* Vertically center the '×' */
    text-align: center;
    /* Horizontally center the '×' */
    position: absolute;
    top: 15px;
    /* Adjusted slightly for better placement */
    right: 15px;
    /* Adjusted slightly for better placement */
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    z-index: 10;
    /* Ensure it's above the text container */
}

.close-instructions-button:hover,
.close-instructions-button:focus {
    background-color: rgba(255, 255, 255, 0.3);
    color: #000;
    text-decoration: none;
}

/* --- Camera Request Modal Styles --- */
#cameraRequestModal {
    display: flex;
    /* Show by default initially, JS will manage logic */
    z-index: 3000;
    /* Highest priority */
    background-color: rgba(0, 0, 0, 0.4);
    /* Slightly darker backing */
    backdrop-filter: blur(8px);
    /* Blur the background content */
    -webkit-backdrop-filter: blur(8px);
    /* Safari support */
}

.camera-request-content {
    background: rgba(255, 255, 255, 0.1);
    /* Very subtle white tint */
    backdrop-filter: blur(20px);
    /* Strong blur for the frosted glass effect */
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    color: white;
    font-family: Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}

.camera-request-text p {
    margin: 10px 0;
    font-size: 1.1rem;
    line-height: 1.5;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.camera-request-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    margin-top: 30px;
}

.camera-request-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

.camera-request-status {
    /* Reserve space */
    font-size: 0.9rem;
    margin-top: 5px;
    font-weight: 300;
}

.camera-request-status.error {
    color: #ff6b6b;
    text-shadow: 0 0 5px rgba(255, 107, 107, 0.5);
}

.camera-request-status.success {
    color: #51cf66;
    text-shadow: 0 0 5px rgba(81, 207, 102, 0.5);
}

/* --- Scene 1 Interaction Styles --- */
#scene1Popup {
    display: none;
    /* Hidden by default */
    z-index: 2000;
    background-color: transparent;
    /* Clear background outside */
    align-items: flex-start;
    /* Align to top */
    padding-top: 5vh;
    /* Reduced padding */
    opacity: 0;
    transition: opacity 1s ease;
    /* Fade effect */
}

#scene1Popup.visible {
    opacity: 1;
}

.scene1-content {
    background: rgba(0, 0, 0, 0.666);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 10px;
    /* Reduced padding */
    text-align: center;
    max-width: 700px;
    /* Increased width to prevent text wrapping */
    width: 90%;
    color: rgb(223, 223, 223);
    font-family: Helvetica, sans-serif;
    font-size: 1.1rem;
    /* Smaller font */
    line-height: 1.2;
    font-weight: 400;
    margin-top: 1.2vh;
    /* Slight margin from top */
}

/* Typewriter word fade-in transition */
.scene1-content p span,
.scene2-content p span,
.scene3-content p span,
.scene4-content p span,
.scene5-content p span {
    transition: opacity 0.7s ease;
}

/* --- Scene 2 Interaction Styles (Mirrors Scene 1) --- */
#scene2Popup {
    display: none;
    /* Hidden by default */
    z-index: 2000;
    background-color: transparent;
    /* Clear background outside */
    align-items: flex-start;
    /* Align to top */
    padding-top: 5vh;
    /* Moved popup higher */
    opacity: 0;
    transition: opacity 1s ease;
    /* Fade effect */
}

#scene2Popup.visible {
    opacity: 1;
}

.scene2-content {
    background: rgba(0, 0, 0, 0.666);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 10px;
    /* Reduced padding */
    text-align: center;
    max-width: 700px;
    /* Increased width to prevent text wrapping */
    width: 90%;
    color: rgb(223, 223, 223);
    font-family: Helvetica, sans-serif;
    font-size: 1.1rem;
    /* Smaller font */
    line-height: 1.2;
    font-weight: 400;
    margin-top: 1.2vh;
    /* Slight margin from top */
}

/* --- Scene 3 Interaction Styles (Mirrors Scene 1 & 2) --- */
#scene3Popup {
    display: none;
    /* Hidden by default */
    z-index: 2000;
    background-color: transparent;
    /* Clear background outside */
    align-items: flex-start;
    /* Align to top */
    padding-top: 5vh;
    /* Reduced padding */
    opacity: 0;
    transition: opacity 1s ease;
    /* Fade effect */
}

#scene3Popup.visible {
    opacity: 1;
}

.scene3-content {
    background: rgba(0, 0, 0, 0.666);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 10px;
    /* Reduced padding */
    text-align: center;
    max-width: 700px;
    /* Increased width to prevent text wrapping */
    width: 90%;
    color: rgb(223, 223, 223);
    font-family: Helvetica, sans-serif;
    font-size: 1.1rem;
    /* Smaller font */
    line-height: 1.2;
    font-weight: 400;
    margin-top: 1.2vh;
    /* Slight margin from top */
}

/* --- Scene 4 Interaction Styles (Mirrors Scene 1, 2 & 3) --- */
#scene4Popup {
    display: none;
    /* Hidden by default */
    z-index: 2000;
    background-color: transparent;
    /* Clear background outside */
    align-items: flex-start;
    /* Align to top */
    padding-top: 5vh;
    /* Reduced padding */
    opacity: 0;
    transition: opacity 1s ease;
    /* Fade effect */
}

#scene4Popup.visible {
    opacity: 1;
}

.scene4-content {
    background: rgba(0, 0, 0, 0.666);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 10px;
    /* Reduced padding */
    text-align: center;
    max-width: 700px;
    /* Increased width to prevent text wrapping */
    width: 90%;
    color: rgb(223, 223, 223);
    font-family: Helvetica, sans-serif;
    font-size: 1.1rem;
    /* Smaller font */
    line-height: 1.2;
    font-weight: 400;
    margin-top: 1.2vh;
    /* Slight margin from top */
}

/* --- Scene 5 Interaction Styles (Mirrors Scene 1-4) --- */
#scene5Popup {
    display: none;
    /* Hidden by default */
    z-index: 2000;
    background-color: transparent;
    /* Clear background outside */
    align-items: flex-start;
    /* Align to top */
    padding-top: 5vh;
    /* Reduced padding */
    opacity: 0;
    transition: opacity 1s ease;
    /* Fade effect */
}

#scene5Popup.visible {
    opacity: 1;
}

.scene5-content {
    background: rgba(0, 0, 0, 0.666);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 10px;
    /* Reduced padding */
    text-align: center;
    max-width: 700px;
    /* Increased width to prevent text wrapping */
    width: 90%;
    color: rgb(223, 223, 223);
    font-family: Helvetica, sans-serif;
    font-size: 1.1rem;
    /* Smaller font */
    line-height: 1.2;
    font-weight: 400;
    margin-top: 1.2vh;
    /* Slight margin from top */
    cursor: pointer;
    /* Indicate clickable */
}

/* Scene 4 Waveform Canvas */
#scene4WaveformCanvas {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1999;
    /* Below popup but above video */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    background: transparent;
}

#scene4WaveformCanvas.visible {
    opacity: 1;
}

#hamsaOverlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
    width: 40vmin;
    height: 40vmin;
    display: flex;
    justify-content: center;
    align-items: center;
}

#hamsaOverlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter:
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.1));
}

#hamsaOverlay.visible {
    opacity: 1;
}

/* Pose Overlay Canvas */
#poseOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    /* Ensure it is above the video (z-index 0 or auto) but below controls if needed */
    pointer-events: none;
    /* Allow clicks to pass through to the video/controls */
}

/* Scene 2 Particle Canvas */
#scene2Canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    /* Below controls (z-index 5+), above video */
    pointer-events: none;
    display: none;
    /* Hidden by default */
    opacity: 0;
    transition: opacity 1s ease;
}

#scene2Canvas.visible {
    opacity: 1;
}

/* --- Scene 3 Karaoke Styles --- */
#scene3Container {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1200px;
    text-align: center;
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: Helvetica, sans-serif;
}

#lyricLine {
    font-size: 3.5vmin;
    color: white;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    margin-bottom: 3vh;
    transition: opacity 0.3s ease-in-out;
    display: flex;
    flex-wrap: nowrap;
    /* Keep all words on single line */
    justify-content: center;
    gap: 0.6em;
    position: relative;
    padding-top: 4vmin;
    /* Reduced - ball bounces closer to words now */
    white-space: nowrap;
    overflow: visible;
}

/* Individual word spans */
#lyricLine .word {
    display: inline-block;
    position: relative;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    cursor: default;
}

/* Highlight sung words */
#lyricLine .word.sung {
    color: #ffeb3b;
    text-shadow: 0 0 15px rgba(255, 235, 59, 0.8);
}

/* Current word being sung */
#lyricLine .word.current {
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.9);
}

/* Hide the old track */
#karaokeTrack {
    display: none;
}

#bouncyBall {
    width: 2.5vmin;
    height: 2.5vmin;
    background: radial-gradient(circle at 30% 30%, #ffeb3b, #fbc02d);
    border-radius: 50%;
    position: absolute;
    top: 0.5vmin;
    /* Closer to words */
    left: 0;
    /* Start at beginning, JS will position over first word */
    transform: translateX(-50%);
    box-shadow:
        0 0 12px rgba(255, 235, 59, 0.9),
        0 0 25px rgba(255, 235, 59, 0.5);
    /* Arc-like transition when moving between words */
    transition: left 0.3s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    z-index: 10;
    /* Normal bouncing animation */
    animation: karaokeBouncePhysics 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}

/* When jumping to next word - high arc hop */
#bouncyBall.jumping {
    animation: karaokeHop 0.3s cubic-bezier(0.33, 0, 0.67, 1) forwards;
}

/* Physics-based bouncing - starts fast (gravity), slows at peak, accelerates back down */
@keyframes karaokeBouncePhysics {
    0% {
        transform: translateX(-50%) translateY(0) scaleY(0.9) scaleX(1.1);
    }

    15% {
        transform: translateX(-50%) translateY(-1.5vmin) scaleY(1) scaleX(1);
    }

    50% {
        transform: translateX(-50%) translateY(-4vmin) scaleY(1.05) scaleX(0.95);
    }

    85% {
        transform: translateX(-50%) translateY(-1.5vmin) scaleY(1) scaleX(1);
    }

    100% {
        transform: translateX(-50%) translateY(0) scaleY(0.9) scaleX(1.1);
    }
}

/* High arc hop for word-to-word transition */
@keyframes karaokeHop {
    0% {
        transform: translateX(-50%) translateY(0) scaleY(0.85) scaleX(1.15);
    }

    20% {
        transform: translateX(-50%) translateY(-3vmin) scaleY(1.1) scaleX(0.9);
    }

    50% {
        transform: translateX(-50%) translateY(-8vmin) scaleY(1.05) scaleX(0.95);
    }

    80% {
        transform: translateX(-50%) translateY(-3vmin) scaleY(1.1) scaleX(0.9);
    }

    100% {
        transform: translateX(-50%) translateY(0) scaleY(0.85) scaleX(1.15);
    }
}