body {
    background-color: #000;
    color: #39ff14; /* A vibrant "matrix" green */
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

#game-container {
    text-align: center;
    border: 2px solid #39ff14;
    padding: 2rem;
    
    user-select: none;
}

h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 8px #39ff14;
}

#play-button {
    background-color: #39ff14;
    color: #000;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.5rem;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
}

#play-button:hover {
    background-color: #a0ff91;
    color: #000;
    box-shadow: 0 0 10px #fff;
}

#map-display {
    font-size: 18px;
    line-height: 1.1;
    text-align: left;
    background-color: #000;
    padding: 1em;
    border: 2px solid #555;
    font-family: 'Courier New', Courier, monospace;
}

.tile-wall { color: #666; }
.tile-floor { color: #7b6d53; }
.tile-stairs { color: #be82ff; font-weight: bold; }
.tile-corpse { color: #bf0000; font-weight: bold; }

.tile-fog {
    color: #000;
    background-color: #000;
}

.tile-wall.dim,
.tile-floor.dim,
.tile-stairs.dim,
.tile-corpse.dim {
    color: #444;
}

.tile-wall.dim { color: #333; }

#status-bar {
    margin-top: 1em;
    padding: 0.5em;
    border: 2px solid #555;
    background-color: #111;
    color: #fff;
    
    /* --- Flexbox Magic --- */
    display: flex; /* Turn on Flexbox */
    justify-content: space-between; /* Push the two stat groups to opposite ends */
    align-items: flex-start; /* Align them to the top */
}

/* Style for the containers holding groups of stats */
.stat-group {
    text-align: left;
}

/* Style for an individual stat line */
.stat {
    margin-bottom: 0.25em;
    white-space: nowrap; /* Prevents text from wrapping */
}

/* Make the stat numbers bold */
.stat span {
    font-weight: bold;
}

#log-container {
    margin-top: 1em;
    padding: 0.5em;
    border: 2px solid #555;
    background-color: #111;
    height: 100px;
    overflow-y: hidden;
}

#inventory-screen,
#equipment-screen { /* Grouped shared styles */
    padding: 1em;
    background-color: #050505;
    border: 2px solid #555;
    color: #fff;
    width: 48ch;
    box-sizing: border-box;
    text-align: left;
}

#inventory-screen h2,
#equipment-screen h2 {
    margin-top: 0;
    color: #ff0;
}

#inventory-screen ul,
#equipment-screen ul {
    list-style: none;
    padding: 0;
}

#inventory-screen li,
#equipment-screen li {
    padding: 0.25em 0;
}

#equipment-screen .slot {
    display: inline-block;
    width: 8ch;
    color: #aaa;
    text-transform: capitalize;
}

#equipment-screen .item-name {
    color: #fff;
    font-weight: bold;
}

#equipment-screen .empty-slot {
    color: #666;
    font-style: italic;
}

#character-sheet {
    padding: 1em;
    background-color: #050505;
    border: 2px solid #555;
    color: #fff;
    width: 48ch;
    box-sizing: border-box;
    text-align: left;
}

#character-sheet h2 {
    margin-top: 0;
    color: #ff0;
    text-align: center;
}

#character-sheet h3 {
    color: #39ff14; /* Matrix green for section headers */
    border-bottom: 1px solid #39ff14;
    padding-bottom: 0.25em;
}

#character-sheet .section {
    margin-top: 1.5em;
}

#character-sheet ul {
    list-style: none;
    padding: 0;
}

#character-sheet li {
    padding: 0.25em 0;
}

@keyframes pulse-red {
    0% {
        border-color: #39ff14; /* Start at normal green */
    }
    50% {
        border-color: #ff0000; /* Pulse to bright red */
        box-shadow: 0 0 20px #ff0000; /* Add a red glow */
    }
    100% {
        border-color: #39ff14; /* Return to normal green */
    }
}

.low-health-warning {
    animation-name: pulse-red;
    animation-duration: 1.5s; /* How long one pulse takes */
    animation-timing-function: ease-in-out; /* Makes the pulse smooth */
    animation-iteration-count: infinite; /* Loop the animation forever */
}

#level-up-screen {
    padding: 1.5em;
    background-color: #050505;
    border: 2px solid #39ff14; /* Use the main border color to show importance */
    color: #fff;
    width: 48ch;
    box-sizing: border-box;
    text-align: left;
}

#level-up-screen h2 {
    margin-top: 0;
    color: #ff0;
    text-align: center;
    text-shadow: 0 0 5px #ff0;
}

#level-up-screen p {
    text-align: center;
    color: #aaa;
}

#level-up-screen ul {
    list-style: none;
    padding: 0;
    margin-top: 2em;
}

#level-up-screen li {
    padding: 0.5em 0;
    font-size: 1.1em;
}

@keyframes hit-flash-animation {
    from {
        /* Temporarily force the character's color and glow to red */
        color: #ff0000;
        text-shadow: 0 0 10px rgba(255, 0, 0, 1);
    }
    to {
        /* When the animation ends, the color reverts to the inline style,
           and the text-shadow is removed. */
        text-shadow: none;
    }
}

.hit-flash {
    animation-name: hit-flash-animation;
    animation-duration: 0.2s;
    animation-timing-function: ease-out;
    animation-iteration-count: 1;
}