/* ============================================================
   小灶 OS · 系统外壳（菜单栏 / 桌面 / 桌面图标 / Dock / 窗口骨架）
   App 专属样式见 appstyles.css
   ============================================================ */
:root {
  --os-accent: #ff7a45;
  --os-wall-1: #1b1035;
  --os-wall-2: #5b2a86;
  --os-wall-3: #ff7a45;
  --os-ink: #1c1822;
  --os-ink-2: #57505f;
  --os-ink-3: #8d8597;
  --os-line: rgba(28, 24, 34, 0.12);
  --os-win: rgba(250, 248, 252, 0.94);
  --font: "Noto Sans SC", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--os-ink);
  overflow: hidden;
  background: linear-gradient(rgba(8, 10, 16, 0.12), rgba(8, 10, 16, 0.28)), url("media/wallpaper-desktop-fin2.webp") center / cover no-repeat;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img, image-slot { -webkit-user-drag: none; user-drag: none; user-select: none; }


.lockscreen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(rgba(8, 10, 16, 0.18), rgba(8, 10, 16, 0.38)), url("media/wallpaper-desktop-fin2.webp") center / cover no-repeat;
  color: #fff;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.lockscreen.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.lock-date {
  margin-top: 11vh;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 0.85;
  text-shadow: 0 2px 14px rgba(10, 5, 40, 0.4);
}
.lock-time {
  font-size: clamp(72px, 13vw, 132px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-shadow: 0 6px 36px rgba(10, 5, 40, 0.45);
}
.lock-user {
  margin-top: auto;
  margin-bottom: 9vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.lock-user img {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 30px rgba(10, 5, 40, 0.45);
}
.lock-user p {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(10, 5, 40, 0.5);
}
.lock-enter {
  margin-top: 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  padding: 10px 30px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  transition: background 0.15s ease, transform 0.15s ease;
}
.lock-enter:hover { background: rgba(255, 255, 255, 0.34); transform: translateY(-1px); }

.menubar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: rgba(12, 8, 20, 0.55);
  backdrop-filter: blur(18px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  z-index: 1000;
  user-select: none;
  -webkit-user-select: none;
}
.menubar .logo-ic { width: 17px; height: 17px; display: block; flex: none; }
.menubar .app-name { font-weight: 700; white-space: nowrap; }
.menubar .menu { opacity: 0.75; cursor: default; white-space: nowrap; }
.menubar .spacer { flex: 1; }
.menubar .clock { font-family: var(--mono); font-size: 12px; opacity: 0.85; white-space: nowrap; }
.menubar .status { display: flex; align-items: center; gap: 14px; opacity: 0.9; }
.menubar .status svg { display: block; }

/* ---------- 桌面 ---------- */
.desktop {
  position: fixed;
  inset: 34px 0 0 0;
  overflow: hidden;
}
.desktop-hint {
  position: absolute;
  right: 6%;
  top: 38%;
  transform: translateY(-50%);
  text-align: right;
  color: rgba(255, 255, 255, 0.92);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.desktop-hint.hide { opacity: 0; }
.desktop-hint h1 {
  font-size: clamp(28px, 3.6vw, 50px);
  font-weight: 900;
  line-height: 1.25;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
}
.desktop-hint h1 b { color: var(--os-accent); }
.desktop-hint p {
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.65;
  font-family: var(--mono);
  letter-spacing: 0.22em;
}
.desktop-sticker {
  position: fixed;
  right: 28px;
  bottom: 130px;
  width: clamp(96px, 11vw, 150px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
  cursor: grab;
  -webkit-user-drag: none;
  z-index: 6000;
  filter: drop-shadow(0 14px 22px rgba(8, 4, 18, 0.28));
}
body.is-locked .desktop-sticker {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.desktop-sticker.dragging { cursor: grabbing; z-index: 6000; }
.desktop-danmaku {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  height: 174px;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  z-index: 6;
  mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
}
.danmaku-item {
  position: absolute;
  left: 100%;
  white-space: nowrap;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(20, 16, 32, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 26px rgba(8, 4, 18, 0.2);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  animation-name: danmaku-fly;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes danmaku-fly {
  to { transform: translate3d(calc(-100vw - 120%), 0, 0); }
}

/* ---------- 桌面视频图标（绝对定位，可拖拽） ---------- */
.desk-icons { position: absolute; inset: 0; z-index: 5; }
.desk-file {
  position: absolute;
  width: 106px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-radius: 8px;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  cursor: default;
}
.desk-file.drag { opacity: 0.82; z-index: 9; }
.desk-thumb {
  position: relative;
  width: 86px;
  height: 54px;
  border-radius: 7px;
  background: linear-gradient(135deg, #3c2b63, #6b3fa0);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.desk-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.desk-file.sel .desk-thumb { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.32), 0 4px 10px rgba(0, 0, 0, 0.3); }
.desk-thumb::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
}
.desk-thumb .pl {
  width: 23px; height: 23px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #2a1650;
  display: grid;
  place-items: center;
  font-size: 10px;
  padding-left: 2px;
  z-index: 1;
}
.desk-thumb .dur {
  position: absolute;
  right: 4px; bottom: 3px;
  font-family: var(--mono);
  font-size: 8.5px;
  color: #fff;
  z-index: 1;
}
.desk-file .fname {
  font-size: 11.5px;
  line-height: 1.4;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  padding: 1px 6px;
  border-radius: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.desk-file.sel .fname { background: #2f7cf6; text-shadow: none; }

.desk-menu {
  position: fixed;
  z-index: 3600;
  min-width: 112px;
  padding: 6px;
  border-radius: 9px;
  background: rgba(245, 242, 249, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 14px 38px rgba(8, 4, 18, 0.32);
  backdrop-filter: blur(22px);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.desk-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.desk-menu button {
  width: 100%;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d7342a;
  text-align: left;
  padding: 0 10px;
  font-size: 13px;
}
.desk-menu button:hover {
  background: rgba(47, 124, 246, 0.14);
}

/* ---------- Quick Look ---------- */
.quicklook {
  position: fixed;
  inset: 34px 0 0 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(8, 6, 14, 0.34);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.quicklook.open { opacity: 1; pointer-events: auto; }
.ql-card {
  position: relative;
  width: min(900px, 78vw);
  border-radius: 18px;
  background: rgba(18, 16, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 36px 110px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform-origin: 50% 45%;
}
.quicklook.open .ql-card { animation: ql-effect-4 0.28s cubic-bezier(0.18, 0.82, 0.22, 1) both; }
@keyframes ql-effect-4 {
  0% { opacity: 0; transform: translateY(18px) scale(0.86); filter: blur(8px); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.015); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
.ql-close {
  position: absolute;
  margin: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 0;
  font-size: 19px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 2;
}
.ql-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #08070b;
}
.ql-stage iframe,
.ql-stage img {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  object-fit: contain;
}
.ql-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px 15px;
  color: #fff;
}
.ql-meta b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.ql-meta span {
  flex: none;
  margin-left: auto;
  font-size: 12px;
  opacity: 0.7;
}

/* 框选矩形 */
.marquee-sel {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  border: 1px solid rgba(130, 175, 255, 0.85);
  background: rgba(100, 150, 255, 0.18);
  border-radius: 2px;
}

/* ---------- Dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 14px 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  backdrop-filter: blur(20px);
  z-index: 900;
}
.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: 0;
}
.dock-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.16s ease;
}
.dock-item:hover .dock-icon { transform: translateY(-8px) scale(1.12); }
.dock-item .tip {
  position: absolute;
  bottom: calc(100% + 10px);
  background: rgba(12, 8, 20, 0.8);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.dock-item:hover .tip { opacity: 1; }
.dock-item .dot {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  margin: 0;
  opacity: 0;
}
.dock-item.running .dot { opacity: 1; }
.dock-sep { width: 1px; align-self: stretch; background: rgba(255, 255, 255, 0.25); margin: 4px 2px; }

/* App 图标（真实 PNG）：容器与图片同尺寸，保证与圆点同轴 */
.dock-icon.img { background: none; box-shadow: none; width: 64px; height: 64px; }
.dock-icon.img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
  pointer-events: none;
}
/* 字母图标（无素材的平台） */
.ic-xhs  { background: linear-gradient(145deg, #ff5b6c, #d61f33); }

/* ---------- 窗口骨架 ---------- */
.window {
  position: absolute;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100% - 80px);
  display: flex;
  flex-direction: column;
  background: var(--os-win);
  backdrop-filter: blur(24px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 30px 80px rgba(8, 4, 18, 0.5);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.96) translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.window.open { opacity: 1; transform: scale(1) translateY(0); }
.window.max { border-radius: 0; max-height: 100%; }

/* 边缘缩放热区（不可见，macOS 风格无角标） */
.rz { position: absolute; z-index: 6; }
.rz-l  { left: -3px; top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; }
.rz-r  { right: -3px; top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; }
.rz-b  { bottom: -3px; left: 10px; right: 10px; height: 7px; cursor: ns-resize; }
.rz-bl { left: -5px; bottom: -5px; width: 14px; height: 14px; cursor: nesw-resize; }
.rz-br { right: -5px; bottom: -5px; width: 14px; height: 14px; cursor: nwse-resize; }
.window.max .rz { display: none; }
.win-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--os-line);
  cursor: grab;
  user-select: none;
  background: rgba(255, 255, 255, 0.5);
  flex: none;
}
.win-bar:active { cursor: grabbing; }
.traffic { display: flex; gap: 8px; }
.traffic button {
  position: relative;
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 0;
}
.traffic button::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: rgba(0, 0, 0, 0.55);
  opacity: 0;
}
.t-close::after { content: "×"; }
.t-min::after { content: "−"; }
.t-max::after { content: "+"; }
.traffic:hover button::after { opacity: 1; }
.t-close { background: #ff5f57; }
.t-min   { background: #febc2e; }
.t-max   { background: #28c840; }
.win-title {
  flex: 1;
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--os-ink-2);
  margin-right: 55px; /* 平衡红绿灯宽度 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-body {
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (max-width: 860px) {
  .menubar .menu { display: none; }
  .dock { gap: 6px; padding: 8px 10px; bottom: 10px; }
  .dock-icon { width: 44px; height: 44px; font-size: 17px; border-radius: 12px; }
}
