* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a3a0f 0%, #2d5016 100%);
    color: #fff8dc;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

#status-bar {
    background: rgba(61, 40, 23, 0.95);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #c73e1d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
    gap: 10px;
}

#resources {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.resource {
    font-size: 16px;
    font-weight: bold;
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
}

#population {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.pop-stat, .goal {
    font-size: 14px;
    font-weight: bold;
}

.goal {
    color: #ffd700;
    animation: pulse 2s infinite;
}

.warning {
    color: #ff4444;
    font-weight: bold;
    animation: blink 1s infinite;
}

.warning.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#canvas {
    flex: 1;
    display: block;
    margin: 0 auto;
    background: #2d5016;
    border: 4px solid #3d2817;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    cursor: crosshair;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#building-menu {
    background: rgba(61, 40, 23, 0.95);
    padding: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    border-top: 3px solid #c73e1d;
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.building-card {
    background: linear-gradient(135deg, #4a3420 0%, #3d2817 100%);
    border: 3px solid #c73e1d;
    border-radius: 8px;
    padding: 10px;
    min-width: 100px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.building-card:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 12px rgba(199, 62, 29, 0.5);
    border-color: #ffd700;
}

.building-card.selected {
    border-color: #ffd700;
    background: linear-gradient(135deg, #5a4430 0%, #4d3827 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

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

.building-card.disabled:hover {
    transform: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.building-icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.building-name {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 3px;
}

.building-cost {
    color: #ffd700;
    font-size: 11px;
    margin-bottom: 3px;
}

.building-info {
    color: #aaa;
    font-size: 10px;
}

#controls {
    background: rgba(61, 40, 23, 0.8);
    padding: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    background: linear-gradient(135deg, #c73e1d 0%, #a02a10 100%);
    border: 2px solid #fff8dc;
    color: #fff8dc;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, #d94d2d 0%, #b03020 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #3d2817 0%, #2a1a0f 100%);
    border: 4px solid #c73e1d;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-content h1 {
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 36px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    animation: rainbow 3s linear infinite;
}

@keyframes rainbow {
    0% { color: #ffd700; }
    25% { color: #ff69b4; }
    50% { color: #00ff00; }
    75% { color: #00bfff; }
    100% { color: #ffd700; }
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content ul {
    text-align: left;
    margin: 20px 0;
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 10px;
}

.tip {
    color: #ffd700;
    font-style: italic;
    margin-top: 20px;
}

.victory-text {
    font-size: 18px;
    color: #fff;
    margin-bottom: 25px;
}

#final-stats {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

#final-stats p {
    font-size: 16px;
    margin: 8px 0;
}

.cta-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #2a1a0f;
    border: 3px solid #fff;
    padding: 12px 30px;
    font-size: 16px;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

.cta-btn:hover {
    background: linear-gradient(135deg, #ffe44d 0%, #ffbb33 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.7);
}

footer {
    background: rgba(61, 40, 23, 0.95);
    padding: 10px;
    text-align: center;
    font-size: 12px;
    color: #aaa;
    border-top: 2px solid #c73e1d;
}

footer a {
    color: #ffd700;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    #status-bar {
        padding: 8px 10px;
    }
    
    .resource, .pop-stat, .goal {
        font-size: 12px;
    }
    
    .building-card {
        min-width: 80px;
        padding: 8px;
    }
    
    .building-icon {
        font-size: 24px;
    }
    
    #controls {
        padding: 8px;
    }
    
    button {
        padding: 6px 12px;
        font-size: 11px;
    }
}