/* Base & Typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
}

body {
    background: #040408;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* --- DYNAMIC STARFIELD --- */
#starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(circle at center, #0a0a12 0%, #020204 100%);
    overflow: hidden;
}

.star {
    position: absolute;
    background: #ffffff;
    border-radius: 50%;
}

/* star sizes and animations */

#stars-small .star { width: 1px; height: 1px; opacity: 0.5; }
#stars-medium .star { width: 2px; height: 2px; opacity: 0.7; }
#stars-large .star { width: 3px; height: 3px; opacity: 0.9; }

/* shooting star effect */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 80px;
    background: linear-gradient(to top, rgba(255,255,255,1), transparent);
    transform: rotate(45deg);
    opacity: 0;
    animation: shoot 1s ease-in forwards;
}

@keyframes shoot {
    0% { transform: translate(0, 0) rotate(45deg); opacity: 1; }
    100% { transform: translate(-300px, 300px) rotate(45deg); opacity: 0; }
}

/* Desktop & Window Layering */
#desktop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10; /* Above starfield */
}

/* Desktop Icons */
.icon {
    width: 80px;
    padding: 10px;
    margin: 15px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.icon:hover { background: rgba(255, 255, 255, 0.05); }

.icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    background: transparent;
    border-radius: 0px;
    box-shadow: none;
}

.icon span {
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    letter-spacing: 0.5px;
}

/* Windows (Glassmorphism) */
.window {
    position: absolute;
    width: 400px;
    min-height: 250px;
    background: rgba(12, 12, 20, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.2s ease;
}

.window.active { transform: scale(1); opacity: 1; }

/* window title bar */
.window-header {
    height: 36px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    cursor: grab;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.window-header:active { cursor: grabbing; }

/* close button */
.close-btn {
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover { color: #ff4d4d; }

.window-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* App Specifics */
textarea {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    resize: none;
    outline: none;
    font-size: 14px;
    font-family: monospace;
}

canvas {
    display: block;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

#gameCanvas { background: #020205; }
#asteroidCanvas { width: 100%; height: 100%; background: #020205; }

/* Notification Center */
.notification-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #d0d0d0;
}
.notification-time {
    display: block;
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
}

/* Taskbar & Start Menu */
#taskbar {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 40px;
    background: rgba(8, 8, 12, 0.85);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 9000;
}

/* taskbar buttons */
#start-btn, #notif-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

#notif-btn {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

#notif-btn svg {
    width: 40px;
    height: 40px;
    display: block;
}

#start-btn:hover, #notif-btn:hover { background: rgba(255, 255, 255, 0.1); }

#clock { font-size: 13px; letter-spacing: 1px; }

/* start menu dropdown */
#start-menu {
    position: absolute;
    bottom: 50px;
    left: 20px;
    width: 200px;
    background: rgba(12, 12, 20, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px;
    display: none;
    z-index: 9001;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#start-menu.show { display: flex; flex-direction: column; }

#shutdown-btn {
    background: rgba(255, 50, 50, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 50, 50, 0.2);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

#shutdown-btn:hover { background: rgba(255, 50, 50, 0.2); }

/* Shutdown Sequence */
#shutdown-screen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 9999; display: none; background: transparent; pointer-events: none;
}

/* black hole animation */
.black-hole {
    position: absolute; bottom: -100px; left: 50%;
    width: 10px; height: 10px; border-radius: 50%;
    background: radial-gradient(circle, #000 30%, #300050 70%, transparent 100%);
    box-shadow: 0 0 50px 20px #200040;
    transform: translateX(-50%); opacity: 0;
}

.fly-up { animation: flyUp 1.5s cubic-bezier(0.5, 0, 0.1, 1) forwards; }
@keyframes flyUp {
    0% { bottom: -100px; transform: translateX(-50%) scale(1); opacity: 1; }
    100% { bottom: 50%; transform: translate(-50%, 50%) scale(200); opacity: 1; }
}

/* glitch effect for shutdown */
.glitch-active { animation: screenGlitch 0.6s steps(2, end) forwards; }
@keyframes screenGlitch {
    0% { background: #000; } 20% { background: #222; }
    40% { background: #000; } 60% { background: #444; }
    80% { background: #111; } 100% { background: #000000; }
}