:root {
    --color-bg: #1A2E1A;
    --color-ui-bg: rgba(30, 41, 59, 0.9);
    --color-ui-border: #475569;
    --color-text: #F8FAFC;
    --color-highlight: #F59E0B;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: var(--color-bg);
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--color-text);
    user-select: none;
    touch-action: none;
}

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

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#resource-bar {
    pointer-events: auto;
    background: var(--color-ui-bg);
    border-bottom: 2px solid var(--color-ui-border);
    padding: 10px 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.resource {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.icon {
    font-size: 16px;
}

#building-menu {
    pointer-events: auto;
    background: var(--color-ui-bg);
    border-top: 2px solid var(--color-ui-border);
    padding: 10px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    justify-content: center;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.building-btn {
    background: #334155;
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 10px;
    min-width: 80px;
    color: white;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.building-btn:active {
    transform: scale(0.95);
}

.building-btn.selected {
    border-color: var(--color-highlight);
    background: #475569;
    box-shadow: 0 0 10px var(--color-highlight);
}

.building-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.building-cost {
    font-size: 10px;
    color: #94A3B8;
}

#controls {
    pointer-events: auto;
    position: absolute;
    top: 60px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ui-btn {
    background: #3B82F6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ui-btn:hover {
    background: #2563EB;
}

#prestige-btn {
    background: #8B5CF6;
}

.modal {
    pointer-events: auto;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1E293B;
    padding: 20px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #475569;
}

h2, h3 {
    margin-top: 0;
    color: var(--color-highlight);
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    pointer-events: none;
}

/* Animations */
@keyframes pop {
    0% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

.pop-animation {
    animation: pop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
