* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: #3a6ea5;
  font-family: Tahoma, 'Noto Sans', sans-serif;
  user-select: none;
}

/* ---------- desktop icons ---------- */
.desktop-icons {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.desktop-icon {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 11px;
  text-align: center;
  text-shadow: 1px 1px 1px #000;
  cursor: default;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.desktop-icon img { width: 32px; height: 32px; image-rendering: pixelated; }
.desktop-icon.selected img { filter: brightness(0.6) sepia(1) hue-rotate(180deg) saturate(4); }
.desktop-icon.selected span { background: #0b61ff; text-shadow: none; }

/* ---------- XP window chrome ---------- */
.window {
  position: absolute;
  display: inline-flex;
  flex-direction: column;
  padding: 0 3px 3px;
  background: #0831d9;
  border-radius: 8px 8px 0 0;
  box-shadow: inset -1px -1px #00138c, inset 1px 1px #0831d9, 2px 2px 8px rgba(0, 0, 0, 0.4);
}
.window[hidden] { display: none; }

.title-bar {
  touch-action: none; /* let the title bar drag the window instead of scrolling */
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 3px 0 4px;
  margin: 0 -3px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(
    to bottom,
    #0058ee 0%, #3593ff 4%, #288eff 6%, #127dff 8%, #036ffc 10%,
    #0262ee 14%, #0057e5 20%, #0054e3 24%, #0055eb 56%, #005bf5 66%,
    #026afe 76%, #0062ef 86%, #0052d6 92%, #0040ab 94%, #003092 100%
  );
}
.title-bar__icon { width: 15px; height: 15px; margin-right: 4px; }
.title-bar__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 1px 1px #0f1089;
  letter-spacing: 0.3px;
}
.title-bar__buttons { display: flex; gap: 2px; }
.title-bar__buttons button {
  position: relative;
  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%);
  box-shadow: inset 0 -1px 2px 1px #4646ff;
}
.title-bar__buttons button:hover { filter: brightness(1.15); }
.title-bar__buttons button:active { filter: brightness(0.85); }
.title-bar__buttons button:disabled { opacity: 0.6; filter: none; }
.title-bar__min::before {
  content: ''; position: absolute; left: 4px; top: 13px; width: 8px; height: 3px; background: #fff;
}
.title-bar__max::before {
  content: ''; position: absolute; left: 4px; top: 4px; width: 9px; height: 9px;
  border: 1px solid #fff; border-top-width: 3px;
}
.title-bar__close {
  background: radial-gradient(circle at 90% 90%, #cc4600 0%, #dc6527 55%, #cd7546 70%, #ffccb2 90%, #fff 100%) !important;
  box-shadow: inset 0 -1px 2px 1px #da4600 !important;
}
.title-bar__close::before, .title-bar__close::after {
  content: ''; position: absolute; left: 9px; top: 3px; width: 2px; height: 13px; background: #fff;
}
.title-bar__close::before { transform: rotate(45deg); }
.title-bar__close::after { transform: rotate(-45deg); }

/* Inactive window: the paler XP caption. */
.window.inactive { background: #7a96df; box-shadow: inset -1px -1px #6582d0, inset 1px 1px #7a96df, 2px 2px 8px rgba(0, 0, 0, 0.3); }
.window.inactive .title-bar {
  background: linear-gradient(
    to bottom,
    #7697e7 0%, #7e9ee3 3%, #94afe8 6%, #97b4e9 8%, #82a5e4 14%, #7c9fe2 17%,
    #7996de 25%, #7b99e1 56%, #82a9e9 81%, #80a5e7 89%, #7b96e1 94%, #7a93df 100%
  );
}
.window.inactive .title-bar__text { color: #d8e4f8; text-shadow: none; }
.window.inactive .title-bar__buttons button { filter: saturate(0.5) brightness(1.1); }

/* Blocks the owner window while one of its dialogs is open. */
.window__modal-cover {
  position: absolute;
  inset: 0;
  z-index: 100;
}

/* ---------- menu bar (ported from winXP DropDowns) ---------- */
.menu-bar {
  height: 20px;
  line-height: 20px;
  background: rgb(236, 233, 216);
  display: flex;
  position: relative;
}
.menu-bar img { pointer-events: none; }
.drop-down { font-size: 11px; position: relative; }
.drop-down__label { padding: 0 7px; }
.drop-down__label:hover,
.drop-down.open .drop-down__label { background-color: #1660e8; color: #fff; }

.drop-down__menu {
  display: none;
  position: absolute;
  top: 20px;
  left: 0;
  z-index: 50;
  padding: 2px;
  line-height: 18px;
  background-color: #fff;
  box-shadow: 2px 2px 1px rgb(100, 100, 100);
  border: 1px solid gray;
  grid-template-columns: 16px auto auto 15px;
}
.drop-down.open .drop-down__menu { display: grid; }
.drop-down__row { display: contents; }
.drop-down__row:not(.disabled):hover > * { background: #1660e8; color: #fff; }
.drop-down__row:not(.disabled):hover .drop-down__check img { filter: invert(100%); }
.drop-down__row.disabled > * { color: #aca899; }
.drop-down__check { grid-column: 1; display: flex; align-items: center; justify-content: center; }
.drop-down__check img { visibility: hidden; }
.drop-down__row.checked .drop-down__check img { visibility: visible; }
.drop-down__text { grid-column: 2; white-space: nowrap; padding-right: 8px; }
.drop-down__hot-key { grid-column: 3; white-space: nowrap; padding-right: 2px; }
.drop-down__arrow { grid-column: 4; }
.drop-down__row.has-sub .drop-down__arrow::after {
  content: '';
  display: inline-block;
  margin-left: 5px;
  border: 4px solid transparent;
  border-left-color: currentColor;
  border-right-width: 0;
}
.drop-down__submenu {
  position: absolute;
  display: none;
  left: calc(100% - 3px);
}
.drop-down__submenu.open { display: grid; }
.drop-down__separator {
  grid-column: 1 / 5;
  height: 7px;
  padding: 3px 1px;
  background-color: rgba(0, 0, 0, 0.2);
  background-clip: content-box;
}

/* ---------- dialog contents ---------- */
.dialog {
  position: relative;
  background: #ece9d8;
  font-size: 11px;
  color: #000;
}
.dialog fieldset {
  margin: 0;
  padding: 2px 7px 4px;
  border: 1px solid #d0d0bf;
  border-radius: 3px;
}
.dialog legend { color: #0046d5; padding: 0 2px; }
.dialog label { display: flex; align-items: center; gap: 4px; height: 24px; }
.dialog label.disabled { color: #aca899; }
.dialog input { margin: 0; }
.dialog__buttons { display: flex; justify-content: center; gap: 10px; }
.xp-button {
  min-width: 72px;
  height: 23px;
  padding: 0 8px;
  font: inherit;
  border: 1px solid #003c74;
  border-radius: 3px;
  background: linear-gradient(to bottom, #fff 0%, #ecebe6 86%, #d6d0c5 100%);
}
.xp-button:hover { box-shadow: inset 0 0 0 2px #f8b330; }
.xp-button:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.xp-button:active { background: linear-gradient(to bottom, #cdcac3 0%, #e3e3db 8%, #f2f2f1 100%); }
