/* ============ Windows 98 desktop shell ============ */

#desktop {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 800;
  background: #3a6ea5 url("/assets/bg-stars.gif") repeat;
  font-family: "Pixelated MS Sans Serif", Tahoma, sans-serif;
  font-size: 12px;
  color: #ffffff;
  overflow: hidden;
}
body.desktop-on #desktop { display: block; }
body.desktop-on { overflow: hidden; }

/* the homepage is fully hidden while the desktop is up, so nothing lingers
   underneath the shell */
/* #app carries an inline display from the sign-in flow, so this has to win */
body.desktop-on > center,
body.desktop-on > #app,
body.desktop-on > #lockScreen { display: none !important; }

/* ---- icons ---- */
/* auto-arranged icons fill a column then start a new one, as they did in 98 */
#deskIcons {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 38px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0;
}
.dicon {
  width: 84px;
  margin: 0 0 14px 0;
  padding: 5px 3px 4px 3px;
  text-align: center;
  cursor: default;
  user-select: none;
}
.dicon img { display: block; margin: 0 auto 3px auto; max-width: 42px; max-height: 42px; }
.dicon span {
  display: inline-block;
  padding: 1px 3px;
  line-height: 1.25;
  text-shadow: 1px 1px 1px #000000;
}
.dicon.sel span { background: #000080; outline: 1px dotted #ffffff; }

/* ---- floating windows ---- */
.dwin {
  position: absolute;
  z-index: 10;
  min-width: 200px;
  color: #000000;
  text-align: left;
}
.dwin .title-bar { cursor: move; user-select: none; }
.dwin.inactive .title-bar {
  background: linear-gradient(90deg, #808080, #b5b5b5);
}
.dwin .window-body { margin: 6px; }
.dwin.minimized { display: none; }

.dwin.maxed {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: calc(100% - 30px) !important;
}
.dwin.maxed .win-content { height: calc(100% - 62px); }

.win-content { overflow: auto; }

/* ---- taskbar ---- */
#taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  z-index: 500;
  background: #c0c0c0;
  box-shadow: inset 0 1px #ffffff, inset 0 2px #dfdfdf;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 3px;
  box-sizing: border-box;
}

#startBtn {
  font-weight: bold;
  min-width: 0;
  padding: 3px 8px 3px 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}
#startBtn img { width: 18px; height: 18px; }

#taskWins { flex: 1 1 auto; display: flex; gap: 3px; overflow: hidden; }
.taskbtn {
  flex: 0 1 165px;
  min-width: 44px;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
}
.taskbtn img { width: 15px; height: 15px; flex: 0 0 auto; }
.taskbtn.active {
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a,
              inset -2px -2px #dfdfdf, inset 2px 2px #808080;
  font-weight: bold;
}

#clock {
  flex: 0 0 auto;
  padding: 3px 9px;
  color: #000000;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}

/* ---- start menu ---- */
#startMenu {
  position: absolute;
  left: 2px;
  bottom: 30px;
  width: 210px;
  z-index: 600;
  display: none;
  background: #c0c0c0;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff,
              inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  padding: 3px;
}
#startMenu.open { display: flex; }
.sm-rail {
  width: 26px;
  background: linear-gradient(180deg, #808080, #000080);
  color: #ffffff;
  font-weight: bold;
  font-size: 15px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: right;
  padding: 8px 4px;
  letter-spacing: 1px;
}
.sm-items { flex: 1 1 auto; }
.sm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  color: #000000;
  cursor: default;
}
.sm-item img { width: 22px; height: 22px; }
.sm-item:hover { background: #000080; color: #ffffff; }
.sm-sep { height: 2px; margin: 3px 2px; border-top: 1px solid #808080; border-bottom: 1px solid #ffffff; }

/* ---- minesweeper ---- */
.ms-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  margin-bottom: 5px;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.ms-lcd {
  background: #000000;
  color: #ff0000;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 20px;
  padding: 1px 5px;
  letter-spacing: 1px;
}
.ms-face { font-size: 15px; padding: 2px 7px; min-width: 0; }

.ms-grid {
  display: grid;
  gap: 0;
  padding: 4px;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  width: max-content;
}
.ms-cell {
  width: 20px;
  height: 20px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  cursor: default;
  user-select: none;
  background: #c0c0c0;
  box-shadow: inset -1px -1px #808080, inset 1px 1px #ffffff,
              inset -2px -2px #c0c0c0, inset 2px 2px #dfdfdf;
}
.ms-cell.open {
  box-shadow: none;
  border: 1px solid #808080;
  width: 18px;
  height: 18px;
  line-height: 18px;
}
.ms-cell.mine { background: #ff0000; }
.ms-n1 { color: #0000ff; } .ms-n2 { color: #008000; } .ms-n3 { color: #ff0000; }
.ms-n4 { color: #000080; } .ms-n5 { color: #800000; } .ms-n6 { color: #008080; }
.ms-n7 { color: #000000; } .ms-n8 { color: #808080; }
.ms-hint { margin-top: 6px; font-size: 11px; color: #333333; }

/* ---- notepad ---- */
.np-area {
  width: 100%;
  height: 260px;
  box-sizing: border-box;
  font-family: "Courier New", monospace;
  font-size: 13px;
  resize: none;
}
.np-bar { margin-top: 5px; display: flex; gap: 6px; align-items: center; }
.np-msg { font-size: 11px; color: #333333; }

/* ---- paint ---- */
.pt-tools { display: flex; gap: 5px; align-items: center; margin-bottom: 5px; flex-wrap: wrap; }
.pt-sw {
  width: 20px;
  height: 20px;
  cursor: default;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.pt-sw.sel { outline: 2px solid #000000; outline-offset: 1px; }
.pt-canvas {
  background: #ffffff;
  cursor: crosshair;
  touch-action: none;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}

/* ---- my computer / generic listing ---- */
.mc-list { display: flex; flex-wrap: wrap; gap: 14px; padding: 6px; }
.mc-item { width: 84px; text-align: center; font-size: 11px; color: #000000; }
.mc-item img { display: block; margin: 0 auto 4px auto; max-width: 36px; max-height: 36px; }

.plain { font-size: 12px; line-height: 1.6; color: #000000; }
.plain a { color: #0000ee; }

/* ---- shutdown screen ---- */
#shutdown {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  background: #000000;
  color: #ffa500;
  font-family: "Courier New", monospace;
  font-size: 26px;
  line-height: 1.6;
  text-align: center;
  padding-top: 32vh;
  cursor: default;
}
#shutdown.on { display: block; }
#shutdown small { display: block; margin-top: 26px; font-size: 14px; color: #888888; }

/* the button that brings the desktop back once the window is closed */
#reopenBar { margin: 14px auto 0 auto; }
#reopenBar button { min-width: 210px; padding: 6px 10px; }

@media (max-width: 700px) {
  .dwin { max-width: 96vw; }
  #deskIcons { width: 78px; }
  .dicon { width: 70px; }
  .dicon img { max-width: 34px; max-height: 34px; }
}

/* ---- explorer ---- */
.ex-bar { display: flex; gap: 5px; align-items: center; margin-bottom: 5px; flex-wrap: wrap; }
.ex-path {
  flex: 1 1 140px;
  padding: 3px 6px;
  font-size: 11px;
  background: #ffffff;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.ex-panel { height: 250px; overflow: auto; background: #ffffff; }
.ex-item { cursor: default; }
.ex-item:hover span { background: #000080; color: #ffffff; }

/* ---- internet explorer ---- */
.ie-bar { display: flex; gap: 5px; align-items: center; margin-bottom: 4px; }
.ie-addr { flex: 1 1 auto; font-size: 12px; }
.ie-addr-label { font-size: 11px; color: #333333; }
.ie-links { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 5px; }
.ie-fav { font-size: 11px; padding: 2px 7px; min-width: 0; }
.ie-frame {
  width: 100%;
  height: 420px;
  border: 0;
  background: #ffffff;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.dwin.maxed .ie-frame { height: calc(100vh - 210px); }

/* ---- virtual machine ---- */
.vm-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; flex-wrap: wrap; }
.vm-status { font-size: 11px; color: #333333; }
.vm-screen {
  background: #000000;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.vm-screen canvas { max-width: 100%; }
.vm-text {
  color: #c0c0c0;
  font-family: "Courier New", monospace;
  font-size: 13px;
  white-space: pre;
  line-height: 1.15;
}
.vm-help { margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: #222222; }
.vm-help code, .vm-help pre {
  font-family: "Courier New", monospace;
  background: #ffffff;
  border: 1px solid #808080;
}
.vm-help code { padding: 0 3px; }
.vm-help pre { padding: 6px; overflow-x: auto; font-size: 11px; }
.vm-help a { color: #0000ee; }

/* ---- settings ---- */
.set-tabs { display: flex; gap: 3px; margin-bottom: 5px; flex-wrap: wrap; }
.set-tab { font-size: 11px; padding: 3px 9px; min-width: 0; }
.set-tab.sel {
  font-weight: bold;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a,
              inset -2px -2px #dfdfdf, inset 2px 2px #808080;
}
.set-panel { height: 300px; overflow: auto; background: #ffffff; padding: 10px; }
.set-body .field-row { margin-bottom: 7px; }
.set-body .field-row label { min-width: 96px; }
.set-body .field-row input { flex: 1 1 auto; }
.set-lead { font-size: 12px; margin: 0 0 10px 0; line-height: 1.5; }
.set-note { font-size: 11px; color: #444444; line-height: 1.5; }
.window .set-note { color: #444444; }
.set-warn { font-size: 11px; font-weight: bold; color: #aa0000; }
.window .set-warn { color: #aa0000; }
.set-codelist {
  font-family: "Courier New", monospace;
  font-size: 13px;
  background: #ffffcc;
  border: 1px solid #808080;
  padding: 8px;
  margin: 6px 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.set-uri { font-family: "Courier New", monospace; font-size: 10px; word-break: break-all; }
.set-body hr { border: 0; border-top: 1px solid #c0c0c0; margin: 12px 0; }

/* ---- all lists ---- */
.ll-panel { height: 320px; overflow: auto; background: #ffffff; padding: 8px; }
.ll-user h4 { margin: 6px 0 4px 0; font-size: 12px; }
.ll-user ul { margin: 0 0 12px 0; padding-left: 20px; font-size: 12px; }
.ll-user li { margin-bottom: 4px; }
.ll-done { text-decoration: line-through; color: #808080; }
.ll-note { font-size: 11px; color: #555555; }
.ll-empty { color: #808080; font-style: italic; }

/* ---- imaging ---- */
.im-drop {
  margin-bottom: 5px;
  padding: 9px;
  text-align: center;
  font-size: 11px;
  color: #444444;
  background: #ffffff;
  border: 2px dashed #808080;
}
.im-drop.over { border-color: #000080; background: #e8ecff; color: #000080; }

.im-panel { height: 210px; overflow: auto; background: #ffffff; padding: 6px; }
.im-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.im-cell {
  width: 92px;
  text-align: center;
  font-size: 11px;
  cursor: default;
  overflow: hidden;
}
.im-cell img {
  display: block;
  width: 84px;
  height: 64px;
  object-fit: cover;
  margin: 0 auto 3px auto;
  background: #c0c0c0;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.im-cell span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.im-cell:hover span { background: #000080; color: #ffffff; }

.im-viewer { margin-top: 6px; }
.im-viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}
.im-viewer img {
  display: block;
  max-width: 100%;
  max-height: 300px;
  margin: 0 auto;
  background: #808080;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}

/* uploaded pictures act as their own icon in Explorer */
.ex-item img { object-fit: cover; }

/* ---- window resize grips ---- */
.dwin { position: absolute; }
.wgrip { position: absolute; z-index: 5; }
.wgrip-n  { top: -3px; left: 6px; right: 6px; height: 6px; cursor: ns-resize; }
.wgrip-s  { bottom: -3px; left: 6px; right: 6px; height: 6px; cursor: ns-resize; }
.wgrip-w  { left: -3px; top: 6px; bottom: 6px; width: 6px; cursor: ew-resize; }
.wgrip-e  { right: -3px; top: 6px; bottom: 6px; width: 6px; cursor: ew-resize; }
.wgrip-nw { top: -3px; left: -3px; width: 10px; height: 10px; cursor: nwse-resize; }
.wgrip-se { bottom: -3px; right: -3px; width: 10px; height: 10px; cursor: nwse-resize; }
.wgrip-ne { top: -3px; right: -3px; width: 10px; height: 10px; cursor: nesw-resize; }
.wgrip-sw { bottom: -3px; left: -3px; width: 10px; height: 10px; cursor: nesw-resize; }
.dwin.maxed .wgrip { display: none; }

/* once resized by hand, the body fills whatever height was chosen */
.dwin.sized { display: flex; flex-direction: column; }
.dwin.sized > .window-body { flex: 1 1 auto; min-height: 0; display: flex; }
.dwin.sized > .window-body > .win-content { flex: 1 1 auto; min-height: 0; overflow: auto; }
.dwin.sized .ex-panel,
.dwin.sized .im-panel,
.dwin.sized .set-panel,
.dwin.sized .ll-panel,
.dwin.sized .list-panel { height: auto; min-height: 120px; }

/* ---- period dialogs ---- */
.dlg-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 40, 0.35);
}
.dlg-win { width: 400px; max-width: 92vw; color: #000000; text-align: left; }
.dlg-row { display: flex; gap: 12px; align-items: flex-start; }
.dlg-ico { width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.dlg-main { flex: 1 1 auto; min-width: 0; }
.dlg-msg { margin: 0 0 8px 0; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
.dlg-input { width: 100%; box-sizing: border-box; }
.dlg-btns {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 14px;
}
.dlg-btns button { min-width: 82px; }

.dlg-list {
  max-height: 190px;
  overflow: auto;
  background: #ffffff;
  margin-top: 4px;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.dlg-list-item { padding: 3px 6px; font-size: 12px; cursor: default; }
.dlg-list-item.sel { background: #000080; color: #ffffff; }

/* shared pictures are marked in the grid */
.im-cell.shared span { color: #0a246a; font-weight: bold; }
.im-shared {
  margin: 0 0 6px 0;
  font-size: 11px;
  color: #444444;
}
.window .im-shared { color: #444444; }
.ll-panel .im-cell a { display: block; }

/* Notepad was black on white in Fixedsys, not grey */
.np-area {
  color: #000000 !important;
  background: #ffffff !important;
  font-family: "Fixedsys", "Courier New", monospace;
}
.window .np-area { color: #000000; }

/* the emulator captures the pointer, so the page cursor gets out of the way */
.vm-screen.captured { cursor: none; }
.vm-hint {
  font-size: 11px;
  color: #444444;
  margin-top: 4px;
}
.window .vm-hint { color: #444444; }

/* ---- free icon placement ---- */
#deskIcons.free { display: block; }
#deskIcons.free .dicon { position: absolute; }

/* the mine gif is a dark bomb, so it needs a little lift on a dark background */
.dicon img[src*="ico-mine"] { filter: drop-shadow(0 0 2px rgba(255,255,255,.55)); }

/* ---- desktop context menu ---- */
.ctx-menu {
  position: absolute;
  z-index: 700;
  min-width: 160px;
  padding: 2px;
  background: #c0c0c0;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff,
              inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}
.ctx-item {
  padding: 4px 18px 4px 12px;
  font-size: 12px;
  color: #000000;
  cursor: default;
  white-space: nowrap;
}
.ctx-item:hover { background: #000080; color: #ffffff; }

/* ---- display properties ---- */
.dp-preview { display: flex; justify-content: center; margin-bottom: 8px; }
.dp-screen {
  width: 220px;
  height: 150px;
  background: #000033 url("/assets/bg-stars.gif") repeat;
  border: 6px solid #c0c0c0;
  box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080,
              0 0 0 2px #808080;
}
.dp-modes { align-items: center; gap: 8px; }
.dp-panel { height: 170px; overflow: auto; background: #ffffff; }
.dp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  font-size: 12px;
  cursor: default;
}
.dp-item.sel { background: #000080; color: #ffffff; }
.dp-swatch {
  display: inline-block;
  width: 26px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid #808080;
  background-repeat: repeat;
  background-position: center;
}

.ex-item.drop-target span { background: #000080; color: #ffffff; }
.ex-item.drop-target { outline: 1px dotted #000080; }
