/* ============================================================
   Windows 98 chrome — desktop, taskbar, windows, menus, dialogs
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --face: #c0c0c0;
  --face-lite: #d4d0c8;
  --hilite: #ffffff;
  --lite: #dfdfdf;
  --shade: #808080;
  --dark: #404040;
  --sel: #000080;
  --sel2: #1084d0;
  --tip: #ffffe1;
  --font: 11px Tahoma, "MS Sans Serif", Geneva, Verdana, sans-serif;
}

html, body { height: 100%; overflow: hidden; }
body {
  font: var(--font);
  color: #000;
  background: #000;
  -webkit-user-select: none; user-select: none;
  cursor: default;
}
body.app-wait, body.app-wait * { cursor: wait !important; }
body.app-busy { cursor: progress !important; }

img { -webkit-user-drag: none; user-select: none; }
button { font: var(--font); }

/* ---------- bevel primitives ---------- */
.bv-out, .menu, .taskbtn, .win, .dlg-body {
  border: 1px solid;
  border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade);
  background: var(--face);
}
.bv-in, .sunken {
  border: 1px solid;
  border-color: var(--shade) var(--hilite) var(--hilite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--lite);
  background: var(--face);
}
.field, .listbox, textarea.field, select.field {
  border: 1px solid;
  border-color: var(--shade) var(--hilite) var(--hilite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--lite);
  background: #fff;
  font: var(--font);
  padding: 2px 3px;
  -webkit-user-select: text; user-select: text;
}
input.field:focus, textarea.field:focus { outline: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 74px; min-height: 21px; padding: 2px 12px;
  font: var(--font); color: #000;
  border: 1px solid;
  border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade);
  background: var(--face);
  cursor: default;
}
.btn:active, .btn.pressed {
  border-color: var(--dark) var(--lite) var(--lite) var(--dark);
  box-shadow: inset 1px 1px 0 var(--shade), inset -1px -1px 0 var(--hilite);
  padding: 3px 11px 1px 13px;
}
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.btn.default { box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade), 0 0 0 1px #000; }
.btn[disabled] { color: var(--shade); text-shadow: 1px 1px 0 var(--hilite); }
.btn .ico { width: 16px; height: 16px; flex: none; }

/* ============================================================
   BOOT
   ============================================================ */
#boot { position: fixed; inset: 0; z-index: 9999; background: #000; }
.bios {
  position: absolute; inset: 0; padding: 18px 22px;
  font: 14px/1.45 "Lucida Console", "Courier New", monospace;
  color: #c8c8c8; white-space: pre-wrap; -webkit-user-select: none;
}
.bios .ok { color: #37e037; }
.bios .cursor { display:inline-block; width:9px; height:15px; background:#c8c8c8; vertical-align:-2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.bootlogo { position: absolute; inset: 0; overflow: hidden; background: #000; }
.boot-sky { position: absolute; inset: 0; background: linear-gradient(#7db9e8 0%, #b7dcf5 55%, #e8f4ff 100%); }
.boot-clouds { position: absolute; inset: 0;
  background:
    radial-gradient(140px 40px at 18% 22%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(190px 55px at 78% 18%, rgba(255,255,255,.85), transparent 70%),
    radial-gradient(240px 60px at 40% 70%, rgba(255,255,255,.7), transparent 70%),
    radial-gradient(160px 45px at 88% 62%, rgba(255,255,255,.75), transparent 70%);
  filter: blur(1px);
}
.boot-flag { position: absolute; left: 50%; top: 34%; transform: translate(-50%,-50%); width: 132px; height: 96px; filter: drop-shadow(3px 4px 3px rgba(0,0,0,.35)); }
.flag-waves { position: relative; width: 100%; height: 100%; transform: perspective(140px) rotateY(-18deg) skewY(-4deg); }
.flag-waves span { position: absolute; left:0; right:0; height: 24px; border-radius: 6px 14px 4px 10px; }
.flag-waves span:nth-child(1){ top:0;  background:#e8341c; transform: skewX(-16deg) translateY(2px) scaleX(.98); }
.flag-waves span:nth-child(2){ top:24px; background:#7db700; transform: skewX(-16deg) translateY(1px) scaleX(1.0); }
.flag-waves span:nth-child(3){ top:48px; background:#2877c8; transform: skewX(-16deg) scaleX(.98); }
.flag-waves span:nth-child(4){ top:72px; background:#f9b900; transform: skewX(-16deg) translateY(-1px) scaleX(.95); }
.boot-wordmark { position: absolute; left: 50%; top: 53%; transform: translateX(-50%);
  font: 30px "Times New Roman", Georgia, serif; color: #202020; letter-spacing: 1px; white-space: nowrap; }
.boot-wordmark b { font-weight: 700; }
.boot-wordmark .nines { font-size: 42px; font-weight: 700; color: #111; }
.boot-wordmark .reg { font-size: 12px; vertical-align: super; }
.boot-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: #0a0a0a; overflow: hidden; }
.boot-bar-stripes { position: absolute; top: 3px; bottom: 3px; width: 260px;
  background: repeating-linear-gradient(90deg, #f4a024 0 8px, #d47f10 8px 14px, #0a0a0a 14px 22px);
  border-radius: 2px; animation: bootscroll 1.1s linear infinite; }
@keyframes bootscroll { from { left: -280px; } to { left: 105%; } }

/* "safe to turn off" screen */
.offscreen { position: fixed; inset: 0; z-index: 9999; background: #ff9900;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; }
.offscreen .msg { font: 26px "Times New Roman", Georgia, serif; color: #000; text-align: center; }
.offscreen .hint { font: 12px Tahoma, sans-serif; color: rgba(0,0,0,.6); }

/* ============================================================
   DESKTOP
   ============================================================ */
#desktop { position: fixed; inset: 0; background: #008080; overflow: hidden; }
#wallpaper { position: absolute; inset: 0; }
#wallpaper.wp-clouds { background:
  radial-gradient(200px 60px at 20% 15%, rgba(255,255,255,.55), transparent 70%),
  radial-gradient(260px 70px at 70% 30%, rgba(255,255,255,.4), transparent 70%),
  radial-gradient(180px 55px at 40% 75%, rgba(255,255,255,.5), transparent 70%),
  linear-gradient(#2f7cd6, #79b7ec); }
#wallpaper.wp-stone { background:
  linear-gradient(135deg, rgba(255,255,255,.12) 25%, transparent 25%) -18px 0/36px 36px,
  linear-gradient(225deg, rgba(255,255,255,.10) 25%, transparent 25%) -18px 0/36px 36px,
  linear-gradient(315deg, rgba(0,0,0,.12) 25%, transparent 25%) 0 0/36px 36px,
  linear-gradient(45deg, rgba(0,0,0,.10) 25%, transparent 25%) 0 0/36px 36px,
  #005a5a; }
#wallpaper.wp-circles { background:
  radial-gradient(circle at 30px 30px, rgba(255,255,255,.14) 12px, transparent 13px) 0 0/60px 60px,
  radial-gradient(circle at 60px 60px, rgba(0,0,0,.12) 10px, transparent 11px) 0 0/60px 60px,
  #004d6b; }
#wallpaper.wp-forest { background:
  repeating-linear-gradient(115deg, rgba(0,0,0,.16) 0 12px, transparent 12px 44px),
  repeating-linear-gradient(65deg, rgba(255,255,255,.08) 0 9px, transparent 9px 40px),
  #1d5e33; }
#wallpaper.wp-none { background: #008080; }
#wallpaper.wp-field { background:
  radial-gradient(320px 120px at 70% 90%, rgba(90,140,60,.9), transparent 70%),
  radial-gradient(400px 150px at 20% 100%, rgba(60,120,50,.85), transparent 70%),
  linear-gradient(#2e7bd4 0%, #9ecdf2 60%, #7fae62 61%, #639448 100%); }

#iconlayer { position: absolute; inset: 0 0 28px 0; }
.dicon { position: absolute; width: 74px; text-align: center; padding: 2px 0; cursor: default; }
.dicon .ico { width: 32px; height: 32px; margin: 0 auto; display: block; }
.dicon .lbl { display: inline-block; margin-top: 3px; padding: 1px 3px; color: #fff; font-size: 11px; line-height: 1.15; }
.dicon.sel .lbl { background: var(--sel); outline: 1px dotted #ffd; }
.dicon.sel .ico { filter: drop-shadow(0 0 0 #000080); opacity: .85; }
.dicon.focused .lbl { outline: 1px dotted #fff; }
#rubberband { position: absolute; border: 1px dotted #fff; background: rgba(0,0,128,.12); display: none; z-index: 5; pointer-events: none; }

/* ---------- taskbar ---------- */
#taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28px; z-index: 4000;
  display: flex; align-items: center; gap: 3px; padding: 3px 2px 2px;
  background: var(--face);
  border-top: 1px solid var(--lite);
  box-shadow: inset 0 1px 0 var(--hilite);
}
#startbtn {
  display: flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px 0 5px;
  font: bold 11px Tahoma, sans-serif;
  border: 1px solid; border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade);
  background: var(--face);
}
#startbtn:active, #startbtn.open {
  border-color: var(--dark) var(--lite) var(--lite) var(--dark);
  box-shadow: inset 1px 1px 0 var(--shade), inset -1px -1px 0 var(--hilite);
}
.start-flag { display: inline-grid; grid-template-columns: 8px 8px; grid-template-rows: 7px 7px; transform: skewY(-8deg); }
.start-flag i:nth-child(1){ background:#e8341c; } .start-flag i:nth-child(2){ background:#7db700; }
.start-flag i:nth-child(3){ background:#2877c8; } .start-flag i:nth-child(4){ background:#f9b900; }
.taskbar-sep { width: 1px; height: 20px; border-left: 1px solid var(--shade); border-right: 1px solid var(--hilite); margin: 0 2px; flex: none; }
#quicklaunch { display: flex; gap: 2px; padding-right: 2px; }
#quicklaunch .ql { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
#quicklaunch .ql:hover { background: rgba(255,255,255,.35); box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade); }
#quicklaunch .ql:active { box-shadow: inset 1px 1px 0 var(--shade), inset -1px -1px 0 var(--hilite); }
#quicklaunch .ico { width: 16px; height: 16px; }
#taskbtns { flex: 1; display: flex; gap: 3px; min-width: 0; overflow: hidden; height: 22px; }
.taskbtn {
  display: flex; align-items: center; gap: 4px; padding: 0 6px; height: 22px;
  min-width: 60px; max-width: 160px; flex: 0 1 160px;
  font: var(--font); white-space: nowrap; overflow: hidden;
}
.taskbtn .ico { width: 16px; height: 16px; flex: none; }
.taskbtn .t { overflow: hidden; text-overflow: ellipsis; }
.taskbtn.active {
  border-color: var(--dark) var(--lite) var(--lite) var(--dark);
  box-shadow: inset 1px 1px 0 var(--shade), inset -1px -1px 0 var(--hilite), inset 2px 2px 0 var(--shade);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 2px, transparent 2px 4px),
    var(--face-lite);
  font-weight: bold;
}
#tray {
  display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 6px; flex: none;
  border: 1px solid; border-color: var(--shade) var(--hilite) var(--hilite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--shade);
}
#tray-icons { display: flex; gap: 4px; align-items: center; }
#tray-icons .ico { width: 16px; height: 16px; cursor: default; }
#clock { font: var(--font); min-width: 52px; text-align: center; }

/* ---------- windows ---------- */
.win {
  position: absolute; padding: 3px; z-index: 100;
  display: flex; flex-direction: column;
  min-width: 120px; min-height: 60px;
}
.win.active { z-index: 100; }
.titlebar {
  display: flex; align-items: center; height: 18px; padding: 0 2px 0 3px; gap: 4px;
  background: linear-gradient(90deg, var(--sel), var(--sel2));
  color: #fff; flex: none;
}
.win.inactive .titlebar { background: linear-gradient(90deg, var(--shade), #b5b5b5); color: #e8e8e8; }
.titlebar .ticon { width: 16px; height: 16px; flex: none; }
.titlebar .ttext { flex: 1; font: bold 11px Tahoma, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 1px; }
.tbtns { display: flex; gap: 2px; flex: none; }
.tbtn {
  width: 16px; height: 14px; padding: 0; position: relative;
  border: 1px solid; border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade);
  background: var(--face);
}
.tbtn:active { border-color: var(--dark) var(--lite) var(--lite) var(--dark); box-shadow: inset 1px 1px 0 var(--shade); }
.tbtn svg { position: absolute; inset: 0; margin: auto; }
.winbody { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--face); }
.winclient { flex: 1; min-height: 0; overflow: hidden; position: relative; background: #fff;
  border: 1px solid; border-color: var(--shade) var(--hilite) var(--hilite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--dark), inset -1px -1px 0 var(--lite); }
.winclient.nosunken { background: var(--face); }
.statusbar { display: flex; gap: 2px; padding: 2px 1px 0; flex: none; }
.sb-cell { flex: 1; padding: 2px 4px; font: var(--font); color: #222; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  border: 1px solid; border-color: var(--shade) var(--hilite) var(--hilite) var(--shade); }
.sb-cell.fix { flex: none; }

/* resize handles */
.rh { position: absolute; z-index: 50; }
.rh.n { top: -2px; left: 8px; right: 8px; height: 5px; cursor: n-resize; }
.rh.s { bottom: -2px; left: 8px; right: 8px; height: 5px; cursor: s-resize; }
.rh.e { right: -2px; top: 8px; bottom: 8px; width: 5px; cursor: e-resize; }
.rh.w { left: -2px; top: 8px; bottom: 8px; width: 5px; cursor: w-resize; }
.rh.ne { right: -3px; top: -3px; width: 10px; height: 10px; cursor: ne-resize; }
.rh.nw { left: -3px; top: -3px; width: 10px; height: 10px; cursor: nw-resize; }
.rh.se { right: -3px; bottom: -3px; width: 10px; height: 10px; cursor: se-resize; }
.rh.sw { left: -3px; bottom: -3px; width: 10px; height: 10px; cursor: sw-resize; }
.win.maximized { border: none; padding: 0; }
.win.maximized .rh { display: none; }

/* ---------- menu bars & popups ---------- */
.menubar { display: flex; flex: none; background: var(--face); padding: 1px 0; }
.menubar .mb-item { padding: 2px 7px 3px; font: var(--font); }
.menubar .mb-item:hover, .menubar .mb-item.open { background: var(--sel); color: #fff; }
.menubar .mb-item u { text-decoration: none; }

.menu {
  position: absolute; min-width: 150px; padding: 2px; z-index: 6000;
}
.menu .mi { display: flex; align-items: center; gap: 6px; padding: 3px 18px 3px 6px; font: var(--font); position: relative; white-space: nowrap; }
.menu .mi .ico { width: 16px; height: 16px; flex: none; }
.menu .mi .acc { margin-left: auto; padding-left: 16px; color: #555; }
.menu .mi:hover:not(.dis), .menu .mi.open, .menu .mi.hot:not(.dis) { background: var(--sel); color: #fff; }
.menu .mi:hover:not(.dis) .acc, .menu .mi.open .acc, .menu .mi.hot:not(.dis) .acc { color: #fff; }
.menu .mi.dis { color: var(--shade); text-shadow: 1px 1px 0 var(--hilite); }
.menu .mi .sub { position: absolute; right: 4px; font-size: 9px; }
.menu .sep { height: 1px; margin: 3px 2px; border-top: 1px solid var(--shade); border-bottom: 1px solid var(--hilite); }
.menu .mi.checked .chk { visibility: visible; }
.menu .mi .chk { width: 12px; visibility: hidden; font-size: 10px; }
.menu .mi.rad.checked .chk { visibility: visible; }

/* start menu */
#startmenu { position: absolute; left: 2px; bottom: 28px; z-index: 6000; display: flex; padding: 3px;
  border: 1px solid; border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade), 2px 2px 6px rgba(0,0,0,.4);
  background: var(--face); }
#startmenu .side { width: 21px; background: linear-gradient(#7b7b7b, #000080); color: #c8c8c8;
  writing-mode: vertical-rl; transform: rotate(180deg); font: bold 15px Tahoma, sans-serif;
  display: flex; align-items: flex-end; padding: 8px 2px; letter-spacing: 1px; }
#startmenu .side b { color: #fff; font-weight: 800; }
#startmenu .items { min-width: 178px; }
#startmenu .mi { display: flex; align-items: center; gap: 8px; padding: 4px 18px 4px 8px; position: relative; }
#startmenu .mi .ico { width: 24px; height: 24px; }
#startmenu .mi.big { padding: 5px 18px 5px 8px; }
#startmenu .mi:hover:not(.dis), #startmenu .mi.open, #startmenu .mi.hot:not(.dis) { background: var(--sel); color: #fff; }

/* ---------- dialogs ---------- */
.dlg { position: absolute; padding: 3px; z-index: 5000;
  border: 1px solid; border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade), 3px 3px 8px rgba(0,0,0,.45);
  background: var(--face); display: flex; flex-direction: column; }
.dlg .content { flex: 1; padding: 10px 12px; overflow: auto; }
.dlg .btnrow { display: flex; justify-content: flex-end; gap: 6px; padding: 0 12px 10px; }
.dlg-msg { display: flex; gap: 12px; align-items: flex-start; }
.dlg-msg .ico { width: 32px; height: 32px; flex: none; }
.dlg-msg p { padding-top: 2px; line-height: 1.4; max-width: 320px; -webkit-user-select: text; user-select: text; }

/* tabs */
.tabs { display: flex; gap: 0; padding: 6px 6px 0; position: relative; z-index: 2; }
.tab { padding: 3px 10px 4px; font: var(--font); background: var(--face); margin-right: 2px;
  border: 1px solid; border-color: var(--lite) var(--dark) transparent var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite); border-radius: 2px 2px 0 0; position: relative; top: 1px; }
.tab.on { top: 0; padding-top: 5px; margin-top: -2px; box-shadow: inset 1px 1px 0 var(--hilite); z-index: 3; }
.tabpage { border: 1px solid; border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade);
  background: var(--face); padding: 10px; margin: 0 6px 6px; flex: 1; overflow: auto; position: relative; }

/* radio/check */
.opt { display: flex; align-items: center; gap: 6px; padding: 3px 0; font: var(--font); }
.opt .dot { width: 12px; height: 12px; border-radius: 50%; background: #fff;
  border: 1px solid; border-color: var(--shade) var(--hilite) var(--hilite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--dark); position: relative; }
.opt.on .dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #000; }
.opt .box { width: 12px; height: 12px; background: #fff;
  border: 1px solid; border-color: var(--shade) var(--hilite) var(--hilite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--dark); color: #000; font: bold 10px/10px Tahoma; text-align: center; }
.opt.on .box::after { content: "✓"; font-size: 9px; }

/* tooltip */
#tooltip { position: fixed; z-index: 9000; background: var(--tip); border: 1px solid #000;
  padding: 2px 4px; font: var(--font); max-width: 260px; pointer-events: none; display: none; }

/* progress bar */
.pbar { height: 16px; display: flex; gap: 2px; padding: 2px; background: #fff;
  border: 1px solid; border-color: var(--shade) var(--hilite) var(--hilite) var(--shade);
  box-shadow: inset 1px 1px 0 var(--dark); }
.pbar i { width: 10px; background: var(--sel); }

/* misc shared */
.ico { display: inline-block; vertical-align: middle; }
.ico svg { display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }
.kbd { font: var(--font); }

/* scrollbars — thin themed illusion for webkit */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: #dfdfdf;
  background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%),
  linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%);
  background-size: 2px 2px; background-position: 0 0, 1px 1px; }
::-webkit-scrollbar-thumb { background: var(--face); border: 1px solid; border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade); }
::-webkit-scrollbar-button { display: block; background: var(--face); width: 16px; height: 16px;
  border: 1px solid; border-color: var(--lite) var(--dark) var(--dark) var(--lite);
  box-shadow: inset 1px 1px 0 var(--hilite), inset -1px -1px 0 var(--shade);
  background-repeat: no-repeat; background-position: center; }
::-webkit-scrollbar-button:vertical:decrement { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8'><path d='M1 6 L4 2 L7 6 Z' fill='black'/></svg>"); }
::-webkit-scrollbar-button:vertical:increment { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8'><path d='M1 2 L4 6 L7 2 Z' fill='black'/></svg>"); }
::-webkit-scrollbar-button:horizontal:decrement { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8'><path d='M6 1 L2 4 L6 7 Z' fill='black'/></svg>"); }
::-webkit-scrollbar-button:horizontal:increment { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8'><path d='M2 1 L6 4 L2 7 Z' fill='black'/></svg>"); }
