body {
  background-color: #008080; /* Classic Win98 Teal */
  background-image: url('assets/icon/bg-dither.svg');
  background-repeat: repeat;
  background-size: 4px 4px;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Prevent body scroll, windows move inside */
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  height: 100vh;
  width: 100vw;
  user-select: none;
  position: relative;
}

/* Center logo watermark (Win98-style, original SVG) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: url('assets/icon/windows-0.png') center 42% / 300px auto no-repeat;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

/* Desktop Icons */
.desktop-icons {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none; /* icons opt-in */
}

.icon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 84px; /* 70px * 1.2 */
  cursor: pointer;
  text-align: center;
  color: white;
  text-shadow: 1px 1px 0px black; /* Better readability on teal */
  pointer-events: auto;
}

.icon img {
  width: 38.4px; /* 32px * 1.2 */
  height: 38.4px; /* 32px * 1.2 */
  margin-bottom: 6px; /* 5px * 1.2 */
}

.icon-text {
  font-size: 14.4px; /* 12px * 1.2 */
  padding: 2px;
}

.icon:active .icon-text {
  background-color: #000080;
  border: 1px dotted white;
}

/* 图标选中状态 */
.icon.selected .icon-text {
  background-color: #000080;
  border: 1px dotted white;
}

.icon.selected {
  /* 可选：给整个图标添加视觉反馈 */
}

/* 拖拽中的图标 */
.icon.dragging {
  opacity: 0.7;
  cursor: move !important;
}

/* 窗口标题栏悬停效果 */
.title-bar:hover {
  background: linear-gradient(to right, #000080, #1084d0);
}

/* Recycle Bin */
.recyclebin-layout {
  display: flex;
  gap: 10px;
  height: 100%;
  padding: 8px;
  box-sizing: border-box;
}

.recyclebin-list {
  flex: 1;
  min-width: 200px;
  border: 2px inset #dfdfdf;
  background: #fff;
  overflow: auto;
}

.recyclebin-preview {
  width: 170px;
  flex: 0 0 170px;
}

.recyclebin-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  cursor: default;
  user-select: none;
}

.recyclebin-item img {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
}

.recyclebin-item.is-selected {
  background: #000080;
  color: #fff;
}

/* PVZ Wisdom Tree */
.pvz-tree {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #3a6ea5;
}

.pvz-tree-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 6px;
  background: #c0c0c0;
  border-bottom: 2px solid #808080;
}

.pvz-fertilize {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pvz-fertilize img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}

.pvz-tree-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  gap: 10px;
}

.pvz-tree-img {
  width: 240px;
  height: 240px;
  image-rendering: pixelated;
}

.pvz-tree-speech {
  width: min(520px, 92%);
  background: #fff;
  border: 2px solid #000;
  padding: 8px 10px;
  font-family: "MS Sans Serif", Arial, sans-serif;
  font-size: 12px;
}

/* Boot toast (bottom-right) */
.boot-toast {
  position: fixed;
  right: 10px;
  bottom: 42px; /* above taskbar */
  background: #fff;
  border: 2px solid #000;
  padding: 8px 10px;
  font-family: "MS Sans Serif", Arial, sans-serif;
  font-size: 12px;
  max-width: 320px;
  z-index: 10001;
  box-shadow: 2px 2px 0 #000;
}

/* Context menu (Recycle Bin restore) */
.context-menu {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 10002;
  min-width: 120px;
  background: #c0c0c0;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  padding: 2px;
}

.context-menu-item {
  padding: 4px 8px;
  cursor: default;
  user-select: none;
}

.context-menu-item:hover {
  background: #000080;
  color: #fff;
}

/* Windows */
.window {
  position: absolute;
  min-width: 300px;
  min-height: 200px;
  display: none; /* Hidden by default */
  z-index: 10;
  box-sizing: border-box;
}

.window.window-open {
  display: flex;
  flex-direction: column;
}

.window-body {
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Message box (window-styled dialogs) */
.message-box {
  background: #c0c0c0;
  border: 2px inset #dfdfdf;
  padding: 10px;
  font-family: "MS Sans Serif", Arial, sans-serif;
  font-size: 12px;
  color: #000;
  box-sizing: border-box;
}

.message-box-main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.message-box-icon {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.message-box-text {
  line-height: 1.5;
  word-break: break-word;
}

.message-box-detail {
  margin-top: 8px;
  padding: 8px;
  background: #fff;
  border: 2px inset #dfdfdf;
  color: #000;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-box-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.message-box-buttons button {
  min-width: 70px;
}

.message-box-btn-primary {
  font-weight: bold;
}

.message-box-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000;
  padding: 10px;
  box-sizing: border-box;
}

.message-box-fallback {
  background: silver;
  border: 2px solid #000;
  box-shadow: 4px 4px 0 #000;
}

.window-body > ul[role="menu-bar"] {
  flex: 0 0 auto;
}

/* Resize Handle */
.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #808080 50%);
  z-index: 10;
}

.resize-handle::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  border-left: 2px solid #fff;
  border-top: 2px solid #fff;
}

/* Taskbar */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: silver;
  border-top: 2px solid white;
  display: flex;
  align-items: center;
  padding: 2px;
  z-index: 1000;
  box-shadow: inset 1px 1px #dfdfdf, 1px 0 #000, 0 1px #000, 1px 1px #000;
}

.start-button {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  margin-right: 5px;
}

.start-button img {
  width: 16px;
  height: 16px;
}

.taskbar-divider {
  flex-grow: 1;
}

.taskbar-windows {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.taskbar-window-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  min-width: 120px;
  height: 24px;
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbar-window-btn img {
  width: 16px;
  height: 16px;
}

.taskbar-window-btn.is-active {
  box-shadow: inset -1px -1px #dfdfdf, inset 1px 1px #0a0a0a;
}

.taskbar-separator {
  width: 2px;
  height: 22px;
  margin: 0 4px;
  background: #808080;
  box-shadow: 1px 0 #fff;
}

.quick-launch {
  display: flex;
  align-items: center;
  gap: 2px;
}

.quick-launch-btn {
  width: 26px;
  height: 26px;
  padding: 1px;
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
}

.quick-launch-btn img {
  width: 22px;
  height: 22px;
}

.quick-launch-btn:hover {
  border-color: #ffffff #808080 #808080 #ffffff;
}

.taskbar-time {
  padding: 2px 5px;
  margin-right: 2px;
  font-size: 12px;
  /* Border moved to system-tray */
}

.system-tray {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  padding: 2px;
  margin-right: 2px;
  background: silver;
  height: 22px; /* Match taskbar height roughly */
}

.tray-icon {
  width: 16px;
  height: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tray-icon img {
  width: 16px;
  height: 16px;
}

/* Start Menu */
.start-menu {
  position: fixed;
  bottom: 32px;
  left: 2px;
  width: 200px;
  background: silver;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-shadow: 2px 2px 0px black;
  display: none;
  z-index: 2000;
  padding: 2px;
}

.start-menu-sidebar {
  width: 20px;
  background: linear-gradient(to bottom, #000080, #1084d0);
  color: white;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  padding: 5px 0;
  float: left;
  height: 100%;
  min-height: 150px;
}

.start-menu-items {
  margin-left: 25px;
  display: flex;
  flex-direction: column;
}

.menu-item {
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.menu-item:hover {
  background-color: #000080;
  color: white;
}

.menu-item img {
  width: 24px;
  height: 24px;
}

/* Guestbook Specifics */
.guestbook-container {
  /* Custom scrollbar for webkit to match retro feel slightly better */
  scrollbar-width: thin;
  scrollbar-color: #c0c0c0 #dfdfdf;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
  padding: 10px;
  border: 2px inset #dfdfdf;
  overflow-y: auto;
}

.guestbook-container #gitalk-container {
  flex: 1;
  overflow-y: auto;
}

/* Computer Window Content */
.computer-content {
  background: white;
  padding: 15px;
  border: 2px inset #dfdfdf;
  flex: 1;
  overflow-y: auto;
  font-size: 15px; /* 增大字体 */
  line-height: 1.6; /* 增加行高提升可读性 */
}

.computer-content h3 {
  font-size: 20px; /* 标题更大 */
}

.computer-content p {
  font-size: 15px;
}

.computer-content fieldset {
  font-size: 14px;
}

/* Resume Window */
.resume-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: white;
  min-height: 0;
}

.resume-container iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 2px inset #dfdfdf;
  box-sizing: border-box;
}

/* Music player */
.music-container {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 10px;
  padding: 10px;
  background: silver;
}

.music-list {
  background: white;
  border: 2px inset #dfdfdf;
  overflow-y: auto;
  padding: 6px;
  font-family: "Comic Sans MS", "Comic Sans", cursive;
}

.music-list button {
  width: 100%;
  text-align: left;
  margin-bottom: 4px;
}

.music-now {
  background: white;
  border: 2px inset #dfdfdf;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.music-controls .btn {
  min-width: 44px;
}

.music-loop {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
}

.music-track-btn.is-current {
  background: #000080;
  color: #fff;
}

.music-now-title {
  font-weight: bold;
  color: #000080;
}

.music-audio {
  width: 100%;
}

@media (max-width: 720px) {
  .music-container {
    grid-template-columns: 1fr;
  }
}

/* Waline Customization to fit Win98 theme */
#waline-container {
  font-family: "MS Sans Serif", Arial, sans-serif;
  --waline-theme-color: #008080;
  --waline-active-color: #000080;
}

#waline-container .wl-editor {
  border: 2px inset #dfdfdf;
  background: #fff;
}

#waline-container .wl-btn.primary {
  border: 2px outset #fff;
  background: #c0c0c0;
  color: #000;
  border-right-color: #404040;
  border-bottom-color: #404040;
  border-radius: 0;
  font-weight: bold;
}

#waline-container .wl-btn.primary:active {
  border: 2px inset #dfdfdf;
}
}
/* 右键菜单 */
.context-menu {
  position: fixed;
  background: silver;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-shadow: 2px 2px 0px black;
  padding: 2px;
  z-index: 3000;
  display: none;
  min-width: 150px;
}

.context-menu-item {
  padding: 5px 25px 5px 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  position: relative;
}

.context-menu-item:hover {
  background-color: #000080;
  color: white;
}

.context-menu-item.disabled {
  color: #808080;
  cursor: default;
}

.context-menu-item.disabled:hover {
  background-color: silver;
  color: #808080;
}

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

.context-menu-item img {
  width: 16px;
  height: 16px;
  position: absolute;
  left: 5px;
}
/* Terminal / CMD 样式 */
#terminal-container {
  width: 100%;
  height: 100%;
  background: #000;
  color: #c0c0c0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  padding: 10px;
  overflow-y: auto; /* Scroll the container */
  display: block;   /* Normal block flow */
}

#terminal-output {
  /* Remove flex: 1 and overflow */
  margin-bottom: 5px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.terminal-line {
  margin: 2px 0;
  line-height: 1.4;
}

.terminal-input {
  color: #fff;
}

.terminal-output {
  color: #c0c0c0;
}

.terminal-error {
  color: #ff5555;
}

.terminal-success {
  color: #55ff55;
}

.terminal-system {
  color: #55ffff;
}

.terminal-hint {
  color: #ffff55;
}

.terminal-prompt {
  color: #55ff55;
}

.prompt-path {
  color: #55ffff;
}

.prompt-symbol {
  color: #55ff55;
  margin: 0 4px;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  position: relative;
  min-height: 20px; /* Ensure it has height */
  flex-wrap: wrap; /* Allow wrapping if command is long */
}

.terminal-cursor {
  color: #55ff55;
  animation: blink 1s step-end infinite;
  font-weight: bold;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

#terminal-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 10;
  cursor: text;
}

#terminal-input-display {
  color: #fff;
  white-space: pre-wrap;
  word-break: break-all;
}

#terminal-prompt-text {
  margin-right: 8px;
}

#terminal-input::selection {
  background: #fff;
  color: #000;
}

#terminal-output::-webkit-scrollbar {
  width: 16px;
}

#terminal-output::-webkit-scrollbar-track {
  background: #000;
}

#terminal-output::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 2px solid #000;
}

#terminal-output::-webkit-scrollbar-thumb:hover {
  background: #fff;
}

/* Top Right Info Container */
#top-right-info {
  position: absolute !important;
  top: 20px !important;
  right: 20px !important;
  left: auto !important;
  z-index: 2000 !important;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: auto;
}

/* Visitor Counter */
#visitor-counter {
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  color: white;
  text-shadow: 1px 1px 0px black;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
}

#last-updated {
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  color: white;
  text-shadow: 1px 1px 0px black;
  font-size: 14px;
}

#visitor-counter img {
  vertical-align: middle;
}

/* Window Description Bar */
.window-description-bar {
  padding: 4px 8px;
  background-color: #c0c0c0;
  color: #000;
  font-size: 12px;
  border-bottom: 1px solid #808080;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
