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

:root {
    --bg-deep: #0f0f1a;
    --bg-panel: rgba(25, 25, 45, 0.95);
    --accent-gold: #ffd700;
    --accent-teal: #00d4aa;
    --accent-coral: #ff6b6b;
    --accent-purple: #9d4edd;
    --text-cream: #f0f0e8;
    --text-dim: #8888aa;
    --border-glow: #4a4a6a;
}

body {
    background: var(--bg-deep);
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--text-cream);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-panel);
    border-bottom: 3px solid var(--border-glow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
}

#canvas {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: grab;
}

#canvas:active {
    cursor: grabbing;
}

#building-panel {
    position: fixed;
    right: 0;
    top: 56px;
    bottom: 0;
    width: 200px;
    background: var(--bg-panel);
    border-left: 3px solid var(--border-glow);
    padding: 12px;
    overflow-y: auto;
    z-index: 50;
    transition: transform 0.3s ease;
}

#building-panel.collapsed {
    transform: translateX(160px);
}

#minimap-container {
    position: fixed;
    left: 12px;
    bottom: 12px;
    width: 120px;
    height: 120px;
    background: var(--bg-panel);
    border: 3px solid var(--border-glow);
    border-radius: 4px;
    z-index: 50;
    overflow: hidden;
}

#minimap {
    width: 100%;
    height: 100%;
}

#ui-overlay {
    position: fixed;
    top: 70px;
    left: 12px;
    z-index: 40;
    pointer-events: none;
}

#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#modal-container.active {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    border: 4px solid var(--border-glow);
    border-radius: 8px;
    padding: 24px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    font-family: 'IBM Plex Sans', sans-serif;
}

.modal-content h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: var(--accent-gold);
    margin-bottom: 16px;
    text-align: center;
}

.btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 12px 20px;
    border: 3px solid var(--border-glow);
    background: var(--bg-panel);
    color: var(--text-cream);
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
}

.btn:hover {
    background: var(--accent-gold);
    color: var(--bg-deep);
    border-color: var(--accent-gold);
    transform: scale(1.05);
}

.btn-primary {
    background: var(--accent-teal);
    border-color: var(--accent-teal);
    color: var(--bg-deep);
}

.btn-primary:hover {
    background: var(--accent-gold);
}

.resource-display {
    display: flex;
    gap: 16px;
    align-items: center;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.resource-icon {
    font-size: 14px;
}

.building-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.building-btn {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(40, 40, 60, 0.8);
    border: 2px solid var(--border-glow);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 6px;
}

.building-btn:hover:not(.locked) {
    border-color: var(--accent-teal);
    background: rgba(0, 212, 170, 0.2);
    transform: scale(1.05);
}

.building-btn.selected {
    border-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.building-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.building-btn .emoji {
    font-size: 24px;
}

.building-btn .cost {
    font-size: 9px;
    color: var(--text-dim);
    font-family: 'Press Start 2P', cursive;
}

.size-option {
    padding: 16px;
    margin: 8px 0;
    background: rgba(40, 40, 60, 0.8);
    border: 3px solid var(--border-glow);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.size-option:hover {
    border-color: var(--accent-teal);
    transform: translateX(4px);
}

.size-option h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: var(--accent-gold);
}

.size-option p {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 6px;
}

.turn-summary {
    text-align: center;
    padding: 20px;
}

.turn-summary .gains {
    font-size: 18px;
    margin: 12px 0;
    color: var(--accent-teal);
}

.turn-summary .events {
    font-size: 13px;
    color: var(--text-cream);
    margin: 8px 0;
}

footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-dim);
    padding: 6px 12px;
    background: var(--bg-panel);
    border-radius: 8px 8px 0 0;
    z-index: 60;
}

footer a {
    color: var(--accent-teal);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent-gold);
}

.tooltip {
    position: absolute;
    background: var(--bg-panel);
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    max-width: 200px;
    z-index: 300;
    pointer-events: none;
}

.tooltip h4 {
    font-family: 'Press Start 2P', cursive;
    font-size: 9px;
    color: var(--accent-gold);
    margin-bottom: 4px;
}

.tech-tree {
    display: grid;
    gap: 12px;
}

.tech-tier {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    background: rgba(30, 30, 50, 0.6);
    border-radius: 6px;
}

.tech-tier-label {
    width: 100%;
    font-family: 'Press Start 2P', cursive;
    font-size: 9px;
    color: var(--accent-purple);
    margin-bottom: 8px;
}

.tech-node {
    padding: 8px 12px;
    background: rgba(40, 40, 60, 0.9);
    border: 2px solid var(--border-glow);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    min-width: 80px;
}

.tech-node:hover:not(.locked):not(.researched) {
    border-color: var(--accent-teal);
}

.tech-node.researched {
    border-color: var(--accent-teal);
    background: rgba(0, 212, 170, 0.2);
}

.tech-node.current {
    border-color: var(--accent-gold);
    animation: pulse 1.5s infinite;
}

.tech-node.locked {
    opacity: 0.4;
}

.tech-node .name {
    font-size: 10px;
    font-weight: 600;
}

.tech-node .icon {
    font-size: 20px;
    margin-bottom: 4px;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 16px rgba(255, 215, 0, 0.8); }
}

@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-30px); opacity: 0; }
}

.float-text {
    position: absolute;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: var(--accent-teal);
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
}

@media (max-width: 768px) {
    #building-panel {
        width: 100%;
        height: 180px;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        border-left: none;
        border-top: 3px solid var(--border-glow);
    }
    
    #building-panel.collapsed {
        transform: translateY(140px);
    }
    
    .building-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    #minimap-container {
        width: 80px;
        height: 80px;
        left: 8px;
        bottom: 190px;
    }
    
    .resource-display {
        gap: 8px;
    }
    
    .resource-item {
        font-size: 8px;
    }
    
    #header-bar {
        font-size: 8px;
        padding: 0 8px;
    }
}