:root {
    --bg-color: #0d0d0d; 
    --parchment: #d9ceb2; 
    --accent: #630000;
    --text-dark: #1a1a1a; 
    --gold: #c5a059; 
    --patience-color: #3a6ea5;
    /* Strategy Colors */
    --strat-support: #4a90e2;
    --strat-confront: #e04a4a;
    --strat-probe: #f5a623;
    --strat-deflect: #9b9b9b;
}

body { 
    margin: 0; background: var(--bg-color); color: var(--parchment); 
    font-family: 'Georgia', serif; display: flex; justify-content: center; 
    align-items: center; height: 100vh; overflow: hidden;
}

#ambient-particles {
    position: absolute; top: 0; left: 0; width: 200%; height: 200%; 
    pointer-events: none; z-index: 0; opacity: 0.15;
    background-image: radial-gradient(#d9ceb2 1px, transparent 1px);
    background-size: 40px 40px;
    animation: drift 60s linear infinite;
}
@keyframes drift { 0% { transform: translate(0, 0); } 100% { transform: translate(-10%, -10%); } }

#game-container { 
    width: 900px; height: 600px; border: 1px solid #333; 
    position: relative; overflow: hidden; background: #111; 
    display: flex; flex-direction: column; z-index: 10;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.screen { display: none; width: 100%; height: 100%; flex-direction: column; }

#title-screen { justify-content: center; align-items: center; text-align: center; background-color: #050508; cursor: pointer; }
.title-logo { width: 180px; height: 180px; border-radius: 50%; box-shadow: 0 0 30px rgba(197, 160, 87, 0.2); margin-bottom: 10px; animation: pulse 4s infinite alternate; }
@keyframes pulse { from { box-shadow: 0 0 20px rgba(197, 160, 87, 0.1); transform: scale(1); } to { box-shadow: 0 0 40px rgba(197, 160, 87, 0.4); transform: scale(1.02); } }
.blink-text { animation: blinker 3s linear infinite; letter-spacing: 2px; }
@keyframes blinker { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

#map-screen { background: url('assets/world_map.png'); background-size: cover; background-position: center; position: relative; }

.map-node { position: absolute; background: rgba(10, 10, 15, 0.85); border: 1px solid var(--gold); border-radius: 6px; padding: 8px 16px; font-size: 0.9rem; transform: translate(-50%, -50%); box-shadow: 0 4px 10px rgba(0,0,0,0.5); color: var(--parchment); cursor: pointer; transition: 0.2s; }
.map-node:hover { background: var(--accent); border-color: #ff3333; box-shadow: 0 0 15px var(--accent); }

.completed-node { background: rgba(30, 30, 35, 0.85); border-color: #555; color: #888; box-shadow: none; }
.completed-node:hover { background: #222; border-color: #777; box-shadow: none; }

.gate-node { top: 40%; left: 18%; }
.market-node { top: 50%; left: 22%; }
.ash-node { top: 62%; left: 22%; }
.tower-node { top: 35%; left: 30%; }
.mira-node { top: 45%; left: 35%; }
.observer-node { top: 38%; left: 48%; border-color: #ff00ff; color: #ff99ff; animation: pulse 2s infinite alternate;}
.shrine-node { top: 55%; left: 48%; border-color: #33ff33; }

.corner-btn { position: absolute; right: 25px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); color: var(--parchment); cursor: pointer; background: rgba(10, 10, 15, 0.85); border: 1px solid var(--gold); padding: 8px 16px; border-radius: 6px; transition: 0.3s; }
.begin-anew-btn { bottom: 75px; border-color: #444; color: #666; }
.begin-anew-btn:hover { border-color: #aaa; color: #aaa; }

#hud { padding: 15px; display: flex; justify-content: space-between; align-items: center; background: #000; border-bottom: 1px solid var(--accent); }

/* NEW: Clean HUD Button Styling */
.hud-btn { background: transparent; border: 1px solid var(--parchment); color: var(--parchment); padding: 6px 12px; cursor: pointer; border-radius: 4px; font-family: inherit; transition: 0.2s ease; }
.hud-btn:hover { border-color: var(--gold); color: var(--gold); }

.patience-track { width: 200px; height: 10px; background: #222; border: 1px solid #444; margin-top: 5px; }
#patience-fill { height: 100%; width: 100%; transition: 0.3s ease; }

#stage { flex: 1; display: flex; padding: 30px; gap: 30px; align-items: center; }
#npc-portrait { width: 300px; height: 400px; background: #000; border: 1px solid #444; object-fit: cover; transition: filter 0.3s ease, border-color 0.3s ease; }
#dialogue-area { flex: 1; display: flex; flex-direction: column; gap: 15px; position: relative; }
#dialogue-box { background: var(--parchment); color: var(--text-dark); padding: 20px; min-height: 120px; font-size: 1.2rem; font-style: italic; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn { padding: 12px; background: #222; color: var(--parchment); border: 1px solid #555; cursor: pointer; text-align: left; font-family: inherit; transition: 0.2s; position: relative; }
.choice-btn:hover:not(:disabled) { background: #333; border-color: var(--gold); }

.strat-support { border-left: 4px solid var(--strat-support); }
.strat-confront { border-left: 4px solid var(--strat-confront); }
.strat-probe { border-left: 4px solid var(--strat-probe); }
.strat-deflect { border-left: 4px solid var(--strat-deflect); }

.dig-btn { background: var(--accent); font-weight: bold; border-color: #ff0000; color: white; border-left: 4px solid #ff0000;}
.locked-btn { background: #111; color: #777; border-style: dashed; cursor: not-allowed; border-left: none;}

.invoked-star { color: var(--gold); font-size: 0.75rem; font-style: italic; margin-left: 8px; opacity: 0.9; }

#intro-overlay {
    display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(10, 10, 15, 0.90); z-index: 150; flex-direction: column; 
    justify-content: center; align-items: center; padding: 20px; box-sizing: border-box;
    overflow-y: auto;
}

.intro-text-box {
    max-width: 650px; color: var(--parchment); font-size: 1.05rem; 
    line-height: 1.5; font-style: italic; text-align: center;
}
.intro-text-box p { margin-bottom: 12px; }

#star-toast {
    position: absolute; top: -55px; left: 50%; transform: translateX(-50%) translateY(10px);
    background: rgba(10, 10, 15, 0.95); border: 1px solid var(--gold); border-left: 4px solid var(--gold); 
    padding: 8px 16px; border-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.7); 
    display: flex; align-items: center; z-index: 300; pointer-events: none; opacity: 0; 
    transition: opacity 0.5s ease, transform 0.5s ease; width: fit-content;
}

#star-toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
#star-toast-text { margin-left: 10px; font-style: italic; font-size: 1.1rem; }

.dig-active #game-container { box-shadow: inset 0 0 150px rgba(99, 0, 0, 0.4); }
.dig-active #npc-portrait { filter: contrast(1.5) brightness(0.6); border-color: red; }

.observer-active #game-container { box-shadow: inset 0 0 150px rgba(120, 0, 255, 0.4); }
.observer-active #dialogue-box { background: #000; color: #ff99ff; border: 1px solid #ff00ff; font-family: monospace;}
.observer-active #npc-portrait { filter: invert(1) hue-rotate(180deg); border-color: #ff00ff; }

/* Constellation Grouping Styles */
#constellation-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 10, 15, 0.95); z-index: 100; display: none; flex-direction: column; justify-content: center; align-items: center; padding: 40px; box-sizing: border-box; overflow-y: auto;}
.constellation-category { color: var(--gold); font-size: 0.9rem; font-weight: bold; letter-spacing: 2px; border-bottom: 1px solid rgba(197, 160, 87, 0.3); margin-top: 20px; padding-bottom: 5px; margin-bottom: 10px; text-transform: uppercase; }
.constellation-entry { font-size: 1.1rem; color: var(--parchment); margin-bottom: 8px; line-height: 1.4; display: flex; align-items: baseline; }
.constellation-source { font-size: 0.8rem; color: #888; font-style: italic; margin-right: 10px; min-width: 90px; display: inline-block; text-align: right; }

/* History Overlay */
#history-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 10, 15, 0.98); z-index: 200; display: none; flex-direction: column; padding: 40px; box-sizing: border-box; overflow-y: auto; }
#history-list { flex: 1; overflow-y: auto; padding-right: 15px; display: flex; flex-direction: column; gap: 15px; }
.history-entry { font-size: 1.1rem; line-height: 1.5; padding: 10px; border-bottom: 1px solid rgba(197, 160, 87, 0.2); }
.history-entry.npc-line { color: var(--parchment); font-style: italic; }
.history-entry.player-line { color: var(--gold); text-align: right; }
.history-speaker { font-weight: bold; font-size: 0.9rem; text-transform: uppercase; margin-bottom: 4px; opacity: 0.7; }