/* --- Global Reset and Viewport Setup --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent scrolling of the whole page */
    background-color: #000080; /* IBM Blue / Retro BG */
    font-family: 'Courier New', Courier, monospace;
    color: #00ff00; /* Neon Green / Retro Text */
}

/* --- Retro Font and Appearance --- */
@font-face {
    font-family: 'Pixelated';
    /* Since we cannot host custom files, we rely on monospace defaults, 
       but we aim for a high-contrast, blocky appearance */
    font-weight: normal;
    font-style: normal;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

#game-container {
    width: 95%;
    max-width: 1000px;
    height: 95%;
    max-height: 700px;
    display: grid;
    gap: 15px;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: 
        "status status"
        "resources upgrades"
        "log log";
}

/* --- Retro Window Styling --- */
.window {
    background-color: #000000;
    border: 3px solid #00ff00;
    padding: 8px;
    box-shadow: inset 0 0 0 1px #00ff00; /* Inner border glow */
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.window-title {
    background-color: #00ff00;
    color: #000000;
    padding: 2px 5px;
    font-weight: bold;
    margin: -8px -8px 8px -8px;
    text-align: center;
    border-bottom: 3px solid #00ff00;
}

/* --- Layout Areas --- */
#status-bar {
    grid-area: status;
    display: flex;
    justify-content: space-between;
    padding: 5px 15px;
}

#resource-display {
    grid-area: resources;
    display: flex;
    flex-direction: column;
}

#upgrade-area {
    grid-area: upgrades;
}

#log-area {
    grid-area: log;
    height: 120px;
    min-height: 120px;
}

/* --- Resource Grid Styling --- */
#resources-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    height: 100%;
}

.resource-panel {
    border: 1px solid #00ff00;
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.res-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.res-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #ffffff; /* Bright white for primary value */
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.res-rate {
    font-size: 0.9em;
    margin-top: 5px;
}

/* --- Upgrade Styling --- */
#upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 5px;
    overflow-y: auto;
    height: calc(100% - 15px);
}

.upgrade-button {
    background-color: #00ff00;
    color: #000000;
    border: 2px solid #00ff00;
    padding: 5px;
    cursor: pointer;
    font-weight: bold;
    text-align: left;
    transition: background-color 0.1s;
    font-family: inherit;
    font-size: 1em;
}

.upgrade-button:hover:not(:disabled) {
    background-color: #ffffff;
}

.upgrade-button:active:not(:disabled) {
    background-color: #008800;
    color: #ffffff;
}

.upgrade-button:disabled {
    background-color: #000000;
    color: #008800;
    border-color: #008800;
    cursor: not-allowed;
}

.cost-info {
    display: block;
    font-size: 0.8em;
    font-weight: normal;
    margin-top: 2px;
}

/* --- Log Styling --- */
#log-content {
    height: calc(100% - 10px);
    overflow-y: auto;
    padding-right: 5px;
}

#log-content p {
    margin: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Game Over Screen --- */
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
}

#game-over-screen h1 {
    color: #ff0000; /* Red alert */
    font-size: 3em;
    text-shadow: 0 0 10px #ff0000;
}

#game-over-screen p {
    font-size: 1.5em;
    margin-bottom: 20px;
}

#game-over-screen button {
    padding: 10px 20px;
    font-size: 1.2em;
    background-color: #ff0000;
    color: #000000;
    border: 3px solid #ff0000;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* Status coloring based on resource level */
.low-res {
    color: #ffaa00; /* Orange/Yellow warning */
}

.critical-res {
    color: #ff0000; /* Red danger */
}