@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;500;600;700&display=swap');

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    overflow: hidden;
    background: #000;
    color: #fff;
}

#desktop {
    position: fixed;
    inset: 0 0 56px 0;
    overflow: hidden;
}

#spaceBg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px #fff;
    animation: twinkle var(--duration) infinite alternate;
}

@keyframes twinkle {
    from { opacity: var(--opacity); }
    to { opacity: 0.35; }
}

.shooting-star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: linear-gradient(transparent, #c4d0ff, transparent);
    box-shadow: 0 0 12px #a5b4fc;
    transform: rotate(35deg);
    animation: shoot var(--duration) linear forwards;
}

@keyframes shoot {
    0% { transform: translate(0,0) rotate(35deg); opacity: 1; }
    100% { transform: translate(var(--distance), var(--distance)) rotate(35deg); opacity: 0; }
}

.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.22;
    mix-blend-mode: screen;
    animation: drift 140s linear infinite;
}

@keyframes drift {
    0%,100% { transform: translate(0,0); }
    50% { transform: translate(30px,-20px); }
}

#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(15,23,42,0.85);
    backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    padding: 0 8px;
    z-index: 1000;
    gap: 4px;
}

.taskbar-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.taskbar-btn:hover {
    background: rgba(255,255,255,0.12);
}

.taskbar-btn.active {
    background: rgba(59,130,246,0.35);
    box-shadow: 0 0 0 2px #3b82f6;
}

.window {
    position: absolute !important;
    background: rgba(15,23,42,0.96);
    border-radius: 10px;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.65);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.09);
    z-index: 10;
    min-width: 320px;
    min-height: 220px;
}

.window-header {
    height: 40px;
    background: rgba(30,41,59,0.98);
    display: flex;
    align-items: center;
    padding: 0 12px;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    touch-action: none; /* предотвращает прокрутку при касании заголовка */
}

.window-title {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    margin-left: 10px;
}

.window-buttons button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.15s;
}

.window-buttons button:hover {
    background: rgba(255,255,255,0.15);
}

.window-buttons .close-btn:hover {
    background: #ef4444 !important;
    color: white;
}

.resize-handle {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    cursor: nwse-resize;
    z-index: 20;
    touch-action: none;
}

#startMenu {
    position: fixed;
    bottom: 68px;
    left: 12px;
    width: 520px;
    background: rgba(15,23,42,0.96);
    backdrop-filter: blur(32px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    box-shadow: 0 30px 60px -15px rgb(0 0 0 / 0.7);
    padding: 20px;
    z-index: 2000;
    display: none;
}

.start-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.start-apps {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 8px;
    scrollbar-width: none;
}

.start-app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 80px;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s;
}

.start-app:hover {
    background: rgba(255,255,255,0.08);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .window {
        border-radius: 0 !important;
        box-shadow: none;
    }
    #startMenu {
        left: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        bottom: 56px;
    }
    .taskbar-btn {
        width: 48px;
        height: 48px;
    }
    .start-apps {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .resize-handle {
        display: none; /* на телефоне изменение размера не нужно */
    }
    .window-header {
        height: 56px; /* больше места для пальца */
        font-size: 18px;
    }
    .window-buttons button {
        width: 48px;
        height: 48px;
    }
}

.mobile-window {
    position: fixed !important;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.mobile-window.hidden {
    transform: translateY(100%);
    pointer-events: none;
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .window {
    }
}

.window.maximized {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: calc(100% - 60px); /* Учитываем высоту панели */
    padding: 0;
    margin: 0;
    border-radius: 0;
}