/* ============================================================
   Windows 95 styles
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: "MS Sans Serif", "Pixelated MS Sans Serif", Tahoma, Geneva, sans-serif;
  font-size: 11px;
  user-select: none;
  -webkit-font-smoothing: none;
}

body {
  background: #094afd;
  cursor: default;
}

.hidden { display: none !important; }

/* ============================================================
   Boot screen
   ============================================================ */
#boot-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s;
}
#boot-screen.fade-out { opacity: 0; }
.boot-content {
  text-align: center;
  color: #fff;
}
.boot-logo { width: 180px; height: auto; }
.boot-title { font-size: 28px; margin: 14px 0; letter-spacing: 1px; }
.boot-title sub { font-size: 12px; vertical-align: super; }
.boot-progress {
  width: 240px;
  height: 14px;
  border: 2px inset #c0c0c0;
  background: #000;
  margin: 16px auto;
  padding: 1px;
}
.boot-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #000080, #1084d0);
  animation: bootbar 2.2s ease-in forwards;
}
@keyframes bootbar { to { width: 100%; } }
.boot-text { font-size: 14px; margin-top: 12px; }

.power-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   Desktop
   ============================================================ */
#desktop {
  position: fixed;
  inset: 0;
  background: #094afd;
}

#desktop-icons {
  position: absolute;
  inset: 8px 0 36px 8px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
}

.desktop-icon {
  width: 76px;
  height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  cursor: default;
  border: 1px dotted transparent;
}
.desktop-icon img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  margin-bottom: 4px;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.3));
}
.desktop-icon span {
  color: #fff;
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
  text-shadow: 1px 1px 0 #000;
  padding: 1px 2px;
}
.desktop-icon.selected {
  border: 1px dotted #fff;
}
.desktop-icon.selected span {
  background: #000080;
}
.desktop-icon.selected img {
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.3)) brightness(0.7) sepia(1) hue-rotate(180deg) saturate(4);
}

#windows-container {
  position: absolute;
  inset: 0 0 28px 0;
  pointer-events: none;
}
#windows-container > * { pointer-events: auto; }

/* ============================================================
   Windows (the draggable kind)
   ============================================================ */
.window {
  position: absolute;
  min-width: 200px;
  min-height: 120px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow:
    inset -1px -1px 0 #808080,
    inset 1px 1px 0 #fff;
  display: flex;
  flex-direction: column;
  padding: 2px;
}
.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100vh - 28px) !important;
}

.title-bar {
  height: 18px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 2px 2px 2px 4px;
  font-weight: bold;
  cursor: default;
  flex-shrink: 0;
}
.window.inactive .title-bar {
  background: linear-gradient(90deg, #808080, #c0c0c0);
  color: #d0d0d0;
}
.title-bar-icon {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  image-rendering: pixelated;
}
.title-bar-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}
.title-bar-controls {
  display: flex;
  gap: 2px;
}
.title-bar-controls button {
  width: 16px;
  height: 14px;
  padding: 0;
  font-family: "Marlett", "MS Sans Serif", sans-serif;
  font-size: 9px;
  font-weight: bold;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  color: #000;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.title-bar-controls button:active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
}
.title-bar-controls button:focus { outline: none; }

.menu-bar {
  display: flex;
  background: #c0c0c0;
  padding: 1px 0;
  border-bottom: 1px solid #808080;
  flex-shrink: 0;
}
.menu-bar > span {
  padding: 2px 6px;
  cursor: default;
}
.menu-bar > span:hover { background: #000080; color: #fff; }
.menu-bar > span u { text-decoration: underline; }

.window-body {
  flex: 1;
  min-height: 0;
  background: #c0c0c0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.status-bar {
  height: 18px;
  border-top: 1px solid #fff;
  box-shadow: inset 0 1px 0 #808080;
  display: flex;
  padding: 2px 4px;
  font-size: 11px;
  flex-shrink: 0;
}
.status-bar > * {
  flex: 1;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  padding: 1px 4px;
  margin-right: 2px;
}
.status-bar > *:last-child { margin-right: 0; }

.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  z-index: 10;
}

/* Generic Win95 buttons */
.win95-btn {
  min-width: 75px;
  height: 23px;
  padding: 0 8px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  font-family: inherit;
  font-size: 11px;
  cursor: default;
}
.win95-btn:active, .win95-btn.active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
  padding: 1px 7px 0 9px;
}
.win95-btn:focus { outline: 1px dotted #000; outline-offset: -4px; }

input[type="text"], textarea, .field {
  background: #fff;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #000;
  font-family: inherit;
  font-size: 11px;
  padding: 2px;
}

/* ============================================================
   Taskbar
   ============================================================ */
#taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 28px;
  background: #c0c0c0;
  border-top: 2px solid;
  border-color: #fff;
  box-shadow: inset 0 1px 0 #dfdfdf;
  display: flex;
  align-items: center;
  padding: 2px;
  z-index: 9000;
}

#start-button {
  height: 22px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 4px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  cursor: default;
}
#start-button img { width: 16px; height: 16px; image-rendering: pixelated; }
#start-button.active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
  padding: 1px 5px 0 5px;
}
#start-button u { text-decoration: underline; }

.taskbar-divider {
  width: 2px;
  height: 22px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
  margin: 0 3px;
}

#taskbar-items {
  flex: 1;
  display: flex;
  gap: 2px;
  overflow: hidden;
}
.taskbar-item {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  min-width: 130px;
  max-width: 180px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  font-size: 11px;
  cursor: default;
  overflow: hidden;
}
.taskbar-item img { width: 14px; height: 14px; image-rendering: pixelated; flex-shrink: 0; }
.taskbar-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.taskbar-item.active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
  background: linear-gradient(45deg, #c0c0c0 25%, #808080 25%, #808080 50%, #c0c0c0 50%, #c0c0c0 75%, #808080 75%);
  background-size: 4px 4px;
}

#taskbar-tray {
  height: 22px;
  display: flex;
  align-items: center;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  padding: 0 8px;
  font-size: 11px;
  min-width: 70px;
  justify-content: center;
}

/* ============================================================
   Start menu
   ============================================================ */
#start-menu {
  position: fixed;
  bottom: 28px;
  left: 2px;
  width: 200px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf, 2px 2px 4px rgba(0,0,0,0.3);
  display: flex;
  z-index: 10000;
  padding: 2px;
}

.start-side {
  width: 24px;
  background: linear-gradient(180deg, #808080, #000080);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
}
.start-side-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #c0c0c0;
  font-size: 18px;
  font-weight: bold;
  white-space: nowrap;
}
.start-side-text span { color: #fff; }

.start-list {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}
.start-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 4px 4px;
  cursor: default;
  position: relative;
  font-size: 12px;
}
.start-list li img {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.start-list li:hover {
  background: #000080;
  color: #fff;
}
.start-list li.has-submenu::after {
  content: '▶';
  position: absolute;
  right: 4px;
  font-size: 9px;
}
.start-list li.separator {
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
  height: 0;
  padding: 0;
  margin: 2px 2px;
}

/* Submenus */
.submenu {
  position: fixed;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf, 2px 2px 4px rgba(0,0,0,0.3);
  list-style: none;
  margin: 0;
  padding: 2px;
  min-width: 160px;
  z-index: 10001;
}
.submenu li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 16px 3px 4px;
  cursor: default;
  font-size: 12px;
}
.submenu li img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.submenu li:hover { background: #000080; color: #fff; }

/* ============================================================
   Context menu
   ============================================================ */
#context-menu {
  position: fixed;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf, 2px 2px 4px rgba(0,0,0,0.3);
  list-style: none;
  margin: 0;
  padding: 2px;
  min-width: 160px;
  z-index: 10001;
  font-size: 12px;
}
#context-menu li {
  padding: 3px 16px 3px 24px;
  cursor: default;
}
#context-menu li:hover:not(.separator):not(.disabled) {
  background: #000080;
  color: #fff;
}
#context-menu li.disabled { color: #808080; }
#context-menu li.separator {
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
  padding: 0;
  height: 0;
  margin: 2px 2px;
}

#menu-blocker {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

/* ============================================================
   App: Notepad
   ============================================================ */
.notepad-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.notepad-textarea {
  flex: 1;
  width: 100%;
  resize: none;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #000;
  font-family: "Courier New", monospace;
  font-size: 13px;
  padding: 4px;
  background: #fff;
  outline: none;
}

/* ============================================================
   App: Paint
   ============================================================ */
.paint-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.paint-content {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.paint-tools {
  width: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  padding: 2px;
  background: #c0c0c0;
  border-right: 1px solid #808080;
  align-content: flex-start;
}
.paint-tool {
  width: 24px;
  height: 24px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  font-size: 14px;
}
.paint-tool.active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
}
.paint-canvas-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #808080;
  padding: 4px;
  overflow: auto;
}
.paint-canvas-inner {
  background: #fff;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #000;
  width: fit-content;
}
.paint-canvas {
  display: block;
  cursor: crosshair;
  image-rendering: pixelated;
}
.paint-colors {
  height: 48px;
  display: flex;
  align-items: center;
  background: #c0c0c0;
  border-top: 1px solid #808080;
  padding: 4px;
  gap: 4px;
}
.paint-current-color {
  width: 32px;
  height: 32px;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #000;
  position: relative;
}
.paint-current-color::before, .paint-current-color::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid #000;
}
.paint-current-color::before { top: 2px; left: 2px; background: var(--fg, #000); z-index: 2; }
.paint-current-color::after { bottom: 2px; right: 2px; background: var(--bg, #fff); z-index: 1; }
.paint-color-grid {
  display: grid;
  grid-template-columns: repeat(14, 16px);
  grid-template-rows: 16px 16px;
  gap: 1px;
}
.paint-color {
  width: 16px;
  height: 16px;
  border: 1px solid #000;
  cursor: default;
}

/* ============================================================
   App: Minesweeper
   ============================================================ */
.mines-body {
  flex: 1;
  background: #c0c0c0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mines-header {
  width: 100%;
  height: 36px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
  margin-bottom: 6px;
}
.mines-counter {
  background: #000;
  color: #f00;
  font-family: "Courier New", monospace;
  font-size: 22px;
  font-weight: bold;
  padding: 0 4px;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  min-width: 44px;
  text-align: center;
  letter-spacing: 1px;
}
.mines-face {
  width: 26px;
  height: 26px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: default;
}
.mines-face:active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
}
.mines-grid-wrap {
  border: 3px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #000;
  background: #c0c0c0;
}
.mines-canvas {
  display: block;
  cursor: default;
  image-rendering: pixelated;
}

/* ============================================================
   App: My Computer / Explorer
   ============================================================ */
.explorer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.explorer-toolbar {
  display: flex;
  align-items: center;
  padding: 2px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  gap: 2px;
  flex-shrink: 0;
}
.explorer-toolbar-btn {
  height: 28px;
  min-width: 36px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  padding: 2px;
  cursor: default;
}
.explorer-toolbar-btn:active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
}
.explorer-toolbar-btn span { font-size: 16px; line-height: 1; }
.explorer-toolbar-btn.disabled { color: #808080; }

.explorer-address {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  background: #c0c0c0;
  gap: 4px;
  border-bottom: 1px solid #808080;
  flex-shrink: 0;
}
.explorer-address-label { font-size: 11px; }
.explorer-address-input {
  flex: 1;
  height: 22px;
  background: #fff;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px 0 #000;
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 11px;
  gap: 4px;
}
.explorer-address-input img { width: 14px; height: 14px; image-rendering: pixelated; }

.explorer-content {
  flex: 1;
  background: #fff;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
}
.explorer-item {
  width: 76px;
  height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  cursor: default;
  border: 1px dotted transparent;
  text-align: center;
}
.explorer-item img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  margin-bottom: 4px;
}
.explorer-item span {
  font-size: 11px;
  line-height: 1.2;
  padding: 1px 2px;
  color: #000;
}
.explorer-item.selected {
  border: 1px dotted #000;
}
.explorer-item.selected span {
  background: #000080;
  color: #fff;
}

/* ============================================================
   App: Internet Explorer
   ============================================================ */
.ie-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ie-toolbar {
  display: flex;
  align-items: center;
  padding: 2px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  gap: 4px;
  flex-shrink: 0;
}
.ie-toolbar-btn {
  height: 36px;
  min-width: 48px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #000 #000 #fff;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  padding: 2px 6px;
  cursor: default;
  gap: 2px;
}
.ie-toolbar-btn:active {
  border-color: #000 #fff #fff #000;
  box-shadow: inset 1px 1px 0 #808080;
}
.ie-toolbar-btn span.icon { font-size: 16px; line-height: 1; }
iframe.ie-content {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  background: #fff;
}
.ie-content {
  flex: 1;
  background: #fff;
  overflow: auto;
  padding: 16px;
  font-family: "Times New Roman", serif;
  font-size: 14px;
  color: #000;
}
.ie-content h1 {
  color: #000080;
  border-bottom: 2px solid #000080;
  padding-bottom: 4px;
}
.ie-content h2 { color: #000080; }
.ie-content a { color: #0000ee; text-decoration: underline; cursor: pointer; }
.ie-content a:visited { color: #551a8b; }
.ie-content img.banner {
  width: 100%;
  max-width: 468px;
  display: block;
  border: 2px ridge #c0c0c0;
}
.ie-content .marquee-box {
  background: #000;
  color: #0f0;
  font-family: "Courier New", monospace;
  padding: 6px;
  overflow: hidden;
  white-space: nowrap;
  margin: 8px 0;
}
.ie-content .marquee-inner {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 15s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
.ie-content table.retro {
  border: 2px ridge #c0c0c0;
  border-collapse: separate;
  margin: 8px 0;
}
.ie-content table.retro td {
  background: #ffffe0;
  padding: 4px 8px;
  border: 1px solid #808080;
}
.ie-content hr {
  border: 0;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
}

/* ============================================================
   Dialog box (for shutdown etc.)
   ============================================================ */
.dialog-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}
.dialog-message {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.dialog-message img { width: 32px; height: 32px; image-rendering: pixelated; }
.dialog-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* Touch / Pointer support */
.title-bar        { touch-action: none; }
.resize-handle    { touch-action: none; }
.paint-canvas     { touch-action: none; }
.mines-canvas     { touch-action: none; }

.desktop-icon, .win95-btn, #start-button,
.taskbar-item, .title-bar-controls button,
.paint-tool, .mines-face, .explorer-toolbar-btn,
.ie-toolbar-btn, .menu-bar > span,
.start-list li, .submenu li { touch-action: manipulation; }
