/* ============================================================
   WINDOWS 98 SHELL
   ============================================================ */

/* ------------------------------------------------------------
   FONT
   "Pixelated MS Sans Serif" — the bitmap conversion of the real
   Windows 98 UI font, from 98.css (MIT). It is a bitmap: it is
   only sharp at 11px and exact multiples, so every font-size in
   this file is 11px or 22px. See assets/icons/SOURCES.md.
   ------------------------------------------------------------ */
@font-face {
  font-family: "Pixelated MS Sans Serif";
  src: url("fonts/ms_sans_serif.woff2") format("woff2"),
       url("fonts/ms_sans_serif.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Pixelated MS Sans Serif";
  src: url("fonts/ms_sans_serif_bold.woff2") format("woff2"),
       url("fonts/ms_sans_serif_bold.woff") format("woff");
  font-weight: bold;
  font-style: normal;
  font-display: block;
}

/* ------------------------------------------------------------
   TOKENS
   ------------------------------------------------------------ */
#win98-shell {
  --face:         #c0c0c0;
  --hilite:       #ffffff;
  --light:        #dfdfdf;
  --shadow:       #808080;
  --dark:         #000000;
  --title-a:      #000080;
  --title-b:      #1084d0;
  --title-off-a:  #808080;
  --title-off-b:  #b5b5b5;
  --select:       #000080;
  --desktop-bg:   #008080;
  --text:         #000000;
  --text-dim:     #808080;
  --font:         "Pixelated MS Sans Serif", Tahoma, "MS Sans Serif", Verdana, sans-serif;

  --taskbar-h:    30px;
  --title-h:      20px;

  font-family: var(--font);
  font-size: 11px;
  color: var(--text);
  background: var(--desktop-bg);
  cursor: default;

  /* A bitmap font must not be smoothed, or the pixels turn to mush. */
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  font-smooth: never;
}

/* The original bitmaps are 16/32px; never let the browser interpolate them. */
.w98-ico {
  image-rendering: pixelated;
  flex: none;
  display: block;
}

/* ------------------------------------------------------------
   BEVELS — every 3D edge in the shell comes from these two
   ------------------------------------------------------------ */
.bevel-out {
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shadow);
}
.bevel-in {
  border: 2px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--light);
}
/* Single-line variants for thin chrome (status bars, trays). */
.bevel-thin-in {
  border: 1px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
}
.bevel-thin-out {
  border: 1px solid;
  border-color: var(--hilite) var(--shadow) var(--shadow) var(--hilite);
}

/* ------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------ */
.w98-btn {
  font: inherit;
  background: var(--face);
  color: var(--text);
  padding: 3px 10px;
  min-width: 70px;
  cursor: default;
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shadow);
}
.w98-btn:active,
.w98-btn.is-pressed {
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--light);
  padding: 4px 9px 2px 11px;
}
.w98-btn:focus-visible { outline: 1px dotted var(--dark); outline-offset: -4px; }

/* ------------------------------------------------------------
   DESKTOP
   ------------------------------------------------------------ */
.w98-desktop {
  position: absolute;
  inset: 0 0 var(--taskbar-h) 0;
  overflow: hidden;
}

.w98-icons {
  position: absolute;
  inset: 4px auto auto 4px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 80px);
  gap: 4px;
  height: calc(100% - 8px);
  align-content: start;
}

.w98-icon {
  width: 78px;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.w98-icon span {
  color: #fff;
  padding: 1px 3px;
  line-height: 1.2;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .7);
  word-break: break-word;
}
.w98-icon.is-selected .w98-ico { opacity: .65; }
.w98-icon.is-selected span {
  background: var(--select);
  outline: 1px dotted #fff;
  outline-offset: -1px;
  text-shadow: none;
}

/* Explorer-style icon list reuses .w98-icon inside folder windows. */
.w98-folderview {
  height: 100%;
  padding: 6px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  background: #fff;
  overflow: auto;
}
.w98-folderview .w98-icon span { color: var(--text); text-shadow: none; }
.w98-folderview .w98-icon.is-selected span { color: #fff; background: var(--select); }

/* ------------------------------------------------------------
   WINDOWS
   ------------------------------------------------------------ */
.w98-windows { position: absolute; inset: 0; pointer-events: none; }
.w98-windows > * { pointer-events: auto; }

.w98-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 120px;
  background: var(--face);
  padding: 3px;
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shadow);
}
.w98-window.is-maximized { border-radius: 0; }

.w98-titlebar {
  flex: none;
  height: var(--title-h);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 2px 0 3px;
  background: linear-gradient(90deg, var(--title-off-a), var(--title-off-b));
  color: #d8d8d8;
  touch-action: none;
}
.w98-window.is-active .w98-titlebar {
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff;
}
.w98-title-text {
  flex: 1;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w98-title-btns { display: flex; gap: 2px; flex: none; }
.w98-title-btn {
  width: 16px;
  height: 14px;
  min-width: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--face);
  border: 1px solid;
  border-color: var(--hilite) var(--dark) var(--dark) var(--hilite);
  box-shadow: inset 1px 1px 0 var(--light), inset -1px -1px 0 var(--shadow);
}
.w98-title-btn:active {
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  box-shadow: none;
}
.w98-title-btn svg { width: 8px; height: 7px; }
.w98-title-btn[data-act="close"] { margin-left: 2px; }

.w98-menubar {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 1px 0;
}
.w98-menubar span { padding: 2px 7px; }
.w98-menubar span:hover { background: var(--select); color: #fff; }

.w98-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--face);
  margin-top: 2px;
}
.w98-body.is-sunken {
  background: #fff;
  border: 2px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--light);
}
.w98-body iframe { width: 100%; height: 100%; background: #fff; }

.w98-statusbar {
  flex: none;
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.w98-statusbar span {
  padding: 2px 5px;
  border: 1px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.w98-statusbar span:first-child { flex: 1; }

/* Resize handles — invisible, sized to the classic 4px grab area. */
.w98-resize { position: absolute; }
.w98-resize[data-dir="n"]  { top: -2px; left: 6px; right: 6px; height: 5px; cursor: ns-resize; }
.w98-resize[data-dir="s"]  { bottom: -2px; left: 6px; right: 6px; height: 5px; cursor: ns-resize; }
.w98-resize[data-dir="w"]  { left: -2px; top: 6px; bottom: 6px; width: 5px; cursor: ew-resize; }
.w98-resize[data-dir="e"]  { right: -2px; top: 6px; bottom: 6px; width: 5px; cursor: ew-resize; }
.w98-resize[data-dir="nw"] { top: -2px; left: -2px; width: 9px; height: 9px; cursor: nwse-resize; }
.w98-resize[data-dir="ne"] { top: -2px; right: -2px; width: 9px; height: 9px; cursor: nesw-resize; }
.w98-resize[data-dir="sw"] { bottom: -2px; left: -2px; width: 9px; height: 9px; cursor: nesw-resize; }
.w98-resize[data-dir="se"] { bottom: -2px; right: -2px; width: 9px; height: 9px; cursor: nwse-resize; }
.w98-window.is-maximized .w98-resize { display: none; }

/* ------------------------------------------------------------
   APP CONTENT
   ------------------------------------------------------------ */
.w98-pane { padding: 14px 16px; line-height: 1.5; }
.w98-pane h2 { font-size: 11px; margin-bottom: 8px; }
.w98-pane p { margin-bottom: 10px; }

.w98-placeholder {
  display: flex;
  gap: 14px;
  padding: 18px 20px 14px;
  align-items: flex-start;
}
.w98-placeholder > .w98-ico { margin-top: 2px; }
.w98-placeholder h2 { font-size: 11px; margin-bottom: 6px; }
.w98-placeholder p { margin-bottom: 10px; line-height: 1.5; max-width: 42ch; }
.w98-placeholder .w98-dim { color: var(--text-dim); }

/* Sunken trough + chunky segmented fill: the Win98 progress bar. */
.w98-progress {
  height: 18px;
  padding: 2px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--light);
  margin-bottom: 8px;
}
.w98-progress i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--title-a) 0 10px, transparent 10px 12px);
}

.w98-form { padding: 14px 16px; }
.w98-field { display: block; margin-bottom: 10px; }
.w98-field label { display: block; margin-bottom: 3px; }
.w98-field input,
.w98-field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 2px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--light);
  padding: 3px 4px;
}
.w98-field textarea { resize: vertical; min-height: 70px; font-family: inherit; }
.w98-form-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.w98-hint { color: var(--text-dim); font-size: 11px; margin-top: 8px; }

.w98-list { list-style: none; }
.w98-list li { display: flex; gap: 8px; padding: 3px 6px; align-items: center; }

.w98-swatches { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px; }
.w98-swatch {
  width: 26px;
  height: 20px;
  border: 2px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
}
.w98-swatch.is-current { outline: 2px dotted var(--dark); outline-offset: 1px; }

/* ------------------------------------------------------------
   TASKBAR
   ------------------------------------------------------------ */
.w98-taskbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--taskbar-h);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  background: var(--face);
  border-top: 1px solid var(--hilite);
  box-shadow: 0 -1px 0 var(--shadow);
  z-index: 5000;
}

.w98-start {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: bold;
  min-width: 0;
  padding: 2px 7px 2px 4px;
  flex: none;
}
/* The real slanted Windows flag bitmap, not a CSS approximation. */
.w98-start .w98-flag { margin-right: 1px; }

.w98-sep {
  flex: none;
  width: 3px;
  height: 20px;
  border-left: 1px solid var(--shadow);
  border-right: 1px solid var(--hilite);
}

.w98-quicklaunch { display: flex; gap: 2px; flex: none; }
.w98-ql-btn {
  width: 22px; height: 22px;
  min-width: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--face);
  border: 1px solid transparent;
}
.w98-ql-btn:hover {
  border-color: var(--hilite) var(--shadow) var(--shadow) var(--hilite);
}
.w98-ql-btn:active {
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
}

.w98-tasks {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 3px;
  overflow: hidden;
}
.w98-task {
  flex: 0 1 160px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  text-align: left;
}
.w98-task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w98-task.is-pressed span { font-weight: bold; }

.w98-tray {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
}

/* ------------------------------------------------------------
   TASKBAR SEARCH
   ------------------------------------------------------------ */
.w98-search {
  position: relative;
  flex: none;
  width: 148px;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  background: #fff;
  border: 2px solid;
  border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--light);
}
.w98-search > .w98-ico { margin-right: 1px; }
.w98-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
}
.w98-search input::placeholder { color: var(--shadow); }

.w98-results {
  position: absolute;
  left: -2px;
  bottom: calc(100% + 3px);
  width: 250px;
  max-height: 260px;
  overflow: auto;
  padding: 2px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shadow);
  display: none;
}
.w98-results.is-open { display: block; }
.w98-result {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  width: 100%;
  text-align: left;
}
.w98-result b { font-weight: normal; flex: 1; }
.w98-result i { font-style: normal; color: var(--text-dim); }
.w98-result.is-active { background: var(--select); color: #fff; }
.w98-result.is-active i { color: #c0c8e8; }
.w98-results .w98-empty { padding: 8px 7px; color: var(--text-dim); }

/* ------------------------------------------------------------
   START MENU
   ------------------------------------------------------------ */
.w98-startmenu {
  position: absolute;
  left: 2px;
  bottom: var(--taskbar-h);
  width: 208px;
  display: none;
  padding: 3px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shadow);
  z-index: 6000;
}
.w98-startmenu.is-open { display: flex; }

.w98-startbanner {
  flex: none;
  width: 22px;
  background: linear-gradient(180deg, #000080, #1084d0 130%);
  position: relative;
}
.w98-startbanner span {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: bottom center;
  white-space: nowrap;
  color: #c0c0c0;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: .5px;
}
.w98-startbanner span b { color: #fff; }

.w98-startitems { flex: 1; min-width: 0; }

.w98-mi {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 6px;
  text-align: left;
  font: inherit;
  background: none;
  border: 0;
  color: var(--text);
}
.w98-mi span { flex: 1; }
.w98-mi .w98-arrow { flex: none; font-size: 11px; }
.w98-mi:hover, .w98-mi.is-open { background: var(--select); color: #fff; }
.w98-mi.is-disabled { color: var(--shadow); text-shadow: 1px 1px 0 var(--hilite); }
.w98-mi.is-disabled:hover { background: none; color: var(--shadow); }
.w98-mi-sep { height: 2px; margin: 3px 2px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--hilite); }

.w98-submenu {
  position: absolute;
  left: 100%;
  min-width: 180px;
  padding: 3px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shadow);
  display: none;
  z-index: 6100;
}
.w98-submenu.is-open { display: block; }

/* ------------------------------------------------------------
   CONTEXT MENU
   ------------------------------------------------------------ */
.w98-ctxmenu {
  position: absolute;
  min-width: 158px;
  padding: 3px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shadow);
  display: none;
  z-index: 6500;
}
.w98-ctxmenu.is-open { display: block; }
.w98-ctxmenu .w98-mi { padding: 4px 18px 4px 8px; }

/* ------------------------------------------------------------
   DIALOGS + SHUTDOWN
   ------------------------------------------------------------ */
.w98-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 7000;
}
.w98-dialog { width: 340px; }
.w98-dialog .w98-body { padding: 18px 20px 14px; }
.w98-dialog-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.w98-dialog-row > .w98-ico { margin-top: 2px; }
.w98-dialog-btns { display: flex; justify-content: center; gap: 8px; padding-bottom: 4px; }
.w98-radio { display: flex; gap: 7px; align-items: center; padding: 3px 0; }

.w98-shutdown {
  position: absolute;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: #000;
  color: #ff9d1e;
  font-size: 22px;
  text-align: center;
  padding: 20px;
  line-height: 1.6;
}
.w98-shutdown small { display: block; font-size: 11px; color: #7a7a7a; margin-top: 26px; }
