body { font-family: sans-serif; display: flex; height: 100vh; margin: 0; }
#sidebar { width: 200px; min-width: 280px; border-right: 1px solid #ccc; padding: 10px 10px 10px; overflow: auto; resize: horizontal; max-width: calc(100vw - 50vmin - 100px); }
#crafting-area { flex-grow: 1; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
#elements-list { display: flex; flex-wrap: wrap; justify-content: space-between; }
#elements-list.searching { justify-content: flex-start; }
.element { padding: 5px 10px; margin: 4px; border: 1px solid #ddd; border-radius: 5px; cursor: pointer; text-align: center; width: fit-content; user-select: none; }
.element:hover { background-color: #f0f0f0; }
#combination { margin-bottom: 20px; font-size: 24px; }
#result { margin-top: 20px; font-size: 28px; font-weight: bold; color: #333; }
#stats { position: absolute; top: 10px; right: 10px; border: 1px solid #ccc; padding: 10px; background: #f9f9f9; }
#server-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    z-index: 100;
}
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.status-up { background-color: #28a745; }
.status-down { background-color: #dc3545; }
#mixer {
    width: 50vmin;
    height: 50vmin;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
#mixer-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.cloned-element {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: grab;
}
.cloned-element:active {
    cursor: grabbing;
}
.cloned-element.dragging {
    visibility: hidden;
    opacity: 0;
}
#combine-btn {
    position: absolute;
    bottom: 30px;
    padding: 8px 16px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.6);
    transition: box-shadow 0.3s ease-in-out;
    user-select: none;
}
#combine-btn:disabled {
    cursor: not-allowed;
    background-color: #eee;
    color: #aaa;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.6);
}
#combine-btn.loading {
    color: transparent;
}
#combine-btn.loading::after {
    content: 'Combining...';
    position: absolute;
    left: 0;
    right: 0;
    top: 8px; /* Should match padding */
    color: #333;
}
#settings-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

#settings-btn, #info-btn {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s;
    line-height: 1;
}

#settings-btn:hover, #info-btn:hover {
    transform: scale(1.1);
}

#settings-btn:hover {
    transform: rotate(90deg);
}

#settings-menu {
    position: absolute;
    bottom: 40px; /* Adjust based on button height */
    right: 0;
    width: 200px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#reset-progress-btn {
    border-radius: 4px;
}
#recipe-context-menu {
    display: none;
    position: absolute;
    z-index: 1000;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    font-size: 14px;
    max-width: 300px;
}
#recipe-context-menu h4 {
    margin-top: 0;
    margin-bottom: 10px;
}
#recipe-context-menu ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}
#recipe-context-menu li {
    padding: 2px 0;
}
#search-bar {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#sort-select, #sort-order-btn {
    border-radius: 5px;
    padding: 5px 10px !important; /* Override inline style for better spacing with round corners */
    border: 1px solid #ccc;
}

@keyframes breath {
    0% { box-shadow: 0 0 3px rgba(0, 123, 255, 0.3); }
    50% { box-shadow: 0 0 9px rgba(0, 123, 255, 0.7); }
    100% { box-shadow: 0 0 3px rgba(0, 123, 255, 0.3); }
}

.first-discovery {
    animation: breath 3s infinite ease-in-out;
    border-color: #007bff;
}

body.no-breath .first-discovery {
    animation: none;
    box-shadow: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1500;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Modal List Spacing */
.modal-content li {
    margin-bottom: 10px;
    line-height: 1.6;
}
