Beveled Win98 Desktop OS
Authentic teal desktop, 2px 3D outset/inset silver-gray bevels, navy-to-sky gradient titlebars, and working Start Menu.
Inspired by 98.js ↗
WHY THIS AESTHETIC IS UNIQUE
Recreates the unmistakable tactile geometry of late-90s Windows 98 with pixel-accurate 3D bevel borders, clickable desktop icons, interactive mini-apps, and a live taskbar.
BEST FOR
TAGS
COLOR PALETTE (CLICK TO COPY HEX)
TYPOGRAPHY
- Display
- VT323
- Body
- Tahoma, sans-serif
- Mono
- IBM Plex Mono
- Scale
- Crisp 12–14px system UI labels inside beveled chrome, bold white titlebar text over a navy-to-cerulean gradient, and monospace Notepad text.
ARCHITECTURE & MOBILE NOTES
LAYOUT
Full-viewport teal desktop with left-aligned icon column, layered 3D beveled application windows, popup Start Menu, and pinned bottom taskbar with live clock.
INTERACTION
Clickable desktop icons opening System Properties, editable Notepad, and an interactive mini Pixel Paint canvas, plus working Start Menu, window minimize/focus, and taskbar buttons.
MOBILE
Fits active application windows cleanly within 390px viewports with touchable >=44px Start button, icon triggers, and zero horizontal overflow.
AI AGENT GUARDRAILS
DO
- Construct 3D bevels using contrasting 2px top-left highlights (#FFFFFF) and bottom-right shadows (#404040/#808080).
- Use the iconic #000080 to #1084D0 horizontal gradient on focused window titlebars.
- Keep every taskbar button, Start Menu item, and window close button genuinely interactive.
DON'T
- Never apply modern border-radius or soft blur shadows to Win98 chrome.
- Avoid non-functional static mockups; users expect desktop icons and Start menus to open.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Win98 Classic Desktop — Beveled 3D OS</title>
<style>
:root {
--teal: #008080;
--silver: #c0c0c0;
--silver-light: #dfdfdf;
--white: #ffffff;
--gray-dark: #808080;
--black: #000000;
--navy: #000080;
--sky: #1084d0;
--font-ui: 'Tahoma', 'MS Sans Serif', 'Segoe UI', Geneva, sans-serif;
--font-mono: 'Courier New', Courier, monospace;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
height: 100%;
width: 100%;
overflow-x: hidden;
font-family: var(--font-ui);
font-size: 13px;
color: var(--black);
background: var(--teal);
user-select: none;
}
body.clouds-bg {
background: linear-gradient(180deg, #5d9ce6 0%, #9ac6f5 55%, #dcecff 100%);
}
/* Authentic Win98 2px Bevels */
.bevel-out {
background: var(--silver);
border-top: 2px solid var(--white);
border-left: 2px solid var(--white);
border-right: 2px solid var(--black);
border-bottom: 2px solid var(--black);
box-shadow: inset -1px -1px 0 var(--gray-dark), inset 1px 1px 0 var(--silver-light);
}
.bevel-in {
background: var(--white);
border-top: 2px solid var(--gray-dark);
border-left: 2px solid var(--gray-dark);
border-right: 2px solid var(--white);
border-bottom: 2px solid var(--white);
box-shadow: inset 1px 1px 0 var(--black);
}
.win-btn {
background: var(--silver);
border-top: 2px solid var(--white);
border-left: 2px solid var(--white);
border-right: 2px solid var(--black);
border-bottom: 2px solid var(--black);
box-shadow: inset -1px -1px 0 var(--gray-dark);
color: var(--black);
font-family: var(--font-ui);
font-size: 12px;
padding: 5px 12px;
min-height: 30px;
cursor: pointer;
}
.win-btn:active, .win-btn.pressed {
border-top: 2px solid var(--black);
border-left: 2px solid var(--black);
border-right: 2px solid var(--white);
border-bottom: 2px solid var(--white);
box-shadow: inset 1px 1px 0 var(--gray-dark);
padding: 6px 11px 4px 13px;
}
/* Desktop Surface */
.desktop {
position: relative;
width: 100%;
min-height: calc(100vh - 44px);
padding: 12px 10px 64px;
}
.icon-grid {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 12px;
}
.desktop-icon {
width: 82px;
min-height: 76px;
padding: 6px 4px;
background: transparent;
border: 1px dotted transparent;
color: var(--white);
display: flex;
flex-direction: column;
align-items: center;
gap: 5px;
cursor: pointer;
text-align: center;
font-size: 12px;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75);
}
.desktop-icon:focus-visible, .desktop-icon.selected {
background: rgba(0, 0, 128, 0.45);
border-color: #ffff80;
outline: none;
}
/* Windows */
.win98-window {
width: 100%;
max-width: 100%;
padding: 3px;
margin-bottom: 12px;
display: none;
flex-direction: column;
}
.win98-window.is-open {
display: flex;
}
.win98-window.is-minimized {
display: none;
}
.titlebar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 4px 6px;
min-height: 30px;
background: linear-gradient(90deg, #808080, #b5b5b5);
color: #dfdfdf;
font-weight: 700;
font-size: 12px;
cursor: default;
}
.win98-window.is-active .titlebar {
background: linear-gradient(90deg, var(--navy), var(--sky));
color: var(--white);
}
.titlebar-left {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.titlebar-left span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.titlebar-controls {
display: flex;
gap: 3px;
flex-shrink: 0;
}
.ctrl-btn {
width: 24px;
height: 22px;
padding: 0;
min-height: 22px;
font-weight: 700;
font-size: 12px;
line-height: 1;
display: grid;
place-items: center;
}
.win-content {
padding: 10px;
display: flex;
flex-direction: column;
gap: 10px;
}
/* System Properties Tabs */
.tab-strip {
display: flex;
gap: 2px;
padding-left: 2px;
}
.tab-btn {
padding: 6px 12px;
min-height: 34px;
background: var(--silver);
border-top: 2px solid var(--white);
border-left: 2px solid var(--white);
border-right: 2px solid var(--black);
border-bottom: 0;
cursor: pointer;
font-family: var(--font-ui);
font-size: 12px;
}
.tab-btn.active {
position: relative;
top: 2px;
padding-bottom: 8px;
font-weight: 700;
z-index: 2;
}
.tab-panel {
padding: 12px;
border-top: 2px solid var(--white);
border-left: 2px solid var(--white);
border-right: 2px solid var(--black);
border-bottom: 2px solid var(--black);
background: var(--silver);
}
.sys-grid {
display: grid;
grid-template-columns: 76px 1fr;
gap: 12px;
align-items: start;
}
.sys-specs p {
margin-bottom: 5px;
line-height: 1.35;
}
.sys-specs h3 {
font-size: 12px;
margin: 8px 0 4px;
color: var(--navy);
}
.device-list {
list-style: none;
padding: 8px;
line-height: 1.7;
font-family: var(--font-ui);
}
/* Notepad */
.menu-strip {
display: flex;
flex-wrap: wrap;
gap: 4px;
border-bottom: 1px solid var(--gray-dark);
padding-bottom: 4px;
}
.menu-item {
background: transparent;
border: 1px solid transparent;
padding: 4px 8px;
min-height: 30px;
font-family: var(--font-ui);
font-size: 12px;
cursor: pointer;
}
.menu-item:hover {
background: var(--navy);
color: var(--white);
}
.notepad-area {
width: 100%;
min-height: 170px;
padding: 8px;
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.45;
resize: vertical;
outline: none;
user-select: text;
}
.statusbar {
display: flex;
justify-content: space-between;
gap: 6px;
font-size: 11px;
}
.status-cell {
padding: 3px 6px;
border-top: 1px solid var(--gray-dark);
border-left: 1px solid var(--gray-dark);
border-right: 1px solid var(--white);
border-bottom: 1px solid var(--white);
flex: 1;
}
/* Pixel Paint */
.paint-toolbar {
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
}
.paint-canvas-wrap {
padding: 4px;
background: var(--gray-dark);
overflow: hidden;
}
#paint-canvas {
display: block;
width: 100%;
height: auto;
background: var(--white);
cursor: crosshair;
touch-action: none;
image-rendering: pixelated;
}
.palette-row {
display: grid;
grid-template-columns: repeat(8, 1fr);
gap: 4px;
}
.color-swatch {
height: 28px;
min-height: 28px;
border: 2px solid var(--gray-dark);
cursor: pointer;
}
.color-swatch.active {
outline: 2px solid var(--black);
outline-offset: -4px;
}
/* Taskbar */
.taskbar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 800;
height: 44px;
padding: 4px 6px;
display: flex;
align-items: center;
gap: 6px;
background: var(--silver);
border-top: 2px solid var(--white);
}
.start-btn {
display: inline-flex;
align-items: center;
gap: 6px;
font-weight: 700;
min-height: 36px;
padding: 4px 10px;
flex-shrink: 0;
}
.taskbar-windows {
display: flex;
align-items: center;
gap: 4px;
flex: 1;
min-width: 0;
overflow-x: auto;
}
.task-btn {
min-height: 34px;
padding: 4px 8px;
font-size: 12px;
max-width: 148px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
flex: 1 1 80px;
}
.task-btn.active {
font-weight: 700;
background: #dcdcdc;
border-top: 2px solid var(--black);
border-left: 2px solid var(--black);
border-right: 2px solid var(--white);
border-bottom: 2px solid var(--white);
}
.tray {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 8px;
min-height: 32px;
border-top: 1.5px solid var(--gray-dark);
border-left: 1.5px solid var(--gray-dark);
border-right: 1.5px solid var(--white);
border-bottom: 1.5px solid var(--white);
font-size: 12px;
flex-shrink: 0;
}
/* Start Menu Popup */
.start-menu {
position: fixed;
left: 6px;
bottom: 46px;
width: 248px;
max-width: calc(100vw - 12px);
z-index: 900;
display: none;
padding: 2px;
}
.start-menu.open {
display: grid;
grid-template-columns: 28px 1fr;
}
.start-banner {
background: linear-gradient(180deg, var(--navy), var(--sky));
color: var(--white);
display: flex;
align-items: flex-end;
justify-content: center;
padding-bottom: 10px;
font-weight: 700;
font-size: 15px;
letter-spacing: 0.04em;
}
.start-banner span {
writing-mode: vertical-rl;
transform: rotate(180deg);
}
.start-list {
list-style: none;
padding: 4px 0;
}
.start-item {
width: 100%;
min-height: 40px;
padding: 6px 12px;
background: transparent;
border: 0;
display: flex;
align-items: center;
gap: 10px;
font-family: var(--font-ui);
font-size: 13px;
color: var(--black);
cursor: pointer;
text-align: left;
}
.start-item:hover {
background: var(--navy);
color: var(--white);
}
.start-divider {
height: 2px;
margin: 4px 8px;
border-top: 1px solid var(--gray-dark);
border-bottom: 1px solid var(--white);
}
/* Desktop Floating Layout */
@media (min-width: 860px) {
.desktop {
height: calc(100vh - 44px);
padding: 16px;
overflow: hidden;
}
.icon-grid {
flex-direction: column;
width: 90px;
}
.win98-window {
position: absolute;
margin-bottom: 0;
}
.titlebar {
cursor: move;
}
#win-sys {
top: 24px;
left: 124px;
width: 410px;
}
#win-notepad {
top: 64px;
left: 556px;
width: 390px;
}
#win-paint {
top: 295px;
left: 170px;
width: 410px;
}
}
</style>
</head>
<body>
<main class="desktop" id="desktop">
<div class="icon-grid" aria-label="Desktop Icons">
<button class="desktop-icon" data-open="win-sys">
<svg width="34" height="34" viewBox="0 0 34 34" aria-hidden="true">
<rect x="4" y="4" width="26" height="19" fill="#c0c0c0" stroke="#000" stroke-width="2"/>
<rect x="7" y="7" width="20" height="13" fill="#008080" stroke="#000" stroke-width="1"/>
<rect x="12" y="23" width="10" height="3" fill="#808080" stroke="#000" stroke-width="1"/>
<rect x="6" y="26" width="22" height="4" fill="#c0c0c0" stroke="#000" stroke-width="1.5"/>
</svg>
<span>My Computer</span>
</button>
<button class="desktop-icon" data-open="win-notepad">
<svg width="34" height="34" viewBox="0 0 34 34" aria-hidden="true">
<rect x="6" y="4" width="22" height="26" fill="#fff" stroke="#000" stroke-width="2"/>
<rect x="6" y="4" width="22" height="6" fill="#1084d0" stroke="#000" stroke-width="1.5"/>
<path d="M10 14h14M10 19h14M10 24h10" stroke="#000" stroke-width="1.5"/>
</svg>
<span>Notepad.exe</span>
</button>
<button class="desktop-icon" data-open="win-paint">
<svg width="34" height="34" viewBox="0 0 34 34" aria-hidden="true">
<rect x="4" y="6" width="26" height="22" fill="#fff" stroke="#000" stroke-width="2"/>
<circle cx="11" cy="14" r="3" fill="#ff0000"/>
<circle cx="19" cy="12" r="3" fill="#0000ff"/>
<circle cx="23" cy="20" r="3" fill="#008000"/>
<path d="M9 24l14-12" stroke="#804000" stroke-width="2.5"/>
</svg>
<span>Paint.exe</span>
</button>
</div>
<!-- WINDOW: SYSTEM PROPERTIES -->
<section class="win98-window bevel-out is-open is-active" id="win-sys" style="z-index: 20;" aria-label="System Properties">
<div class="titlebar" data-drag>
<div class="titlebar-left">
<span>System Properties</span>
</div>
<div class="titlebar-controls">
<button class="win-btn ctrl-btn" data-min="win-sys" aria-label="Minimize">_</button>
<button class="win-btn ctrl-btn" data-close="win-sys" aria-label="Close">×</button>
</div>
</div>
<div class="win-content">
<div class="tab-strip" role="tablist">
<button class="tab-btn active" data-systab="general" role="tab">General</button>
<button class="tab-btn" data-systab="devices" role="tab">Device Manager</button>
<button class="tab-btn" data-systab="perf" role="tab">Performance</button>
</div>
<div class="tab-panel" id="tab-general">
<div class="sys-grid">
<svg width="68" height="68" viewBox="0 0 68 68" aria-hidden="true">
<rect x="8" y="8" width="52" height="38" fill="#c0c0c0" stroke="#000" stroke-width="2"/>
<rect x="13" y="13" width="42" height="28" fill="#008080" stroke="#000" stroke-width="1.5"/>
<rect x="18" y="18" width="12" height="10" fill="#ff3b30"/>
<rect x="33" y="18" width="12" height="10" fill="#34c759"/>
<rect x="18" y="30" width="12" height="8" fill="#007aff"/>
<rect x="33" y="30" width="12" height="8" fill="#ffcc00"/>
<rect x="24" y="46" width="20" height="6" fill="#808080" stroke="#000" stroke-width="1.5"/>
<rect x="14" y="52" width="40" height="7" fill="#c0c0c0" stroke="#000" stroke-width="2"/>
</svg>
<div class="sys-specs">
<h3>System:</h3>
<p>Classic Desktop OS 98<br>Second Edition 4.10.2222 A</p>
<h3>Registered to:</h3>
<p>Studio Workstation<br>OEM-98042-771-39401</p>
<h3>Computer:</h3>
<p>Pentium II 350 MHz<br>64.0 MB RAM (SDRAM)</p>
</div>
</div>
</div>
<div class="tab-panel" id="tab-devices" hidden>
<ul class="device-list bevel-in">
<li>[+] Display adapters — 3dfx Voodoo3 2000 AGP</li>
<li>[+] Sound, video & game — Sound Blaster Live!</li>
<li>[+] Network adapters — 3Com Fast EtherLink XL</li>
<li>[+] Disk drives — Quantum Fireball 8.4 GB IDE</li>
<li>[+] Floppy controllers — Standard 3.5" 1.44 MB</li>
</ul>
</div>
<div class="tab-panel" id="tab-perf" hidden>
<div class="sys-specs">
<p><strong>Memory:</strong> 64.0 MB of RAM</p>
<p><strong>System Resources:</strong> 84% free</p>
<p><strong>File System:</strong> 32-bit FAT32</p>
<p><strong>Virtual Memory:</strong> 32-bit managed swap</p>
<p style="margin-top:8px;">Your system is configured for optimal 1998 performance.</p>
</div>
</div>
<div style="display:flex; justify-content:flex-end; gap:8px;">
<button class="win-btn" id="toggle-bg-btn">Toggle Sky Wallpaper</button>
<button class="win-btn" data-close="win-sys">OK</button>
</div>
</div>
</section>
<!-- WINDOW: NOTEPAD -->
<section class="win98-window bevel-out is-open" id="win-notepad" style="z-index: 18;" aria-label="Notepad">
<div class="titlebar" data-drag>
<div class="titlebar-left">
<span>README.TXT — Notepad</span>
</div>
<div class="titlebar-controls">
<button class="win-btn ctrl-btn" data-min="win-notepad" aria-label="Minimize">_</button>
<button class="win-btn ctrl-btn" data-close="win-notepad" aria-label="Close">×</button>
</div>
</div>
<div class="win-content">
<div class="menu-strip">
<button class="menu-item" id="np-new">New</button>
<button class="menu-item" id="np-time">Time/Date</button>
<button class="menu-item" id="np-sample">Restore Sample</button>
</div>
<textarea class="notepad-area bevel-in" id="notepad-text" aria-label="Notepad text editor">WELCOME TO CLASSIC 98 DESKTOP
=============================
- Click Start below to launch apps.
- Drag window titlebars on desktop.
- Open Paint.exe to sketch pixel art.
- Everything runs locally with zero dependencies.
Tip: Click Time/Date above to stamp your notes.</textarea>
<div class="statusbar">
<div class="status-cell" id="np-count">Lines: 7 | Chars: 221</div>
<div class="status-cell" style="flex:0 0 auto;">UTF-8</div>
</div>
</div>
</section>
<!-- WINDOW: PIXEL PAINT -->
<section class="win98-window bevel-out is-open" id="win-paint" style="z-index: 16;" aria-label="Pixel Paint">
<div class="titlebar" data-drag>
<div class="titlebar-left">
<span>untitled.bmp — Pixel Paint</span>
</div>
<div class="titlebar-controls">
<button class="win-btn ctrl-btn" data-min="win-paint" aria-label="Minimize">_</button>
<button class="win-btn ctrl-btn" data-close="win-paint" aria-label="Close">×</button>
</div>
</div>
<div class="win-content">
<div class="paint-toolbar">
<button class="win-btn pressed" id="tool-pen">Pencil</button>
<button class="win-btn" id="tool-eraser">Eraser</button>
<button class="win-btn" id="tool-clear">Clear</button>
<span style="margin-left:auto; font-size:11px;" id="paint-coords">0, 0 px</span>
</div>
<div class="paint-canvas-wrap bevel-in">
<canvas id="paint-canvas" width="320" height="176"></canvas>
</div>
<div class="palette-row" id="paint-palette" aria-label="Color palette"></div>
</div>
</section>
</main>
<!-- START MENU -->
<nav class="start-menu bevel-out" id="start-menu" aria-label="Start Menu">
<div class="start-banner"><span>Windows 98</span></div>
<ul class="start-list">
<li><button class="start-item" data-open="win-sys">System Properties</button></li>
<li><button class="start-item" data-open="win-notepad">Notepad (README.TXT)</button></li>
<li><button class="start-item" data-open="win-paint">Pixel Paint</button></li>
<li class="start-divider" role="separator"></li>
<li><button class="start-item" id="start-wallpaper">Switch Desktop Teal / Sky</button></li>
<li><button class="start-item" id="start-cascade">Cascade All Windows</button></li>
</ul>
</nav>
<!-- TASKBAR -->
<footer class="taskbar" role="contentinfo">
<button class="win-btn start-btn" id="start-btn" aria-expanded="false" aria-controls="start-menu">
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
<rect x="1" y="1" width="6" height="6" fill="#ff3b30"/>
<rect x="9" y="1" width="6" height="6" fill="#34c759"/>
<rect x="1" y="9" width="6" height="6" fill="#007aff"/>
<rect x="9" y="9" width="6" height="6" fill="#ffcc00"/>
</svg>
<span>Start</span>
</button>
<div class="taskbar-windows" id="taskbar-windows" aria-label="Open windows"></div>
<div class="tray" aria-label="System tray">
<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true">
<path d="M2 5h3l4-3v10L5 9H2z" fill="#000"/>
<path d="M11 4.5c1 1 1 4 0 5" fill="none" stroke="#000" stroke-width="1.4"/>
</svg>
<span id="tray-clock">12:00 PM</span>
</div>
</footer>
<script>
const WIN_META = {
'win-sys': 'System Properties',
'win-notepad': 'README.TXT',
'win-paint': 'Pixel Paint'
};
let zTop = 30;
const startBtn = document.getElementById('start-btn');
const startMenu = document.getElementById('start-menu');
const taskbarWrap = document.getElementById('taskbar-windows');
function closeStartMenu() {
startMenu.classList.remove('open');
startBtn.classList.remove('pressed');
startBtn.setAttribute('aria-expanded', 'false');
}
function renderTaskbar() {
taskbarWrap.innerHTML = '';
Object.entries(WIN_META).forEach(([id, label]) => {
const win = document.getElementById(id);
if (!win.classList.contains('is-open')) return;
const btn = document.createElement('button');
btn.className = 'win-btn task-btn' + (win.classList.contains('is-active') && !win.classList.contains('is-minimized') ? ' active' : '');
btn.textContent = label;
btn.addEventListener('click', () => {
if (win.classList.contains('is-minimized')) {
win.classList.remove('is-minimized');
focusWindow(win);
} else if (win.classList.contains('is-active')) {
win.classList.add('is-minimized');
win.classList.remove('is-active');
renderTaskbar();
} else {
focusWindow(win);
}
});
taskbarWrap.appendChild(btn);
});
}
function focusWindow(win) {
document.querySelectorAll('.win98-window').forEach(w => w.classList.remove('is-active'));
win.classList.add('is-open', 'is-active');
win.classList.remove('is-minimized');
zTop += 1;
win.style.zIndex = zTop;
renderTaskbar();
}
function openWindow(id) {
const win = document.getElementById(id);
if (!win) return;
focusWindow(win);
if (window.innerWidth < 860) {
win.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
closeStartMenu();
}
startBtn.addEventListener('click', (e) => {
e.stopPropagation();
const isOpen = startMenu.classList.toggle('open');
startBtn.classList.toggle('pressed', isOpen);
startBtn.setAttribute('aria-expanded', String(isOpen));
});
document.addEventListener('click', (e) => {
if (!startMenu.contains(e.target) && e.target !== startBtn) closeStartMenu();
});
document.querySelectorAll('[data-open]').forEach(el => {
el.addEventListener('click', () => openWindow(el.dataset.open));
});
document.querySelectorAll('[data-close]').forEach(btn => {
btn.addEventListener('click', (e) => {
e.stopPropagation();
const win = document.getElementById(btn.dataset.close);
win.classList.remove('is-open', 'is-active', 'is-minimized');
renderTaskbar();
});
});
document.querySelectorAll('[data-min]').forEach(btn => {
btn.addEventListener('click', (e) => {
e.stopPropagation();
const win = document.getElementById(btn.dataset.min);
win.classList.add('is-minimized');
win.classList.remove('is-active');
renderTaskbar();
});
});
// Desktop Dragging
document.querySelectorAll('.win98-window').forEach(win => {
win.addEventListener('pointerdown', () => focusWindow(win));
const bar = win.querySelector('[data-drag]');
bar.addEventListener('pointerdown', (e) => {
if (window.innerWidth < 860 || e.target.closest('button')) return;
focusWindow(win);
const rect = win.getBoundingClientRect();
const desk = document.getElementById('desktop').getBoundingClientRect();
const ox = e.clientX - rect.left;
const oy = e.clientY - rect.top;
bar.setPointerCapture(e.pointerId);
const onMove = (ev) => {
const left = Math.max(0, Math.min(desk.width - rect.width, ev.clientX - desk.left - ox));
const top = Math.max(0, Math.min(desk.height - 40, ev.clientY - desk.top - oy));
win.style.left = `${left}px`;
win.style.top = `${top}px`;
};
const onUp = () => {
bar.removeEventListener('pointermove', onMove);
bar.removeEventListener('pointerup', onUp);
};
bar.addEventListener('pointermove', onMove);
bar.addEventListener('pointerup', onUp);
});
});
// System Properties Tabs
document.querySelectorAll('[data-systab]').forEach(tab => {
tab.addEventListener('click', () => {
const key = tab.dataset.systab;
document.querySelectorAll('[data-systab]').forEach(t => t.classList.toggle('active', t === tab));
['general', 'devices', 'perf'].forEach(k => {
document.getElementById(`tab-${k}`).hidden = k !== key;
});
});
});
function toggleWallpaper() {
document.body.classList.toggle('clouds-bg');
closeStartMenu();
}
document.getElementById('toggle-bg-btn').addEventListener('click', toggleWallpaper);
document.getElementById('start-wallpaper').addEventListener('click', toggleWallpaper);
document.getElementById('start-cascade').addEventListener('click', () => {
['win-sys', 'win-notepad', 'win-paint'].forEach((id, i) => {
const w = document.getElementById(id);
w.classList.add('is-open');
w.classList.remove('is-minimized');
if (window.innerWidth >= 860) {
w.style.left = `${130 + i * 36}px`;
w.style.top = `${28 + i * 36}px`;
}
focusWindow(w);
});
closeStartMenu();
});
// Notepad Logic
const npText = document.getElementById('notepad-text');
const npCount = document.getElementById('np-count');
const SAMPLE_NOTE = npText.value;
function updateNpCount() {
const lines = npText.value.split('\n').length;
npCount.textContent = `Lines: ${lines} | Chars: ${npText.value.length}`;
}
npText.addEventListener('input', updateNpCount);
document.getElementById('np-new').addEventListener('click', () => {
npText.value = '';
updateNpCount();
npText.focus();
});
document.getElementById('np-time').addEventListener('click', () => {
npText.value += `\n[${new Date().toLocaleString()}]`;
updateNpCount();
});
document.getElementById('np-sample').addEventListener('click', () => {
npText.value = SAMPLE_NOTE;
updateNpCount();
});
// Pixel Paint Canvas
const canvas = document.getElementById('paint-canvas');
const ctx = canvas.getContext('2d');
const coordsEl = document.getElementById('paint-coords');
const COLORS = ['#000000', '#808080', '#800000', '#ff0000', '#008000', '#00ff00', '#808000', '#ffff00', '#000080', '#0000ff', '#800080', '#ff00ff', '#008080', '#00ffff', '#c0c0c0', '#ffffff'];
let paintColor = '#000080';
let tool = 'pen';
let drawing = false;
function initPaintArt() {
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Little starter retro sunset mountain doodle
ctx.fillStyle = '#008080';
ctx.fillRect(0, 0, 320, 110);
ctx.fillStyle = '#ffff00';
ctx.beginPath();
ctx.arc(250, 44, 22, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = '#000080';
ctx.beginPath();
ctx.moveTo(0, 110); ctx.lineTo(85, 42); ctx.lineTo(170, 110); ctx.fill();
ctx.fillStyle = '#800080';
ctx.beginPath();
ctx.moveTo(110, 110); ctx.lineTo(205, 55); ctx.lineTo(320, 110); ctx.fill();
ctx.fillStyle = '#008000';
ctx.fillRect(0, 110, 320, 66);
}
const paletteEl = document.getElementById('paint-palette');
COLORS.forEach(hex => {
const b = document.createElement('button');
b.className = 'color-swatch' + (hex === paintColor ? ' active' : '');
b.style.background = hex;
b.setAttribute('aria-label', `Select color ${hex}`);
b.addEventListener('click', () => {
paintColor = hex;
tool = 'pen';
document.getElementById('tool-pen').classList.add('pressed');
document.getElementById('tool-eraser').classList.remove('pressed');
paletteEl.querySelectorAll('.color-swatch').forEach(s => s.classList.toggle('active', s === b));
});
paletteEl.appendChild(b);
});
function getCanvasPt(e) {
const r = canvas.getBoundingClientRect();
return {
x: Math.floor(((e.clientX - r.left) / r.width) * canvas.width),
y: Math.floor(((e.clientY - r.top) / r.height) * canvas.height)
};
}
function paintAt(pt) {
ctx.fillStyle = tool === 'eraser' ? '#ffffff' : paintColor;
const sz = tool === 'eraser' ? 12 : 6;
ctx.fillRect(pt.x - sz / 2, pt.y - sz / 2, sz, sz);
coordsEl.textContent = `${pt.x}, ${pt.y} px`;
}
canvas.addEventListener('pointerdown', (e) => {
drawing = true;
canvas.setPointerCapture(e.pointerId);
paintAt(getCanvasPt(e));
});
canvas.addEventListener('pointermove', (e) => {
const pt = getCanvasPt(e);
coordsEl.textContent = `${pt.x}, ${pt.y} px`;
if (drawing) paintAt(pt);
});
canvas.addEventListener('pointerup', () => { drawing = false; });
document.getElementById('tool-pen').addEventListener('click', () => {
tool = 'pen';
document.getElementById('tool-pen').classList.add('pressed');
document.getElementById('tool-eraser').classList.remove('pressed');
});
document.getElementById('tool-eraser').addEventListener('click', () => {
tool = 'eraser';
document.getElementById('tool-eraser').classList.add('pressed');
document.getElementById('tool-pen').classList.remove('pressed');
});
document.getElementById('tool-clear').addEventListener('click', () => {
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, canvas.width, canvas.height);
});
// Live Clock
function tickClock() {
document.getElementById('tray-clock').textContent = new Date().toLocaleTimeString([], {
hour: 'numeric',
minute: '2-digit'
});
}
initPaintArt();
updateNpCount();
renderTaskbar();
tickClock();
setInterval(tickClock, 1000);
</script>
</body>
</html>