:root {
    --desktop-bg: #4a849a;
}
@font-face {
    font-family: 'Pixel';
    src: local('Courier New'), local('Courier'), monospace;
}

body, html {
    margin: 0; padding: 0; height: 100%; overflow: hidden;
    font-family: 'Tahoma', sans-serif;
    background-color: #000;
}

/* CRT Effects */
:root {
    --crt-opacity: 0.25;
    --flicker-min: 0.98;
    --flicker-max: 1;
}
.crt-effects {
    animation: flicker 0.15s infinite;
}
.crt-effects::before {
    content: " "; display: block; position: absolute; top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, var(--crt-opacity)) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 99999;
    background-size: 100% 2px, 3px 100%; pointer-events: none;
}
@keyframes flicker {
    0% { opacity: var(--flicker-min); } 50% { opacity: var(--flicker-max); } 100% { opacity: calc(var(--flicker-min) + 0.01); }
}

/* Fullscreen overlays */
.fullscreen-overlay {
    box-sizing: border-box;
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 90000; display: flex; align-items: center; justify-content: center;
}
#bios-screen { background: #000; color: #ccc; font-family: 'Courier New', monospace; justify-content: flex-start; align-items: flex-start; padding: 20px; font-size: 18px; }
.bsod { background: #0000aa; color: #fff; font-family: 'Courier New', monospace; text-align: left; align-items: center; justify-content: center; padding: 10%; display: flex; flex-direction: column; }
.bsod-text { font-size: 20px; max-width: 800px; width: 100%; display: flex; flex-direction: column; align-items: flex-start; }
#shutdown-screen { background: #000; color: #ff8c00; font-family: 'Press Start 2P', monospace; font-size: 24px; text-align: center; }

/* Desktop */
.desktop {
    width: 100vw; height: calc(100vh - 30px);
    background: #008080;
    position: relative; overflow: hidden;
}

/* Icons - FIXED TEXT SHADOW FOR READABILITY */
.icon-wrapper {
    position: absolute; display: flex; flex-direction: column; align-items: center;
    cursor: pointer; width: 70px; z-index: 10;
}
.icon-wrapper img { width: 32px; height: 32px; image-rendering: pixelated; margin-bottom: 4px; filter: drop-shadow(1px 1px 0px rgba(0,0,0,0.5)); }
.icon-text { 
    color: white; 
    font-family: 'Press Start 2P', 'Courier New', monospace; 
    font-size: 10px; 
    text-align: center; 
    line-height: 1.2; 
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; 
}
.icon-wrapper.selected .icon-text {
    margin-top: 5px;
    background: #000080;
    border: 1px dotted #fff;
    color: white;
    text-shadow: none;
    text-align: center;
    font-size: 11px;
    line-height: 1.4;
    padding: 2px;
}

#selection-box { position: absolute; border: 1px dotted #fff; background: rgba(0, 0, 128, 0.3); z-index: 9; }

.window {
    position: absolute; background: #c0c0c0; border: 2px outset #fff;
    display: flex; flex-direction: column;
    transition: transform 0.2s, opacity 0.2s; /* Maximize animation */
}
.window.inactive .title-bar { background: #808080; }
.title-bar { background: linear-gradient(90deg, #000080, #1084d0); padding: 3px 2px; display: flex; justify-content: space-between; align-items: center; color: white; font-weight: bold; font-family: Tahoma, sans-serif; font-size: 12px; cursor: move; }


.window-body { flex: 1; background: #fff; border: 2px inset #fff; margin: 2px; overflow: hidden; }
.resize-handle { position: absolute; bottom: 0; right: 0; width: 15px; height: 15px; cursor: se-resize; }

/* IE Specific */
.ie-tabs { display: flex; background: #c0c0c0; border-bottom: 1px solid #808080; padding-top: 3px;}
.ie-tab { padding: 3px 10px; border: 1px outset #fff; border-bottom: none; background: #dfdfdf; font-size: 12px; cursor: pointer; border-radius: 3px 3px 0 0; margin-left: 2px;}
.ie-tab.active { background: #fff; border-bottom: 1px solid #fff; z-index: 2; position: relative; top: 1px; }
.toolbar-btn { cursor: pointer; background: transparent; border: 1px solid transparent; padding: 2px 5px; }
.toolbar-btn:hover { border: 1px outset #fff; }
.toolbar-btn:active { border: 1px inset #fff; }
.address-bar { flex:1; margin-left: 10px; border: 2px inset #fff; padding: 2px; }
.bookmarks-bar { padding: 3px 5px; border-bottom: 1px solid #808080; font-size: 12px; background: #c0c0c0; }
.bookmarks-bar a { color: black; text-decoration: none; margin: 0 10px; padding: 2px; }
.bookmarks-bar a:hover { text-decoration: underline; background: #000080; color: white; }

.google-98-logo { font-family: 'Times New Roman', Times, serif; font-size: 80px; font-weight: bold; letter-spacing: -3px; text-shadow: 3px 3px 0px rgba(0,0,0,0.2); }
#search-input { width: 400px; padding: 5px; font-size: 16px; border: 2px inset #fff; }
#autocomplete-dropdown { position: absolute; top: 100%; left: 0; width: 100%; background: #fff; border: 1px solid #000; z-index: 100; text-align: left; }
#autocomplete-dropdown div { padding: 3px; cursor: pointer; }
#autocomplete-dropdown div:hover { background: #000080; color: white; }

/* App Specific */
.color-btn { width: 20px; height: 20px; border: 1px inset #fff; margin: 1px; cursor: pointer; }

/* WordPad Formatting Buttons - FIXED */
#notepad-window button {
    border: 2px outset #fff; background: #dfdfdf; cursor: pointer; padding: 2px 5px; margin: 1px;
}
#notepad-window button:active { border: 2px inset #fff; }

/* Taskbar & Start Menu */
.taskbar { position: absolute; bottom: 0; left: 0; width: 100%; height: 28px; background: #c0c0c0; border-top: 2px outset #fff; display: flex; align-items: center; padding: 2px; box-sizing: border-box; z-index: 9999; }
.start-button { font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 2px 4px; border: 2px outset #fff; background: #c0c0c0; cursor: pointer; height: 22px; margin-right: 4px;}
.start-button:active, .start-button.active { border: 2px inset #fff; background: #dfdfdf;}
.start-button img { width: 16px; height: 16px; }

.taskbar-tasks { flex: 1; display: flex; align-items: center; gap: 4px; padding: 0 4px; flex-wrap: nowrap; overflow: hidden; }
.task { display: flex; align-items: center; gap: 5px; padding: 0 6px; font-size: 11px; background: #c0c0c0; border: 2px outset #fff; flex: 1; max-width: 160px; min-width: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; height: 22px; box-sizing: border-box; font-family: Tahoma, sans-serif;}
.task.active { border: 2px inset #fff; background: #dfdfdf; }
.task img { width: 16px; height: 16px; flex-shrink: 0; }

.taskbar-tray { display: flex; align-items: center; gap: 8px; padding: 0 8px; border: 2px inset #fff; font-size: 11px; height: 22px; box-sizing: border-box; cursor: pointer; font-family: Tahoma, sans-serif;}
.taskbar-tray img { width: 16px; height: 16px; }

/* Start Menu - FIXED SPACING */
#start-menu { position: absolute; bottom: 30px; left: 0; width: 250px; background: #c0c0c0; border: 2px outset #fff; display: flex; z-index: 10000; box-shadow: 2px 2px 0px #000; }
.start-menu-sidebar { width: 30px; background: linear-gradient(0deg, #000080, #1084d0); position: relative; }
.sidebar-text { position: absolute; bottom: 5px; left: 5px; color: #fff; font-weight: bold; font-family: Tahoma; font-size: 16px; writing-mode: vertical-lr; transform: rotate(180deg); white-space: nowrap; }
.start-menu-items { flex: 1; padding: 4px; display: flex; flex-direction: column;}
.start-item { position: relative; padding: 8px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 12px;}
.start-item:hover { background: #000080; color: #fff; }
.start-item:hover > .sub-menu { display: block !important; }
.start-item img { width: 24px; height: 24px; }
.start-menu-items hr { border: 0; border-top: 1px solid #808080; border-bottom: 1px solid #fff; margin: 4px 0; width: 100%;}

/* Context Menu */
#context-menu { position: absolute; background: #c0c0c0; border: 2px outset #fff; z-index: 100000; padding: 2px; box-shadow: 2px 2px 0px #000; font-size: 12px; }
.ctx-item { padding: 4px 15px; cursor: pointer; }
.ctx-item:hover { background: #000080; color: white; }
#context-menu hr { border: 0; border-top: 1px solid #808080; border-bottom: 1px solid #fff; margin: 2px 0; }

/* Custom cursors */
body { cursor: url('https://win98icons.alexmeub.com/cursors/arrow.cur'), auto; }
button, .start-item, .task, .icon-wrapper, a, .toolbar-btn { cursor: url('https://win98icons.alexmeub.com/cursors/pointer.cur'), pointer; }
input[type="text"], textarea { cursor: url('https://win98icons.alexmeub.com/cursors/ibeam.cur'), text; }

/* GLOBAL INPUT COLOR FIX */
input[type="text"]:not(#cmd-input), input[type="password"], textarea, [contenteditable="true"] { 
    color: black !important; 
    background-color: white !important; 
}
.loading, .loading * { cursor: wait !important; }
.safe-mode { filter: grayscale(100%) contrast(150%) sepia(20%) hue-rotate(180deg); }
