/* Windows 98 Core Design System */
:root {
  --win-teal: #008080;
  --win-bg: #c0c0c0;
  --win-face: #c0c0c0;
  --win-light: #ffffff;
  --win-shadow-light: #dfdfdf;
  --win-shadow-dark: #808080;
  --win-shadow-darkest: #000000;
  --win-title-active-left: #000080;
  --win-title-active-right: #1084d0;
  --win-title-inactive-left: #808080;
  --win-title-inactive-right: #b5b5b5;
  --win-text: #000000;
  --win-selected: #000080;
  --win-selected-text: #ffffff;
  --font-win: "MS Sans Serif", Tahoma, Pixelated, Geneva, sans-serif;
  --taskbar-height: 34px;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-win);
  font-size: 12px;
  background-color: var(--win-teal);
  color: var(--win-text);
  image-rendering: pixelated;
}

/* 3D Bevel Utilities */
.win-outset {
  background-color: var(--win-bg);
  box-shadow: 
    inset 1px 1px var(--win-light),
    inset -1px -1px var(--win-shadow-darkest),
    inset 2px 2px var(--win-shadow-light),
    inset -2px -2px var(--win-shadow-dark);
}

.win-outset-thin {
  background-color: var(--win-bg);
  box-shadow: 
    inset 1px 1px var(--win-light),
    inset -1px -1px var(--win-shadow-dark);
}

.win-inset {
  background-color: #ffffff;
  box-shadow: 
    inset 1px 1px var(--win-shadow-dark),
    inset -1px -1px var(--win-light),
    inset 2px 2px var(--win-shadow-darkest),
    inset -2px -2px var(--win-shadow-light);
}

.win-inset-flat {
  background-color: var(--win-bg);
  box-shadow: 
    inset 1px 1px var(--win-shadow-dark),
    inset -1px -1px var(--win-light);
}

/* Desktop Canvas */
#desktop-viewport {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--taskbar-height);
  background-color: var(--win-teal);
  overflow: hidden;
}

/* Desktop Grid & Shortcuts */
.desktop-shortcuts {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  height: 100%;
  padding: 10px;
  gap: 12px;
}

.desktop-icon {
  width: 75px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 4px;
  cursor: pointer;
  border: 1px transparent solid;
  border-radius: 2px;
}

.desktop-icon:hover {
  background-color: rgba(0, 0, 128, 0.2);
}

.desktop-icon.selected {
  border: 1px dotted #ffffff;
}

.desktop-icon.selected .icon-title {
  background-color: var(--win-selected);
  color: var(--win-selected-text);
}

.desktop-icon img {
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
  pointer-events: none;
}

.icon-title {
  color: #ffffff;
  font-size: 11px;
  padding: 1px 3px;
  text-shadow: 1px 1px 1px #000000;
  line-height: 1.2;
  word-break: break-word;
}

/* Windows */
.win-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 180px;
  background-color: var(--win-bg);
  padding: 3px;
  z-index: 10;
  box-shadow: 
    inset 1px 1px var(--win-light),
    inset -1px -1px var(--win-shadow-darkest),
    inset 2px 2px var(--win-shadow-light),
    inset -2px -2px var(--win-shadow-dark),
    3px 3px 10px rgba(0,0,0,0.3);
}

.win-window.active-window {
  z-index: 100;
}

.win-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 20px;
  background: linear-gradient(90deg, var(--win-title-inactive-left), var(--win-title-inactive-right));
  padding: 2px 3px;
  color: #c0c0c0;
  font-weight: bold;
  font-size: 11px;
  cursor: move;
}

.win-window.active-window .win-titlebar {
  background: linear-gradient(90deg, var(--win-title-active-left), var(--win-title-active-right));
  color: #ffffff;
}

.win-title-text {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.win-title-text img {
  width: 16px;
  height: 16px;
}

.win-controls {
  display: flex;
  gap: 2px;
}

.win-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 2px 8px;
  font-family: var(--font-win);
  font-size: 11px;
  text-align: center;
  margin: 0;
  border: none;
  background-color: var(--win-bg);
  color: var(--win-text);
  box-shadow: 
    inset 1px 1px var(--win-light),
    inset -1px -1px var(--win-shadow-darkest),
    inset 2px 2px var(--win-shadow-light),
    inset -2px -2px var(--win-shadow-dark);
  cursor: pointer;
  white-space: nowrap;
}

.win-titlebar-btn {
  width: 16px;
  height: 14px;
  padding: 0;
  font-size: 9px;
  font-weight: bold;
  line-height: 12px;
}

.win-btn:active {
  box-shadow: 
    inset 1px 1px var(--win-shadow-darkest),
    inset -1px -1px var(--win-light),
    inset 2px 2px var(--win-shadow-dark),
    inset -2px -2px var(--win-shadow-light);
  padding: 3px 7px 1px 9px;
}

.win-titlebar-btn:active {
  padding: 1px 0 0 1px;
}

/* Window Content Body */
.win-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 2px;
}

/* Menu Bar */
.win-menubar {
  display: flex;
  gap: 12px;
  padding: 2px 6px;
  background-color: var(--win-bg);
  border-bottom: 1px solid var(--win-shadow-dark);
}

.win-menu-item {
  position: relative;
  cursor: pointer;
  padding: 1px 4px;
}

.win-menu-item:hover {
  background-color: var(--win-selected);
  color: var(--win-selected-text);
}

/* Status Bar */
.win-status-bar {
  display: flex;
  align-items: center;
  height: 22px;
  margin-top: 2px;
  padding: 2px 4px;
  gap: 6px;
  font-size: 11px;
}

.win-status-cell {
  padding: 2px 6px;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}

/* Taskbar */
#taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  background-color: var(--win-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px;
  z-index: 9999;
  box-shadow: 
    inset 0 1px var(--win-light),
    inset 0 2px var(--win-shadow-light);
}

.start-button-wrapper {
  display: flex;
  align-items: center;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 2px 8px;
  font-family: var(--font-win);
  font-weight: bold;
  font-size: 12px;
  background-color: var(--win-bg);
  border: none;
  box-shadow: 
    inset 1px 1px var(--win-light),
    inset -1px -1px var(--win-shadow-darkest),
    inset 2px 2px var(--win-shadow-light),
    inset -2px -2px var(--win-shadow-dark);
  cursor: pointer;
}

.start-btn:active, .start-btn.active {
  box-shadow: 
    inset 1px 1px var(--win-shadow-darkest),
    inset -1px -1px var(--win-light),
    inset 2px 2px var(--win-shadow-dark),
    inset -2px -2px var(--win-shadow-light);
  background-color: #b5b5b5;
}

.start-btn img {
  width: 16px;
  height: 16px;
}

/* Taskbar Active Items */
.taskbar-tasks {
  flex: 1;
  display: flex;
  gap: 3px;
  padding: 0 4px;
  overflow-x: auto;
}

.taskbar-task-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  max-width: 160px;
  min-width: 100px;
  padding: 2px 6px;
  font-size: 11px;
  background-color: var(--win-bg);
  box-shadow: 
    inset 1px 1px var(--win-light),
    inset -1px -1px var(--win-shadow-darkest),
    inset 2px 2px var(--win-shadow-light),
    inset -2px -2px var(--win-shadow-dark);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbar-task-btn.active {
  background-color: #dfdfdf;
  font-weight: bold;
  background-image: radial-gradient(#ffffff 50%, transparent 50%);
  background-size: 2px 2px;
  box-shadow: 
    inset 1px 1px var(--win-shadow-darkest),
    inset -1px -1px var(--win-light),
    inset 2px 2px var(--win-shadow-dark),
    inset -2px -2px var(--win-shadow-light);
}

.taskbar-task-btn img {
  width: 16px;
  height: 16px;
}

/* System Tray */
.system-tray {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 2px 8px;
  margin-left: auto;
}

.tray-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tray-clock {
  font-size: 11px;
  white-space: nowrap;
  padding: 0 4px;
}

/* Start Menu */
#start-menu {
  position: absolute;
  bottom: var(--taskbar-height);
  left: 2px;
  width: 200px;
  background-color: var(--win-bg);
  display: none;
  flex-direction: row;
  z-index: 10000;
  box-shadow: 
    inset 1px 1px var(--win-light),
    inset -1px -1px var(--win-shadow-darkest),
    inset 2px 2px var(--win-shadow-light),
    inset -2px -2px var(--win-shadow-dark),
    3px 3px 10px rgba(0,0,0,0.4);
}

#start-menu.open {
  display: flex;
}

.start-menu-sidebar {
  width: 28px;
  background: linear-gradient(180deg, #000080, #1084d0);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #ffffff;
  font-weight: bold;
  font-size: 14px;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  letter-spacing: 1px;
}

.start-menu-sidebar span {
  font-weight: 900;
}

.start-menu-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2px;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--win-text);
}

.start-menu-item:hover {
  background-color: var(--win-selected);
  color: var(--win-selected-text);
}

.start-menu-item img {
  width: 20px;
  height: 20px;
}

.start-icon-avatar {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 2px;
  flex-shrink: 0;
}

.start-menu-divider {
  height: 1px;
  margin: 3px 2px;
  border-bottom: 1px solid var(--win-light);
  background-color: var(--win-shadow-dark);
}

/* Mobile Responsive Adaptations */
@media (max-width: 768px) {
  .desktop-shortcuts {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: flex-start;
    gap: 16px;
    padding: 16px;
  }

  .desktop-icon {
    width: 80px;
    padding: 8px;
  }

  .desktop-icon img {
    width: 36px;
    height: 36px;
  }

  .icon-title {
    font-size: 12px;
  }

  .win-window {
    width: 96vw !important;
    height: 75vh !important;
    left: 2vw !important;
    top: 5vh !important;
    position: fixed !important;
  }

  .win-titlebar {
    height: 28px;
    font-size: 13px;
  }

  .win-btn {
    min-width: 24px;
    width: auto;
    height: 26px;
    padding: 2px 10px;
    font-size: 12px;
  }

  .win-titlebar-btn {
    width: 22px;
    height: 20px;
    font-size: 12px;
    line-height: 18px;
    padding: 0;
  }

  .taskbar-task-btn {
    max-width: 100px;
    font-size: 10px;
  }

  #start-menu {
    width: 240px;
  }
}
