body {
    margin: 0;
    padding: 0;
    background-color: #008080;
    font-family: "MS Sans Serif", sans-serif;
    overflow: hidden;
    height: 100vh;
    position: relative;
    user-select: none;
}

/* CRT Monitor Effect */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50000;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.08) 2px,
            rgba(0, 0, 0, 0.08) 4px
        );
    animation: scanlines 0.1s linear infinite;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50001;
    background: radial-gradient(circle, transparent 70%, rgba(0, 0, 0, 0.3));
    box-shadow: 
        inset 0 0 150px rgba(0, 0, 0, 0.2),
        inset 0 0 80px rgba(0, 0, 0, 0.15);
}

/* Remove transform effects from preloader to prevent perspective issues */

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

@keyframes flicker {
    0%, 98% { opacity: 1; }
    99%, 100% { opacity: 0.98; }
}

/* CRT Glow effect - only for preloader */
.preloader {
    box-shadow: 
        0 0 10px rgba(0, 255, 255, 0.1),
        inset 0 0 10px rgba(0, 255, 255, 0.05);
    animation: flicker 4s infinite;
}

/* Additional CRT effects */
body {
    background-color: #000000;
}

body.desktop-loaded {
    background-color: #008080;
}

.preloader {
    background: #000000;
}

/* Phosphor trail effect for text */
.preloader-text {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 15px currentColor;
}

/* Preloader styling */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    color: #ffffff;
    font-family: "Courier New", monospace;
    font-size: 14px;
    padding: 20px;
    box-sizing: border-box;
    z-index: 100000;
    display: block;
}

.preloader-text {
    white-space: pre-line;
}

.desktop-container {
    display: none;
    position: relative;
    z-index: 100;
}

/* Desktop styling */
.desktop {
    height: calc(100vh - 30px);
    position: relative;
    padding: 20px;
    box-sizing: border-box;
}

/* Desktop icons */
.desktop-icon {
    width: 64px;
    text-align: center;
    margin: 10px;
    cursor: pointer;
    display: inline-block;
    vertical-align: top;
    position: relative;
    z-index: 1000;
}

.desktop-icon img {
    width: 32px;
    height: 32px;
    display: block;
    margin: 0 auto 5px;
}

.desktop-icon span {
    color: white;
    font-size: 11px;
    text-shadow: 1px 1px 1px black;
    word-wrap: break-word;
    line-height: 1.2;
}

.desktop-icon:hover span {
    background-color: rgba(0, 0, 139, 0.7);
    color: white;
}

/* Taskbar */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, #c0c0c0, #a0a0a0);
    border-top: 1px solid #dfdfdf;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    z-index: 60000;
}

.start-button {
    display: flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
}

.clock {
    background: #c0c0c0;
    border: 1px inset #c0c0c0;
    padding: 2px 8px;
    font-size: 11px;
    min-width: 60px;
    text-align: center;
}

/* Start menu */
.start-menu {
    position: fixed;
    bottom: 30px;
    left: 0;
    width: 200px;
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    display: none;
    z-index: 60001;
}

.start-menu-header {
    background: linear-gradient(to right, #000080, #4040ff);
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
}

.start-menu-item {
    padding: 4px 20px 4px 30px;
    font-size: 11px;
    cursor: pointer;
    border-bottom: 1px solid #a0a0a0;
}

.start-menu-item:hover {
    background: #0000ff;
    color: white;
}

.start-menu-separator {
    height: 1px;
    background: #808080;
    margin: 2px 0;
}

.has-submenu {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.submenu-arrow {
    font-size: 8px;
    margin-left: 10px;
}

.start-submenu {
    position: fixed;
    left: 200px;
    bottom: 30px;
    width: 300px;
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    display: none;
    z-index: 60002;
    max-height: 400px;
    overflow-y: auto;
}

.start-submenu .start-menu-item {
    padding: 4px 20px 4px 10px;
    font-size: 11px;
    cursor: pointer;
    border-bottom: 1px solid #a0a0a0;
    white-space: nowrap;
}

.start-submenu .start-menu-item:hover {
    background: #0000ff;
    color: white;
}

/* Windows */
.window {
    position: absolute;
    min-width: 300px;
    min-height: 200px;
    display: none;
    z-index: 1000;
}

/* My Computer and Recycle Bin window sizing */
#my-computer-window, #recycle-bin-window {
    min-width: 500px;
    min-height: 400px;
}

.window.active {
    z-index: 2000;
}

/* Custom title bar for dragging */
.title-bar {
    cursor: move;
}

/* Windows 98 Explorer styling */
.menu-bar {
    background: #c0c0c0;
    border-bottom: 1px solid #808080;
    padding: 2px 4px;
    font-size: 11px;
    display: flex;
    gap: 15px;
}

.menu-item {
    padding: 4px 8px;
    cursor: pointer;
}

.menu-item:hover {
    background: #0000ff;
    color: white;
}

.address-bar {
    background: #c0c0c0;
    border-bottom: 1px solid #808080;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.address-label {
    font-weight: bold;
}

.address-input {
    display: flex;
    align-items: center;
    background: white;
    border: 1px inset #c0c0c0;
    padding: 2px 4px;
    flex: 1;
    gap: 4px;
}

.address-input img {
    width: 16px;
    height: 16px;
}

.drive-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 20px;
    background: white;
    min-height: 200px;
}

.drive-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    padding: 4px;
    user-select: none;
    width: 80px;
    height: 80px;
    justify-content: center;
    position: relative;
}

.drive-item:hover {
    background: rgba(0, 0, 255, 0.1);
}

.drive-item.selected {
    background: #0000ff;
    color: white;
    border: 1px dotted #ffffff;
}

.drive-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.drive-label {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 2px;
}

.drive-size {
    font-size: 9px;
    color: #666;
    text-align: center;
    line-height: 1.1;
}

.drive-item.selected .drive-size {
    color: white;
}

/* Toolbar styling */
.toolbar {
    background: #c0c0c0;
    border-bottom: 1px solid #808080;
    padding: 4px;
    display: flex;
    gap: 2px;
}

.toolbar-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 6px;
    border: 1px outset #c0c0c0;
    background: #c0c0c0;
    cursor: pointer;
    font-size: 9px;
    min-width: 40px;
}

.toolbar-button:hover {
    border: 1px inset #c0c0c0;
}

.toolbar-icon {
    font-size: 16px;
    margin-bottom: 2px;
}

/* Document items styling */
.document-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    padding: 4px;
    user-select: none;
    width: 80px;
    height: 80px;
    justify-content: center;
    position: relative;
}

.document-item:hover {
    background: rgba(0, 0, 255, 0.1);
}

.document-item.selected {
    background: #0000ff;
    color: white;
    border: 1px dotted #ffffff;
}

.document-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.document-label {
    font-size: 11px;
    text-align: center;
}

/* Status bar */
.status-bar {
    background: #c0c0c0;
    border-top: 1px solid #808080;
    padding: 2px 8px;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    align-items: center;
}

.status-right {
    margin-left: auto;
}

.notepad-textarea {
    width: 100%;
    height: 200px;
    font-family: "Courier New", monospace;
    font-size: 12px;
    resize: none;
    box-sizing: border-box;
}

.error-content {
    padding: 20px;
    text-align: center;
}

.error-icon {
    width: 32px;
    height: 32px;
    background: red;
    border-radius: 50%;
    display: inline-block;
    margin-bottom: 10px;
    position: relative;
}

.error-icon::before {
    content: "!";
    color: white;
    font-weight: bold;
    font-size: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.shutdown-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #008080;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 80000;
}

.shutdown-message {
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    padding: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
}

/* Icon placeholders using CSS */
.icon-computer::before {
    content: "🖥️";
    font-size: 32px;
    display: block;
    margin-bottom: 5px;
}

.icon-recycle::before {
    content: "🗑️";
    font-size: 32px;
    display: block;
    margin-bottom: 5px;
}

.icon-ie::before {
    content: "🌐";
    font-size: 32px;
    display: block;
    margin-bottom: 5px;
}

.icon-notepad::before {
    content: "📝";
    font-size: 32px;
    display: block;
    margin-bottom: 5px;
}

.icon-drive::before {
    content: "💽";
    font-size: 32px;
    display: block;
    margin-bottom: 5px;
}

.start-icon::before {
    content: "S";
    font-weight: bold;
    font-size: 14px;
    margin-right: 5px;
    color: black;
}

/* Error dialog styling */
.error-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    min-width: 350px;
    z-index: 70000;
    display: none;
}

.error-dialog .title-bar {
    background: linear-gradient(to right, #000080, #4040ff);
    color: white;
    padding: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    cursor: default;
}

.error-dialog-content {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.error-dialog-icon {
    width: 32px;
    height: 32px;
    background: red;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    flex-shrink: 0;
}

.error-dialog-buttons {
    padding: 10px 15px;
    text-align: center;
    border-top: 1px solid #808080;
}


/* Hacking window styling */
.hacking-text {
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: #00ff00;
    background: #000000;
    padding: 10px;
    height: 200px;
    overflow: hidden;
    border: 1px inset #c0c0c0;
    line-height: 1.2;
}

/* Glitch text animation */
#glitch-text {
    font-family: "MS Sans Serif", sans-serif;
    font-size: 12px;
    animation: glitch 0.5s infinite;
}

@keyframes glitch {
    0%, 80%, 100% {
        transform: translateX(0);
        filter: hue-rotate(0deg);
    }
    10% {
        transform: translateX(-2px);
        filter: hue-rotate(90deg);
    }
    20% {
        transform: translateX(2px);
        filter: hue-rotate(180deg);
    }
    30% {
        transform: translateX(-1px);
        filter: hue-rotate(270deg);
    }
    40% {
        transform: translateX(1px);
        filter: hue-rotate(360deg);
    }
    50% {
        transform: translateX(-0.5px);
        filter: brightness(1.5);
    }
    60% {
        transform: translateX(0.5px);
        filter: contrast(1.5);
    }
    70% {
        transform: translateX(-0.25px);
        filter: invert(0.1);
    }
}
