:root {
    --bar-health: #e74c3c;
    --bar-hunger: #e67e22;
    --bar-thirst: #3498db;
    --bar-temp: #9b59b6;
    --ui-bg: rgba(0, 0, 0, 0.7);
    --slot-bg: rgba(255, 255, 255, 0.2);
    --slot-active: rgba(255, 255, 255, 0.6);
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #2c3e50;
    font-family: 'Courier New', Courier, monospace;
    color: white;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87CEEB, #E0F7FA); /* Simple skybox */
}

#vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(0,0,0,0) 50%, rgba(0,0,0,0.4) 100%);
    z-index: 10;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas mostly */
    z-index: 20;
}

/* Enable pointer events for UI elements */
.menu-screen, #hotbar, #mobile-controls button {
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* Menus */
.menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

button {
    padding: 15px 30px;
    margin: 10px;
    font-size: 1.2rem;
    background: #555;
    color: white;
    border: 2px solid #888;
    cursor: pointer;
    font-family: inherit;
}

button:hover {
    background: #777;
}

/* HUD */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

#status-bars {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 220px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.bar-container {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.5);
    padding: 3px;
    border-radius: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.icon {
    width: 30px;
    text-align: center;
    margin-left: 8px;
    font-size: 18px;
    text-shadow: 0 2px 2px rgba(0,0,0,0.5);
}

.bar {
    height: 12px;
    width: 100%;
    background-color: #ccc;
    transform-origin: left;
    transition: transform 0.2s;
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 2px rgba(0,0,0,0.3);
}

.bar.health { background: linear-gradient(to right, #c0392b, #e74c3c); }
.bar.hunger { background: linear-gradient(to right, #d35400, #e67e22); }
.bar.thirst { background: linear-gradient(to right, #2980b9, #3498db); }
.bar.temp { background: linear-gradient(to right, #8e44ad, #9b59b6); }

#hotbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
}

.slot {
    width: 54px;
    height: 54px;
    border: 2px solid rgba(255,255,255,0.1);
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    position: relative;
    border-radius: 8px;
    transition: all 0.2s;
}

.slot.active {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.slot-key {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 10px;
    color: #aaa;
}

.item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 0 #000;
}

.item-icon {
    width: 30px;
    height: 30px;
    background-size: cover;
}

/* Simple colored blocks for icons */
.item-icon.tree { background-color: #2E7D32; }
.item-icon.rock { background-color: #9E9E9E; }
.item-icon.dirt { background-color: #795548; }
.item-icon.water { background-color: #2196F3; }
.item-icon.sand { background-color: #F4A460; }
.item-icon.cactus { background-color: #006400; }
.item-icon.snow { background-color: #FFFAFA; }
.item-icon.ice { background-color: #ADD8E6; }
.item-icon.log { background-color: #5D4037; }
.item-icon.plank { background-color: #8D6E63; }
.item-icon.brick { background-color: #616161; border: 1px dashed #aaa; }
.item-icon.glass { background-color: #81D4FA; opacity: 0.8; }
.item-icon.iron_ore { background-color: #A1887F; }
.item-icon.gold_ore { background-color: #FFD54F; }
.item-icon.cobblestone { background-color: #616161; background-image: linear-gradient(45deg, #555 25%, transparent 25%, transparent 75%, #555 75%, #555), linear-gradient(45deg, #555 25%, transparent 25%, transparent 75%, #555 75%, #555); background-size: 10px 10px; background-position: 0 0, 5px 5px; }
.item-icon.gravel { background-color: #9E9E9E; background-image: radial-gradient(#757575 15%, transparent 16%), radial-gradient(#757575 15%, transparent 16%); background-size: 8px 8px; background-position: 0 0, 4px 4px; }
.item-icon.leaves { background-color: #2E7D32; background-image: radial-gradient(#1B5E20 20%, transparent 20%); background-size: 6px 6px; }
.item-icon.stone_brick { background-color: #757575; border: 2px solid #555; }

.slot-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 12px;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 20px;
    width: 100%;
    height: 150px;
    pointer-events: none;
}

#joystick-zone {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    pointer-events: auto;
}

#action-buttons {
    position: absolute;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

#action-buttons button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0;
    margin: 0;
    font-size: 14px;
    opacity: 0.7;
}

@media (min-width: 768px) {
    #mobile-controls {
        display: none;
    }
}
