body {
    background-color: #222;
    color: #ddd;
    font-family: monospace;
    margin: 0;
    padding: 0;
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    background-color: #333;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
    flex-shrink: 0;
}

.game-header h1 {
    margin: 3px 0;
    font-size: 1.5em;
}

.game-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

#additional-stats {
    margin-left: 10px;
    display: block;
    padding-top: 5px;
    color: #aaa;
}

.game-controls {
    margin-top: 3px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
    flex-shrink: 0;
    padding: 3px 0;
}

.game-controls p {
    margin: 3px 0;
}

#game-messages {
    background-color: #111;
    border: 1px solid #555;
    padding: 8px;
    margin-bottom: 8px;
    height: 60px;
    overflow-y: auto;
    color: #adff2f;
    flex-shrink: 0;
}

.game-main {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    flex: 1;
    overflow: hidden;
}

#game-map {
    background-color: #111;
    border: 1px solid #555;
    padding: 5px;
    font-size: 14px;
    line-height: 1;
    white-space: pre;
    font-family: monospace;
    height: calc(100vh - 170px); /* Adjust to fill available vertical space */
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content vertically */
}

.map-row {
    display: flex;
}

.map-cell {
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#inventory-panel, #character-panel, #shop-panel, #spellbook-panel, #help-panel {
    background-color: #222;
    border: 1px solid #555;
    padding: 10px;
    width: 250px;
    height: calc(100vh - 170px); /* Match game map height */
    overflow-y: auto;
    color: #ddd;
}

#inventory-panel.hidden, #character-panel.hidden, #shop-panel.hidden, #spellbook-panel.hidden, #help-panel.hidden {
    display: none;
}

#inventory-list, #shop-list, #spell-list {
    margin-bottom: 15px;
}

.inventory-item, .shop-item, .spell-item {
    padding: 5px;
    border-bottom: 1px solid #444;
    cursor: pointer;
}

.inventory-item.selected, .shop-item.selected, .spell-item.selected {
    background-color: #444;
    font-weight: bold;
}

#spell-details {
    padding: 10px;
    margin-top: 10px;
    background-color: #333;
    border-radius: 5px;
}

#player-gold {
    padding: 10px 5px;
    margin-top: 10px;
    background-color: #333;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    color: #fd0;
}

.inventory-instructions, .character-instructions, .shop-instructions, .spellbook-instructions, .help-instructions {
    margin-top: 20px;
    color: #888;
    font-size: 12px;
}

.inventory-instructions p, .character-instructions p, .shop-instructions p, .spellbook-instructions p, .help-instructions p {
    margin: 5px 0;
}

.help-content {
    padding: 0 5px;
}

.help-content h4 {
    color: #adff2f;
    margin-top: 15px;
    margin-bottom: 5px;
}

#character-stats, #character-equipment, #character-xp {
    margin-bottom: 15px;
    padding: 5px;
    border-bottom: 1px solid #444;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.stat-name {
    color: #aaa;
}

.stat-value {
    color: #fff;
    font-weight: bold;
}

.equipment-slot {
    margin-bottom: 5px;
}

.equipment-name {
    font-weight: bold;
}

.equipment-empty {
    color: #666;
    font-style: italic;
}

.xp-bar {
    height: 10px;
    width: 100%;
    background-color: #333;
    margin-top: 5px;
    border-radius: 5px;
    overflow: hidden;
}

.xp-progress {
    height: 100%;
    background-color: #38f;
    width: 0%;
}

.tile {
    width: 18px;
    height: 18px;
    text-align: center;
    padding: 0;
    margin: 0;
    font-size: 16px;
}

/* Set tile colors based on JSON data */
.wall { color: #888; }
.floor { color: #555; }
.player { color: #fff; font-weight: bold; }
.monster { color: #f00; }
.item { color: #ff0; }
.stairs { color: #0ff; }
.door { color: #a52; }
.water { color: #00f; }
.lava { color: #f80; }
.dark { color: transparent; background-color: #000; }
.dimmed { opacity: 0.5; }