/* 主页样式 */
:root {
  --glass: rgba(20, 22, 26, 0.42);
  --glass-line: rgba(255, 255, 255, 0.12);
  --fg: #f2f4f8;
}

body.home {
  margin: 0;
  min-height: 100vh;
  color: var(--fg);
  background: #101216;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: -40px;
  background: center/cover no-repeat #101216;
  transform: scale(1.04);
  z-index: -1;
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, calc(var(--mask, 0.55) * 0.64)), rgba(0, 0, 0, var(--mask, 0.55)));
}

.wrap {
  /* 不设上限：一行图标数量（--cols）增加时，网格按需变宽，由视口兜底 */
  max-width: none;
  margin: 0 auto;
  padding: 28px 24px 120px;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 84px;
}

.clock-time {
  font-size: 56px;
  font-weight: 200;
  letter-spacing: 2px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}
.clock-date {
  font-size: 14px;
  opacity: 0.75;
  letter-spacing: 1px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}
/* 右上角只留一个退出图标 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.who {
  font-size: 13px;
  opacity: 0.7;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ghost-btn {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  color: var(--fg);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px auto 36px;
  max-width: 720px;
  padding: 9px 10px 9px 15px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  z-index: 20;
}
.engines-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.engine-pick {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.8;
  flex: none;
}
.engine-pick:hover { opacity: 1; background: rgba(255, 255, 255, 0.16); }
.engine-pick img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}
.engines-menu {
  position: absolute;
  /* 跟搜索条缩小的尺寸走：41px 正好落在胶囊下沿外面，不会压住输入框 */
  top: 41px;
  left: 0;
  min-width: 148px;
  z-index: 10;
  background: rgba(30, 32, 38, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding: 3px 0;
  backdrop-filter: blur(10px);
}
.engines-menu .engine {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: auto;
  padding: 7px 10px;
  border-radius: 0;
  opacity: 0.75;
  font-size: 12px;
  color: var(--fg, #f2f4f8);
  white-space: nowrap;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
}
.engines-menu .engine:hover { background: rgba(255, 255, 255, 0.08); opacity: 1; }
.engines-menu .engine.on {
  opacity: 1;
  background: rgba(79, 140, 255, 0.22);
}
.engines-menu .engine img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: none;
  font-size: 10px;
  color: #fff;
}
.engines-menu .engine span {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 亮色主题：搜索引擎下拉跟着换浅色，否则白底页面上是块黑 */
[data-color-scheme="light"] .engines-menu {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
[data-color-scheme="light"] .engines-menu .engine {
  color: #1f2328;
}
[data-color-scheme="light"] .engines-menu .engine:hover {
  background: rgba(0, 0, 0, 0.06);
}
[data-color-scheme="light"] .engines-menu .engine.on {
  background: rgba(79, 140, 255, 0.16);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 16px;
}
.search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.go {
  border: 0;
  border-radius: 999px;
  padding: 7px 16px;
  background: var(--accent, #4f8cff);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

.suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(18, 20, 24, 0.94);
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  padding: 6px;
  backdrop-filter: blur(14px);
  z-index: 5;
}
.suggest a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
}
.suggest a:hover {
  background: rgba(255, 255, 255, 0.1);
}
.suggest img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.pages {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.page {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.62);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}
.page.on {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

/* 用 ID 选择器：app.css 里的通用 .grid（登录/安装页的两列表单）会覆盖类选择器，
   曾导致首页图标被挤成 2 列竖排。 */
#grid {
  display: grid;
  /* 列宽永远不小于图标尺寸，否则图标会溢出格子与邻居压叠；
     max-width 再用 --cols 封顶，保留「每行个数」设置的作用。 */
  grid-template-columns: repeat(auto-fill, minmax(var(--icon, 64px), 1fr));
  column-gap: calc(var(--gap, 46px) / 2);
  row-gap: calc(var(--gap, 46px) / 2);
  max-width: calc(var(--cols, 14) * (var(--icon, 64px) + var(--gap, 46px) / 2));
  margin-inline: auto;
  justify-items: center;
}
.icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
  color: var(--fg);
}
/* 布局：--spanr 行数 / --spanc 列数，由 home.js 按 item.size（如 2x4 = 2 行 4 列）写入 */
#grid .icon {
  grid-column: span var(--spanc, 1);
  grid-row: span var(--spanr, 1);
}
.icon-img {
  /* 1x1 固定 iconWidth×iconWidth；跨格时按 iconWidth 基准等比放大 */
  width: 100%;
  max-width: calc(var(--spanc, 1) * var(--icon, 64px) + (var(--spanc, 1) - 1) * (var(--gap, 46px) / 2));
  height: calc(var(--spanr, 1) * var(--icon, 64px) + (var(--spanr, 1) - 1) * (var(--gap, 46px) / 2));
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius, 10px);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.icon-img img {
  /* 完整显示整张图且不变形：contain 保证等比缩放、不裁切，
     非正方形图会在图标块内留白（底色由 .icon-img 提供）。 */
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* 非正方形的格子（如 1x2、2x4）：图片按高度占满，左右留白 */
#grid .icon:not([data-size="1x1"]) .icon-img img {
  width: auto;
  max-width: 100%;
  height: 100%;
}
.icon:hover .icon-img {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}
/* 拖动过程中不要任何悬停位移，否则被拖/刚落下的图标看起来“变大” */
#grid.dragging .icon:hover .icon-img {
  transform: none;
}
/* 拖动排序：被拖项半透明，其余图标自动让位（由 JS 的 FLIP 动画平移） */
#grid .icon.dragging {
  opacity: 0.35;
}

/* 文件夹卡片：矩形 group，初始 2x2，图标拖入后自动变大 */
#grid .group-card {
  grid-column: span var(--spanc, 2);
  grid-row: span var(--spanr, 2);
  /* #grid 是 justify-items:center，卡片必须自己撑满跨的格子，否则空卡片会缩成一条 */
  justify-self: stretch;
  width: 100%;
  /* 高度由 JS 写入：名称 + 边框 + 上下留白 + spanr 行图标（见 sizeCards）；网格行高随字号变化，纯 CSS 算不准 */
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  cursor: pointer; /* 点卡片 = 放大打开浮层 */
}
#grid .group-box {
  /* 盒子撑满卡片高度：卡片高度已由 JS 设成它跨的行总高（2 行时 = 两行外部图标高度），
     flex:1 后圆角底边正好落在这几行底部，不再在卡片底部留一截空白 */
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  /* 四边留白由 .group-inner 的 padding 负责，这里不加内边距 */
  padding: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  transition: background 0.18s, border-color 0.18s;
}
#grid .group-card.drop-in .group-box {
  background: rgba(79, 140, 255, 0.24);
  border-color: rgba(79, 140, 255, 0.65);
}
#grid .group-card.dragging {
  opacity: 0.35;
}
.group-name {
  flex: none;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.group-inner {
  flex: 1;
  min-height: 0;
  display: grid;
  /* 四边留白一致（16 + 1px 边框 = 17），行列间距保持 12：列宽行宽都用 1fr 自适应，
     图标放不下时才缩（2 列的小文件夹和 4/6 列的大文件夹是同一个呼吸节奏） */
  gap: 12px;
  padding: 16px;
  grid-template-columns: repeat(var(--spanc, 2), minmax(0, 1fr));
  grid-template-rows: repeat(var(--spanr, 2), minmax(0, 1fr));
  overflow: hidden;
}
.group-inner .gicon {
  display: grid;
  place-items: center;
  /* 列宽够就用 --icon 满尺寸，不够就缩到列宽（保持正方形） */
  width: min(var(--icon, 64px), 100%);
  height: auto;
  aspect-ratio: 1;
  align-self: center;
  justify-self: center;
  border-radius: var(--radius, 10px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.group-inner .gicon:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.group-inner .gicon.dragging {
  opacity: 0.35;
}
/* 卡片图标万一被插到网格里（拖出过程中）也保持 64px，不要被网格拉伸 */
#grid > .gicon {
  width: var(--icon, 64px);
  height: var(--icon, 64px);
  flex: none;
}
.group-inner .gicon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.group-inner .gicon .letter {
  font-size: 13px;
}
.letter {
  font-size: 22px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}
.icon-name {
  font-size: 13px;
  opacity: 0.85;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty {
  text-align: center;
  opacity: 0.5;
  padding: 40px 0;
}

/* 底部导航：macOS Dock 风格 —— 悬浮玻璃胶囊 + 指针靠近时放大（放大逻辑在 home.js 的 magnify()） */
/* 未登录页脚：版权左对齐 / 备案右对齐 */
.site-foot {
  position: fixed; left: 84px; right: 16px; bottom: 16px; z-index: 7;
  display: flex; justify-content: space-between; align-items: center; gap: 0 14px;
  font-size: 12px; line-height: 1.5; color: rgba(255, 255, 255, 0.62);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.site-foot .lab { margin-right: 6px; opacity: 0.7; }
.site-foot a { color: inherit; text-decoration: none; }
.site-foot a:hover { color: #fff; text-decoration: underline; }
.site-foot .foot-left { text-align: left; }
.site-foot .foot-right { text-align: right; }
@media (max-width: 640px) {
  .site-foot { right: 12px; bottom: 104px; }
  .site-foot.no-beian-mobile .beian { display: none; }
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  max-width: calc(100vw - 24px);
  padding: 7px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  z-index: 8;
}
.tabbar::-webkit-scrollbar {
  display: none;
}
/* 用 #tabbar 前缀：app.css 里有给登录页切换标签用的 .tab（height:38px 等），
   会覆盖这里的 dock 图标按钮。 */
#tabbar .tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 72px;
  height: auto;
  flex: 0 0 auto;
  padding: 4px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  color: var(--fg);
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.85;
  transition: background 0.18s;
}
#tabbar .tab:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}
#tabbar .tab img {
  width: 60px;
  height: 60px;
  object-fit: fill;
  border-radius: 12px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.38));
}
/* dock 图标块：bgColor 由 JS 写在行内。有图片时这块保持透明（图片自己就是图标，
   和改动前一模一样）；只有首字母项才需要这层浅色底 */
#tabbar .tab .tab-ico {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-style: normal;
}
#tabbar .tab .tab-ico:not(.has-img) {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.38));
}
/* dock 只显示图标，不显示名称 */
#tabbar .tab span {
  display: none;
}
/* 无图标的项回退为首字母块（与桌面图标 .letter 一致） */
#tabbar .tab .tab-letter {
  font-size: 22px;
  font-weight: 500;
  font-style: normal;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

/* 分隔线 + 垃圾桶（把 dock 图标拖上来即移除） */
#tabbar .tab-sep {
  flex: none;
  align-self: center;
  width: 1px;
  height: 44px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.2);
}
#tabbar .tab-trash {
  flex: none;
  align-self: center;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
#tabbar .tab-trash:hover,
#tabbar .tab-trash.over {
  background: rgba(255, 90, 90, 0.28);
  border-color: #ff8a8a;
  color: #ffd7d7;
}
#tabbar .tab.dragging {
  opacity: 0.35;
}
#tabbar.drop-in {
  background: rgba(79, 140, 255, 0.24);
  border-color: rgba(79, 140, 255, 0.65);
}
#tabbar .tab-trash svg {
  display: block;
  width: 52px;
  height: 52px;
}

/* 新建分类弹窗（挂在 ＋ 按钮右侧） */
.pop {
  position: fixed;
  z-index: 30;
  width: 236px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(24, 26, 32, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}
.pop-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}
.pop-icons {
  display: grid;
  grid-template-columns: repeat(5, 36px);
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
/* 「更多图标」弹窗：10 列 × 5 行 */
#groupMorePop {
  width: auto;
  min-width: 0;
}
#groupIconsMore {
  grid-template-columns: repeat(10, 36px);
}
.pop-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
}
.pop-ico:hover {
  background: rgba(255, 255, 255, 0.16);
}
.pop-ico.on {
  border-color: rgba(79, 140, 255, 0.55);
  background: rgba(79, 140, 255, 0.28);
}
.pop-ico svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.pop-more {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
}
.pop-more:hover {
  background: rgba(255, 255, 255, 0.16);
}
.pop-more svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 添加/编辑书签弹窗：可拖动标题、图标预览、底色调色板 */
#editorTitle {
  cursor: move;
  user-select: none;
}
.icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.icon-row input[name="src"] {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}
.icon-prev {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  opacity: 0.85;
}
.icon-prev img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.size-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.size-btn {
  min-width: 48px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}
.size-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}
.size-btn.on {
  border-color: rgba(79, 140, 255, 0.55);
  background: rgba(79, 140, 255, 0.28);
}
.color-input {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}
/* 当前底色文字提示（未设置时显示「未设置」） */
.color-hex {
  font-size: 12px;
  letter-spacing: 0.5px;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}
/* 未设置底色时，色块上画一道斜线表示「无」 */
.color-input.empty {
  background-image: linear-gradient(
    45deg,
    transparent 44%,
    #ff6b6b 44%,
    #ff6b6b 56%,
    transparent 56%
  );
}
.palette {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 4px 0 10px;
}
.palette button {
  flex: 1 1 0;
  min-width: 0;
  height: auto;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
/* 纯黑在深底上会融进面板、纯白容易被当成「空」：给这两格反向描边，其余色块不变 */
.palette button[title="#000000"] {
  border-color: rgba(255, 255, 255, 0.75);
}
.palette button[title="#ffffff"] {
  border-color: rgba(0, 0, 0, 0.65);
}
/* 选中的色块：放大 + 白色描边 + 蓝色光圈，一眼看出当前底色 */
.palette button.on {
  border-color: #fff;
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.9);
}
.palette button.eye {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
}
.palette button.eye svg {
  width: 12px;
  height: 12px;
}
#groupName {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  font-size: 13px;
  outline: none;
}
#groupName:focus {
  border-color: #4f8cff;
}
.pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
/* 亮色主题：新建分类/更多图标浮层（.pop）也要跟着变浅 */
[data-color-scheme="light"] .pop {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  color: #1f2328;
}
[data-color-scheme="light"] .pop .pop-ico,
[data-color-scheme="light"] .pop .pop-more {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
}
[data-color-scheme="light"] .pop .pop-ico:hover,
[data-color-scheme="light"] .pop .pop-more:hover {
  background: rgba(0, 0, 0, 0.08);
}
[data-color-scheme="light"] .pop .pop-ico.on {
  border-color: rgba(79, 140, 255, 0.55);
  background: rgba(79, 140, 255, 0.18);
}
[data-color-scheme="light"] #groupName {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.04);
}
[data-color-scheme="light"] .pop .ghost-btn {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
  color: #1f2328;
}
[data-color-scheme="light"] .pop .ghost-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}


.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40; /* 必须高于搜索框(20)与弹层(30)，否则遮盖不住（右键菜单是 50，要从浮层里弹出来） */
}
.modal-box {
  width: min(460px, 92vw);
  background: #171a1f;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-box h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.modal-box label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  opacity: 0.9;
  min-width: 0;
}
.modal-box .row {
  display: flex;
  gap: 12px;
}
.modal-box .row label {
  flex: 1;
}
.modal-box label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.modal-box h3.sub {
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
  border-top: 1px solid var(--glass-line);
  padding-top: 14px;
}
/* 文件夹浮层：玻璃面板，从被点的卡片位置放大展开（位移/缩放由 JS 写 --gv-*） */
.gv-box {
  width: min(720px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: gv-in 0.24s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes gv-in {
  from {
    opacity: 0;
    transform: translate(var(--gv-dx, 0px), var(--gv-dy, 0px)) scale(var(--gv-s, 0.35));
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.gv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
}
.gv-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 登录后标题能点改名字，给个能点的样子；浏览态不加这个类，光标保持箭头 */
.gv-title.can-rename {
  cursor: pointer;
}
.gv-title.can-rename:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gv-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* ＋（添加标签）和 × 共用一套按钮外观 */
.gv-add,
.gv-x {
  border: 1px solid var(--glass-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  width: 30px;
  height: 30px;
  font-size: 18px;
  line-height: 1;
}
.gv-add:hover,
.gv-x:hover {
  background: rgba(255, 255, 255, 0.18);
}
.gv-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, 76px);
  gap: 12px;
  justify-content: center;
  align-content: start;
  padding: 4px 16px 18px;
  overflow-y: auto;
}
.gv-tile {
  width: 76px;
}
.gv-tile.dragging {
  opacity: 0.35;
}
.gv-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.gv-link:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}
/* 图标自己的底色块（等同于桌面图标的 .gicon / .icon-img），有 bgColor 时由 JS 写在行内 */
.gv-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}
.gv-link img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.gv-link .letter {
  font-size: 18px;
}
.gv-name {
  max-width: 68px;
  font-size: 11px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gv-empty {
  grid-column: 1 / -1;
  padding: 26px 0;
  text-align: center;
  font-size: 13px;
  opacity: 0.55;
}
[data-color-scheme="light"] .gv-box {
  /* 跟 .modal-box 一样：亮色主题换浅色面板 + 深色文字，否则字在浅底上看不清 */
  --glass-line: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: #1f2328;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}
[data-color-scheme="light"] .gv-add,
[data-color-scheme="light"] .gv-x {
  background: rgba(0, 0, 0, 0.05);
}
[data-color-scheme="light"] .gv-add:hover,
[data-color-scheme="light"] .gv-x:hover {
  background: rgba(0, 0, 0, 0.12);
}
[data-color-scheme="light"] .gv-ico {
  background: rgba(0, 0, 0, 0.05);
}
[data-color-scheme="light"] .gv-link:hover {
  background: rgba(0, 0, 0, 0.1);
}
[data-color-scheme="light"] .gv-link .letter {
  color: #222;
  text-shadow: none;
}
.eng-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
}
.eng-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.eng-row input {
  flex: 1 1 100px;
  min-width: 0;
}
.eng-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.eng-empty {
  font-size: 12px;
  opacity: 0.6;
}
.modal-box input,
.modal-box select {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--fg);
  font-size: 14px;
  outline: none;
}
.modal-box input:focus {
  border-color: #4f8cff;
}
.modal-box input:-webkit-autofill,
.modal-box input:-webkit-autofill:hover,
.modal-box input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f2f4f8 !important;
  -webkit-box-shadow: 0 0 0 1000px #171a1f inset !important;
  background-color: #171a1f !important;
  border-color: rgba(255, 255, 255, 0.16);
  -webkit-transition: background-color 5000s ease-in-out, color 5000s ease-in-out;
}
/* 主题下拉：去掉原生外观，箭头和选项配色跟抽屉一致 */
#drawer .settings-box select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23a8b0bd' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
  cursor: pointer;
}
#drawer .settings-box select:focus {
  border-color: #4f8cff;
}
#drawer .settings-box select option {
  background: #1a1d22;
  color: #f2f4f8;
}
/* 亮色主题：弹窗/设置抽屉换成浅色面板（页面壁纸区域的深色玻璃保持不变） */
[data-color-scheme="light"] .modal-box {
  --glass-line: rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #1f2328;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}
[data-color-scheme="light"] .modal-box .set-tabs {
  background: rgba(0, 0, 0, 0.03);
}
[data-color-scheme="light"] .modal-box .set-tab:hover,
[data-color-scheme="light"] .modal-box .set-x:hover,
[data-color-scheme="light"] .modal-box .ghost-btn:hover {
  background: rgba(0, 0, 0, 0.07);
}
[data-color-scheme="light"] .modal-box .ghost-btn {
  background: rgba(0, 0, 0, 0.04);
  color: #1f2328;
}
[data-color-scheme="light"] .modal-box .ghost-btn.danger {
  color: #d33;
}
[data-color-scheme="light"] .modal-box input,
[data-color-scheme="light"] .modal-box select {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
  color: #1f2328;
}
[data-color-scheme="light"] .modal-box input:-webkit-autofill,
[data-color-scheme="light"] .modal-box input:-webkit-autofill:hover,
[data-color-scheme="light"] .modal-box input:-webkit-autofill:focus {
  -webkit-text-fill-color: #1f2328 !important;
  -webkit-box-shadow: 0 0 0 1000px #f5f6f8 inset !important;
  background-color: #f5f6f8 !important;
  border-color: rgba(0, 0, 0, 0.15);
}
[data-color-scheme="light"] .set-panes,
[data-color-scheme="light"] .set-tabs {
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}
[data-color-scheme="light"] .set-panes::-webkit-scrollbar-thumb,
[data-color-scheme="light"] .set-tabs::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
}
[data-color-scheme="light"] #drawer .settings-box select option {
  background: #fff;
  color: #1f2328;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.btn {
  background: #4f8cff;
  border: 0;
  color: #fff;
  border-radius: 10px;
  padding: 9px 20px;
  cursor: pointer;
  font-size: 14px;
}

/* ---------- 设置弹窗：左侧 tab + 右侧内容 ---------- */
/* 锚定左下角：避开 68px 分类栏，左 88 / 下 24；窄屏靠媒体查询收窄 */
#drawer {
  place-items: end start;
  padding: 0 20px 24px 88px;
}
@keyframes settings-in {
  from {
    opacity: 0;
    transform: translate(-6px, 14px) scale(0.97);
  }
}
#drawer:not([hidden]) .settings-box {
  transform-origin: left bottom;
  animation: settings-in 0.18s ease-out;
}
.settings-box {
  width: min(630px, 100%);
  height: min(600px, 82vh);
  padding: 0;
  gap: 0;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}
.settings-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 14px 22px;
  border-bottom: 1px solid var(--glass-line);
}
.settings-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.6px;
}
.set-x {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  opacity: 0.55;
  cursor: pointer;
}
.set-x:hover {
  background: rgba(255, 255, 255, 0.09);
  opacity: 1;
}
.settings-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.set-tabs {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 146px;
  padding: 12px 10px;
  border-right: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.025);
  overflow: auto;
}
.set-tab {
  position: relative;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  opacity: 0.68;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.set-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  opacity: 0.95;
}
.set-tab.on {
  background: rgba(79, 140, 255, 0.16);
  opacity: 1;
}
.set-tab.on::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 16px;
  margin-top: -8px;
  border-radius: 3px;
  background: #4f8cff;
}
.set-panes {
  flex: 1;
  min-width: 0;
  padding: 18px 22px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.set-panes::-webkit-scrollbar,
.set-tabs::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.set-panes::-webkit-scrollbar-thumb,
.set-tabs::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}
.set-panes::-webkit-scrollbar-thumb:hover,
.set-tabs::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}
.set-panes::-webkit-scrollbar-track,
.set-tabs::-webkit-scrollbar-track {
  background: transparent;
}
.range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
}
.range-head b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}
.set-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* 面板整体已经能滚动，引擎列表不再自己套一层滚动条 */
.set-pane .eng-editor {
  max-height: none;
  overflow: visible;
}
.set-pane .eng-row input:nth-child(2) {
  flex: 2 1 160px;
}
.set-pane h3.sub:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}
.set-tip {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  opacity: 0.6;
}
.pane-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}
.pane-actions .btn,
.pane-actions .ghost-btn {
  padding: 8px 16px;
}
.settings-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  padding: 10px 22px;
  border-top: 1px solid var(--glass-line);
}
.settings-foot .ghost-btn {
  padding: 8px 16px;
}
.settings-box input[type="range"] {
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #4f8cff;
}
.settings-box input[type="checkbox"] {
  flex: none;
  width: 15px;
  height: 15px;
  padding: 0;
  accent-color: #4f8cff;
}
.settings-box input[readonly] {
  opacity: 0.6;
  cursor: default;
}
.avatar-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 6px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.avatar-presets img {
  width: 48px;
  height: 48px;
}
.avatar-presets img:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  z-index: 1;
}
.ghost-btn.danger {
  border-color: rgba(255, 107, 107, 0.4);
  color: #ff9b9b;
}
.ghost-btn.danger:hover {
  background: rgba(255, 107, 107, 0.14);
}
.settings-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  padding: 10px 22px;
  border-top: 1px solid var(--glass-line);
}
.settings-foot .ghost-btn {
  padding: 8px 16px;
}
.bg-preview {
  height: 150px;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  background: #0f1115 center / cover no-repeat;
}
.about-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0 8px;
  text-align: center;
}
.about-logo {
  display: block;
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(79, 140, 255, 0.35), rgba(79, 140, 255, 0.06));
  padding: 4px;
}
.about-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.about-ver {
  font-size: 12px;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}
.about-desc {
  max-width: 340px;
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.8;
  opacity: 0.7;
}
.about-links {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}
.about-links span {
  opacity: 0.35;
}
.about-contact {
  margin-top: 12px;
  text-align: center;
}
.about-contact-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 13px;
}
.about-contact-item {
  font-size: 13px;
  line-height: 1.6;
}
.about-divider {
  margin: 8px 0;
  border-top: 1px solid rgba(128, 128, 128, 0.15);
}
.about-contact-custom {
  margin-top: 8px;
  font-size: 13px;
}
.about-contact-item a {
  color: var(--accent, #5fa1ff);
  text-decoration: none;
}
.about-contact-item a:hover {
  text-decoration: underline;
}
.about-beian {
  margin-top: 12px;
}
.about-beian .lab {
  margin-right: 6px;
  opacity: 0.7;
}
.notice-body {
  font-size: 13px;
  line-height: 1.7;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-line;
}

@media (max-width: 640px) {
  #drawer {
    padding: 0 12px 12px;
  }
  .settings-box {
    height: min(82vh, 560px);
  }
  .settings-body {
    flex-direction: column;
  }
  .set-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    gap: 6px;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--glass-line);
  }
  .set-tab {
    flex: 1 1 auto;
    padding: 8px 10px;
    text-align: center;
    font-size: 12.5px;
  }
  .set-tab.on::before {
    display: none;
  }
  .set-panes {
    padding: 14px 16px;
  }
  .bg-preview {
    height: 110px;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--glass-line);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 12;
}

@media (max-width: 760px) {
  .wrap {
    padding: 18px 14px 110px;
  }
  .clock-time {
    font-size: 38px;
  }
  #grid {
    column-gap: 14px;
    row-gap: 18px;
  }
  .search {
    max-width: 100%;
  }
}

/* ---------- 壁纸选择 ---------- */
.inline-field {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-field input {
  flex: 1;
}
.modal-box.wide {
  width: min(880px, 92vw);
}
.wall-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.wall-folders .ghost-btn.active {
  border-color: #4f8cff;
  color: #fff;
}
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.wall-item {
  padding: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0f1115;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  cursor: pointer;
}
.wall-item img,
.wall-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wall-item:hover {
  border-color: #4f8cff;
}
.wall-item.on {
  border-color: #4f8cff;
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.55);
}
.wall-more {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
/* ---------- 图标右键菜单 ---------- */
.ctx {
  position: fixed;
  /* 高于 .modal(40)：文件夹浮层里右键弹出的菜单不能被浮层压住，而菜单本身只在右键时出现 */
  z-index: 50;
  min-width: 176px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(28, 28, 30, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 13px;
  color: var(--fg);
  user-select: none;
}
.ctx-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.ctx-ico {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: none;
  opacity: 0.85;
}
.ctx-ico svg {
  display: block;
  width: 14px;
  height: 14px;
}
.ctx-item > span:not(.ctx-ico) {
  flex: 1;
}
/* 布局行：尺寸按钮直接排在行内，无子菜单 */
.ctx-item.ctx-layout {
  flex-wrap: wrap;
  cursor: default;
}
.ctx-item.ctx-layout:hover {
  background: transparent;
}
.ctx-sizes {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-top: 6px;
}
.ctx-size {
  flex: 1;
  padding: 4px 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 11px;
  cursor: pointer;
}
.ctx-size:hover {
  background: rgba(255, 255, 255, 0.12);
}
.ctx-size.on {
  border-color: rgba(79, 140, 255, 0.7);
  background: rgba(79, 140, 255, 0.25);
}
.ctx-item:hover {
  background: rgba(255, 255, 255, 0.12);
}
.ctx-item.on {
  color: #4f8cff;
}
.ctx-item.danger {
  color: #ff8a8a;
}
.ctx-item.has-sub::after {
  content: "›";
  opacity: 0.6;
}
.ctx-sep {
  height: 1px;
  margin: 5px 8px;
  background: rgba(255, 255, 255, 0.1);
}
.ctx-sub {
  position: absolute;
  top: -6px;
  left: 100%;
  display: none;
  margin-left: 6px;
  min-width: 132px;
  max-height: 60vh;
  overflow: auto;
  padding: 6px;
  border-radius: 12px;
  background: rgba(28, 28, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}
.ctx.left .ctx-sub {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 6px;
}
.ctx-item:hover > .ctx-sub {
  display: block;
}
/* 亮色主题：右键菜单跟着换浅色面板，否则亮色页面里是一块死黑 */
[data-color-scheme="light"] .ctx {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  color: #1f2328;
}
[data-color-scheme="light"] .ctx-sub {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}
/* 只给可点的行加 hover 底色：布局行原本就是透明的 */
[data-color-scheme="light"] .ctx-item:not(.ctx-layout):hover {
  background: rgba(0, 0, 0, 0.06);
}
[data-color-scheme="light"] .ctx-item.on {
  color: #2f6fe4;
}
[data-color-scheme="light"] .ctx-item.danger {
  color: #d33;
}
[data-color-scheme="light"] .ctx-sep {
  background: rgba(0, 0, 0, 0.1);
}
[data-color-scheme="light"] .ctx-size {
  border-color: rgba(0, 0, 0, 0.15);
}
[data-color-scheme="light"] .ctx-size:hover {
  background: rgba(0, 0, 0, 0.08);
}
[data-color-scheme="light"] .ctx-size.on {
  border-color: rgba(79, 140, 255, 0.6);
  background: rgba(79, 140, 255, 0.16);
}

/* 右侧分类边栏 */
/* 左侧分类导航条：最上头像，中间分类（图标+文字），最下设置 */
.side {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  z-index: 7;
}
.side-top,
.side-bottom {
  flex: none;
}
.side-user {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.side-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.side-avatar-letter {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 15px;
  font-weight: 600;
}
/* 账号设置头像：没有头像时露出下面的文字头像，有头像时图片盖住它 */
.acc-avatar {
  position: relative;
  width: 96px;
  height: 96px;
  margin-top: 4px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
}
.acc-avatar img {
  display: block;
  position: relative; /* 必须压住下面绝对定位的文字头像 */
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #333;
}
.acc-avatar img[src=""] { display: none; }
.acc-avatar-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.side-list {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  scrollbar-width: none;
}
.side-list::-webkit-scrollbar {
  display: none;
}
.side-item {
  position: relative;
  width: 100%;
}
/* 拖动排序：被拖行变淡，落点用一条插入线标出（顶边 = 插到这行前面，底边 = 后面） */
.side-item[draggable="true"] .side-name {
  cursor: grab;
}
.side-item.dragging {
  opacity: 0.4;
}
.side-item.dragging .side-name {
  cursor: grabbing;
}
.side-item::before,
.side-item::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: #7dabff;
  box-shadow: 0 0 6px rgba(79, 140, 255, 0.8);
  opacity: 0;
  pointer-events: none;
}
.side-item::before {
  top: -3px;
}
.side-item::after {
  bottom: -3px;
}
.side-item.over-top::before,
.side-item.over-bot::after {
  opacity: 1;
}
/* 亮色主题下侧栏更亮，换成更深一点的蓝、去掉发光 */
[data-color-scheme="light"] .side-item::before,
[data-color-scheme="light"] .side-item::after {
  background: #2f6fe4;
  box-shadow: none;
}
.side-item.on .side-name {
  background: rgba(79, 140, 255, 0.28);
}
.side-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 7px 1px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.side-ico svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: currentColor;
  opacity: 0.85;
}
.side-label {
  max-width: 100%;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-ops {
  display: none;
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(20, 22, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  z-index: 2;
}
.side-item:hover .side-ops {
  display: flex;
}
.side-item.dragging .side-ops {
  display: none;
}
.side-op {
  padding: 2px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  opacity: 0.75;
  cursor: pointer;
}
.side-op:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}
.side-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.side-add,
.side-gear {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.side-add:hover,
.side-gear:hover {
  background: rgba(255, 255, 255, 0.18);
}
@media (min-width: 901px) {
  .wrap {
    padding-left: 90px;
  }
}
@media (max-width: 900px) {
  .side {
    display: none;
  }
}

/* 切到更下面的分类：内容从底部升起；切到更上面的分类：内容从顶部落下 */
@keyframes icon-rise {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
}
@keyframes icon-drop {
  from {
    opacity: 0;
    transform: translateY(-28px);
  }
}
#grid.slide-up .icon {
  animation: icon-rise 0.36s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
#grid.slide-down .icon {
  animation: icon-drop 0.36s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  #grid.slide-up .icon,
  #grid.slide-down .icon {
    animation: none;
  }
}

#login .modal-box {
  width: min(92vw, 420px);
  text-align: center;
}
#login label {
  display: block;
  margin-bottom: 12px;
  text-align: left;
}
#login label input {
  display: block;
  width: 100%;
  margin-top: 6px;
}
#login .login-msg {
  min-height: 18px;
  margin: 0 0 8px;
  font-size: 13px;
  color: #ff8a8a;
}
#login .auth-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
#login .auth-tab {
  flex: 1;
  padding: 8px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  opacity: 0.55;
  cursor: pointer;
  text-align: center;
}
#login .auth-tab.on {
  border-bottom-color: #4f8cff;
  background: transparent;
  opacity: 1;
}
#login .code-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
#login .code-row input {
  flex: 1;
  margin-top: 0;
}
#login .code-btn {
  flex: none;
  padding: 0 12px;
  font-size: 13px;
}
