/* ============ 桌面 + 图标 + 任务栏 + start 菜单 ============ */

.desktop {
  position: fixed;
  inset: 0;
  /* 桌面壁纸；渐变作兜底，图片缺失时不至于白屏。 */
  background-color: #3f7ec9;
  background-image: url("/assets/wallpaper-custom.png");
  background-size: cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
/* ---- 桌面图标 ---- */
.icons {
  position: absolute;
  top: 18px;
  left: 14px;
  display: grid;
  grid-auto-flow: column;               /* 列优先：6 个图标排成一列，超出再进第二列 */
  grid-template-rows: repeat(6, auto);
  gap: 8px 10px;
  width: max-content;
  justify-items: center;
}
.icons li { width: 86px; }
.icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 2px;
  text-align: center;
}
.icon:focus-visible,
.icon.selected { background: rgba(36, 94, 219, 0.4); border-color: rgba(255,255,255,0.4); outline: none; }
/* hover 轻提示（比选中淡一档）；只在有真 hover 的设备上，避免触屏 tap 后残留 */
@media (hover: hover) {
  .icon:hover:not(.selected) { background: rgba(36, 94, 219, 0.18); border-color: rgba(255, 255, 255, 0.2); }
}
/* 统一图标盒子：等大、保持比例、块级水平居中，避免各 PNG 内边距差异导致看着没对齐 */
.icon .glyph {
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(1px 1px 1px rgba(0,0,0,.4));
}
.icon .name {
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  text-shadow: 1px 1px 2px rgba(0,0,0,.7);
}

/* ---- 文件夹吐出的快捷方式（预览图 + 角标） ---- */
#spill { position: absolute; inset: 0; pointer-events: none; }
#spill .icon.spill {
  position: absolute;
  width: 86px;
  padding: 2px 4px;              /* 比默认更紧，落地页不被挤到屏幕外 */
  gap: 3px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px) scale(.92);
  transition: opacity .18s ease, transform .18s ease;
}
#spill .icon.spill .name { line-height: 1.15; }
#spill .icon.spill.on { opacity: 1; transform: none; }
#spill.out .icon.spill { opacity: 0; transform: translateY(-4px) scale(.94); transition-delay: 0ms !important; }
.sp-thumb {
  position: relative;
  display: block;
  width: 62px; height: 47px;
  margin: 0 auto;
  border: 2px solid #fff; border-radius: 3px;
  background: #fff;
  box-shadow: 1px 1px 3px rgba(0,0,0,.35);
  overflow: hidden;
}
.sp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-lnk {
  position: absolute; left: 0; bottom: 0;
  width: 15px; height: 15px;
  display: grid; place-items: center;
  background: #fff; border-top-right-radius: 3px;
  font-size: 10px; font-weight: 700; color: #222;
}
/* 主打案例（Kuse App 文章）：金标 + 微光（尺寸与其他图标一致，保持对齐） */
#spill .icon.spill.featured .sp-thumb {
  border-color: #f6c344;
  box-shadow: 0 0 0 1px #b8860b, 0 2px 8px rgba(0,0,0,.4), 0 0 12px rgba(246,195,68,.45);
}
.sp-star {
  position: absolute; left: 0; bottom: 0;
  padding: 1px 5px;
  background: #f6c344; border-top-right-radius: 3px;
  font-size: 9px; font-weight: 700; color: #4a3200; letter-spacing: .04em;
}
#spill .icon.spill.featured .name { font-weight: 600; }

/* ---- 任务栏 ---- */
.taskbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 34px;
  display: flex;
  align-items: stretch;
  background: linear-gradient(to bottom, #3168d5 0%, var(--xp-blue) 8%, #1941a5 92%, #0f3491 100%);
  border-top: 1px solid #5b8ce8;
  z-index: 9000;
}
.start-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 0 18px 2px 10px;
  font-family: var(--font-ui);
  font-style: italic;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0,0,0,.4);
  background: linear-gradient(to bottom, #5db14a 0%, #3a8f2c 50%, #2f7d23 100%);
  border-right: 1px solid #1b5e12;
  border-top-right-radius: 9px;
  border-bottom-right-radius: 9px;
}
.start-btn:hover { filter: brightness(1.08); }
.start-btn.open { filter: brightness(0.9); }
.start-flag {
  width: 16px; height: 16px;
  background: conic-gradient(#e64a3b 0 25%, #5db14a 0 50%, #3a86d4 0 75%, #f0c419 0 100%);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}
.taskbar-items { flex: 1; display: flex; align-items: center; gap: 4px; padding: 3px 6px; overflow: hidden; }
.task-item {
  display: flex; align-items: center; gap: 6px;
  min-width: 120px; max-width: 160px;
  height: 24px; padding: 0 8px;
  color: #fff; font-size: 12px;
  background: linear-gradient(to bottom, #3f7ae0, var(--xp-blue));
  border: 1px solid #1941a5;
  border-radius: 3px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.task-item.active { background: linear-gradient(to bottom, #1c46b3, #1a3f9e); box-shadow: inset 1px 1px 2px rgba(0,0,0,.4); }
.task-item .dot { width: 14px; height: 14px; flex: none; }
.task-item span { overflow: hidden; text-overflow: ellipsis; }
.tray {
  display: flex; align-items: center;
  padding: 0 12px;
  background: linear-gradient(to bottom, #1a8fce, #1377b8);
  border-left: 1px solid #0f5e95;
}
.clock { color: #fff; font-size: 12px; text-shadow: 1px 1px 1px rgba(0,0,0,.3); }
/* ---- start 菜单 ---- */
.start-menu {
  position: absolute;
  left: 0; bottom: 34px;
  width: 240px;
  background: var(--win-bg);
  border: 2px solid var(--xp-blue-d);
  border-bottom: none;
  border-top-right-radius: 8px;
  box-shadow: 3px -3px 12px rgba(0,0,0,.4);
  z-index: 9500;
  overflow: hidden;
}
.start-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(to bottom, #2e64d6, #1c46b3);
  color: #fff;
}
.start-avatar {
  width: 34px; height: 34px;
  border-radius: 4px; border: 1px solid rgba(255,255,255,.6);
  overflow: hidden; background: #fff;
}
.start-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.start-user { font-weight: 600; }
.start-list { background: #fff; padding: 6px; }
.start-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  font-size: 13px; color: var(--text);
  border-radius: 2px;
}
.start-list li:hover { background: var(--xp-blue); color: #fff; }
.start-list .glyph { width: 24px; height: 24px; }
.start-foot {
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #4a4a4a;
  background: var(--face-d);
}

@media (max-width: 640px) {
  .icons { gap: 6px 8px; }
  .icons li { width: 68px; }
  .icon .glyph { width: 42px; height: 42px; }
  .icon .name { font-size: 11px; }
  /* 竖屏 cover 只显示横图中间约 1/3，取景窗左移让探头的手也入镜（默认 center 只剩眼睛） */
  .desktop { background-position: 42% center, center; }
  .desktop::before { background-position: 42% center; }
  /* 取景窗挪了，点头彩蛋的隐形热区跟着对到脸上（移动端脸偏中右） */
  #echo-spot { left: 42%; top: 36%; width: 55%; height: 32%; }
}

/* ---- 桌面宠物（js/pet.js）：高于窗口、低于任务栏 ---- */
#pet { position: absolute; left: 0; bottom: 34px; height: 170px; z-index: 8999; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
#pet.held { cursor: grabbing; }
#pet:focus-visible { outline: 2px dotted #fff; outline-offset: 2px; }
#pet .pet-body { height: 100%; transform-origin: 50% 100%; }
#pet img { height: 100%; width: auto; display: block; pointer-events: none; filter: drop-shadow(0 4px 3px rgba(0,0,0,.35)); }
#pet[data-mode="idle"] .pet-body, #pet[data-mode="look"] .pet-body { animation: petBreath 2.4s ease-in-out infinite; }
#pet[data-mode="walk"] .pet-body { animation: petBob .6s ease-in-out infinite; }
#pet.held .pet-body { animation: petDangle .6s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes petBreath { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.02); } }
@keyframes petBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes petDangle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
/* XP 气泡提示（tooltip 黄） */
.pet-bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 10px;
  width: max-content; max-width: 210px; padding: 7px 10px;
  background: #ffffe1; color: #000; border: 1px solid #000; border-radius: 8px;
  font: 12px/1.5 Tahoma, "Microsoft YaHei", sans-serif; box-shadow: 2px 2px 4px rgba(0,0,0,.3);
}
.pet-bubble::before, .pet-bubble::after { content: ""; position: absolute; top: 100%; left: 50%; border: 7px solid transparent; }
.pet-bubble::before { margin-left: -7px; border-top-color: #000; }
.pet-bubble::after { margin-left: -6px; border-width: 6px; border-top-color: #ffffe1; }
#pet.edge-r .pet-bubble { left: auto; right: 0; transform: none; }
#pet.edge-r .pet-bubble::before, #pet.edge-r .pet-bubble::after { left: auto; right: 18px; }
#pet.edge-l .pet-bubble { left: 0; transform: none; }
#pet.edge-l .pet-bubble::before, #pet.edge-l .pet-bubble::after { left: 24px; }
@media (max-width: 600px) { #pet { height: 120px; } }
@media (prefers-reduced-motion: reduce) { #pet .pet-body { animation: none !important; } }

/* 开始菜单分隔线与关机项 */
.start-list .sep { height: 1px; margin: 4px 8px; padding: 0; background: var(--face-d); }
.start-list li[data-shutdown] { font-weight: 500; }
