/* Windows 98 Web Edition - 经典灰白界面 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --face: #c0c0c0;
  --light: #ffffff;
  --shadow: #808080;
  --dark: #000000;
  --title: #000080;
  --title-inactive: #808080;
  --desktop: #008080;
  --font: "MS Sans Serif", "Microsoft Sans Serif", Tahoma, sans-serif;
}

html, body { width: 100%; height: 100%; overflow: hidden; font-family: var(--font); font-size: 12px; }
body { background: var(--desktop); user-select: none; -webkit-user-select: none; }
img { image-rendering: pixelated; }
.hidden { display: none !important; }

#desktop { position: relative; width: 100vw; height: 100vh; background: var(--desktop); overflow: hidden; }

/* ------- 桌面图标 ------- */
#desktop-icons { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start; gap: 4px; height: calc(100% - 60px); }
.desk-icon { width: 84px; min-height: 76px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; cursor: default; text-align: center; }
.desk-icon img { width: 32px; height: 32px; }
.desk-icon span { color: #fff; font-size: 12px; line-height: 1.2; padding: 1px 3px; text-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.desk-icon.selected img { filter: drop-shadow(0 0 0 #000080) brightness(.75); }
.desk-icon.selected span { background: var(--title); outline: 1px dotted #fff; }
.desk-icon.double-hint span { background: var(--title); }

/* ------- 窗口 ------- */
#windows-layer { position: absolute; inset: 0; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto; background: var(--face);
  border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset -1px -1px 0 var(--shadow), inset 1px 1px 0 #dfdfdf, 2px 2px 0 rgba(0,0,0,.35);
  display: flex; flex-direction: column; min-width: 220px; min-height: 140px;
  padding: 3px;
}
.win.inactive .win-titlebar { background: var(--title-inactive); }
.win-titlebar {
  height: 20px; background: var(--title); color: #fff; display: flex; align-items: center;
  gap: 4px; padding: 2px 2px 2px 3px; cursor: default; font-weight: bold;
}
.win-icon { width: 16px; height: 16px; }
.win-title { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-controls { display: flex; gap: 2px; }
.win-controls button {
  width: 16px; height: 14px; font: 11px var(--font); line-height: 11px; padding: 0;
  background: var(--face); color: #000; border: 1px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
  display: flex; align-items: center; justify-content: center; cursor: default;
}
.win-controls button:active { border-color: var(--dark) var(--light) var(--light) var(--dark); }
.win-menubar { display: flex; gap: 2px; padding: 2px 1px; min-height: 20px; align-items: center; }
.win-menubar span { padding: 2px 6px; cursor: default; }
.win-menubar span:hover { background: var(--title); color: #fff; }
.win-toolbar { display: flex; gap: 3px; padding: 3px 1px; border-bottom: 1px solid var(--shadow); min-height: 30px; align-items: center; }
.win-toolbar button {
  min-width: 24px; height: 22px; background: var(--face); border: 1px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light); padding: 1px 4px; cursor: default;
  display: flex; align-items: center; gap: 3px; font-size: 11px;
}
.win-body { flex: 1; background: #fff; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); overflow: auto; padding: 10px; margin: 2px 0; }
.win-statusbar { display: flex; gap: 2px; height: 18px; }
.win-statusbar span { border: 1px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); padding: 1px 4px; display: flex; align-items: center; }
.win-statusbar span:first-child { flex: 1; }
.win-statusbar span:last-child { width: 70px; }

/* 文件列表 */
.file-grid { display: flex; flex-wrap: wrap; gap: 14px; align-content: flex-start; }
.file-item { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px; text-align: center; cursor: default; }
.file-item img { width: 32px; height: 32px; }
.file-item.selected { outline: 1px dotted #000; background: #00008022; }
.file-item span { font-size: 12px; }

/* 记事本 */
.notepad-area { width: 100%; height: 100%; border: none; outline: none; resize: none; font: 13px/1.6 "Courier New", "SimSun", monospace; background: #fff; padding: 2px; }

/* 画图 */
.paint-wrap { display: flex; height: 100%; gap: 0; }
.paint-tools { width: 60px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; padding: 4px; background: var(--face); border-right: 1px solid var(--shadow); }
.paint-tools button { height: 24px; font: 11px var(--font); background: var(--face); border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light); cursor: default; }
.paint-tools button.active { border-color: var(--dark) var(--light) var(--light) var(--dark); background: #dfdfdf; }
.paint-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.paint-canvas { display: block; background: #fff; border: 1px solid var(--shadow); max-width: 100%; cursor: crosshair; }
.paint-colors { display: flex; flex-wrap: wrap; gap: 3px; padding: 5px 4px; background: var(--face); }
.paint-colors button { width: 18px; height: 18px; padding: 0; border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light); cursor: default; }
.paint-colors button.active { outline: 2px dotted #000; outline-offset: 1px; }

/* 打开/另存为对话框中的文件列表 */
.file-picker { height: 150px; overflow: auto; background: #fff; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); margin-bottom: 8px; }
.file-picker .fp-item { padding: 3px 6px; font-size: 12px; cursor: default; white-space: nowrap; }
.file-picker .fp-item.selected { background: var(--title); color: #fff; }
.dialog.wide { width: 420px; }
.dialog label { font-size: 12px; }

/* ------- 任务栏 ------- */
#taskbar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 30px; background: var(--face);
  border-top: 2px solid var(--light); display: flex; align-items: center; gap: 3px; padding: 2px 3px; z-index: 9999;
}
#start-btn {
  height: 24px; display: flex; align-items: center; gap: 4px; padding: 1px 5px 1px 3px; font: bold 12px var(--font);
  background: var(--face); border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light); cursor: default;
}
#start-btn:active, #start-btn.open { border-color: var(--dark) var(--light) var(--light) var(--dark); padding: 2px 4px 0 4px; }
#start-btn img { width: 18px; height: 18px; }
#taskbar-divider { width: 2px; height: 22px; border-left: 1px solid var(--shadow); border-right: 1px solid var(--light); }
#task-buttons { flex: 1; display: flex; gap: 3px; overflow: hidden; }
.task-btn {
  min-width: 120px; max-width: 160px; height: 23px; display: flex; align-items: center; gap: 4px; padding: 0 6px;
  background: var(--face); border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
  font: 12px var(--font); cursor: default; overflow: hidden;
}
.task-btn img { width: 16px; height: 16px; flex-shrink: 0; }
.task-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-btn.active { border-color: var(--dark) var(--light) var(--light) var(--dark); background: repeating-linear-gradient(45deg, #c0c0c0 0 1px, #dfdfdf 1px 2px); font-weight: bold; }
#tray { height: 24px; min-width: 76px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 5px;
  border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); }
#tray-icon { width: 16px; height: 16px; }
#clock { font-size: 12px; }

/* ------- 开始菜单 ------- */
#start-menu {
  position: absolute; bottom: 30px; left: 2px; width: 200px; display: none; z-index: 10000;
  background: var(--face); border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light); padding: 3px;
}
#start-menu.open { display: flex; }
.sm-side { width: 28px; background: var(--title); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 8px 2px; gap: 8px; }
.sm-side img { width: 18px; height: 18px; image-rendering: pixelated; }
.sm-side span { font: bold 13px var(--font); letter-spacing: 1px; writing-mode: vertical-rl; transform: rotate(180deg); }
.sm-items { flex: 1; display: flex; flex-direction: column; padding: 2px; }
.sm-item { display: flex; align-items: center; gap: 6px; height: 30px; padding: 2px 5px; cursor: default; position: relative; }
.sm-item img { width: 20px; height: 20px; flex-shrink: 0; }
.sm-item span { flex: 1; font-size: 12px; }
.sm-item b { font-size: 10px; }
.sm-item:hover { background: var(--title); color: #fff; }
.sm-sep { height: 2px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--light); margin: 3px 2px; }
/* 开始菜单内部子菜单：悬停展开 */
.sm-submenu {
  display: none; position: absolute; left: 100%; top: -3px; min-width: 190px; z-index: 10001;
  background: var(--face); color: var(--dark); border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
  padding: 2px; box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
.sm-item.has-sub:hover > .sm-submenu { display: block; }
.sm-submenu .sm-item { height: 26px; }

/* ------- 弹窗 ------- */
.dialog {
  position: absolute; z-index: 20000; background: var(--face); padding: 14px; width: 340px;
  border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
.dialog-title { font-weight: bold; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.dialog-title img { width: 16px; height: 16px; }
.dialog-msg { font-size: 12px; line-height: 1.6; margin-bottom: 14px; }
.dialog-buttons { display: flex; justify-content: center; gap: 8px; }
.btn {
  min-width: 72px; height: 24px; background: var(--face); border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light); font: 12px var(--font); cursor: default;
}
.btn:active { border-color: var(--dark) var(--light) var(--light) var(--dark); }
.dialog input[type=text] { width: 100%; height: 22px; padding: 2px 4px; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); font: 12px var(--font); }

/* ------- 开机/关机 ------- */
#boot-screen {
  position: absolute; inset: 0; background: #000 url('assets/wallpaper/clouds.png') center/cover no-repeat;
  z-index: 50000; display: flex; align-items: center; justify-content: center;
}
.boot-inner { width: 460px; text-align: center; color: #000; }
.boot-logo { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 40px;
  text-shadow: 1px 1px 0 rgba(255,255,255,.6); }
.boot-flag { width: 84px; height: 84px; flex-shrink: 0; image-rendering: pixelated; filter: drop-shadow(2px 2px 1px rgba(0,0,0,.3)); }
.boot-word { text-align: left; line-height: 1; }
.boot-logo b { font-size: 26px; letter-spacing: 1px; color: #00224d; }
.boot-logo div span { font-size: 52px; font-weight: bold; letter-spacing: -3px; color: #001a3d; }
.boot-98 { font-size: 22px !important; letter-spacing: 0 !important; vertical-align: super; }
.boot-inner p { margin-top: 40px; font-size: 11px; color: #1a3a5c; }

#shutdown-screen {
  position: absolute; inset: 0; background: #000; z-index: 50000; display: none;
  align-items: center; justify-content: center; color: #fff; cursor: pointer;
}
#shutdown-screen.show { display: flex; }
.shutdown-inner { text-align: center; }
.shutdown-inner h1 { font-size: 22px; font-weight: normal; margin-bottom: 14px; }
.shutdown-inner p { font-size: 14px; color: #aaa; }

/* 蓝屏 */
.bsod {
  position: absolute; inset: 0; background: #000080; color: #c0c0c0; z-index: 60000;
  font-family: "Courier New", monospace; font-size: 15px; padding: 40px; white-space: pre-wrap; cursor: pointer;
}

/* ------- 文件资源管理器 ------- */
.ex-nav { font: 11px var(--font) !important; padding: 0 5px !important; }
.ex-nav:disabled { color: #808080; text-shadow: 1px 1px 0 #fff; }
.ex-address {
  flex: 1; height: 20px; background: #fff; display: flex; align-items: center; gap: 4px;
  padding: 0 3px; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow);
  font-size: 11px; overflow: hidden;
}
.ex-address img { width: 15px; height: 15px; flex-shrink: 0; }
.ex-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-drop { font-size: 9px; color: #000; }
.ex-go { font: 11px var(--font) !important; }

.explorer-body { background: var(--face) !important; }
.explorer { display: flex; height: 100%; gap: 0; }
.ex-tree { width: 190px; flex-shrink: 0; overflow: auto; background: #fff;
  border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); }
.ex-tree-title { padding: 4px 6px; font-weight: bold; background: var(--face); border-bottom: 1px solid var(--shadow); }
.ex-tree-item { display: flex; align-items: center; gap: 3px; padding: 3px 4px; font-size: 12px; cursor: default; white-space: nowrap; }
.ex-tree-item img { width: 16px; height: 16px; flex-shrink: 0; }
.ex-tree-item .ex-twisty { width: 10px; font-size: 9px; color: #333; text-align: center; flex-shrink: 0; }
.ex-tree-item.selected { background: var(--title); color: #fff; }
.ex-divider { width: 6px; flex-shrink: 0; cursor: col-resize; }
.ex-right { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff;
  border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); }
.ex-list-head { display: grid; grid-template-columns: 1fr 70px 100px; background: var(--face);
  border-bottom: 1px solid var(--shadow); font-size: 11px; }
.ex-list-head span { padding: 3px 6px; border-right: 1px solid var(--shadow); }
.ex-list { flex: 1; overflow: auto; }
.ex-list-item { display: grid; grid-template-columns: 24px 1fr 70px 100px; align-items: center;
  padding: 3px 4px; font-size: 12px; cursor: default; min-height: 28px; }
.ex-list-item img { width: 20px; height: 20px; justify-self: center; }
.ex-list-item .ex-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-list-item .ex-size, .ex-list-item .ex-type { color: #333; font-size: 11px; }
.ex-list-item.selected { background: var(--title); color: #fff; }
.ex-list-item.selected .ex-size, .ex-list-item.selected .ex-type { color: #fff; }
.ex-empty { padding: 20px; color: #808080; }

/* ------- Internet Explorer ------- */
.ie-tb { min-width: 24px; height: 22px; background: var(--face); border: 1px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light); padding: 1px 4px; cursor: default;
  display: flex; align-items: center; gap: 3px; font-size: 11px; }
.ie-tb img { width: 16px; height: 16px; }
.ie-tb:disabled { color: #808080; text-shadow: 1px 1px 0 #fff; }
.ie-addr { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 120px; margin-left: 4px; font-size: 11px; }
.ie-addr img { width: 16px; height: 16px; flex-shrink: 0; }
.ie-addr input { flex: 1; min-width: 60px; height: 20px; font: 11px var(--font); padding: 0 3px;
  border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); }
.ie-addr .btn { min-width: 40px; height: 20px; font-size: 11px; }
.ie-body { background: #fff !important; overflow: hidden; display: flex; flex-direction: column; }
.ie-frame-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 3px 6px;
  background: var(--face); border-bottom: 1px solid var(--shadow); font-size: 11px; }
.ie-frame-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #000080; }
.ie-frame-bar .btn { flex: 0 0 auto; }
.ie-frame { display: block; flex: 1 1 auto; width: 100%; border: 0; background: #fff; min-height: 0; }
.ie-doc, .ie-portal { font-family: "Times New Roman", "SimSun", serif; font-size: 13px; line-height: 1.6; color: #000; }
.ie-doc { padding: 18px 22px; }
.ie-doc h2 { font-size: 20px; color: #000080; border-bottom: 1px solid #c0c0c0; padding-bottom: 4px; margin-bottom: 12px; }
.ie-doc h3 { font-size: 15px; color: #000080; margin: 14px 0 4px; }
.ie-doc code { background: #f0f0f0; padding: 0 3px; font-family: "Courier New", monospace; }
.ie-doc a, .ie-links a, .ie-result a { color: #0000ee; text-decoration: underline; cursor: pointer; }
.ie-doc a:visited, .ie-links a:visited { color: #551a8b; }
.ie-links { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 0 12px; }
.ie-portal-head { background: linear-gradient(90deg, #000080, #1084d0); color: #fff; font: bold 15px var(--font);
  padding: 8px 12px; display: flex; align-items: center; gap: 8px; }
.ie-portal-head img { width: 20px; height: 20px; }
.ie-portal-body { padding: 16px 22px; }
.ie-searchbox { display: flex; gap: 6px; margin: 12px 0; }
.ie-searchbox input { flex: 1; height: 24px; padding: 2px 5px; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); font: 13px var(--font); }
.ie-search-results { margin-top: 16px; border-top: 1px solid #c0c0c0; padding-top: 10px; }
.ie-result { margin-top: 10px; }
.ie-result div { color: #008000; font-size: 12px; }

/* 右键菜单 */
.ctx-menu { position: absolute; z-index: 60000; min-width: 168px; background: var(--face);
  border: 2px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
  padding: 2px; box-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.ctx-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: 12px; cursor: default; white-space: nowrap; }
.ctx-item img { width: 16px; height: 16px; flex-shrink: 0; }
.ctx-item:hover { background: var(--title); color: #fff; }
.ctx-item.disabled { color: #9a9a9a; }
.ctx-item.disabled img { opacity: .5; }
.ctx-item.disabled:hover { background: transparent; color: #9a9a9a; }
.ctx-sep { height: 2px; margin: 3px 2px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--light); }

/* 重命名输入框 */
.ex-rename { font: 12px var(--font); width: 100%; height: 20px; padding: 0 3px;
  border: 1px solid #000; outline: none; }

/* 属性对话框 */
.prop-box { font-size: 12px; line-height: 1.9; display: grid; grid-template-columns: 60px 1fr; gap: 2px 8px; }
.prop-box div { display: contents; }
.prop-box b { grid-column: 1 / -1; border-bottom: 1px solid var(--shadow); padding-bottom: 4px; margin-bottom: 4px; }

/* 帮助窗口内容 */
.help-content { line-height: 1.7; }
.help-content h3 { margin-bottom: 8px; }
.help-content ul { margin-left: 18px; }
