:root {
  --taskbar-height: 30px;
  --accent: #245edb;
  --accent-dark: #0b3b9a;
  --surface: #ece9d8;
  --text: #111;
  --font-ui: Tahoma, "Segoe UI", Arial, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  background-color: #5aa7e8;
}

.desktop {
  position: absolute;
  inset: 0 0 var(--taskbar-height) 0;
  overflow: hidden;
  user-select: none;
  cursor: default;
  background-color: #5aa7e8;
  /* CC BY-SA 3.0 vector recreation by Damianadrian. */
  background-image: url("../assets/landscape.jpg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.desktop::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0) 40%, rgba(0,80,0,.04));
}

/* Desktop icons */
.desktop-icons {
  position: relative;
  z-index: 10;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 92px);
  justify-content: start;
  align-content: start;
  gap: 2px 6px;
  list-style: none;
  width: max-content;
  height: 100%;
  margin: 0;
  padding: 8px;
}

.desktop-icon {
  width: 76px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 3px 2px;
  background: transparent;
  border: 1px dotted transparent;
  border-radius: 0;
  color: #fff;
  font: 11px/14px Tahoma, "Segoe UI", sans-serif;
  text-align: center;
  text-shadow: 1px 1px 1px rgba(0,0,0,.95), -1px -1px 1px rgba(0,0,0,.35);
  cursor: default;
  user-select: none;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
  background: rgba(50, 100, 210, 0.28);
  border-color: rgba(255,255,255,.45);
  outline: none;
}

.desktop-icon.selected {
  background: rgba(49,106,201,.72);
  border-color: rgba(255,255,255,.78);
  outline: none;
}

.desktop-icon.selected:active {
  cursor: grabbing;
}

.desktop-selection-box {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: rgba(49,106,201,.18);
  border: 1px dotted rgba(255,255,255,.98);
  box-shadow: 0 0 0 1px rgba(0,63,160,.45);
  animation: xp-selection-march .55s linear infinite;
}

@keyframes xp-selection-march {
  0%, 100% {
    border-color: rgba(255,255,255,.98);
    box-shadow: 0 0 0 1px rgba(0,63,160,.45);
  }
  50% {
    border-color: rgba(0,63,160,.9);
    box-shadow: 0 0 0 1px rgba(255,255,255,.65);
  }
}

.desktop {
  user-select: none;
}

.desktop-icon img {
  width: 48px;
  height: 48px;
  pointer-events: none;
}

/* Taskbar */
.taskbar {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--taskbar-height);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 0;
  background: linear-gradient(180deg,#3d9af3 0%,#286ed1 48%,#1652ad 50%,#245edb 100%);
  border-top: 1px solid #65b4ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  z-index: 9000;
}

.start-button {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  min-width: 104px;
  padding: 0 18px 0 9px;
  border: 0;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg,#72c968 0%,#3ba53a 46%,#238323 54%,#197319 100%);
  color: #fff;
  font: bold italic 14px/30px Tahoma, sans-serif;
  text-shadow: 1px 1px 1px rgba(0,70,0,.65);
  cursor: pointer;
}

.start-button:hover { filter: brightness(1.1); }

.start-logo {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 2px;
  background: conic-gradient(#f34b38 0 25%,#ffd83d 0 50%,#69d85d 0 75%,#44a6ff 0);
}

.task-list {
  display: flex;
  flex: 1;
  gap: 4px;
  overflow-x: auto;
}

.task-button {
  min-width: 150px;
  max-width: 220px;
  height: 24px;
  padding: 2px 10px;
  border: 1px solid rgba(0,35,105,.65);
  border-radius: 2px;
  background: linear-gradient(180deg,#4b91e7,#2863bd);
  color: #fff;
  font: 11px Tahoma, sans-serif;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.task-button[aria-pressed="true"] {
  background: linear-gradient(180deg,#194a9f,#0e347e);
}

/* Start menu */
.start-menu {
  position: fixed;
  left: 0;
  bottom: var(--taskbar-height);
  width: 360px;
  padding: 0 0 7px;
  border: 1px solid #154da0;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #fff;
  box-shadow: 2px -3px 12px rgba(0,0,0,.38);
  z-index: 9500;
}

.start-menu[hidden] { display: none; }

.start-menu-header {
  margin: 0 0 5px;
  padding: 11px 14px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg,#3e83e8,#1753ae);
  color: #fff;
  font: bold 13px Tahoma, sans-serif;
  text-shadow: 1px 1px 1px #17427e;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 10px);
  min-height: 38px;
  margin: 1px 5px;
  padding: 4px 9px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font: 12px Tahoma, sans-serif;
  text-align: left;
  cursor: pointer;
}

.start-menu-item:hover { background: var(--accent); color: #fff; }
.start-menu-item img { width: 24px; height: 24px; }

@media (max-width: 720px) {
  .desktop-icons { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, 88px); grid-template-rows: none; }
  .desktop-icon { width: 88px; }
}

.tray {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 9px;
  border-left: 1px solid rgba(0,55,145,.6);
  background: linear-gradient(180deg,rgba(65,130,221,.9),rgba(25,78,169,.9));
  color: #fff;
  font-size: 11px;
}
.tray-button:hover { background: rgba(255, 255, 255, 0.3); }

@media (prefers-reduced-motion: reduce) {
  .desktop-selection-box { animation: none; }
}
