* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #000;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    padding: 8px;
    box-sizing: border-box;
}
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    transition: none !important;
    animation: none !important;
}

/* Desktop */
#desktop {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #6ba7e0, #cde4ff);
    position: relative;
    padding: 8px 8px 0 8px;
    border-radius: 8px;
    overflow: hidden;
}

#desktopIcons {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 30px;
    align-content: start;
    overflow-y: auto;
    z-index: 1;
    position: relative;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.desktop-icon.dragging {
    opacity: 0.85;
    transform: none;
    z-index: 2;
    will-change: transform;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.desktop-icon:active {
    background: rgba(255, 255, 255, 0.25);
}

.desktop-icon-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.desktop-icon-label {
    color: white;
    font-size: 12px;
    text-align: center;
    max-width: 80px;
    word-wrap: break-word;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Taskbar */
#taskbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40px;
    background: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

.taskbar-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 15px;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.taskbar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.taskbar-item.active {
    background: rgba(255, 255, 255, 0.2);
    border-bottom: 3px solid #667eea;
}

#startButton {
    background: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 75%;
    width: 32px;
    border-radius: 4px;
    transition: all 0.2s ease;
    overflow: hidden;
    padding: 0;
}

#startButton:hover {
    background: #777;
}

.start-icon {
    width: 32px;
    height: 32px;
}

#taskbarApps {
    flex: 1;
    display: flex;
    gap: 5px;
    overflow-x: auto;
}

.taskbar-app {
    padding: 5px 10px;
    background: #5c5c5c;
    color: white;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    user-select: none;
}

.taskbar-app:hover {
    background: #666;
}

.taskbar-app.active {
    background: #777;
    border-bottom: 2px solid #999;
}

#systemTray {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-left: auto;
}

.tray-item {
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    user-select: none;
}

/* Start Menu */
#startMenu {
    position: fixed;
    bottom: 60px;
    left: 10px;
    width: 250px;
    background: #333;
    border: 1px solid #222;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    max-height: 400px;
    overflow-y: auto;
}

#startMenu.all-apps {
    width: 360px;
    max-height: none;
    overflow-y: visible;
}

#startMenu.hidden {
    display: none;
}

.start-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid #222;
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.start-menu-title {
    font-size: 16px;
}

.start-menu-action {
    border: 1px solid #444;
    background: #2b2b2b;
    color: #f0f0f0;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}

.start-menu-action:hover {
    background: #3a3a3a;
}

#appsList {
    display: flex;
    flex-direction: column;
}

#startMenu.all-apps #appsList {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
}

.start-menu-item {
    padding: 12px 20px;
    color: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 3px solid transparent;
    user-select: none;
}

.start-menu-item.grid {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border-left: none;
    border-radius: 6px;
    text-align: center;
}

#startMenu.all-apps .start-menu-item.grid:hover {
    background: #444;
}

.start-menu-item:hover {
    background: #444;
    border-left-color: #888;
}

.start-menu-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

#startMenu.all-apps .start-menu-icon {
    width: 32px;
    height: 32px;
}

/* Window Manager */
#windowManager {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 40px);
    z-index: 5;
    pointer-events: none;
}

.window {
    position: absolute;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    min-width: 400px;
    min-height: 300px;
    overflow: hidden;
    font-family: inherit;
    pointer-events: auto;
}

.window-titlebar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: #f0f0f0;
    color: #333;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #ccc;
    user-select: none;
    cursor: default;
    gap: 10px;
    position: relative;
}

.window-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-weight: bold;
    font-size: 0.95rem;
    color: #333;
    pointer-events: none;
}

.window-buttons {
    display: flex;
    gap: 6px;
    margin-right: auto;
}

.window-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset;
    transition: all 0.2s ease;
    font-size: 0;
}

.window-btn:hover {
    box-shadow: none;
}

.close-btn {
    background: #f25c5c;
}

.minimize-btn {
    background: #f2d45c;
}

.maximize-btn {
    background: #5cf27a;
}

.close-btn:hover,
.minimize-btn:hover,
.maximize-btn:hover {
    filter: brightness(0.95);
}

.window-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.window-resizer {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 12px;
    height: 12px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 0 40%, #bdbdbd 40% 60%, transparent 60% 100%);
}

.window.maximized .window-resizer {
    display: none;
}

/* Window Constraints */
.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 40px) !important;
    border-radius: 0 !important;
}

.window.minimized {
    display: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}
