body, html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #1a1a1a;
    font-family: Arial, sans-serif;
    color: white;
    user-select: none;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none; 
}

#top-bar {
    background-color: rgba(0, 0, 0, 0.85);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between; 
    align-items: flex-start;
    border-bottom: 2px solid #444;
    pointer-events: auto; 
}

#resources-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.res-group {
    display: flex;
    gap: 20px;
}

.res-group.advanced {
    color: #ffd700; 
}

.resource {
    font-size: 14px;
    color: inherit;
}

.resource span {
    font-weight: bold;
    color: #fff;
    margin-left: 5px;
}

#context-menu {
    position: absolute;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid #666;
    padding: 5px;
    border-radius: 4px;
    pointer-events: auto; 
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

#context-menu.hidden {
    display: none;
}

#context-menu button {
    background: #333;
    color: white;
    border: 1px solid #555;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}

#context-menu button:hover {
    background: #555;
}

#tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 12px;
    border: 1px solid #888;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none; 
    transform: translate(15px, 15px); 
    z-index: 100;
}

#tooltip.hidden {
    display: none;
}

#bottom-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    padding: 10px;
    display: flex;
    gap: 10px;
    border: 2px solid #444;
    border-radius: 8px;
    pointer-events: auto;
}

.tool-btn {
    background: #222;
    color: #aaa;
    border: 2px solid #444;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #444;
    color: #fff;
}

.tool-btn.active {
    background: #2d5a27;
    border-color: #4CAF50;
    color: white;
}

.tool-btn.paused-active {
    background: #b71c1c;
    border-color: #f44336;
    color: white;
}

.tool-btn.demolish-active {
    background: #d32f2f;
    border-color: #f44336;
    color: white;
}

#recipe-modal, #help-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid #555;
    padding: 20px;
    border-radius: 8px;
    pointer-events: auto;
    z-index: 200;
    min-width: 300px;
}

#recipe-modal.hidden, #help-modal.hidden {
    display: none;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

#help-modal p {
    font-size: 14px;
    line-height: 1.6;
    margin: 8px 0;
}

#help-modal hr {
    border: 0;
    border-top: 1px solid #444;
    margin: 15px 0;
}

.recipe-btn {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 12px;
    background: #333;
    color: white;
    border: 1px solid #777;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    text-align: left;
}

.recipe-btn:hover {
    background: #555;
}

#btn-close-modal {
    width: 100%;
    margin-top: 15px;
}

.end-screen {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: auto;
}

.end-screen .modal-content {
    text-align: center;
    padding: 40px;
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 8px;
}

.end-screen.hidden {
    display: none;
}