/* --- 1. DESIGN SYSTEM & THEMES --- */
:root {} /* Placeholder for JS */

body[data-theme="stargazing"] {
    --bg-canvas: #d4e3f0;
    --window-bg: rgba(10, 20, 40, 0.92);
    --window-border: #87CEEB;
    --window-shadow: #87CEEB;
    --text-color: #d0d0d0;
    --header-color: #87CEEB;
    --link-color: #FFD700;
    --icon-text-color: #2c3e50;
    --top-bar-bg: rgba(10, 20, 40, 0.85);
    --top-bar-text: #d4d4d4;
    --top-bar-border: #87CEEB;
    --special-text-color: #d4d4d4;
    --scrollbar-track-bg: #1e3a5f;
    --scrollbar-thumb-bg: #87CEEB;
}
body[data-theme="love-compound"] {
    --bg-canvas: #ffe0e0; --window-bg: rgba(60, 10, 20, 0.92); --window-border: #ff87ab; --window-shadow: #ff87ab; --text-color: #ffd0d0; --header-color: #ff87ab; --link-color: #ab87ff; --icon-text-color: #3d2c2c;
    --top-bar-bg: rgba(60, 10, 20, 0.85); --top-bar-text: #ffd4d4; --top-bar-border: #ff87ab; --special-text-color: #ff99aa;
    --scrollbar-track-bg: #5f1e3a; --scrollbar-thumb-bg: #ff87ab;
}
body[data-theme="classic-nav"] {
    --bg-canvas: #008080; --window-bg: #c0c0c0; --window-border: #f0f0f0; --window-shadow: #000; --text-color: #000; --header-color: #000080; --link-color: #0000FF; --icon-text-color: #fff;
    --top-bar-bg: #c0c0c0; --top-bar-text: #000; --top-bar-border: #000; --special-text-color: #000;
    --scrollbar-track-bg: #a0a0a0; --scrollbar-thumb-bg: #000080;
}

/* --- 2. GENERAL STYLES & RESETS --- */
* { box-sizing: border-box; }
html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; font-family: 'DotGothic16', sans-serif; color: var(--text-color); background-color: var(--bg-canvas); user-select: none; }
h1, h2, h3, h4, .window-title-text, #top-bar, .icon p { font-family: 'VT323', monospace; }
a { color: var(--link-color); text-decoration: underline; cursor: pointer; }

/* --- 3. AESTHETICS: PARALLAX BACKGROUND --- */
@keyframes twinkle { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.9; } }
@keyframes fall { from { background-position: 0 0; } to { background-position: 0 1000px; } }
/* --- New Particle Effect Styles --- */
.particle {
    position: absolute;
    bottom: -20px;
    border-radius: 50%;
    opacity: 0;
    animation: floatUp 20s infinite linear;
    z-index: 1; /* Place above static stars but below windows */
}

.sparkle::before {
    content: '✦';
    font-size: 15px;
    color: var(--header-color);
    text-shadow: 0 0 8px var(--header-color);
}

.teardrop {
    background-color: rgba(135, 206, 235, 0.6); /* Using the original teardrop color */
    border-radius: 50% 50% 50% 0;
    transform: rotate(45deg);
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

/* --- 4. DESKTOP LAYOUT & ELEMENTS --- */
#top-bar { position: fixed; top: 0; left: 0; width: 100%; height: 30px; background: var(--top-bar-bg); color: var(--top-bar-text); display: flex; justify-content: space-between; align-items: center; padding: 0 15px; font-size: 18px; z-index: 10000; border-bottom: 2px solid var(--top-bar-border); backdrop-filter: blur(5px); }
#top-bar-left, #top-bar-right { display: flex; align-items: center; gap: 15px; }
.star-icon { font-size: 1.2em; color: var(--header-color); }
.special-text { color: var(--special-text-color); }
/* --- New Custom Dropdown Styles --- */
#settings-container {
    position: relative; /* Crucial for positioning the dropdown */
}

/* --- Desktop Character Image --- */
#desktop-character-img {
    position: absolute;
    bottom: 50px;  
    right: 1px;    
    max-width: 550px; 
    pointer-events: none;
    opacity: 0.85; 
}

#settings-btn {
    background: transparent;
    color: var(--top-bar-text);
    border: 1px solid var(--top-bar-border);
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 2px 8px;
    cursor: pointer;
}

#theme-options {
    position: absolute;
    top: 100%; /* Position right below the button */
    right: 0;
    background-color: var(--window-bg);
    border: 1px solid var(--window-border);
    box-shadow: 3px 3px 0 0 var(--window-shadow);
    min-width: 180px;
    z-index: 10001; /* Above the top bar */
}

#theme-options.hidden {
    display: none;
}

.theme-option {
    padding: 8px 12px;
    color: var(--text-color);
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 16px;
}

.theme-option:hover {
    background-color: var(--header-color);
    color: var(--window-bg);
}

#desktop { width: 100%; height: 100%; position: relative; padding-top: 30px; }
.icon { position: absolute; width: 80px; height: 90px; padding: 5px; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.icon.dragging { opacity: 0.7; z-index: 9999; }
.icon-visual { width: 60px; height: 60px; background: var(--window-border); display: flex; align-items: center; justify-content: center; font-size: 1.5em; color: var(--window-bg); }
.icon p { margin: 5px 0 0 0; color: var(--icon-text-color); font-size: 16px; text-align: center; word-wrap: break-word; }
#trash-bin { position: absolute; bottom: 20px; right: 20px; }
#trash-bin.trash-active .icon-visual { background-color: #ff4757; }

.window {
    position: absolute;
    width: 500px; /* Default width */
    height: 400px; /* Default height */
    max-width: 85vw; 
    max-height: 80vh; 
    min-width: 350px;
    min-height: 250px;
    background: var(--window-bg);
    border: 2px solid var(--window-border);
    box-shadow: 5px 5px 0 0 var(--window-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
}
.window.maximized { top: 30px !important; left: 0 !important; width: 100% !important; height: calc(100% - 30px) !important; box-shadow: none; max-width: 100%; max-height: 100%; resize: none; }
.window.minimized { display: none; }
.window-title-bar { background: var(--header-color); color: var(--window-bg); padding: 4px 8px; cursor: move; display: flex; justify-content: space-between; align-items: center; height: 28px; flex-shrink: 0; }
.window-title-text { font-size: 18px; font-weight: bold; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.window-controls button { background: var(--window-bg); color: var(--header-color); border: 1px solid var(--window-bg); font-family: 'VT323', monospace; width: 20px; height: 20px; margin-left: 4px; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }
.window-content { padding: 15px; flex-grow: 1; overflow: auto; }
.window-content h2 { color: var(--header-color); margin-top: 0; font-size: 24px; }
.window-resizer { position: absolute; bottom: 0; right: 0; width: 15px; height: 15px; cursor: nwse-resize; z-index: 1; }
.template { display: none; }

/* Themed Scrollbars */
.window-content::-webkit-scrollbar { width: 12px; }
.window-content::-webkit-scrollbar-track { background: var(--scrollbar-track-bg); }
.window-content::-webkit-scrollbar-thumb { background-color: var(--scrollbar-thumb-bg); border: 2px solid var(--scrollbar-track-bg); }

/* --- 5. MOBILE VIEW --- */
#mobile-container { display: none; }
@media (max-width: 768px) {
    #desktop, #parallax-background, #top-bar { display: none !important; }
    body { overflow: auto; }
    #mobile-container { display: flex; flex-direction: column; min-height: 100vh; background-color: var(--bg-canvas); }
    #mobile-header { position: sticky; top: 0; z-index: 10; flex-shrink: 0; background: var(--top-bar-bg); color: var(--top-bar-text); padding: 10px 15px; text-align: left; font-family: 'VT323', monospace; font-size: 20px; border-bottom: 2px solid var(--top-bar-border); }
    #mobile-content { flex-grow: 1; overflow-y: auto; padding: 20px; background-color: var(--window-bg); color: var(--text-color); }
    #mobile-content h2 { color: var(--header-color); font-size: 28px; margin-top: 0; }
    #mobile-dock { flex-shrink: 0; position: sticky; bottom: 0; left: 0; width: 100%; display: flex; justify-content: space-around; align-items: center; background: var(--top-bar-bg); padding: 10px 0; border-top: 1px solid var(--top-bar-border); }
    .mobile-icon { display: flex; flex-direction: column; align-items: center; color: var(--top-bar-text); font-family: 'VT323', monospace; font-size: 14px; cursor: pointer; }
    .mobile-icon .icon-visual { width: 45px; height: 45px; font-size: 1.2em; }
    .mobile-icon p { margin-top: 5px; color: var(--top-bar-text); }
}