:root {
    --bg-color: #0d0d0d;
    --monitor-bg: #c8c8b8;
    --text-color: #1a4f1a;
    --header-bg: #000080;
    --header-text: #ffffff;
    --border-light: #dfdfd3;
    --border-dark: #6a6a62;
    --font-family: 'VT323', monospace;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-family);
    color: var(--text-color);
}

#crt-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh;
    box-sizing: border-box;
    position: relative;
}

#crt-container::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% { opacity: 0.4; }
  25% { opacity: 1; }
  50% { opacity: 0.5; }
  75% { opacity: 0.8; }
  100% { opacity: 0.4; }
}

#game-window {
    width: 100%;
    height: 100%;
    max-width: 1000px;
    max-height: 700px;
    background: var(--monitor-bg);
    border: 2px solid black;
    box-shadow: 
        inset -2px -2px 0px var(--border-dark), 
        inset 2px 2px 0px var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 3px;
    font-size: 18px;
    position: relative;
}

#window-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 3px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.window-buttons span {
    background: var(--monitor-bg);
    color: black;
    padding: 0 4px;
    margin-left: 2px;
    border: 1px solid black;
    box-shadow: inset -1px -1px 0px var(--border-dark), inset 1px 1px 0px var(--border-light);
}

#game-content {
    flex-grow: 1;
    padding: 10px;
    display: flex;
    gap: 10px;
}

.left-pane, .right-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.left-pane { flex: 2; }
.right-pane { flex: 3; }

.panel {
    border: 2px solid;
    border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark);
    padding: 5px;
}

.panel-header {
    background: var(--border-dark);
    color: var(--monitor-bg);
    padding: 2px 5px;
    margin: -5px -5px 5px -5px;
    text-align: center;
}

.resource-item, .upgrade-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    image-rendering: pixelated;
}

.upgrade-item {
    justify-content: space-between;
}

.upgrade-item span {
    flex-basis: 40%;
}
.upgrade-item small {
    flex-basis: 30%;
    text-align: right;
}

button {
    font-family: var(--font-family);
    background: var(--monitor-bg);
    border: 2px solid;
    border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
    padding: 5px 10px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-color);
}

button:active {
    border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark);
    background: #b8b8a8;
}

#log-panel {
    height: 120px;
    margin: 0 10px 10px 10px;
}

#log-content {
    height: 100%;
    overflow-y: auto;
    background: #b8b8a8;
    padding: 5px;
    box-shadow: inset 1px 1px 0px var(--border-dark), inset -1px -1px 0px var(--border-light);
}

#log-content div {
    margin-bottom: 2px;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 13, 13, 0.9);
    color: #ff0000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
}
#game-over-screen h1 {
    font-size: 4em;
    margin: 0;
    text-shadow: 2px 2px #550000;
}
#game-over-screen p {
    font-size: 1.5em;
    color: white;
}
#game-over-screen button {
    font-size: 1.5em;
    padding: 10px 20px;
    margin-top: 20px;
    color: black;
}
.hidden {
    display: none !important;
}

.low-resource {
    color: #b30000;
    font-weight: bold;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { color: var(--text-color); font-weight: normal; }
}

@media (max-width: 600px) {
    #game-content {
        flex-direction: column;
    }
    .left-pane, .right-pane {
        width: 100%;
    }
    #game-window {
        font-size: 16px;
    }
    .icon {
        width: 16px;
        height: 16px;
    }
}

