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

body {
    background: #0a0a1a;
    overflow: hidden;
    font-family: 'VT323', monospace;
    color: #e8d5b0;
}

#canvas {
    display: block;
    cursor: crosshair;
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

#top-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 15px;
    background: linear-gradient(to bottom, rgba(20, 15, 10, 0.95), rgba(20, 15, 10, 0.7));
    border-bottom: 3px solid #8b7355;
    pointer-events: auto;
    font-size: 24px;
    text-shadow: 2px 2px 0 #000;
}

#top-bar > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

#year {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    color: #ffd700;
}

.icon {
    font-size: 20px;
}

#gold-amount {
    color: #ffd700;
}

#liberty-percent {
    color: #90ee90;
}

#message-box {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 15, 10, 0.95);
    border: 2px solid #8b7355;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
}

#message-box.show {
    opacity: 1;
}

#action-panel {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    pointer-events: auto;
    padding: 10px;
}

.action-btn {
    background: linear-gradient(to bottom, #5d4e37, #3d3225);
    border: 2px solid #8b7355;
    color: #e8d5b0;
    padding: 12px 20px;
    font-family: 'VT323', monospace;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.action-btn:hover {
    background: linear-gradient(to bottom, #7d6e57, #5d5245);
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(0);
}

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

.independence-btn:not(:disabled) {
    background: linear-gradient(to bottom, #4a5d37, #2d4025);
    border-color: #6b8b55;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 5px #6b8b55; }
    50% { box-shadow: 0 0 20px #6b8b55; }
}

.sub-menu {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 25, 20, 0.98);
    border: 3px solid #8b7355;
    padding: 20px;
    border-radius: 8px;
    pointer-events: auto;
    min-width: 280px;
}

.sub-menu h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    color: #ffd700;
}

.sub-menu.hidden {
    display: none;
}

.build-option, .sell-btn, .recruit-btn, .close-menu {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 10px;
    background: #3d3225;
    border: 2px solid #5d4e37;
    color: #e8d5b0;
    font-family: 'VT323', monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.build-option:hover, .sell-btn:hover, .recruit-btn:hover {
    background: #5d4e37;
}

.close-menu {
    background: #4a2020;
    border-color: #6a3030;
    margin-top: 15px;
}

.close-menu:hover {
    background: #6a3030;
}

.trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

.trade-row .sell-btn {
    width: auto;
    margin: 0;
    padding: 6px 12px;
}

#victory-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a3d1a, #0d2d0d);
    border: 4px solid #4a8b4a;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    pointer-events: auto;
    z-index: 100;
}

#victory-screen.hidden {
    display: none;
}

#victory-screen h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    color: #ffd700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

#victory-screen p {
    font-size: 20px;
    margin: 10px 0;
}

#play-again {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 18px;
    background: linear-gradient(to bottom, #4a8b4a, #2d5d2d);
    border: 2px solid #6bab6b;
    color: #fff;
    cursor: pointer;
    font-family: 'VT323', monospace;
}

#instructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 15, 10, 0.98);
    border: 4px solid #8b7355;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    pointer-events: auto;
    z-index: 100;
    max-width: 90%;
    width: 400px;
}

#instructions.hidden {
    display: none;
}

#instructions h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: #ffd700;
    margin-bottom: 20px;
}

#instructions p {
    font-size: 18px;
    margin: 12px 0;
    text-align: left;
}

#start-game {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 18px;
    background: linear-gradient(to bottom, #5d4e37, #3d3225);
    border: 2px solid #8b7355;
    color: #e8d5b0;
    cursor: pointer;
    font-family: 'VT323', monospace;
}

#start-game:hover {
    background: linear-gradient(to bottom, #7d6e57, #5d5245);
}

#footer {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    opacity: 0.6;
}

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

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

@media (max-width: 600px) {
    #top-bar {
        gap: 15px;
        padding: 10px;
        font-size: 18px;
    }
    
    #year {
        font-size: 14px;
    }
    
    .action-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    #action-panel {
        bottom: 50px;
    }
    
    .sub-menu {
        bottom: 120px;
        min-width: auto;
        width: 90%;
        max-width: 320px;
    }
    
    #instructions, #victory-screen {
        padding: 20px;
    }
    
    #instructions h2, #victory-screen h1 {
        font-size: 12px;
    }
}