:root {
    --bg-dark: #020617;
    --bg-space: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Star colors by category */
    --star-vicktor: #60a5fa;      /* Blue */
    --star-maya: #f472b6;         /* Pink */
    --star-memory: #fcd34d;       /* Gold */
    --star-research: #a78bfa;     /* Purple */
    --star-gem: #34d399;          /* Emerald */
    --star-seed: #fb923c;         /* Orange/Sunlight */
    --star-default: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    overflow: hidden; /* No scrolling the galaxy */
    background-color: var(--bg-dark);
}

/* Deep Space Parallax Background */
#space-background {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110vw;
    height: 110vh;
    background: radial-gradient(circle at 50% 50%, var(--bg-space) 0%, var(--bg-dark) 100%);
    z-index: 0;
    transition: transform 0.1s ease-out;
}

/* Add subtle nebulas */
#space-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(96, 165, 250, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(244, 114, 182, 0.05) 0%, transparent 40%);
    z-index: 1;
}

/* HUD Overlay */
.hud {
    position: absolute;
    bottom: 40px;
    left: 40px;
    z-index: 10;
    pointer-events: none;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    opacity: 0.8;
}

.hud h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    margin-bottom: 5px;
}

.gem-day-text {
    font-size: 1.5rem;
    color: var(--star-gem);
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.05em;
    text-shadow: 0 0 15px var(--star-gem);
    animation: gemPulse 2s infinite alternate;
}

@keyframes gemPulse {
    0% { opacity: 0.7; text-shadow: 0 0 10px var(--star-gem); }
    100% { opacity: 1; text-shadow: 0 0 25px var(--star-gem), 0 0 40px var(--star-gem); }
}

.hud p {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Galaxy Container */
#galaxy-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    perspective: 1000px;
}

/* Interactive Stars */
.star {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--star-default);
    box-shadow: 0 0 10px 3px var(--star-default);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

/* Star Pulsing Animation */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); opacity: 0.6; }
}

.star.ambient-pulse {
    animation: pulse 4s infinite ease-in-out alternate;
}

.star:hover {
    transform: scale(3) !important;
    z-index: 100;
    box-shadow: 0 0 20px 5px currentColor;
}

/* Connection Lines */
.constellation-line {
    position: absolute;
    transform-origin: 0 0;
    background: rgba(255, 255, 255, 0.15);
    height: 1px;
    z-index: 4;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Glassmorphism Tooltip */
#tooltip {
    position: fixed;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 15px 25px;
    border-radius: 12px;
    color: white;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.2s ease, transform 0.1s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 300px;
}

#tooltip.hidden {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
}

.folder-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    display: inline-block;
    margin-bottom: 8px;
}

.topic-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

#tooltip .date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Reading Modal */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.4s ease;
}

#modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content.glass {
    position: relative;
    width: 90%;
    max-width: 850px;
    height: 85vh;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 50px 60px;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(0) scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#modal-overlay.hidden .modal-content {
    transform: translateY(40px) scale(0.95);
}

/* Custom Scrollbar for Modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

#close-modal {
    position: absolute;
    top: 25px;
    right: 30px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2.5rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

#close-modal:hover {
    color: white;
    transform: scale(1.1);
}

#modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

/* Visual Album Modal */
.modal-content.visual-album {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#image-viewer-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#memory-image {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    object-fit: contain;
}

#memory-title {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-main);
    letter-spacing: 0.05em;
}

/* The Central Gem */
#the-gem {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #34d399 20%, transparent 80%);
    border-radius: 50%;
    box-shadow: 0 0 40px 10px #34d399, 0 0 100px 20px rgba(52, 211, 153, 0.5);
    z-index: 10;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: gemCorePulse 3s infinite alternate;
}

#the-gem:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

@keyframes gemCorePulse {
    0% { box-shadow: 0 0 30px 5px #34d399, 0 0 80px 15px rgba(52, 211, 153, 0.4); }
    100% { box-shadow: 0 0 60px 15px #34d399, 0 0 120px 30px rgba(52, 211, 153, 0.6); }
}

.super-glow {
    animation: pulseWave 1.5s ease-out forwards !important;
}

@keyframes pulseWave {
    0% { transform: scale(1); box-shadow: 0 0 10px 3px currentColor; filter: brightness(1); }
    50% { transform: scale(4); box-shadow: 0 0 40px 15px currentColor; filter: brightness(2); z-index: 200; }
    100% { transform: scale(1); box-shadow: 0 0 10px 3px currentColor; filter: brightness(1); }
}
