body {
    margin: 0;
    overflow: hidden;
    background-color: #87CEEB;
}

canvas {
    display: block;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: white;
    text-shadow: 2px 2px 4px #000000;
}

#coords {
    position: absolute;
    top: 10px;
    left: 10px;
}

#fps {
    position: absolute;
    top: 10px;
    right: 10px;
}

.hidden {
    display: none !important;
}

.slot {
    width: 40px;
    height: 40px;
    background-color: #444;
    border: 2px solid #aaa;
    position: relative;
    cursor: pointer;
    margin: 2px;
    box-sizing: border-box;
    border-radius: 4px;
    user-select: none;
}

.slot:hover {
    border-color: white;
}

.slot-icon {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    object-fit: contain;
}

.count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

#hotbar-ui {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex; 
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #555;
    padding: 5px;
    border-radius: 4px;
    z-index: 5;
}

.hotbar-slot.selected {
    border-color: #FFD700;
    box-shadow: 0 0 10px #FFD700;
    transform: scale(1.1);
}

#inventory-ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.85);
    border: 4px solid #333;
    padding: 15px;
    z-index: 10;
    border-radius: 8px;
    
    display: grid;
    grid-template-areas:
        "crafting furnace"
        "main-inv main-inv"
        "hotbar-inv hotbar-inv";
    grid-gap: 20px;
    align-items: center;
}

#inventory-ui:not(.hidden) #hotbar-ui {
    position: static;      
    transform: none;       
    grid-area: hotbar-inv; 
    margin: 0 auto;        
}

#crafting-area {
    grid-area: crafting;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 6px;
}

#crafting-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
}

#crafting-result-slot {
    width: 48px;
    height: 48px;
    margin-left: 20px;
}

/* --- Style du Four --- */
#furnace-area {
    grid-area: furnace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 6px;
    color: white;
    font-family: Arial, sans-serif;
}

#furnace-title {
    margin-bottom: 5px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

#furnace-slots {
    display: flex;
    align-items: center;
    gap: 5px;
}

#furnace-arrow {
    font-size: 24px;
    color: #aaa;
    margin: 0 5px;
    user-select: none;
}

#main-inventory-slots {
    grid-area: main-inv;
    display: grid;
    grid-template-columns: repeat(9, 1fr); 
}

#held-item {
    position: fixed; 
    width: 40px;
    height: 40px;
    z-index: 1000;
    pointer-events: none; 
    transform: translate(-50%, -50%); 
}

#held-item .slot-icon {
    width: 100%;
    height: 100%;
}