:root {
    /* Classic Windows 95 Color Palette */
    --bg-color: #c0c0c0;
    --desktop-teal: #008080;
    --window-silver: #c0c0c0;
    --border-light: #ffffff;
    --border-dark: #808080;
    --border-black: #000000;
    --title-blue: #000080;
    --text-color: #000000;
    --panel-height: 30px;
}
@font-face {
  font-family: main_font; 
  src: url(W95font.otf); 
}
@font-face {
  font-family: bold_font; 
  src: url(W95font-Bold.otf); 
}

html, body {
    background: transparent;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: main_font; /* Closest to MS Sans Serif */
        /* Wallpaper is sized to leave room for the taskbar: the image height
             equals viewport minus the panel height so its bottom stays above the bar */
        background-image: url("Textures/background.jpg");
        background-size: auto calc(100vh - var(--panel-height));
        background-position: center bottom;
        background-repeat: no-repeat;
  width: 100%;
    user-select: none;
        height: 100vh;
    color: var(--text-color);
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: main_font; /* Closest to MS Sans Serif */
    width: 100%;
    height: 100vh;
    user-select: none;
    color: var(--text-color);
}

/* Wallpaper layer that stops above the taskbar */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--panel-height);
    background-image: url("Textures/background.jpg");
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    z-index: 0;
}

/* Ensure desktop content sits above the wallpaper */
#desktop-area {
    position: relative;
    z-index: 1;
}
#desktop-area {
    width: 100%;
    height: calc(100% - var(--panel-height));
    position: relative;
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 25px;
}

.desktop-icon {
    width: 75px;
    text-align: center;
    cursor: pointer;
    color: white;
    text-shadow: 1px 1px 1px black;
}

.icon-img {
    font-size: 32px;
    margin-bottom: 4px;
}

.icon-label {
    font-size: 11px;
    padding: 2px;
}

/* Window Styling */
.window {
    position: absolute;
    background-color: var(--window-silver);
    border: 2px solid;
    border-color: var(--border-light) var(--border-black) var(--border-black) var(--border-light);
    box-shadow: 1px 1px 0px var(--border-dark) inset;
    display: flex;
    flex-direction: column;
    padding: 2px;
}

.title-bar {
    height: 18px;
    background: var(--border-dark); /* Inactive */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
}

.window.active .title-bar {
    background: var(--title-blue);
}

.window-title {
    font-size: 11px;
    font-weight: bold;
    color: white;
}

.window-controls {
    display: flex;
    gap: 2px;
}

.control-btn {
    width: 16px;
    height: 14px;
    background: var(--window-silver);
    border: 1px solid;
    border-color: var(--border-light) var(--border-black) var(--border-black) var(--border-light);
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 0;
}

.control-btn:active {
    border-color: var(--border-black) var(--border-light) var(--border-light) var(--border-black);
}

.window-content {
    flex: 1;
    margin-top: 2px;
    background: white;
    border: 2px solid;
    border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark);
}

/* Taskbar */
#panel {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: var(--panel-height);
    background: var(--window-silver);
    border-top: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 2px;
    z-index: 9999;
    box-sizing: border-box;
}

#start-btn {
    font-weight: bold;
    padding: 0px 4px;
    height: 22px;
    display: flex;
    align-items: center;
    gap: 2px;
    border: 2px solid;
    border-color: var(--border-light) var(--border-black) var(--border-black) var(--border-light);
    cursor: pointer;
    font-size: 12px;
}

#start-btn:active {
    border-color: var(--border-black) var(--border-light) var(--border-light) var(--border-black);
}

#task-manager {
    display: flex;
    gap: 3px;
    margin-left: 5px;
}

.task-item {
    width: 140px;
    height: 22px;
    border: 2px solid;
    border-color: var(--border-light) var(--border-black) var(--border-black) var(--border-light);
    padding: 0 6px;
    font-size: 11px;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.task-item.active {
    background: #e0e0e0;
    border-color: var(--border-black) var(--border-light) var(--border-light) var(--border-black);
    font-weight: bold;
}

#clock {
    margin-left: auto;
    border: 2px solid;
    border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark);
    padding: 2px 8px;
    font-size: 11px;
}

/* Start Menu */
#start-menu {
    position: absolute;
    bottom: 30px;
    left: 2px;
    width: 250px;
    background: var(--window-silver);
    border: 2px solid;
    border-color: var(--border-light) var(--border-black) var(--border-black) var(--border-light);
    display: none;
    z-index: 10000;
}

#start-menu.open {
    display: flex;
}

.start-sidebar {
    width: 25px;
    background: linear-gradient(to bottom, #808080, #000000);
    display: flex;
    align-items: flex-end;
    padding: 5px;
    font-family: bold_font;
}

.start-sidebar span {
    color: #c0c0c0;
    font-weight: bold;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 14px;
}

.menu-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2px;
}

.menu-item {
    padding: 9px 10px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

hr {
    border: 0;
    border-top: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-light);
    margin: 4px 0;
}
.resize-handle {
    width: 12px;
    height: 12px;
    position: absolute;
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
    z-index: 10;
    /* Drawing the little diagonal dots/lines manually with a gradient */
    background: linear-gradient(135deg, transparent 50%, var(--border-dark) 50%, var(--border-dark) 60%, transparent 60%, transparent 70%, var(--border-dark) 70%);
}
.icon{
    width: 32px;
    height: 32px;
}

/* ===================== */
/* Mobile / Phone Fixes  */
/* ===================== */
@media (max-width: 768px) {
    #desktop-area {
        padding: 10px;
        gap: 16px;
    }

    .desktop-icon {
        width: 64px;
    }

    .desktop-icon .icon-img img {
        width: 40px !important;
    }

    .icon-label {
        font-size: 10px;
    }

    /* Taskbar shrinks to fit small screens */
    :root { --panel-height: 34px; }
    #panel {
        padding: 3px 4px;
    }

    #start-btn span {
        display: none; /* keep just the logo to save space */
    }

    #start-btn {
        padding: 0 6px;
    }

    #task-manager {
        flex: 1;
        overflow-x: auto;
        gap: 4px;
        margin-left: 4px;
        margin-right: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .task-item {
        width: auto;
        min-width: 70px;
        max-width: 110px;
        flex-shrink: 0;
        font-size: 10px;
    }

    #clock {
        font-size: 10px;
        padding: 2px 6px;
        white-space: nowrap;
    }

    /* Start menu fits narrow screens and scrolls if tall */
    #start-menu {
        width: min(85vw, 260px);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        left: 2px;
    }

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

    .icon {
        width: 26px;
        height: 26px;
    }

    /* Windows are handled full-screen via JS on mobile,
       but guard against any inline desktop sizing leaking through */
    .window {
        max-width: 100vw;
        max-height: 100vh;
    }

    .title-bar {
        height: 28px;
    }

    .window-title {
        font-size: 12px;
    }

    .control-btn {
        width: 26px;
        height: 22px;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    .task-item {
        min-width: 56px;
        max-width: 90px;
        font-size: 9px;
    }

    .menu-item {
        font-size: 14px;
        padding: 10px 8px;
    }
}