/* Windows XP "Luna" chrome around the original client area. */
:root {
  --face: #ece9d8;
  --frame: #0831d9;
  --frame-inactive: #7a96df;
  --menu-hilite: #316ac5;
  --text: #000;
  --desktop: #3a6ea5;
  font-family: Tahoma, "Segoe UI", Geneva, Verdana, sans-serif;
  font-size: 11px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--desktop) linear-gradient(180deg, #5a8fd6 0%, #3a6ea5 55%, #2f5f94 100%);
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }

#desktop { position: absolute; inset: 0 0 30px 0; }

/* ---- desktop icon ---------------------------------------------------- */
.desktop-icon {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 76px;
  padding: 4px 2px;
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}
.desktop-icon span {
  color: #fff;
  text-shadow: 1px 1px 1px #000;
  padding: 0 2px;
}
.desktop-icon:focus { outline: none; }
.desktop-icon:focus span { background: var(--menu-hilite); outline: 1px dotted #fff; }
.desktop-icon:focus img { filter: brightness(0.7) sepia(1) hue-rotate(180deg) saturate(3); }

/* ---- window frame ---------------------------------------------------- */
.xp-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--face);
  border: 3px solid var(--frame);
  border-top: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 2px 2px 10px rgb(0 0 0 / 35%);
}
.xp-window[hidden] { display: none; }

.title-bar {
  height: 29px;
  margin: 0 -3px;
  padding: 0 5px 0 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #0997ff 0%, #0053ee 8%, #0050ee 40%, #06f 88%, #06f 93%, #005bff 95%, #003dd7 96%, #003dd7 100%);
  color: #fff;
  font: bold 13px "Trebuchet MS", Tahoma, sans-serif;
  text-shadow: 1px 1px #0f1089;
  touch-action: none;
  cursor: default;
}
.title-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-controls { display: flex; gap: 2px; }

.inactive .title-bar, .xp-window.inactive {
  border-color: var(--frame-inactive);
}
.inactive .title-bar {
  background: linear-gradient(180deg, #9db9eb 0%, #7a96df 10%, #7a96df 90%, #6c87d1 100%);
  color: #d8e4f8;
  text-shadow: none;
}

.ctl {
  width: 21px;
  height: 21px;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 3px;
  background: radial-gradient(circle at 90% 90%, #0054e9 0%, #2263d5 55%, #4479e4 70%, #a3bbec 90%, #fff 100%);
  position: relative;
  box-shadow: inset 0 -1px 2px rgb(0 0 0 / 25%);
}
.ctl:active { filter: brightness(0.85); }
.ctl:disabled { opacity: 0.45; }
.ctl.close { background: radial-gradient(circle at 90% 90%, #cc4600 0%, #dc6527 55%, #cd7546 70%, #ffccb2 90%, #fff 100%); }
.ctl::before, .ctl::after { content: ""; position: absolute; background: #fff; }
.ctl.minimize::before { left: 4px; bottom: 4px; width: 7px; height: 3px; }
.ctl.maximize::before { inset: 3px; background: none; border: 1px solid #fff; border-top-width: 3px; }
.ctl.close::before, .ctl.close::after { left: 9px; top: 3px; width: 2px; height: 13px; transform: rotate(45deg); }
.ctl.close::after { transform: rotate(-45deg); }

/* ---- menu bar -------------------------------------------------------- */
.menu-bar {
  display: flex;
  height: 20px;
  padding: 0 1px;
  background: var(--face);
  border-bottom: 1px solid #fff;
  box-shadow: 0 1px 0 #aca899;
  position: relative;
  z-index: 2;
}
.menu { position: relative; }
.menu-label {
  height: 19px;
  padding: 0 6px;
  background: none;
  border: 0;
  cursor: default;
}
.menu-label u, .menu-items u { text-decoration: none; }
.menu.open .menu-label { background: var(--menu-hilite); color: #fff; }
.menu-items {
  display: none;
  position: absolute;
  top: 19px;
  left: 0;
  min-width: 170px;
  margin: 0;
  padding: 2px;
  list-style: none;
  background: #fff;
  border: 1px solid #aca899;
  box-shadow: 2px 2px 3px rgb(0 0 0 / 30%);
  white-space: nowrap;
}
.menu.open .menu-items { display: block; }
.menu-items li {
  position: relative;
  padding: 3px 20px 3px 20px;
  cursor: default;
}
.menu-items li:hover:not(.sep) { background: var(--menu-hilite); color: #fff; }
.menu-items li.checked::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  width: 6px;
  height: 3px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}
.menu-items li[data-level].checked::before {
  width: 6px;
  height: 6px;
  top: 7px;
  left: 7px;
  border: 0;
  border-radius: 50%;
  background: currentColor;
  transform: none;
}
.menu-items kbd { font: inherit; float: right; margin-left: 24px; }
.menu-items .sep { padding: 0; margin: 3px 1px; border-top: 1px solid #aca899; }

/* ---- board ----------------------------------------------------------- */
#board {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: default;
}

/* ---- taskbar --------------------------------------------------------- */
#taskbar {
  position: fixed;
  inset: auto 0 0 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  background: linear-gradient(180deg, #3168d5 0%, #4993e6 3%, #2157d7 10%, #2663e0 90%, #1941a5 100%);
  z-index: 10;
}
.start {
  height: 30px;
  padding: 0 22px 0 12px;
  display: flex;
  align-items: center;
  border-radius: 0 10px 10px 0;
  background: linear-gradient(180deg, #3c8f3c 0%, #5eac56 10%, #3c8f3c 90%, #2f6f2f 100%);
  color: #fff;
  font: italic bold 18px "Trebuchet MS", sans-serif;
  text-shadow: 1px 1px 2px #222;
  box-shadow: inset -2px 0 3px rgb(0 0 0 / 25%);
}
.task-button {
  height: 24px;
  width: 160px;
  max-width: 40vw;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 0;
  border-radius: 3px;
  background: #3c81f3;
  color: #fff;
  box-shadow: inset 1px 1px 1px rgb(255 255 255 / 30%);
}
.task-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-button.active { background: #1e52b7; box-shadow: inset 1px 1px 2px rgb(0 0 0 / 50%); }
.task-button[hidden] { display: none; }
.tray {
  margin-left: auto;
  padding: 0 10px;
  height: 30px;
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, #0c59b9 0%, #139ee9 5%, #18b9ff 10%, #1291e3 90%, #0f75d4 100%);
  border-left: 1px solid #092e73;
  color: #fff;
  text-decoration: none;
}

/* ---- dialogs --------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 20; }
.dialog { min-width: 220px; max-width: calc(100vw - 8px); }
.dialog.untitled .title-text { visibility: hidden; }
.dialog-body { padding: 12px; }
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}
.dialog-buttons button, .dialog button:not(.ctl) {
  min-width: 75px;
  height: 23px;
  padding: 0 8px;
  border: 1px solid #003c74;
  border-radius: 3px;
  background: linear-gradient(180deg, #fff 0%, #ecebe6 86%, #d6d0c5 100%);
}
.dialog-buttons button:hover { box-shadow: inset 0 0 0 2px #f8b636; }
.dialog-buttons button.default { box-shadow: inset 0 0 0 1px #c2d4f6, inset 0 0 0 2px #7da2ce; }
.dialog-buttons button:active { background: linear-gradient(180deg, #e5e4de 0%, #e3e2db 100%); }
.dialog button:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.dialog input[type="text"] {
  font: inherit;
  height: 21px;
  padding: 1px 3px;
  border: 1px solid #7f9db9;
  background: #fff;
  -webkit-user-select: text;
  user-select: text;
}

.custom-fields { display: grid; gap: 8px; }
.custom-fields label { display: grid; grid-template-columns: 60px 52px; align-items: center; }

.best-times fieldset { border: 1px solid #d0d0bf; border-radius: 3px; margin: 0; padding: 8px 12px; }
.best-row { display: grid; grid-template-columns: 80px 80px auto; gap: 4px; padding: 3px 0; }
.best-dialog .dialog-buttons { justify-content: space-between; }

.name-entry { display: grid; gap: 10px; justify-items: center; text-align: center; width: 200px; }
.name-entry p { margin: 0; white-space: pre-line; }
.name-entry input { width: 160px; }

.about { display: flex; gap: 14px; max-width: 340px; }
.about p { margin: 0 0 6px; }
.about hr { border: 0; border-top: 1px solid #aca899; margin: 10px 0; }
.about .port-note { color: #333; }
.about code { font-size: 11px; }

.help-dialog { width: min(620px, calc(100vw - 8px)); }
.help-viewer {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 6px;
  height: min(360px, calc(100vh - 140px));
}
.help-toc, .help-content {
  margin: 0;
  overflow: auto;
  background: #fff;
  border: 1px solid #7f9db9;
}
.help-toc { padding: 6px; list-style: none; }
.help-toc ul { list-style: none; padding-left: 14px; margin: 2px 0 6px; }
.help-toc .book > span::before { content: "📖 "; }
.help-toc .page { padding: 1px 3px; cursor: pointer; }
.help-toc .page::before { content: "📄 "; }
.help-toc .page.selected { background: var(--menu-hilite); color: #fff; }
.help-content {
  padding: 10px 14px;
  font: 13px Verdana, Tahoma, sans-serif;
  -webkit-user-select: text;
  user-select: text;
}
.help-content h1 { font-size: 15px; margin-top: 0; }
.help-content .proclabel { font-weight: bold; }
.help-content .note { font-weight: bold; margin-bottom: 0; }
@media (max-width: 520px) {
  .help-viewer { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .help-toc { max-height: 120px; }
}

/* The XYZZY cheat writes a single pixel at the top-left of the screen. */
#cheat-pixel { position: fixed; left: 0; top: 0; width: 1px; height: 1px; z-index: 100; pointer-events: none; }
