/* --- RESET & BASIC STYLES --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'W95FA', 'MS Sans Serif', 'Microsoft Sans Serif', Tahoma, sans-serif;
    font-size: 14px;
    user-select: none;
    background-color: #008080; 
    image-rendering: pixelated; 
    -webkit-font-smoothing: none;
    touch-action: none; 
}

/* --- BOOT SCREEN --- */
#boot-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: black; color: #c0c0c0;
    font-family: 'Courier New', monospace;
    z-index: 20000; padding: 20px; box-sizing: border-box; font-size: 16px;
    display: block;
}

#cursor-blink { animation: blink 0.8s infinite; }
@keyframes blink { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* BLACKOUT */
#blackout-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: black; z-index: 19000;
}

/* --- QUADRATINI SFONDO --- */
.square-bg {
    pointer-events: none;
    transition: all 0.5s ease;
}

/* --- WINDOW STYLES --- */
.win-window {
    background: #c0c0c0;
    border-top: 2px solid #dfdfdf; border-left: 2px solid #dfdfdf;
    border-right: 2px solid #000; border-bottom: 2px solid #000;
    box-shadow: 2px 2px 0 #000;
    position: absolute; display: none;
    flex-direction: column;
}

.folder-window { width: 500px; height: 400px; }
.text-window { width: 600px; height: 500px; }
.media-window { width: 450px; height: auto; padding-bottom: 10px;}

.drag-handle { cursor: default; }

.title-bar {
    background: linear-gradient(90deg, #000080, #1084d0);
    color: white; padding: 4px 6px; font-weight: bold;
    display: flex; justify-content: space-between; align-items: center;
    height: 28px; letter-spacing: 0.5px; font-size: 16px;
    touch-action: none; 
}

.title-text { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    overflow: hidden;
    white-space: nowrap;
}

.close-btn {
    background: #c0c0c0; border: 2px solid; border-color: #fff #000 #000 #fff;
    width: 20px; height: 20px; font-size: 14px; line-height: 16px;
    text-align: center; color: black; cursor: pointer; font-family: sans-serif; font-weight: bold;
    flex-shrink: 0;
}
.close-btn:active { border-color: #000 #fff #fff #000; transform: translate(1px, 1px); }

.win-btn {
    background: #c0c0c0; border: 2px solid; border-color: #fff #000 #000 #fff;
    padding: 6px 12px; font-family: inherit; font-size: 14px; cursor: pointer; color: black;
}
.win-btn:active { border-color: #000 #fff #fff #000; transform: translate(1px, 1px); }

/* --- LOGIN --- */
#login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #008080; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    cursor: none;
}
.login-box { display: flex; width: 400px; padding: 2px; position: relative; }
.login-content { display: flex; padding: 15px; gap: 15px; width: 100%; box-sizing: border-box; }
.key-icon {
    width: 48px; height: 48px;
    background-image: url('https://win98icons.alexmeub.com/icons/png/key_win-4.png');
    background-size: contain; background-repeat: no-repeat;
    flex-shrink: 0;
}
.login-form { flex-grow: 1; color: black; font-size: 14px;}
.login-row { display: flex; align-items: center; margin-bottom: 10px; }
.login-label { width: 80px; }
.win-input { width: 100%; border: 2px inset #fff; padding: 3px; font-family: inherit; font-size:14px;}
.login-buttons { display: flex; flex-direction: column; gap: 5px; }

/* --- DESKTOP ICONS --- */
#desktop { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    display: none; 
}
.icon {
    width: 90px; position: absolute;
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer; color: white; text-align: center;
    margin-bottom: 10px; z-index: 1;
}
.icon img { width: 48px; height: 48px; margin-bottom: 5px; }
.icon span { padding: 2px; background: none; text-shadow: 1px 1px #000; font-size: 14px; }
.icon.selected span { background-color: #000080; border: 1px dotted #ffff00; text-shadow: none; }

/* --- CONTENT --- */
.menu-bar { background: #c0c0c0; padding: 4px 8px; border-bottom: 1px solid #808080; font-size: 14px; color: black; }
.folder-content {
    background: white; border: 2px inset #fff;
    margin: 2px; padding: 15px;
    flex-grow: 1; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 20px;
    overflow: auto; height: 100%;
}

.window-icon { width: 80px; text-align: center; cursor: pointer; color: black; display: flex; flex-direction: column; align-items: center; }
.window-icon img { 
    width: 32px; height: 32px; margin-bottom: 5px; 
    display: block; 
    object-fit: contain;
}
.window-icon span { font-size: 14px; }
.window-icon:hover span { background-color: #c0c0c0; }

.notepad-area {
    width: 100%; height: 100%; border: none; resize: none;
    font-family: 'Courier New', Courier, monospace;
    padding: 10px; box-sizing: border-box; outline: none; font-size: 16px; line-height: 1.5;
    background: white; color: black;
}

/* --- MEDIA PLAYER --- */
.media-content { padding: 15px; background: #c0c0c0; }
.media-tabs { display: flex; justify-content: center; margin-bottom: 10px; gap: 10px; }
.tab-btn.active { font-weight: bold; background: #dfdfdf; border-color: #000 #fff #fff #000; padding: 7px 11px 5px 13px; }
.media-display { 
    background: black; width: 100%; min-height: 200px; 
    display: flex; align-items: center; justify-content: center; 
    border: 2px inset #fff; overflow: hidden;
}

/* --- TASKBAR --- */
.taskbar {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 35px;
    background: #c0c0c0; border-top: 2px solid #fff;
    display: flex; align-items: center; padding: 2px; z-index: 9000; color: black;
}
.start-btn {
    display: flex; align-items: center; height: 28px; padding: 0 10px;
    background: #c0c0c0; border: 2px outset #fff; margin-left: 2px;
    font-weight: bold; font-style: italic; font-size: 16px; gap: 5px; cursor: pointer;
}
.start-btn:active { border-style: inset; transform: translate(1px, 1px); }
.start-btn img { width: 20px; height: 20px; }
.taskbar-divider { flex-grow: 1; border-left: 2px solid #808080; border-right: 2px solid #fff; height: 28px; margin: 0 5px; width: 4px; }
.taskbar-tray {
    border: 2px inset #fff; padding: 0 10px; margin-right: 2px; height: 28px;
    display: flex; align-items: center; background: #c0c0c0; font-size: 14px;
}

/* --- FAKE CURSOR --- */
#fake-cursor {
    position: fixed; width: 12px; height: 20px;
    background-image: url('https://win98icons.alexmeub.com/cursors/arrow.png'); 
    background-size: contain; background-repeat: no-repeat;
    z-index: 10001; pointer-events: none; transition: all 1s ease-in-out;
}

/* --- MOBILE OPTIMIZATION --- */
@media screen and (max-width: 768px) {
    /* Login Box mantenuto come su PC, ma scalato */
    .static-center {
        width: 95% !important;
        max-width: 380px;
        margin: auto;
    }
    .login-content { padding: 10px; gap: 10px; flex-direction: row; }
    .key-icon { width: 36px; height: 36px; display: block; }
    .login-form { font-size: 12px; }
    .login-row { flex-direction: row; align-items: center; margin-bottom: 8px; }
    .login-label { width: 60px; font-size: 12px; }
    .win-input { padding: 2px; font-size: 12px; }
    .login-buttons { flex-direction: column; justify-content: flex-start; gap: 5px; }
    .win-btn { padding: 4px 8px; font-size: 12px; }

    /* Ottimizzazione altre finestre per Mobile */
    .win-window {
        width: 94% !important;
        left: 3% !important;
        top: 50px !important;
        max-height: 80vh;
    }
    
    .text-window { height: 70vh !important; }
    .text-window .folder-content { flex-grow: 1; height: 100%; display: block; }
    .notepad-area { height: 100% !important; font-size: 14px; }

    .folder-window { height: 60vh !important; }
    .folder-content { overflow-y: auto; padding: 10px; }

    .media-window { top: 80px !important; }

    .icon { width: 80px; margin: 15px; }
    .icon img { width: 42px; height: 42px; }

    .taskbar { height: 40px; }
    .start-btn { font-size: 14px; }
}