/* ============================================================
   w98.css — Windows 98-era widget foundation
   Exact period tokens: face #c0c0c0, light #dfdfdf, #fff,
   shadow #808080, dark #0a0a0a, active navy #000080 -> #1084d0
   ============================================================ */
@font-face {
  font-family: "Px Sans";
  font-style: normal;
  font-weight: 400;
  src: url(../fonts/ms_sans_serif.woff) format("woff");
}
@font-face {
  font-family: "Px Sans";
  font-style: normal;
  font-weight: 700;
  src: url(../fonts/ms_sans_serif_bold.woff) format("woff");
}

:root {
  --face: #c0c0c0;
  --face-lt: #dfdfdf;
  --hl: #ffffff;
  --sh: #808080;
  --dk: #0a0a0a;
  --navy: #000080;
  --navy-lt: #1084d0;
  --sel: #000080;
  --desk: #3a6ea5;
  --font-ui: "Px Sans", "MS Sans Serif", Tahoma, Geneva, Verdana, sans-serif;
  --font-doc: Georgia, "Times New Roman", Times, serif;
  --font-mono: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  color: #000;
  background: #000;
  overflow: hidden;
  -webkit-font-smoothing: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}
img { -webkit-user-drag: none; user-drag: none; }
button, input, select, textarea { font-family: var(--font-ui); font-size: 11px; }
::selection { background: var(--sel); color: #fff; }

/* ---- bevel helpers ---- */
.bv-out  { box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hl), inset -2px -2px var(--sh), inset 2px 2px var(--face-lt); }
.bv-in   { box-shadow: inset -1px -1px var(--hl), inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk); }
.bv-thin-out { box-shadow: inset -1px -1px var(--sh), inset 1px 1px var(--hl); }
.bv-thin-in  { box-shadow: inset -1px -1px var(--hl), inset 1px 1px var(--sh); }
.bv-field { background: #fff; box-shadow: inset -1px -1px #fff, inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk); }
.bv-group { border: 1px solid var(--sh); border-right-color: var(--hl); border-bottom-color: var(--hl); }

/* ---- generic window ---- */
.win {
  position: absolute;
  background: var(--face);
  padding: 3px;
  display: flex;
  flex-direction: column;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--face-lt), inset -2px -2px var(--sh), inset 2px 2px var(--hl);
  min-width: 120px;
  min-height: 60px;
}
.win.maximized { box-shadow: none; }
.win.dragging, .win.resizing { will-change: transform, width, height; }
.win.opening { animation: winOpen 120ms ease-out; }
@keyframes winOpen { from { opacity: 0; } to { opacity: 1; } }

.win-title {
  height: 18px;
  display: flex;
  align-items: center;
  padding: 2px 2px 3px 3px;
  background: linear-gradient(90deg, var(--navy), var(--navy-lt));
  color: #fff;
  font-weight: 700;
  cursor: default;
  flex: none;
}
.win.inactive .win-title { background: linear-gradient(90deg, #7b7b7b, #b5b5b5); }
.win-title .ticon { width: 16px; height: 16px; margin-right: 3px; flex: none; display: inline-flex; }
.win-title .ticon svg, .win-title .ticon img { width: 16px; height: 16px; }
.win-title-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 6px; }
.win-title-btns { display: flex; gap: 2px; flex: none; }
.tbtn {
  width: 16px; height: 14px;
  background: var(--face);
  border: none; padding: 0;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hl), inset -2px -2px var(--sh), inset 2px 2px var(--face-lt);
  display: flex; align-items: center; justify-content: center;
  cursor: default;
}
.tbtn:active { box-shadow: inset -1px -1px var(--hl), inset 1px 1px var(--dk), inset -2px -2px var(--face-lt), inset 2px 2px var(--sh); }
.tbtn svg { width: 9px; height: 9px; }
.tbtn.disabled { color: var(--sh); }
.tbtn.disabled svg path { fill: var(--sh); }

.win-menubar {
  display: flex;
  flex-wrap: nowrap;
  padding: 1px 0 2px;
  flex: none;
  position: relative;
  z-index: 30;
}
.menubar-item { padding: 2px 6px 3px; white-space: nowrap; }
.menubar-item.open, .menubar-item:hover.open { background: var(--navy); color: #fff; }

/* ---- menu (dropdown / context / start-sub) ---- */
.menu {
  position: absolute;
  background: var(--face);
  padding: 2px;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hl), inset -2px -2px var(--sh), inset 2px 2px var(--face-lt);
  z-index: 9000;
  min-width: 120px;
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 3px 18px 4px 20px;
  white-space: nowrap;
  position: relative;
}
.menu-item .mi-icon { position: absolute; left: 4px; top: 3px; width: 16px; height: 16px; }
.menu-item .mi-icon svg, .menu-item .mi-icon img { width: 16px; height: 16px; }
.menu-item .mi-label { flex: 1; }
.menu-item .mi-arrow { margin-left: 12px; font-size: 9px; }
.menu-item.disabled { color: var(--sh); }
.menu-item.disabled .mi-icon { opacity: 0.4; filter: grayscale(1); }
.menu-item:not(.disabled):hover, .menu-item.hover:not(.disabled) { background: var(--navy); color: #fff; }
.menu-item.checked::before {
  content: ""; position: absolute; left: 7px; top: 6px; width: 7px; height: 7px;
  background: #000;
  clip-path: polygon(0 35%, 35% 70%, 100% 0, 100% 30%, 35% 100%, 0 65%);
}
.menu-sep { height: 2px; margin: 3px 2px; box-shadow: inset 0 1px var(--sh), inset 0 -1px var(--hl); }

/* ---- buttons ---- */
.btn98 {
  min-width: 75px; min-height: 23px;
  background: var(--face);
  border: none;
  padding: 2px 12px 3px;
  color: #000;
  box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hl), inset -2px -2px var(--sh), inset 2px 2px var(--face-lt);
  cursor: default;
}
.btn98:active:not(:disabled), .btn98.pressed {
  box-shadow: inset -1px -1px var(--hl), inset 1px 1px var(--dk), inset -2px -2px var(--face-lt), inset 2px 2px var(--sh);
  padding: 3px 11px 2px 13px;
}
.btn98:focus { outline: 1px dotted #000; outline-offset: -4px; }
.btn98:disabled { color: var(--sh); text-shadow: 1px 1px 0 var(--hl); }
.btn98.default-btn { box-shadow: inset -1px -1px var(--dk), inset 1px 1px var(--hl), inset -2px -2px var(--sh), inset 2px 2px var(--face-lt), 0 0 0 1px #000; }

/* toolbar buttons */
.tbb {
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 4px;
  display: inline-flex; align-items: center; gap: 3px;
  color: #000;
  min-height: 22px;
  cursor: default;
}
.tbb:disabled { color: var(--sh); }
.tbb:disabled svg path, .tbb:disabled svg circle, .tbb:disabled svg rect, .tbb:disabled svg line, .tbb:disabled svg polygon, .tbb:disabled svg polyline, .tbb:disabled svg ellipse { stroke: var(--sh) !important; fill: none; }
.tbb:not(:disabled):hover, .tbb:not(:disabled).hover { border-color: var(--hl) var(--sh) var(--sh) var(--hl); background: var(--face-lt); }
.tbb:not(:disabled):active, .tbb.pressed { border-color: var(--sh) var(--hl) var(--hl) var(--sh); background: var(--face); }
.tbb svg { width: 16px; height: 16px; flex: none; }
.tbb.tbb-sep { width: 4px; padding: 0; border-left: 1px solid var(--sh); border-right: 1px solid var(--hl); margin: 2px 3px; min-height: 18px; }

/* ---- fields ---- */
.txt98 {
  height: 21px;
  background: #fff;
  border: none;
  padding: 3px 4px 2px;
  box-shadow: inset -1px -1px #fff, inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk);
  outline: none;
  user-select: text; -webkit-user-select: text;
}
textarea.txt98 { height: auto; resize: none; }
select.sel98 {
  height: 21px;
  background: #fff;
  border: none;
  padding: 2px 4px;
  box-shadow: inset -1px -1px #fff, inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='20'%3E%3Crect width='17' height='20' fill='%23c0c0c0'/%3E%3Cpath d='M1 0h15v1H1zM16 0h1v20h-1z' fill='%230a0a0a'/%3E%3Cpath d='M15 0h1v20h-1zM1 1h14v18H1z' fill='%23808080'/%3E%3Cpath d='M1 1h14v1H1zM1 1h1v18H1z' fill='%23fff'/%3E%3Cpath d='M11.5 7h-6l3 4z' fill='%23000'/%3E%3C/svg%3E");
  background-position: top right; background-repeat: no-repeat;
  padding-right: 20px;
}

/* checkbox & radio */
.chk { display: inline-flex; align-items: center; gap: 5px; line-height: 13px; }
.chk input { position: absolute; opacity: 0; width: 13px; height: 13px; margin: 0; }
.chk .box {
  width: 13px; height: 13px; flex: none;
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk);
  position: relative;
}
.chk input:checked + .box::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 9px; height: 8px;
  background: #000;
  clip-path: polygon(0 40%, 15% 55%, 35% 75%, 85% 5%, 100% 20%, 40% 100%, 0 70%);
}
.chk input[type=radio]:checked + .box::after {
  clip-path: none;
  width: 4px; height: 4px; left: 4px; top: 4px; border-radius: 50%;
}
.chk .box.radio { border-radius: 50%; box-shadow: inset -1px -1px #fff, inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk); }
.chk.disabled { color: var(--sh); }

/* ---- status bar ---- */
.statusbar { display: flex; gap: 1px; margin: 0 1px; flex: none; }
.status-field {
  box-shadow: inset -1px -1px var(--face-lt), inset 1px 1px var(--sh);
  padding: 2px 4px 3px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  flex: none;
}
.status-field.grow { flex: 1; }

/* ---- progress bar ---- */
.pb { height: 18px; padding: 1px; box-shadow: inset -1px -1px #fff, inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk); background: var(--face); }
.pb .pb-fill { height: 100%; width: 0%; background: repeating-conic-gradient(var(--navy) 0% 25%, var(--navy-lt) 0% 50%) 0 0/8px 8px; }

/* ---- tooltip ---- */
#tooltip {
  position: absolute;
  background: #ffffe1;
  border: 1px solid #000;
  padding: 2px 5px 1px;
  font-family: var(--font-ui); font-size: 11px;
  z-index: 99999;
  pointer-events: none;
  white-space: pre;
  display: none;
}

/* ---- win98 scrollbars (webkit) ---- */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track {
  background-color: #dfdfdf;
  background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%),
                    linear-gradient(45deg, #fff 25%, #c0c0c0 25%, #c0c0c0 75%, #fff 75%);
  background-size: 2px 2px; background-position: 0 0, 1px 1px;
}
::-webkit-scrollbar-thumb { background-color: #dfdfdf; box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf; }
::-webkit-scrollbar-corner { background: #dfdfdf; }
::-webkit-scrollbar-button:single-button {
  background-color: #c0c0c0;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  display: block; height: 16px; width: 16px;
  background-repeat: no-repeat; background-position: center;
  background-size: 7px;
}
::-webkit-scrollbar-button:single-button:vertical:decrement { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 1 7 6H1z' fill='%23000'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:vertical:increment { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 7 1 2h6z' fill='%23000'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:decrement { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1 4 6 1v6z' fill='%23000'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:increment { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M7 4 2 7V1z' fill='%23000'/%3E%3C/svg%3E"); }

/* ---- misc ---- */
.sunken { background: #fff; box-shadow: inset -1px -1px #fff, inset 1px 1px var(--sh), inset -2px -2px var(--face-lt), inset 2px 2px var(--dk); }
.groove { border: 2px groove #dfdfdf; }
.hourglass-active, .hourglass-active * { cursor: wait !important; }
.link { color: #0000c0; text-decoration: underline; cursor: pointer; }
.link:active { color: #800000; }
hr.hair { border: none; border-top: 1px solid var(--sh); border-bottom: 1px solid var(--hl); height: 0; margin: 4px 0; }
fieldset.fs98 { border: 1px solid var(--sh); border-right-color: var(--hl); border-bottom-color: var(--hl); margin: 0; padding: 8px 10px 10px; }
fieldset.fs98 legend { padding: 0 4px; }

/* msgbox icons drawn via CSS-free inline svg class helper */
.msg-icon { width: 32px; height: 32px; flex: none; }
.msg-icon svg { width: 32px; height: 32px; }
