body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
    font-family: 'Press Start 2P', cursive, monospace; /* Changed font */
    color: #333; /* Default text color */
}

/* Dark mode styles */
body.dark-mode {
    background-color: #222;
    color: #eee;
}

body.dark-mode canvas {
    border-color: #666;
    background-color: #333;
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 {
    color: #eee;
}

body.dark-mode #mainMenu,
body.dark-mode #selectionScreen,
body.dark-mode #bossSelectionScreen,
body.dark-mode #gameOverScreen {
    background-color: #333;
    border-color: #666;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

body.dark-mode .menu-content p {
    color: #bbb;
}

body.dark-mode #statsContainer {
    border-color: #666;
    background-color: #383838;
}

body.dark-mode .player-stats {
    border-color: #555;
    background-color: #444;
}

body.dark-mode #bossStats {
    border-color: #555;
    background-color: #444;
}

body.dark-mode .fighter-option {
    border-color: #555;
    background-color: #444;
}

body.dark-mode .fighter-option select {
    background-color: #555;
    color: #eee;
    border-color: #666;
    font-family: 'Press Start 2P', cursive, monospace; /* Ensure select elements also use pixel font */
}

body.dark-mode button {
    background-color: #555;
    color: white;
}

body.dark-mode button:hover {
    background-color: #777;
}

body.dark-mode #enterGame, body.dark-mode #enterBattleRoyale, body.dark-mode #enterBossFight {
    background-color: #2e8b57; /* Darker green */
}

body.dark-mode #enterGame:hover, body.dark-mode #enterBattleRoyale:hover, body.dark-mode #enterBossFight:hover {
    background-color: #3cb371; /* Lighter green on hover */
}

body.dark-mode #brPlayerList, body.dark-mode #bossPlayerList {
    background-color: #444;
    color: #eee;
}

body.dark-mode #brPlayerStatsList li .player-health, body.dark-mode #bossPlayerStatsList li .player-health {
    color: #ccc;
}

body.dark-mode .player-bonuses span {
    color: #bbb; /* Adjust color for dark mode bonuses */
}

canvas {
    border: 2px solid #333;
    background-color: #e0e0e0;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em; /* Adjust size for pixel font legibility */
}

h2 {
    font-size: 1.5em; /* Adjust size for pixel font legibility */
}

h3 {
    font-size: 1.1em; /* Adjust size for pixel font legibility */
}

#statsContainer {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding: 10px;
    border: 2px solid #333;
    background-color: #f9f9f9;
    font-size: 1.1em;
    gap: 20px;
}

.player-stats {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    background-color: #fff;
    border-radius: 5px;
    line-height: 1.5;
    font-size: 0.8em; /* Adjust base size for pixel font in stats */
}

/* New style for the stats text */
.player-stats .stat-text {
    font-size: 1em; /* Bigger */
    font-weight: bold; /* Bolded */
    margin: 5px 0; /* Add some vertical spacing */
}

#ball1Stats.unarmed-charge, #ball2Stats.unarmed-charge, #bossPlayerStatsList li.unarmed-charge {
    transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

#selectionScreen, #gameOverScreen, #bossSelectionScreen {
    text-align: center;
    padding: 20px;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    margin: 20px;
}

.fighter-selection {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    gap: 40px;
}

.fighter-option {
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.fighter-option h3 {
    margin-top: 0;
    color: #333;
}

.fighter-option select {
    padding: 5px 10px;
    font-size: 16px;
    border-radius: 3px;
    border: 1px solid #ccc;
    font-family: 'Press Start 2P', cursive, monospace; /* Ensure select elements also use pixel font */
}

button {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px;
    font-family: 'Press Start 2P', cursive, monospace; /* Ensure buttons also use pixel font */
}

button:hover {
    background-color: #555;
}

#gameOverScreen h2 {
    color: #333;
    font-size: 1.5em; /* Adjust size for pixel font legibility */
    margin-bottom: 20px;
}

#mainMenu {
    text-align: center;
    padding: 40px;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    margin: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#mainMenu h1 {
    font-size: 3em;
    color: #333;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.menu-content h2 {
    color: #555;
    margin-bottom: 15px;
}

.menu-content p {
    color: #777;
    font-size: 1.1em;
    margin-bottom: 30px;
}

#enterGame, #enterBattleRoyale, #enterBossFight {
    padding: 15px 30px;
    font-size: 18px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#enterGame:hover, #enterBattleRoyale:hover, #enterBossFight:hover {
    background-color: #45a049;
}

.settings {
    margin-top: 20px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#brPlayerList, #bossStats {
    display: none; /* Hidden by default, shown when BR/Boss mode is active */
    flex-direction: column; /* Stack stats vertically */
    flex-grow: 1; /* Allow it to take available space */
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    overflow-y: auto; /* Enable scrolling if many players */
    max-height: 200px; /* Limit height */
}

#brPlayerStatsList, #bossPlayerStatsList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#brPlayerStatsList li, #bossPlayerStatsList li {
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for bonuses */
    justify-content: space-between;
    align-items: center;
}

#brPlayerStatsList li:last-child, #bossPlayerStatsList li:last-child {
    border-bottom: none;
}

#brPlayerStatsList li .player-name, #bossPlayerStatsList li .player-name {
    font-weight: bold;
    margin-right: 10px;
    flex-basis: auto;
}

#brPlayerStatsList li .player-health, #bossPlayerStatsList li .player-health {
    font-size: 0.9em;
    color: #666;
    flex-basis: auto;
}

.player-bonuses {
    width: 100%; /* Take full width below health/name */
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    font-size: 0.7em; /* Smaller font for bonuses */
    justify-content: flex-end; /* Align bonuses to the right */
}

.player-bonuses span {
    padding: 2px 4px;
    background-color: rgba(0,0,0,0.05); /* Light background for bonuses */
    border-radius: 3px;
    white-space: nowrap; /* Prevent breaking bonus text */
    color: #555; /* Default color for bonuses */
}

.player-bonuses .stat-damage-dealt {
    font-weight: bold;
}

#killFeed {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 250px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.7em;
    max-height: 200px;
    overflow-y: hidden; /* Hide scrollbar but allow content to move */
    display: flex;
    flex-direction: column-reverse; /* New messages appear at bottom, stack upwards */
    gap: 5px;
}

body.dark-mode #killFeed {
    background-color: rgba(50, 50, 50, 0.8);
    color: #eee;
}

#killFeed .kill-message {
    padding-bottom: 5px;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.2);
    font-size: 1.1em;
}

#killFeed .kill-message:last-child {
    border-bottom: none;
}