@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --win-gray: #D4D0C8;
  --win-dark: #808080;
  --win-darker: #404040;
  --win-white: #FFFFFF;
  --win-blue: #0A246A;
  --win-blue-end: #A6CAF0;
  --win-btn-face: #D4D0C8;
  --win-highlight: #316AC5;
  --win-text: #000000;
  --win-desktop: #3A6EA5;
}

body {
  font-family: 'Tahoma', 'MS Sans Serif', sans-serif;
  font-size: 11px;
  background-color: var(--win-desktop);
  min-height: 100vh;
  overflow: hidden;
  cursor: default;
  user-select: none;
}

/* BEVEL HELPERS */
.raised {
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  box-shadow: inset 1px 1px 0 #E8E4DC, inset -1px -1px 0 #A09C95;
}

.sunken {
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
  box-shadow: inset 1px 1px 0 #A09C95;
}

.flat-border { border: 1px solid var(--win-dark); }

/* ── DESKTOP ── */
#desktop {
  position: relative;
  width: 100vw;
  height: calc(100vh - 30px);
  background: var(--win-desktop);
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  align-content: flex-start;
  padding: 10px;
  gap: 4px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  padding: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 8px;
}
.desktop-icon:hover {
  border: 1px dotted rgba(255,255,255,0.7);
  background: rgba(0,100,200,0.3);
}
.desktop-icon.selected {
  border: 1px solid rgba(255,255,255,0.8);
  background: rgba(49,106,197,0.6);
}
.desktop-icon img, .desktop-icon .icon-img {
  width: 32px;
  height: 32px;
  margin-bottom: 3px;
  image-rendering: pixelated;
}
.desktop-icon span {
  color: white;
  font-size: 11px;
  text-align: center;
  text-shadow: 1px 1px 1px #000;
  word-break: break-word;
  line-height: 1.2;
}

/* ── TASKBAR ── */
#taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 30px;
  background: var(--win-gray);
  border-top: 1px solid var(--win-white);
  box-shadow: inset 0 1px 0 #E8E4DC;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  z-index: 9999;
}

#start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: var(--win-btn-face);
  font-weight: bold;
  font-size: 11px;
  font-family: 'Tahoma', sans-serif;
  cursor: pointer;
  height: 24px;
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  box-shadow: inset 1px 1px 0 #E8E4DC;
}
#start-btn:active {
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
  box-shadow: inset 1px 1px 0 #A09C95;
}

.win-logo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  width: 16px; height: 16px;
}
.win-logo div { width: 7px; height: 7px; }
.win-logo div:nth-child(1) { background: #FF0000; }
.win-logo div:nth-child(2) { background: #00FF00; }
.win-logo div:nth-child(3) { background: #0000FF; }
.win-logo div:nth-child(4) { background: #FFFF00; }

.taskbar-divider {
  width: 2px; height: 22px;
  border-left: 1px solid var(--win-dark);
  border-right: 1px solid var(--win-white);
  margin: 0 2px;
}

.taskbar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  height: 22px;
  background: var(--win-btn-face);
  font-size: 11px;
  cursor: pointer;
  min-width: 120px;
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.taskbar-btn.active {
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
  background: #C0BDB5;
  font-weight: bold;
}

#system-tray {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 24px;
  background: var(--win-btn-face);
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
  font-size: 11px;
}
#clock { font-size: 11px; font-family: 'Tahoma', sans-serif; }

/* ── WINDOWS ── */
.window {
  position: absolute;
  background: var(--win-gray);
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  box-shadow: 2px 2px 8px rgba(0,0,0,0.4), inset 1px 1px 0 #E8E4DC;
  min-width: 200px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.window.hidden { display: none; }
.window.active { z-index: 200; }

/* ── TITLE BAR ── */
.title-bar {
  display: flex;
  align-items: center;
  padding: 3px 4px;
  height: 22px;
  cursor: move;
  flex-shrink: 0;
}
.title-bar.active-bar   { background: linear-gradient(to right, var(--win-blue), var(--win-blue-end)); }
.title-bar.inactive-bar { background: linear-gradient(to right, #7A96DF, #C9D5E8); }

.title-bar-icon { width: 16px; height: 16px; margin-right: 4px; image-rendering: pixelated; }

.title-bar-text {
  color: white;
  font-size: 11px;
  font-weight: bold;
  font-family: 'Tahoma', sans-serif;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.title-bar-buttons { display: flex; gap: 2px; }

.tb-btn {
  width: 17px; height: 15px;
  background: var(--win-btn-face);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  cursor: pointer;
  font-family: 'Marlett', 'Tahoma', sans-serif;
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  box-shadow: inset 1px 1px 0 #E8E4DC;
  line-height: 1;
}
.tb-btn:active {
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
  box-shadow: none;
}
.tb-btn.close-btn { color: #000; font-size: 8px; font-weight: 900; }
.tb-btn.close-btn:hover { background: #c0392b; color: white; }

/* ── MENU BAR ── */
.menu-bar {
  display: flex;
  align-items: center;
  background: var(--win-gray);
  padding: 2px;
  border-bottom: 1px solid var(--win-dark);
  flex-shrink: 0;
  position: relative;
}
.menu-item { padding: 2px 6px; cursor: pointer; font-size: 11px; position: relative; }
.menu-item:hover, .menu-item.open { background: var(--win-highlight); color: white; }

.dropdown {
  position: absolute;
  top: 100%; left: 0;
  background: var(--win-gray);
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  min-width: 160px;
  z-index: 9999;
  display: none;
}
.dropdown.visible { display: block; }
.dropdown-item {
  padding: 4px 24px 4px 28px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.dropdown-item:hover { background: var(--win-highlight); color: white; }
.dropdown-separator { height: 1px; background: var(--win-dark); margin: 2px; border-bottom: 1px solid var(--win-white); }

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 4px;
  border-bottom: 1px solid var(--win-dark);
  flex-shrink: 0;
}
.toolbar-btn {
  width: 24px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  background: var(--win-gray);
  border: 1px solid transparent;
}
.toolbar-btn:hover {
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
}
.toolbar-separator { width: 2px; height: 20px; border-left: 1px solid var(--win-dark); border-right: 1px solid var(--win-white); margin: 0 2px; }

/* ── ADDRESS BAR ── */
.address-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-bottom: 1px solid var(--win-dark);
  font-size: 11px;
  flex-shrink: 0;
}
.address-label { font-size: 11px; }
.address-input {
  flex: 1;
  height: 20px;
  padding: 1px 4px;
  font-size: 11px;
  font-family: 'Tahoma', sans-serif;
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
  background: white;
  outline: none;
}

/* ── WINDOW CONTENT ── */
.window-content {
  flex: 1;
  overflow: auto;
  padding: 8px;
  background: white;
  font-size: 11px;
}
.window-content.gray-bg { background: var(--win-gray); }

/* ── STATUS BAR ── */
.status-bar { display: flex; gap: 2px; padding: 2px 4px; border-top: 1px solid var(--win-dark); flex-shrink: 0; }
.status-item {
  flex: 1;
  font-size: 11px;
  padding: 1px 4px;
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
}

/* ── FILE GRID ── */
.file-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; align-content: flex-start; }
.file-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  padding: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
}
.file-item:hover { border: 1px dotted var(--win-highlight); background: rgba(49,106,197,0.1); }
.file-item.selected { border: 1px solid var(--win-highlight); background: rgba(49,106,197,0.2); }
.file-item .icon { font-size: 28px; line-height: 1; margin-bottom: 2px; }
.file-item span { font-size: 10px; line-height: 1.2; word-break: break-word; color: #000; }

/* ── SIDEBAR ── */
.sidebar { width: 150px; flex-shrink: 0; padding: 8px; border-right: 1px solid var(--win-dark); background: var(--win-gray); font-size: 11px; }
.sidebar-section { margin-bottom: 12px; }
.sidebar-title { font-weight: bold; color: var(--win-blue); font-size: 11px; margin-bottom: 4px; border-bottom: 1px solid var(--win-blue); padding-bottom: 2px; }
.sidebar-link { display: block; color: #00008B; text-decoration: underline; cursor: pointer; font-size: 11px; padding: 2px 0; }
.sidebar-link:hover { color: #FF6600; }

.split-layout { display: flex; flex: 1; overflow: hidden; }

/* ── NOTEPAD ── */
.notepad-area {
  width: 100%; height: 100%;
  resize: none;
  border: none; outline: none;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 4px;
  background: white;
}

/* ── DIALOG BUTTONS ── */
.dialog-btn {
  padding: 3px 16px;
  background: var(--win-btn-face);
  font-size: 11px;
  font-family: 'Tahoma', sans-serif;
  cursor: pointer;
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  box-shadow: inset 1px 1px 0 #E8E4DC;
  min-width: 75px;
}
.dialog-btn:active {
  border-top: 1px solid var(--win-darker);
  border-left: 1px solid var(--win-darker);
  border-right: 1px solid var(--win-white);
  border-bottom: 1px solid var(--win-white);
  box-shadow: none;
}
.dialog-btn.default-btn { border: 2px solid #000; padding: 2px 14px; }

/* ── RESIZE HANDLE ── */
.resize-handle {
  width: 12px; height: 12px;
  position: absolute;
  bottom: 0; right: 0;
  cursor: se-resize;
  font-size: 10px;
  color: var(--win-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── START MENU ── */
#start-menu {
  position: fixed;
  bottom: 30px; left: 0;
  width: 300px;
  background: var(--win-gray);
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  box-shadow: 2px 2px 8px rgba(0,0,0,0.4);
  display: none;
  z-index: 9999;
  flex-direction: column;
}
#start-menu.visible { display: flex; }

.start-header {
  background: linear-gradient(to right, var(--win-blue), var(--win-blue-end));
  padding: 8px 10px;
  display: flex;
  align-items: flex-end;
}
.start-header-text { color: white; font-size: 18px; font-weight: bold; font-style: italic; text-shadow: 1px 1px 2px rgba(0,0,0,0.6); letter-spacing: 1px; }

.start-menu-items { display: flex; flex-direction: column; padding: 4px 0; border-bottom: 1px solid var(--win-dark); }
.start-menu-item { display: flex; align-items: center; gap: 8px; padding: 5px 10px; cursor: pointer; font-size: 11px; }
.start-menu-item:hover { background: var(--win-highlight); color: white; }
.start-menu-icon { font-size: 20px; }
.start-menu-footer { display: flex; justify-content: flex-end; padding: 4px 8px; gap: 4px; }

/* ── ICON SVG ── */
.icon-computer { display: block; width: 32px; height: 32px; }

/* ── BSOD ── */
#bsod {
  display: none;
  position: fixed;
  inset: 0;
  background: #000080;
  color: white;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 40px;
  z-index: 99999;
  line-height: 1.8;
}
#bsod.visible { display: block; }
#bsod h2 {
  background: #C0C0C0;
  color: #000080;
  padding: 2px 8px;
  display: inline-block;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 20px;
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: var(--win-gray); }
::-webkit-scrollbar-thumb {
  background: var(--win-gray);
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
}
::-webkit-scrollbar-button {
  background: var(--win-gray);
  border-top: 1px solid var(--win-white);
  border-left: 1px solid var(--win-white);
  border-right: 1px solid var(--win-darker);
  border-bottom: 1px solid var(--win-darker);
  height: 16px; width: 16px;
}