/* ============================================================
   红河OS · Win11 Mica 全套样式（手写，无框架）
   浅色默认，深色用 html[data-theme="dark"] 切换
   低饱和配色，禁蓝紫渐变
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --os-font: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", "PingFang SC",
             "Hiragino Sans GB", system-ui, -apple-system, sans-serif;

  --os-accent: #4b7d6e;                 /* 低饱和青绿（品牌主色） */
  --os-accent-hover: #3f6d5f;
  --os-on-accent: #ffffff;

  --os-text: #292622;
  --os-text-2: #6d675f;

  --os-taskbar-bg: rgba(250, 249, 247, .72);
  --os-menu-bg: rgba(250, 249, 247, .88);
  --os-win-bg: #f7f6f3;
  --os-titlebar-bg: rgba(247, 246, 243, .92);
  --os-border: rgba(60, 54, 46, .14);
  --os-hover: rgba(60, 54, 46, .07);
  --os-active: rgba(60, 54, 46, .13);

  --os-shadow-menu: 0 12px 40px rgba(35, 30, 24, .22), 0 2px 10px rgba(35, 30, 24, .12);
  --os-shadow-win: 0 10px 36px rgba(35, 30, 24, .20), 0 2px 10px rgba(35, 30, 24, .10);

  --os-select-bg: rgba(96, 135, 175, .26);      /* 图标选中：半透明蓝框 */
  --os-select-border: rgba(96, 135, 175, .60);

  --os-close-red: #c42b1c;
  --os-radius: 8px;

  --os-lock-bg: linear-gradient(160deg, #e9ede8 0%, #dae3dc 45%, #ccd6cd 100%);
}

html[data-theme="dark"] {
  --os-text: #ece7e0;
  --os-text-2: #a9a29a;

  --os-taskbar-bg: rgba(37, 35, 32, .66);
  --os-menu-bg: rgba(41, 39, 36, .90);
  --os-win-bg: #2b2926;
  --os-titlebar-bg: rgba(43, 41, 38, .94);
  --os-border: rgba(236, 231, 224, .14);
  --os-hover: rgba(236, 231, 224, .08);
  --os-active: rgba(236, 231, 224, .15);

  --os-shadow-menu: 0 12px 40px rgba(0, 0, 0, .50), 0 2px 10px rgba(0, 0, 0, .35);
  --os-shadow-win: 0 10px 36px rgba(0, 0, 0, .45), 0 2px 10px rgba(0, 0, 0, .30);

  --os-select-bg: rgba(120, 160, 200, .28);
  --os-select-border: rgba(120, 160, 200, .52);

  --os-lock-bg: linear-gradient(160deg, #2c322e 0%, #252b27 50%, #1f2421 100%);
}

/* ---------- 基础复位 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--os-font);
  color: var(--os-text);
  background: #20241f;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(128, 122, 114, .38);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(128, 122, 114, .60); background-clip: content-box; border: 2px solid transparent; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(190, 184, 176, .30); background-clip: content-box; border: 2px solid transparent; }

/* ============================================================
   锁屏
   ============================================================ */
#lockscreen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease, visibility .45s;
}
#lockscreen.leave { opacity: 0; visibility: hidden; pointer-events: none; }

.lock-bg {
  position: absolute; inset: -24px;             /* 外扩消除模糊边缘 */
  background: var(--os-lock-bg) center / cover no-repeat;
  filter: blur(42px) saturate(1.02);
  transform: scale(1.04);
}
.lock-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px; text-align: center;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(20, 25, 20, .45);
}
.lock-time {
  font-size: clamp(64px, 14vw, 128px);
  font-weight: 600; line-height: 1.05;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.lock-date { margin-top: 6px; font-size: clamp(17px, 3vw, 24px); font-weight: 500; }

#lock-enter {
  margin-top: clamp(36px, 8vh, 72px);
  min-width: 168px; padding: 12px 34px;
  font-size: 16px; letter-spacing: .35em; text-indent: .35em;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  transition: background .15s ease, transform .12s ease;
}
#lock-enter:hover { background: rgba(255, 255, 255, .30); }
#lock-enter:active { transform: scale(.97); }

.lock-links { margin-top: 22px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.lock-links a { color: rgba(255, 255, 255, .92); text-decoration: none; border-bottom: 1px solid transparent; }
.lock-links a:hover { border-bottom-color: rgba(255, 255, 255, .8); }
.lock-sep { opacity: .55; }

/* ============================================================
   桌面（壁纸 + 图标）
   ============================================================ */
#desktop { position: fixed; inset: 0; }
#os-wallpaper {                                  /* 元素 id 为 os-wallpaper（二期修复选择器笔误） */
  position: absolute; inset: 0;
  background: var(--os-lock-bg) center / cover no-repeat;
  transition: background .3s ease;
}
#icons {
  position: absolute; left: 0; right: 0; top: 0; bottom: 56px;   /* 给任务栏留位 */
}

.os-icon {
  position: absolute;
  width: 100px; padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  border: 1px solid transparent; border-radius: 6px;
  cursor: default; user-select: none; -webkit-user-select: none;
  touch-action: none;                            /* Pointer Events 拖拽必需 */
  outline: none;
}
.os-icon:hover { background: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .os-icon:hover { background: rgba(255, 255, 255, .07); }
.os-icon.selected, .os-icon:focus-visible {
  background: var(--os-select-bg);
  border-color: var(--os-select-border);
}
.os-icon.dragging { opacity: .82; z-index: 5; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }

.os-icon-img {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 50px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .28));
  pointer-events: none;
}
.os-icon-label {
  max-width: 100%;
  font-size: 13px; line-height: 1.3; text-align: center;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .65), 0 0 8px rgba(0, 0, 0, .35);
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-all;
  pointer-events: none;
}

/* ============================================================
   任务栏（48px 居中毛玻璃）
   ============================================================ */
#taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 48px; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: var(--os-taskbar-bg);
  backdrop-filter: blur(30px) saturate(1.1);
  -webkit-backdrop-filter: blur(30px) saturate(1.1);
  border-top: 1px solid var(--os-border);
}

.tb-center { display: flex; align-items: center; gap: 4px; height: 100%; }

/* 开始按钮：四色 Windows 徽标（纯 CSS 2x2 方块） */
#start-btn {
  width: 40px; height: 40px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease;
}
#start-btn:hover { background: var(--os-hover); }
#start-btn.active, #start-btn:active { background: var(--os-active); }
.os-logo {
  width: 18px; height: 18px;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px;
}
.os-logo i { display: block; border-radius: 1px; }
.os-logo i:nth-child(1) { background: #f35325; }
.os-logo i:nth-child(2) { background: #81bc06; }
.os-logo i:nth-child(3) { background: #05a6f0; }
.os-logo i:nth-child(4) { background: #ffba08; }

/* 移动端「返回桌面」按钮（桌面端隐藏） */
#back-btn {
  display: none;
  height: 34px; padding: 0 12px; border-radius: 6px;
  font-size: 13px; background: var(--os-hover);
}

#task-pinned, #task-wins { display: flex; align-items: center; gap: 4px; height: 100%; }
#task-wins:not(:empty)::before {
  content: ""; width: 1px; height: 24px; margin: 0 4px;
  background: var(--os-border);
}

/* 任务栏应用按钮（固定 + 运行中），运行指示为图标下方下划线 */
.tb-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s ease;
}
.tb-btn:hover { background: var(--os-hover); }
.tb-btn.active { background: var(--os-active); }
.tb-btn-icon { font-size: 23px; line-height: 1; pointer-events: none; }
.tb-btn.min .tb-btn-icon { opacity: .55; }

.tb-run-bar {
  position: absolute; left: 50%; bottom: 2px;
  width: 6px; height: 3px; border-radius: 2px;
  transform: translateX(-50%);
  background: transparent;
  transition: width .15s ease, background .15s ease, opacity .15s ease;
}
.tb-btn.running .tb-run-bar { background: var(--os-text-2); }
.tb-btn.running.min .tb-run-bar { opacity: .45; }
.tb-btn.active .tb-run-bar { width: 16px; background: var(--os-accent); opacity: 1; }

/* 托盘（右侧） */
.tb-tray {
  position: absolute; right: 8px; top: 0; height: 100%;
  display: flex; align-items: center; gap: 2px;
}
.tray-classic {
  height: 34px; padding: 0 10px; border-radius: 6px;
  display: flex; align-items: center;
  font-size: 12px; color: var(--os-text-2); text-decoration: none;
}
.tray-classic:hover { background: var(--os-hover); color: var(--os-text); }

#tray-user {
  height: 34px; padding: 0 10px; border-radius: 6px;
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; max-width: 168px;
}
#tray-user:hover { background: var(--os-hover); }
.tray-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--os-accent); color: var(--os-on-accent);
  font-size: 12px;
}
.tray-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tray-clock {
  height: 38px; padding: 0 10px; border-radius: 6px;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  line-height: 1.25; cursor: default;
}
.tray-clock:hover { background: var(--os-hover); }
#tray-time { font-size: 12.5px; font-variant-numeric: tabular-nums; }
#tray-date { font-size: 11px; color: var(--os-text-2); }

/* ============================================================
   开始菜单（居中弹出、圆角 8px、毛玻璃）
   ============================================================ */
#startmenu {
  position: fixed; left: 50%; bottom: 58px; z-index: 9100;
  transform: translateX(-50%);
  width: min(600px, 94vw);
  max-height: min(680px, calc(100vh - 76px));
  display: flex; flex-direction: column;
  background: var(--os-menu-bg);
  backdrop-filter: blur(30px) saturate(1.1);
  -webkit-backdrop-filter: blur(30px) saturate(1.1);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  box-shadow: var(--os-shadow-menu);
  overflow: hidden;
  animation: os-menu-in .14s ease-out;
}
@keyframes os-menu-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.sm-search { padding: 18px 22px 8px; }
.sm-search input {
  width: 100%; height: 34px; padding: 0 12px;
  font: inherit; font-size: 13px; color: var(--os-text);
  background: var(--os-hover);
  border: 1px solid var(--os-border);
  border-bottom: 2px solid var(--os-accent);
  border-radius: 6px;
  outline: none;
}
.sm-search input:focus { background: var(--os-menu-bg); }

.sm-sec { padding: 6px 22px 2px; overflow-y: auto; }
.sm-sec[data-sec="all"] { flex: 1; min-height: 0; padding-bottom: 10px; }
.sm-sec-title { font-size: 12.5px; font-weight: 600; color: var(--os-text-2); padding: 8px 4px 6px; }

.sm-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
}
.sm-app {
  padding: 10px 2px 8px; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: background .1s ease;
}
.sm-app:hover { background: var(--os-hover); }
.sm-app-icon { font-size: 26px; line-height: 1; pointer-events: none; }
.sm-app-title {
  font-size: 11.5px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}

.sm-list { display: flex; flex-direction: column; }
.sm-row {
  height: 36px; padding: 0 10px; border-radius: 6px;
  display: flex; align-items: center; gap: 12px;
  text-align: left; font-size: 13px;
  transition: background .1s ease;
}
.sm-row:hover { background: var(--os-hover); }
.sm-row .sm-app-icon { font-size: 19px; }

.sm-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 22px;
  border-top: 1px solid var(--os-border);
  background: var(--os-hover);
}
.sm-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sm-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--os-accent); color: var(--os-on-accent);
  font-size: 14px;
}
.sm-avatar.guest { background: var(--os-text-2); }
.sm-user-name {
  font-size: 13px; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sm-user-btn {
  height: 28px; padding: 0 12px; border-radius: 5px;
  font-size: 12.5px;
  background: var(--os-active);
}
.sm-user-btn:hover { background: var(--os-accent); color: var(--os-on-accent); }
.sm-classic { font-size: 12.5px; color: var(--os-text-2); text-decoration: none; flex: none; }
.sm-classic:hover { color: var(--os-accent); text-decoration: underline; }

/* ============================================================
   WinBox → Win11 窗口覆写
   ============================================================ */
.winbox.os-win {
  background: var(--os-win-bg);
  border-radius: var(--os-radius);
  border: 1px solid var(--os-border);
  box-shadow: var(--os-shadow-win);
  overflow: hidden;
  animation: os-win-in .12s ease-out;          /* 开窗 120ms 缩放淡入（二期契约） */
}
@keyframes os-win-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
/* 关窗 120ms 缩放淡出（os.js 加 .os-win-out 后延迟真正关闭） */
.winbox.os-win.os-win-out {
  opacity: 0; transform: scale(.96);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.winbox.os-win.max { top: 0 !important; height: calc(100vh - 48px) !important; border-radius: 0; }

.winbox.os-win .wb-header {
  height: 40px; line-height: 40px;
  background: var(--os-titlebar-bg);
  color: var(--os-text);
}
.winbox.os-win .wb-body { top: 40px; background: var(--os-win-bg); }
.winbox.os-win:not(.focus) .wb-header { color: var(--os-text-2); }

.winbox.os-win .wb-drag { padding-left: 12px; }
.winbox.os-win .wb-title { font-family: var(--os-font); font-size: 12.5px; }
.winbox.os-win .wb-icon { width: 18px; margin: 0 8px 0 0; }

/* 控制按钮：Win11 宽按钮 + CSS 绘制图标 */
.winbox.os-win .wb-control * {
  width: 46px; height: 40px;
  background-image: none !important;             /* 去掉 vendor 白色 SVG */
  position: relative;
  color: var(--os-text);
  transition: background .1s ease, color .1s ease;
}
.winbox.os-win .wb-control *:hover { background: var(--os-hover); }
.winbox.os-win .wb-control .wb-close:hover { background: var(--os-close-red); color: #fff; }
.winbox.os-win .wb-full { display: none; }       /* Win11 仅 最小化 / 最大化 / 关闭 */

.winbox.os-win .wb-min::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 11px; height: 1px; background: currentColor;
  transform: translate(-50%, -50%);
}
.winbox.os-win .wb-max::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; border: 1px solid currentColor; border-radius: 1px;
  transform: translate(-50%, -50%);
}
.winbox.os-win.max .wb-max::before {             /* 已最大化 → 还原图标（双层框） */
  width: 8px; height: 8px;
  box-shadow: 2px -2px 0 -1px var(--os-win-bg), 2px -2px 0 0 currentColor;
}
.winbox.os-win .wb-close::before,
.winbox.os-win .wb-close::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 13px; height: 1px; background: currentColor;
}
.winbox.os-win .wb-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.winbox.os-win .wb-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* 最小化到任务栏的残留条：压低存在感 */
.winbox.os-win.min { opacity: .35; box-shadow: none; }

/* 设置等 pseudo-app 的 DOM 容器 */
.os-settings-root {
  height: 100%; overflow-y: auto;
  padding: 18px 20px;
  font-size: 13.5px; color: var(--os-text);
  background: var(--os-win-bg);
}
.os-settings-error { padding: 24px; text-align: center; color: var(--os-text-2); }

/* iframe 加载占位：应用图标 + 转圈（iframe load 后由 os.js 移除） */
.os-win-loading {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--os-win-bg);
  color: var(--os-text-2);
}
.os-win-loading-icon { font-size: 44px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .2)); }
.os-win-loading-spin {
  width: 26px; height: 26px;
  border: 2.5px solid var(--os-border); border-top-color: var(--os-accent);
  border-radius: 50%;
  animation: os-spin .8s linear infinite;
}
.os-win-loading-text { font-size: 12.5px; }

/* 原生应用（OSNative）窗口内容容器 */
.os-native-root {
  height: 100%; overflow-y: auto;
  font-size: 13.5px; color: var(--os-text);
  background: var(--os-win-bg);
}

/* ============================================================
   OSKit 组件样式（.osk-*，二期契约全套，Win11 风；浅色/深色
   均通过 --os-* 主题变量自动适配）
   ============================================================ */

/* 状态区块：加载中 / 空结果 / 出错（居中） */
.osk-loading, .osk-empty, .osk-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 180px; padding: 32px 16px;
  text-align: center; font-size: 13px; color: var(--os-text-2);
}
.osk-loading::before {
  content: ""; width: 26px; height: 26px;
  border: 2.5px solid var(--os-border); border-top-color: var(--os-accent);
  border-radius: 50%;
  animation: os-spin .8s linear infinite;
}
.osk-error { color: #b3392b; }
html[data-theme="dark"] .osk-error { color: #e08a7d; }

/* 自适应卡片网格（最小列宽 160px） */
.osk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; padding: 14px 16px 18px;
}

/* 资源卡片：圆角 10px、悬停浮起 */
.osk-card {
  display: flex; flex-direction: column;
  background: var(--os-menu-bg);
  border: 1px solid var(--os-border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease;
}
.osk-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--os-shadow-win);
}
.osk-card-media {
  position: relative;
  aspect-ratio: 16 / 10;                       /* 16:10 预览区 */
  background: var(--os-hover);
  overflow: hidden;
}
.osk-card-media img, .osk-card-media video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.osk-card-media audio { width: 100%; margin-top: 12px; }
.osk-card-media .osk-media-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: var(--os-text-2);
}
.osk-card-body { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px 12px; }
.osk-card-title {
  font-size: 13px; font-weight: 600; color: var(--os-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.osk-card-meta {
  font-size: 11.5px; color: var(--os-text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.osk-card-badge {
  align-self: flex-start;
  padding: 1px 7px; border-radius: 999px;
  font-size: 11px; line-height: 1.6;
  color: var(--os-accent);
  background: rgba(75, 125, 110, .14);
  border: 1px solid rgba(75, 125, 110, .35);
}
.osk-card-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

/* 按钮（默认 / primary / danger） */
.osk-btn {
  height: 28px; padding: 0 12px; border-radius: 6px;
  font-size: 12.5px; color: var(--os-text);
  background: var(--os-active);
  border: 1px solid transparent;
  transition: background .12s ease, color .12s ease;
}
.osk-btn:hover { background: var(--os-hover); }
.osk-btn.primary { background: var(--os-accent); color: var(--os-on-accent); }
.osk-btn.primary:hover { background: var(--os-accent-hover); }
.osk-btn.danger { background: rgba(196, 43, 28, .12); color: #b3392b; }
.osk-btn.danger:hover { background: var(--os-close-red); color: #fff; }
html[data-theme="dark"] .osk-btn.danger { color: #e08a7d; }
html[data-theme="dark"] .osk-btn.danger:hover { color: #fff; }

/* 搜索框（圆角） */
.osk-search { position: relative; flex: 1; max-width: 340px; }
.osk-search input {
  width: 100%; height: 32px; padding: 0 12px;
  font: inherit; font-size: 13px; color: var(--os-text);
  background: var(--os-hover);
  border: 1px solid var(--os-border);
  border-radius: 999px;
  outline: none;
  transition: border-color .12s ease, background .12s ease;
}
.osk-search input:focus { border-color: var(--os-accent); background: var(--os-win-bg); }

/* 分页条 */
.osk-pager {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 12px 16px 18px;
  font-size: 12.5px; color: var(--os-text-2);
}
.osk-pager .osk-btn { min-width: 64px; }
.osk-pager .osk-btn[disabled] { opacity: .45; cursor: default; }

/* 窗口内顶部工具条 */
.osk-toolbar {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--os-titlebar-bg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-bottom: 1px solid var(--os-border);
}
.osk-toolbar .osk-toolbar-title { font-size: 13px; font-weight: 600; color: var(--os-text); }

/* 点击卡片放大预览浮层（视频可播） */
.osk-preview-overlay {
  position: fixed; inset: 0; z-index: 9500;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: rgba(25, 25, 22, .55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: os-notify-in .15s ease-out;
}
.osk-preview-overlay .osk-preview-body {
  max-width: min(880px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  background: var(--os-menu-bg);
  border: 1px solid var(--os-border);
  border-radius: 10px;
  box-shadow: var(--os-shadow-menu);
}
.osk-preview-overlay img, .osk-preview-overlay video {
  max-width: 100%; max-height: 70vh; border-radius: 6px; object-fit: contain;
}
.osk-preview-overlay audio { width: min(480px, 80vw); }
.osk-preview-overlay .osk-preview-title { font-size: 13.5px; font-weight: 600; color: var(--os-text); }

/* ============================================================
   通知气泡（右下角）
   ============================================================ */
#notify-layer {
  position: fixed; right: 14px; bottom: 60px; z-index: 12000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.os-notify {
  pointer-events: auto; cursor: default;
  max-width: min(340px, 80vw);
  padding: 11px 16px;
  font-size: 13px; line-height: 1.5;
  color: var(--os-text);
  background: var(--os-menu-bg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--os-border);
  border-left: 3px solid var(--os-accent);
  border-radius: var(--os-radius);
  box-shadow: var(--os-shadow-menu);
  animation: os-notify-in .22s ease-out;
}
.os-notify.out { opacity: 0; transform: translateX(12px); transition: opacity .3s ease, transform .3s ease; }
@keyframes os-notify-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   extras.js 组件样式
   右键菜单：.os-context-menu / .os-context-item
   设置窗：.os-settings / .os-settings-section / .os-settings-title /
          .os-wallpaper-grid / .os-wallpaper-card(.is-active) /
          .os-wallpaper-swatch / .os-wallpaper-name /
          .os-theme-row / .os-theme-btn(.is-active) /
          .os-settings-desc / .os-settings-link / .os-settings-icp
   ============================================================ */
.os-context-menu {
  position: fixed; z-index: 9600; min-width: 208px;
  padding: 5px;
  display: flex; flex-direction: column;
  background: var(--os-menu-bg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  box-shadow: var(--os-shadow-menu);
}
.os-context-item {
  width: 100%; padding: 8px 12px; border-radius: 5px;
  text-align: left; font-size: 13px; color: var(--os-text);
}
.os-context-item:hover { background: var(--os-hover); }

.os-settings { line-height: 1.6; }
.os-settings-section { margin-bottom: 22px; }
.os-settings-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.os-settings-desc { font-size: 12.5px; color: var(--os-text-2); margin-bottom: 6px; }
.os-settings-icp { margin-top: 10px; opacity: .75; }
.os-settings-link {
  display: inline-block; margin-top: 4px;
  font-size: 13px; color: var(--os-accent); text-decoration: none;
}
.os-settings-link:hover { text-decoration: underline; }

.os-wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
}
.os-wallpaper-card {
  padding: 5px; border-radius: 8px;
  display: flex; flex-direction: column; gap: 6px;
  border: 2px solid transparent;
  transition: border-color .12s ease, background .12s ease;
}
.os-wallpaper-card:hover { background: var(--os-hover); }
.os-wallpaper-card.is-active { border-color: var(--os-accent); }
.os-wallpaper-swatch {
  display: block; height: 64px; border-radius: 5px;
  background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 1px var(--os-border);
}
.os-wallpaper-name { font-size: 12px; color: var(--os-text-2); text-align: center; }

.os-theme-row { display: flex; gap: 10px; }
.os-theme-btn {
  height: 32px; padding: 0 16px; border-radius: 6px;
  font-size: 13px;
  background: var(--os-active); color: var(--os-text);
  border: 1px solid transparent;
}
.os-theme-btn:hover { background: var(--os-hover); }
.os-theme-btn.is-active {
  background: var(--os-accent); color: var(--os-on-accent);
  border-color: var(--os-accent);
}

/* ============================================================
   header.js 登录弹窗（.hh-modal）Win11 化
   （契约禁止引主站 styles.css，这里手写兜底样式）
   ============================================================ */
.hh-modal-overlay {
  position: fixed; inset: 0; z-index: 13000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(25, 25, 22, .38);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-family: var(--os-font);
}
.hh-modal {
  position: relative;
  width: min(380px, 92vw); max-height: 86vh; overflow-y: auto;
  padding: 26px 26px 24px;
  background: var(--os-menu-bg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  box-shadow: var(--os-shadow-menu);
  color: var(--os-text);
}
.hh-modal-close {
  position: absolute; top: 10px; right: 12px;
  width: 30px; height: 30px; border-radius: 5px;
  font-size: 17px; line-height: 1; color: var(--os-text-2);
}
.hh-modal-close:hover { background: var(--os-hover); color: var(--os-text); }
.hh-modal-title { font-size: 17px; font-weight: 600; }
.hh-modal-sub { margin-top: 5px; font-size: 12.5px; color: var(--os-text-2); }

.hh-login-tabs { display: flex; gap: 6px; margin: 16px 0 14px; }
.hh-login-tab {
  flex: 1; height: 32px; border-radius: 6px;
  font-size: 13px; color: var(--os-text-2);
  background: var(--os-hover);
}
.hh-login-tab.active { background: var(--os-accent); color: var(--os-on-accent); }

.hh-field { display: block; margin-bottom: 12px; font-size: 12.5px; color: var(--os-text-2); }
.hh-field span { display: block; margin-bottom: 5px; }
.hh-field input, .hh-field textarea {
  width: 100%; padding: 8px 10px;
  font: inherit; font-size: 13.5px; color: var(--os-text);
  background: var(--os-hover);
  border: 1px solid var(--os-border); border-radius: 6px;
  outline: none; resize: vertical;
}
.hh-field input:focus, .hh-field textarea:focus { border-color: var(--os-accent); }

.hh-btn-primary {
  width: 100%; height: 36px; border-radius: 6px;
  font-size: 14px;
  background: var(--os-accent); color: var(--os-on-accent);
}
.hh-btn-primary:hover { background: var(--os-accent-hover); }
.hh-btn-primary:disabled { opacity: .55; cursor: default; }

.hh-form-error {
  margin-bottom: 10px; padding: 8px 10px;
  font-size: 12.5px; color: #b3392b;
  background: rgba(196, 43, 28, .10);
  border-radius: 6px;
}
.hh-qr-box { display: flex; justify-content: center; padding: 8px 0; min-height: 60px; }
.hh-qr-frame { padding: 10px; background: #fff; border-radius: 8px; }
.hh-qr-status { text-align: center; font-size: 12.5px; color: var(--os-text-2); }
.hh-spinner {
  width: 26px; height: 26px; margin: 16px auto;
  border: 2.5px solid var(--os-border); border-top-color: var(--os-accent);
  border-radius: 50%;
  animation: os-spin .8s linear infinite;
}
@keyframes os-spin { to { transform: rotate(360deg); } }

/* ============================================================
   移动端简化模式（<768px：应用最大化单窗口，任务栏只剩开始+返回）
   ============================================================ */
@media (max-width: 767px) {
  #task-pinned, #task-wins, .tb-tray { display: none; }
  #back-btn { display: flex; align-items: center; }
  .tb-center { gap: 8px; }

  #startmenu {
    left: 8px; right: 8px; bottom: 56px;
    width: auto; transform: none;
    max-height: calc(100vh - 72px);
  }
  @keyframes os-menu-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .sm-grid { grid-template-columns: repeat(4, 1fr); }

  .os-icon { width: 76px; }
  .os-icon-img { width: 48px; height: 48px; font-size: 38px; }

  .lock-time { font-size: clamp(56px, 18vw, 96px); }

  .winbox.os-win.max { height: calc(100vh - 48px) !important; }
}

/* ============================================================
   三期内核升级新增样式
   .os-ctxmenu      图标/窗口自绘右键菜单（os.js openIconMenu）
   .os-marquee      桌面框选矩形
   .os-snap-preview Aero Snap 吸附预览框
   均通过 --os-* 变量 + 显式 dark 覆写适配浅色/深色
   ============================================================ */

/* ---------- 图标右键菜单（Win11 自绘菜单） ---------- */
.os-ctxmenu {
  position: fixed; z-index: 9700; min-width: 200px;
  padding: 5px;
  display: flex; flex-direction: column;
  background: var(--os-menu-bg);
  backdrop-filter: blur(30px) saturate(1.1);
  -webkit-backdrop-filter: blur(30px) saturate(1.1);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  box-shadow: var(--os-shadow-menu);
  animation: os-ctx-in .12s ease-out;
}
@keyframes os-ctx-in {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.os-ctxmenu-item {
  width: 100%; padding: 8px 12px; border-radius: 5px;
  text-align: left; font-size: 13px; color: var(--os-text);
  transition: background .1s ease, color .1s ease;
}
.os-ctxmenu-item:hover { background: var(--os-hover); }
.os-ctxmenu-item.danger { color: #b3392b; }
.os-ctxmenu-item.danger:hover { background: var(--os-close-red); color: #fff; }
.os-ctxmenu-sep {
  height: 1px; margin: 4px 8px; flex: none;
  background: var(--os-border);
}
/* 深色适配：危险项文字提亮（其余颜色经 --os-* 变量自动切换） */
html[data-theme="dark"] .os-ctxmenu-item.danger { color: #e08a7d; }
html[data-theme="dark"] .os-ctxmenu-item.danger:hover { color: #fff; }

/* ---------- 桌面框选矩形（半透明选框，命中图标加 .selected） ---------- */
.os-marquee {
  position: absolute; z-index: 4;
  pointer-events: none;
  background: var(--os-select-bg);
  border: 1px solid var(--os-select-border);
  border-radius: 2px;
}
/* 深色适配：--os-select-bg / --os-select-border 已有深色取值，这里略降透明度防刺眼 */
html[data-theme="dark"] .os-marquee {
  background: rgba(120, 160, 200, .22);
  border-color: rgba(120, 160, 200, .48);
}

/* ---------- Aero Snap 吸附预览框（拖到屏幕边缘时显示目标区域） ---------- */
.os-snap-preview {
  position: fixed; z-index: 8900;
  pointer-events: none;
  background: rgba(75, 125, 110, .16);                 /* 主色淡填充 */
  border: 2px solid rgba(75, 125, 110, .55);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
  transition: left .12s ease, top .12s ease, width .12s ease, height .12s ease;
}
/* 深色适配：提亮边框与填充 */
html[data-theme="dark"] .os-snap-preview {
  background: rgba(126, 184, 164, .15);
  border-color: rgba(126, 184, 164, .50);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .30);
}


/* ============================================================
   四期：Minecraft 外壳结构（Agent B）
   仅结构性调整：布局 / 尺寸 / 显示切换 / 动画；
   配色一律走变量（--mc-* 由 mc.css 在 html[data-skin="mc"] 下定义，
   此处给经典皮肤兜底值），视觉深化（像素描边/木板底等）由 mc.css 完成。
   ============================================================ */

/* ---------- 游戏贴图与 emoji 兜底的双态切换 ---------- */
.mc-tex { display: none; image-rendering: pixelated; -webkit-user-drag: none; pointer-events: none; }
html[data-skin="mc"] .mc-tex { display: block; }
html[data-skin="mc"] .mc-fallback { display: none !important; }

/* ---------- 桌面图标物品框（.mc-itemframe 结构；视觉框体由 mc.css 深化） ---------- */
/* 加大默认排版：MC 皮肤框体 64→76（mc.css 注释允许使用方覆写；此处用更高优先级压过
   html[data-skin="mc"] .mc-itemframe 的 64px 默认值，贴图随之放大至 58px） */
html[data-skin="mc"] .os-icon .os-icon-img.mc-itemframe { width: 76px; height: 76px; }
.os-icon-img .mc-tex { width: 58px; height: 58px; }
.os-icon-img .mc-fallback { font-size: inherit; }

/* ---------- 拖拽幽灵框（.mc-ghost；.swap = 目标格被占，松手交换） ---------- */
.mc-ghost {
  position: absolute; z-index: 4;
  width: 100px; height: 114px; box-sizing: border-box;
  border: 2px dashed var(--mc-ghost-border, rgba(255, 255, 255, .85));
  background: var(--mc-ghost-bg, rgba(255, 255, 255, .10));
  pointer-events: none;
}
.mc-ghost.swap { outline: 2px dashed var(--mc-ghost-border, rgba(255, 255, 255, .85)); outline-offset: -7px; }

/* ---------- 快捷栏任务栏（9 槽位结构；贴图略放大，不超 40px 槽位） ---------- */
.tb-btn .mc-tex { width: 28px; height: 28px; }
.tb-btn .mc-fallback { font-size: inherit; }
#start-btn .mc-start-tex { width: 26px; height: 26px; }
/* 修正：mc.css 的 .mc-slot-btn img{max-width:72%} 以 shrink-to-fit 的 .tb-btn-icon 为
   包含块，会把槽位贴图压窄（生产实测 26px 规格仅渲染 19×26）。此处用更高优先级解除
   钳制，保证贴图按设定尺寸正方形渲染（28px 仍小于槽位 40px 的 72% 观感上限） */
html[data-skin="mc"] .tb-btn .mc-tex,
html[data-skin="mc"] #start-btn .mc-start-tex { max-width: none; max-height: none; }
html[data-skin="mc"] #start-btn .os-logo { display: none; }
.tb-btn.tb-empty { pointer-events: none; }
.tb-empty::before {
  content: ""; display: block;
  width: 28px; height: 28px; border-radius: 4px;
  border: 1px dashed var(--os-border);
  opacity: .5;
}
/* XP 条基座结构（经验绿配色由 mc.css 覆写 .mc-xpbar） */
.mc-xpbar { pointer-events: none; }

/* ---------- mc-tooltip（MC 物品提示框结构；配色走 --mc-tip-* 变量） ---------- */
.mc-tooltip {
  position: fixed; z-index: 9600;
  max-width: 240px; padding: 6px 10px 7px;
  font-size: 12px; line-height: 1.45;
  color: var(--mc-tip-text, #fff);
  background: var(--mc-tip-bg, rgba(24, 16, 32, .94));
  border: 2px solid var(--mc-tip-border, #0d0a06);
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.mc-tooltip .mc-tip-name { font-weight: 600; }
.mc-tooltip .mc-tip-desc { opacity: .72; font-size: 11px; margin-top: 2px; }

/* ---------- 背包开始菜单（.mc-inventory 结构） ---------- */
.mc-inventory { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.inv-search { padding: 16px 18px 8px; }
.inv-search input {
  width: 100%; height: 34px; padding: 0 12px; box-sizing: border-box;
  border-radius: 6px; border: 1px solid var(--os-border);
  background: var(--os-hover); color: var(--os-text);
  font-size: 13px; outline: none;
}
.inv-search input:focus { background: var(--os-menu-bg); border-color: var(--os-accent); }
.inv-grid {
  flex: 1; min-height: 120px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px; padding: 8px 18px; align-content: start;
}
.inv-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px 6px; border-radius: 6px;
}
.inv-item:hover { background: var(--os-hover); }
.inv-item .os-icon-img {
  width: 44px; height: 44px; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  filter: none; pointer-events: none;
}
.inv-item .mc-tex { width: 34px; height: 34px; }
.inv-name {
  max-width: 100%; font-size: 12px; line-height: 1.3; text-align: center;
  color: var(--os-text);
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-all; pointer-events: none;
}
.inv-pin { position: absolute; top: 2px; right: 4px; font-size: 10px; font-style: normal; pointer-events: none; }
.inv-empty { grid-column: 1 / -1; padding: 14px; text-align: center; font-size: 12.5px; color: var(--os-text-2); }
.inv-sub { padding: 6px 22px 2px; font-size: 12.5px; font-weight: 600; color: var(--os-text-2); }
.inv-hotbar { display: flex; gap: 4px; justify-content: center; padding: 4px 12px 10px; }
.inv-hotbar .tb-btn { width: 36px; height: 36px; flex: none; }
.inv-hotbar .tb-btn .mc-tex { width: 24px; height: 24px; }
.inv-bar-slot.running::after {
  content: ""; position: absolute; left: 50%; bottom: 2px;
  width: 12px; height: 3px; border-radius: 2px;
  transform: translateX(-50%);
  background: var(--os-accent);
}

/* ---------- MC 头像（Steve 默认头：本地皮肤贴图 CSS 裁切头部正面，无外部图片依赖） ---------- */
.mc-head { overflow: hidden; }
.mc-head.steve {
  background-image: url('/dist/26.1-pre-2/assets/minecraft/textures/entity/player/wide/steve.png');
  background-size: 800% 800%;
  background-position: 14.2857% 14.2857%;
  image-rendering: pixelated;
  border-radius: 0;
}

/* ---------- 首次引导：图标掉落动画 + 中央提示卡 ---------- */
.mc-drop { animation: osIconDrop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes osIconDrop {
  from { transform: translateY(-46px); opacity: 0; }
  70%  { transform: translateY(5px);  opacity: 1; }
  to   { transform: none;             opacity: 1; }
}
.os-tour-card {
  position: fixed; left: 50%; top: 36%; transform: translate(-50%, -50%);
  z-index: 9500; padding: 16px 24px; text-align: center;
  background: var(--os-menu-bg); border: 1px solid var(--os-border); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  transition: opacity .3s ease;
  pointer-events: none;
}
.os-tour-card.out { opacity: 0; }
.os-tour-title { font-size: 16px; font-weight: 700; color: var(--os-text); }
.os-tour-sub { font-size: 12.5px; color: var(--os-text-2); margin-top: 6px; }

/* ---------- 移动端：快捷栏缩小居中，空槽隐藏；桌面物品框等比缩小 ---------- */
@media (max-width: 767px) {
  .tb-btn { width: 32px; height: 38px; }
  .tb-btn .mc-tex { width: 23px; height: 23px; }
  .tb-empty { display: none; }
  /* MC 物品框窄屏适配：76→60，贴图 58→42（须排在本文件桌面覆写之后才能生效） */
  html[data-skin="mc"] .os-icon .os-icon-img.mc-itemframe { width: 60px; height: 60px; }
  .os-icon-img .mc-tex { width: 42px; height: 42px; }
}
