/* desktop.css — 全屏 XP 桌面舞台、开机动画、图标、任务栏、开始菜单与 CRT 效果 */

#os-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #0b2454;
}

/* 壁纸 Canvas 层 */
#wallpaper-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* CRT 复古微弧扫描线遮罩（可关闭） */
#crt-overlay {
  position: absolute;
  inset: 0;
  z-index: 9500;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.055) 0px,
      rgba(0, 0, 0, 0.055) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(ellipse at center, transparent 62%, rgba(0, 8, 24, 0.24) 100%);
  opacity: 0.72;
  transition: opacity 0.25s ease;
}
#os-root.crt-off #crt-overlay {
  opacity: 0;
}

/* 坏道瞬间微震/故障闪烁特效 */
#os-root.glitch-flash {
  animation: hdGlitch 0.36s steps(2, end);
}
@keyframes hdGlitch {
  0% { filter: none; transform: translate(0, 0); }
  25% { filter: contrast(1.25) hue-rotate(-14deg); transform: translate(-2px, 1px); }
  50% { filter: saturate(0.5) brightness(0.92); transform: translate(2px, -1px); }
  75% { filter: contrast(1.12); transform: translate(-1px, 0); }
  100% { filter: none; transform: translate(0, 0); }
}

/* 主桌面工作区（位于任务栏上方） */
#desktop-stage {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--taskbar-h);
  z-index: 1;
  overflow: hidden;
}

/* 桌面快捷图标网格（左侧双列有序排布，不拥挤） */
#desktop-icons {
  position: absolute;
  top: 14px;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px 10px;
  z-index: 2;
  pointer-events: none;
}

.desktop-icon {
  pointer-events: auto;
  width: 86px;
  padding: 6px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.desktop-icon:hover {
  background: rgba(58, 140, 255, 0.26);
  border-color: rgba(160, 206, 255, 0.65);
}
.desktop-icon.selected {
  background: rgba(11, 97, 255, 0.45);
  border-color: rgba(205, 230, 255, 0.9);
}
.desktop-icon .icon-art {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 3px rgba(0, 15, 45, 0.45));
}
.desktop-icon .icon-label {
  font-size: 12px;
  line-height: 1.25;
  color: #ffffff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.92),
    1px 1px 0 rgba(0, 0, 0, 0.78),
    -1px 0 1px rgba(0, 0, 0, 0.5);
  word-break: break-word;
}
.desktop-icon .icon-badge {
  position: absolute;
  top: 3px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #e03131;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  animation: badgePulse 1.4s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* 右上角极简桌面档案进度挂件（经典 XP 桌面贴纸风） */
#desktop-hud {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 3;
  width: 262px;
  background: linear-gradient(180deg, #fffbe6, #fff3bf);
  border: 1px solid #d4a62a;
  box-shadow: 2px 4px 14px rgba(0, 16, 48, 0.28);
  border-radius: 3px;
  padding: 10px 12px;
  color: #3b2f0b;
  font-size: 12px;
}
.hud-pin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  color: #7c4a03;
  border-bottom: 1px dashed #d4a62a;
  padding-bottom: 5px;
  margin-bottom: 7px;
}
.hud-meter-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}
.hud-bar {
  width: 100%;
  height: 7px;
  background: rgba(124, 74, 3, 0.14);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.hud-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59f00, #2b8a3e);
  transition: width 0.35s ease;
}
.hud-tip {
  font-size: 11.5px;
  line-height: 1.45;
  color: #5c450d;
  margin-bottom: 8px;
}
.hud-actions {
  display: flex;
  gap: 6px;
}
.hud-btn {
  flex: 1;
  border: 1px solid #c59217;
  background: linear-gradient(180deg, #fffdf2, #f5df93);
  color: #4a3304;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 2px;
  cursor: pointer;
}
.hud-btn:hover {
  background: linear-gradient(180deg, #ffffff, #ffe89e);
}

/* 窗口承载层 */
#windows-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* 离线消息右下角弹窗（3秒入戏钩子） */
#offline-toast {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 318px;
  z-index: 4200;
  background: #f4f8ff;
  border: 2px solid #1254c4;
  border-radius: 7px 7px 4px 4px;
  box-shadow: 0 10px 28px rgba(0, 15, 50, 0.48);
  overflow: hidden;
  transform: translateY(130%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}
#offline-toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.toast-head {
  background: linear-gradient(180deg, #3288ff, #0c52d1 55%, #073eb3);
  color: #fff;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
}
.toast-close {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  width: 20px;
  height: 18px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 14px;
  font-size: 12px;
}
.toast-body {
  padding: 12px;
  font-size: 12.5px;
  line-height: 1.55;
}
.toast-sender {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.toast-sender strong {
  color: #0b4db8;
  font-size: 13px;
}
.toast-sender time {
  font-size: 11px;
  color: #7c8596;
  font-family: var(--font-mono);
}
.toast-msg {
  background: #ffffff;
  border: 1px solid #c9daf6;
  border-radius: 4px;
  padding: 8px 10px;
  color: #1f2937;
  margin-bottom: 10px;
}
.toast-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 全局线索采集浮提示（居左中偏上，确保不遮挡右上角便签） */
#clue-toast {
  position: absolute;
  top: 12px;
  left: 118px;
  max-width: min(460px, calc(100vw - 420px));
  transform: translateY(-150%);
  z-index: 5000;
  background: linear-gradient(180deg, #fffdf0, #ffec99);
  border: 2px solid #d97706;
  border-radius: 6px;
  padding: 7px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #4a2d00;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;
}
#clue-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* XP Luna 底部任务栏 */
#taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  z-index: 4500;
  background: linear-gradient(180deg, #3c8df7 0%, #2467e1 14%, #1e57cf 84%, #1644ad 100%);
  border-top: 1px solid #63a4ff;
  display: flex;
  align-items: stretch;
  box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.35);
}

#start-btn {
  height: 100%;
  padding: 0 18px 0 12px;
  border: none;
  border-right: 1px solid #1b5c1b;
  border-radius: 0 13px 13px 0;
  background: linear-gradient(180deg, #62c762 0%, #3d9e3d 18%, #2e842e 82%, #236923 100%);
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.04em;
  text-shadow: 1px 1px 2px rgba(0, 42, 0, 0.8);
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 2px 0 5px rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
}
#start-btn:hover {
  background: linear-gradient(180deg, #74d474 0%, #48ae48 18%, #369236 82%, #287528 100%);
}
#start-btn.active {
  background: linear-gradient(180deg, #2b7a2b 0%, #236623 100%);
  box-shadow: inset 1px 2px 4px rgba(0, 0, 0, 0.45);
}
.start-flag {
  width: 16px;
  height: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  transform: skewX(-6deg);
}
.start-flag span { display: block; border-radius: 1px; }
.start-flag span:nth-child(1) { background: #ff5722; }
.start-flag span:nth-child(2) { background: #8bc34a; }
.start-flag span:nth-child(3) { background: #03a9f4; }
.start-flag span:nth-child(4) { background: #ffc107; }

/* 任务栏窗口切换条 */
#taskbar-tasks {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  overflow: hidden;
}

.task-item {
  height: 27px;
  flex: 0 1 156px;
  min-width: 64px;
  max-width: 164px;
  padding: 0 8px;
  border-radius: 3px;
  border: 1px solid #1441a3;
  background: linear-gradient(180deg, #4b94ff, #2a6de3 48%, #215dd1);
  color: #ffffff;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.task-item:hover {
  background: linear-gradient(180deg, #62a5ff, #397ef0 48%, #296ae0);
}
.task-item.active {
  background: linear-gradient(180deg, #1644a8, #1d52c4);
  border-color: #0b2d7a;
  box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.42);
  font-weight: 700;
}
.task-item.minimized {
  opacity: 0.82;
}
.task-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右下角系统托盘 */
#system-tray {
  flex-shrink: 0;
  height: 100%;
  padding: 0 12px 0 10px;
  background: linear-gradient(180deg, #229ff5 0%, #1484e0 22%, #0e6fc8 85%, #0a58a8 100%);
  border-left: 1px solid #094f9e;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 12px;
}

.tray-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
.tray-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}
.tray-btn.blink {
  animation: trayBlink 0.9s steps(2, start) infinite;
}
@keyframes trayBlink {
  0% { opacity: 1; transform: translateY(0); }
  50% { opacity: 0.45; transform: translateY(-1px); }
  100% { opacity: 1; transform: translateY(0); }
}

#tray-clock {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.15;
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-left: 4px;
}

/* 经典 XP 开始菜单 */
#start-menu {
  position: absolute;
  left: 0;
  bottom: var(--taskbar-h);
  width: 392px;
  z-index: 4600;
  border-radius: 8px 8px 0 0;
  border: 2px solid #0b41b8;
  box-shadow: 4px -4px 24px rgba(0, 14, 48, 0.5);
  overflow: hidden;
  display: none;
}
#start-menu.open {
  display: block;
}
.sm-header {
  background: linear-gradient(180deg, #2d82f5, #1055cf 58%, #0c44b5);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  border-bottom: 2px solid #e59835;
}
.sm-avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 2px solid #dceaff;
  background: linear-gradient(135deg, #2d6cdf, #66c2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}
.sm-user-title {
  font-size: 15px;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.55);
}
.sm-user-sub {
  font-size: 11px;
  color: #d6e8ff;
}
.sm-body {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: #ffffff;
}
.sm-left {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-right: 1px solid #a8c4ed;
}
.sm-right {
  background: #d3e5fa;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sm-item {
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  color: #16243d;
  font-size: 12.5px;
  font-family: var(--font-ui);
}
.sm-item:hover {
  background: #2f71cd;
  color: #ffffff;
}
.sm-item small {
  display: block;
  font-size: 10.5px;
  opacity: 0.72;
}
.sm-sep {
  height: 1px;
  background: rgba(16, 68, 168, 0.18);
  margin: 4px 6px;
}
.sm-footer {
  background: linear-gradient(180deg, #3c86f0, #1654c7);
  padding: 7px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.sm-foot-btn {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
}
.sm-foot-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* 开机仪式 BIOS + XP 加载屏 */
#boot-screen {
  position: absolute;
  inset: 0;
  z-index: 9000;
  background: #040609;
  color: #cfd8e3;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 28px;
  transition: opacity 0.55s ease;
}
#boot-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.boot-bios {
  width: min(760px, 92vw);
  font-size: 13.5px;
  line-height: 1.72;
  color: #cfd8e3;
}
.boot-bios .bios-hl { color: #74c0fc; font-weight: 700; }
.boot-bios .bios-warn { color: #ffd43b; }
.boot-bios .bios-ok { color: #69db7c; }
.boot-bios .bios-story {
  margin-top: 14px;
  padding: 12px 16px;
  border-left: 3px solid #3a8cff;
  background: rgba(58, 140, 255, 0.08);
  color: #e9f2ff;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.75;
}

.boot-xp-logo {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}
.boot-xp-logo.active {
  display: flex;
}
.boot-logo-title {
  font-family: var(--font-ui);
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
}
.boot-logo-title sup {
  color: #ff6b35;
  font-size: 20px;
  margin-left: 3px;
}
.boot-logo-sub {
  font-size: 13px;
  color: #93b4e0;
  letter-spacing: 0.14em;
}
.xp-loader-track {
  width: 210px;
  height: 16px;
  border: 2px solid #8a95a8;
  border-radius: 4px;
  padding: 2px;
  overflow: hidden;
  position: relative;
  background: #080b10;
}
.xp-loader-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 46px;
  display: flex;
  gap: 3px;
  animation: xpSlide 1.35s linear infinite;
}
.xp-loader-bar span {
  flex: 1;
  border-radius: 2px;
  background: linear-gradient(180deg, #99c8ff, #226be6 55%, #1648b0);
}
@keyframes xpSlide {
  0% { left: -52px; }
  100% { left: 214px; }
}

.boot-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
}
.boot-btn {
  padding: 9px 22px;
  border-radius: 4px;
  border: 1px solid #4d94ff;
  background: linear-gradient(180deg, #2d7df6, #1350bd);
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(24, 100, 230, 0.4);
}
.boot-btn:hover {
  background: linear-gradient(180deg, #4791ff, #1b60d9);
}
.boot-btn.ghost {
  background: transparent;
  border-color: #556275;
  color: #a9b4c4;
  box-shadow: none;
}
.boot-btn.ghost:hover {
  border-color: #93a4bc;
  color: #ffffff;
}
