
* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #0a0a0a; font-family: 'Courier New', monospace; }
canvas { 
    display: block; 
    /* The Retro Secret Sauce */
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    
    /* Force full screen stretch */
    width: 100vw;
    height: 100vh;
}

#ui { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }

/* Compass styles removed - now in HUDSystem */

/* Wider to fit names */
}

/* Existing UI... */
/* Debug styles removed - now in HUDSystem */
/* Health UI styles removed - now in HUDSystem */

.reserve-bar 

/* Controls styles removed - now in HUDSystem */
#controls span { color: #666; }
/* Run stats styles removed - now in HUDSystem */
#run-stats .stat-value { color: #fff; font-size: 18px; }
#run-stats .stat-label { color: #666; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
#run-stats .essence-label { color: #aa8822; }
#run-stats .essence-value { color: #ffcc44; text-shadow: 0 0 10px #cc8800; }
#game-over { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; display: none; pointer-events: auto; }
#game-over.visible { display: block; }
#game-over h1 { color: #ff4444; font-size: 48px; margin-bottom: 20px; text-shadow: 0 0 20px #ff0000; }
#game-over .final-stats { color: #888; font-size: 14px; margin-bottom: 30px; }
#game-over .final-stats span { color: #fff; font-size: 24px; display: block; margin: 10px 0; }
#restart-btn { background: #44aaff; border: none; color: #000; padding: 15px 40px; font-size: 18px; font-family: 'Courier New', monospace; cursor: pointer; text-transform: uppercase; letter-spacing: 2px; transition: all 0.2s; }
#restart-btn:hover { background: #66ccff; transform: scale(1.05); }
#outpost-btn { display: block; margin: 15px auto 0; padding: 12px 30px; background: linear-gradient(135deg, #446688, #223355); color: white; border: 1px solid #5588aa; border-radius: 6px; font-size: 14px; font-family: 'Courier New', monospace; cursor: pointer; transition: all 0.2s; }
#outpost-btn:hover { background: linear-gradient(135deg, #557799, #334466); transform: scale(1.05); }
#outpost { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%); display: flex; flex-direction: column; align-items: center; padding: 20px 40px 30px 40px; box-sizing: border-box; overflow-y: auto; z-index: 200; pointer-events: auto; }
#outpost.hidden { display: none; }
#outpost h1 { font-size: 36px; color: #88ccff; text-shadow: 0 0 20px #4488cc; margin-bottom: 5px; }
#outpost .subtitle { color: #667; font-size: 13px; margin-bottom: 15px; }
#outpost .stats-bar { display: flex; gap: 40px; margin-bottom: 12px; font-size: 14px; }
#outpost .stat { color: #777; }
#outpost .stat-value { color: #aaa; }
#outpost .essence-display { font-size: 26px; color: #ffcc44; text-shadow: 0 0 15px #cc8800; margin-bottom: 15px; }
#outpost .section-title { font-size: 18px; color: #88aacc; margin: 10px 0 10px 0; border-bottom: 1px solid #334; padding-bottom: 6px; width: 100%; max-width: 750px; }
#outpost .upgrades-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; width: 100%; max-width: 750px; margin-bottom: 15px; }
.upgrade-card { background: rgba(255,255,255,0.05); border: 1px solid #334; border-radius: 8px; padding: 12px; cursor: pointer; transition: all 0.2s; }
.upgrade-card:hover:not(.owned):not(.locked) { background: rgba(255,255,255,0.1); border-color: #88ccff; }
.upgrade-card.owned { background: rgba(100, 200, 100, 0.12); border-color: #4a4; cursor: default; }
.upgrade-card.locked { opacity: 0.4; cursor: not-allowed; }
.upgrade-card .name { font-size: 15px; color: #fff; margin-bottom: 4px; }
.upgrade-card .desc { font-size: 12px; color: #999; margin-bottom: 6px; }
.upgrade-card .cost { font-size: 13px; color: #ffcc44; }
.upgrade-card.owned .cost { color: #4a4; }
.upgrade-card .affinity-tag { font-size: 10px; padding: 2px 5px; border-radius: 3px; margin-left: 5px; vertical-align: middle; }
.upgrade-card .affinity-tag.magic { background: #442266; color: #bb88ff; }
.upgrade-card .affinity-tag.tech { background: #224466; color: #88ccff; }
#outpost .affinity-display { display: flex; gap: 60px; margin-bottom: 15px; }
.affinity-bar { text-align: center; }
.affinity-bar .label { font-size: 12px; color: #666; margin-bottom: 3px; }
.affinity-bar .value { font-size: 24px; font-weight: bold; }
.affinity-bar.magic .value { color: #bb88ff; }
.affinity-bar.tech .value { color: #88ccff; }
#outpost .enter-rift-btn { margin-top: 15px; padding: 15px 45px; font-size: 20px; background: linear-gradient(135deg, #4466aa, #224488); color: white; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s; text-shadow: 0 2px 4px rgba(0,0,0,0.3); font-family: 'Courier New', monospace; letter-spacing: 1px; }
#outpost .enter-rift-btn:hover { background: linear-gradient(135deg, #5577bb, #335599); transform: scale(1.05); }
#outpost .reset-btn { margin-top: 20px; padding: 6px 15px; font-size: 11px; background: transparent; color: #553333; border: 1px solid #332222; border-radius: 4px; cursor: pointer; }
#outpost .reset-btn:hover { background: #221111; color: #aa5555; }
#game-over .essence-earned { color: #ffcc44; font-size: 20px; margin: 15px 0; }

/* DIALOGUE SYSTEM */
#dialogue-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); /* Dim the world slightly */
    pointer-events: auto; /* Catch clicks */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 50px;
    z-index: 500;
}

#dialogue-overlay.hidden { display: none; }

#dialogue-box {
    width: 800px;
    max-width: 90%;
    background: rgba(16, 20, 30, 0.95);
    border: 2px solid #446688;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    position: relative;
}

#npc-name {
    color: #88ccff;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid #334455;
    padding-bottom: 5px;
}

#npc-text {
    color: #ddd;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 20px;
    min-height: 60px;
}

#player-essence {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #ffcc44;
    font-size: 20px;
    font-weight: bold;
}

#dialogue-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dialogue-btn {
    background: linear-gradient(180deg, #334455 0%, #223344 100%);
    border: 1px solid #557799;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 220px; /* Made slightly wider */
    text-align: left;
    
    /* Flex layout for Title/Price/Desc */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dialogue-btn:hover {
    background: #446688;
    transform: translateY(-2px);
    border-color: #88aacc;
}

.dialogue-btn .header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-weight: bold;
    color: #fff;
}

.dialogue-btn .cost {
    color: #ffcc44;
}

.dialogue-btn .desc {
    font-size: 11px;
    color: #8899aa;
    font-style: italic;
    line-height: 1.2;
}

.dialogue-btn.disabled .desc {
    color: #555;
}