@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 48px 0;
    overflow: hidden;
    z-index: 1;
}

#spaceBg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(circle at top, rgba(255,255,255,0.06), transparent 25%),
                radial-gradient(circle at 20% 20%, rgba(255,255,255,0.08), transparent 20%),
                radial-gradient(circle at 80% 15%, rgba(255,255,255,0.05), transparent 18%),
                #000;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    opacity: var(--opacity, 0.6);
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.3));
    animation: twinkle var(--duration, 6s) ease-in-out infinite alternate;
}

.shooting-star {
    position: absolute;
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.95), rgba(255,255,255,0));
    border-radius: 999px;
    transform: rotate(25deg);
    filter: blur(0.8px);
    opacity: 0.9;
    animation: shooting var(--duration, 1.5s) forwards;
}

@keyframes twinkle {
    0% { opacity: calc(var(--opacity, 0.6) * 0.5); }
    100% { opacity: var(--opacity, 0.9); }
}

@keyframes shooting {
    0% { transform: translate(0, 0) rotate(25deg); opacity: 0.9; }
    100% { transform: translate(240px, 240px) rotate(25deg); opacity: 0; }
}

.number-animate {
    animation: number-pop 0.3s ease-out;
}

@keyframes number-pop {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#startMenu .start-apps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

#startMenu .start-app {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: #fff;
    text-align: left;
    transition: background 0.2s ease;
}

#startMenu .start-app:hover {
    background: rgba(255,255,255,0.1);
}

#startMenu .start-app span {
    display: block;
}

#startMenu .start-app span:first-child {
    font-size: 30px !important;
    line-height: 1;
}

.kei-language-content {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.kei-language-content.kei-language-fade-out {
    opacity: 0;
    transform: translateY(8px);
}

/* === Окна === */
.window {
    position: absolute !important;
    background: rgba(15, 23, 42, 0.97);
    border-radius: 12px;           /* увеличил закругление */
    box-shadow: 0 25px 60px -12px rgb(0 0 0 / 0.7);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 10;
    min-width: 320px;
    min-height: 220px;
}

.window-header {
    height: 42px;
    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.08);
    touch-action: none;
}

.window-title {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    margin-left: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Кнопки управления окном (Windows 11 стиль) === */
.window-buttons {
    display: flex;
    gap: 6px;
}

.window-buttons button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

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

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

/* Контент окна */
.window-content {
    overflow: auto;
    padding: 24px;
    height: calc(100% - 42px);
}

/* Ресайз */
.resize-handle {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    cursor: nwse-resize;
    z-index: 20;
}

/* === Таскбар === */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    padding: 0 8px;
    z-index: 10000;
    gap: 6px;
}

.taskbar-btn {
    min-width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 13px;
    color: #fff;
}

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

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

/* === Start Menu === */
#startMenu {
    position: fixed;
    bottom: 68px;
    left: 12px;
    width: 376px;
    max-width: calc(100vw - 24px);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(32px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    box-shadow: 0 30px 70px -15px rgb(0 0 0 / 0.75);
    padding: 20px;
    z-index: 2000;
    display: none;
}

@media (max-width: 768px) {
    .window {
        border-radius: 16px;           /* большие закругления на телефоне */
        box-shadow: 0 20px 50px -10px rgb(0 0 0 / 0.6);
    }

    .window-header {
        height: 56px;
    }

    .window-buttons button {
        width: 54px;
        height: 54px;
        font-size: 22px;
        border-radius: 12px;
    }

    .window-content {
        padding: 20px;
    }

    #startMenu {
        left: 8px;
        right: 8px;
        width: auto;
        border-radius: 20px 20px 0 0;
        bottom: 64px;
        padding: 20px;
    }

    .resize-handle {
        display: none;
    }
}

/* Убираем подсветку при тапе */
.window-header button,
.taskbar-btn,
#startMenu button {
    -webkit-user-select: none;
    user-select: none;
}

/* === Windows-like window open animation === */
.window-enter {
    animation: windowAppear 0.35s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes windowAppear {
    0% {
        transform: scale(0.92) translateY(20px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}
