/* Asset Reminder Comment */
/* --- Import Pixel Font --- */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* --- General Setup --- */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh; /* Full viewport height */
    margin: 0;
    background-color: #333; /* Keep a neutral page background */
    /* --- ENSURE FONT IS HERE --- */
    font-family: 'Press Start 2P', cursive;
    overflow: hidden; /* Prevent body scrollbars */
    touch-action: none; /* Disable default touch actions like pinch-zoom */
    user-select: none; /* Disable text selection */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE/Edge */
    font-size: 10px; /* Base size for pixel font */
}

#game-container {
    position: relative; /* Needed for absolute positioning of overlays */
    border: 2px solid #0f0f1a; /* Darker border */
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1); /* Subtle glow */
    overflow: hidden; /* Crucial: hides anything outside the container */
    /* Dimensions will be set by JS based on canvas */
}

/* --- Canvas Styling & Effects --- */
canvas#gameCanvas { /* More specific selector */
    display: block; /* Remove extra space below canvas */
    background-color: #87CEEB; /* Base sky blue background */
    transition: filter 0.25s ease-in-out;
    filter: none;
    animation: none;
}

/* Spring Jump Effect (Brief Flash) */
canvas#gameCanvas.spring-jump-effect {
    filter: brightness(1.4) contrast(1.2);
}

/* Keyframes for Hue Cycling */
@keyframes hue-cycle {
    0%   { filter: hue-rotate(0deg) saturate(1.3); }
    50%  { filter: hue-rotate(180deg) saturate(1.3); }
    100% { filter: hue-rotate(360deg) saturate(1.3); }
}

/* Class to apply hue cycle animation (Propeller) */
canvas#gameCanvas.propeller-hue-cycle {
    animation: hue-cycle 2s linear infinite;
}

/* Jetpack Power-up Effect (Continuous, Intense) */
canvas#gameCanvas.jetpack-active {
    filter: hue-rotate(75deg) contrast(1.1) saturate(1.5) brightness(1.1);
}

/* Ensure transitions/animations stop correctly */
canvas#gameCanvas:not(.spring-jump-effect):not(.propeller-hue-cycle):not(.jetpack-active) {
    filter: none;
    animation: none;
}


/* --- UI Overlays --- */
#score-display {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 1.6em;
    color: #1a1a2e; /* Dark blue text */
    background-color: rgba(255, 255, 255, 0.85); /* Semi-transparent white */
    padding: 8px 12px;
    border-radius: 3px;
    z-index: 10;
    text-shadow: none;
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    /* Font should be inherited from body */
}

#loading-screen,
#title-screen { /* Combined selector */
    position: absolute; /* Needs to be absolute to stack correctly */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Text color will be overridden per element */
    display: flex;
    flex-direction: column;
    /* --- Adjusted Flexbox Alignment --- */
    justify-content: flex-start; /* Align content block to the top */
    align-items: center; /* Center content horizontally */
    text-align: center;
    z-index: 20; /* Ensure title screen is above canvas */
    /* --- Added Padding Top --- */
    padding: 150px 20px 20px 20px; /* Top padding creates gap, other padding remains */
    box-sizing: border-box; /* Include padding in height */
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    /* Font should be inherited from body */
    overflow: hidden; /* Hide potential overflow */

    /* --- Multiple Background Approach --- */
    /* Layer 1: Sun Image */
    /* Layer 2: Gradient */
    background:
        /* Sun Layer */
        url('sprites/sun.png') /* Image source */
        /* --- Adjusted Sun Position --- */
        top center / contain /* Position (Top Center) / Size (contain preserves aspect ratio) */
        no-repeat, /* Don't repeat sun */

        /* Gradient Layer */
        linear-gradient(to bottom, #6ad1fa, #eeffff); /* Gradient definition */
        /* Gradient uses default position/size/repeat */

}

/* Loading screen specific background override */
#loading-screen {
     background: rgba(0, 0, 0, 0.85); /* Simple background, overrides multiple backgrounds */
     color: white; /* White text for loading */
     position: absolute; /* Ensure it overlays correctly */
     z-index: 30; /* Above title screen during loading */
     padding: 20px; /* Reset padding for loading screen */
     justify-content: center; /* Re-center loading content */
     /* Pixel font will be applied by the rule above once CSS loads */
}


/* Title Screen Specific Content Styles */
/* Content should now render correctly over the background layers */

#title-screen h1 {
    /* --- Adjusted margin-bottom if needed due to padding-top --- */
    margin-bottom: 25px;
    font-size: 2.6em;
    color: #d2691e; /* Chocolate/Orange-Brown (from Icarus palette) */
    /* Hard shadow using white like platform highlights */
    text-shadow:
       -2px -2px 0 #fff,
        2px -2px 0 #fff,
       -2px  2px 0 #fff,
        2px  2px 0 #fff, /* White outline */
       -4px -4px 0 #ffffff, /* Darker brown outer shadow */
        4px -4px 0 #ffffff,
       -4px  4px 0 #ffffff,
        4px  4px 0 #ffffff;
    line-height: 1.3;
    /* Font should be inherited from body */
}

#title-final-score-display {
    font-size: 1.8em;
    color: #58a4c7; /* Dark text for contrast */
    margin-bottom: 20px;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.7); /* Subtle light shadow */
    /* Font should be inherited from body */
}

#final-score-value { /* Style the score number */
    color: #58a4c7; /* Match title color */
    /* Font should be inherited */
}

#title-screen p {
    margin-bottom: 15px; /* Spacing for instructions */
    font-size: 1.3em;
    color: #333; /* Dark text for contrast */
    line-height: 1.5;
    max-width: 90%;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.6); /* Subtle light shadow */
    /* Font should be inherited from body */
}

#start-button { /* Style applies to Start Game / Play Again */
    padding: 12px 25px;
    font-size: 1.6em;
    cursor: pointer;
    border: 2px solid #555; /* Darker border */
    border-radius: 0;
    background-color: #b0b0b0; /* Stone grey like platforms */
    color: #fff; /* White text */
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background-color 0.1s ease, color 0.1s ease, transform 0.1s ease;
    box-shadow: 3px 3px 0px #777; /* Darker grey shadow */
    /* --- EXPLICITLY SET FONT HERE --- */
    font-family: 'Press Start 2P', cursive;
    margin-top: 20px;
    text-shadow: 2px 2px 0 #555; /* Dark shadow on text */
}

#start-button:hover {
    background-color: #c8c8c8; /* Lighter grey on hover */
    color: #fff;
}

#start-button:active {
    background-color: #909090; /* Darker grey on press */
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px #777;
    text-shadow: 1px 1px 0 #444;
}

#copyright-text {
    /* position: absolute; */ /* Using flexbox for positioning */
    /* bottom: 10px; */
    width: 100%;
    text-align: center;
    font-size: 0.9em;
    color: rgba(0, 0, 0, 0.4); /* Darker transparent text */
    text-shadow: none;
    margin-top: auto; /* Pushes to bottom within flex container */
    padding-bottom: 10px; /* Add some padding instead of absolute positioning */
    /* Font should be inherited from body */
}


/* --- Touch Controls Overlay --- */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    z-index: 5; /* Below UI overlays */
    display: none; /* Use flex when shown */
}

#touch-left,
#touch-right {
    flex: 1;
    height: 100%;
    pointer-events: auto;
    cursor: pointer;
}


/* Media Queries */
@media (max-height: 500px) {
    #score-display {
        font-size: 1.4em; /* Slightly smaller */
        padding: 6px 10px;
    }
    /* Adjust title screen padding for smaller heights */
     #title-screen {
        padding-top: 100px; /* Reduce top padding */
    }
    #title-screen h1 { font-size: 2.2em; margin-bottom: 15px;}
    #title-screen p { font-size: 1.1em; margin-bottom: 10px;}
    #start-button { font-size: 1.4em; padding: 10px 20px; }
    #copyright-text { font-size: 0.8em; padding-bottom: 5px;}
    /* Font should still be inherited */
}

/* Added media query for very short screens */
@media (max-height: 400px) {
    #title-screen {
        padding-top: 50px; /* Further reduce top padding */
    }
     #title-screen h1 { font-size: 2.0em; margin-bottom: 10px;}
     #title-screen p { display: none; } /* Hide instructions on very short screens */
     #start-button { font-size: 1.2em; padding: 8px 15px; margin-top: 15px;}
}