/* One shared computer. The screen is 512 x 512 for everyone and scales to fit; every size below is in screen px.
   Look: Windows XP Luna (blue), with XP's own icons, wallpapers, cards and sounds (/img, /snd). The window buttons and
   scrollbars are in xpcss.css. */

:root {
  --face: #ece9d8;
  --shadow: #aca899;
  --dark: #716f64;
  --hilite: #ffffff;
  --sel: #316ac5;
  --ui: Tahoma, "Segoe UI", Verdana, sans-serif;
  --title: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  --mono: "Lucida Console", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body { font: 11px/1.25 var(--ui); color: #000; -webkit-font-smoothing: antialiased; }

#stage { position: fixed; inset: 0; overflow: hidden; background: #0a0a0a; }
#screen {
  position: absolute; left: 50%; top: 50%; width: 512px; height: 512px; overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--s, 1)); transform-origin: 50% 50%;
  touch-action: none; user-select: none; -webkit-user-select: none; background: #3a6ea5; cursor: default;
}
#screen canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }

/* ---------------------------------------------------------------- desktop */
#wall { position: absolute; inset: 0; width: 512px; height: 512px; pointer-events: none; object-fit: cover; }
#icons, #wins, #cursors { position: absolute; left: 0; top: 0; width: 512px; height: 482px; pointer-events: none; }
.icon, .win { pointer-events: auto; }
#cursors { pointer-events: none; z-index: 900000; height: 512px; }

.icon {
  position: absolute; width: 64px; height: 62px; display: flex; flex-direction: column; align-items: center;
  padding-top: 2px; text-align: center; color: #fff; touch-action: none;
}
.icon .art { position: relative; width: 32px; height: 32px; flex: none; pointer-events: none; }
.icon .art img { display: block; width: 32px; height: 32px; }
.icon.sel .art::after {
  content: ""; position: absolute; inset: 0; background: #0b61ff; opacity: .5;
  -webkit-mask: var(--art) center / 32px 32px no-repeat; mask: var(--art) center / 32px 32px no-repeat;
}
.icon span {
  margin-top: 3px; padding: 0 2px; max-width: 64px; line-height: 13px; font-size: 11px;
  text-shadow: 1px 1px 1px #000, 0 0 2px #000; pointer-events: none;
}
.icon.sel span { background: #0b61ff; text-shadow: none; outline: 1px dotted #9fc2ff; }
.icon.held { opacity: .75; }

/* ---------------------------------------------------------------- windows */
.win {
  position: absolute; display: flex; flex-direction: column; background: var(--face);
  border-radius: 8px 8px 0 0; padding: 0 3px 3px;
  box-shadow: inset -1px -1px #00138c, inset 1px 1px #0831d9, inset -2px -2px #001ea0, inset 2px 2px #166aee,
    inset -3px -3px #003bda, inset 3px 3px #0855dd, 2px 3px 8px rgba(0, 0, 0, .35);
}
.win.max { border-radius: 0; }
.win.inactive {
  box-shadow: inset -1px -1px #6582d0, inset 1px 1px #8da4e6, inset -2px -2px #7b95d8, inset 2px 2px #a7bbf0,
    inset -3px -3px #8ea6e3, inset 3px 3px #98aee6, 2px 3px 8px rgba(0, 0, 0, .25);
}
.titlebar {
  height: 25px; margin: 0 -3px; padding: 0 3px 0 5px; display: flex; align-items: center; gap: 3px; flex: none;
  border-radius: 7px 7px 0 0; touch-action: none; color: #fff;
  background: linear-gradient(180deg, #0997ff, #0053ee 8%, #0050ee 40%, #06f 88%, #06f 93%, #005bff 95%, #003dd7 96%, #003dd7);
  border: 1px solid #0831d9; border-bottom: 0;
}
.win.max .titlebar { border-radius: 0; }
.win.inactive .titlebar {
  background: linear-gradient(180deg, #a6bdf2, #8ba5e4 8%, #8aa3e2 40%, #95b0ec 88%, #9ab4ee 93%, #8eaaea 95%, #7c97dc 96%, #7c97dc);
  border-color: #8da4e6; color: #d8e4f8;
}
.titlebar img { width: 16px; height: 16px; flex: none; pointer-events: none; }
.titlebar .tt {
  flex: 1; min-width: 0; font: 700 13px/1 var(--title); letter-spacing: .2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; text-shadow: 1px 1px #0f1089; pointer-events: none;
}
.win.inactive .titlebar .tt { text-shadow: none; }
.tbtn {
  width: 21px; height: 21px; flex: none; padding: 0; border: 0; border-radius: 3px; cursor: default;
  background: transparent no-repeat 50% / 21px 21px; image-rendering: pixelated;
}
.tbtn:disabled { opacity: .5; }
.win.inactive .tbtn { opacity: .7; }

.wbody { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

.menubar { height: 18px; flex: none; display: flex; align-items: stretch; padding: 0 1px; border-bottom: 1px solid #fff; box-shadow: 0 1px #aca899; }
.menubar > div { position: relative; }
.menubar .mi { height: 18px; padding: 0 6px; display: flex; align-items: center; color: #000; }
.menubar .mi:hover, .menubar .mi.open { background: var(--sel); color: #fff; }
.menubar .mi.off { color: #000; }
.dropdown {
  position: absolute; left: 0; top: 18px; min-width: 132px; padding: 2px; background: #fff; z-index: 50;
  border: 1px solid #aca899; box-shadow: 2px 2px 3px rgba(0, 0, 0, .3); display: none;
}
.dropdown.open { display: block; }
.dropdown .di { padding: 3px 18px 3px 20px; white-space: nowrap; display: flex; justify-content: space-between; gap: 18px; }
.dropdown .di:hover { background: var(--sel); color: #fff; }
.dropdown .di.dim { color: #aca899; }
.dropdown .di.dim:hover { background: none; color: #aca899; }
.dropdown hr { border: 0; border-top: 1px solid #aca899; margin: 3px 1px; }

.statusbar {
  height: 18px; flex: none; display: flex; align-items: center; padding: 0 4px; gap: 4px; color: #000;
  border-top: 1px solid var(--shadow); background: var(--face); white-space: nowrap; overflow: hidden;
}
.statusbar .cell { padding: 0 6px; border-left: 1px solid var(--shadow); margin-left: auto; min-width: 60px; }

.sunken { border: 1px solid; border-color: var(--shadow) #fff #fff var(--shadow); box-shadow: inset 1px 1px #716f64; }

/* ---------------------------------------------------------------- Paint */
.paint-main { flex: 1; display: flex; gap: 4px; padding: 3px 3px 0; min-height: 0; }
.toolbox { width: 52px; flex: none; display: flex; flex-direction: column; gap: 3px; align-items: center; }
.tools { display: grid; grid-template-columns: 25px 25px; gap: 0; }
.tool {
  width: 25px; height: 25px; padding: 0; display: grid; place-items: center; border: 1px solid transparent;
  background: none; border-radius: 0;
}
.tool:hover { border-color: #fff #716f64 #716f64 #fff; }
.tool.on { border-color: #716f64 #fff #fff #716f64; background: #fff repeating-conic-gradient(#ece9d8 0 25%, #fff 0 50%) 0 0 / 2px 2px; }
.tool img { width: 16px; height: 16px; pointer-events: none; image-rendering: pixelated; }
.toolopts { width: 42px; height: 62px; margin-top: 2px; }
.well { flex: 1; background: #808080; padding: 2px; border: 1px solid; border-color: #716f64 #fff #fff #716f64; position: relative; overflow: hidden; }
.well canvas { display: block; width: 320px; height: 200px; background: #fff; cursor: crosshair; touch-action: none; box-shadow: 1px 1px 0 #404040; }
.palette { height: 36px; flex: none; display: flex; align-items: center; gap: 4px; padding: 3px 3px 1px; }
.curcol { width: 30px; height: 30px; position: relative; flex: none; background: #fff repeating-conic-gradient(#ece9d8 0 25%, #fff 0 50%) 0 0 / 2px 2px; }
.curcol .fg { position: absolute; left: 4px; top: 4px; width: 14px; height: 14px; border: 1px solid #000; outline: 1px solid #fff; z-index: 2; }
.curcol .bg { position: absolute; right: 4px; bottom: 4px; width: 14px; height: 14px; border: 1px solid #000; outline: 1px solid #fff; background: #fff; }
.swatches { display: grid; grid-template-columns: repeat(14, 15px); grid-template-rows: 15px 15px; gap: 0; }
.sw { width: 15px; height: 15px; border: 1px solid; border-color: #716f64 #fff #fff #716f64; padding: 0; }

/* ---------------------------------------------------------------- Minesweeper */
.ms { flex: 1; padding: 6px; background: #c0c0c0; border-left: 3px solid #fff; border-top: 3px solid #fff; display: flex; flex-direction: column; gap: 6px; }
.ms-top {
  height: 37px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 5px;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
}
.ms-top canvas { width: 39px; height: 23px; border: 1px solid; border-color: #808080 #fff #fff #808080; background: #000; }
.smiley {
  width: 26px; height: 26px; padding: 0; display: grid; place-items: center; background: #c0c0c0;
  border: 2px solid; border-color: #fff #808080 #808080 #fff; outline: 1px solid #808080; outline-offset: -1px;
}
.smiley:active { border-color: #808080 #fff #fff #808080; }
.smiley canvas { width: 17px; height: 17px; border: 0; background: none; pointer-events: none; }
.ms-board { border: 3px solid; border-color: #808080 #fff #fff #808080; width: 262px; height: 262px; flex: none; }
.ms-board canvas { display: block; width: 256px; height: 256px; touch-action: none; }

/* ---------------------------------------------------------------- Notepad */
.notes-ta {
  flex: 1; width: 100%; resize: none; border: 1px solid; border-color: #7f9db9; margin: 0; padding: 2px 4px;
  font: 12px/1.3 var(--mono); color: #000; background: #fff; outline: none; white-space: pre-wrap; overflow-y: scroll;
  user-select: text; -webkit-user-select: text; touch-action: auto;
}

/* ---------------------------------------------------------------- folders (My Computer, Recycle Bin) */
.folder { flex: 1; display: flex; min-height: 0; overflow: hidden; background: #fff; border: 1px solid #7f9db9; }
.tasks { width: 104px; flex: none; padding: 8px 6px; background: linear-gradient(180deg, #7ba2e7, #6375d6); }
.tasks .box { background: #d6dff7; border-radius: 3px 3px 0 0; overflow: hidden; }
.tasks .box b { display: block; padding: 4px 6px; color: #fff; font-size: 11px; background: linear-gradient(90deg, #fff 0, #c6d3f7 100%); color: #215dc6; }
.tasks .box div { padding: 5px 6px; color: #215dc6; line-height: 1.5; }
.flist { flex: 1; padding: 8px 10px; overflow: auto; }
.flist h3 { margin: 0 0 6px; font: 700 11px var(--ui); color: #000; border-bottom: 1px solid #b4c4e4; padding-bottom: 3px; }
.flist .row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.flist .row img { width: 16px; height: 16px; }
.flist .num { margin-left: auto; color: #555; }
.flist .big { font-size: 22px; font-weight: 700; color: #215dc6; margin: 2px 0 8px; }
.flist .empty { color: #666; margin-top: 30px; text-align: center; }

/* ---------------------------------------------------------------- Internet */
.web { flex: 1; background: #fff; border: 1px solid #7f9db9; padding: 14px 16px; overflow: auto; }
.web h2 { margin: 6px 0 8px; font: 700 15px var(--ui); color: #000; display: flex; gap: 8px; align-items: center; }
.web h2 img { width: 32px; height: 32px; flex: none; }
.web p { margin: 0 0 8px; }
.web hr { border: 0; border-top: 1px solid #ccc; margin: 10px 0; }
.web .muted { color: #555; }

/* ---------------------------------------------------------------- taskbar */
#taskbar {
  position: absolute; left: 0; bottom: 0; width: 512px; height: 30px; display: flex; align-items: stretch; z-index: 950000;
  background: 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%);
}
#start {
  width: 97px; flex: none; padding: 0 0 1px 9px; border: 0; border-radius: 0 13px 13px 0 / 0 15px 15px 0;
  display: flex; align-items: center; gap: 6px; color: #fff;
  font: italic 700 15px/1 "Trebuchet MS", Tahoma, sans-serif; letter-spacing: .5px;   /* side by side, closest to XP's */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, .55), 0 0 1px rgba(0, 0, 0, .25);
  background:
    radial-gradient(ellipse 58% 34% at 40% 14%, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 70%),
    linear-gradient(90deg, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0) 7px, rgba(0, 0, 0, 0) 84px, rgba(0, 0, 0, .14)),
    linear-gradient(180deg, #263903 0, #347e31 3%, #429343 6%, #57a256 9%, #5ca75d 12%, #54a255 15%, #499b49 18%,
      #3f9440 21%, #388e38 24%, #338b33 27%, #338d34 35%, #379237 41%, #3a983a 50%, #3c9b3c 59%, #3c9a3b 68%,
      #3b973b 74%, #399439 79%, #389038 82%, #358b35 85%, #338433 88%, #307d30 91%, #2d7330 94%, #2a6a3e 100%);
  box-shadow: 1px 0 2px rgba(0, 0, 0, .35);
}
#start img { width: 21px; height: 18px; flex: none; filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, .35)); pointer-events: none; }
#start span { pointer-events: none; }
#start:hover { filter: brightness(1.07); }
#start.on { filter: brightness(.82); box-shadow: inset 1px 1px 3px rgba(0, 0, 0, .55); }
#tasks { flex: 1; min-width: 0; display: flex; gap: 2px; padding: 3px 4px 3px 8px; overflow: hidden; }
.task {
  flex: 0 1 120px; min-width: 26px; height: 24px; padding: 0 6px; display: flex; align-items: center; gap: 4px;
  color: #fff; border: 0; border-radius: 3px; text-align: left; white-space: nowrap; overflow: hidden;
  background: #3c81f3; box-shadow: inset -1px 0 rgba(0, 0, 0, .3), inset 1px 1px 1px rgba(255, 255, 255, .2);
}
.task img { width: 16px; height: 16px; flex: none; }
.task span { overflow: hidden; text-overflow: ellipsis; }
.task:hover { background: #53a3ff; }
.task.on { background: #1e52b7; box-shadow: inset 0 0 1px 1px rgba(0, 0, 0, .2), inset 1px 0 1px rgba(0, 0, 0, .7); }
#tray {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 8px; color: #fff; white-space: nowrap;
  border-left: 1px solid #092e51; box-shadow: inset 1px 0 1px #18bbff;
  background: linear-gradient(180deg, #0c59b9 1%, #139ee9 6%, #18b5f2 10%, #139beb 14%, #1290e8 19%, #0d8dea 63%, #0d9ff1 81%,
    #0f9eed 88%, #119be9 91%, #1392e2 94%, #137ed7 97%, #095bc9 100%);
}
#people { display: flex; align-items: center; gap: 3px; padding: 0 2px; border: 0; background: none; color: #fff; height: 100%; }
#people img { width: 16px; height: 16px; }
#people.off { opacity: .55; }

/* ---------------------------------------------------------------- start menu */
#startmenu {
  position: absolute; left: 0; bottom: 30px; width: 262px; z-index: 960000; display: none; overflow: hidden;
  border-radius: 7px 7px 0 0; background: #fff; box-shadow: 2px -1px 6px rgba(0, 0, 0, .45); border: 1px solid #0a49c2;
}
#startmenu.open { display: block; }
.sm-top {
  height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 8px; color: #fff; font: 700 14px var(--title);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, .5);
  background: linear-gradient(180deg, #1868ce 0%, #0e60cb 12%, #0e60cb 20%, #1164cf 32%, #1667cf 33%, #1b6cd3 47%, #1e70d9 54%,
    #2476dc 60%, #2a7fe2 65%, #2b80e3 77%, #2f84e7 80%, #3487ea 86%, #3a8cef 92%, #3e90f2 100%);
}
.sm-top .pic { width: 36px; height: 36px; border: 2px solid #fff; border-radius: 4px; background: #d8e8fb; overflow: hidden; box-shadow: 1px 1px 3px rgba(0, 0, 0, .4); flex: none; }
.sm-top .pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sm-cols { display: flex; border-top: 2px solid #e58a2e; }
.sm-left { flex: 1; padding: 4px 0; }
.sm-right { width: 112px; padding: 4px 0; background: #d3e5fa; border-left: 1px solid #95bdee; }
.sm-item { display: flex; align-items: center; gap: 6px; padding: 4px 8px; color: #000; }
.sm-item img { width: 24px; height: 24px; flex: none; }
.sm-right .sm-item img { width: 18px; height: 18px; }
.sm-right .sm-item { color: #0a246a; font-weight: 700; }
.sm-item:hover { background: var(--sel); color: #fff; }
.sm-item b { display: block; }
.sm-item small { display: block; color: #6d6d6d; font-size: 10px; }
.sm-item:hover small { color: #dfe8f8; }
.sm-sep { border-top: 1px solid #ccc; margin: 3px 8px; }
.sm-bottom {
  height: 34px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 0 8px; color: #fff;
  background: linear-gradient(180deg, #4282d6 0%, #3b85e0 3%, #418ae3 5%, #418ae3 17%, #3c87e2 21%, #3786e4 26%, #3482e3 29%,
    #2e7ee1 39%, #2374df 49%, #2072db 57%, #196edb 62%, #176bd8 72%, #1468d5 75%, #1165d2 83%, #0f61cb 88%);
}
.sm-bottom .sb { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 3px; }
.sm-bottom .sb:hover { background: rgba(255, 255, 255, .15); }
.sm-bottom .sb img { width: 22px; height: 22px; flex: none; }

/* ---------------------------------------------------------------- tray balloon */
#balloon {
  position: absolute; right: 6px; bottom: 40px; width: 232px; z-index: 970000; display: none; padding: 7px 9px 8px 9px;
  background: #ffffe1; border: 1px solid #000; border-radius: 7px; box-shadow: 2px 2px 4px rgba(0, 0, 0, .35); color: #000;
}
#balloon.open { display: block; animation: pop .18s ease-out; }
#balloon::after {
  content: ""; position: absolute; right: 38px; bottom: -11px; width: 14px; height: 11px; background: #ffffe1;
  clip-path: polygon(0 0, 100% 0, 100% 100%); border-right: 1px solid #000;
}
#balloon::before {
  content: ""; position: absolute; right: 37px; bottom: -12px; width: 15px; height: 12px; background: #000;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
#balloon .bt { display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 4px; padding-right: 14px; }
#balloon .bt img { width: 16px; height: 16px; flex: none; }
#balloon .bx { position: absolute; right: 5px; top: 5px; width: 14px; height: 14px; padding: 0; border: 1px solid #b0aa8a; border-radius: 2px; background: #ffffe1; display: grid; place-items: center; }
#balloon .bx svg { width: 8px; height: 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- welcome / dialogs */
#welcome {
  position: absolute; inset: 0; z-index: 990000; display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: #5a7edc; transition: opacity .35s ease;
}
#welcome::before, #welcome::after { content: ""; position: absolute; left: 0; right: 0; height: 66px; background: #00309c; }
#welcome::before { top: 0; border-bottom: 2px solid #f99736; box-shadow: 0 2px 0 #00309c; }
#welcome::after { bottom: 0; border-top: 2px solid #f99736; }
#welcome .glow { position: absolute; left: -10%; top: 66px; width: 70%; height: 300px; background: radial-gradient(ellipse at 20% 20%, rgba(255, 255, 255, .35), transparent 60%); }
#welcome .wt { position: relative; color: #fff; font: italic 700 46px/1 var(--title); text-shadow: 2px 2px 4px rgba(0, 0, 0, .3); letter-spacing: -1px; }
#welcome .ws { position: relative; color: #dbe6ff; font: 12px var(--ui); margin-top: 14px; min-height: 15px; }
#welcome.gone { opacity: 0; pointer-events: none; }

#dialog { position: absolute; inset: 0; z-index: 980000; display: none; place-items: center; background: rgba(0, 0, 0, .15); }
#dialog.open { display: grid; }
#dialog .win { position: relative; width: 300px; }
#dialog .dbody { display: flex; gap: 12px; padding: 14px 12px 10px; align-items: flex-start; }
#dialog .dbody img { width: 32px; height: 32px; flex: none; }
#dialog .dbtns { display: flex; justify-content: center; padding: 0 0 10px; gap: 8px; }
.xpbtn {
  min-width: 75px; height: 23px; padding: 0 10px; border: 1px solid #003c74; border-radius: 3px; color: #000;
  background: linear-gradient(180deg, #fff 0%, #ecebe6 86%, #d6d0c5 100%);
}
.xpbtn:hover { box-shadow: inset -1px 1px #fff0cf, inset 1px 2px #fdd889, inset -2px 2px #fbc761, inset 2px -2px #e5a01a; }
.xpbtn:active { background: linear-gradient(180deg, #e5e4de, #e3e2da 8%, #f2f1ee); }

@media (prefers-reduced-motion: reduce) {
  #welcome, #balloon.open { transition: none; animation: none; }
}
