/* style.css */
body {
    margin: 0;
    padding: 0;
    background-color: #e0f2ff;
    font-family: 'Arial', sans-serif;
    color: #333;
    -webkit-user-select: none;
    user-select: none;
    height: 100vh; /* fallback */
    display: flex;
    justify-content: center;   /* horizontal centering */
    align-items: flex-start;   /* stick content to top to avoid mobile top gap */
}

@supports(height: 100dvh) {
    body {
        height: 100dvh;
    }
}

/* Game wrapper - contains all game elements */
#gameWrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Desktop: Fixed phone-like viewport */
@media (min-width: 500px) {
    body {
        align-items: center; /* vertically center the wrapper */
        background-color: #398350; /* green fill below the image */
        background-image: url('assets/images/balloffury-wide.webp');
        background-repeat: no-repeat;
        background-position: top center;
        background-size: 100% auto;
        isolation: isolate; /* stacking context so ::before with z-index:-1 sits above body bg */
    }
    /* Dark overlay — dims background during loading, fades out on .bg-visible */
    body::before {
        content: '';
        position: fixed;
        inset: 0;
        background: #000;
        opacity: 0.8;
        transition: opacity 2s ease-out;
        z-index: -1;
        pointer-events: none;
    }
    body.bg-visible::before {
        opacity: 0;
    }
    #gameWrapper {
        width: 430px;
        height: 780px;
        max-width: 430px;
        max-height: 780px;
        border-radius: 16px;
        box-shadow: 0 0 60px rgba(0,0,0,0.7), 0 0 120px rgba(0,0,0,0.4);
    }
}

canvas {
    display: block;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    width: 100%;
    height: 100%;
}

/* Meteor Shower Red Overlay Effect */
#meteorShowerOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--meteor-overlay-color, #870000);
    mix-blend-mode: overlay;
    opacity: 0;
    pointer-events: none;
    z-index: 10; /* Above canvas but below UI */
    transition: opacity 3s ease-in-out;
    display: block; /* Ensure it's always visible for transitions */
}

#meteorShowerOverlay.fade-in {
    opacity: var(--meteor-overlay-opacity, 0.7);
}

#meteorShowerOverlay.fade-out {
    opacity: 0;
}

/* Ball of Fury Overlay - 3 second fade-out transition for Ball of Fury events */
#meteorShowerOverlay.ball-of-fury-mode {
    transition: opacity 3s ease-in-out;
    background-color: var(--ball-of-fury-overlay-color, #CC0000);
}

#meteorShowerOverlay.ball-of-fury-mode.fade-in {
    opacity: var(--ball-of-fury-overlay-opacity, 0.6);
}

#meteorShowerOverlay.ball-of-fury-mode.fade-out {
    opacity: 0;
}

#uiOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.scoreInfo {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 5px;
    color: #ffffff;
    pointer-events: auto;
    display: flex;
    flex-direction: column; /* Changed to column for multi-line layout */
    align-items: flex-start; /* Align items to the left */
    z-index: 100;
    min-width: auto;
    box-sizing: border-box;
}

#scoreDisplay {
    font-size: 17px;
    font-weight: bold;
    display: block;
    margin-bottom: 5px; /* Add space between score and high score */
}

#highScoreContainer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#highScoreDisplay {
    font-size: 13px;
    font-weight: bold; /* Make the main HS text bold as well */
    display: block;
    line-height: normal;
    margin-top: 0;
    margin-left: 0; /* Remove left margin */
}

#highScoreSubtext {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 3px; /* Space between HS line and subtext */
}

.scoreInfo .timestamp {
    font-size: 11px;
    opacity: 0.85;
    display: block;
    margin-left: 2px; /* If needed for spacing next to signature */
    align-self: flex-end; /* Align timestamp to bottom if scoreInfo is flex-column */
}

/* =========================== */
/* REUSABLE PROGRESS BAR SYSTEM */
/* =========================== */
/*
 * HOW TO USE THIS SYSTEM FOR NEW FEATURES:
 * 
 * 1. HTML Structure:
 *    <div id="yourFeatureProgressContainer" class="game-progress-container">
 *        <div id="yourFeatureProgressLabel" class="game-progress-label">YOUR FEATURE 1</div>
 *        <div id="yourFeatureProgressBarContainer" class="game-progress-bar-container">
 *            <div id="yourFeatureProgressBar" class="game-progress-bar"></div>
 *        </div>
 *    </div>
 * 
 * 2. CSS Positioning & Colors:
 *    #yourFeatureProgressContainer {
 *        top: 120px;  // Position below other progress bars
 *        left: 15px;
 *    }
 *    #yourFeatureProgressBar {
 *        background: linear-gradient(90deg, #YourColor1, #YourColor2, #YourColor1);
 *        animation: yourShimmer 2s ease-in-out infinite;
 *        box-shadow: 0 0 3px rgba(your-color-rgba, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
 *    }
 * 
 * 3. JavaScript:
 *    - Create similar helper functions for your feature's progress logic
 *    - Use similar updateProgressBar() function pattern
 *    - Set progress with: yourProgressBar.style.width = `${percent}%`;
 */

/* Base Progress Bar Container Class */
.game-progress-container {
    position: absolute;
    width: 100px;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    z-index: 100;
    display: block;
}

/* Base Progress Bar Label Class */
.game-progress-label {
    color: black;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 2px;
}

/* Base Progress Bar Container Class */
.game-progress-bar-container {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    padding: 0;
    margin: 0;
    height: 7px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid black;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Base Progress Bar Class */
.game-progress-bar {
    height: 100%;
    width: 0%;
    background-size: 200% 100%;
    border-radius: 1px;
    transition: width 0.3s ease-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* GOLDEN STREAK SPECIFIC STYLES */
#streakProgressContainer {
    top: 95px;
    left: 15px;
    position: absolute;
    width: auto;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    z-index: 100;
    display: block;
}

#streakProgressBar {
    background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700);
    background-size: 200% 100%;
    animation: shimmer 6s ease-in-out infinite;
    box-shadow: 0 0 3px rgba(255, 215, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Golden Streak Flex Row */
.streak-flex-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

.streak-countdown {
    margin-left: 4px;
    color: rgb(0, 0, 0);
    font-size: 10px;
    font-weight: bold;
    text-align: left;
    font-family: inherit;
    min-width: 12px;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(220, 220, 220, 0.9);
    white-space: nowrap;
}

#streakProgressBarContainer,
#ballOfFuryProgressBarContainer {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

/* ball of fury Flex Row */
.bof-flex-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

.bof-countdown {
    margin-left: 4px;
    color: rgb(0, 0, 0);
    font-size: 10px;
    font-weight: bold;
    text-align: left;
    font-family: inherit;
    min-width: 12px;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(220, 220, 220, 0.9);
    white-space: nowrap;
}

/* Golden pellet indicator next to streak/BoF countdown numbers */
.streak-countdown::after,
.bof-countdown::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background: radial-gradient(circle at 35% 35%, #fff4a3, #f5c842 40%, #c8960c);
    border-radius: 50%;
    margin-left: 5px;
    vertical-align: 0px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    50% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* BALL OF FURY SPECIFIC STYLES */
#ballOfFuryProgressContainer {
    top: 126px; /* Positioned below golden streak bar */
    left: 15px;
}

#ballOfFuryProgressBar {
    background: linear-gradient(90deg, #FF4444, #CC0000, #FF4444);
    background-size: 200% 100%;
    animation: shimmer 9s ease-in-out infinite;
    transition: width 0.3s ease-out, box-shadow 0.3s ease-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Ball of Fury Bar Glow Effect (starts at 50% progress) */
.ball-of-fury-bar.glowing {
    animation: shimmer 6s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.8), 0 1px 2px rgba(0, 0, 0, 0.4);
}

.ball-of-fury-bar.intense-glow {
    animation: shimmer 4.5s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(255, 68, 68, 1.0), 0 0 5px rgba(255, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Slowdown offering phase glow animations */
@keyframes slowdownOfferingGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(79, 195, 247, 0.5), 0 0 8px rgba(79, 195, 247, 0.2), 0 1px 3px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 8px rgba(79, 195, 247, 0.9), 0 0 14px rgba(79, 195, 247, 0.5), 0 1px 3px rgba(0, 0, 0, 0.5); }
}

@keyframes slowdownTextGlow {
    0%, 100% { text-shadow: 0 0 4px rgba(79, 195, 247, 0.6), 1px 1px 2px rgba(0, 0, 0, 0.5); }
    50% { text-shadow: 0 0 8px rgba(79, 195, 247, 1.0), 0 0 12px rgba(79, 195, 247, 0.5), 1px 1px 2px rgba(0, 0, 0, 0.5); }
}

#slowdownProgressBarContainer.offering-glow {
    animation: slowdownOfferingGlow 1.5s ease-in-out infinite;
    border-color: #4FC3F7;
}

#slowdownCountdown.offering-glow {
    color: #4FC3F7;
    animation: slowdownTextGlow 1.5s ease-in-out infinite;
    font-size: 12px;
}

/* NEXT SLOWDOWN SPECIFIC STYLES */
#slowdownProgressContainer {
    top: 157px; /* Below Ball of Fury bar */
    left: 15px;
}

#slowdownProgressBarContainer {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

#slowdownProgressBar {
    background: linear-gradient(90deg, #4FC3F7, #0277BD, #4FC3F7);
    background-size: 200% 100%;
    animation: shimmer 9s ease-in-out infinite;
    box-shadow: 0 0 3px rgba(2, 119, 189, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
}

.slowdown-flex-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

.slowdown-countdown {
    margin-left: 4px;
    color: rgb(0, 0, 0);
    font-size: 9px;
    font-weight: bold;
    text-align: left;
    font-family: inherit;
    min-width: 30px;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(220, 220, 220, 0.9);
}

#slowdownProgressLabel {
    width: 120px;
    text-align: left;
    margin-left: 0;
    margin-right: 0;
    display: block;
}


#gameOverMessage {
    width: 260px;
    display: none;
    font-size: 36px;
    font-weight: bold;
    color: #e74c3c;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 15px 15px;
    border-radius: 10px;
    pointer-events: auto;
    /* Run initial fadeIn once, then continuously pulse size with slow easing */
    animation: fadeIn 0.5s ease-in-out forwards, pulseScale 4s ease-in-out 0.5s infinite;
    z-index: 150; /* Above most game elements but below HS overlay */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

#gameOverMessage span {
    display: block;
    font-size: 18px;
    margin-top: 10px;
    color: #555;
}

/* Group the music and options buttons in a container for proper alignment */
#topRightButtons {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    z-index: 210;
    align-items: center;
}
#musicToggleButton {
    position: static;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0); /* Fully transparent */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 22px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    transition: opacity 0.2s, filter 0.2s;
}
#musicToggleButton.music-on {
    opacity: 1;
    filter: none;
}
#musicToggleButton.music-off {
    opacity: 0.5;
    filter: grayscale(1) brightness(1.5);
}
#musicToggleButton:hover {
    background-color: rgba(0, 0, 0, 0); /* Still transparent on hover */
}
#optionsButton {
    position: static;
}

/* Options Menu - Reverted to be a centered overlay */
#optionsMenu {
    display: none; /* Start hidden, JS will toggle .visible */
    position: absolute; /* Centered within game wrapper */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95); /* Initial state for transition */
    background-color: rgba(250, 250, 250, 0.78);
    padding: 25px; /* Original padding */
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.35);
    z-index: 200; /* High z-index */
    pointer-events: auto;
    text-align: center;
    min-width: 300px; /* Original min-width */
    max-width: min(90vw, 400px); /* Constrained to game container width on desktop */
    max-height: calc(100vh - 80px); /* Adjusted slightly for padding from viewport edges */
    overflow-y: auto;
    box-sizing: border-box;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease-out, transform 0.25s ease-out, visibility 0s linear 0.25s;
}

#optionsMenu.visible {
    width: 90%;
    display: block; /* Or 'flex' if you want to center content with flexbox */
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity 0.25s ease-in, transform 0.25s ease-in, visibility 0s linear 0s;
}

/* Content within #optionsMenu */
#optionsMenu h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}

#optionsMenu h4 { /* Section titles like "Jump Settings" */
    margin-top: 20px;
    margin-bottom: 10px;
    color: #555;
    text-align: left;
    padding-left: 5%; /* Original padding */
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    font-size: 1.1em;
}
#optionsMenu h4:first-of-type {
     margin-top: 0; /* The first h4 (like a sub-title to "Options" if any) */
}
/* If #versionInfo is directly inside #optionsMenu */
#optionsMenu #versionInfo {
    background-color: rgba(0, 0, 0, 0.03);
    padding: 10px 15px;
    margin: -25px -25px 20px -25px; /* Adjust to fit #optionsMenu padding */
    border-bottom: 1px solid #ccc;
    text-align: left;
}
#optionsMenu #versionNumberDisplay {
    font-weight: bold; margin-top: 0; margin-bottom: 8px; font-size: 15px; color: #2c3e50;
}
#optionsMenu #versionInfo h4 { /* "What's new" title inside versionInfo */
    margin-top: 5px; margin-bottom: 5px; font-size: 13px; color: #34495e;
    padding: 0; border-bottom: none; text-align: left;
}
#optionsMenu #versionChangesList {
    list-style-type: disc; padding-left: 20px; margin-top: 0; margin-bottom: 0;
    font-size: 12px; color: #34495e;
}
#optionsMenu #versionChangesList li { margin-bottom: 4px; }


.options-group {
    margin-bottom: 18px;
    padding: 0 5%; /* Original padding */
}
#optionsMenu label {
    display: block; margin-bottom: 6px; color: #454545; font-size: 14px; text-align: left;
}
#optionsMenu input[type="range"] {
    width: 100%; margin-bottom: 6px; cursor: pointer;
}
#optionsMenu .value-display {
    font-weight: bold; color: #2c3e50;
}
#optionsMenu .description {
    font-size: 11px; color: #666; margin-bottom: 12px; text-align: left; line-height: 1.3;
}
#optionsMenu .button-container { /* This was the container for a row of buttons */
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Center buttons in the container */
    gap: 10px; /* Add gap between buttons if they are not full width */
    padding: 0 5%; /* Original padding */
}
#optionsMenu .button-container button { /* Buttons inside the container */
    margin-top: 0; /* Remove individual top margin if using gap */
    padding: 10px 15px;
    font-size: 14px;
    cursor: pointer;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    /* width: auto; /* Allow buttons to size to content or be controlled by flex */
    flex-grow: 1; /* Allow buttons to grow if needed */
    min-width: 100px; /* Prevent buttons from becoming too small */
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}
#optionsMenu .button-container button:hover {
    background-color: #2980b9;
}

/* Specific button colors - ensure high specificity or apply directly */
#optionsMenu #relaunchButton { background-color: #e74c3c; }
#optionsMenu #relaunchButton:hover { background-color: #c0392b; }

#optionsMenu #showSettingsButton { background-color: #27ae60; }
#optionsMenu #showSettingsButton:hover { background-color: #229954; }

#optionsMenu #resetSettingsButton { background-color: #f39c12; }
#optionsMenu #resetSettingsButton:hover { background-color: #e69100; }

#optionsMenu #resetHighScoreButton {
    background-color: #d9534f;
    /* margin-top: 8px; /* Handled by button-container gap or own margin if outside */
}
#optionsMenu #resetHighScoreButton:hover {
    background-color: #c9302c;
}
#optionsMenu #closeOptionsButton { /* Ensure Close button is styled */
    background-color: #7f8c8d; /* Neutral color */
}
#optionsMenu #closeOptionsButton:hover {
    background-color: #6c7a7d;
}


/* --- In-Game Dialog (replaces native alert/confirm/prompt) --- */
.game-dialog {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 210;
    pointer-events: none;
}
.game-dialog.visible {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}
.game-dialog-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease-in;
}
.game-dialog.visible .game-dialog-backdrop {
    opacity: 1;
}
.game-dialog-content {
    position: relative;
    background: rgba(250, 250, 250, 0.97);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
    max-width: min(85%, 340px);
    text-align: center;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
.game-dialog.visible .game-dialog-content {
    transform: scale(1);
    opacity: 1;
}
.game-dialog-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3em;
    color: #2c3e50;
    margin-bottom: 10px;
}
.game-dialog-message {
    font-size: 14px;
    color: #454545;
    margin-bottom: 18px;
    line-height: 1.4;
    max-height: 55vh;
    overflow-y: auto;
}
.game-dialog-input {
    display: none;
    width: 80%;
    padding: 10px 12px;
    font-size: 16px;
    border: 2px solid #ccc;
    border-radius: 6px;
    margin-bottom: 18px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}
.game-dialog-input:focus {
    border-color: #3498db;
}
.game-dialog-input.visible {
    display: inline-block;
}
.game-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.game-dialog-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    color: white;
    min-width: 90px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.game-dialog-btn:active {
    transform: scale(0.95);
}
.game-dialog-btn.confirm {
    background-color: #3498db;
}
.game-dialog-btn.confirm:hover {
    background-color: #2980b9;
}
.game-dialog-btn.cancel {
    display: none;
    background-color: #95a5a6;
}
.game-dialog-btn.cancel:hover {
    background-color: #7f8c8d;
}
.game-dialog-btn.cancel.visible {
    display: inline-block;
}

#settingsTextBox {
    display: none;
    width: 90%; /* Relative to its parent in optionsMenu */
    margin-left: auto; /* Center it */
    margin-right: auto; /* Center it */
    min-height: 80px;
    max-height: 150px;
    overflow-y: auto;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    resize: vertical;
    box-sizing: border-box;
    background-color: #f9f9f9;
}
hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #e0e0e0;
}
@keyframes fadeIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* REMOVED High Score Overlay & Effects CSS from here - MOVED to highscore.css */

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1e7e47;
    z-index: 9999;
    overflow: hidden;
}
#loadingImage {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100vh;
    width: auto;
    z-index: 1;
}
#loadingOverlayContent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 10vh;
    box-sizing: border-box;
    z-index: 2;
    pointer-events: none;
}
#loadingProgressContainer {
    width: 300px;
    height: 18px;
    background: #222;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    border: 3px solid #000;
    margin-bottom: 24px;
    pointer-events: auto;
}
#loadingProgressBar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4fc3f7 0%, #1976d2 100%);
    border-radius: 9px 0 0 9px;
    transition: width 0.3s;
}
#loadingText {
    color: #fff;
    font-size: 2.2rem;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px #000;
    animation: none;
    pointer-events: auto;
}
#loadingText.flash {
    animation: flashText 1s infinite alternate;
}
@keyframes flashText {
    0% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* Use dynamic viewport unit on browsers that support it so the loading GIF always fits the visible screen height on mobile */
@supports (height: 100dvh) {
    #loadingImage {
        height: 100dvh;
    }
}

/* Desktop: Loading screen contained within game wrapper */
@media (min-width: 500px) {
    #loadingOverlay {
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 16px;
    }
    #loadingImage {
        height: 100%;
    }
    #loadingOverlayContent {
        width: 100%;
        height: 100%;
        padding-bottom: 80px;
    }
}

/* Mobile adjustment: raise loading progress UI so it's not flush with bottom edge */
@media (max-width: 767px) {
    #loadingOverlayContent {
        padding-bottom: 19vh;
    }
    
    /* Position game over message higher on mobile devices */
    #gameOverMessage {
        top: 45%;
    }
}

/* ------------------------------------------------------------------
   Pulse (expand / shrink) animation for #gameOverMessage
   Grows to +15% then shrinks to -15% of original size, looping forever.
   "ease-in-out" timing provides the desired slow-down near the limits.
   (We repeat translate so the element stays centered while scaling.)
------------------------------------------------------------------*/
@keyframes pulseScale {
    0%   { transform: translate(-50%, -50%) scale(1); }
    50%  { transform: translate(-50%, -50%) scale(1.15); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* --- Menu Styles --- */
.menu-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5em;
    color: #ffffff;
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
}

.menu-subtitle {
    font-family: 'Arial', sans-serif;
    font-size: 0.8em;
    color: #313131;
    text-align: center;
    margin-bottom: 15px;
}

.menu-options-label {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4em;
    color: #525252;
    text-align: center;
    margin-bottom: 20px;
}

#whatsNewModal {
    background: rgba(216 240 233 / 95%);
    border: 2px solid #4ecdc4;
    border-radius: 10px;
    padding: 20px;
    margin-top: 10px;
}

#whatsNewModal h4 {
    color: #4ecdc4;
    font-family: 'Arial', sans-serif;
}

#adminDevMenu {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid #aaaaaa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 10px;
}

#adminDevMenu h2 {
    color: #ff6b6b;
    font-family: 'Fredoka One', cursive;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

#adminDevMenu h4 {
    color: #feca57;
    font-family: 'Fredoka One', cursive;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

#devButton {
    background: linear-gradient(45deg, #ff6b6b, #e74c3c);
    color: white;
    font-weight: bold;
    border: 2px solid #c0392b;
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
    transition: all 0.3s ease;
}

#devButton:hover {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    box-shadow: 0 6px 12px rgba(231, 76, 60, 0.5);
    transform: translateY(-2px);
}

#whatsNewButton {
    background: linear-gradient(45deg, #4ab466, #7fd08c);
    color: white;
    font-weight: bold;
    border: 2px solid #3498db;
}

#whatsNewButton:hover {
    background: linear-gradient(45deg, #45b7d1, #3498db);
    transform: translateY(-2px);
}

#backToBasicMenuButton {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
    font-weight: bold;
    border: 2px solid #2c3e50;
}

#backToBasicMenuButton:hover {
    background: linear-gradient(45deg, #7f8c8d, #2c3e50);
    transform: translateY(-2px);
}

#closeWhatsNewButton {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
    font-weight: bold;
    border: 2px solid #2c3e50;
}

#closeWhatsNewButton:hover {
    background: linear-gradient(45deg, #7f8c8d, #2c3e50);
    transform: translateY(-2px);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#streakProgressLabel,
#ballOfFuryProgressLabel {
    width: 120px;
    text-align: left;
    margin-left: 0;
    margin-right: 0;
    display: block;
}

