:root {
    --desktop-bg: #008080;
    --window-bg: #c0c0c0;
    --window-text: #000000;
    --title-bar-bg: #000080;
    --title-bar-text: #ffffff;
    --border-light: #ffffff;
    --border-dark: #404040;
    --border-black: #000000;
    --selection-blue: #000080;
    --font-ui: 'Tahoma', 'Verdana', sans-serif;
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: var(--desktop-bg);
    background-image: radial-gradient(#000 1px, transparent 1px);
    background-size: 4px 4px;
    font-family: var(--font-ui);
    color: var(--window-text);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background-repeat: repeat;
    background-position: center;
}

/* Boot Screen (XP Style) */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-family: 'Arial', sans-serif;
}

.xp-logo {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.xp-logo span {
    font-style: italic;
}

.xp-logo .windows {
    font-weight: normal;
}

.xp-logo .xp {
    color: #ff6600;
    /* XP Orange */
    position: relative;
    top: -5px;
    font-size: 36px;
}

.xp-loader-container {
    width: 200px;
    height: 15px;
    border: 2px solid #555;
    border-radius: 4px;
    padding: 2px;
    position: relative;
    margin-top: 50px;
}

.xp-loader-bar {
    width: 40px;
    height: 100%;
    background: linear-gradient(90deg, transparent, #2b60de, #6699ff, #2b60de, transparent);
    position: absolute;
    left: 0;
    top: 2px;
    animation: xp-load 2s linear infinite;
    border-radius: 2px;
}

@keyframes xp-load {
    0% {
        left: 0;
    }

    100% {
        left: 160px;
    }
}

/* Screensaver */
#screensaver {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99990;
    display: none;
    overflow: hidden;
}

#screensaver-logo {
    position: absolute;
    width: 150px;
    height: 80px;
    background: transparent;
    border: 4px solid #fff;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 0 10px #fff;
}

/* Desktop Icons */
#desktop {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    height: calc(100vh - 40px);
    gap: 20px;
}

.desktop-icon {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

.desktop-icon img {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    image-rendering: pixelated;
}

.desktop-icon .icon-label {
    font-size: 12px;
    padding: 2px 4px;
}

.desktop-icon:active .icon-label,
.desktop-icon.selected .icon-label {
    background-color: var(--selection-blue);
    border: 1px dotted #fff;
}

/* Window Manager */
.window {
    position: absolute;
    background-color: var(--window-bg);
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-black);
    border-bottom: 2px solid var(--border-black);
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    min-width: 300px;
    min-height: 200px;
}

.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 40px) !important;
    z-index: 9998 !important;
}

.title-bar {
    background: linear-gradient(90deg, #000080, #1084d0);
    color: var(--title-bar-text);
    padding: 4px 8px;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}

.title-bar-controls {
    display: flex;
    gap: 4px;
}

.control-box {
    width: 16px;
    height: 14px;
    background: var(--window-bg);
    border-top: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-black);
    border-bottom: 1px solid var(--border-black);
    font-size: 10px;
    line-height: 12px;
    text-align: center;
    color: #000;
    cursor: pointer;
    font-family: sans-serif;
}

.control-box:active {
    border-top: 1px solid var(--border-black);
    border-left: 1px solid var(--border-black);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.window-body {
    flex: 1;
    padding: 10px;
    overflow: auto;
    position: relative;
}

/* Applications */
.app-explorer .window-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    align-content: start;
    background: #fff;
    border: 2px inset #fff;
    margin: 10px;
}

.app-explorer .file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    padding: 5px;
}

.app-explorer .file-item:hover {
    background-color: #eee;
}

.app-explorer .file-item img {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
}

.app-browser iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Settings App */
.settings-group {
    margin-bottom: 15px;
    border: 1px solid #808080;
    padding: 10px;
}

.settings-group h4 {
    margin-top: -20px;
    background: var(--window-bg);
    display: inline-block;
    padding: 0 5px;
}

.radio-option {
    display: block;
    margin-bottom: 5px;
    cursor: pointer;
}

/* Game App */
.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 200px;
    margin: 0 auto;
}

.game-cell {
    width: 60px;
    height: 60px;
    background: #fff;
    border: 2px inset #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
}

.game-cell:active {
    background: #eee;
}

.game-status {
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
}

.game-controls {
    text-align: center;
    margin-top: 15px;
}

/* Menus */
#context-menu,
#start-menu {
    position: absolute;
    background: var(--window-bg);
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-black);
    border-bottom: 2px solid var(--border-black);
    z-index: 10000;
    display: none;
}

#context-menu {
    min-width: 150px;
}

#start-menu {
    bottom: 40px;
    left: 0;
    width: 200px;
    display: none;
}

.start-menu-sidebar {
    width: 25px;
    background: #000080;
    color: #fff;
    writing-mode: vertical-rl;
    text-align: center;
    padding: 5px;
    font-weight: bold;
    font-size: 14px;
    float: left;
    height: 100%;
    min-height: 200px;
}

.menu-item {
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-item:hover {
    background-color: var(--selection-blue);
    color: #fff;
}

.menu-item img {
    width: 24px;
    height: 24px;
}

.menu-separator {
    height: 1px;
    background: #808080;
    border-bottom: 1px solid #fff;
    margin: 2px 0;
}

/* Responsive adjustments for small screens / mobile */
@media (max-width: 600px) {
    body {
        overflow: auto;
        height: auto;
    }

    #desktop {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        padding: 12px;
        height: calc(100vh - 60px);
    }

    .desktop-icon {
        width: 64px;
        font-size: 11px;
    }

    .desktop-icon img {
        width: 40px;
        height: 40px;
        margin-bottom: 4px;
    }

    .window {
        min-width: calc(100% - 20px);
        left: 10px !important;
        top: 60px !important;
        right: 10px !important;
        box-shadow: none;
        border-radius: 4px;
    }

    .window.maximized {
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100vh - 48px) !important;
        z-index: 9998 !important;
    }

    .title-bar {
        font-size: 12px;
        padding: 4px 6px;
    }

    .window-body {
        padding: 6px;
    }

    .taskbar {
        height: 48px;
    }

    #start-menu {
        width: 180px;
        bottom: 48px;
    }

    #boot-screen .xp-logo {
        font-size: 32px;
    }

    #screensaver-logo {
        width: 120px;
        height: 60px;
        font-size: 16px;
    }

    .game-board {
        width: 160px;
        gap: 4px;
    }

    .game-cell {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
}

/* Taskbar */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--window-bg);
    border-top: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 4px;
    z-index: 9999;
}

.start-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--window-bg);
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-black);
    border-bottom: 2px solid var(--border-black);
    font-weight: bold;
    cursor: pointer;
    margin-right: 10px;
}

.start-btn.active {
    border-top: 2px solid var(--border-black);
    border-left: 2px solid var(--border-black);
    border-right: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
    background: #e0e0e0;
}

.start-btn img {
    width: 20px;
    height: 20px;
}

.taskbar-divider {
    width: 2px;
    height: 25px;
    background: #808080;
    border-right: 1px solid #fff;
    margin-right: 10px;
}

/* System Tray */
.system-tray {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 10px;
    background: var(--window-bg);
    border: 2px inset #fff;
    height: 30px;
}

.tray-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.weather-widget {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.clock {
    font-size: 12px;
}