body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px;
    background-color: #f0f0f0;
}

h1 {
    color: #333;
}

.container {
    display: flex;
    width: 90%;
    max-width: 1000px;
    gap: 20px;
    margin-top: 20px;
}

.inventory, .crafting-area {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.inventory {
    flex: 1;
    min-height: 400px;
    max-height: 600px; /* Limit height for scrolling */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); /* Responsive grid */
    gap: 10px;
    align-content: start; /* Prevent items from stretching */
}

.crafting-area {
    flex: 1;
    min-height: 400px;
    display: flex;
    flex-direction: column; /* Allow stacking dropped elements */
    align-items: center; /* Center elements */
    justify-content: center; /* Center message */
    border: 2px dashed #ccc;
    background-color: #fafafa;
    position: relative; /* Needed for positioning dropped elements */
}

.crafting-area p {
    color: #888;
    text-align: center;
}

.element {
    background-color: #e9e9e9;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px 5px;
    text-align: center;
    cursor: grab;
    user-select: none; /* Prevent text selection */
    transition: transform 0.1s ease-in-out;
    font-size: 0.9em;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 1; /* Ensure elements are above messages */
}

.element:active {
    cursor: grabbing;
}

.element .emoji {
    font-size: 1.5em;
}

/* Styles for elements dropped into crafting area */
.crafting-area .element {
    position: absolute; /* Position elements absolutely within crafting area */
    z-index: 1; /* Ensure elements are above messages */
    /* Default position, will be updated on drop */
}

.crafting-area .element:nth-child(2) {
    /* Style for the first dropped element (which is the second child due to the p tag) */
    /* Might need more complex positioning logic in JS */
}

.crafting-area .element:nth-child(3) {
    /* Style for the second dropped element */
}

/* Drag over effect */
.crafting-area.drag-over {
    border-color: #007bff;
    background-color: #e9f5ff;
}

/* Styling for messages/indicators in crafting area */
.crafting-area .message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    z-index: 0; /* Ensure messages are behind elements */
    text-align: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
}

/* Styling for the section to create new elements */
.create-element-area {
    margin-top: 30px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    align-items: center;
    gap: 10px;
    width: 90%;
    max-width: 1000px;
}

.create-element-area h2 {
    width: 100%; /* Take full width */
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #333;
}

.create-element-area input[type="text"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    flex-grow: 1; /* Allow inputs to take available space */
    min-width: 100px; /* Ensure minimum width */
}

.create-element-area button {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.create-element-area button:hover {
    background-color: #0056b3;
}

.create-element-area .message {
    width: 100%; /* Take full width */
    text-align: center;
    font-size: 0.9em;
    min-height: 1em; /* Reserve space for the message */
}

/* Styling for the game controls section */
.game-controls {
    margin-top: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center; /* Center button */
    width: 90%;
    max-width: 1000px;
}

.game-controls button {
     padding: 8px 15px;
    background-color: #dc3545; /* Red color for reset */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.game-controls button:hover {
     background-color: #c82333;
}