/* Windows 95/98 look for the sim2003 desktop.  Geometry of every control
   comes from the original Delphi form data, so all boxes are absolutely
   positioned with border-box sizing. */

:root {
  --face: #c0c0c0;
  --light: #dfdfdf;
  --hilite: #ffffff;
  --shadow: #808080;
  --dark: #000000;
  --window: #ffffff;
  --select: #000080;
  --desktop: #008080;
  --title-a: #000080;
  --title-b: #1084d0;
  --title-ia: #808080;
  --title-ib: #b5b5b5;
  --ui-font: 'Microsoft Sans Serif', 'MS Sans Serif', Tahoma, Arial, sans-serif;
  --arial: Arial, 'Liberation Sans', Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--desktop);
}

body {
  font: 11px var(--ui-font);
  color: #000;
  -webkit-font-smoothing: none;
  font-smooth: never;
  font-kerning: none;
  text-rendering: optimizeSpeed;
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
}

canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

#desktop {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--desktop);
  overflow: hidden;
  transform-origin: 0 0;
}

.abs {
  position: absolute;
}

/* ---------------------------------------------------------------- windows */

.window {
  position: absolute;
  background: var(--face);
  padding: 3px;
  box-shadow:
    inset -1px -1px var(--dark),
    inset 1px 1px var(--light),
    inset -2px -2px var(--shadow),
    inset 2px 2px var(--hilite);
}

.window.hidden {
  display: none;
}

.titlebar {
  height: 18px;
  margin-bottom: 1px;
  background: linear-gradient(90deg, var(--title-ia), var(--title-ib));
  color: #c0c0c0;
  display: flex;
  align-items: center;
  padding: 0 2px 0 2px;
  font: bold 11px var(--ui-font);
  white-space: nowrap;
  overflow: hidden;
}

.window.active > .titlebar {
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff;
}

.titlebar .ticon {
  width: 16px;
  height: 16px;
  margin-right: 3px;
  flex: none;
}

.titlebar .ttext {
  flex: 1;
  overflow: hidden;
  padding-top: 1px;
}

.tbtn {
  width: 16px;
  height: 14px;
  flex: none;
  background: var(--face);
  box-shadow:
    inset -1px -1px var(--dark),
    inset 1px 1px var(--hilite),
    inset -2px -2px var(--shadow),
    inset 2px 2px var(--light);
  position: relative;
}

.tbtn:active:not(.disabled) {
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--dark),
    inset -2px -2px var(--light),
    inset 2px 2px var(--shadow);
}

.tbtn.close {
  margin-left: 2px;
}

.tbtn canvas {
  position: absolute;
  left: 0;
  top: 0;
}

.tbtn:active:not(.disabled) canvas {
  left: 1px;
  top: 1px;
}

.client {
  position: relative;
  overflow: hidden;
}

/* --------------------------------------------------------------- controls */

.lbl {
  position: absolute;
  white-space: pre;
  overflow: visible;
  font-family: var(--arial);
}

.lbl.wrap {
  white-space: normal;
}

.btn {
  position: absolute;
  background: var(--face);
  border: none;
  padding: 0;
  font: 11px var(--arial);
  color: #000;
  text-align: center;
  box-shadow:
    inset -1px -1px var(--dark),
    inset 1px 1px var(--hilite),
    inset -2px -2px var(--shadow),
    inset 2px 2px var(--light);
  outline: none;
}

.btn:focus-visible::after,
.btn.default:focus::after {
  content: '';
  position: absolute;
  inset: 4px;
  outline: 1px dotted #000;
}

.btn:active:not(:disabled),
.btn.pressed {
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--dark),
    inset -2px -2px var(--light),
    inset 2px 2px var(--shadow);
  padding: 2px 0 0 2px;
}

.btn:disabled {
  color: var(--shadow);
  text-shadow: 1px 1px 0 var(--hilite);
}

.sunken {
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--shadow),
    inset -2px -2px var(--light),
    inset 2px 2px var(--dark);
}

.edit {
  position: absolute;
  background: var(--window);
  border: none;
  padding: 3px 3px 3px 4px;
  font: 11px var(--arial);
  color: #000;
  outline: none;
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--shadow),
    inset -2px -2px var(--light),
    inset 2px 2px var(--dark);
  -webkit-user-select: text;
  user-select: text;
  border-radius: 0;
}

.edit:disabled,
.edit.readonly-grey {
  background: var(--face);
  color: #000;
}

.edit[readonly] {
  cursor: default;
}

.memo {
  position: absolute;
  background: var(--window);
  resize: none;
  border: none;
  outline: none;
  padding: 2px 3px;
  font: 11px var(--arial);
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--shadow),
    inset -2px -2px var(--light),
    inset 2px 2px var(--dark);
  white-space: pre;
  overflow: auto;
}

.memo:disabled {
  background: var(--face);
  color: #000;
}

.richedit {
  position: absolute;
  background: var(--window);
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--shadow),
    inset -2px -2px var(--light),
    inset 2px 2px var(--dark);
  padding: 2px;
}

.richedit .rtext {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 0 1px;
  font: 11px var(--arial);
  line-height: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.richedit.vscroll .rtext {
  overflow-y: scroll;
}

.richedit.nowrap .rtext {
  white-space: pre;
}

.listbox {
  position: absolute;
  background: var(--window);
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--shadow),
    inset -2px -2px var(--light),
    inset 2px 2px var(--dark);
  padding: 2px;
  outline: none;
}

.listbox .items {
  height: 100%;
  overflow-y: auto;
  font: 11px var(--arial);
}

.listbox .item {
  height: 14px;
  line-height: 14px;
  padding: 0 2px;
  white-space: pre;
  overflow: hidden;
}

.listbox .item.sel {
  background: var(--select);
  color: #fff;
}

.listbox:focus .item.sel {
  outline: 1px dotted #ffff80;
  outline-offset: -1px;
}

.groupbox {
  position: absolute;
}

.groupbox > .gframe {
  position: absolute;
  left: 0;
  right: 1px;
  bottom: 1px;
  border: 1px solid var(--shadow);
  box-shadow: 1px 1px 0 var(--hilite), inset 1px 1px 0 var(--hilite);
}

.groupbox > .gcap {
  position: absolute;
  left: 8px;
  top: 0;
  background: var(--face);
  font: 11px var(--arial);
  white-space: pre;
}

.bevel {
  position: absolute;
  border-style: solid;
  border-width: 1px;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  pointer-events: none;
}

.bevel.raised {
  border-color: var(--hilite) var(--shadow) var(--shadow) var(--hilite);
}

.panel {
  position: absolute;
  background: var(--face);
  box-shadow:
    inset -1px -1px var(--shadow),
    inset 1px 1px var(--hilite);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: pre;
  overflow: hidden;
}

.panel.flat {
  box-shadow: none;
}

.panel.single {
  border: 1px solid #000;
}

.panel.right {
  justify-content: flex-end;
}

.panel.lefttext {
  justify-content: flex-start;
}

.checkbox {
  position: absolute;
  font: 11px var(--arial);
  display: flex;
  align-items: center;
}

.checkbox .box {
  width: 13px;
  height: 13px;
  flex: none;
  background: var(--window);
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--shadow),
    inset -2px -2px var(--light),
    inset 2px 2px var(--dark);
  position: relative;
}

.checkbox.disabled .box {
  background: var(--face);
}

.checkbox.disabled {
  color: var(--shadow);
}

.checkbox.disabled .ctext {
  text-shadow: 1px 1px 0 var(--hilite);
}

.checkbox .box canvas {
  position: absolute;
  left: 0;
  top: 0;
}

.checkbox .ctext {
  margin-left: 4px;
  padding: 0 1px;
  white-space: pre;
}

.checkbox:focus {
  outline: none;
}

.checkbox:focus .ctext {
  outline: 1px dotted #000;
}

.checkbox.leftbox {
  flex-direction: row-reverse;
  justify-content: space-between;
}

.updown {
  position: absolute;
}

.updown .ub {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  background: var(--face);
  box-shadow:
    inset -1px -1px var(--dark),
    inset 1px 1px var(--hilite),
    inset -2px -2px var(--shadow),
    inset 2px 2px var(--light);
}

.updown .ub:active {
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--dark);
}

.updown .ub.down {
  top: 50%;
}

.updown canvas {
  position: absolute;
  left: 0;
  top: 0;
}

.shape-black {
  position: absolute;
  background: #000;
}

/* ----------------------------------------------------------- scrollbars */

::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2" shape-rendering="crispEdges"><rect width="1" height="1" fill="%23ffffff"/><rect x="1" y="1" width="1" height="1" fill="%23ffffff"/><rect x="1" width="1" height="1" fill="%23c0c0c0"/><rect y="1" width="1" height="1" fill="%23c0c0c0"/></svg>');
}

::-webkit-scrollbar-thumb {
  background: var(--face);
  box-shadow:
    inset -1px -1px var(--dark),
    inset 1px 1px var(--light),
    inset -2px -2px var(--shadow),
    inset 2px 2px var(--hilite);
}

::-webkit-scrollbar-button:vertical:start:decrement,
::-webkit-scrollbar-button:vertical:end:increment {
  display: block;
  height: 16px;
  background-color: var(--face);
  background-repeat: no-repeat;
  background-position: center;
  box-shadow:
    inset -1px -1px var(--dark),
    inset 1px 1px var(--light),
    inset -2px -2px var(--shadow),
    inset 2px 2px var(--hilite);
}

::-webkit-scrollbar-button:vertical:start:decrement {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="7" height="4" shape-rendering="crispEdges"><path d="M3 0h1v1h1v1h1v1h1v1H0V3h1V2h1V1h1z" fill="black"/></svg>');
}

::-webkit-scrollbar-button:vertical:end:increment {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="7" height="4" shape-rendering="crispEdges"><path d="M0 0h7v1H6v1H5v1H4v1H3V3H2V2H1V1H0z" fill="black"/></svg>');
}

::-webkit-scrollbar-button:vertical:start:increment,
::-webkit-scrollbar-button:vertical:end:decrement {
  display: none;
}

/* ------------------------------------------------------------ taskbar etc */

#taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background: var(--face);
  box-shadow: inset 0 1px var(--light), inset 0 2px var(--hilite);
  display: flex;
  align-items: center;
  padding: 2px 2px 0;
  gap: 3px;
  z-index: 100000;
}

#taskbar .start {
  position: relative;
  height: 22px;
  width: 54px;
  font-weight: bold;
  font-family: var(--ui-font);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 0 0 3px;
  text-align: left;
}

#taskbar .start.pressed {
  padding: 1px 0 0 4px;
}

#taskbar .tasks {
  flex: 1;
  display: flex;
  gap: 3px;
  overflow: hidden;
}

#taskbar .task {
  position: relative;
  height: 22px;
  width: 160px;
  min-width: 40px;
  flex: 0 1 160px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 4px;
  font-family: var(--ui-font);
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
}

#taskbar .task.active {
  font-weight: bold;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2" shape-rendering="crispEdges"><rect width="2" height="2" fill="%23c0c0c0"/><rect width="1" height="1" fill="%23ffffff"/><rect x="1" y="1" width="1" height="1" fill="%23ffffff"/></svg>');
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--dark),
    inset -2px -2px var(--light),
    inset 2px 2px var(--shadow);
  padding-top: 1px;
}

#taskbar .tray {
  height: 22px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow:
    inset -1px -1px var(--hilite),
    inset 1px 1px var(--shadow);
  font-family: var(--ui-font);
}

.menu {
  position: absolute;
  background: var(--face);
  padding: 3px;
  box-shadow:
    inset -1px -1px var(--dark),
    inset 1px 1px var(--light),
    inset -2px -2px var(--shadow),
    inset 2px 2px var(--hilite);
  z-index: 200000;
  font: 11px var(--ui-font);
}

.menu .mi {
  height: 17px;
  line-height: 17px;
  padding: 0 20px 0 18px;
  white-space: nowrap;
  position: relative;
}

.menu .mi:hover:not(.disabled) {
  background: var(--select);
  color: #fff;
}

.menu .mi.disabled {
  color: var(--shadow);
  text-shadow: 1px 1px 0 var(--hilite);
}

.menu .mi.checked::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.menu .sep {
  height: 2px;
  margin: 3px 1px;
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--hilite);
}

.startmenu {
  display: flex;
  padding: 3px;
}

.startmenu .side {
  width: 21px;
  background: linear-gradient(0deg, #000080, #1084d0);
  color: #c0c0c0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font: bold 18px var(--arial);
  padding: 6px 0 4px;
  letter-spacing: 0;
}

.startmenu .side b {
  color: #fff;
}

.startmenu .items .mi {
  height: 30px;
  line-height: 30px;
  padding: 0 24px 0 38px;
}

.startmenu .items .mi canvas {
  position: absolute;
  left: 4px;
  top: 3px;
}
