:root {
    --bg-color: #008080; /* Classic Teal */
    --win-gray: #c0c0c0;
    --win-gray-light: #dfdfdf;
    --win-gray-dark: #808080;
    --win-text: #000000;
    --win-blue: #000080;
    --win-blue-light: #1084d0;
    --bevel-light: #ffffff;
    --bevel-dark: #000000;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background-color: var(--bg-color);
    user-select: none;
    height: 100vh;
    width: 100vw;

    background-image: url('backgrounds/Windows XP Pixel Art Wallpaper.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Desktop */
#desktop {
    width: 100%;
    height: calc(100vh - 40px); /* Minus taskbar height */
    position: relative;
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
}

.desktop-icon {
    width: 80px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 5px;
    color: white;
    text-shadow: 1px 1px 0px black;
    cursor: pointer;
    border: 1px dotted transparent;
}

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

.desktop-icon img {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    image-rendering: pixelated;
}

.desktop-icon span {
    text-align: center;
    font-size: 14px;
    line-height: 1.2;
}

/* Specific Icon Positioning */
#desktop-icon-recycle {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

/* Taskbar */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: var(--win-gray);
    border-top: 2px solid var(--bevel-light);
    display: flex;
    align-items: center;
    padding: 2px;
    z-index: 10000;
    box-shadow: inset 0 1px 0 var(--bevel-light);
}

.bevel-btn {
    border: 2px solid;
    border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
    background-color: var(--win-gray);
    box-shadow: 1px 1px 0 black;
    /* Fixed: bevel-btn active state */
}

.bevel-btn:active {
    border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
    box-shadow: none;
}

#start-btn {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 16px;
    padding: 4px 6px;
    margin-right: 10px;
    cursor: pointer;
    height: 32px;
}

#start-btn img {
    width: 20px;
    height: 20px;
    margin-right: 4px;
}

#start-btn:active, .taskbar-item.active {
    border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
    box-shadow: none;
    padding-top: 6px; /* Push down effect */
    padding-bottom: 2px;
    background-color: #d4d4d4; /* Dotted effect simulation */
}

/* Taskbar Apps */
#quick-launch {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icons */
    padding: 0 10px;
    height: 100%;
}

#quick-launch img {
    width: 20px;
    height: 20px;
    cursor: pointer;
    transition: transform 0.1s ease;
    filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.2));
}

#quick-launch img:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

#quick-launch img:active {
    transform: translateY(1px);
    filter: brightness(0.9);
}

#taskbar-apps {
    flex-grow: 1;
    display: flex;
    gap: 4px;
    padding-left: 10px;
}

.taskbar-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    background: var(--win-gray);
    border: 2px solid;
    border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
    max-width: 180px;
    height: 32px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.taskbar-item img {
    width: 16px;
    height: 16px;
    margin-right: 6px;
}

/* Tray */
#tray {
    border: 2px solid;
    border-color: var(--win-gray-dark) var(--bevel-light) var(--bevel-light) var(--win-gray-dark);
    background: var(--win-gray);
    padding: 4px 10px;
    margin-left: 10px;
    font-size: 14px;
    min-width: 80px;
    text-align: center;
    box-shadow: inset 1px 1px 0 black;
}

/* Window Styles */
.window {
    position: absolute;
    background: var(--win-gray);
    border: 2px solid;
    border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
    box-shadow: 1px 1px 0 black;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    min-height: 100px;
    padding: 2px;
    resize: both;
    overflow: auto; /* For resize handle */
}

.title-bar {
    background: linear-gradient(90deg, var(--win-blue), var(--win-blue-light));
    color: white;
    padding: 3px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
    cursor: default; /* We will overriding this for drag */
}

.window.active .title-bar {
    background: linear-gradient(90deg, var(--win-blue), var(--win-blue-light));
}

.window:not(.active) .title-bar {
    background: var(--win-gray-dark);
    color: var(--win-gray-light);
}

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

.control-btn {
    width: 16px;
    height: 14px;
    background: var(--win-gray);
    border: 1px solid;
    border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
    padding: 0;
    font-size: 10px;
    line-height: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-family: monospace;
    font-weight: bold;
}

.control-btn:active {
    border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
    padding-top: 1px;
    padding-left: 1px;
}

.window-body {
    flex-grow: 1;
    margin-top: 2px;
    background: white;
    border: 2px solid;
    border-color: var(--win-gray-dark) var(--bevel-light) var(--bevel-light) var(--win-gray-dark);
    padding: 10px;
    overflow: auto;
    font-family: 'Courier New', Courier, monospace; /* Default content font */
}

/* Start Menu */
.start-menu {
    position: absolute;
    bottom: 42px;
    left: 2px;
    width: 250px;
    background: var(--win-gray);
    border: 2px solid;
    border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
}

.start-menu .sidebar {
    width: 25px;
    background: linear-gradient(180deg, #000080 0%, #1084d0 100%);
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
}

.start-menu .sidebar .sideways-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: white;
    font-weight: bold;
    font-size: 20px; /* Slightly larger */
    white-space: nowrap;
    letter-spacing: 1px;
    padding: 10px 0;
}

.start-menu .sidebar .version {
    color: #ffd700;
    font-weight: normal;
    margin-left: 5px;
}

.start-menu .menu-items {
    flex-grow: 1;
    padding: 2px;
}

.start-menu .menu-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
}

.start-menu .menu-item:hover {
    background-color: #000080;
    color: white;
}

.start-menu .menu-item img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.start-menu .menu-item .arrow {
    margin-left: auto;
    font-size: 10px;
}

.start-menu .divider {
    height: 1px;
    background: white;
    border-top: 1px solid #808080;
    margin: 4px 0;
}

/* Project Window Grid */
.project-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.project-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    cursor: pointer;
    text-align: center;
}

.project-item:hover {
    outline: 1px dotted black;
}

.project-item img {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
}


/* Wallpaper */
body {
    /* Override background with a cloud image or fallback */
    background: url('background.png') no-repeat center center fixed;
    background-size: cover;
}

/* CRT Effect Overlay */
body::after {
    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, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 999999;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* WinAmp / iPod Player */
.winamp-player {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #111;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden; /* Contain children */
}

.winamp-player .display {
    background: #000;
    border-bottom: 2px solid #333;
    padding: 10px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #0f0;
}

.winamp-player .scrolling-text {
    white-space: nowrap;
    overflow: hidden;
    max-width: 200px;
}

.winamp-player .playlist {
    flex-grow: 1;
    background: #1a1a1a;
    overflow-y: auto;
    padding: 5px 0;
    color: #ccc;
    font-size: 13px;
}

.winamp-player .track {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.2s;
}

.winamp-player .track:hover {
    background: #333;
}

.winamp-player .track.active {
    background: #000080;
    color: white;
    font-weight: bold;
}

/* iPod Controls (Bottom Area) */
.winamp-player .controls {
    flex-shrink: 0;
    height: 40px; /* Reduced from 80px */
    background: linear-gradient(to bottom, #e0e0e0, #cccccc); /* Lighter gray */
    border-top: 1px solid #999;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* Reduced gap */
}

.winamp-player button {
    background: none;
    border: none;
    font-size: 16px; /* Smaller icons */
    cursor: pointer;
    color: #555;
    transition: transform 0.1s;
    padding: 0; /* Remove default padding */
}

.winamp-player button:active {
    transform: scale(0.95);
    border-style: none; /* Override default bevel */
}

.winamp-player .btn-play {
    width: 30px; /* Smaller play button */
    height: 30px;
    border-radius: 50%;
    border: 2px solid #aaa; /* Thinner border */
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.winamp-player .btn-pause {
    font-size: 18px;
}
.winamp-player .btn-prev, .winamp-player .btn-next {
    font-size: 14px;
}

/* Browser Window Styles */
.browser-toolbar {
    display: flex;
    gap: 5px;
    padding: 2px;
    background: var(--win-gray);
    border-bottom: 2px solid var(--win-gray-dark);
}

.browser-toolbar input {
    flex-grow: 1;
    border: 2px inset white;
    padding: 2px 5px;
    font-family: inherit;
}

.browser-toolbar button {
    width: auto;
    padding: 0 10px;
    background: var(--win-gray);
    border: 2px outset white;
    cursor: pointer;
}


/* Boot Screen */
.hidden {
    opacity: 0;
}
/* Recycle Bin Grid */
.recycle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    padding: 10px;
}

.recycle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.recycle-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    margin-bottom: 5px;
    border: 1px solid transparent;
}

.recycle-item:hover img {
    border: 1px dotted #888;
    background: rgba(255, 255, 255, 0.1);
}

.recycle-item span {
    font-size: 12px;
    font-family: Tahoma, sans-serif;
    color: #000;
}

/* Boot Screen */
.hidden {
    opacity: 0;
}
/* Boot Screen Terminal Style */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    color: #ccc;
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px; /* Increased from default */
    z-index: 1000000;
    padding: 20px; /* Reduced from 40px */
    display: flex;
    flex-direction: column;
}

.boot-content {
    width: 100%;
    flex-grow: 1; /* Allow content to push footer down */
    display: flex;
    flex-direction: column;
}

.boot-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    font-weight: bold;
    color: #fff;
    font-size: 20px; /* Larger header */
}

/* ... existing styles ... */

@keyframes ring {
    0% { transform: rotate(0); }
    10% { transform: rotate(30deg); }
    30% { transform: rotate(-28deg); }
    50% { transform: rotate(34deg); }
    70% { transform: rotate(-32deg); }
    90% { transform: rotate(30deg); }
    100% { transform: rotate(0); }
}

.ringing {
    animation: ring 1s ease-in-out;
    transform-origin: top center;
}

.boot-info {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Increased gap */
    flex-grow: 1;
}

.boot-footer {
    margin-top: auto; /* Push to bottom */
    padding-bottom: 20px;
    text-align: center;
    width: 100%;
    position: absolute; /* Ensure it's at the very bottom */
    bottom: 20px;
    left: 0;
}

.blink {
    animation: blinker 1s linear infinite;
}

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

/* Star graphic simulation */
.energy-star::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: -20px;
    width: 120%;
    height: 2px;
    background: #ffff00;
}

.energy-star span {
    font-size: 40px;
    font-weight: bold;
    font-family: 'Impact', sans-serif; /* Blocky font */
    letter-spacing: 2px;
}

.star-icon {
    font-size: 50px;
    line-height: 1;
}

.boot-info {
    margin: 20px 0;
}

.boot-info .row {
    display: flex;
    margin-bottom: 8px;
    font-size: 16px;
}

.boot-info .label {
    width: 250px;
    color: #888; /* Darker grey for labels */
}

.boot-footer {
    margin-top: auto;
    padding-bottom: 20px;
}

.boot-footer p {
    margin: 5px 0;
    color: #aaa;
}

.blink {
    animation: blink 1s step-end infinite;
    color: #fff; /* Brighter for prompt */
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}





/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    /* Boot Screen Mobile */
    #boot-screen {
        padding: 10px;
        font-size: 14px;
    }
    .boot-header {
        font-size: 16px;
    }
    .boot-header img {
        width: 80px !important; /* Smaller mascot */
    }
    .boot-footer {
        position: fixed;
        bottom: 20px;
    }

    /* Mobile Windows: Centered using transform */
    /* Mobile Windows: Centered using transform */
    .window {
        width: 85vw !important; /* Slightly narrower */
        max-width: 95% !important;
        height: auto !important;
        max-height: 70vh !important; /* Shorter to catch overflow */
        left: 50% !important;
        transform: translateX(-50%) !important;
        top: 60px !important; /* Higher up */
        box-sizing: border-box !important;
        margin: 0 !important;
        overflow: hidden !important; /* Let content scroll */
    }

    /* Ensure content inside scrolls if needed */
    .window-content {
        max-height: calc(70vh - 40px) !important; /* Subtract title bar height */
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* Ensure title bar fits */
    .title-bar {
        padding: 4px; /* Larger hit area */
        height: 30px; /* Taller header */
        display: flex;
        align-items: center;
    }
    
    /* Make buttons easier to tap */
    .title-bar-controls button {
        width: 24px;
        height: 20px;
        min-width: 24px;
        font-size: 14px;
        margin-left: 4px;
    }

    .title-bar-text {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-grow: 1;
    }

    /* Start Menu adjustments */
    .start-menu {
        width: 250px;
    }
    
    /* Hide Day if space is tight, or just keep it small */
    #clock {
        font-size: 12px;
    }

    /* Adjust Desktop Grid - JS calculates this, but providing a fallback safety */
    .desktop-icon {
        /* On very small screens, maybe ensure they don't overflow right */
        max-width: 80px;
    }
    
    /* Recycle Bin always bottom right, ensure it fits */
    .desktop-icon[id="recycle"] {
        right: 10px;
        bottom: 50px;
    }
}
