/* ===== 全局 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  background: #000;
}

.screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ===== 壁纸 ===== */
.wallpaper {
  position: absolute;
  inset: 0;
  background-color: #1a1a1a;
  background-image: url('background.jpeg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

/* ===== 顶部菜单栏 ===== */
.menubar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26px;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.menubar-left, .menubar-right {
  display: flex;
  align-items: center;
  height: 100%;
}

.menu-item {
  padding: 0 9px;
  height: 100%;
  display: flex;
  align-items: center;
  cursor: default;
  border-radius: 4px;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.18); }
.menu-app-name { font-weight: 600; }
.apple-logo { padding: 0 10px; }
.apple-logo svg { display: block; margin-top: -1px; }

.menu-icon {
  padding: 0 7px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
  color: rgba(255, 255, 255, 0.95);
}
.menu-icon:hover { background: rgba(255,255,255,0.15); border-radius: 4px; }

.menu-icon.feishu-menu { padding: 0 6px; }
.menu-icon.feishu-menu img {
  height: 16px;
  width: auto;
  display: block;
  border-radius: 3px;
}

.menu-datetime {
  padding: 0 8px 0 10px;
  font-size: 13px;
  letter-spacing: 0.3px;
}

/* ===== 桌面小猫 ===== */
.desktop-cat {
  position: absolute;
  left: 18px;
  bottom: 84px;
  width: 120px;
  height: auto;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}

/* ===== 桌面 ===== */
.desktop {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.desktop-icons {
  position: absolute;
  top: 36px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 96px;
}

/* 铺满模式：网格布满整个桌面，每个图标加随机偏移制造杂乱感 */
.desktop-icons.filled {
  top: 36px;
  right: 12px;
  left: 12px;
  bottom: 80px;
  width: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  grid-auto-rows: 88px;
  gap: 0;
  align-content: start;
  justify-items: center;
  overflow: hidden;
}
.desktop-icons.filled .desktop-icon {
  /* 标签可以横向溢出，模拟长文件名覆盖邻格 */
  overflow: visible;
}
.desktop-icons.filled .icon-label {
  white-space: nowrap;
  max-width: none;
  word-break: normal;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 8px;
  border-radius: 6px;
  cursor: default;
}
.desktop-icon:hover { background: rgba(255,255,255,0.08); }
.desktop-icon.selected {
  background: rgba(80,130,200,0.45);
  outline: 1px solid rgba(255,255,255,0.25);
}

.icon-img {
  width: 60px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
}
.icon-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* 文件夹形状 */
.folder-shape {
  width: 60px;
  height: 44px;
  position: relative;
  background: linear-gradient(180deg, #6cb6ff 0%, #3a8bd8 100%);
  border-radius: 4px 4px 5px 5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.folder-shape::before {
  /* 文件夹后片 */
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  width: 24px;
  height: 8px;
  background: linear-gradient(180deg, #7bc1ff, #4a99e6);
  border-radius: 3px 3px 0 0;
}
.folder-shape::after {
  /* 文件夹前片高光 */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px 4px 5px 5px;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent 40%);
}

/* PDF 文件形状 */
.pdf-shape {
  width: 38px;
  height: 48px;
  background: linear-gradient(180deg, #fff 0%, #e8e8e8 100%);
  border-radius: 3px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  font-size: 8px;
  font-weight: 700;
  color: #d32f2f;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.pdf-shape::before {
  /* 折角 */
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: linear-gradient(225deg, #ccc 50%, #fff 50%);
  border-radius: 0 3px 0 3px;
}

.icon-label {
  margin-top: 4px;
  font-size: 11px;
  color: #fff;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  word-break: break-all;
  max-width: 92px;
}
.desktop-icon.selected .icon-label {
  background: rgba(80,130,200,0.8);
  border-radius: 3px;
  padding: 1px 3px;
}

/* ===== Dock ===== */
.dock-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  display: flex;
  justify-content: center;
  z-index: 50;
}

.dock {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(220, 220, 220, 0.32);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    0 10px 30px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

.dock-item {
  width: 52px;
  height: 52px;
  position: relative;
  cursor: default;
  transition: transform 0.18s ease;
}
.dock-item:hover { transform: translateY(-6px) scale(1.08); }

/* 运行指示点 */
.dock-item.running::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(60, 60, 60, 0.85);
  box-shadow: 0 0 1px rgba(255,255,255,0.5);
}

.dock-icon {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: visible;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.25));
}
.dock-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}
.dock-icon svg { display: block; border-radius: 12px; }

.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.9);
  z-index: 2;
}

.dock-separator {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.4);
  margin: 0 4px;
  align-self: center;
}

/* ===== 全屏按钮 ===== */
.fs-toggle {
  position: fixed;
  right: 12px;
  top: 36px;
  z-index: 200;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.fs-toggle:hover { opacity: 1; transform: scale(1.05); }
.fs-toggle .fs-exit { display: none; }
body.fs-on .fs-toggle .fs-enter { display: none; }
body.fs-on .fs-toggle .fs-exit { display: block; }

/* ===== 飞鸟动画 ===== */
.flying-bird {
  position: fixed;
  width: 120px;
  height: 120px;
  z-index: 9999;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.35));
  animation: bird-fly 1.6s cubic-bezier(.22,.61,.36,1) forwards;
}
.flying-bird img { width: 100%; height: 100%; display: block; animation: bird-bob 0.4s ease-in-out infinite; }
@keyframes bird-fly {
  /* 0-30%：先翻个白眼（左右摇头 + 后仰蓄势）*/
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  6%   { transform: translate(-6px, -1px) scale(1) rotate(-20deg); opacity: 1; }
  13%  { transform: translate(6px, -1px) scale(1) rotate(20deg); opacity: 1; }
  20%  { transform: translate(-4px, 0) scale(1.03) rotate(-15deg); opacity: 1; }
  25%  { transform: translate(2px, 3px) scale(1) rotate(10deg); opacity: 1; }
  30%  { transform: translate(0, 5px) scale(0.95) rotate(25deg); opacity: 1; }
  /* 30-100%：起飞飞走 */
  42%  { transform: translate(25px, -60px) scale(1.1) rotate(-10deg); opacity: 1; }
  58%  { transform: translate(140px, -190px) scale(1) rotate(-18deg); opacity: 1; }
  78%  { transform: translate(360px, -380px) scale(0.7) rotate(-28deg); opacity: 0.9; }
  100% { transform: translate(720px, -660px) scale(0.18) rotate(-42deg); opacity: 0; }
}
@keyframes bird-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(4deg); }
}

/* 窗口预览 */
.window-preview {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid rgba(0,0,0,0.15);
}
.wp-line {
  height: 4px;
  background: #aaa;
  border-radius: 2px;
}
.wp-line.short { width: 60%; }
