@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --bg-color: #008080;
    --win-gray: #c0c0c0;
    --win-blue: #000080;
    --win-dark: #808080;
    --win-light: #ffffff;
    --win-text: #000000;
    --win-title-text: #ffffff;
    --win-border-light: #dfdfdf;
    --win-border-dark: #000000;
    --btn-face: #c0c0c0;
    --selection-blue: #000080;
}

body {
    background-color: var(--bg-color);
    font-family: 'VT323', monospace;
    font-size: 18px;
    overflow: hidden;
    user-select: none;
    -webkit-font-smoothing: none;
    image-rendering: pixelated;
    color: var(--win-text);
    background-size: cover;
    background-position: center;
}

/* --- CRT Effect Overlay --- */
#crt-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 999999;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.9);
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% {
        opacity: 0.97;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.98;
    }
}

.crt-active #crt-overlay {
    display: block;
}

.crt-active {
    text-shadow: 1px 0px 2px rgba(0, 255, 0, 0.4);
    filter: contrast(1.2) brightness(1.1);
}

/* --- Boot Screen --- */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    color: #aaa;
    z-index: 100000;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- Shutdown Screen --- */
#shutdown-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.shutdown-text {
    color: #ff9900;
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: bold;
}

/* --- BSOD --- */
#bsod {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0000AA;
    color: #fff;
    z-index: 99998;
    padding: 10%;
    font-family: 'Courier New', monospace;
    display: none;
    text-align: center;
}

/* --- Clippy --- */
#clippy {
    position: absolute;
    bottom: 50px;
    right: 20px;
    width: 150px;
    z-index: 9000;
    display: none;
    cursor: pointer;
    transition: transform 0.1s;
}

#clippy:active {
    transform: scale(0.95);
}

.clippy-anim {
    animation: bounce 3s infinite ease-in-out;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.clippy-bubble {
    background: #ffffe0;
    border: 1px solid #000;
    border-radius: 5px;
    padding: 8px;
    margin-bottom: 5px;
    font-size: 14px;
    color: #000;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
    position: relative;
    line-height: 1.2;
}

/* --- WinAmp --- */
.winamp-skin {
    background: #202020;
    color: #00ff00;
    border: 2px solid #505050;
}

/* Standard UI Styles */
::-webkit-scrollbar {
    width: 16px;
    background: var(--win-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--win-gray);
    border-top: 2px solid var(--win-light);
    border-left: 2px solid var(--win-light);
    border-right: 2px solid var(--win-dark);
    border-bottom: 2px solid var(--win-border-dark);
}

.win-outset {
    box-shadow: inset 1px 1px var(--win-border-light), inset -1px -1px var(--win-border-dark), 1px 1px var(--win-light), -1px -1px var(--win-dark);
    background: var(--win-gray);
}

.win-inset {
    box-shadow: inset 1px 1px var(--win-dark), inset -1px -1px var(--win-light), 1px 1px var(--win-border-dark), -1px -1px var(--win-border-light);
    background: var(--win-light);
}

.win-btn {
    box-shadow: inset 1px 1px var(--win-light), inset -1px -1px var(--win-border-dark), 1px 1px var(--win-border-light), -1px -1px var(--win-dark);
    background: var(--btn-face);
    color: var(--win-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'VT323', monospace;
    font-size: 18px;
    text-transform: uppercase;
    cursor: pointer;
}

.win-btn:active {
    box-shadow: inset 1px 1px var(--win-border-dark), inset -1px -1px var(--win-light);
    padding-top: 2px;
    padding-left: 2px;
}

.window {
    position: absolute;
    background: var(--win-gray);
    padding: 3px;
    box-shadow: inset 1px 1px var(--win-border-light), inset -1px -1px var(--win-border-dark), 1px 1px var(--win-light), -1px -1px var(--win-dark);
    display: flex;
    flex-direction: column;
    resize: both;
    overflow: hidden;
    min-width: 200px;
    min-height: 150px;
    border: 1px solid var(--win-gray);
}

.window.fullscreen {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
    z-index: 1000 !important;
    resize: none;
}

.title-bar {
    background: var(--win-blue);
    color: var(--win-title-text);
    padding: 4px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
    font-size: 20px;
    letter-spacing: 1px;
}

.title-bar.inactive {
    background: var(--win-dark);
}

.desktop-icon {
    width: 80px;
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    cursor: default;
    border: 1px solid transparent;
    text-align: center;
}

.desktop-icon:hover {
    border: 1px dotted white;
    background: rgba(0, 0, 128, 0.3);
}

.desktop-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 2px;
    image-rendering: pixelated;
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.8));
}

.desktop-icon span {
    background: rgba(0, 0, 0, 0.2);
    padding: 0 4px;
    font-size: 18px;
    user-select: none;
    margin-top: 2px;
    line-height: 1.1;
}

#context-menu,
#calendar-popup {
    position: absolute;
    background: var(--win-gray);
    border: 1px solid var(--win-light);
    border-right: 1px solid var(--win-border-dark);
    border-bottom: 1px solid var(--win-border-dark);
    box-shadow: 1px 1px 0 var(--win-border-dark);
    min-width: 150px;
    z-index: 10002;
    padding: 2px;
    font-size: 18px;
    color: var(--win-text);
}

.ctx-item {
    padding: 4px 15px;
    cursor: default;
    display: flex;
    justify-content: space-between;
    position: relative;
}

.ctx-item:hover {
    background-color: var(--selection-blue);
    color: white;
}

.ctx-divider {
    border-top: 1px solid var(--win-dark);
    border-bottom: 1px solid var(--win-light);
    margin: 3px 2px;
}

.ctx-item:hover>.submenu {
    display: flex;
}

.submenu {
    display: none;
    flex-direction: column;
    position: absolute;
    left: 100%;
    top: -4px;
    background: var(--win-gray);
    border: 2px solid;
    border-color: var(--win-light) var(--win-dark) var(--win-dark) var(--win-light);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    min-width: 180px;
    z-index: 10001;
    padding: 2px;
    color: var(--win-text);
}

/* Start Menu Submenu Specifics */
.submenu .ctx-item {
    justify-content: flex-start;
    /* Force left alignment */
    font-size: 18px;
    /* Match main menu font size */
    padding: 8px 12px;
    /* Increase padding for larger items */
    gap: 10px;
    /* Space between icon and text */
}

.submenu .ctx-item img {
    width: 32px;
    height: 32px;
    margin-right: 0;
    /* Gap handles spacing */
}

/* Fix for Programs submenu going off-screen */
.submenu-programs {
    top: -150px !important;
    width: 200px !important;
    /* Shift up to use available space above */
}

.scanlines {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.2));
    background-size: 100% 4px;
}

.start-menu {
    position: absolute;
    bottom: 38px;
    left: 2px;
    width: 220px;
    background: var(--win-gray);
    box-shadow: inset 1px 1px var(--win-border-light), inset -1px -1px var(--win-border-dark), 1px 1px var(--win-light), -1px -1px var(--win-dark);
    display: none;
    z-index: 10000;
    flex-direction: row;
    padding: 2px;
}

.start-menu.active {
    display: flex !important;
}

.sidebar {
    width: 30px;
    background: var(--win-blue);
    color: white;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 10px 0;
    font-weight: bold;
    font-size: 20px;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.menu-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--win-gray);
    padding-left: 2px;
    color: var(--win-text);
}

.menu-item {
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 18px;
    height: 40px;
    position: relative;
}

.menu-item:hover {
    background: var(--selection-blue);
    color: white;
}

.menu-item svg {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.menu-item:hover>.submenu {
    display: flex;
}

.minesweeper-grid {
    display: grid;
    grid-template-columns: repeat(9, 25px);
    gap: 1px;
    background: #808080;
    border: 2px solid #808080;
    width: fit-content;
    margin: 0 auto;
}

.cell {
    width: 25px;
    height: 25px;
    background: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: default;
    font-size: 16px;
}

.cell.revealed {
    border: 1px solid #808080;
    background: #c0c0c0;
}

.cell.bomb {
    background: red;
}

#snake-canvas,
#paint-canvas {
    border: 2px solid #808080;
    background: #fff;
    display: block;
    margin: 0 auto;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 4px;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background: #00ff00;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

input,
textarea {
    font-family: 'VT323', monospace;
    font-size: 18px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        overflow-y: auto;
    }

    /* Ensure windows appear within viewport on mobile */
    .window {
        max-width: calc(100vw - 10px) !important;
        max-height: calc(100vh - 60px) !important;
        resize: none !important;
    }

    /* Position all windows at 5px, 5px on mobile */
    .window:not(.fullscreen) {
        left: 5px !important;
        top: 5px !important;
    }

    /* Adjust title bar for mobile */
    .title-bar {
        font-size: 16px;
        padding: 8px 10px;
        touch-action: none;
    }

    /* Desktop icons - keep absolute positioning on mobile */
    #desktop {
        padding: 5px;
        position: relative;
        overflow-y: auto;
        height: calc(100vh - 50px);
    }


    /* Calendar Popup Positioning */
    #calendar-popup {
        position: fixed;
        bottom: 40px;
        right: 2px;
        z-index: 10000;
    }

    @media (max-width: 768px) {
        #calendar-popup {
            bottom: 50px;
        }
    }

    .desktop-icon img {
        width: 48px;
        height: 48px;
    }

    .desktop-icon span {
        font-size: 12px;
    }

    /* Hide fullscreen buttons on mobile (windows are fullscreen by default) */
    .title-bar button[onclick*="toggleFullScreen"] {
        display: none !important;
    }

    /* Taskbar adjustments - ensure it's always visible */
    #taskbar {
        height: 50px;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 99999 !important;
    }

    #start-btn {
        padding: 8px 12px;
        font-size: 16px;
    }

    #taskbar-items {
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
    }

    #clock {
        font-size: 14px;
        padding: 0 8px;
    }

    /* Fix submenu positioning on mobile */
    .submenu {
        left: 0 !important;
        right: auto !important;
        top: 100% !important;
        width: 100% !important;
        max-width: 280px !important;
        position: absolute !important;
    }

    /* Reset Programs submenu vertical adjustment on mobile */
    .submenu-programs {
        top: 100% !important;
    }

    /* Start menu adjustments */
    .start-menu {
        width: 100% !important;
        max-width: 280px;
        left: 0 !important;
        bottom: 50px !important;
    }

    .menu-item {
        font-size: 16px;
        padding: 10px 12px;
        height: auto;
    }

    /* Context menu mobile */
    #context-menu {
        min-width: 200px;
        font-size: 16px;
    }

    .ctx-item {
        padding: 8px 20px;
    }

    /* Clippy adjustments */
    #clippy {
        width: 100px;
        bottom: 60px;
        right: 10px;
    }

    .clippy-bubble {
        font-size: 12px;
        max-width: 200px;
    }

    /* Form inputs */
    input,
    textarea,
    button {
        font-size: 16px !important;
        min-height: 44px;
    }

    .win-btn {
        min-height: 44px;
        padding: 8px 12px;
    }

    /* Calculator grid */
    .calc-grid button {
        min-height: 50px;
        font-size: 18px;
    }

    /* Paint canvas */
    #paint-canvas {
        max-width: 100%;
        height: auto;
    }

    /* Minesweeper grid */
    .minesweeper-grid {
        grid-template-columns: repeat(9, 30px);
    }

    .cell {
        width: 30px;
        height: 30px;
    }

    /* LinkedIn profile card mobile */
    .desktop-icon:hover {
        background: rgba(0, 0, 128, 0.3);
    }

    /* Hide CRT effect on mobile for performance */
    .crt-active #crt-overlay {
        display: none !important;
    }

    /* Scrollbar mobile */
    ::-webkit-scrollbar {
        width: 8px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .desktop-icon {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .desktop-icon img {
        width: 48px;
        height: 48px;
    }

    .desktop-icon span {
        font-size: 12px;
    }

    .title-bar {
        font-size: 14px;
        padding: 6px 8px;
    }

    /* Google search in IE window */
    #ie h1 {
        font-size: 3rem !important;
    }

    #ie input[type="text"] {
        font-size: 14px !important;
    }

    /* LinkedIn profile */
    #linkedin h1 {
        font-size: 1.5rem !important;
    }

    #linkedin p {
        font-size: 14px !important;
    }

    #linkedin img {
        width: 100px !important;
        height: 100px !important;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #desktop {
        height: calc(100vh - 40px);
    }
}

/* Tablet devices */
@media (min-width: 769px) and (max-width: 1024px) {
    .window {
        max-width: 90% !important;
        max-height: 85% !important;
    }

    .desktop-icon {
        width: 90px;
    }

    .desktop-icon img {
        width: 52px;
        height: 52px;
    }
}

/* Calendar Popup Positioning */
#calendar-popup {
    position: fixed;
    bottom: 40px;
    right: 2px;
    z-index: 10000;
}

@media (max-width: 768px) {
    #calendar-popup {
        bottom: 50px;
    }
}