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

body {
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
    font-size: 11px;
    overflow: hidden;
    height: 100vh;
}

/* Desktop */
.desktop {
    background: #008080;
    width: 100%;
    height: calc(100vh - 28px);
    position: relative;
    padding: 10px;
    overflow: hidden;
}

@media (max-width: 800px) {
    .desktop {
        height: calc(100vh - 24px);
        padding: 5px;
    }
}

@media (max-width: 500px) {
    .desktop {
        height: calc(100vh - 20px);
        padding: 3px;
    }
}

/* Desktop Icons */
.icon {
    width: 70px;
    min-width: 50px;
    max-width: 70px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    user-select: none;
    margin: 5px;
    transition: opacity 0.2s;
    transform-origin: top left;
}

/* Scale icons based on container size */
@media (max-width: 800px) {
    .icon {
        width: 60px;
        max-width: 60px;
    }
    .icon-image {
        width: 28px !important;
        height: 28px !important;
    }
}

@media (max-width: 500px) {
    .icon {
        width: 50px;
        max-width: 50px;
    }
    .icon-image {
        width: 24px !important;
        height: 24px !important;
    }
    .icon-label {
        font-size: 9px !important;
        max-width: 50px !important;
    }
}

.icon[draggable="true"] {
    cursor: move;
}

.icon:hover {
    background: rgba(0, 0, 128, 0.3);
    outline: 1px dotted #ffffff;
}

.icon.drag-over {
    background: rgba(0, 0, 128, 0.5);
    outline: 2px solid #ffffff;
}

.icon.selected {
    background: rgba(0, 0, 128, 0.5);
    outline: 1px dotted #ffffff;
}

.icon-image {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
}

.icon-label {
    color: #ffffff;
    text-align: center;
    font-size: 11px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    word-wrap: break-word;
    max-width: 70px;
    overflow-wrap: break-word;
}

/* Taskbar */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #c0c0c0;
    border-top: 1px solid #ffffff;
    display: flex;
    align-items: center;
    padding: 2px;
    z-index: 10000;
}

@media (max-width: 800px) {
    .taskbar {
        height: 24px;
    }
    .start-button {
        height: 20px !important;
        font-size: 9px !important;
    }
    .taskbar-button {
        height: 18px !important;
        font-size: 9px !important;
        min-width: 80px !important;
    }
    .clock {
        font-size: 9px !important;
    }
}

@media (max-width: 500px) {
    .taskbar {
        height: 20px;
    }
    .start-button {
        height: 16px !important;
        font-size: 8px !important;
    }
    .taskbar-button {
        height: 14px !important;
        font-size: 8px !important;
        min-width: 60px !important;
    }
    .clock {
        font-size: 8px !important;
    }
}

.start-button {
    height: 24px;
    padding: 0 5px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11px;
}

.start-button:active,
.start-button.active {
    border-style: inset;
    padding-left: 7px;
    padding-top: 2px;
}

.start-logo {
    display: flex;
    align-items: center;
}

.start-text {
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
}

.taskbar-windows {
    flex: 1;
    display: flex;
    gap: 2px;
    padding: 0 2px;
    overflow-x: auto;
}

.taskbar-button {
    height: 22px;
    min-width: 120px;
    max-width: 160px;
    padding: 0 5px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    cursor: pointer;
    font-size: 11px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.taskbar-button:hover {
    background: #dfdfdf;
}

.taskbar-button.active {
    border-style: inset;
    background: #a9a9a9;
}

.system-tray {
    height: 22px;
    border: 1px inset #808080;
    padding: 2px 8px;
    background: #c0c0c0;
    display: flex;
    align-items: center;
}

.clock {
    font-size: 11px;
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
}

/* Start Menu */
.start-menu {
    position: fixed;
    bottom: 28px;
    left: 0;
    width: 200px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    display: none;
    z-index: 9999;
}

.start-menu.show {
    display: block;
}

.start-menu-banner {
    background: linear-gradient(to right, #000080, #0000ff);
    color: #ffffff;
    padding: 5px 10px;
    height: 100%;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 20px;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 25px;
}

.banner-text {
    transform: rotate(180deg);
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
}

.start-menu-items {
    margin-left: 25px;
    padding: 2px;
}

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

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

.menu-icon {
    font-size: 16px;
}

.menu-separator {
    height: 1px;
    background: #808080;
    margin: 2px 0;
    border-top: 1px solid #ffffff;
}

/* Windows */
.window {
    position: absolute;
    min-width: 300px;
    min-height: 200px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 1;
    resize: both;
    overflow: hidden;
}

@media (max-width: 800px) {
    .window {
        min-width: 200px;
        min-height: 150px;
        font-size: 9px;
    }
}

@media (max-width: 500px) {
    .window {
        min-width: 150px;
        min-height: 100px;
        font-size: 8px;
    }
}

.window.active {
    z-index: 100;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    z-index: 10;
}

.resize-handle.resize-right {
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    cursor: e-resize;
}

/* Larger touch target for right edge on mobile */
@media (hover: none) and (pointer: coarse) {
    .resize-handle.resize-right {
        width: 12px;
        right: -4px;
    }
}

.resize-handle.resize-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    cursor: s-resize;
}

/* Larger touch target for bottom edge on mobile */
@media (hover: none) and (pointer: coarse) {
    .resize-handle.resize-bottom {
        height: 12px;
        bottom: -4px;
    }
}

.resize-handle.resize-corner {
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nw-resize;
    background: #c0c0c0;
}

/* Larger touch target for corner on mobile */
@media (hover: none) and (pointer: coarse) {
    .resize-handle.resize-corner {
        width: 24px;
        height: 24px;
        right: -4px;
        bottom: -4px;
    }
}

.resize-handle.resize-corner::after {
    content: '';
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 12px;
    height: 12px;
    background-image:
        linear-gradient(135deg, transparent 0%, transparent 45%, #808080 45%, #808080 55%, transparent 55%),
        linear-gradient(135deg, transparent 0%, transparent 35%, #808080 35%, #808080 45%, transparent 45%),
        linear-gradient(135deg, transparent 0%, transparent 25%, #808080 25%, #808080 35%, transparent 35%);
}

.title-bar {
    background: linear-gradient(to right, #000080, #1084d0);
    color: #ffffff;
    padding: 2px 2px 2px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    height: 22px;
}

.window:not(.active) .title-bar {
    background: linear-gradient(to right, #808080, #a0a0a0);
}

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

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

.title-bar-button {
    width: 16px;
    height: 14px;
    background: #c0c0c0;
    border: 1px outset #ffffff;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Larger touch target for title bar buttons on mobile */
@media (hover: none) and (pointer: coarse) {
    .title-bar-button {
        width: 32px;
        height: 28px;
        font-size: 16px;
    }

    .title-bar-button.close {
        font-size: 20px;
    }
}

.title-bar-button:active {
    border-style: inset;
}

.title-bar-button.close {
    font-size: 14px;
}

.window-body {
    padding: 10px;
    background: #ffffff;
    height: calc(100% - 22px);
    overflow: auto;
    box-sizing: border-box;
}

/* Window-specific styles */
.notepad-window {
    width: 500px;
    height: 400px;
}

@media (max-width: 800px) {
    .notepad-window {
        width: 350px;
        height: 280px;
    }
}

@media (max-width: 500px) {
    .notepad-window {
        width: 250px;
        height: 200px;
    }
}

.notepad-window .window-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.notepad-menu {
    background: #c0c0c0;
    border-bottom: 1px solid #808080;
    padding: 2px 5px;
    display: flex;
    gap: 10px;
}

.notepad-menu-item {
    padding: 2px 8px;
    cursor: pointer;
    font-size: 11px;
}

.notepad-menu-item:hover {
    background: #000080;
    color: #ffffff;
}

.notepad-content {
    flex: 1;
    display: flex;
    padding: 2px;
}

.notepad-textarea {
    width: 100%;
    height: 100%;
    border: 1px inset #808080;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 5px;
    resize: none;
    box-sizing: border-box;
}

.calculator-window {
    min-width: 220px;
    min-height: 280px;
    max-width: 220px;
    max-height: 280px;
}

.calculator-body {
    background: #c0c0c0;
    padding: 5px;
}

.calculator-display {
    background: #ffffff;
    border: 2px inset #808080;
    padding: 5px;
    text-align: right;
    font-family: 'Digital', monospace;
    font-size: 18px;
    margin-bottom: 5px;
    height: 30px;
    line-height: 30px;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}

.calc-button {
    background: #c0c0c0;
    border: 2px outset #ffffff;
    padding: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.calc-button:active {
    border-style: inset;
}

.about-window {
    min-width: 400px;
    min-height: 250px;
}

.about-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    height: 100%;
}

.about-logo {
    font-size: 48px;
    background: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #0000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.about-text {
    text-align: center;
    line-height: 1.5;
}

.win95-button {
    background: #c0c0c0;
    border: 2px outset #ffffff;
    padding: 5px 20px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
}

.win95-button:active {
    border-style: inset;
}

/* Minesweeper */
.minesweeper-window {
    min-width: 320px;
}

.minesweeper-body {
    background: #c0c0c0;
    padding: 5px;
}

.minesweeper-header {
    background: #c0c0c0;
    border: 2px inset #808080;
    padding: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.minesweeper-counter {
    background: #000000;
    color: #ff0000;
    font-family: 'Digital', monospace;
    font-size: 18px;
    padding: 2px 5px;
    border: 1px inset #808080;
}

.minesweeper-face {
    width: 26px;
    height: 26px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minesweeper-face:active {
    border-style: inset;
}

.minesweeper-grid {
    border: 2px inset #808080;
    display: inline-block;
}

.minesweeper-row {
    display: flex;
}

.mine-cell {
    width: 20px;
    height: 20px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mine-cell.revealed {
    border: 1px solid #808080;
    background: #bdbdbd;
}

.mine-cell.flagged::after {
    content: '🚩';
    font-size: 12px;
}

/* Internet Explorer */
.internet-window {
    width: 700px;
    height: 500px;
}

.internet-window .window-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100% - 22px);
}

@media (max-width: 800px) {
    .internet-window {
        width: 500px;
        height: 350px;
    }
}

@media (max-width: 500px) {
    .internet-window {
        width: 300px;
        height: 250px;
    }
}

/* p03m.exe */
.p03m-window {
    width: 700px;
    height: 500px;
}

.p03m-window .window-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100% - 22px);
}

@media (max-width: 800px) {
    .p03m-window {
        width: 500px;
        height: 350px;
    }
}

@media (max-width: 500px) {
    .p03m-window {
        width: 300px;
        height: 250px;
    }
}

.browser-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.browser-toolbar {
    background: #c0c0c0;
    padding: 5px;
    border-bottom: 1px solid #808080;
    display: flex;
    align-items: center;
}

.browser-address-bar {
    flex: 1;
    padding: 3px 5px;
    border: 2px inset #808080;
    background: #ffffff;
    font-size: 11px;
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
}

.browser-go-button {
    margin-left: 5px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    padding: 3px 15px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
}

.browser-go-button:active {
    border-style: inset;
}

.browser-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #ffffff;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    padding: 2px;
    z-index: 10001;
    display: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    padding: 4px 20px;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
}

.context-menu-item:hover {
    background: #000080;
    color: #ffffff;
}

/* Image Viewer */
.image-viewer-window {
    width: 600px;
    height: 500px;
}

.image-viewer-window .window-body {
    padding: 0;
    background: #c0c0c0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

@media (max-width: 800px) {
    .image-viewer-window {
        width: 400px;
        height: 350px;
    }
}

@media (max-width: 500px) {
    .image-viewer-window {
        width: 250px;
        height: 200px;
    }
}
