body {
    background-color: #111;
    color: #eee;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    height: 100vh;
}

#game-container {
    position: relative; /* For positioning overlays */
    border: 2px solid #555;
}

canvas {
    display: block;
    background-color: #222;
}

#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-size: 1.5em;
    pointer-events: none;
}

#hud-left, #hud-right {
    flex: 1;
}

#hud-right {
    text-align: right;
}

#hud-center {
    flex: 0 1 auto; /* Don't grow, don't shrink, base on content */
    font-size: 1.2em;
    font-weight: bold;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#game-over-screen h1 {
    font-size: 4em;
    color: #e24a4a;
    margin: 0;
}

#game-over-screen p {
    font-size: 1.5em;
    margin-top: 20px;
}

/* --- XP Bar Styles --- */
#xp-bar-container {
    width: 150px;
    height: 15px;
    background-color: #555;
    border: 1px solid #888;
    border-radius: 5px;
    margin-top: 5px;
}

#xp-bar {
    width: 0%; /* Starts at 0 */
    height: 100%;
    background-color: #80bfff; /* Light blue for XP */
    border-radius: 4px;
    transition: width 0.3s ease-out;
}

/* --- Level Up Screen Styles --- */
#level-up-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 20;
}

#level-up-screen h2 {
    font-size: 3em;
    color: #f8e71c;
    margin-bottom: 10px;
}

#upgrade-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.upgrade-button {
    background-color: #334;
    color: white;
    border: 2px solid #778;
    padding: 15px 25px;
    font-size: 1.1em;
    font-family: 'Courier New', Courier, monospace;
    cursor: pointer;
    width: 400px;
    text-align: left;
    border-radius: 8px;
    transition: background-color 0.2s, border-color 0.2s;
}

.upgrade-button:hover {
    background-color: #445;
    border-color: #aef;
}

.upgrade-button .title {
    font-weight: bold;
    font-size: 1.2em;
}

.upgrade-button .description {
    font-size: 0.9em;
    color: #ccc;
    margin-top: 5px;
}

/* --- Character Select Screen Styles --- */
#character-select-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    color: white;
    display: flex; /* Starts visible */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 30;
}

#character-select-screen h1 {
    font-size: 3em;
    color: #eee;
    margin-bottom: 40px;
}

#character-options {
    display: flex;
    gap: 30px;
}

.character-button {
    background-color: #223;
    color: white;
    border: 3px solid #556;
    padding: 20px;
    font-size: 1.1em;
    font-family: 'Courier New', Courier, monospace;
    cursor: pointer;
    width: 300px;
    height: 180px;
    text-align: left;
    border-radius: 8px;
    transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}

.character-button:hover {
    background-color: #334;
    border-color: #f8e71c;
    transform: translateY(-5px);
}

.character-button .title {
    font-weight: bold;
    font-size: 1.5em;
    color: #f8e71c;
}

.character-button .description {
    font-size: 0.95em;
    color: #ccc;
    margin-top: 15px;
}

/* --- Chest Open Screen Styles --- */
#chest-open-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 20;
}

#chest-open-screen h2 {
    font-size: 3em;
    color: #ffd54f; /* Gold color */
    margin-bottom: 20px;
}

#weapon-choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}
