:root {
  --face: #ece9d8;
  --face-dark: #d6d2c2;
  --shadow: #aca899;
  --dark-shadow: #716f64;
  --navy: #000080;
  --select: #316ac5;
  --win-border: #0831d9;
  --title: linear-gradient(180deg, #0997ff 0%, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7 100%);
  --title-inactive: linear-gradient(180deg, #a6b9ef 0%, #7a96df 10%, #7a96df 85%, #6c87d6 100%);
  --taskbar: linear-gradient(180deg, #1f2f86 0%, #3165c4 3%, #3682e5 6%, #4490e6 10%, #3883e5 12%, #2b71e0 15%, #2663da 18%, #235bd6 20%, #2258d5 23%, #2157d6 38%, #245ddb 54%, #2562df 86%, #245fdc 89%, #2158d4 92%, #1d4ec0 95%, #1941a5 98%);
  --ui-font: Tahoma, "Segoe UI", Verdana, Geneva, sans-serif;
  --taskbar-h: 40px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 13px/1.45 var(--ui-font);
  color: #000;
  background: #3a6ea5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pixelated { image-rendering: pixelated; }
button { font: inherit; color: inherit; }
kbd { font: 11px var(--ui-font); color: #555; }

/* ---------- Desktop ---------- */
.desktop {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  background:
    radial-gradient(ellipse 90% 60% at 18% 112%, #6cbf3a 0 55%, transparent 56%),
    radial-gradient(ellipse 80% 55% at 88% 118%, #4f9e2c 0 55%, transparent 56%),
    radial-gradient(ellipse 60% 18% at 70% 22%, rgba(255,255,255,.75) 0 40%, transparent 70%),
    radial-gradient(ellipse 40% 12% at 22% 14%, rgba(255,255,255,.6) 0 40%, transparent 70%),
    linear-gradient(180deg, #1c5fd1 0%, #3d86e8 35%, #8cc4f5 70%, #cfe8fb 100%);
  overflow: hidden;
}
.icons {
  position: absolute; top: 12px; left: 10px;
  display: flex; flex-direction: column; gap: 6px; z-index: 1;
}
.icon {
  width: 84px; padding: 4px 2px; border: 1px dotted transparent; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff; text-decoration: none; cursor: pointer; text-align: center;
}
.icon img { width: 40px; height: 40px; filter: drop-shadow(1px 2px 1px rgba(0,0,0,.35)); }
.icon span { font-size: 12px; padding: 0 3px; text-shadow: 1px 1px 2px #000; }
.icon:focus-visible, .icon.selected { border-color: #fff; outline: none; }
.icon:focus-visible span, .icon.selected span { background: var(--select); text-shadow: none; }

/* ---------- Windows ---------- */
.window {
  position: absolute;
  display: flex; flex-direction: column;
  background: var(--face);
  border: 3px solid var(--win-border);
  border-top: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 2px 4px 14px rgba(0,0,0,.35);
  min-width: 260px;
  max-height: calc(100% - 8px);
}
.window[hidden] { display: none; }
.window.minimized { display: none; }
.window.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
.title-bar {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 4px 0 6px;
  background: var(--title);
  border-radius: 7px 7px 0 0;
  color: #fff; font: bold 13px "Trebuchet MS", var(--ui-font);
  text-shadow: 1px 1px #0f1089;
  cursor: default; user-select: none; touch-action: none;
  flex: none;
}
.window:not(.active) .title-bar { background: var(--title-inactive); text-shadow: none; }
.window:not(.active) { border-color: #7a96df; }
.title-bar img { width: 16px; height: 16px; }
.title-bar span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.controls { display: flex; gap: 2px; }
.controls button {
  width: 22px; height: 22px; padding: 0; position: relative; cursor: pointer;
  border: 1px solid #fff; border-radius: 3px;
  background: linear-gradient(180deg, #3c8cfe, #1756e6);
}
.controls button.close { background: linear-gradient(180deg, #e88a6e, #c4401f); }
.controls button:hover { filter: brightness(1.12); }
.controls button::before, .controls button::after { content: ""; position: absolute; background: #fff; }
.controls .min::before { left: 5px; bottom: 5px; width: 8px; height: 3px; }
.controls .max::before { left: 4px; top: 4px; width: 12px; height: 12px; background: none; border: 2px solid #fff; border-top-width: 3px; }
.controls .close::before, .controls .close::after { left: 9px; top: 3px; width: 2.5px; height: 14px; transform: rotate(45deg); }
.controls .close::after { transform: rotate(-45deg); }
.window-body { padding: 14px 16px; overflow: auto; }

/* ---------- Buttons ---------- */
.xp-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 75px; padding: 5px 14px;
  border: 1px solid #003c74; border-radius: 3px;
  background: linear-gradient(180deg, #fff 0%, #ecebe6 86%, #d6d0c5 100%);
  color: #000; text-decoration: none; cursor: pointer; font-size: 13px;
}
.xp-btn:hover { box-shadow: inset 0 0 0 2px #f8b636; }
.xp-btn:active { background: linear-gradient(180deg, #e3e2da, #f1f0ea); }
.xp-btn.primary { box-shadow: inset 0 0 0 1px #9dbdf2, inset 0 0 0 2px #6a9be8; font-weight: bold; }
.xp-btn.primary:hover { box-shadow: inset 0 0 0 2px #f8b636; }
.xp-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

/* ---------- Welcome ---------- */
.welcome { background: linear-gradient(180deg, #fff 0, #fff 60%, var(--face) 100%); }
.hero { display: flex; gap: 16px; align-items: center; }
.hero-icon { flex: none; filter: drop-shadow(2px 3px 3px rgba(0,0,0,.25)); }
.eyebrow { margin: 0; color: #2d5bb9; font-weight: bold; letter-spacing: .04em; text-transform: uppercase; font-size: 11px; }
.hero-title {
  margin: 0; font: 700 46px/1 "Pixelify Sans", var(--ui-font);
  color: #0a3cbe; text-shadow: 3px 3px 0 #ffd23f;
}
.hero-title span { color: #d72e1d; }
.lede { margin: 8px 0 0; font-size: 14px; color: #222; }
.cta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.facts { list-style: none; padding: 0; margin: 14px 0 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.facts li { background: #fff; border: 1px solid var(--shadow); border-radius: 3px; padding: 6px 4px; text-align: center; font-size: 11px; color: #444; }
.facts b { display: block; font: 700 22px "Pixelify Sans", var(--ui-font); color: #0a3cbe; }
.tip { display: flex; gap: 6px; align-items: center; margin: 10px 0 0; font-size: 12px; color: #555; }
.tip img { width: 16px; }

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.dl {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-decoration: none; color: #fff;
  border: 1px solid #1e5c1e; border-radius: 4px;
  background: linear-gradient(180deg, #5fc35f 0%, #3a9a3a 45%, #2f8a2f 55%, #3fa83f 100%);
  box-shadow: inset 0 1px rgba(255,255,255,.5), 1px 2px 3px rgba(0,0,0,.25);
  text-shadow: 1px 1px 1px rgba(0,0,0,.4);
}
.dl:hover { filter: brightness(1.08); }
.dl:active { filter: brightness(.95); box-shadow: inset 1px 1px 3px rgba(0,0,0,.4); }
.dl:focus-visible { outline: 2px dotted #000; outline-offset: 2px; }
.dl img { width: 32px; height: 32px; flex: none; filter: drop-shadow(1px 1px 1px rgba(0,0,0,.3)); }
.dl b { display: block; font-size: 14px; }
.dl small { display: block; font-size: 10.5px; opacity: .92; line-height: 1.3; }
.dl-note { margin: 6px 0 0; }

/* ---------- Paint window ---------- */
.menubar { display: flex; gap: 0; padding: 1px 2px; border-bottom: 1px solid #fff; flex: none; }
.menu { position: relative; }
.menu > button { border: 0; background: none; padding: 3px 8px; cursor: default; }
.menu > button:hover, .menu.open > button { background: var(--select); color: #fff; }
.menu-list {
  display: none; position: absolute; top: 100%; left: 0; z-index: 50;
  min-width: 180px; padding: 2px; background: #fff;
  border: 1px solid var(--dark-shadow); box-shadow: 2px 2px 3px rgba(0,0,0,.35);
}
.menu.open .menu-list { display: block; }
.menu-list button { display: flex; justify-content: space-between; width: 100%; border: 0; background: none; text-align: left; padding: 4px 18px; cursor: default; }
.menu-list button:hover { background: var(--select); color: #fff; }
.menu-list button:hover kbd { color: #fff; }
.menu-list hr { border: 0; border-top: 1px solid var(--shadow); margin: 3px 1px; }

.paint-body { display: flex; flex: 1; min-height: 0; }
.toolbox { width: 58px; padding: 4px 3px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tools { display: grid; grid-template-columns: 25px 25px; }
.tool {
  width: 25px; height: 25px; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--face);
  border: 1px solid; border-color: #fff var(--dark-shadow) var(--dark-shadow) #fff;
  box-shadow: inset -1px -1px var(--shadow);
}
.tool img { width: 16px; height: 16px; }
.tool[aria-pressed="true"] {
  border-color: var(--dark-shadow) #fff #fff var(--dark-shadow);
  box-shadow: inset 1px 1px var(--shadow);
  background: repeating-conic-gradient(#fff 0 25%, var(--face) 0 50%) 0 0 / 2px 2px;
}
.tool[aria-pressed="true"] img { transform: translate(1px, 1px); }
.tool.disabled img { opacity: .35; filter: grayscale(1); }
.options {
  width: 44px; min-height: 66px; padding: 2px;
  border: 1px solid; border-color: var(--shadow) #fff #fff var(--shadow);
  display: flex; flex-direction: column; align-items: stretch; gap: 1px;
}
.options.grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.opt { border: 0; background: none; padding: 2px 0; display: grid; place-items: center; cursor: pointer; min-height: 12px; }
.opt.on { background: var(--navy); }
.opt canvas { image-rendering: pixelated; }

.workspace {
  flex: 1; min-width: 0; overflow: auto; background: #808080; padding: 4px;
  border: 1px solid; border-color: var(--shadow) #fff #fff var(--shadow);
}
#canvas {
  display: block; background: #fff; image-rendering: pixelated; cursor: crosshair;
  max-width: 100%; height: auto; touch-action: none;
}
.colorbox { display: flex; align-items: center; gap: 4px; padding: 5px 4px; flex: none; flex-wrap: wrap; }
.current {
  position: relative; width: 32px; height: 32px; flex: none;
  border: 1px solid; border-color: var(--shadow) #fff #fff var(--shadow);
}
.current div { position: absolute; width: 14px; height: 14px; border: 1px solid; border-color: var(--dark-shadow) #fff #fff var(--dark-shadow); }
#fg-swatch { left: 5px; top: 5px; }
#bg-swatch { left: 13px; top: 13px; }
.palette { display: grid; grid-template-columns: repeat(14, 16px); }
.swatch { width: 16px; height: 16px; padding: 0; cursor: pointer; border: 1px solid; border-color: var(--dark-shadow) #fff #fff var(--dark-shadow); }
.palette-hint { font-size: 11px; color: #666; margin-left: 6px; }
.statusbar { display: flex; gap: 2px; padding: 2px; flex: none; }
.statusbar span {
  height: 20px; padding: 2px 5px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid; border-color: var(--shadow) #fff #fff var(--shadow);
}
#status-help { flex: 1; }
#status-pos, #status-size { width: 90px; }

/* ---------- Screenshots ---------- */
.tabs { display: flex; gap: 2px; padding-left: 4px; }
.tabs button {
  border: 1px solid #919b9c; border-bottom: 0; border-radius: 3px 3px 0 0; cursor: pointer;
  background: linear-gradient(180deg, #fff, #ecebe5); padding: 4px 14px; position: relative; top: 1px;
}
.tabs button[aria-selected="true"] { background: #fcfcfe; border-top: 3px solid #ffc83c; padding-top: 2px; z-index: 1; }
.tab-panel { border: 1px solid #919b9c; background: #fcfcfe; padding: 12px; }
.tab-panel figure { margin: 0; text-align: center; }
.tab-panel img { max-width: 100%; max-height: 62vh; height: auto; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.tab-panel figcaption { margin-top: 10px; color: #444; }

/* ---------- Features / Get / About ---------- */
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--shadow); border-radius: 4px; padding: 10px; }
.feature-list img { width: 32px; height: 32px; flex: none; }
.feature-list b { display: block; color: #0a3cbe; margin-bottom: 2px; }
.code {
  background: #000; color: #c0c0c0; padding: 10px 12px; margin: 10px 0; overflow: auto;
  font: 12px/1.6 "Lucida Console", Consolas, Menlo, monospace;
  border: 2px solid; border-color: var(--dark-shadow) #fff #fff var(--dark-shadow);
}
.small { font-size: 11px; color: #555; }
.dialog { width: 400px; }
.about { display: flex; gap: 14px; }
.about p { margin: 0 0 8px; }

/* ---------- Taskbar & start menu ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar-h); z-index: 1000;
  display: flex; align-items: stretch; background: var(--taskbar);
}
.start {
  display: flex; align-items: center; gap: 6px; padding: 0 18px 0 10px; border: 0; cursor: pointer;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(180deg, #3c9b3c 0%, #52b952 8%, #3a9a3a 40%, #2f8a2f 88%, #217a21 100%);
  box-shadow: inset -2px 0 3px rgba(0,0,0,.25), 2px 0 4px rgba(0,0,0,.3);
  color: #fff; font: italic bold 19px "Trebuchet MS", var(--ui-font); text-shadow: 1px 1px 2px #222;
}
.start img { width: 24px; height: 24px; }
.start:hover, .start[aria-expanded="true"] { filter: brightness(1.1); }
.tasks { flex: 1; display: flex; gap: 3px; padding: 4px 6px; overflow: hidden; }
.task {
  display: flex; align-items: center; gap: 6px; width: 170px; min-width: 0; padding: 0 8px; cursor: pointer;
  border: 1px solid #1e48b5; border-radius: 3px; color: #fff; font-size: 12px; text-align: left;
  background: linear-gradient(180deg, #3c81f3, #2d6ae0);
}
.task img { width: 16px; height: 16px; }
.task span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.task.active { background: linear-gradient(180deg, #1e52b7, #1a48a8); box-shadow: inset 1px 1px 2px rgba(0,0,0,.4); }
.tray {
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: linear-gradient(180deg, #0c59b9 0%, #139ee9 5%, #18b5f2 10%, #139beb 15%, #1290e8 20%, #0d8dea 75%, #0f84d7 95%, #1e70ca 100%);
  border-left: 1px solid #1042af; color: #fff; font-size: 12px;
}
.tray img { width: 16px; height: 16px; }

.start-menu {
  position: fixed; left: 0; bottom: var(--taskbar-h); z-index: 1001; width: 380px; max-width: 100vw;
  border-radius: 8px 8px 0 0; overflow: hidden; background: #fff;
  box-shadow: 3px -2px 10px rgba(0,0,0,.4); border: 1px solid #0831d9;
}
.start-menu[hidden] { display: none; }
.sm-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--title); color: #fff; font: bold 16px "Trebuchet MS", var(--ui-font); text-shadow: 1px 1px #0f1089; }
.sm-head img { width: 44px; height: 44px; border: 2px solid #fff; border-radius: 4px; background: #fff; }
.sm-body { display: grid; grid-template-columns: 1fr 140px; }
.sm-left { padding: 6px; display: flex; flex-direction: column; }
.sm-right { padding: 6px; background: #d3e5fa; border-left: 1px solid #95bdee; display: flex; flex-direction: column; }
.sm-left button, .sm-right button, .sm-right a {
  display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px; text-align: left; cursor: pointer; color: #000; text-decoration: none; border-radius: 2px;
}
.sm-right button, .sm-right a { font-weight: bold; color: #0a246a; }
.sm-left img { width: 32px; height: 32px; }
.sm-left small { display: block; color: #666; font-size: 11px; }
.sm-left button:hover, .sm-right button:hover, .sm-right a:hover { background: var(--select); color: #fff; }
.sm-left button:hover small { color: #dde; }
.sm-foot { display: flex; justify-content: flex-end; padding: 6px 10px; background: var(--title); }
.sm-foot button { border: 0; background: none; color: #fff; cursor: pointer; font-size: 12px; }

/* ---------- Boot & easter egg ---------- */
.boot { position: fixed; inset: 0; z-index: 3000; background: #000; display: grid; place-items: center; cursor: pointer; transition: opacity .4s; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; color: #fff; }
.boot-title { font: 700 44px "Pixelify Sans", var(--ui-font); margin: 10px 0 26px; }
.boot-title span { color: #ff8a00; }
.boot-bar { width: 160px; height: 18px; margin: 0 auto; border: 2px solid #b2b2b2; border-radius: 4px; padding: 2px; overflow: hidden; }
.boot-blocks { display: flex; gap: 2px; animation: slide 1.4s linear infinite; }
.boot-blocks i { width: 9px; height: 10px; background: linear-gradient(180deg, #2838c7, #6c7cf1 50%, #2838c7); }
@keyframes slide { from { transform: translateX(-40px); } to { transform: translateX(160px); } }
.boot-hint { margin-top: 18px; font-size: 11px; color: #777; }
.safe-off { position: fixed; inset: 0; z-index: 4000; background: #000; display: grid; place-content: center; text-align: center; cursor: pointer; }
.safe-off p { color: #f90; font: bold 26px var(--ui-font); margin: 0 0 8px; }
.safe-off small { color: #777; }
.safe-off[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .boot { display: none; }
  .boot-blocks { animation: none; }
}

/* ---------- Narrow screens: stacked windows ---------- */
@media (max-width: 899px) {
  body { overflow: auto; }
  .desktop { position: relative; inset: auto; min-height: 100vh; padding: 8px 8px calc(var(--taskbar-h) + 12px); overflow: visible; }
  .icons { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; gap: 2px; }
  .icon { width: 76px; flex: none; }
  .window { position: relative; left: auto !important; top: auto !important; width: auto !important; height: auto !important; margin: 10px 0; max-height: none; }
  .controls .max { display: none; }
  .hero { flex-direction: column; text-align: center; }
  .hero-title { font-size: 40px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .downloads { grid-template-columns: 1fr; text-align: left; }
  .cta { justify-content: center; }
  .paint-body { min-height: 0; }
  .tip { display: none; }
  .palette { grid-template-columns: repeat(14, minmax(14px, 20px)); }
  .swatch { width: auto; height: 18px; }
  .palette-hint { display: none; }
  #status-size { display: none; }
  .task { width: 120px; }
  .tray img { display: none; }
  .dialog { width: auto; }
}
