body {
    margin: 0;
    overflow: hidden;
    background: linear-gradient(to bottom, #000428, #004e92);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#gameContainer {
    position: relative;
    height: 90%;
    width: calc(90% * (375 / 600));
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    border: 2px solid white;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Use the blob image for the player */
#player {
    position: absolute;
    width: 40px; /* Default size to match the original circle */
    height: 40px;
    transform: translate(-50%, -50%); /* Center the image over the position */
    z-index: 2;
    transition: transform 0.05s linear;
}

/* HUD styling with glowing effect */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 3;
    font-family: 'Orbitron', sans-serif; /* Futuristic font */
    font-size: 24px;
    color: rgba(255, 223, 0, 0.9); /* Gold color */
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.7), 
                 0 0 10px rgba(255, 223, 0, 0.6), 
                 0 0 20px rgba(255, 215, 0, 0.4);
    animation: level-glow 2s infinite alternate; /* Subtle pulsing glow */
}

/* Glow animation for level text */
@keyframes level-glow {
    0% {
        text-shadow: 0 0 5px rgba(255, 223, 0, 0.8), 
                     0 0 10px rgba(255, 215, 0, 0.5), 
                     0 0 15px rgba(255, 215, 0, 0.4);
    }
    100% {
        text-shadow: 0 0 8px rgba(255, 223, 0, 1), 
                     0 0 15px rgba(255, 215, 0, 0.7), 
                     0 0 20px rgba(255, 223, 0, 0.6);
    }
}


/* Quote Display */
#quoteDisplay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(226, 226, 226, 0.514);
    font-family: Arial, sans-serif;
    font-size: 44px;
    text-align: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    z-index: 4;
}

/* Base portal styling - hollow purple state */
#exit {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.7), rgba(128, 0, 255, 0.5), transparent);
    box-shadow: 0 0 15px rgba(128, 0, 255, 0.8), 
                0 0 30px rgba(128, 0, 255, 0.6), 
                0 0 50px rgba(128, 0, 255, 0.4);
    overflow: hidden;
    animation: portal-pulse 2s infinite alternate;
    z-index: 1;
}

/* Portal fill - dynamic outside-in filling */
#exitFill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle,
                rgba(128, 0, 255, 0.7) 0%, 
                rgba(128, 0, 255, 0.7) var(--fill-progress),
                transparent var(--fill-progress),
                transparent 100%);
    transition: background 0.2s ease-in-out;
}

/* Full portal state - green swirling with gold shadow */
#exit.full {
    background: radial-gradient(circle, rgba(0, 128, 0, 0.9), darkgreen); /* Green center */
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 
                0 0 40px rgba(255, 215, 0, 0.6), 
                0 0 60px rgba(255, 223, 0, 0.4), 
                0 0 80px rgba(255, 223, 0, 0.3);
    animation: gold-glow 1.5s infinite alternate; /* Gold shimmering glow */
}

/* Swirling effect inside the portal */
#exitFill.swirl {
    background: conic-gradient(from 0deg, 
                rgba(0, 255, 0, 0.8), /* Green swirl */
                rgba(255, 255, 255, 0.6), /* White glow */
                rgba(0, 255, 0, 0.9)); /* Green swirl */
    animation: swirl 3s linear infinite;
}

/* Pulsing purple glow while filling */
@keyframes portal-pulse {
    0% {
        box-shadow: 0 0 10px rgba(128, 0, 255, 0.7), 
                    0 0 20px rgba(128, 0, 255, 0.5), 
                    0 0 30px rgba(128, 0, 255, 0.3);
    }
    100% {
        box-shadow: 0 0 15px rgba(128, 0, 255, 1), 
                    0 0 25px rgba(128, 0, 255, 0.8), 
                    0 0 40px rgba(128, 0, 255, 0.5);
    }
}

/* Gold shimmering glow */
@keyframes gold-glow {
    0% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.7), 
                    0 0 40px rgba(255, 223, 0, 0.5), 
                    0 0 60px rgba(255, 223, 0, 0.3);
    }
    100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 
                    0 0 50px rgba(255, 223, 0, 0.7), 
                    0 0 70px rgba(255, 223, 0, 0.5);
    }
}

/* Swirling effect inside the portal */
@keyframes swirl {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Progress bar container */
#progressContainer {
    position: relative;
    width: 200px; /* Adjust width as needed */
    height: 15px;
    margin-top: 10px; /* Space below the level display */
    border: 2px solid rgba(255, 215, 0, 0.8); /* Gold border */
    border-radius: 10px;
    overflow: hidden; /* Clip the progress bar fill */
    background: rgba(0, 0, 0, 0.7); /* Dark background */
    box-shadow: 0 0 10px rgba(255, 223, 0, 0.5), 
                0 0 20px rgba(255, 223, 0, 0.3);
}

/* Progress bar fill */
#progressBar {
    width: 0%; /* Initial progress */
    height: 100%;
    background: linear-gradient(to right, rgba(0, 255, 0, 0.9), rgba(0, 128, 0, 0.8)); /* Green gradient */
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8), 
                0 0 20px rgba(0, 255, 0, 0.6);
    border-radius: 10px;
    transition: width 0.2s ease-in-out; /* Smooth fill effect */
}

/* Portal open text */
#portalOpenText {
    display: none; /* Hidden by default */
    margin-top: 10px; /* Space below the progress bar */
    font-family: 'Arial, sans-serif';
    font-size: 18px;
    font-weight: bold;
    color: rgba(255, 215, 0, 0.9); /* Gold color */
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7), 
                 0 0 20px rgba(255, 223, 0, 0.5);
    text-align: center;
    animation: flash 1s infinite alternate; /* Flashing effect */
}

/* Flashing animation */
@keyframes flash {
    0% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.9), 
                     0 0 20px rgba(255, 223, 0, 0.7);
    }
    100% {
        opacity: 0.5;
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.6), 
                     0 0 10px rgba(255, 223, 0, 0.4);
    }
}

#startScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Dark overlay */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 5; /* Above everything */
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
}

#startScreen h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 223, 0, 0.9);
}

#startButton {
    padding: 10px 30px;
    font-size: 24px;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    color: #000;
    background: linear-gradient(to right, #00ff00, #00cc00);
    border: 2px solid #fff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.7), 0 0 20px rgba(0, 255, 0, 0.5);
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

#startButton:hover {
    background: linear-gradient(to right, #00cc00, #009900);
    box-shadow: 0 0 15px rgba(0, 255, 0, 1), 0 0 30px rgba(0, 255, 0, 0.8);
    transform: scale(1.1);
}

#storyText {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 20px;
    max-width: 80%;
    text-align: center;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

#storyText strong {
    color: #00ff00; /* Highlighted green for key words */
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
}

#storyText em {
    color: #cccccc; /* Lighter gray for emphasis */
    font-style: italic;
}
