:root {
    --primary: #ff79c6;
    --bg-night: rgba(40, 42, 54, 0.4);
    --ui-panel: rgba(255, 255, 255, 0.9);
}

body, html {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    background: #1a1a1a;
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
}

#game-viewport {
    position: relative;
    width: 100vw; height: 100vh;
    background: #7ed6df; /* Sky color */
    overflow: hidden;
    transition: background 5s ease;
}

/* Day/Night Overlay */
#game-viewport.night { background: #2c3e50; }
#game-viewport.night #world { filter: brightness(0.6) sepia(0.2) hue-rotate(200deg); }

#world {
    position: absolute;
    width: 3000px; height: 3000px;
    background-image: 
        radial-gradient(#95afc0 1px, transparent 1px),
        linear-gradient(#badc58 0%, #6ab04c 100%);
    background-size: 50px 50px, 100% 100%;
    transition: transform 0.1s ease-out;
}

/* Player & NPCs */
#player-container {
    position: absolute;
    width: 80px; height: 120px;
    z-index: 100;
}

#player-sprite {
    width: 100%; height: auto;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.3));
}

#player-name {
    position: absolute; top: -25px; left: 50%;
    transform: translateX(-50%);
    background: var(--primary); color: white;
    padding: 2px 8px; border-radius: 10px; font-size: 12px;
}

.npc {
    position: absolute; width: 80px; height: 120px;
}

.npc-img { width: 100%; border-radius: 50%; background: white; border: 3px solid var(--primary); }

.interact-prompt {
    position: absolute; top: -40px; left: 50%;
    transform: translateX(-50%);
    background: white; border: 2px solid black;
    padding: 4px; border-radius: 5px; display: none;
}

/* Buildings */
.building {
    position: absolute; padding: 40px;
    background: #ecf0f1; border: 4px solid #7f8c8d;
    border-radius: 15px; font-weight: bold; text-align: center;
}

/* UI Components */
#hud {
    position: fixed; top: 20px; left: 20px;
    display: flex; gap: 20px; align-items: center;
    z-index: 1000;
}

.stat-box { width: 150px; background: var(--ui-panel); padding: 10px; border-radius: 8px; }
.bar { width: 100%; height: 10px; background: #ddd; border-radius: 5px; margin-top: 5px; }
#energy-fill { height: 100%; background: #f1c40f; border-radius: 5px; transition: 0.3s; }

#clock {
    background: #34495e; color: white; padding: 10px 20px;
    border-radius: 30px; font-weight: bold; font-size: 1.2rem;
}

#dialogue-container {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%);
    width: 90%; max-width: 800px;
    background: var(--ui-panel);
    border: 5px solid var(--primary);
    border-radius: 20px; padding: 30px;
    display: none; z-index: 2000;
}

#speaker-tag {
    position: absolute; top: -25px; left: 20px;
    background: var(--primary); color: white;
    padding: 5px 20px; border-radius: 10px; font-weight: bold;
}

#dialogue-options { margin-top: 20px; display: flex; gap: 10px; }
.opt-btn {
    background: #f8a5c2; border: none; padding: 10px 20px;
    border-radius: 5px; cursor: pointer; transition: 0.2s;
}
.opt-btn:hover { background: var(--primary); color: white; }

#inventory-btn {
    position: fixed; bottom: 20px; right: 20px;
    padding: 15px 30px; background: var(--primary);
    color: white; border-radius: 50px; cursor: pointer;
}

.hidden { display: none !important; }