* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: #111;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* Global Controls */
#global-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

button, .link-btn {
    background: #333;
    color: white;
    border: 2px solid #555;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    text-decoration: none;
    text-align: center;
    transition: 0.2s;
}

button:hover, .link-btn:hover {
    background: #555;
    border-color: #777;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #222;
}

.screen.active {
    display: flex;
}

.overlay {
    background: rgba(0, 0, 0, 0.85);
    z-index: 500;
}

#main-menu {
    background: linear-gradient(135deg, #1a0b2e 0%, #000000 100%);
    position: relative;
}

#main-menu::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, transparent 0%, #000 100%), 
                repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px);
    z-index: 0;
}

#main-menu::after {
    display: none; /* Remove the old emoji background */
}

h1 { 
    font-family: 'Bungee', cursive;
    font-size: 76px; 
    margin-bottom: 40px; 
    color: #fff; 
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 6px 6px 0px #000, 0 0 10px rgba(255, 0, 128, 0.8), 0 0 20px rgba(0, 255, 255, 0.8); 
    z-index: 10;
}

h2 { font-size: 36px; margin-bottom: 20px; }

.menu-buttons { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    width: 350px; 
    z-index: 10; 
}

.menu-buttons button, .menu-buttons .link-btn {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.menu-buttons button:hover, .menu-buttons .link-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #0ff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
    transform: translateY(-3px) scale(1.05);
}

h2 { font-size: 36px; margin-bottom: 20px; }
.menu-buttons { display: flex; flex-direction: column; gap: 15px; width: 300px; z-index: 10; }
#tutorial-screen p { margin-bottom: 12px; font-size: 20px; }

/* Level Grid Styles */
.level-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: visible;
    padding: 10px;
}
.level-card {
    background: #333;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
    width: 130px;
}

.level-card:hover {
    background: #555;
    border-color: #777;
    transform: scale(1.05);
}
.level-card img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
    background: #000;
}

/* Game UI */
#game-screen { background: #000; }

#end-screen.overlay {
    background: rgba(0, 0, 0, 0.9);
    border: 4px solid gold;
    border-radius: 20px;
    width: 400px !important;
    height: auto !important; /* Changed to auto to prevent scrollbars */
    min-height: 250px;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
    pointer-events: auto; /* Allows clicking the button while ignoring background */
}

/* Game UI */
#game-screen { background: #000; }

#ui-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #555;
    transform: scale(0.8);
    transform-origin: top left;
}

.ui-row {
    display: flex;
    gap: 20px;
    align-items: center;
}

.ui-row span {
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

.color-stat {
    cursor: crosshair;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.color-stat:hover {
    background: rgba(255, 255, 255, 0.3);
}

#gameCanvas { display: block; }

/* Boss Level Card Styles */
.boss-card {
    width: 50%;
    background: linear-gradient(45deg, #4a0000, #220000);
    border: 4px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6), inset 0 0 15px rgba(255, 215, 0, 0.3);
    padding: 20px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.boss-card:hover {
    background: linear-gradient(45deg, #6a0000, #330000);
    transform: scale(1.05);
    border-color: #ff4500;
}
.boss-card img {
    width: 150px;
    height: 150px;
    border: 3px solid #ffd700;
}
.boss-label {
    color: #ffd700;
    font-size: 26px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
    text-shadow: 2px 2px 6px #000;
}

#top-right-controls {
    position: absolute;
    top: 15px;      /* Adjust to match the padding of your left UI */
    right: 15px;    /* Pins it to the right side */
    display: flex;
    gap: 10px;      /* Space between the two buttons */
    z-index: 1000;  /* Ensures it stays clickable above the game canvas */
}

/* Optional: If you want them to have the same dark background as the left UI */
#top-right-controls button {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
}