/* ==========================================================================
   Windows 98 Desktop Experience
   Complete CSS for the daaarek.uk gateway desktop
   ========================================================================== */

/* --------------------------------------------------------------------------
   Win98 colour palette
   -------------------------------------------------------------------------- */

:root {
  --w98-face: #c0c0c0;          /* button / window face */
  --w98-face-dark: #b0b0b0;     /* pressed-in face */
  --w98-light: #ffffff;         /* highlight (outer top-left bevel) */
  --w98-light-soft: #dfdfdf;    /* inner highlight (rare) */
  --w98-shadow: #808080;        /* inner shadow */
  --w98-dark: #000000;          /* outer shadow */
  --w98-title: #000080;
  --w98-title-grad: #1084d0;
  --w98-title-inactive: #808080;
  --w98-title-inactive-grad: #b0b0b0;
  --w98-desktop: #008080;
  --w98-text: #000000;
  --w98-text-inv: #ffffff;
}

/* 3D bevel mixins, via inset box-shadow.
   Win98 "raised" = 2 nested 1px borders (white-outer + lightgrey-inner on
   top/left, darkgrey-outer + black-inner on bottom/right).
   Implementing as borders alone reads thin because the browser blends them;
   using inset box-shadow gives crisp 1-pixel edges that match the OS. */
.w98-raised {
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow);
}
.w98-raised-deep {
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow),
    inset 2px 2px 0 0 var(--w98-light-soft),
    inset -2px -2px 0 0 var(--w98-shadow);
}
.w98-sunken {
  background: var(--w98-face);
  border: 1px solid var(--w98-light);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow),
    inset -1px -1px 0 0 var(--w98-light-soft);
}
.w98-sunken-deep {
  background: #ffffff;
  border: 1px solid var(--w98-light);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow),
    inset -1px -1px 0 0 var(--w98-light-soft),
    inset 2px 2px 0 0 var(--w98-dark),
    inset -2px -2px 0 0 var(--w98-face);
}
.w98-pressed {
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow);
}

/* --------------------------------------------------------------------------
   Reset & Viewport Lock
   -------------------------------------------------------------------------- */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'MS Sans Serif', 'Microsoft Sans Serif', Tahoma, 'Segoe UI', sans-serif;
  font-size: 11px;
  color: var(--w98-text);
  user-select: none;
}

/* --------------------------------------------------------------------------
   Desktop Background
   -------------------------------------------------------------------------- */

body {
  background: #008080;
  position: relative;
}

/* Hourglass cursor during loading */
.win98-window.loading,
.win98-window.loading * {
  cursor: wait !important;
}

#desktop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 28px; /* above taskbar */
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Desktop Icons
   -------------------------------------------------------------------------- */

.desktop-icon {
  position: absolute;
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: default;
  padding: 4px 2px;
  gap: 3px;
  overflow: visible;
}

.desktop-icon .icon-img {
  font-size: 30px;
  line-height: 1;
  pointer-events: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
}

.desktop-icon .icon-label {
  font-size: 11px;
  color: #ffffff;
  text-shadow: 1px 1px 0 #000000, 1px 0 0 #000000, 0 1px 0 #000000;
  word-wrap: normal;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  white-space: normal;
  line-height: 1.15;
  padding: 1px 4px;
  max-width: 96px;
  width: max-content;
  border: 1px dotted transparent;
}

.desktop-icon.selected .icon-label {
  background: var(--w98-title);
  color: #ffffff;
  border: 1px dotted #ffffff;
  text-shadow: none;
}

/* Authentic Win98 selected-icon tint: ~50% blue dither over the image */
.desktop-icon.selected .icon-img {
  filter: brightness(0.55) contrast(1.1) sepia(1) hue-rotate(195deg) saturate(4);
}

.desktop-icon.classified {
  opacity: 0.5;
}

.desktop-icon.classified .icon-label {
  color: #c0c0c0;
}

/* --------------------------------------------------------------------------
   Desktop Context Menu
   -------------------------------------------------------------------------- */

.context-menu {
  position: fixed;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow),
    2px 2px 0 0 rgba(0,0,0,0.35);
  padding: 2px;
  min-width: 168px;
  z-index: 100000;
}

.context-menu-item {
  padding: 4px 24px 4px 26px;
  font-size: 11px;
  cursor: default;
  position: relative;
  color: var(--w98-text);
  white-space: nowrap;
}

.context-menu-item:hover {
  background: var(--w98-title);
  color: var(--w98-text-inv);
}

.context-menu-item.disabled {
  color: var(--w98-shadow);
  text-shadow: 1px 1px 0 #ffffff;
}

.context-menu-item.disabled:hover {
  background: transparent;
  color: var(--w98-shadow);
}

.context-menu-item.has-submenu::after {
  content: '\25B6';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
}

.context-menu-item.has-submenu > .context-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: -3px;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow),
    2px 2px 0 0 rgba(0,0,0,0.35);
  padding: 2px;
  min-width: 160px;
  z-index: 1;
}

.context-menu-item.has-submenu:hover > .context-submenu {
  display: block;
}

.context-menu-divider {
  height: 0;
  border-top: 1px solid var(--w98-shadow);
  border-bottom: 1px solid var(--w98-light);
  margin: 3px 1px;
}

/* --------------------------------------------------------------------------
   Drag-Select Rectangle
   -------------------------------------------------------------------------- */

.select-box {
  position: fixed;
  border: 1px dotted #000000;
  background: rgba(0, 0, 128, 0.1);
  z-index: 50;
  pointer-events: none;
}

.desktop-icon.revealing {
  animation: revealIcon 0.4s ease forwards;
}

.desktop-icon.revealing .icon-img {
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
  border-radius: 4px;
}

@keyframes revealIcon {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   Window Chrome
   -------------------------------------------------------------------------- */

.win98-window {
  position: absolute;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow),
    inset 2px 2px 0 0 var(--w98-light-soft),
    inset -2px -2px 0 0 var(--w98-shadow),
    2px 2px 0 0 rgba(0, 0, 0, 0.3);
  padding: 3px;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 120px;
  z-index: 100;
}

.win98-window.focused {
  z-index: 200;
}

.win98-window.minimized {
  z-index: -1 !important;
  pointer-events: none;
  opacity: 0;
}

.win98-window.maximized {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 28px;
  width: auto !important;
  height: auto !important;
  border: none;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Title Bar
   -------------------------------------------------------------------------- */

.win-titlebar {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, var(--w98-title) 0%, var(--w98-title-grad) 100%);
  color: var(--w98-text-inv);
  font-weight: bold;
  font-size: 11px;
  padding: 2px 2px 2px 3px;
  height: 18px;
  user-select: none;
  cursor: default;
  flex-shrink: 0;
  gap: 4px;
}

.win98-window:not(.focused) .win-titlebar {
  background: linear-gradient(90deg, var(--w98-title-inactive) 0%, var(--w98-title-inactive-grad) 100%);
}

.win-titlebar .win-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-titlebar .win-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  letter-spacing: 0;
}

.win-titlebar .win-controls {
  display: flex;
  gap: 1px;
  flex-shrink: 0;
}

.win-titlebar .win-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow);
  padding: 0;
  font-size: 0; /* hide any text fallback */
  cursor: default;
  color: var(--w98-text);
  flex-shrink: 0;
  position: relative;
}

.win-titlebar .win-btn:active {
  box-shadow: inset 1px 1px 0 0 var(--w98-shadow);
}

/* Pixel-art glyphs for window controls, drawn via SVG data-uri so they
   stay crisp at 1× and 2× DPI alike. Each is a 9×9 pixel art mark
   centred inside the 16×14 button. */
.win-titlebar .win-btn.minimize-btn::before {
  content: '';
  width: 6px;
  height: 2px;
  background: var(--w98-text);
  margin-top: 6px;
}
.win-titlebar .win-btn.maximize-btn::before {
  content: '';
  width: 8px;
  height: 8px;
  border: 1px solid var(--w98-text);
  border-top-width: 2px;
  background: transparent;
}
.win98-window.maximized .win-titlebar .win-btn.maximize-btn::before {
  /* restore-down glyph: small overlapping squares */
  width: 8px;
  height: 8px;
  border: 1px solid var(--w98-text);
  border-top-width: 2px;
  box-shadow:
    -2px 2px 0 -1px var(--w98-face),
    -2px 2px 0 0 var(--w98-text);
}
.win-titlebar .win-btn.close-btn::before {
  content: '';
  width: 8px;
  height: 8px;
  background:
    linear-gradient(45deg, transparent 42%, var(--w98-text) 42%, var(--w98-text) 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, var(--w98-text) 42%, var(--w98-text) 58%, transparent 58%);
  background-size: 100% 100%;
}

.win-titlebar .win-btn:active::before {
  transform: translate(1px, 1px);
}

/* --------------------------------------------------------------------------
   Window Content
   -------------------------------------------------------------------------- */

.win-content {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--w98-light);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow),
    inset -1px -1px 0 0 var(--w98-light-soft),
    inset 2px 2px 0 0 var(--w98-dark),
    inset -2px -2px 0 0 var(--w98-face);
  margin: 0;
  overflow: auto;
  position: relative;
}

/* Menu bar — sits between titlebar and content */
.win-menubar {
  display: flex;
  align-items: center;
  height: 18px;
  background: var(--w98-face);
  font-size: 11px;
  padding: 1px 2px;
  margin-top: 1px;
  flex-shrink: 0;
  gap: 0;
}

.win-menubar .menu-item {
  padding: 2px 6px;
  cursor: default;
  border: 1px solid transparent;
  color: var(--w98-text);
}

.win-menubar .menu-item:hover,
.win-menubar .menu-item.open {
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow);
  padding: 3px 5px 1px 7px;
}

.win-menubar .menu-item .menu-underline {
  text-decoration: underline;
}

/* Status bar — sits below content */
.win-statusbar {
  display: flex;
  align-items: stretch;
  height: 20px;
  margin-top: 2px;
  font-size: 11px;
  gap: 2px;
  flex-shrink: 0;
}

.win-statusbar .status-cell {
  background: var(--w98-face);
  border: 1px solid var(--w98-light);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow),
    inset -1px -1px 0 0 var(--w98-light-soft);
  padding: 2px 6px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: var(--w98-text);
  min-width: 0;
}

.win-statusbar .status-cell:first-child {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Resize Handles (edges + corners)
   -------------------------------------------------------------------------- */

.win-resize {
  position: absolute;
  z-index: 1;
}

/* Edges */
.win-resize-n  { top: -3px; left: 4px; right: 4px; height: 6px; cursor: ns-resize; }
.win-resize-s  { bottom: -3px; left: 4px; right: 4px; height: 6px; cursor: ns-resize; }
.win-resize-w  { left: -3px; top: 4px; bottom: 4px; width: 6px; cursor: ew-resize; }
.win-resize-e  { right: -3px; top: 4px; bottom: 4px; width: 6px; cursor: ew-resize; }

/* Corners */
.win-resize-nw { top: -3px; left: -3px; width: 10px; height: 10px; cursor: nwse-resize; }
.win-resize-ne { top: -3px; right: -3px; width: 10px; height: 10px; cursor: nesw-resize; }
.win-resize-sw { bottom: -3px; left: -3px; width: 10px; height: 10px; cursor: nesw-resize; }
.win-resize-se { bottom: -3px; right: -3px; width: 14px; height: 14px; cursor: nwse-resize;
  background:
    linear-gradient(135deg,
      transparent 30%,
      #808080 30%, #808080 40%,
      transparent 40%, transparent 50%,
      #808080 50%, #808080 60%,
      transparent 60%, transparent 70%,
      #808080 70%, #808080 80%,
      transparent 80%
    );
}

.win98-window.maximized .win-resize {
  display: none;
}

/* --------------------------------------------------------------------------
   Taskbar
   -------------------------------------------------------------------------- */

#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--w98-face);
  border-top: 1px solid var(--w98-light);
  box-shadow: inset 0 -1px 0 0 var(--w98-shadow);
  display: flex;
  align-items: center;
  padding: 2px;
  z-index: 10000;
  gap: 3px;
}

/* --------------------------------------------------------------------------
   Start Button
   -------------------------------------------------------------------------- */

.start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow);
  padding: 2px 5px 2px 3px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  font-size: 11px;
  font-weight: bold;
  cursor: default;
  height: 22px;
  flex-shrink: 0;
  color: var(--w98-text);
  position: relative;
}

.start-btn:active,
.start-btn.active {
  box-shadow: inset 1px 1px 0 0 var(--w98-shadow);
  padding: 3px 4px 1px 4px;
}

/* Authentic 4-colour Windows 98 flag, drawn as inline SVG */
.start-btn .start-logo {
  width: 18px;
  height: 16px;
  display: inline-block;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 16' shape-rendering='crispEdges'><path d='M2 3 L8 2 L8 7 L2 8 Z' fill='%23e21b1b'/><path d='M9 2 L16 1 L16 7 L9 7 Z' fill='%2300b300'/><path d='M2 9 L8 8 L8 14 L2 15 Z' fill='%230066ff'/><path d='M9 8 L16 7 L16 14 L9 15 Z' fill='%23ffb800'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  flex-shrink: 0;
  filter: drop-shadow(0.5px 0.5px 0 rgba(0,0,0,0.3));
}

.start-btn:focus {
  outline: 1px dotted var(--w98-text);
  outline-offset: -4px;
}

/* --------------------------------------------------------------------------
   Quick Launch Divider
   -------------------------------------------------------------------------- */

.taskbar-divider {
  width: 0;
  height: 20px;
  border-left: 1px solid var(--w98-shadow);
  border-right: 1px solid var(--w98-light);
  margin: 0 2px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Taskbar Window Buttons
   -------------------------------------------------------------------------- */

#taskbar-buttons {
  display: flex;
  flex: 1;
  gap: 3px;
  overflow: hidden;
  min-width: 0;
}

.taskbar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow);
  padding: 2px 6px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  font-size: 11px;
  cursor: default;
  height: 22px;
  max-width: 170px;
  min-width: 0;
  flex-shrink: 1;
  color: var(--w98-text);
}

.taskbar-btn .taskbar-btn-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.taskbar-btn .taskbar-btn-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.taskbar-btn.active {
  background:
    repeating-linear-gradient(
      45deg,
      var(--w98-face) 0 1px,
      var(--w98-light) 1px 2px
    );
  box-shadow: inset 1px 1px 0 0 var(--w98-shadow);
  padding: 3px 5px 1px 7px;
}

/* --------------------------------------------------------------------------
   System Tray
   -------------------------------------------------------------------------- */

#system-tray, .system-tray {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--w98-face);
  border: 1px solid var(--w98-light);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow),
    inset -1px -1px 0 0 var(--w98-light-soft);
  padding: 1px 8px 1px 4px;
  height: 22px;
  flex-shrink: 0;
  margin-left: auto;
}

#system-tray .tray-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  flex-shrink: 0;
}

#system-tray .tray-icon img,
#system-tray .tray-icon svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* Muted state for the volume tray icon — draws the classic red "no-entry"
   slash across the speaker. The icon stays clickable; the overlay is
   pointer-events:none so it doesn't swallow the toggle click. */
#system-tray .tray-icon.muted {
  position: relative;
}
#system-tray .tray-icon.muted::after {
  content: '';
  position: absolute;
  left: 1px; top: 50%;
  width: 14px;
  border-top: 2px solid #cc0000;
  transform: rotate(-30deg);
  pointer-events: none;
}

#clock {
  font-size: 11px;
  white-space: nowrap;
  padding-left: 2px;
}

.system-tray .clock {
  font-size: 11px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Start Menu
   -------------------------------------------------------------------------- */

#start-menu {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 0;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow),
    3px 3px 0 0 rgba(0, 0, 0, 0.35);
  z-index: 10001;
}

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

.start-sidebar {
  width: 22px;
  background: linear-gradient(180deg, #1a1a8c 0%, #000060 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  flex-shrink: 0;
}

.start-sidebar-text {
  color: #c0c0c0;
  font-size: 15px;
  font-weight: bold;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 1px;
  white-space: nowrap;
  text-shadow: 1px 0 0 rgba(0,0,0,0.5);
}

.start-sidebar-text b {
  color: #ffffff;
}

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

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 24px 5px 6px;
  cursor: default;
  font-size: 11px;
  white-space: nowrap;
  position: relative;
  color: var(--w98-text);
}

.start-menu-item:hover {
  background: var(--w98-title);
  color: var(--w98-text-inv);
}

.start-menu-item .item-icon {
  font-size: 18px;
  line-height: 1;
  width: 24px;
  height: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.start-menu-item.has-submenu::after {
  content: '\25B6';
  position: absolute;
  right: 6px;
  font-size: 8px;
}

.start-menu-item.disabled {
  color: #808080;
}

.start-menu-item.disabled:hover {
  background: transparent;
  color: #808080;
}

.start-menu-divider {
  height: 0;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #ffffff;
  margin: 2px 4px;
}

/* --------------------------------------------------------------------------
   Start Submenu (Programs flyout)
   -------------------------------------------------------------------------- */

.start-submenu {
  display: none;
  position: absolute;
  left: 100%;
  bottom: 0;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow),
    3px 3px 0 0 rgba(0, 0, 0, 0.35);
  min-width: 180px;
  padding: 2px 0;
  z-index: 10002;
}

.start-submenu.open {
  display: block;
}

.start-submenu .start-menu-item {
  padding: 4px 8px;
}

/* Nested submenus (Games, Accessories inside Programs) */
.start-submenu .has-submenu > .start-submenu {
  bottom: auto;
  top: 0;
}

.start-submenu .has-submenu {
  position: relative;
}

.start-submenu .has-submenu::after {
  content: '\25B6';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
}

/* --------------------------------------------------------------------------
   Pattern Grid (Security Dialog)
   -------------------------------------------------------------------------- */

.pattern-grid {
  display: inline-grid;
  grid-template-columns: repeat(5, 28px);
  grid-template-rows: repeat(5, 28px);
  gap: 4px;
  margin-bottom: 8px;
  user-select: none;
  touch-action: none;
}

.pattern-cell {
  width: 28px;
  height: 28px;
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.pattern-cell:hover {
  background: #d4d0c8;
}

.pattern-cell.active {
  background: var(--w98-title);
  box-shadow: inset 1px 1px 0 0 var(--w98-shadow);
}

.pattern-grid.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* --------------------------------------------------------------------------
   Win98 Buttons (generic)
   -------------------------------------------------------------------------- */

.win98-btn {
  background: var(--w98-face);
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow);
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  font-size: 11px;
  padding: 4px 16px;
  min-width: 75px;
  cursor: default;
  color: var(--w98-text);
  text-align: center;
}

.win98-btn:active {
  box-shadow: inset 1px 1px 0 0 var(--w98-shadow);
  padding: 5px 15px 3px 17px;
}

.win98-btn:focus {
  outline: 1px dotted var(--w98-text);
  outline-offset: -4px;
}

/* --------------------------------------------------------------------------
   Easter Egg: Internet Explorer
   -------------------------------------------------------------------------- */

/* IE5-style upper toolbar: large icon+label buttons grouped by separator */
.ie-bigbar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 1px 2px 2px;
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-shrink: 0;
}

.ie-bigbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px 8px 1px;
  background: #c0c0c0;
  border: 1px solid transparent;
  font: 11px 'MS Sans Serif', Tahoma, sans-serif;
  color: var(--w98-text);
  cursor: default;
  min-width: 48px;
}

.ie-bigbtn:not(:disabled):hover {
  border: 1px solid var(--w98-dark);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-shadow);
}

.ie-bigbtn:not(:disabled):active {
  box-shadow:
    inset 1px 1px 0 0 var(--w98-shadow),
    inset -1px -1px 0 0 var(--w98-light);
}

.ie-bigbtn:disabled .ie-bigbtn-label {
  color: var(--w98-shadow);
  text-shadow: 1px 1px 0 #ffffff;
}

.ie-bigbtn:disabled .ie-bigbtn-icon {
  opacity: 0.45;
}

.ie-bigbtn-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ie-bigbtn-label {
  font-size: 11px;
  line-height: 1;
}

.ie-bigbar-sep {
  width: 0;
  margin: 4px 4px;
  border-left: 1px solid var(--w98-shadow);
  border-right: 1px solid var(--w98-light);
}

/* CSS-drawn glyphs (monochrome — no colour emoji) */
.ie-icon-back, .ie-icon-fwd {
  width: 0; height: 0;
  border-style: solid;
}
.ie-icon-back {
  border-width: 8px 11px 8px 0;
  border-color: transparent #1a5a99 transparent transparent;
}
.ie-icon-fwd {
  border-width: 8px 0 8px 11px;
  border-color: transparent transparent transparent #1a5a99;
}
.ie-icon-stop {
  width: 14px; height: 14px;
  background: #cc0000;
  border-radius: 50%;
  position: relative;
}
.ie-icon-stop::before, .ie-icon-stop::after {
  content: '';
  position: absolute;
  top: 6px; left: 3px;
  width: 8px; height: 2px;
  background: #fff;
  transform-origin: center;
}
.ie-icon-stop::before { transform: rotate(45deg); }
.ie-icon-stop::after  { transform: rotate(-45deg); }
.ie-icon-refresh {
  width: 16px; height: 16px;
  border: 3px solid #1a8a3a;
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  position: relative;
  transform: rotate(45deg);
}
.ie-icon-refresh::after {
  content: '';
  position: absolute;
  top: -4px; right: -2px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent #1a8a3a;
}
.ie-icon-home {
  width: 16px; height: 12px;
  background: #b85a25;
  position: relative;
  margin-top: 6px;
}
.ie-icon-home::before {
  content: '';
  position: absolute;
  top: -8px; left: -3px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 11px 8px 11px;
  border-color: transparent transparent #b85a25 transparent;
}
.ie-icon-home::after {
  content: '';
  position: absolute;
  bottom: 0; left: 6px;
  width: 4px; height: 6px;
  background: #5a2e1a;
}

.ie-toolbar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ie-nav-btn {
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  font-size: 10px;
  padding: 1px 4px;
  cursor: pointer;
  color: #000;
  line-height: 1;
}

.ie-nav-btn:active {
  border-style: inset;
}

.ie-toolbar label {
  font-size: 11px;
  flex-shrink: 0;
}

.ie-toolbar input.ie-address {
  flex: 1;
  border: 2px inset #808080;
  background: #ffffff;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 11px;
  padding: 1px 4px;
  color: #000000;
  min-width: 0;
}

.ie-go-btn {
  font-size: 11px;
  padding: 1px 8px;
  flex-shrink: 0;
}

/* IE home page */
.ie-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #ffffff;
  color: #333;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  text-align: center;
  padding: 20px;
}

.ie-home-logo {
  font-size: 64px;
  margin-bottom: 12px;
}

.ie-home-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 4px;
}

.ie-home-subtitle {
  font-size: 12px;
  color: #666;
  margin-bottom: 16px;
}

.ie-home-hint {
  font-size: 11px;
  color: #999;
  font-style: italic;
  line-height: 1.4;
}

/* IE start page (about:home) */
.ie-startpage {
  background: #ffffff;
  height: 100%;
  overflow: auto;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  color: #000;
}

.ie-startpage-header {
  background: linear-gradient(180deg, #0066cc 0%, #003399 100%);
  color: #fff;
  padding: 14px 20px;
  text-align: center;
}

.ie-startpage-logo {
  font-size: 36px;
  margin-bottom: 4px;
  line-height: 1;
}

.ie-startpage-title {
  font-size: 15px;
  font-weight: bold;
}

.ie-startpage-subtitle {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
}

.ie-startpage-section {
  padding: 10px 18px;
  border-bottom: 1px solid #e0e0e0;
}

.ie-startpage-section-title {
  font-size: 12px;
  font-weight: bold;
  color: #003399;
  margin-bottom: 8px;
  padding-bottom: 2px;
  border-bottom: 1px solid #e0e0e0;
}

.ie-startpage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.ie-startpage-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  text-decoration: none;
  color: #000;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}

.ie-startpage-tile:hover {
  background: #e8f0ff;
  border-color: #99b8e0;
}

.ie-startpage-tile-icon {
  font-size: 26px;
  margin-bottom: 3px;
  line-height: 1;
}

.ie-startpage-tile-label {
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
}

.ie-startpage-links {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ie-startpage-link {
  font-size: 12px;
  color: #003399;
  text-decoration: none;
  cursor: pointer;
  padding: 2px 4px;
}

.ie-startpage-link:hover {
  text-decoration: underline;
  background: #f0f4ff;
}

.ie-startpage-link-icon {
  margin-right: 4px;
}

.ie-startpage-hint {
  font-size: 11px;
  color: #666;
  font-style: italic;
  padding: 8px 18px 14px;
}

/* IE error page */
.ie-error {
  background: #ffffff;
  height: 100%;
  padding: 24px 32px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  color: #333;
  overflow: auto;
}

.ie-error-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.ie-error-title {
  font-size: 16px;
  font-weight: bold;
  color: #003399;
  margin-bottom: 16px;
}

.ie-error-detail {
  font-size: 11px;
  color: #666;
  background: #f0f0f0;
  border: 1px solid #ccc;
  padding: 4px 8px;
  margin-bottom: 16px;
  font-family: 'Courier New', monospace;
}

.ie-error-reasons {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 4px;
}

.ie-error ul {
  font-size: 11px;
  margin: 0 0 16px 20px;
  padding: 0;
  line-height: 1.6;
}

.ie-error-try {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 8px;
}

.ie-error-action {
  font-size: 11px;
  color: #0066cc;
  cursor: pointer;
  text-decoration: underline;
}

.ie-error-action:hover {
  color: #003399;
}

/* Claude Code terminal window */
.ie-content {
  background: #0c0c0c;
  color: #33ff33;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.4;
  padding: 12px;
  white-space: pre;
  overflow: auto;
  min-height: 100%;
}

/* --------------------------------------------------------------------------
   Easter Egg: System Properties (My Computer)
   -------------------------------------------------------------------------- */

.system-props {
  padding: 12px;
  font-size: 12px;
}

.system-props table {
  border-collapse: collapse;
  width: 100%;
}

.system-props td {
  padding: 3px 8px;
  vertical-align: top;
}

.system-props td:first-child {
  font-weight: bold;
  white-space: nowrap;
  width: 1%;
}

.system-props .prop-section {
  font-weight: bold;
  color: #000080;
  padding: 8px 0 4px;
  border-bottom: 1px solid #c0c0c0;
  margin-bottom: 4px;
}

/* --------------------------------------------------------------------------
   Easter Egg: Recycle Bin
   -------------------------------------------------------------------------- */

.recycle-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 14px;
  color: #808080;
  text-align: center;
  padding: 20px;
}

/* Recycle Bin folder-detail view */
.recycle-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  font-size: 11px;
}

.recycle-col-header {
  display: flex;
  background: var(--w98-face);
  border-bottom: 1px solid var(--w98-shadow);
  flex-shrink: 0;
}

.recycle-col-cell {
  padding: 3px 8px;
  font-size: 11px;
  color: var(--w98-text);
  white-space: nowrap;
  border-right: 1px solid var(--w98-shadow);
  box-shadow:
    inset 1px 1px 0 0 var(--w98-light),
    inset -1px -1px 0 0 var(--w98-light-soft);
  min-width: 100px;
  cursor: default;
}

.recycle-col-cell.flex {
  flex: 1;
}

.recycle-body {
  flex: 1;
  background: #ffffff;
  overflow: auto;
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Easter Egg: Shut Down Dialog / Screen
   -------------------------------------------------------------------------- */

#shutdown-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FF8C00;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#shutdown-screen.visible {
  opacity: 1;
  pointer-events: auto;
}

#shutdown-screen .shutdown-text {
  color: #ffffff;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 24px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   BSOD Easter Egg
   -------------------------------------------------------------------------- */

#bsod-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000080;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

#bsod-screen.visible {
  opacity: 1;
  pointer-events: auto;
}

.bsod-text {
  color: #ffffff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
  max-width: 600px;
}

/* --------------------------------------------------------------------------
   Screensaver
   -------------------------------------------------------------------------- */

#screensaver {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999998;
  background: #000000;
  cursor: none;
}

/* --------------------------------------------------------------------------
   Divider (etched line, generic)
   -------------------------------------------------------------------------- */

.win-divider {
  border: none;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #ffffff;
  margin: 0 2px;
  height: 0;
}

/* --------------------------------------------------------------------------
   Scrollbar Styling (Win98-like)
   -------------------------------------------------------------------------- */

.win-content::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.win-content::-webkit-scrollbar-track {
  background: #c0c0c0;
  border: 1px inset #808080;
}

.win-content::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
}

.win-content::-webkit-scrollbar-button {
  display: block;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Selection Color
   -------------------------------------------------------------------------- */

::selection {
  background: #000080;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   iframe windows (service content)
   -------------------------------------------------------------------------- */

.win-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* --------------------------------------------------------------------------
   Mobile Responsive (max-width: 768px)
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  /* Larger touch targets for resize handles on mobile */
  .win-resize-n, .win-resize-s { height: 12px; }
  .win-resize-w, .win-resize-e { width: 12px; }
  .win-resize-nw, .win-resize-ne, .win-resize-sw { width: 20px; height: 20px; }
  .win-resize-se { width: 24px; height: 24px; }

  .desktop-icon {
    position: relative !important;
    left: auto !important;
    top: auto !important;
  }

  #desktop {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 8px;
    gap: 4px;
    overflow-y: auto;
  }

  #taskbar-buttons {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pattern-grid {
    grid-template-columns: repeat(5, 40px);
    grid-template-rows: repeat(5, 40px);
  }

  .pattern-cell {
    width: 40px;
    height: 40px;
  }
}
