*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: "MS Sans Serif", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #008080;
    color: #000000;
    overflow: hidden;
}

/* Boot screen */

.boot-screen {
    position: fixed;
    inset: 0;
    background-color: #000000;
    color: #00ff00;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    font-family: "Consolas", "Courier New", monospace;
    transition: opacity 0.6s ease;
}

.boot-screen-hidden {
    opacity: 0;
}

.boot-inner {
    width: 90%;
    max-width: 640px;
}

.boot-logo {
    display: block;
    margin: 0 auto 12px;
    max-width: 260px;
    image-rendering: pixelated;
}

.boot-header {
    font-size: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #00ff00;
    padding-bottom: 6px;
}

.boot-body {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 14px;
}

.boot-body p {
    margin-bottom: 2px;
}

.boot-loading {
    margin-bottom: 10px;
}

.boot-bar {
    width: 100%;
    height: 12px;
    border: 1px solid #00ff00;
    position: relative;
    overflow: hidden;
    background-color: #001000;
    margin-bottom: 4px;
}

.boot-bar-fill {
    position: absolute;
    left: -40%;
    top: 0;
    width: 40%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        #00ff00,
        #00ff00 4px,
        #003300 4px,
        #003300 8px
    );
    animation: boot-bar-scan 3s linear infinite;
}

.boot-loading-text {
    font-size: 12px;
    opacity: 0.8;
}

.boot-footer {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 6px;
}

@keyframes boot-bar-scan {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(250%);
    }
}

/* BSOD screen */

.bsod-screen {
    position: fixed;
    inset: 0;
    background-color: #0000aa;
    color: #ffffff;
    font-family: "Lucida Console", "Consolas", "Courier New", monospace;
    display: none;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 40px;
    z-index: 3000;
}

.bsod-screen.active {
    display: flex;
}

.bsod-inner {
    max-width: 720px;
    font-size: 14px;
    line-height: 1.6;
}

.bsod-logo {
    display: block;
    margin-bottom: 16px;
    max-width: 120px;
    image-rendering: pixelated;
}

/* Desktop and windows */

.desktop {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 8px;
    padding-bottom: 44px;
}

.desktop-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.desktop-icon {
    width: 72px;
    text-align: center;
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
}

.desktop-icon:hover span {
    text-decoration: underline;
}

.icon-image {
    width: 48px;
    height: 48px;
    margin: 0 auto 4px;
    background-color: #c0c0c0;
    border: 2px solid #ffffff;
    border-right-color: #808080;
    border-bottom-color: #808080;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    image-rendering: pixelated;
}

/* Per icon backgrounds */

.desktop-icon-welcome .icon-image {
    background-image: url("images/home_icon.png");
}

.desktop-icon-convert .icon-image {
    background-image: url("images/convert.png");
}

.desktop-icon-qr .icon-image {
    background-image: url("images/qr_icon.png");
}

.desktop-icon-recipes .icon-image {
    background-image: url("images/recipes_icon.png");
}

.desktop-icon-write .icon-image {
    background-image: url("images/write.png");
}

.window {
    position: absolute;
    top: 80px;
    left: 120px;
    min-width: 280px;
    max-width: 640px;
    background-color: #c0c0c0;
    border: 2px solid #000000;
    box-shadow: 2px 2px 0 #000000;
    display: none;
}

.window.active {
    display: block;
}

.window-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to right, #000080, #1084d0);
    color: #ffffff;
    padding: 2px 4px;
    cursor: move;
}

.window-title {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.window-title-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    image-rendering: pixelated;
}

.window-controls {
    display: flex;
    gap: 2px;
}

.window-btn {
    width: 18px;
    height: 16px;
    border: 1px solid #000000;
    background-color: #c0c0c0;
    font-size: 10px;
    line-height: 12px;
    padding: 0;
    cursor: pointer;
}

.window-btn:active {
    border-top-color: #808080;
    border-left-color: #808080;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.window-content {
    padding: 8px 10px 10px;
    font-size: 13px;
}

.window-content h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.tagline {
    margin-bottom: 12px;
    font-style: italic;
}

.window-section {
    margin-top: 12px;
    padding: 8px;
    background-color: #d4d0c8;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
}

.window-section h2,
.window-section h3 {
    font-size: 14px;
    margin-bottom: 6px;
}

.window-section p {
    margin-bottom: 6px;
}

.button-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.win95-button {
    display: inline-block;
    padding: 4px 10px;
    background-color: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    text-decoration: none;
    color: #000000;
    font-size: 12px;
}

.win95-button:active {
    border-top-color: #404040;
    border-left-color: #404040;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

/* Under construction bar */

.construction-banner {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 44px;
    padding: 4px 6px 6px;
    background-color: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
    font-size: 11px;
}

.construction-text {
    font-weight: bold;
    margin-bottom: 3px;
}

.construction-bar {
    position: relative;
    height: 10px;
    border: 2px solid #000000;
    margin-bottom: 3px;
    background-color: #ffffff;
    overflow: hidden;
}

.construction-bar-fill {
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        #000080,
        #000080 4px,
        #00ffff 4px,
        #00ffff 8px
    );
    animation: construction-scan 3s linear infinite;
}

.construction-footer {
    font-size: 10px;
}

@keyframes construction-scan {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(250%);
    }
}

/* Taskbar and start menu */

.taskbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 36px;
    background-color: #c0c0c0;
    border-top: 2px solid #ffffff;
    display: flex;
    align-items: center;
    padding: 2px 4px;
    z-index: 1000;
}

.start-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    background-color: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    cursor: pointer;
    font-size: 12px;
}

.start-button:active,
.taskbar.start-open .start-button {
    border-top-color: #404040;
    border-left-color: #404040;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.start-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
    image-rendering: pixelated;
}

.taskbar-spacer {
    flex: 1;
}

.taskbar-clock {
    min-width: 60px;
    text-align: center;
    font-size: 12px;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    padding: 2px 4px;
    background-color: #c0c0c0;
}

.start-menu {
    position: fixed;
    left: 4px;
    bottom: 36px;
    width: 240px;
    background-color: #c0c0c0;
    border: 2px solid #000000;
    box-shadow: 2px 2px 0 #000000;
    display: none;
    z-index: 1100;
}

.taskbar.start-open .start-menu {
    display: block;
}

.start-menu-header {
    background: linear-gradient(to bottom, #000080, #1084d0);
    color: #ffffff;
    padding: 6px;
    font-weight: bold;
    font-size: 13px;
}

.start-menu-list {
    list-style: none;
    padding: 4px;
}

.start-menu-item {
    width: 100%;
    text-align: left;
    padding: 4px 6px;
    font-size: 13px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.start-menu-item:hover {
    background-color: #000080;
    color: #ffffff;
}

.start-menu-icon {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
}

.start-menu-separator {
    border-bottom: 1px solid #808080;
    margin: 4px 2px;
}

/* Responsive tweaks */

@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .desktop {
        padding: 4px;
        padding-bottom: 60px;
    }

    .desktop-icons {
        gap: 10px;
    }

    .window {
        top: 70px;
        left: 8px;
        right: auto;
        max-width: none;
    }

    .construction-banner {
        bottom: 40px;
        left: 4px;
        right: 4px;
    }

    .boot-inner {
        max-width: 90%;
    }

    .bsod-screen {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .desktop-icons {
        gap: 8px;
    }

    .desktop-icon {
        width: 60px;
        font-size: 11px;
    }

    .window-content {
        font-size: 12px;
    }

    .window-content h1 {
        font-size: 18px;
    }
}
