:root {
    --black: #0a0a0a;
    --white: #ffffff;
}

.light-theme {
    --bg: var(--white);
    --fontColor: var(--black);
    --btnBg: var(--black);
    --btnFontColor: var(--white);
    --windowBorder: var(--black);
    --logoOpacity: 0.08;
}

.dark-theme {
    --bg: var(--black);
    --fontColor: var(--white);
    --btnBg: var(--white);
    --btnFontColor: var(--black);
    --windowBorder: var(--white);
    --logoOpacity: 0.2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--fontColor);
    font-family: monospace;
    height: 100vh;
    display: grid;
    /* Main area | Sidebar */
    grid-template-columns: 1fr 320px;
    grid-template-rows: 1fr auto;
}

/* --- THE DESKTOP (The 'Square' Grid) --- */
#desktop {
    grid-column: 1;
    grid-row: 1;
    padding: 50px;
    position: relative;
    /* FIX: This creates the square grid layout instead of a column */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 120px));
    grid-template-rows: repeat(auto-fill, minmax(120px, 120px));
    gap: 20px;
    z-index: 1;
}

    /* FIX: Separate logo from the icon layer so it doesn't make them dim */
    #desktop::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: url('resources/CDlogo.png');
        background-repeat: no-repeat;
        background-position: center;
        background-size: 350px;
        image-rendering: pixelated;
        opacity: var(--logoOpacity);
        z-index: -1;
    }

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--fontColor);
    /* FIX: High contrast text */
    font-weight: bold;
    transition: background 0.2s;
}

    .desktop-icon:hover {
        outline: 2px solid var(--fontColor);
        background: rgba(128, 128, 128, 0.2);
    }

.icon-visual {
    width: 64px;
    height: 64px;
    border: 3px solid var(--windowBorder); /* Thicker border for visibility */
    margin-bottom: 10px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}


.icon-label {
    font-size: 14px;
    background: var(--fontColor); /* Inverted background for readability */
    color: var(--bg);
    padding: 2px 6px;
    text-transform: uppercase;
}

/* Disabled state - still readable but distinct */
.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- SYSTEM TRAY --- */
#system-tray {
    grid-column: 2;
    padding: 20px;
    border-left: 4px double var(--windowBorder);
    background: var(--bg);
    z-index: 10;
}

.window {
    border: 2px solid var(--windowBorder);
    margin-bottom: 20px;
    box-shadow: 4px 4px 0px var(--windowBorder); /* Retro shadow */
}

.window-title-bar {
    background: var(--fontColor);
    color: var(--bg);
    padding: 5px 10px;
    font-weight: bold;
}

.window-content {
    padding: 15px;
}

/* Fixed Toggle Button */
.theme-toggle {
    cursor: pointer;
    border: 2px solid var(--windowBorder);
    color: var(--btnFontColor);
    background: var(--btnBg);
    font: bold 14px monospace;
    padding: 10px;
    width: 100%;
    text-transform: uppercase;
}

/* --- FOOTER --- */
footer {
    grid-column: 1 / 3;
    background: var(--fontColor);
    color: var(--bg);
    padding: 5px 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

.cursor {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}