body {
    margin: 0; padding: 0; overflow: hidden;
    font-family: 'Arial Black', Gadget, sans-serif; /* Bolder font for Neo-Brutalism */
    background-color: #111; /* Darker background */
    color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

canvas { display: block; }

/* --- UI Screens Base Style (Neo-Brutalism) --- */
#start-screen, #pause-screen, #shop-screen, #leaderboard-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #1a1a1a; /* Dark solid background */
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    box-sizing: border-box;
    padding: 20px;
    text-align: center;
    border: 4px solid #fff; /* White border */
}
/* Hide initially for JS control */
#pause-screen, #shop-screen { display: none; }

/* Specific background for start screen */
#start-screen {
    background-size: cover; background-position: center; background-repeat: no-repeat;
    /* Background image set by JS, fallback color */
    background-color: #111;
    border-color: #ffd700; /* Gold border for start */
}

/* Titles */
#start-screen .logo, /* Use logo class */
#pause-screen h1,
#shop-screen h1,
#leaderboard-screen h1 {
    font-size: clamp(2.2em, 6vw, 4em);
    margin-bottom: 25px;
    text-shadow: 2px 2px 0px #000; /* Simple black shadow */
    color: #fff; /* Default white title */
    border-bottom: 3px solid #fff; /* White underline */
    padding-bottom: 10px;
    display: inline-block; /* Fit border to text */
}
#start-screen .logo { /* Specific logo color handled in HTML style block */
    border-bottom: 3px solid #ffd700;
}
#pause-screen h1 { color: #ffc107; border-color: #ffc107; } /* Yellow for pause */
#shop-screen h1 { color: #1e90ff; border-color: #1e90ff; } /* Blue for shop */
#leaderboard-screen h1 { color: #32cd32; border-color: #32cd32; } /* Green for leaderboard */


/* Text & Input */
#start-screen .game-summary {
    font-size: clamp(1em, 2vw, 1.1em);
    font-family: Arial, sans-serif; /* More readable font for paragraph */
    max-width: 90%; width: 550px;
    margin-bottom: 25px;
    background: #2a2a2a; /* Slightly lighter dark bg */
    padding: 15px;
    border: 2px solid #555; /* Grey border */
    line-height: 1.5;
    color: #eee;
}

#start-screen input {
    padding: 10px 15px;
    font-size: clamp(1em, 2.5vw, 1.1em);
    font-family: Arial, sans-serif;
    margin-bottom: 20px;
    border: 2px solid #fff; /* White border */
    background: #111; /* Match background */
    color: #fff; /* White text */
    width: 80%; max-width: 300px;
    box-sizing: border-box;
    text-align: center;
}
#start-screen input::placeholder { color: #888; }

/* --- General Button Styling (Neo-Brutalism) --- */
button { /* Target all buttons for consistency */
    padding: 10px 20px;
    font-size: clamp(1em, 2.5vw, 1.1em);
    font-family: 'Arial Black', Gadget, sans-serif; /* Bold font */
    color: #000; /* Black text */
    border: 3px solid #000; /* Black border */
    cursor: pointer;
    margin: 8px;
    text-transform: uppercase;
    font-weight: bold;
    box-shadow: 4px 4px 0px #000; /* Hard offset shadow */
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    background-color: #fff; /* Default White Background */
}

button:hover {
    /* Keep solid color on hover, maybe slight transform */
    transform: scale(1.02);
}

button:active {
    transform: translate(2px, 2px); /* Press down effect */
    box-shadow: 2px 2px 0px #000;
}

/* Button Color Overrides */
#start-screen #start-game-button { background-color: #ffd700; } /* Gold */
#start-screen #leaderboard-button { background-color: #32cd32; } /* Green */

#pause-screen #resume-button { background-color: #32cd32; } /* Green */
#pause-screen #shop-button-pause { background-color: #1e90ff; } /* Blue */
#pause-screen #quit-button { background-color: #f44336; } /* Red */
#pause-screen #restart-button-death { background-color: #32cd32; } /* Green */
#pause-screen #quit-button-death { background-color: #f44336; } /* Red */

#shop-screen button { background-color: #1e90ff; } /* Blue default for shop items */
#shop-screen #start-next-level-button { background-color: #32cd32; } /* Green */
#shop-screen #shop-resume-button { background-color: #32cd32; } /* Green */

#leaderboard-screen button { background-color: #ccc; } /* Grey for close */
#end-screen button { background-color: #fff; } /* White for end screen */
#end-screen #restart-button-end { background-color: #ffd700; } /* Gold restart */
#end-screen #leaderboard-button-end { background-color: #32cd32; } /* Green leaderboard */


/* Game Container & Overlay */
#game-container { position: relative; width: 100%; height: 100vh; }
#game-canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
#ui-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* Mobile Controls */
#mobile-controls { position: absolute; bottom: 0; left: 0; width: 100%; height: 150px; display: flex; justify-content: space-between; align-items: flex-end; z-index: 5; padding: 15px; box-sizing: border-box; pointer-events: none; touch-action: none; }
#joystick-container { width: 120px; height: 120px; pointer-events: auto; }
#joystick-base { width: 100%; height: 100%; background: rgba(50, 50, 50, 0.6); border-radius: 50%; position: relative; border: 3px solid rgba(255, 255, 255, 0.5); box-shadow: 3px 3px 0px rgba(0,0,0,0.5); /* Subtle shadow */ }
#joystick-handle { width: 50px; height: 50px; background: rgba(255, 255, 255, 0.8); border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 2px solid #aaa; }
#action-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; align-items: center; max-width: 65%; pointer-events: auto; }
.action-button { padding: 8px 4px; font-size: 0.8em; min-width: 65px; margin: 0; box-shadow: 2px 2px 0px #000; border-width: 2px; }
.action-button.secondary { background-color: #aaa; }
.action-button.utility { background-color: #1e90ff; } /* Blue */


/* Made By Link */
.made-by { position: absolute; bottom: 10px; right: 15px; font-size: clamp(0.8em, 1.5vw, 0.9em); color: rgba(255, 255, 255, 0.6); z-index: 11; font-family: Arial, sans-serif; }
.made-by a { color: #1DA1F2; text-decoration: none; font-weight: bold; }
.made-by a:hover { text-decoration: underline; }

/* Leaderboard Screen Specifics */
#leaderboard-screen-container {
    /* Uses base UI screen styles */
    background: rgba(10, 10, 10, 0.95); /* Darker overlay for leaderboard */
    border: 4px solid #32cd32; /* Green border */
    display: none; /* Hidden by default */
    z-index: 20;
}
#leaderboard-screen { /* Inner content div */
    background: none; border: none; box-shadow: none; /* Remove duplicate styling */
    width: 90%; max-width: 600px;
}
.leaderboard-entries {
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 2px solid #555;
    background: #2a2a2a;
    padding: 10px;
    box-sizing: border-box;
}
.leaderboard-entries table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    font-size: clamp(0.9em, 2vw, 1em);
}
.leaderboard-entries th, .leaderboard-entries td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #444;
}
.leaderboard-entries th {
    background: #333;
    color: #32cd32; /* Green header text */
    position: sticky; top: 0; /* Keep header visible on scroll */
}
.leaderboard-entries td:nth-child(1) { text-align: center; width: 15%; } /* Rank */
.leaderboard-entries td:nth-child(3) { text-align: right; width: 25%; } /* Score */
.leaderboard-entries td:nth-child(4) { text-align: right; width: 20%; } /* Time */

/* End Screen Styling (Created Dynamically) */
#end-screen {
     /* Uses base UI screen styles */
     background: rgba(10, 10, 10, 0.9);
     border: 4px solid #ffd700; /* Gold border */
     z-index: 15;
     font-family: Arial, sans-serif; /* More readable font */
     display: none; /* Hidden until shown by JS */
}
#end-screen h1 { /* Override base title */
    font-family: 'Arial Black', Gadget, sans-serif;
    color: #ffd700;
    border-color: #ffd700;
}
#end-screen p { font-size: clamp(1em, 2vw, 1.1em); margin: 8px 0; }


/* Hide mobile controls on larger screens */
@media (min-width: 768px) {
    #mobile-controls { display: none !important; }
}