body {
    font-family: "Metamorphous", serif;
    font-weight: 400;
    font-style: normal;
    text-align: center;
    background-color: #111;
    color: white;
    margin: 0;
    max-width: 1280px;
    margin: 0 auto;
}

.wall-container {
    position: absolute;
    width: 100%;
    height: 100%;
}
.enemy, .boss, #player-sprite {
    image-rendering: pixelated;
    object-fit: contain;
}

.wall-chunk {
    position: absolute;
    background-color: #888;
    border-radius: 5px;
}

h1 {
    margin: 10px 0;
}

#game {
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    width: 100%;
    margin: 20px auto;
    position: relative;
    background-color: #222;
    border: 5px solid #666;
    border-radius: 10px;
    overflow: hidden;
}
#game { width: 1290px !important; height: 730px !important; }

.wall, .ladder {
    position: absolute;
    background-color: #444;
}

.ladder {
    background-color: gold;
}

.wall.up, .ladder.up {
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
}

.wall.down, .ladder.down {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
}

.wall.left, .ladder.left {
    left: 0;
    top: 0;
    width: 10px;
    height: 100%;
}

.wall.right, .ladder.right {
    right: 0;
    top: 0;
    width: 10px;
    height: 100%;
}

/* ------------------------------------------------------------
   FIX: REMOVE transform-centering that breaks z-index system
------------------------------------------------------------ */

.enemy {
    position: absolute;
    width: 160px;
    height: 160px;
}

.enemy.boss {
    width: 200px;
    height: 200px;
}

/* REMOVE transform-centering */
.artifact,
.dungeonExit,
.health,
.shield,
.food,
.otherItem,
.weapon {
    position: absolute;
    width: 50px;
    height: 50px;
}

/* dungeonExit needs a larger size but should NOT be centered */
.dungeonExit {
    width: 200px;
    height: 200px;
}

/* ------------------------------------------------------------ */

#mini-map {
    display: grid;
    grid-template-columns: repeat(10, 32px);
    grid-template-rows: repeat(10, 18px);
    gap: 2px;
    margin: 10px auto;
    width: max-content;
}

.mini-room {
    width: 32px;
    height: 18px;
    background-color: #333;
    border: 1px solid #222;
    position: relative;
}

.mini-room.discovered {
    background-color: #555;
}

.mini-room.current {
    background-color: gold;
}

.mini-exit {
    position: absolute;
    background-color: black;
    width: 4px;
    height: 4px;
}

.mini-exit.up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.mini-exit.down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.mini-exit.left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.mini-exit.right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.current-room {
    border: 3px solid gold;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

#mini-map-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
}

#description-panel,
#inventory-panel {
    width: 300px;
    padding: 10px;
    background-color: #333;
    border: 2px solid #555;
    border-radius: 5px;
    margin-right: 20px;
    text-align: left;
}

#description-panel h2,
#inventory-panel h2 {
    margin: 0;
    font-size: 18px;
    color: gold;
}

#description-panel p,
#inventory-panel p {
    margin: 10px 0;
    font-size: 14px;
}

#status-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
}

#status-panel div {
    margin: 0 10px;
    font-size: 14px;
}

#status-panel h2 {
    margin: 0;
    font-size: 24px;
    color: gold;
}

#status-panel .health-bar-container,
#status-panel .health-bar,
#status-panel .health-fill {
    margin: 0;
}

.health-bar-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.health-bar {
    width: 200px;
    height: 20px;
    border: 1px solid white;
    background: red;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    position: relative;
}

.health-fill {
    background: green;
    height: 100%;
    margin: 0;
    padding: 0;
    display: block;
    position: absolute;
    left: 0;
    top: 0;
}

.discovered.bossRoom {
    background: #300 !important;
}

.discovered.oracleRoom {
    background: #003 !important;
}

.discovered.exitRoom {
    background: #030 !important;
}

@media (max-width: 1000px) {
    #mini-map-container {
        flex-direction: column;
        align-items: stretch;
    }

    #description-panel,
    #inventory-panel {
        margin: 10px auto;
        width: calc(100% - 40px);
    }

    #mini-map {
        margin: 10px auto;
    }
}

.sprite-wrapper {
    position: absolute;
    display: inline-block;
}
.sprite-wrapper img {
    display: block;
}


.weapon,
.food,
.health,
.shield,
.otherItem,
.dungeonExit,
.enemy,
#player-sprite {
    display: block;        /* Ensures outline wraps tightly */
    box-sizing: border-box;
}

.sprite-wrapper {
    position: absolute;
    display: inline-block;
}

.sprite-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
}

.depth-debug {
    position: absolute;
    left: 0;
    top: 100%;
    padding: 2px 4px;
    font-size: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    pointer-events: none;
    white-space: nowrap;
    z-index: 99999;
}
#game-popup-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    z-index: 999999;
}


#game-popup-overlay {
    position: absolute;
    display: none;
    background: rgba(0,0,0,0.45);
    pointer-events: auto;
    z-index: 999998;
    width:100%;
    height:100%;
    left:0;
    top:0;
}

.game-popup {
    width:260px;
    opacity: 0.5;
}

.game-popup button {
    margin-top:10px;
}
