:root {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --font-family: 'Fira Code', monospace;

    /* XP Colors */
    --xp-blue: #0055EA;
    --xp-blue-gradient-top: #0058EE;
    --xp-blue-gradient-bottom: #3593FF;
    --xp-taskbar-color: #245EDC;
    --xp-start-green: #38A755;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tahoma', sans-serif;
    /* XP System Font */
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(to bottom, #6591E8 0%, #FFFFFF 100%);
    /* Fallback for Bliss */
    background-image: url('bliss.png');
    /* Local Bliss wallpaper */
    background-size: cover;
    background-position: center;
    user-select: none;
}

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

.desktop-icon {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    color: white;
    text-shadow: 1px 1px 1px black;
    /* Authentic XP shadow */
}

.desktop-icon:hover {
    opacity: 0.8;
}

.desktop-icon img {
    width: 32px;
    /* XP default icon size */
    height: 32px;
    margin-bottom: 5px;
}

.desktop-icon span {
    font-size: 11px;
    line-height: 1.2;
    padding: 1px 3px;
}

.desktop-icon:active span {
    background-color: #0B61A4;
}

/* Window */
.window {
    position: absolute;
    top: 50px;
    left: 50px;
    width: 800px;
    height: 500px;
    background-color: #ECE9D8;
    /* XP Window Background */
    border: 3px solid #0055EA;
    /* Thicker blue border */
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 3px;
}

.window-header {
    height: 30px;
    background: linear-gradient(to bottom, #0058EE 0%, #3593FF 4%, #288EFB 18%, #1978FA 50%, #0055EA 100%);
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    cursor: default;
}

.window-title {
    color: white;
    font-weight: bold;
    font-size: 13px;
    text-shadow: 1px 1px 1px #000;
    display: flex;
    align-items: center;
    gap: 5px;
}

.window-title img {
    width: 16px;
    height: 16px;
}

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

.window-btn {
    width: 21px;
    height: 21px;
    border: 1px solid white;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: sans-serif;
    font-size: 12px;
    cursor: pointer;
    background: transparent;
    box-shadow: inset 1px 1px 0px rgba(255, 255, 255, 0.5), 1px 1px 1px rgba(0, 0, 0, 0.3);
}

.minimize-btn {
    background: linear-gradient(to bottom, #4A81F5, #2858BA);
    align-items: flex-end;
    font-weight: bold;
}

.maximize-btn {
    background: linear-gradient(to bottom, #4A81F5, #2858BA);
    font-weight: bold;
}

.close-btn {
    background: linear-gradient(to bottom, #E86848, #C52814);
    border-color: #fff;
    font-weight: bold;
    font-size: 14px;
}

.window-content {
    flex-grow: 1;
    background-color: white;
    border: 1px solid #999;
    margin-top: 2px;
    position: relative;
    overflow: hidden;
}

/* Terminal inside Window */
.terminal-container {
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.terminal-header {
    display: none;
    /* Hide original terminal header */
}

.terminal-body {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
}

/* Taskbar */
#taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, #245EDC 0%, #3E87EB 10%, #245EDC 100%);
    display: flex;
    align-items: center;
    z-index: 9999;
    border-top: 1px solid #fff;
}

#start-button {
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-right: 10px;
    transition: opacity 0.2s;
    background: linear-gradient(to bottom, #38A755 0%, #44C767 10%, #38A755 100%);
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    padding: 0 10px 0 5px;
    color: white;
    font-weight: bold;
    font-style: italic;
    font-size: 14px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

#start-button:hover {
    filter: brightness(1.1);
}

#start-button img {
    width: 18px;
    height: 18px;
    margin-right: 5px;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.3));
}

.taskbar-items {
    flex-grow: 1;
    display: flex;
    gap: 5px;
    padding-left: 10px;
}

.taskbar-item {
    width: 150px;
    height: 24px;
    background-color: #3E87EB;
    border-radius: 3px;
    display: flex;
    align-items: center;
    padding: 0 5px;
    color: white;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.5);
}

.taskbar-item:hover {
    background-color: #5CA3FF;
}

.taskbar-item.active {
    background-color: #1E52B7;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.5);
}

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

#system-tray {
    background-color: #0B77E9;
    height: 100%;
    padding: 0 15px;
    display: flex;
    align-items: center;
    color: white;
    font-size: 11px;
    border-left: 1px solid #18569E;
    box-shadow: inset 1px 0 2px rgba(0, 0, 0, 0.3);
}

/* Terminal Specifics */
.welcome-message,
.output-line,
.command-executed,
.response {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.command-highlight {
    color: #79c0ff;
    font-weight: bold;
}

.prompt {
    color: #3fb950;
    margin-right: 10px;
    white-space: nowrap;
}

#command-input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1rem;
    flex-grow: 1;
    outline: none;
    caret-color: #58a6ff;
    min-width: 0;
    /* Allow input to shrink */
}

.response.error {
    color: #f85149;
}

/* Pre-formatted text (like fastfetch) needs special handling */
.response {
    white-space: pre-wrap;
    /* css-3 */
    white-space: -moz-pre-wrap;
    /* Mozilla, since 1999 */
    white-space: -pre-wrap;
    /* Opera 4-6 */
    white-space: -o-pre-wrap;
    /* Opera 7 */
    word-wrap: break-word;
    /* Internet Explorer 5.5+ */
}

/* Scrollbar */
.terminal-body::-webkit-scrollbar {
    width: 10px;
}

.terminal-body::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 5px;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    .window {
        width: 100% !important;
        height: calc(100% - 30px) !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0;
    }

    .terminal-body {
        font-size: 0.9rem;
        /* Smaller font on mobile */
        padding: 5px;
    }

    .desktop-icon {
        margin: 5px;
    }
}

/* Container Query for Window (Simulated) */
.window-content {
    container-type: inline-size;
}

@container (max-width: 500px) {
    .terminal-body {
        font-size: 0.85rem;
    }

    .prompt {
        font-size: 0.85rem;
    }

    #command-input {
        font-size: 0.85rem;
    }
}

/* Paint App Styles */
.paint-toolbar {
    background-color: #f0f0f0;
    border-bottom: 1px solid #808080;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.paint-tools {
    display: flex;
    gap: 5px;
}

.paint-tool {
    width: 30px;
    height: 30px;
    border: 1px solid #808080;
    background-color: #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.paint-tool:active,
.paint-tool.active {
    border: 1px solid #404040;
    background-color: #e0e0e0;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.paint-palette {
    width: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    background-color: #f0f0f0;
    border: 1px solid #808080;
    padding: 2px;
    align-content: flex-start;
}

.paint-color {
    width: 16px;
    height: 16px;
    border: 1px solid #808080;
    cursor: pointer;
}

.paint-color.active {
    border: 2px solid #000000;
    z-index: 1;
}

.paint-canvas-container {
    flex: 1;
    background-color: #808080;
    padding: 2px;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#paint-canvas {
    background-color: white;
    cursor: crosshair;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
}

/* BSOD Styles */
#bsod {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000082;
    color: white;
    font-family: 'Courier New', monospace;
    z-index: 99999;
    padding: 100px;
    font-size: 20px;
    font-weight: bold;
    cursor: none;
    display: flex;
    justify-content: center;
}

.bsod-content {
    max-width: 800px;
    line-height: 1.5;
}

.bsod-content p {
    margin-bottom: 20px;
}

/* Notepad Styles */
.notepad-menu-bar {
    height: 20px;
    background-color: #ECE9D8;
    border-bottom: 1px solid #ACA899;
    display: flex;
    font-size: 11px;
    color: black;
    align-items: center;
    position: relative;
    z-index: 10;
}

.notepad-menu-item {
    position: relative;
    padding: 2px 6px;
    cursor: default;
}

.notepad-menu-item:hover {
    background-color: #316AC5;
    color: white;
}

.notepad-menu-item.active {
    background-color: #316AC5;
    color: white;
}

.notepad-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid #ACA899;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
    min-width: 150px;
    padding: 2px;
    z-index: 100;
}

.notepad-menu-item.active .notepad-dropdown {
    display: block;
}

/* Fix for inner dropdown items text color inheriting from parent when hovering parent */
.notepad-menu-item:hover .notepad-dropdown {
    color: black;
}

.notepad-menu-item.active .notepad-dropdown {
    color: black;
}

.notepad-dropdown-item {
    padding: 2px 15px 2px 5px;
    /* Extra right padding for accelerators ideally */
    cursor: default;
}

.notepad-dropdown-item:hover {
    background-color: #316AC5;
    color: white;
}

.notepad-dropdown-separator {
    height: 1px;
    background-color: #ACA899;
    margin: 3px 2px;
}

.notepad-textarea {
    flex-grow: 1;
    border: none;
    resize: none;
    outline: none;
    font-family: 'Lucida Console', monospace;
    font-size: 14px;
    padding: 2px;
    overflow: auto;
}

/* Generic Button Styles for Dialogs */
button {
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
}

/* Explorer Styles */
.explorer-toolbar {
    height: 36px;
    background-color: #ECE9D8;
    border-bottom: 1px solid #ACA899;
    display: flex;
    align-items: center;
    padding: 0 5px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    padding: 2px 5px;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
}

.toolbar-btn:hover {
    border: 1px solid #ACA899;
    background-color: #F8F8F8;
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

.toolbar-btn:active {
    background-color: #DDD;
    box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.1);
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background-color: #ACA899;
    margin: 0 5px;
}

.toolbar-icon {
    font-size: 16px;
    /* In reality these would be images */
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.go-btn {
    background: url('icons/go-button.png') no-repeat center;
    /* Mock */
    background-color: #38A755;
    color: white;
    padding: 2px 5px;
    font-size: 11px;
    margin-left: 2px;
    cursor: pointer;
    border: 1px solid #1C672B;
    border-radius: 2px;
}

.explorer-sidebar {
    width: 200px;
    background: linear-gradient(to bottom, #7BA2E7 0%, #6375D6 100%);
    padding: 10px;
    color: white;
    flex-shrink: 0;
}

.sidebar-box {
    background-color: white;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.sidebar-header {
    background: linear-gradient(to right, #ffffff 0%, #C6D3F7 100%);
    color: #215DC6;
    font-weight: bold;
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
}

.sidebar-content {
    background-color: #D6DFF7;
    padding: 5px 10px;
    color: #215DC6;
    font-size: 11px;
}

.sidebar-item {
    padding: 2px 0;
    cursor: pointer;
}

.sidebar-item:hover {
    color: #000;
    text-decoration: underline;
}

.explorer-main {
    flex-grow: 1;
    background-color: white;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 20px;
}

/* File/Folder Items in Grid */
.file-item {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: default;
    padding: 2px;
    border: 1px solid transparent;
}

.file-item:hover {
    background-color: #E8F0FF;
    border: 1px solid #CDE0FA;
}

.file-item.selected {
    background-color: #316AC5;
    color: white;
    border: 1px solid #316AC5;
}

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

.file-item span {
    font-size: 11px;
    word-break: break-word;
}

/* Rover Styles */
.search-pane-header {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
    color: white;
}

.search-pane-content {
    background-color: #D6DFF7;
    /* Light Blue */
    color: black;
    padding: 10px;
    height: calc(100% - 30px);
    overflow-y: auto;
}

.rover-container {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
}

#rover-img {
    width: 80px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s;
    animation: rover-breath 3s infinite ease-in-out;
}

#rover-img:hover {
    transform: scale(1.1);
    animation-play-state: paused;
}

@keyframes rover-breath {

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

    50% {
        transform: translateY(-2px) scale(1.02);
    }
}

/* Calculator Styles */
.calc-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.calc-btn {
    width: 100%;
    height: 28px;
    font-size: 11px;
    font-family: 'Tahoma', sans-serif;
    color: #000;
    border: 1px solid #003c74;
    border-radius: 3px;
    background: linear-gradient(to bottom, #fff 0%, #ece9d8 100%);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.calc-btn:active {
    background: #d1cfc7;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.calc-btn.text-red {
    color: #aa0000;
}

.calc-btn.text-blue {
    color: #0000aa;
}

/* Adjust top row to span */
.calc-buttons>button:nth-child(1) {
    grid-column: span 2;
}

/* Backspace */
.calc-buttons>button:nth-child(2) {
    grid-column: span 2;
}

/* CE */
.calc-buttons>button:nth-child(3) {
    grid-column: span 2;
}

/* C */

.rover-bubble {
    position: absolute;
    top: -20px;
    left: 20px;
    background: #FFffe1;
    border: 1px solid #000;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 11px;
    display: none;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
}

.search-form {
    font-size: 11px;
}

.search-form p {
    margin-bottom: 10px;
}