* {
    box-sizing: border-box;
    font-family: 'Minecraftia', sans-serif; /* A more thematic font */
}

@font-face {
    font-family: 'Minecraftia';
    src: url('https://misuse.org/tmp/minecraftia.ttf') format('truetype');
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #333;
    color: white;
}

/* The canvas where the game is rendered */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    cursor: crosshair;
}

/* --- UI Overlay --- */
.ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicks to pass through to the canvas */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
}

.hotbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    pointer-events: auto; /* Hotbar is interactive */
}

.hotbar .slot {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 3px solid #555;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.hotbar .slot.active {
    border-color: #FFF;
    transform: scale(1.1);
    transition: transform 0.1s ease-in-out, border-color 0.1s ease-in-out;
}

/* --- HUD Stats (Health, Hunger, etc.) --- */
.hud-container {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: space-between;
    width: 536px; /* Matches the calculated width of the hotbar */
    pointer-events: none;
}

.stat-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
}

.stat-bar.hunger {
    flex-direction: row-reverse;
}

.stat-bar .icon {
    width: 18px;
    height: 18px;
    background-size: contain;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.health .icon {
    background-image: linear-gradient(to top right, #c00 45%, #f33 50%, #c00 55%);
}

.hunger .icon {
    background-image: linear-gradient(to top right, #8B4513 45%, #D2691E 50%, #8B4513 55%);
}

/* --- Debug Overlay --- */
.debug-overlay {
    position: fixed;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #FFF;
    text-shadow: none;
    pointer-events: none;
    white-space: pre;
}

/* --- Full Screen Menus (Inventory, Pause) --- */
.menu-overlay, .inventory-screen {
    display: flex; /* Use 'flex' to show, 'none' to hide (managed by .hidden class) */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Menus are interactive */
    flex-direction: column;
}

.menu-overlay h2, .inventory-screen h2 {
    text-align: center;
    font-size: 2em;
    margin-bottom: 20px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(9, 54px);
    grid-gap: 4px;
    background-color: rgba(20, 20, 20, 0.8);
    padding: 10px;
    border: 3px solid #555;
}

.inventory-slot {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #333;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.pause-menu-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 250px;
}

.pause-menu-content button {
    padding: 10px;
    font-size: 16px;
    background-color: #707070;
    border: 2px solid;
    border-color: #c6c6c6 #5a5a5a #5a5a5a #c6c6c6;
    color: white;
    cursor: pointer;
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
    box-shadow: inset 0 0 0 2px #2d2d2d;
}

.pause-menu-content button:hover {
    background-color: #828282;
    border-color: #d8d8d8 #6c6c6c #6c6c6c #d8d8d8;
}

.pause-menu-content button:active {
    border-color: #5a5a5a #c6c6c6 #c6c6c6 #5a5a5a;
    box-shadow: inset 0 0 0 2px #000;
}


/* Utility class to hide elements */
.hidden {
    display: none !important;
}