* { box-sizing: border-box; }

:root {
  --gray: #c0c0c0;
  --gray-dark: #808080;
  --gray-darker: #404040;
  --gray-light: #dfdfdf;
  --navy: #000080;
  --navy-light: #1084d0;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: Tahoma, Geneva, "Segoe UI", Verdana, sans-serif;
  font-size: 12px;
  color: #000;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

/* ===== Boot screen ===== */
#boot-screen {
  position: fixed;
  inset: 0;
  background: #000;
  color: #b0b0b0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-inner { text-align: center; }
.boot-paw { width: 64px; height: 64px; }
.boot-title { font-size: 22px; margin: 10px 0 20px; letter-spacing: 1px; color: #e0e0e0; }
.boot-bar {
  width: 220px;
  height: 14px;
  border: 1px solid #808080;
  background: #101010;
  margin: 0 auto 10px;
  overflow: hidden;
}
.boot-bar-fill {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(45deg, #808080, #808080 6px, #a0a0a0 6px, #a0a0a0 12px);
  animation: boot-fill 1.8s ease forwards;
}
@keyframes boot-fill { to { width: 100%; } }
.boot-text { font-size: 12px; }
#boot-screen.hide { display: none; }

/* ===== Desktop ===== */
#desktop {
  position: relative;
  height: 100vh;
  width: 100vw;
  background-color: #008080;
  background-image: url("assets/wallpaper1.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

/* ===== Desktop icons ===== */
#icons {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 4px;
  height: calc(100vh - 80px);
  z-index: 2;
}

.icon {
  width: 100px;
  background: transparent;
  border: 1px dotted transparent;
  color: #fff;
  text-shadow: 1px 1px 1px #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  cursor: pointer;
  text-decoration: none;
  font-size: 11px;
  text-align: center;
}
.icon img { width: 32px; height: 32px; pointer-events: none; }
.icon span { line-height: 1.2; word-break: break-word; }
.icon:hover { border-color: rgba(255,255,255,0.5); }
.icon:focus, .icon.selected {
  outline: none;
  background: rgba(0,0,128,0.5);
  border: 1px dotted #fff;
}

/* ===== Windows 98 buttons ===== */
.win98-btn {
  display: inline-block;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  box-shadow: inset 1px 1px 0 var(--gray-light), inset -1px -1px 0 var(--gray-dark);
  padding: 4px 12px;
  font-family: inherit;
  font-size: 12px;
  color: #000;
  text-decoration: none;
  cursor: pointer;
}
.win98-btn:active {
  border-top: 2px solid var(--gray-darker);
  border-left: 2px solid var(--gray-darker);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  box-shadow: inset 1px 1px 0 var(--gray-dark), inset -1px -1px 0 var(--gray-light);
}

/* ===== Windows ===== */
.window {
  position: absolute;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  box-shadow: inset 1px 1px 0 var(--gray-light), inset -1px -1px 0 var(--gray-dark), 3px 3px 8px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  z-index: 10;
  max-width: 92vw;
  max-height: 82vh;
}
.window.open { display: flex; }
.window.minimized { display: none; }
.window.active { z-index: 50; }

.titlebar {
  background: linear-gradient(90deg, var(--navy), var(--navy-light));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 3px 3px 4px;
  font-weight: bold;
  cursor: move;
  flex: 0 0 auto;
}
.window:not(.active) .titlebar { background: linear-gradient(90deg, #808080, #b5b5b5); }
.title-icon { width: 16px; height: 16px; }
.title-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.title-btns { display: flex; gap: 2px; }
.tbtn {
  width: 18px;
  height: 16px;
  background: var(--gray);
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid var(--gray-darker);
  border-bottom: 1px solid var(--gray-darker);
  font-size: 11px;
  line-height: 1;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
}
.tbtn:active { border-color: var(--gray-darker) var(--gray-darker) #fff #fff; }

.menubar {
  background: var(--gray);
  border-bottom: 1px solid var(--gray-dark);
  display: flex;
  gap: 14px;
  padding: 2px 8px;
  font-size: 12px;
  flex: 0 0 auto;
}

.window-body {
  padding: 10px;
  overflow: auto;
  background: var(--gray);
  flex: 1 1 auto;
}
.window-body.no-pad { padding: 0; }

.about-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.about-header h2 { margin: 0; font-size: 16px; }
.ticker { color: var(--navy); font-weight: bold; letter-spacing: 1px; }

.specs { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.specs td { padding: 3px 4px; border-bottom: 1px dotted var(--gray-dark); font-size: 12px; }
.specs td:first-child { font-weight: bold; width: 40%; }
.mono { font-family: "Courier New", monospace; font-size: 11px; word-break: break-all; }
.fine-print { font-size: 10px; color: #333; margin-top: 8px; }

.notepad-area {
  width: 100%;
  height: 220px;
  border: none;
  resize: none;
  padding: 8px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  background: #fff;
}

.notepad-linkbar {
  display: flex;
  justify-content: flex-end;
  padding: 6px 8px;
  background: var(--gray);
  border-top: 1px solid var(--gray-dark);
  box-shadow: inset 0 1px 0 #fff;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  color: #000;
  text-decoration: none;
  border: 1px solid transparent;
}
.link-row img { width: 18px; height: 18px; }
.link-row:hover { border: 1px dotted var(--gray-darker); background: #d4d0c8; }

.litterbox-body { text-align: center; padding: 20px 10px; }

/* ===== MeowPaint ===== */
.paint-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--gray);
  border-bottom: 1px solid var(--gray-dark);
}
.swatch {
  width: 20px; height: 20px;
  border: 1px solid #000;
  cursor: pointer;
  padding: 0;
}
.swatch[data-color="#000000"] { outline: 2px solid #fff; outline-offset: -3px; }
.paint-clear { margin-left: auto; }
#paint-canvas { display: block; background: #fff; cursor: crosshair; touch-action: none; }

/* ===== Shutdown ===== */
#shutdown-screen {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
}
#shutdown-screen.show { display: flex; }
.shutdown-inner p { font-size: 16px; margin: 14px 0 20px; }

/* ===== Context menu ===== */
#context-menu {
  position: absolute;
  display: none;
  list-style: none;
  margin: 0;
  padding: 2px;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  z-index: 200;
  min-width: 160px;
}
#context-menu.show { display: block; }
#context-menu li { padding: 4px 10px; font-size: 12px; }
#context-menu li:hover { background: var(--navy); color: #fff; }
#context-menu li.sep { height: 1px; margin: 3px 2px; padding: 0; background: var(--gray-dark); border-bottom: 1px solid #fff; }

/* ===== Start menu ===== */
#start-menu {
  position: absolute;
  bottom: 32px;
  left: 2px;
  width: 200px;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  display: none;
  z-index: 150;
}
#start-menu.show { display: flex; }
.start-banner {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: linear-gradient(180deg, var(--navy), var(--navy-light));
  color: #fff;
  font-weight: bold;
  font-style: italic;
  font-size: 18px;
  padding: 10px 4px;
  display: flex;
  align-items: flex-end;
}
.start-items { list-style: none; margin: 0; padding: 3px; flex: 1; }
.start-items li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}
.start-items li img { width: 20px; height: 20px; }
.start-items li:hover { background: var(--navy); color: #fff; }
.start-items li.sep { height: 1px; padding: 0; margin: 3px 4px; background: var(--gray-dark); border-bottom: 1px solid #fff; cursor: default; }
.start-items li.sep:hover { background: var(--gray-dark); }

/* ===== Taskbar ===== */
#taskbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 30px;
  background: var(--gray);
  border-top: 2px solid #fff;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  z-index: 100;
}
#start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 2px 8px;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
}
#start-btn img { width: 18px; height: 18px; }
#start-btn.active, #start-btn:active {
  border-top: 2px solid var(--gray-darker);
  border-left: 2px solid var(--gray-darker);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
#task-buttons { display: flex; gap: 3px; flex: 1; overflow: hidden; height: 24px; }
.task-btn {
  height: 24px;
  padding: 2px 10px;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  font-size: 12px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.task-btn.active {
  border-top: 2px solid var(--gray-darker);
  border-left: 2px solid var(--gray-darker);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  background: #d4d0c8;
}
#tray {
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-top: 1px solid var(--gray-darker);
  border-left: 1px solid var(--gray-darker);
  box-shadow: inset 1px 1px 0 #fff;
  font-size: 12px;
}

/* ===== Meowsweeper ===== */
.ms-body { padding: 6px; background: var(--gray); }
.ms-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  margin-bottom: 6px;
  border-top: 2px solid var(--gray-dark);
  border-left: 2px solid var(--gray-dark);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.ms-counter {
  background: #000;
  color: #ff2020;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 18px;
  letter-spacing: 2px;
  padding: 1px 4px;
  min-width: 3ch;
  text-align: right;
  border-top: 1px solid var(--gray-darker);
  border-left: 1px solid var(--gray-darker);
  border-right: 1px solid #fff;
  border-bottom: 1px solid #fff;
}
.ms-reset {
  width: 26px;
  height: 26px;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ms-reset:active {
  border-top: 2px solid var(--gray-darker);
  border-left: 2px solid var(--gray-darker);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.ms-grid {
  display: grid;
  grid-template-columns: repeat(9, 20px);
  width: max-content;
  border-top: 2px solid var(--gray-dark);
  border-left: 2px solid var(--gray-dark);
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.ms-cell {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  font-family: Tahoma, sans-serif;
  background: var(--gray);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid var(--gray-darker);
  border-bottom: 2px solid var(--gray-darker);
  cursor: pointer;
  user-select: none;
}
.ms-cell.revealed {
  background: var(--gray);
  border: 1px solid var(--gray-dark);
  cursor: default;
}
.ms-cell.hairball.revealed { background: #d33b3b; font-size: 13px; }
.ms-cell.boom { background: #ff6b6b; }
.ms-cell.num-1 { color: #0000ff; }
.ms-cell.num-2 { color: #008000; }
.ms-cell.num-3 { color: #ff0000; }
.ms-cell.num-4 { color: #000080; }
.ms-cell.num-5 { color: #800000; }
.ms-cell.num-6 { color: #008080; }
.ms-cell.num-7 { color: #000000; }
.ms-cell.num-8 { color: #808080; }

@media (max-width: 640px) {
  .icon { width: 64px; }
  .window { max-width: 96vw; max-height: 78vh; left: 2vw !important; }
  .start-banner { font-size: 14px; }
  #start-menu { width: 170px; }
}
